CourseService#
- class CourseService[source]#
Methods
Return all Course objects the current user is a member of.
Create a new course.
Get a list of all course roles in a given course.
Add a new CourseRole to the given Course.
Bulk enroll users into this course.
Add or modify a CourseSnippet by key.
Get the all the group sets of a given course.
Create or update a GroupSet in the given course id.
Get all assignments of the given course.
Create a new course for the given assignment.
Get the registration links for the given course.
Create or edit an enroll link.
Get all sections of this course.
Create a new course section.
Update the price of the given course.
Update the price of the given course.
Delete the CourseSnippet with the given id.
Modify the CourseSnippet with the given id.
Get a registration link.
Delete the given registration link.
Get a list of all course roles in a given course.
Remove a CourseRole from the given Course.
Update the Permission of a given CourseRole in the given Course.
Delete a user from a course.
Get all users and their role in a course.
Set the CourseRole of a user in the given course.
Get a course by id.
Update the given course with new values.
Get all snippets of the given course.
Get user statistics of a specific course.
Get all the authorization of the currently logged in user in this course.
Get all submissions by the given user in this course.
Copy a course into another course.
Join a course as the currently logged in user using a registration link.
Register as a new user, and directly enroll in a course.
Sent the authors in this course an email.
- get_all(*, lti_course_id=Nothing, tenant_id=Nothing, q='', page_size=20)[source]#
Return all Course objects the current user is a member of.
- Parameters:
lti_course_id (
Union
[Just
[str
],_Nothing
[str
]]) – The id of the course according to the lti platform.tenant_id (
Union
[Just
[str
],_Nothing
[str
]]) – The id of the tenant to which you want to limit the courses you are searching.q (
str
) – Only find courses matching this search query, currently only searches for course names in a fuzzy way.page_size (
int
) – The size of a single page, maximum is 50.self (CourseService[AuthenticatedClient]) –
- Returns:
A response containing the requested courses.
- Return type:
Response[Course]
- create(json_body)[source]#
Create a new course.
- Parameters:
json_body (
CreateCourseData
) – The body of the request. SeeCreateCourseData
for information about the possible fields. You can provide this data as aCreateCourseData
or as a dictionary.self (CourseService[AuthenticatedClient]) –
- Returns:
A response containing the JSON serialization of the new course
- Return type:
- get_course_roles(*, course_id, q='', page_size=20)[source]#
Get a list of all course roles in a given course.
- Parameters:
course_id (
int
) – The id of the course to get the roles for.q (
str
) – Search on the name for the roles.page_size (
int
) – The size of a single page, maximum is 50.self (CourseService[AuthenticatedClient]) –
- Returns:
An array of all course roles for the given course.
- Return type:
Response[CourseRole]
- create_role(json_body, *, course_id)[source]#
Add a new CourseRole to the given Course.
- Parameters:
json_body (
CreateRoleCourseData
) – The body of the request. SeeCreateRoleCourseData
for information about the possible fields. You can provide this data as aCreateRoleCourseData
or as a dictionary.course_id (
int
) – The id of the courseself (CourseService[AuthenticatedClient]) –
- Returns:
An empty response with return code 204.
- Return type:
- bulk_enroll(json_body, *, course_id)[source]#
Bulk enroll users into this course.
All given users are directly enrolled into the course, and they will receive an email confirming that they have been enrolled.
Users that do not exist yet are created, but no password is set yet so they cannot log in. Their course enrollment email will include a link to a page where they can set their password.
- Parameters:
json_body (
BulkEnrollCourseData
) – The body of the request. SeeBulkEnrollCourseData
for information about the possible fields. You can provide this data as aBulkEnrollCourseData
or as a dictionary.course_id (
int
) – The id of the course in which users should be enrolled.self (CourseService[AuthenticatedClient]) –
- Returns:
A dictionary containing the job sending out the mails, a list of newly created users, and a list of users that could not be created because of SSO incompatibility.
- Return type:
- create_snippet(json_body, *, course_id)[source]#
Add or modify a CourseSnippet by key.
- Parameters:
json_body (
CreateSnippetCourseData
) – The body of the request. SeeCreateSnippetCourseData
for information about the possible fields. You can provide this data as aCreateSnippetCourseData
or as a dictionary.course_id (
int
) – The id of the course in which you want to create a new snippet.self (CourseService[AuthenticatedClient]) –
- Returns:
A response containing the JSON serialized snippet and return code 201.
- Return type:
- get_group_sets(*, course_id, page_size=20)[source]#
Get the all the group sets of a given course.
- Parameters:
course_id (
int
) – The id of the course of which the group sets should be retrieved.page_size (
int
) – The size of a single page, maximum is 50.self (CourseService[AuthenticatedClient]) –
- Returns:
A list of group sets.
- Return type:
Response[GroupSet]
- create_group_set(json_body, *, course_id)[source]#
Create or update a GroupSet in the given course id.
- Parameters:
json_body (
CreateGroupSetCourseData
) – The body of the request. SeeCreateGroupSetCourseData
for information about the possible fields. You can provide this data as aCreateGroupSetCourseData
or as a dictionary.course_id (
int
) – The id of the course in which the group set should be created or updated. The course id of a group set cannot change.self (CourseService[AuthenticatedClient]) –
- Returns:
The created or updated group.
- Return type:
- get_assignments(*, course_id, has_rubric=False, has_auto_test=False, has_handin_requirements=False, division_parent_id=Nothing, group_set_id=Nothing, q='', page_size=20)[source]#
Get all assignments of the given course.
The returned assignments are sorted by deadline.
- Parameters:
course_id (
int
) – The id of the coursehas_rubric (
bool
) – Get only assignments that have a rubric.has_auto_test (
bool
) – Get only assignments that have a AutoTest configuration.has_handin_requirements (
bool
) – Get only assignments that have hand-in requirements.division_parent_id (
Union
[Just
[int
],_Nothing
[int
]]) – Only return assignments matching the given division parent id.group_set_id (
Union
[Just
[int
],_Nothing
[int
]]) – Only return assignments that are linked to this group set id.q (
str
) – Only assignments matching this query will be returned.page_size (
int
) – The size of a single page, maximum is 50.self (CourseService[AuthenticatedClient]) –
- Returns:
A response containing the assignments of the given course sorted by deadline of the assignment
- Return type:
Response[Assignment]
- create_assignment(json_body, *, course_id)[source]#
Create a new course for the given assignment.
- Parameters:
json_body (
CreateAssignmentCourseData
) – The body of the request. SeeCreateAssignmentCourseData
for information about the possible fields. You can provide this data as aCreateAssignmentCourseData
or as a dictionary.course_id (
int
) – The course to create an assignment in.self (CourseService[AuthenticatedClient]) –
- Returns:
The newly created assignment.
- Return type:
- get_all_enroll_links(*, course_id, page_size=20)[source]#
Get the registration links for the given course.
- Parameters:
course_id (
int
) – The course id for which to get the registration links.page_size (
int
) – The size of a single page, maximum is 50.self (CourseService[AuthenticatedClient]) –
- Returns:
An array of registration links.
- Return type:
Response[CourseRegistrationLink]
- put_enroll_link(json_body, *, course_id)[source]#
Create or edit an enroll link.
- Parameters:
json_body (
PutEnrollLinkCourseData
) – The body of the request. SeePutEnrollLinkCourseData
for information about the possible fields. You can provide this data as aPutEnrollLinkCourseData
or as a dictionary.course_id (
int
) – The id of the course in which this link should enroll users.self (CourseService[AuthenticatedClient]) –
- Returns:
The created or edited link.
- Return type:
- get_sections(*, course_id, q='', page_size=20)[source]#
Get all sections of this course.
- Parameters:
course_id (
int
) – The id of the course to get the sections for.q (
str
) – Only find courses sections with a name matching this search query.page_size (
int
) – The size of a single page, maximum is 50.self (CourseService[AuthenticatedClient]) –
- Returns:
A list of all sections connected to this course.
- Return type:
Response[CourseSection]
- create_section(json_body, *, course_id)[source]#
Create a new course section.
- Parameters:
json_body (
CreateSectionCourseData
) – The body of the request. SeeCreateSectionCourseData
for information about the possible fields. You can provide this data as aCreateSectionCourseData
or as a dictionary.course_id (
int
) – The id of the course to create a section for.self (CourseService[AuthenticatedClient]) –
- Returns:
The new section.
- Return type:
- put_price(json_body, *, course_id)[source]#
Update the price of the given course.
- Parameters:
json_body (
PutPriceCourseData
) – The body of the request. SeePutPriceCourseData
for information about the possible fields. You can provide this data as aPutPriceCourseData
or as a dictionary.course_id (
int
) – The id of the course for which you want to update the price.self (CourseService[AuthenticatedClient]) –
- Returns:
The created or updated price.
- Return type:
- delete_price(*, course_id)[source]#
Update the price of the given course.
- Parameters:
course_id (
int
) – The id of the course for which you want to update the price.self (CourseService[AuthenticatedClient]) –
- Returns:
The created or updated price.
- Return type:
None
- delete_snippet(*, course_id, snippet_id)[source]#
Delete the CourseSnippet with the given id.
- Parameters:
course_id (
int
) – The id of the course in which the snippet is located.snippet_id (
int
) – The id of the snippetself (CourseService[AuthenticatedClient]) –
- Returns:
An empty response with return code 204
- Return type:
None
- patch_snippet(json_body, *, course_id, snippet_id)[source]#
Modify the CourseSnippet with the given id.
- Parameters:
json_body (
PatchSnippetCourseData
) – The body of the request. SeePatchSnippetCourseData
for information about the possible fields. You can provide this data as aPatchSnippetCourseData
or as a dictionary.course_id (
int
) – The id of the course in which the course snippet is saved.snippet_id (
int
) – The id of the snippet to change.self (CourseService[AuthenticatedClient]) –
- Returns:
An empty response with return code 204.
- Return type:
None
- get_registration_link(*, course_id, link_id)[source]#
Get a registration link.
This route can be used without logging in, i.e. you don’t have to be enrolled in the course to use this route. This route will not work for expired registration links.
- Parameters:
- Returns:
The specified registration link.
- Return type:
- delete_enroll_link(*, course_id, link_id)[source]#
Delete the given registration link.
- Parameters:
course_id (
int
) – The id of the course to which the registration link is connected.link_id (
str
) – The id of the registration link.self (CourseService[AuthenticatedClient]) –
- Returns:
Nothing.
- Return type:
None
- get_course_role(*, course_id, role_id)[source]#
Get a list of all course roles in a given course.
- Parameters:
course_id (
int
) – The id of the course to get the roles for.role_id (
int
) – The id of the role to get.self (CourseService[AuthenticatedClient]) –
- Returns:
The requested role.
- Return type:
- delete_role(*, course_id, role_id)[source]#
Remove a CourseRole from the given Course.
- Parameters:
course_id (
int
) – The id of the courserole_id (
int
) – The id of the role you want to deleteself (CourseService[AuthenticatedClient]) –
- Returns:
An empty response with return code 204
- Return type:
None
- patch_role(json_body, *, course_id, role_id)[source]#
Update the Permission of a given CourseRole in the given Course.
- Parameters:
json_body (
PatchRoleCourseData
) – The body of the request. SeePatchRoleCourseData
for information about the possible fields. You can provide this data as aPatchRoleCourseData
or as a dictionary.course_id (
int
) – The id of the course.role_id (
int
) – The id of the course role.self (CourseService[AuthenticatedClient]) –
- Returns:
An empty response with return code 204.
- Return type:
- delete_user(*, course_id, user_id)[source]#
Delete a user from a course.
This does not delete the user’s submissions within the course.
- Parameters:
course_id (
int
) – The id of the course to remove the user from.user_id (
int
) – The id of the user to remove from the course.self (CourseService[AuthenticatedClient]) –
- Returns:
Nothing.
- Return type:
None
- get_all_users(*, course_id, q='', page_size=20)[source]#
Get all users and their role in a course.
- Parameters:
course_id (
int
) – The id of the courseq (
str
) – Only retrieve users whose name or username matches this value. This will change the output to a list of users.page_size (
int
) – The size of a single page, maximum is 50.self (CourseService[AuthenticatedClient]) –
- Returns:
All users in this course and their role.
- Return type:
Response[CourseEnrollment]
- change_user_role(json_body, *, course_id)[source]#
Set the CourseRole of a user in the given course.
- Parameters:
json_body (
Union
[ChangeUserRoleCourseData_1
,ChangeUserRoleCourseData_1_2
]) – The body of the request. SeeChangeUserRoleCourseData
for information about the possible fields. You can provide this data as aChangeUserRoleCourseData
or as a dictionary.course_id (
int
) – The id of the course in which you want to enroll a new user, or change the role of an existing user.self (CourseService[AuthenticatedClient]) –
- Returns:
The response will contain the JSON serialized user and course role.
- Return type:
- get(*, course_id)[source]#
Get a course by id.
- Parameters:
course_id (
int
) – The id of the courseself (CourseService[AuthenticatedClient]) –
- Returns:
A response containing the JSON serialized course
- Return type:
- patch(json_body, *, course_id)[source]#
Update the given course with new values.
- Parameters:
json_body (
PatchCourseData
) – The body of the request. SeePatchCourseData
for information about the possible fields. You can provide this data as aPatchCourseData
or as a dictionary.course_id (
int
) – The id of the course you want to update.self (CourseService[AuthenticatedClient]) –
- Returns:
The updated course, in extended format.
- Return type:
- get_snippets(*, course_id, page_size=20)[source]#
Get all snippets of the given course.
- Parameters:
course_id (
int
) – The id of the course from which you want to get the snippets.page_size (
int
) – The size of a single page, maximum is 50.self (CourseService[AuthenticatedClient]) –
- Returns:
An array containing all snippets for the given course.
- Return type:
Response[CourseSnippet]
- get_statistics(*, course_id)[source]#
Get user statistics of a specific course.
- Parameters:
course_id (
int
) – The id of the course for which you want to get the statisticsself (CourseService[AuthenticatedClient]) –
- Returns:
A response containing the course management statistics
- Return type:
- get_authorization(*, course_id)[source]#
Get all the authorization of the currently logged in user in this course.
This will return the permission as if you have already paid, even if this is not the case. We will also not check any restrictions of the current session.
- Parameters:
course_id (
int
) – The id of the course of which the permissions should be retrieved.self (CourseService[AuthenticatedClient]) –
- Returns:
A mapping between the permission name and a boolean indicating if the currently logged in user has this permission.
- Return type:
- get_submissions_by_user(*, course_id, user_id, page_size=20)[source]#
Get all submissions by the given user in this course.
- Parameters:
course_id (
int
) – The id of the course from which you want to get the submissions.user_id (
int
) – The id of the user of which you want to get the submissions.page_size (
int
) – The size of a single page, maximum is 50.self (CourseService[AuthenticatedClient]) –
- Returns:
A paginated list of the submissions by the user in this course.
- Return type:
Response[Work]
- import_into(json_body, *, into_course_id)[source]#
Copy a course into another course.
- Parameters:
json_body (
ImportIntoCourseData
) – The body of the request. SeeImportIntoCourseData
for information about the possible fields. You can provide this data as aImportIntoCourseData
or as a dictionary.into_course_id (
int
) – The course you want to import into.self (CourseService[AuthenticatedClient]) –
- Returns:
The updated course, so the course of which the id was passed in the url.
- Return type:
- join_as_logged_in_user(*, course_id, link_id)[source]#
Join a course as the currently logged in user using a registration link.
- Parameters:
course_id (
int
) – The id of the course in which you want to enroll.link_id (
str
) – The id of the link you want to use to enroll.self (CourseService[AuthenticatedClient]) –
- Returns:
Nothing.
- Return type:
None
- register_user_with_link(json_body, *, course_id, link_id)[source]#
Register as a new user, and directly enroll in a course.
- Parameters:
json_body (
RegisterUserWithLinkCourseData
) – The body of the request. SeeRegisterUserWithLinkCourseData
for information about the possible fields. You can provide this data as aRegisterUserWithLinkCourseData
or as a dictionary.course_id (
int
) – The id of the course to which the registration link is connected.link_id (
str
) – The id of the registration link.
- Returns:
The access token that the created user can use to log in.
- Return type:
- email_users(json_body, *, course_id)[source]#
Sent the authors in this course an email.
- Parameters:
json_body (
EmailUsersCourseData
) – The body of the request. SeeEmailUsersCourseData
for information about the possible fields. You can provide this data as aEmailUsersCourseData
or as a dictionary.course_id (
int
) – The id of the course in which you want to send the emails.self (CourseService[AuthenticatedClient]) –
- Returns:
A task result that will send these emails.
- Return type: