Documentation
¶
Index ¶
- Constants
- func FetchAndDecode(url string, target interface{}) error
- func GetSectionDetailRaw(year string, term string, dept string, number string, section string) (SectionDetailRaw, error)
- func ProcessAndWriteOutlines(outlineMap map[string]model.CourseOutline, destPath string) error
- func ProcessTerm(year string, term string, ...) error
- func ToCourseWithSectionDetails(sectionDetailRawArr []SectionDetailRaw) mo.Option[CourseWithSectionDetails]
- func TransformDate(inputDate string) (string, error)
- type CourseRes
- type DepartmentRes
- type OutlineRes
- type SectionRes
Constants ¶
View Source
const (
BaseURL = "http://www.sfu.ca/bin/wcm/course-outlines"
)
Variables ¶
This section is empty.
Functions ¶
func FetchAndDecode ¶
fetchAndDecode makes an HTTP GET request and decodes the JSON response
func GetSectionDetailRaw ¶
func GetSectionDetailRaw(year string, term string, dept string, number string, section string) (SectionDetailRaw, error)
GetSectionDetailRaw fetches the course outline for a given section
func ProcessAndWriteOutlines ¶
func ProcessAndWriteOutlines(outlineMap map[string]model.CourseOutline, destPath string) error
ProcessAndWriteOutlines takes a map of course outlines and a destination path, processes the data (filters, sorts), and writes it to a JSON file
func ProcessTerm ¶
func ProcessTerm(year string, term string, courseMap mo.Either[map[string]model.CourseOutline, map[string]model.CourseWithSectionDetails]) error
ProcessTerm handles all the fetching for a single term
func ToCourseWithSectionDetails ¶
func ToCourseWithSectionDetails(sectionDetailRawArr []SectionDetailRaw) mo.Option[CourseWithSectionDetails]
ToCourseWithSectionDetails converts an array of SectionDetailRaw to CourseWithSectionDetails
func TransformDate ¶
Types ¶
type CourseRes ¶
type DepartmentRes ¶
type DepartmentRes struct {
Name string `json:"name"` // CMPT
Value string `json:"value"` // Computing Science
}
func GetDepartments ¶
func GetDepartments(year string, term string) ([]DepartmentRes, error)
GetDepartments fetches all departments for a given term
type OutlineRes ¶
type OutlineRes struct {
Info CourseOutline `json:"info"`
}
func GetCourseOutline ¶
func GetCourseOutline(year string, term string, dept string, number string, section string) (OutlineRes, error)
GetCourseOutline fetches the course outline for a given section
type SectionRes ¶
type SectionRes struct {
Title string `json:"title"` // D100
Value string `json:"value"` // Data Structures and Programming
}
func GetSections ¶
GetSections fetches all sections for a given course
Directories
¶
| Path | Synopsis |
|---|---|
|
This file should be saved as scripts/fetchSections/main.go
|
This file should be saved as scripts/fetchSections/main.go |
Click to show internal directories.
Click to hide internal directories.