From aa7c403e60ac526810253de12eb874ef8a038b1b Mon Sep 17 00:00:00 2001 From: zervo Date: Tue, 10 Dec 2024 11:57:18 +0100 Subject: [PATCH] Add godoc --- types/classes.go | 25 +++++++++++++------------ types/rooms.go | 7 ++++--- types/schedules.go | 36 ++++++++++++++++++++++++++++++++++++ types/schools.go | 28 +++++++++++++++------------- types/teachers.go | 19 ++++++++++--------- types/terms.go | 14 ++++++++------ 6 files changed, 86 insertions(+), 43 deletions(-) create mode 100644 types/schedules.go diff --git a/types/classes.go b/types/classes.go index 488f308..e0a1db0 100644 --- a/types/classes.go +++ b/types/classes.go @@ -24,17 +24,18 @@ along with this program. If not, see . package types +// Holds data about a class, which is usually a group of people studying a subject together type Class struct { - Name string `json:"name"` - ClassId string `json:"classId"` - AbsenceMessageNotDeliveredCount int `json:"absenceMessageNotDeliveredCount"` - IsResponsible bool `json:"isResponsible"` - IsClass bool `json:"isClass"` - IsAdmin bool `json:"isAdmin"` - IsPrincipal bool `json:"isPrincipal"` - IsMentor bool `json:"isMentor"` - IsPreschoolGroup bool `json:"isPreschoolGroup"` - Teachers any `json:"teachers"` // TODO: MAKE TYPED - SubstituteTeacherId string `json:"substituteTeacherId"` - TeacherChangeStudents int `json:"teacherChangeStudents"` + Name string `json:"name"` // Friendly-name of the class + ClassId string `json:"classId"` // UUID identifying the class + AbsenceMessageNotDeliveredCount int `json:"absenceMessageNotDeliveredCount"` // Purpose unknown + IsResponsible bool `json:"isResponsible"` // Purpose unknown + IsClass bool `json:"isClass"` // Purpose unknown + IsAdmin bool `json:"isAdmin"` // Purpose unknown + IsPrincipal bool `json:"isPrincipal"` // Purpose unknown + IsMentor bool `json:"isMentor"` // Purpose unknown + IsPreschoolGroup bool `json:"isPreschoolGroup"` // Purpose unknown + Teachers any `json:"teachers"` // Teachers for the class. TODO: MAKE TYPED + SubstituteTeacherId string `json:"substituteTeacherId"` // Teacher ID of the substitute teacher, if any + TeacherChangeStudents int `json:"teacherChangeStudents"` // Purpose unknown } diff --git a/types/rooms.go b/types/rooms.go index acefb2a..d03e0b5 100644 --- a/types/rooms.go +++ b/types/rooms.go @@ -24,8 +24,9 @@ along with this program. If not, see . package types +// Holds data about a room; a physical location within a school type Room struct { - Name string `json:"name"` - RoomId string `json:"roomId"` - External bool `json:"external"` + Name string `json:"name"` // Name describing the room + RoomId string `json:"roomId"` // UUID identifying the room + External bool `json:"external"` // Whether or not the room is external (purpose unknown) } diff --git a/types/schedules.go b/types/schedules.go new file mode 100644 index 0000000..ba867e5 --- /dev/null +++ b/types/schedules.go @@ -0,0 +1,36 @@ +/* +GoSkola24API +Copyright (C) 2024, Zervó Zadachin + +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License version 3 +as published by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License version 3 for more details. + +This program incorporates external libraries for certain functionalities. +These libraries are covered by their respective licenses, and their usage +agreements are as outlined in their respective documentation or source +code. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . +*/ + +package types + +import "time" + +// Holds data about a lesson, usually occurring once a week +type Lesson struct { + LessonId string `json:"lessonId"` // UUID identifying the lesson + DayOfWeek int `json:"dayOfWeek"` // Day of the week where lesson occurs (monday=1) + Start time.Time `json:"start"` // Time when the lesson starts + End time.Time `json:"end"` // Time when the lesson ends + Texts []string `json:"texts"` // Extra texts that may be displayed on timetable +} diff --git a/types/schools.go b/types/schools.go index b649547..d4875ba 100644 --- a/types/schools.go +++ b/types/schools.go @@ -24,21 +24,23 @@ along with this program. If not, see . package types +// Holds data about a school type School struct { - Name string `json:"name"` - SchoolId string `json:"schoolId"` - HostName string `json:"hostName"` - AllowCalendarExport bool `json:"allowCalendarExport"` - AvailableData DataAvailability `json:"availableData"` + Name string `json:"name"` // Friendly-name of the school + SchoolId string `json:"schoolId"` // UUID identifying the school + HostName string `json:"hostName"` // The hostname (domain) that the school belongs to + AllowCalendarExport bool `json:"allowCalendarExport"` // Whether traditional calendar export is allowed, does not affect this module + AvailableData DataAvailability `json:"availableData"` // The types of data that the school provides } +// Defines data availability, showing what type of data can be retrieved from an entity type DataAvailability struct { - HasClasses bool `json:"hasClasses"` - HasCourses bool `json:"hasCourses"` - HasGroups bool `json:"hasGroups"` - HasResources bool `json:"hasResources"` - HasRooms bool `json:"hasRooms"` - HasStudents bool `json:"hasStudents"` - HasSubjects bool `json:"hasSubjects"` - HasTeachers bool `json:"hasTeachers"` + HasClasses bool `json:"hasClasses"` // Whether the school provides class data + HasCourses bool `json:"hasCourses"` // Whether the school provides course data + HasGroups bool `json:"hasGroups"` // Whether the school provides group data + HasResources bool `json:"hasResources"` // Whether the school provides resource data + HasRooms bool `json:"hasRooms"` // Whether the school provides room data + HasStudents bool `json:"hasStudents"` // Whether the school provides student data + HasSubjects bool `json:"hasSubjects"` // Whether the school provides subject data + HasTeachers bool `json:"hasTeachers"` // Whether the school provides teacher data } diff --git a/types/teachers.go b/types/teachers.go index 58e4880..7cab4ef 100644 --- a/types/teachers.go +++ b/types/teachers.go @@ -24,14 +24,15 @@ along with this program. If not, see . package types +// Holds data about a teacher type Teacher struct { - FirstName string `json:"firstName"` - LastName string `json:"lastName"` - FullName string `json:"fullName"` - FriendlyId string `json:"friendlyId"` - TeacherId string `json:"teacherId"` - IsActive bool `json:"isActive"` - Integrity bool `json:"integrity"` - Reported bool `json:"reported"` - ReadOnly bool `json:"readOnly"` + FirstName string `json:"firstName"` // Teacher's first name + LastName string `json:"lastName"` // Teacher's last name + FullName string `json:"fullName"` // Teacher's full name, usually including their initials + FriendlyId string `json:"friendlyId"` // Friendly-ID of the teacher, usually their initials + TeacherId string `json:"teacherId"` // UUID identifying the teacher + IsActive bool `json:"isActive"` // Purpose unknown + Integrity bool `json:"integrity"` // Purpose unknown + Reported bool `json:"reported"` // Purpose unknown + ReadOnly bool `json:"readOnly"` // Purpose unknown } diff --git a/types/terms.go b/types/terms.go index 4c2fedf..bee2866 100644 --- a/types/terms.go +++ b/types/terms.go @@ -24,14 +24,16 @@ along with this program. If not, see . package types +// Holds data about a school term, aka semester type SchoolTerm struct { - Start string `json:"start"` - TermId string `json:"termId"` - Name string `json:"name"` - End string `json:"end"` + Start string `json:"start"` // Start-date of the term + TermId string `json:"termId"` // UUID identifying the term + Name string `json:"name"` // Friendly-name of the term + End string `json:"end"` // End-date of the term } +// Holds a list of active school terms type Terms struct { - ActiveTerms []SchoolTerm `json:"activeSchoolYears"` - UseSchoolYearsFeatures bool `json:"useSchoolYearsFeatures"` + ActiveTerms []SchoolTerm `json:"activeSchoolYears"` // List of active terms + UseSchoolYearsFeatures bool `json:"useSchoolYearsFeatures"` // Purpose unknown }