Documentation ¶
Index ¶
- func GetAllEvents(cookies string, schoolId string) ([]types.ActionCentreEvent, error)
- func GetAllLocations(cookies string, schoolId string) ([]types.LC, error)
- func GetAllStaff(cookies string, schoolId string, userId float64) ([]types.User, error)
- func GetAttendanceSummary(cookies string, schoolId string, userId float64, startDate time.Time, ...) ([]types.SL, error)
- func GetCalendarEventsByUser(cookies string, schoolId string, userId float64, startDate time.Time, ...) ([]types.CalendarTransport, error)
- func GetEvents(cookies string, schoolId string) ([]types.ActionCentreEvent, error)
- func GetNewsItems(cookies string, schoolId string) ([]types.NewsItem, error)
- func Login(username string, password string, schoolId string) (cookies string, userId float64, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAllEvents ¶ added in v0.0.2
func GetAllEvents(cookies string, schoolId string) ([]types.ActionCentreEvent, error)
func GetAllStaff ¶
GetAllStaff retrieves a list of all staff members from the Compass Education API.
The function takes the provided session 'cookies', 'schoolId', and 'userId' to make a request to the Compass Education API and fetch all staff members.
Parameters:
- cookies: Session cookies for authentication.
- schoolId: The unique identifier for the school.
- userId: The user ID associated with the request.
Returns:
- []types.User: A slice containing information about all staff members in the form of 'types.User'.
- error: An error, if any, that occurred during the API request or processing of the response.
Example:
cookies := "your_session_cookies_here" schoolId := "your_school_id_here" userId := 12345 staffMembers, err := getAllStaff(cookies, schoolId, userId) if err != nil { log.Fatal(err) } // Use 'staffMembers' as needed.
func GetAttendanceSummary ¶ added in v0.0.3
func GetCalendarEventsByUser ¶
func GetCalendarEventsByUser(cookies string, schoolId string, userId float64, startDate time.Time, endDate time.Time) ([]types.CalendarTransport, error)
getCalendarEventsByUser retrieves calendar events for a specified user within a date range.
The function takes the provided session 'cookies', 'schoolId', 'userId', 'startDate', and 'endDate' to make a request to the Compass Education API and fetch calendar events for the specified user within the given date range.
Parameters:
- cookies: Session cookies for authentication.
- schoolId: The unique identifier for the school.
- userId: The user ID for whom the calendar events are to be retrieved.
- startDate: The start date of the range for which calendar events are requested.
- endDate: The end date of the range for which calendar events are requested.
Returns:
- []types.CalendarTransport: A slice of calendar events in the form of 'types.CalendarTransport'.
- error: An error, if any, that occurred during the API request or processing of the response.
Example:
cookies := "your_session_cookies_here" schoolId := "your_school_id_here" userId := 12345 startDate := time.Date(2022, time.January, 1, 0, 0, 0, 0, time.UTC) endDate := time.Date(2022, time.December, 31, 23, 59, 59, 999999999, time.UTC) events, err := getCalendarEventsByUser(cookies, schoolId, userId, startDate, endDate) if err != nil { log.Fatal(err) } // Use 'events' as needed.
func GetEvents ¶ added in v0.0.2
func GetEvents(cookies string, schoolId string) ([]types.ActionCentreEvent, error)
func Login ¶
func Login(username string, password string, schoolId string) (cookies string, userId float64, err error)
Login authenticates a user with Compass Education API and returns session cookies and user ID.
The function takes the provided 'username', 'password', and 'schoolId' to authenticate the user. It utilizes the Compass Education API to perform the authentication.
Parameters:
- username: The username of the user.
- password: The password of the user.
- schoolId: The unique identifier for the school.
Returns:
- cookies: A semicolon-separated string containing session cookies.
- userId: The user ID obtained after successful authentication.
- err: An error, if any, that occurred during the authentication process.
Example:
cookies, userId, err := Login("exampleUsername", "examplePassword", "exampleSchoolID") if err != nil { log.Fatal(err) } // Use cookies and userId as needed.
Types ¶
This section is empty.