GoSkola24API/cmd/goskola24api/main.go

60 lines
1,008 B
Go
Raw Normal View History

2024-11-21 18:41:28 +01:00
package main
import (
"fmt"
2024-11-26 17:04:32 +01:00
goskola24api "git.zervo.org/zervo/goskola24api"
"git.zervo.org/zervo/goskola24api/internal/utility"
2024-11-21 18:41:28 +01:00
)
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 {
2024-11-22 07:50:57 +01:00
fmt.Println(school.Name)
if school.AvailableData.HasCourses {
fmt.Println("School has data")
}
2024-11-21 18:41:28 +01:00
}
rooms, err := api.GetRooms(schools[4], true)
if err != nil {
fmt.Println(err.Error())
}
for _, room := range rooms {
fmt.Println(room.Name)
}
2024-11-21 20:24:24 +01:00
teachers, err := api.GetTeachers(schools[4], true)
if err != nil {
fmt.Println(err.Error())
}
for _, teacher := range teachers {
fmt.Println(teacher.FullName)
}
2024-11-22 07:50:57 +01:00
classes, err := api.GetClasses(schools[4], true)
2024-11-21 20:24:24 +01:00
if err != nil {
fmt.Println(err.Error())
}
2024-11-22 07:50:57 +01:00
for _, class := range classes {
fmt.Println(class.Name)
}
2024-11-21 20:24:24 +01:00
2024-11-21 18:41:28 +01:00
fmt.Println(key)
}