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 its ID.
Name | Type | Description |
---|---|---|
id |
Number | The ID of the attachment to retrieve. |
- Type
- Promise.<Attachment>
getAttachments(ids) → {Promise.<Array.<Attachment>>}
Get attachments by their 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 its 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 their 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 its ID.
Name | Type | Description |
---|---|---|
id |
Number | The ID of the employee to retrieve. |
- Type
- Promise.<Employee>
getEmployees(ids) → {Promise.<Array.<Employee>>}
Get employees by their 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 its 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 its 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 their 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 its 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 their IDs.
Name | Type | Description |
---|---|---|
ids |
Array.<Number> |
- Type
- Promise.<Array.<FlexibleTaskSubmission>>
getHomework(id) → {Promise.<Homework>}
Get a homework assignment by its 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 their 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 its 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 their 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>>
getQuiz(id) → {Promise.<Quiz>}
Get a quiz assignment by its ID.
Name | Type | Description |
---|---|---|
id |
Number | The ID of the quiz assignment to retrieve. |
- Type
- Promise.<Quiz>
getQuizQuestion(id) → {Promise.<QuizQuestion>}
Get a quiz question by its ID.
Name | Type | Description |
---|---|---|
id |
Number | The ID of the quiz question to retrieve. |
- Type
- Promise.<QuizQuestion>
getQuizQuestions(ids) → {Promise.<Array.<QuizQuestion>>}
Get quiz questions by their IDs.
Name | Type | Description |
---|---|---|
ids |
Array.<Number> | An array of quiz question IDs to retrieve. |
- Type
- Promise.<Array.<QuizQuestion>>
getQuizSubmission(id) → {Promise.<QuizSubmission>}
Get a quiz submission by its ID.
Name | Type | Description |
---|---|---|
id |
Number | The ID of the quiz submission to retrieve. |
- Type
- Promise.<QuizSubmission>
getQuizSubmissionQuestion(id) → {Promise.<QuizSubmissionQuestion>}
Get a quiz submission question by its ID.
Name | Type | Description |
---|---|---|
id |
Number | The ID of the quiz submission question to retrieve. |
- Type
- Promise.<QuizSubmissionQuestion>
getQuizSubmissionQuestions(ids) → {Promise.<Array.<QuizSubmissionQuestion>>}
Get an array of quiz submission questions by their IDs.
Name | Type | Description |
---|---|---|
ids |
Array.<Number> | An array of quiz submission question IDs to retrieve. |
- Type
- Promise.<Array.<QuizSubmissionQuestion>>
getQuizSubmissions(ids) → {Promise.<Array.<QuizSubmission>>}
Get an array of quiz submissions by their IDs.
Name | Type | Description |
---|---|---|
ids |
Array.<Number> | An array of quiz submission IDs to retrieve. |
- Type
- Promise.<Array.<QuizSubmission>>
getQuizzes(ids) → {Promise.<Array.<Quiz>>}
Get quiz assignments by their IDs.
Name | Type | Description |
---|---|---|
ids |
Array.<Number> | An array of quiz IDs to retrieve. |
- Type
- Promise.<Array.<Quiz>>
getSchool(id) → {Promise.<School>}
Get a school by its 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 its ID.
Name | Type | Description |
---|---|---|
id |
Number | The ID of the student to retrieve. |
- Type
- Promise.<Student>
getStudents(ids) → {Promise.<Array.<Student>>}
Get students by their 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 its 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 their 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 its 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 their 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 its 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 its ID.
Name | Type | Description |
---|---|---|
id |
Number | The ID of the user to retrieve. |
- Type
- Promise.<User>
getUsers(ids) → {Promise.<Array.<User>>}
Get users by their 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.