GoSkola24API/cmd/goskola24api/main.go
2024-12-09 19:12:24 +01:00

68 lines
1.2 KiB
Go

package main
import (
"fmt"
goskola24api "git.zervo.org/zervo/goskola24api"
"git.zervo.org/zervo/goskola24api/internal/utility"
)
func main() {
key, _ := utility.GetRendererKey()
api := goskola24api.Skola24API{
Host: "avesta.skola24.se",
}
_, err := api.GetTerms()
if err != nil {
fmt.Println(err.Error())
}
schools, _ := api.GetSchools()
for _, school := range schools {
fmt.Println(school.Name)
if school.AvailableData.HasCourses {
fmt.Println("School has data")
}
}
terms, _ := api.GetTerms()
rooms, err := api.GetRooms(schools[4], true)
if err != nil {
fmt.Println(err.Error())
}
for _, room := range rooms {
fmt.Println(room.Name)
}
teachers, err := api.GetTeachers(schools[4], true)
if err != nil {
fmt.Println(err.Error())
}
for _, teacher := range teachers {
fmt.Println(teacher.FullName)
}
classes, err := api.GetClasses(schools[4], true)
if err != nil {
fmt.Println(err.Error())
}
for _, class := range classes {
fmt.Println(class.Name)
}
fmt.Println(key)
schedule, err := api.GetWeekSchedule(2024, 50, schools[4], terms.ActiveTerms[0], classes[0])
if err != nil {
fmt.Println(err.Error())
}
fmt.Println(schedule)
}