utils

package
v0.0.0-...-5325adf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BaseURL = "http://www.sfu.ca/bin/wcm/course-outlines"
)

Variables

This section is empty.

Functions

func FetchAndDecode

func FetchAndDecode(url string, target interface{}) error

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

func TransformDate(inputDate string) (string, error)

Types

type CourseRes

type CourseRes struct {
	Title string `json:"title"` // 225
	Value string `json:"value"` // Data Structures and Programming
}

func GetCourses

func GetCourses(year string, term string, dept string) ([]CourseRes, error)

GetCourses fetches all courses for a given department in a term

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

func GetSections(year string, term string, dept string, number string) ([]SectionRes, error)

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL