DXNoteClient

This class is responsible for making requests to the note API.

You will need to enable the "Training" scope for your app in the developer dashboard before using the course API.

Properties

public static let shared: DXNoteClient

Singleton instance of DXNoteClient . You will access all the available DXNoteClient methods through this instance.

Methods

createNote

public func createNote(
    text: String,
    lessondId: String?,
    userId: String?,
    classId: String?,
    studentId: String?,
    courseId: String?,
    _ completion: @escaping (_ error: Error?, _ note: DXNote?) -> Void
  )

Creates a note.

The following parameters allow the API to automatically add additional metadata to a note:

  • if a lessonId is specified, the lesson's course ID is added.

  • if a classId is specified, the class's course ID is added.

  • if a studentId is specified, the student's user profile ID, class ID, and course IDs are added.

When adding notes for the MOTAR Training Dashboard, you must include a student ID and a lesson ID.

Parameter

Type

Description

text

String

Text of note.

lessonId

String?

Id of lesson to which this note refers.

userId

String?

Id of user profile to whom this note refers.

classId

String?

Id of class to which this note refers.

studentId

String?

Id of student to whom this note refers.

courseId

String?

Id of student to whom this note refers.

completion

(_ error: Error?, _ note: DXNote?) -> Void

Closure invoked when the request finishes. Called with an Error argument if the request fails; otherwise, called with the newly created DXNote.

getNote

public func getNote(
    noteId: String,
    _ completion: @escaping (_ error: Error?, _ note: DXNote?) -> Void
  )

Retrieves a specific note by ID.

Parameter

Type

Description

noteId

String

ID of the note to return.

completion

(_ error: Error?, _ note: DXNote?) -> Void

Closure invoked when the request finishes. Called with an Error argument if the request fails; otherwise, called with the requested note.

getNoteList

public func getNoteList(
    lessondId: String?,
    userId: String?,
    classId: String?,
    studentId: String?,
    courseId: String?,
    _ completion: @escaping (_ error: Error?, _ notes: [DXNote]?) -> Void
  )

Retrieves all notes from the specified category or categories.

Parameter

Type

Description

lessonId

String?

A lesson ID to which the desired notes are related.

userId

String?

A user account ID to whom the notes are related.

classId

String?

A class ID to which the notes are related.

studentId

String?

A student ID to whom the notes are related.

courseId

String?

A course ID to which the desired notes are related.

completion

(_ error: Error?, _ notes: [DXNote]?) -> Void

Closure invoked when the request finishes. Called with an Error argument if the request fails; otherwise, called with the requested notes.

deleteNote

public func deleteNote(
    noteId: String,
    _ completion: @escaping (_ error: Error?) -> Void
  )

Deletes a note by ID.

Parameter

Type

Description

noteId

String

ID of the note to be deleted.

completion

(_ error: Error?) -> Void

Closure invoked when the request finishes. Called with an Error argument if the request fails.

Last updated