Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Course ¶
type Course struct { NameLong string `json:"nameLong"` NameShort string `json:"nameShort"` ProfessorLong string `json:"professorLong"` ProfessorShort string `json:"professorShort"` Room string `json:"room"` Lesson Lesson `json:"lesson"` Time Time `json:"time"` }
Course represents a single course of a timetable for a DegreeProgram.
type Degree ¶
type Degree string
Degree is used to describe a DegreeProgram, either Bachelor or Master.
type DegreeProgram ¶
type DegreeProgram struct { ID ID `json:"id"` Name string `json:"name"` Degree Degree `json:"degree"` Semester Semester `json:"semester"` }
DegreeProgram represents a degree program for which a timetable is available.
func DegreePrograms ¶
func DegreePrograms(cycle SemesterCycle) ([]DegreeProgram, error)
DegreePrograms returns all degree programs for which timetables are available and that fall into the given cycle. If the HTML could not be parsed, an error is returned.
type ID ¶
type ID string
ID is the internal ID of each DegreeProgram returned by DegreePrograms. It is needed to fetch the timetable for a given DegreeProgram.
type Semester ¶
type Semester struct { Cycle SemesterCycle `json:"cycle"` Year int `json:"year"` Term int `json:"term"` }
Semester is used to describe the accompanying DegreeProgram.
type SemesterCycle ¶
type SemesterCycle string
SemesterCycle represents the type of a Semester, either Summer or Winter.
const ( Summer SemesterCycle = "Summer" Winter SemesterCycle = "Winter" )
type Time ¶
type Time struct { Weekday time.Weekday `json:"weekday"` HourStart int `json:"hourStart"` HourEnd int `json:"hourEnd"` }
Time represents the day, start and end of a Course.
type Timetable ¶
type Timetable struct { // Can be nil, use FillDegreeProgram to fill the value, or if you obtained // the right DegreeProgram through calling DegreePrograms prior to calling // TimetableForDegreeProgram you can set the instance yourself. DegreeProgram *DegreeProgram `json:"degreeProgram"` Days []TimetableDay `json:"days"` // contains filtered or unexported fields }
Timetable contains all days for which courses exist as well as a DegreeProgram for which the timetable is valid.
func TimetableForDegreeProgram ¶
TimetableForDegreeProgram returns a Timetable that contains all courses for the given degree program. The days inside Timetable are sorted by their weekday and the courses inside each day are sorted by their start hour. The ID can be obtained by calling DegreePrograms.
func (*Timetable) FillDegreeProgram ¶
FillDegreeProgram calls DegreePrograms at most one time to obtain the correct DegreeProgram. The reason that t.DegreeProgram can be nil is as follows: If the function TimetableForDegreeProgram is called there is no way to know which semester the passed in ID belongs to; the server defaults to Winter. Now if the ID belongs to Winter then the DegreeProgram can be found and parsed within one request but if it belongs to Summer then the response we get does not contain the DegreeProgram, only the timetable for it and another request has to be made.
type TimetableDay ¶
type TimetableDay struct { Weekday time.Weekday `json:"weekday"` Courses []Course `json:"courses"` }
TimetableDay contains all courses for a Weekday for an accompanying Timetable.