Constructor
new SMHWClient(options)
Instantiate a SMHW Client.
Name | Type | Description |
---|---|---|
options |
Object | Options to instantiate the client with. |
Members
(private) _auth :ClientAuthentication
Authentication information for the client.
(private) _heartbeat :Number
The active client heartbeat.
- Number
(private) _last_heartbeat :Number
The timestamp of the last heartbeat.
- Number
(private) _options :Object
Options for the client.
- Object
school :School
The school that the student user of the client belongs to.
student :Student
The student user of the client.
user :UserPrivateInformation
Private information of the client user.
Methods
getAttachment(id) → {Promise.<Attachment>}
Get an attachment by ID.
Name | Type | Description |
---|---|---|
id |
Number | The ID of the attachment to retrieve. |
- Type
- Promise.<Attachment>
getAttachments(ids) → {Promise.<Array.<Attachment>>}
Get attachments by IDs.
Name | Type | Description |
---|---|---|
ids |
Array.<Number> | An array of attachment IDs to retrieve. |
- Type
- Promise.<Array.<Attachment>>
getClassGroup(id) → {Promise.<ClassGroup>}
Get a class group by ID.
Name | Type | Description |
---|---|---|
id |
Number | The ID of the class group to retrieve. |
- Type
- Promise.<ClassGroup>
getClassGroups(ids) → {Promise.<Array.<ClassGroup>>}
Get class groups by IDs.
Name | Type | Description |
---|---|---|
ids |
Array.<Number> | An array of class group IDs to retrieve. |
- Type
- Promise.<Array.<ClassGroup>>
getEmployee(id) → {Promise.<Employee>}
Get an employee by ID.
Name | Type | Description |
---|---|---|
id |
Number | The ID of the employee to retrieve. |
- Type
- Promise.<Employee>
getEmployees(ids) → {Promise.<Array.<Employee>>}
Get employees by IDs.
Name | Type | Description |
---|---|---|
ids |
Array.<Number> | An array of employee IDs to retrieve. |
- Type
- Promise.<Array.<Employee>>
getEvent(id) → {Promise.<ClientEvent>}
Get a client event by ID.
Name | Type | Description |
---|---|---|
id |
Number | The ID of the event to retrieve. |
- Type
- Promise.<ClientEvent>
getEvents(ids) → {Promise.<Array.<ClientEvent>>}
Get client events.
Name | Type | Description |
---|---|---|
ids |
Array.<Number> | An array of Event IDs to retrieve. |
- Type
- Promise.<Array.<ClientEvent>>
getFlexibleTask(id) → {Promise.<FlexibleTask>}
Get a flexible task assignment by ID.
Name | Type | Description |
---|---|---|
id |
Number | The ID of the flexible task assignment to retrieve. |
- Type
- Promise.<FlexibleTask>
getFlexibleTasks(ids) → {Promise.<Array.<FlexibleTask>>}
Get flexible task assignments by IDs.
Name | Type | Description |
---|---|---|
ids |
Array.<Number> | An array of flexible task IDs to retrieve. |
- Type
- Promise.<Array.<FlexibleTask>>
getFlexibleTaskSubmission(id) → {Promise.<FlexibleTaskSubmission>}
Get a flexible task submission by ID.
Name | Type | Description |
---|---|---|
id |
Number | The ID of the flexible task submission to retrieve. |
- Type
- Promise.<FlexibleTaskSubmission>
getFlexibleTaskSubmissions(ids) → {Promise.<Array.<FlexibleTaskSubmission>>}
Get homework submissions by IDs.
Name | Type | Description |
---|---|---|
ids |
Array.<Number> |
- Type
- Promise.<Array.<FlexibleTaskSubmission>>
getHomework(id) → {Promise.<Homework>}
Get a homework assignment by ID.
Name | Type | Description |
---|---|---|
id |
Number | The ID of the homework assignment to retrieve. |
- Type
- Promise.<Homework>
getHomeworks(ids) → {Promise.<Array.<Homework>>}
Get homework assignments by IDs.
Name | Type | Description |
---|---|---|
ids |
Array.<Number> | An array of homework IDs to retrieve. |
- Type
- Promise.<Array.<Homework>>
getHomeworkSubmission(id) → {Promise.<HomeworkSubmission>}
Get a homework submission by ID.
Name | Type | Description |
---|---|---|
id |
Number | The ID of the homework submission to retrieve. |
- Type
- Promise.<HomeworkSubmission>
getHomeworkSubmissions(ids) → {Promise.<Array.<HomeworkSubmission>>}
Get homework submissions by IDs.
Name | Type | Description |
---|---|---|
ids |
Array.<Number> |
- Type
- Promise.<Array.<HomeworkSubmission>>
getOwnEvents(options, ids) → {Promise.<Array.<ClientEvent>>}
Get client events fired for the client user.
Name | Type | Description |
---|---|---|
options |
Object | Event request options. |
ids |
Array.<Number> | An array of event IDs to retrieve. |
- Type
- Promise.<Array.<ClientEvent>>
getSchool(id) → {Promise.<School>}
Get a school by ID.
Name | Type | Description |
---|---|---|
id |
Number | The ID of the school to retrieve. |
- Type
- Promise.<School>
getStandardSubjects(ids) → {Promise.<Array.<StandardSubject>>}
Get standard subjects on SMHW.
Name | Type | Description |
---|---|---|
ids |
Array.<Number> | An array of standard subject IDs to retrieve. |
- Type
- Promise.<Array.<StandardSubject>>
getStudent(id) → {Promise.<Student>}
Get a student by ID.
Name | Type | Description |
---|---|---|
id |
Number | The ID of the student to retrieve. |
- Type
- Promise.<Student>
getStudents(ids) → {Promise.<Array.<Student>>}
Get students by IDs.
Name | Type | Description |
---|---|---|
ids |
Array.<Number> | An array of Student IDs to retrieve. |
- Type
- Promise.<Array.<Student>>
getSubmissionComment(id) → {Promise.<SubmissionComment>}
Get a submission comment by ID.
Name | Type | Description |
---|---|---|
id |
Number | The ID of the submission comment to retrieve. |
- Type
- Promise.<SubmissionComment>
getSubmissionComments(ids) → {Promise.<Array.<SubmissionComment>>}
Get submission commenst by IDs.
Name | Type | Description |
---|---|---|
ids |
Array.<Number> | An array of submission comment IDs to retrieve. |
- Type
- Promise.<Array.<SubmissionComment>>
getSubmissionEvent(id) → {Promise.<SubmissionEvent>}
Get a submission event by ID.
Name | Type | Description |
---|---|---|
id |
Number | The ID of the submission event to retrieve. |
- Type
- Promise.<SubmissionEvent>
getSubmissionEvents(ids) → {Promise.<Array.<SubmissionEvents>>}
Get submission events by IDs.
Name | Type | Description |
---|---|---|
ids |
Array.<Number> | An array of submission event IDs to retrieve. |
- Type
- Promise.<Array.<SubmissionEvents>>
getSubmissionMethods(ids) → {Promise.<Array.<SubmissionMethod>>}
Get submission methods on SMHW.
Name | Type | Description |
---|---|---|
ids |
Array.<Number> | An array of submission method IDs to retrieve. |
- Type
- Promise.<Array.<SubmissionMethod>>
getTask(id) → {Promise.<Task>}
Get a task by ID.
Name | Type | Description |
---|---|---|
id |
Number | The ID of the task to retrieve. |
- Type
- Promise.<Task>
getTasks(ids) → {Promise.<Array.<Task>>}
Get tasks set.
Name | Type | Description |
---|---|---|
ids |
Array.<Number> | An array of task IDs to retrieve. |
- Type
- Promise.<Array.<Task>>
getUser(id) → {Promise.<User>}
Get a user by ID.
Name | Type | Description |
---|---|---|
id |
Number | The ID of the user to retrieve. |
- Type
- Promise.<User>
getUsers(ids) → {Promise.<Array.<User>>}
Get users by IDs.
Name | Type | Description |
---|---|---|
ids |
Array.<Number> | An array of user IDs to retrieve. |
- Type
- Promise.<Array.<User>>
login(school_id, username, password) → {Promise}
Log in to a SMHW account for an access token to make authorised requests to SMHW.
Name | Type | Description |
---|---|---|
school_id |
Number | The ID of the school of the account to log in to. |
username |
String | The username of the account to log in to. |
password |
String | The password of the account to log in to. (Not stored) |
- Type
- Promise
stopHeartbeat()
Stop a continuous client connection.