# 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:
  - Client.js, line 42

### Members

#### (private) _auth :ClientAuthentication

Authentication information for the client.

Type:

- ClientAuthentication

Source:
  - Client.js, line 55

#### (private) _heartbeat :Number

The active client heartbeat.

Type:

- Number

Source:
  - Client.js, line 62

#### (private) _last_heartbeat :Number

The timestamp of the last heartbeat.

Type:

- Number

Source:
  - Client.js, line 69

#### (private) _options :Object

Options for the client.

Type:

- Object

Source:
  - Client.js, line 48

#### school :School

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

Type:

- School

Source:
  - Client.js, line 81

#### student :Student

The student user of the client.

Type:

- Student

Source:
  - Client.js, line 75

#### user :UserPrivateInformation

Private information of the client user.

Type:

- UserPrivateInformation

Source:
  - Client.js, line 87

### 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:
  - Client.js, line 667

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:
  - Client.js, line 642

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:
  - Client.js, line 591

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:
  - Client.js, line 566

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:
  - Client.js, line 515

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:
  - Client.js, line 490

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:
  - Client.js, line 361

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:
  - Client.js, line 328

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:
  - Client.js, line 781

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:
  - Client.js, line 756

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:
  - Client.js, line 819

Returns:

Type
  Promise.<FlexibleTaskSubmission>

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

Get homework submissions by their IDs.

Parameters:

Name | Type | Description
--- | --- | ---
`ids` | Array.<Number> |

Source:
  - Client.js, line 794

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:
  - Client.js, line 705

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:
  - Client.js, line 680

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:
  - Client.js, line 743

Returns:

Type
  Promise.<HomeworkSubmission>

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

Get homework submissions by their IDs.

Parameters:

Name | Type | Description
--- | --- | ---
`ids` | Array.<Number> |

Source:
  - Client.js, line 718

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:
  - Client.js, line 290

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:
  - Client.js, line 857

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:
  - Client.js, line 895

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:
  - Client.js, line 870

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:
  - Client.js, line 933

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:
  - Client.js, line 971

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:
  - Client.js, line 946

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:
  - Client.js, line 908

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:
  - Client.js, line 832

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:
  - Client.js, line 260

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:
  - Client.js, line 233

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:
  - Client.js, line 477

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:
  - Client.js, line 452

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:
  - Client.js, line 629

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:
  - Client.js, line 604

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:
  - Client.js, line 399

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:
  - Client.js, line 374

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:
  - Client.js, line 206

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:
  - Client.js, line 439

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:
  - Client.js, line 412

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:
  - Client.js, line 553

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:
  - Client.js, line 528

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:
  - Client.js, line 146

Returns:

Type
  Promise

#### stopHeartbeat()

Stop a continuous client connection.

Source:
  - Client.js, line 195