54 lines
1.7 KiB
Go
54 lines
1.7 KiB
Go
/*
|
|
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 <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
package requests
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"git.zervo.org/zervo/goskola24api/internal/types"
|
|
"git.zervo.org/zervo/goskola24api/internal/utility"
|
|
pubtypes "git.zervo.org/zervo/goskola24api/types"
|
|
)
|
|
|
|
func GetGenericSelection(school pubtypes.School, filters types.RequestFilters) (_result map[string]interface{}, _error error) {
|
|
request := types.RequestSelectionBase{
|
|
HostName: school.HostName,
|
|
UnitGuid: school.SchoolId,
|
|
Filters: filters,
|
|
}
|
|
|
|
response, err := utility.Request(request, "get/timetable/selection")
|
|
if err != nil {
|
|
return nil, errors.New("could not get selection: " + err.Error())
|
|
}
|
|
|
|
// Assert the response type to a map[string]interface{}
|
|
responseMap, ok := response.(map[string]interface{})
|
|
if !ok {
|
|
return nil, errors.New("unexpected response type")
|
|
}
|
|
|
|
return responseMap, nil
|
|
}
|