edulink-api / Exports / Edulink_API
This class is the main API class. It is an abstracton of the Edulink_Raw class. If you require more granular control over the API, you can use the Edulink_Raw class directly.
• new Edulink_API()
• Edulink_Raw: Edulink_Raw
This is the Edulink_Raw instance that is used to make all the requests to the edulink api
• Maps: Object
This is used to store maps from ids to objects
| Name | Type | Description |
|---|---|---|
community_group_id_to_community_group |
Map<string, { name: string }> |
Maps from community group id to community_group |
form_group_id_to_form_group |
Map<string, { employee_id: string ; name: string ; room: { code: string ; name: string } ; year_group_ids: string[] }> |
Maps from form group id to form_group |
period_id_to_lesson |
Map<number, Edulink_Timetable_Lesson> |
Maps from period id to lesson, this is populated in {@link Edulink_API.getTimetable} |
room_id_to_room |
Map<string, { code: string ; name: string }> |
Maps from room id to room |
teaching_group_id_to_teaching_group |
Map<string, { employee_id: string ; name: string }> |
Maps from teaching group id to teaching_group |
year_group_id_to_year_group |
Map<string, { code: string ; name: string }> |
Maps from year group id to year_group |
• Raw_Responses: Object
This is used to store the raw_responses from the api calls
| Name | Type |
|---|---|
Homework_Raw_Response? |
Edulink_Homework |
Login_Raw_Response? |
Edulink_Login |
School_FromCode_Raw_Response? |
School_FromCode |
Timetable_Raw_Responses |
Edulink_Timetable[] |
• isAuthenticated: boolean
Whether the Edulink_API instance has been authenticated
• keepAlive: undefined | Timeout
If this is true the server will be pinged every 5 minutes to keep the session alive
• userPermissions: Object
The full list of permissions the user has can be viewed in this.Raw_Responses.Login_Raw_Response.result.capabilities
This is defined when Edulink_API.Authenticate is called
| Name | Type |
|---|---|
can_change_password |
boolean |
can_create_achievement |
boolean |
can_create_behaviour |
boolean |
can_create_club |
boolean |
can_create_homework |
boolean |
can_create_messages |
boolean |
▸ Authenticate(param0, keepAlive?): Promise<[forename: string, surname: string, avatar: Object]>
| Name | Type | Default value | Description |
|---|---|---|---|
param0 |
Object |
undefined |
The school_code, username and password to use to authenticate, if you don't know your school_code your school's postcode can also be used |
param0.password |
string |
undefined |
- |
param0.school_code |
string |
undefined |
- |
param0.username |
string |
undefined |
- |
keepAlive |
boolean |
false |
Edulink_API.keepAlive |
Promise<[forename: string, surname: string, avatar: Object]>
A promise that resolves to an array of [forename, surname, avatar]
▸ Homework(includeCurrent?, includePast?): Promise<{ available_date: string ; completed: boolean ; description: string ; due_date: string ; due_text: string ; set_by: string ; status: string ; subject: string ; title: string ; mark_complete: () => Promise<any> ; mark_incomplete: () => Promise<any> }[]>
Gets the homework for the authenticated user
| Name | Type | Default value | Description |
|---|---|---|---|
includeCurrent |
boolean |
true |
Whether to include currently set homeworks |
includePast |
boolean |
false |
Whether to include past homeworks |
Promise<{ available_date: string ; completed: boolean ; description: string ; due_date: string ; due_text: string ; set_by: string ; status: string ; subject: string ; title: string ; mark_complete: () => Promise<any> ; mark_incomplete: () => Promise<any> }[]>
An array of objects that represent a homework
▸ Timetable(startDate?, endDate?, includeOverflow?): Promise<{ date: string ; day_name: string ; lessons: { end_time: string ; lesson_name: string ; lesson_room: string ; period_name: string ; start_time: string ; teacher: string }[] }[]>
Returns the timetable of the user from a given date
| Name | Type | Default value | Description |
|---|---|---|---|
startDate? |
string |
undefined |
A date in the format YYYY-MM-DD to start the events in the timetable from |
endDate? |
string |
undefined |
A date in the format YYYY-MM-DD to end the timetable in the timetable from |
includeOverflow |
boolean |
false |
Include events that are outside the end dates included because they are in the same week as the end date, this is ony used if endDate is provided |
Promise<{ date: string ; day_name: string ; lessons: { end_time: string ; lesson_name: string ; lesson_room: string ; period_name: string ; start_time: string ; teacher: string }[] }[]>
An array of objects that represent a date and its events