SMHWClient

SMHWClient

Represents access to SatchelOne's SMHW API.


Constructor

new SMHWClient(options)

Instantiate a SMHW Client.

Parameters:
Name Type Description
options Object

Options to instantiate the client with.

Source:

Members

(private) _auth :ClientAuthentication

Authentication information for the client.

Source:

(private) _heartbeat :Number

The active client heartbeat.

Type:
  • Number
Source:

(private) _last_heartbeat :Number

The timestamp of the last heartbeat.

Type:
  • Number
Source:

(private) _options :Object

Options for the client.

Type:
  • Object
Source:

school :School

The school that the student user of the client belongs to.

Type:
Source:

student :Student

The student user of the client.

Type:
Source:

user :UserPrivateInformation

Private information of the client user.

Source:

Methods

getAttachment(id) → {Promise.<Attachment>}

Get an attachment by its ID.

Parameters:
Name Type Description
id Number

The ID of the attachment to retrieve.

Source:
Returns:
Type
Promise.<Attachment>

getAttachments(ids) → {Promise.<Array.<Attachment>>}

Get attachments by their IDs.

Parameters:
Name Type Description
ids Array.<Number>

An array of attachment IDs to retrieve.

Source:
Returns:
Type
Promise.<Array.<Attachment>>

getClassGroup(id) → {Promise.<ClassGroup>}

Get a class group by its ID.

Parameters:
Name Type Description
id Number

The ID of the class group to retrieve.

Source:
Returns:
Type
Promise.<ClassGroup>

getClassGroups(ids) → {Promise.<Array.<ClassGroup>>}

Get class groups by their IDs.

Parameters:
Name Type Description
ids Array.<Number>

An array of class group IDs to retrieve.

Source:
Returns:
Type
Promise.<Array.<ClassGroup>>

getEmployee(id) → {Promise.<Employee>}

Get an employee by its ID.

Parameters:
Name Type Description
id Number

The ID of the employee to retrieve.

Source:
Returns:
Type
Promise.<Employee>

getEmployees(ids) → {Promise.<Array.<Employee>>}

Get employees by their IDs.

Parameters:
Name Type Description
ids Array.<Number>

An array of employee IDs to retrieve.

Source:
Returns:
Type
Promise.<Array.<Employee>>

getEvent(id) → {Promise.<ClientEvent>}

Get a client event by its ID.

Parameters:
Name Type Description
id Number

The ID of the event to retrieve.

Source:
Returns:
Type
Promise.<ClientEvent>

getEvents(ids) → {Promise.<Array.<ClientEvent>>}

Get client events.

Parameters:
Name Type Description
ids Array.<Number>

An array of Event IDs to retrieve.

Source:
Returns:
Type
Promise.<Array.<ClientEvent>>

getFlexibleTask(id) → {Promise.<FlexibleTask>}

Get a flexible task assignment by its ID.

Parameters:
Name Type Description
id Number

The ID of the flexible task assignment to retrieve.

Source:
Returns:
Type
Promise.<FlexibleTask>

getFlexibleTasks(ids) → {Promise.<Array.<FlexibleTask>>}

Get flexible task assignments by their IDs.

Parameters:
Name Type Description
ids Array.<Number>

An array of flexible task IDs to retrieve.

Source:
Returns:
Type
Promise.<Array.<FlexibleTask>>

getFlexibleTaskSubmission(id) → {Promise.<FlexibleTaskSubmission>}

Get a flexible task submission by its ID.

Parameters:
Name Type Description
id Number

The ID of the flexible task submission to retrieve.

Source:
Returns:
Type
Promise.<FlexibleTaskSubmission>

getFlexibleTaskSubmissions(ids) → {Promise.<Array.<FlexibleTaskSubmission>>}

Get homework submissions by their IDs.

Parameters:
Name Type Description
ids Array.<Number>
Source:
Returns:
Type
Promise.<Array.<FlexibleTaskSubmission>>

getHomework(id) → {Promise.<Homework>}

Get a homework assignment by its ID.

Parameters:
Name Type Description
id Number

The ID of the homework assignment to retrieve.

Source:
Returns:
Type
Promise.<Homework>

getHomeworks(ids) → {Promise.<Array.<Homework>>}

Get homework assignments by their IDs.

Parameters:
Name Type Description
ids Array.<Number>

An array of homework IDs to retrieve.

Source:
Returns:
Type
Promise.<Array.<Homework>>

getHomeworkSubmission(id) → {Promise.<HomeworkSubmission>}

Get a homework submission by its ID.

Parameters:
Name Type Description
id Number

The ID of the homework submission to retrieve.

Source:
Returns:
Type
Promise.<HomeworkSubmission>

getHomeworkSubmissions(ids) → {Promise.<Array.<HomeworkSubmission>>}

Get homework submissions by their IDs.

Parameters:
Name Type Description
ids Array.<Number>
Source:
Returns:
Type
Promise.<Array.<HomeworkSubmission>>

getOwnEvents(options, ids) → {Promise.<Array.<ClientEvent>>}

Get client events fired for the client user.

Parameters:
Name Type Description
options Object

Event request options.

ids Array.<Number>

An array of event IDs to retrieve.

Source:
Returns:
Type
Promise.<Array.<ClientEvent>>

getQuiz(id) → {Promise.<Quiz>}

Get a quiz assignment by its ID.

Parameters:
Name Type Description
id Number

The ID of the quiz assignment to retrieve.

Source:
Returns:
Type
Promise.<Quiz>

getQuizQuestion(id) → {Promise.<QuizQuestion>}

Get a quiz question by its ID.

Parameters:
Name Type Description
id Number

The ID of the quiz question to retrieve.

Source:
Returns:
Type
Promise.<QuizQuestion>

getQuizQuestions(ids) → {Promise.<Array.<QuizQuestion>>}

Get quiz questions by their IDs.

Parameters:
Name Type Description
ids Array.<Number>

An array of quiz question IDs to retrieve.

Source:
Returns:
Type
Promise.<Array.<QuizQuestion>>

getQuizSubmission(id) → {Promise.<QuizSubmission>}

Get a quiz submission by its ID.

Parameters:
Name Type Description
id Number

The ID of the quiz submission to retrieve.

Source:
Returns:
Type
Promise.<QuizSubmission>

getQuizSubmissionQuestion(id) → {Promise.<QuizSubmissionQuestion>}

Get a quiz submission question by its ID.

Parameters:
Name Type Description
id Number

The ID of the quiz submission question to retrieve.

Source:
Returns:
Type
Promise.<QuizSubmissionQuestion>

getQuizSubmissionQuestions(ids) → {Promise.<Array.<QuizSubmissionQuestion>>}

Get an array of quiz submission questions by their IDs.

Parameters:
Name Type Description
ids Array.<Number>

An array of quiz submission question IDs to retrieve.

Source:
Returns:
Type
Promise.<Array.<QuizSubmissionQuestion>>

getQuizSubmissions(ids) → {Promise.<Array.<QuizSubmission>>}

Get an array of quiz submissions by their IDs.

Parameters:
Name Type Description
ids Array.<Number>

An array of quiz submission IDs to retrieve.

Source:
Returns:
Type
Promise.<Array.<QuizSubmission>>

getQuizzes(ids) → {Promise.<Array.<Quiz>>}

Get quiz assignments by their IDs.

Parameters:
Name Type Description
ids Array.<Number>

An array of quiz IDs to retrieve.

Source:
Returns:
Type
Promise.<Array.<Quiz>>

getSchool(id) → {Promise.<School>}

Get a school by its ID.

Parameters:
Name Type Description
id Number

The ID of the school to retrieve.

Source:
Returns:
Type
Promise.<School>

getStandardSubjects(ids) → {Promise.<Array.<StandardSubject>>}

Get standard subjects on SMHW.

Parameters:
Name Type Description
ids Array.<Number>

An array of standard subject IDs to retrieve.

Source:
Returns:
Type
Promise.<Array.<StandardSubject>>

getStudent(id) → {Promise.<Student>}

Get a student by its ID.

Parameters:
Name Type Description
id Number

The ID of the student to retrieve.

Source:
Returns:
Type
Promise.<Student>

getStudents(ids) → {Promise.<Array.<Student>>}

Get students by their IDs.

Parameters:
Name Type Description
ids Array.<Number>

An array of Student IDs to retrieve.

Source:
Returns:
Type
Promise.<Array.<Student>>

getSubmissionComment(id) → {Promise.<SubmissionComment>}

Get a submission comment by its ID.

Parameters:
Name Type Description
id Number

The ID of the submission comment to retrieve.

Source:
Returns:
Type
Promise.<SubmissionComment>

getSubmissionComments(ids) → {Promise.<Array.<SubmissionComment>>}

Get submission commenst by their IDs.

Parameters:
Name Type Description
ids Array.<Number>

An array of submission comment IDs to retrieve.

Source:
Returns:
Type
Promise.<Array.<SubmissionComment>>

getSubmissionEvent(id) → {Promise.<SubmissionEvent>}

Get a submission event by its ID.

Parameters:
Name Type Description
id Number

The ID of the submission event to retrieve.

Source:
Returns:
Type
Promise.<SubmissionEvent>

getSubmissionEvents(ids) → {Promise.<Array.<SubmissionEvents>>}

Get submission events by their IDs.

Parameters:
Name Type Description
ids Array.<Number>

An array of submission event IDs to retrieve.

Source:
Returns:
Type
Promise.<Array.<SubmissionEvents>>

getSubmissionMethods(ids) → {Promise.<Array.<SubmissionMethod>>}

Get submission methods on SMHW.

Parameters:
Name Type Description
ids Array.<Number>

An array of submission method IDs to retrieve.

Source:
Returns:
Type
Promise.<Array.<SubmissionMethod>>

getTask(id) → {Promise.<Task>}

Get a task by its ID.

Parameters:
Name Type Description
id Number

The ID of the task to retrieve.

Source:
Returns:
Type
Promise.<Task>

getTasks(ids) → {Promise.<Array.<Task>>}

Get tasks set.

Parameters:
Name Type Description
ids Array.<Number>

An array of task IDs to retrieve.

Source:
Returns:
Type
Promise.<Array.<Task>>

getUser(id) → {Promise.<User>}

Get a user by its ID.

Parameters:
Name Type Description
id Number

The ID of the user to retrieve.

Source:
Returns:
Type
Promise.<User>

getUsers(ids) → {Promise.<Array.<User>>}

Get users by their IDs.

Parameters:
Name Type Description
ids Array.<Number>

An array of user IDs to retrieve.

Source:
Returns:
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.

Parameters:
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)

Source:
Returns:
Type
Promise

stopHeartbeat()

Stop a continuous client connection.

Source: