DXLessonClient
This class is responsible for requests to the lesson API.
You will need to enable the "Training" scope for your app in the developer dashboard before using the lesson API.
Properties
Singleton instance of DXLessonClient
. You will access all the available DXLessonClient
methods through this instance.
Methods
getLesson
Retrieves a single lesson by ID.
Parameter
Type
Description
lessonId
String
The ID of the requested lesson.
completion
(_ error: Error?, _ lesson: DXLesson?) -> Void
The closure invoked when the request finishes. Called with an Error
argument if the request fails; otherwise, called with the requested lesson.
getLessonsInCourse
Request all lessons belonging to a course.
Parameter
Type
Description
courseId
String
ID of the course.
limit
Int?
Page size.
page
Int?
Results page to return.
completion
(_ error: Error?, _ lessons: [DXLesson]?) -> Void
The closure invoked when the request finishes. Called with an Error
argument if the request fails; otherwise, called with the requested lessons.
getAppLessons
Returns all lessons that belong to the app the user is currently authenticated into, filtered by a provided class.
Parameter
Type
Description
classId
String
Class to which the requested lessons are assigned.
completion
(_ error: Error?, _ lessons: [DXLesson]?) -> Void
The closure invoked when the request finishes. Called with an Error
argument if the request fails; otherwise, called with the requested lessons.
startLesson
Indicates a student has started taking a lesson, updating the start
date in the lesson's progress. If the user has previously started the lesson but not completed it, this request will fail.
Parameter
Type
Description
classId
String
Lesson progress is tracked on a class-by-class basis. This parameter is the ID of the student's class for which you would like to retrieve progress in this lesson for.
lessonId
String
ID of the lesson.
studentId
String?
Specify which student to return progress for. If not provided, will return the progress of the currently authenticated user.
completion
(_ error: Error?, _ progress: DXLessonProgress?) -> Void
The closure invoked when the request finishes. Called with an Error
argument if the request fails; otherwise, called with an instance of DXLessonProgress
.
getStudentsProgress
Returns the current (or latest) progress for the specified lesson either for the currently authenticated user or a specified user.
Parameter
Type
Description
classId
String
Lesson is tracked on a class-by-class basis. This parameter is the ID of the student's class for which you would like to retrieve progress in this lesson for.
lessonId
String
ID of the lesson.
studentId
String?
Specify which student to return progress for. If not provided, will return the progress of the currently authenticated user.
completion
(_ error: Error?, _ progress: DXLessonProgress?) -> Void
The closure invoked when the request finishes. Called with an Error
argument if the request fails; otherwise, called with an instance of DXLessonProgress
.
getStudentsProgressHistory
Returns all the attempts for the specified lesson either for the currently authenticated user or a specified user.
Parameter
Type
Description
classId
String
Lesson progress is tracked on a class-by-class basis. This parameter is the ID of the student's class for which you would like to retrieve progress in this lesson for.
lessonId
String
ID of the lesson.
studentId
String?
Specify which student to return progress for. If not provided, will return the progress of the currently authenticated user.
completion
(_ error: Error?, _ history: [DXLessonProgress]?) -> Void
The closure invoked when the request finishes. Called with an Error
argument if the request fails; otherwise, called with the requested progress history.
updateStudentsProgress
Updates a student's progress for a lesson in a class with a score, answers, and a pass/fail result.
Parameter
Type
Description
classId
String
Lesson progress is tracked on a class-by-class basis. This parameter is the ID of the student's class for which you would like to retrieve progress in this lesson for.
lessonId
String
ID of the lesson.
pass
Bool
A boolean pass/fail flag.
studentId
String?
Specify which student to return progress for. If not provided, will return the progress of the currently authenticated user.
complete
Bool?
If true, the lesson's completed
attribute will be set to the current date/time, indicating the student has finished the lesson.
score
Int?
A numeric score for the lesson.
startTime
String?
A parseable date to mark the start of the student's session. Suggested format is ISO date, eg. 2020-01-07T21:45:35.649Z.
endTime
String?
A parseable date to mark the end of the student's session. Suggested format is ISO date, eg. 2020-01-07T21:45:35.649Z.
completion
(_ error: Error?, _ progress: DXLessonProgress?) -> Void
The closure invoked when the request finishes. Called with an Error
argument if the request fails; otherwise, called with an instance of DXLessonProgress
.
getLessonsLockStatus
Checks whether or not the specified lesson is currently locked or unlocked.
Parameter
Type
Description
classId
String
Lesson progress is tracked on a class-by-class basis. This parameter is the ID of the student's class for which you would like to retrieve progress in this lesson for.
completion
( error: Error?, lessons: [DXLesson]?) -> Void
Closure invoked when the request finishes. Called with an Error
argument if the request fails; otherwise, called with the lessons for that student.
pauseLesson
Indicates that a student has paused progress on a lesson.
The "progressIntervals" attribute will be updated with the previous start time and an end time of the current time.
Parameter
Type
Description
lessonId
String
ID of the lesson.
classId
String
Lesson progress is tracked on a class-by-class basis. This parameter is the ID of the student's class for which you would like to update the student's progress.
completion
( error: Error?, lessonProgress: DXLessonProgress?) -> Void
Closure invoked when the request finishes. Called with an Error
argument if the request fails; otherwise, called with the paused lesson.
resumeLesson
Indicates that a student has resumed progress on a paused lesson.
Parameter
Type
Description
lessonId
String
ID of the lesson.
classId
String
Lesson progress is tracked on a class-by-class basis. This parameter is the ID of the student's class for which you would like to update the student's progress.
completion
( error: Error?, lessonProgress: DXLessonProgress?) -> Void
Closure invoked when the request finishes. Called with an Error
argument if the request fails; otherwise, called with the resumed argument.
startIdleTimeForLesson
Indicates that the student's progress is temporarily paused. The "idleIntervals" attribute will be updated with the previous start time and an end time of the current time.
Parameter
Type
Description
lessonId
String
ID of the lesson.
classId
String
Lesson progress is tracked on a class-by-class basis. This parameter is the ID of the student's class for which you would like to update the student's progress.
completion
( error: Error?, lessonProgress: DXLessonProgress?) -> Void
Closure invoked when the request finishes. Called with an Error
argument if the request fails; otherwise, called with the lesson progress marked as idle.
endIdleTimeForLesson
Indicates that a student has ended idle time.
Parameter
Type
Description
lessonId
String
ID of the lesson.
classId
String
Lesson progress is tracked on a class-by-class basis. This parameter is the ID of the student's class for which you would like to update the student's progress.
completion
( error: Error?, lessonProgress: DXLessonProgress?) -> Void
Closure invoked when the request finishes. Called with an Error
argument if the request fails; otherwise, called with the lesson progress marked as active.
updateStudentsObjectiveScore
Updates a student's objective score for a lesson, if the objective score is different than the student's overall lesson score.
Note that a student must have a lesson attempt started (or completed) before objective scores can be recorded for any objectives linked to that lesson.
Parameter
Type
Description
lessonId
String
ID of the lesson.
classId
String
Lesson progress is tracked on a class-by-class basis. This parameter is the ID of the student's class for which you would like to update the student's progress.
objectiveId
String
The objective's ID.
score
Int
A numeric score from 0-100.
completion
(_ error: Error?) -> Void
Closure invoked when the request finishes. Called with an Error
argument if the request fails.
Last updated