AssignmentService#

class AssignmentService[source]#

Methods

get_rubric

Return the rubric corresponding to the given assignment_id.

put_rubric

Add or update rubric of an assignment.

delete_rubric

Delete the rubric for the given assignment.

patch_rubric_category_type

Change the type of a rubric category.

get

Get a single assignment by id.

delete

Delete a given Assignment.

patch

Update the given assignment with new values.

get_description

Get the description for this assignment.

put_description

Stores a file containing the new description for a given Assignment.

delete_description

Deletes the description for a given Assignment.

get_template

Return the template corresponding to the given assignment_id.

delete_template

Delete the template corresponding to the given assignment_id.

update_peer_feedback_settings

Enable peer feedback for an assignment.

disable_peer_feedback

Disabled peer feedback for an assignment.

export

Generate a CSV report for this assignment.

get_all_grades

Get the grades for all submissions in this assignment.

get_all_graders

Gets a list of all users that can grade in the given assignment.

get_submissions_by_user

Return all submissions by the given user in the given assignment.

get_all_submissions

Return all submissions for the given assignment.

get_analytics_data

Get the data of an analytics source.

get_template_file

Get the content of a single file of an assignment template.

get_timeframes

Get the schedule for the specified Assignment.

put_timeframes

Updates the schedule for the specified Assignment.

get_auto_test

Get the AutoTest for this assignment.

get_webhook_settings

Create or get the webhook settings to hand-in submissions.

get_member_states

Get the LTI states for the members of a group for the given assignment.

get_peer_feedback_subjects

Get the peer feedback subjects for a given user.

get_all_plagiarism_runs

Get all plagiarism runs for the given assignment.

get_reply_counts_for_user

Retrieves reply counts for a specific user, grouped by submission.

import_into

Import an assignment into another assignment.

copy_rubric

Import a rubric from a different assignment.

mark_grader_as_done

Indicate that the given grader is done grading the given assignment.

mark_grader_as_not_done

Indicate that the given grader is not yet done grading the given assignment.

create_plagiarism_run

Run a plagiarism checker for the given Assignment.

patch_submit_types

Update the given assignment editor template with new files.

upload_submission

Upload one or more files as Work to the given Assignment.

get_rubric(*, assignment_id, page_size=50)[source]#

Return the rubric corresponding to the given assignment_id.

Parameters:
Returns:

A list of RubricRow items.

Return type:

Response[RubricRowBase]

put_rubric(json_body, *, assignment_id)[source]#

Add or update rubric of an assignment.

Parameters:
Returns:

The updated or created rubric.

Return type:

Sequence[RubricRowBase]

delete_rubric(*, assignment_id)[source]#

Delete the rubric for the given assignment.

Parameters:
Returns:

Nothing.

Return type:

None

patch_rubric_category_type(json_body, *, assignment_id, rubric_category_id)[source]#

Change the type of a rubric category.

Parameters:
Returns:

The updated rubric row.

Return type:

RubricRowBase

get(*, assignment_id)[source]#

Get a single assignment by id.

Parameters:
Returns:

The requested assignment.

Return type:

ExtendedAssignment

delete(*, assignment_id)[source]#

Delete a given Assignment.

Parameters:
Returns:

Nothing.

Return type:

None

patch(json_body, *, assignment_id)[source]#

Update the given assignment with new values.

Parameters:
Returns:

The updated assignment.

Return type:

ExtendedAssignment

get_description(*, assignment_id)[source]#

Get the description for this assignment.

Parameters:
Returns:

A public link that allows users to download the file or the file itself as a stream of octets

Return type:

bytes

put_description(multipart_data, *, assignment_id)[source]#

Stores a file containing the new description for a given Assignment.

Parameters:
Returns:

An empty response.

Return type:

None

delete_description(*, assignment_id)[source]#

Deletes the description for a given Assignment.

Parameters:
Returns:

An empty response.

Return type:

None

get_template(*, assignment_id)[source]#

Return the template corresponding to the given assignment_id.

Parameters:
Returns:

The template for this assignment.

Return type:

ExtendedAssignmentTemplate

delete_template(*, assignment_id)[source]#

Delete the template corresponding to the given assignment_id.

Parameters:
Returns:

Nothing.

Return type:

None

update_peer_feedback_settings(json_body, *, assignment_id)[source]#

Enable peer feedback for an assignment.

Parameters:
Returns:

The just created peer feedback settings.

Return type:

AssignmentPeerFeedbackSettings

disable_peer_feedback(*, assignment_id)[source]#

Disabled peer feedback for an assignment.

Parameters:
Returns:

Nothing; an empty response.

Return type:

None

export(json_body, *, assignment_id)[source]#

Generate a CSV report for this assignment.

Parameters:
Returns:

A CSV report for this assignment.

Return type:

Job

get_all_grades(*, assignment_id, page_size=150)[source]#

Get the grades for all submissions in this assignment.

Parameters:
Returns:

The rows of the gradebook.

Return type:

Response[AssignmentGradebookRow]

get_all_graders(*, assignment_id, page_size=20)[source]#

Gets a list of all users that can grade in the given assignment.

Parameters:
Returns:

A response containing the JSON serialized graders.

Return type:

Response[AssignmentGrader]

get_submissions_by_user(*, assignment_id, user_id, page_size=20)[source]#

Return all submissions by the given user in the given assignment.

For group assignments this route will also include submissions by the group of the user, which are always seen as later than the submission of the user.

Parameters:
  • assignment_id (int) – The id of the assignment

  • user_id (int) – The user of which you want to get the submissions.

  • page_size (int) – The size of a single page, maximum is 50.

  • self (AssignmentService[AuthenticatedClient]) –

Returns:

A response containing the JSON serialized submissions.

Return type:

Response[Work]

get_all_submissions(*, assignment_id, q='', test_student=Nothing, page_size=50)[source]#

Return all submissions for the given assignment.

Parameters:
  • assignment_id (int) – The id of the assignment

  • q (str) – Filter the submissions returned based on this string.

  • test_student (Union[Just[bool], _Nothing[bool]]) – If give only return submissions that either are or are not of the test student.

  • page_size (int) – The size of a single page, maximum is 100.

  • self (AssignmentService[AuthenticatedClient]) –

Returns:

A response containing the JSON serialized submissions.

Return type:

Response[Work]

get_analytics_data(*, assignment_id, data_source_name, page_size=100)[source]#

Get the data of an analytics source.

the data. the data.

Parameters:
  • assignment_id (int) – The id of the assignment from which you want to get the data.

  • data_source_name (str) – The name of the data source of which you wan to get the data.

  • page_size (int) – The size of a single page, maximum is 250.

  • self (AssignmentService[AuthenticatedClient]) –

Returns:

A paginated list of the data.

Return type:

Response[AnalyticsData]

get_template_file(*, assignment_id, file_id)[source]#

Get the content of a single file of an assignment template.

Parameters:
Returns:

The contents of the requested file.

Return type:

bytes

get_timeframes(*, assignment_id)[source]#

Get the schedule for the specified Assignment.

Parameters:
Returns:

The assignment schedule.

Return type:

AssignmentTimeframes

put_timeframes(json_body, *, assignment_id)[source]#

Updates the schedule for the specified Assignment.

Parameters:
Returns:

The updated assignment schedule.

Return type:

AssignmentTimeframes

get_auto_test(*, assignment_id)[source]#

Get the AutoTest for this assignment.

Parameters:
Returns:

The AutoTest for the given assignment, if it has an AutoTest.

Return type:

AutoTest

get_webhook_settings(*, assignment_id, webhook_type, author_id=Nothing, is_test_submission=False)[source]#

Create or get the webhook settings to hand-in submissions.

You can select the user for which the webhook should hand-in using the exact same query parameters as the route to upload a submission.

Parameters:
  • assignment_id (int) – The assignment for which the webhook should hand-in submissions.

  • webhook_type (Literal['git']) – The webhook type, currently only git is supported, which works for both GitLab and GitHub.

  • author_id (Union[Just[int], _Nothing[int]]) – The id of the user for which we should get the webhook settings. If not given defaults to the current user.

  • is_test_submission (bool) – Should we get the webhook settings for the test student.

  • self (AssignmentService[AuthenticatedClient]) –

Returns:

A serialized form of a webhook, which contains all data needed to add the webhook to your provider.

Return type:

WebhookBase

get_member_states(*, assignment_id, group_id)[source]#

Get the LTI states for the members of a group for the given assignment.

Parameters:
Returns:

A mapping between user id and a boolean indicating if we can already passback grades for this user. If the assignment is any LTI assignment and any of the values in this mapping is False trying to submit anyway will result in a failure.

Return type:

Mapping[str, bool]

get_peer_feedback_subjects(*, assignment_id, user_id, page_size=20)[source]#

Get the peer feedback subjects for a given user.

This endpoint retrieves the list of subjects (i.e., other users or groups) that the specified user is assigned to review. It transparently handles both individual and group assignments.

Parameters:
  • assignment_id (int) – The ID of the assignment.

  • user_id (int) – The ID of the user whose peer feedback duties are being requested. For group assignments, providing an individual member’s ID will return the subjects assigned to their entire group.

  • page_size (int) – The size of a single page, maximum is 50.

  • self (AssignmentService[AuthenticatedClient]) –

Returns:

A paginated list of peer feedback subjects. Returns an empty list if the assignment’s feedback period is not active or if it is not a peer feedback assignment.

Return type:

Response[AssignmentPeerFeedbackConnection]

get_all_plagiarism_runs(*, assignment_id, q='', page_size=20)[source]#

Get all plagiarism runs for the given assignment.

Parameters:
Returns:

A response containing the JSON serialized list of plagiarism runs.

Return type:

Response[PlagiarismRun]

get_reply_counts_for_user(*, assignment_id, user_id, page_size=20)[source]#

Retrieves reply counts for a specific user, grouped by submission.

This endpoint provides an efficient summary of a user’s activity within an assignment. It’s useful for analytics or dashboard views where you need to see how many replies a user has contributed to each submission without fetching the full comment data.

Parameters:
  • assignment_id (int) – The ID of the assignment to scope the search to.

  • user_id (int) – The ID of the user whose replies are being counted.

  • page_size (int) – The size of a single page, maximum is 50.

  • self (AssignmentService[AuthenticatedClient]) –

Returns:

A paginated response. The data payload is a list of objects, each mapping a submission’s ID to the total count of replies the specified user made on it.

Return type:

Response[WorkCommentCount]

import_into(json_body, *, into_assignment_id)[source]#

Import an assignment into another assignment.

Parameters:
Returns:

The updated assignment, so the assignment which was imported into.

Return type:

ExtendedAssignment

copy_rubric(json_body, *, assignment_id)[source]#

Import a rubric from a different assignment.

Parameters:
Returns:

The rubric rows of the assignment in which the rubric was imported, so the assignment with id assignment_id and not old_assignment_id.

Return type:

Sequence[RubricRowBase]

mark_grader_as_done(*, assignment_id, grader_id)[source]#

Indicate that the given grader is done grading the given assignment.

Parameters:
Returns:

An empty response with return code 204

Return type:

None

mark_grader_as_not_done(*, assignment_id, grader_id)[source]#

Indicate that the given grader is not yet done grading the given assignment.

Parameters:
Returns:

An empty response with return code 204

Return type:

None

create_plagiarism_run(multipart_data, *, assignment_id)[source]#

Run a plagiarism checker for the given Assignment.

Parameters:
Returns:

The json serialization newly created

Return type:

PlagiarismRun

patch_submit_types(multipart_data, *, assignment_id)[source]#

Update the given assignment editor template with new files.

How this route deals with existing editor templates when submitting is still experimental and might change in an upcoming release.

Parameters:
Returns:

The updated assignment.

Return type:

ExtendedAssignment

upload_submission(multipart_data, *, assignment_id, author_id=Nothing, is_test_submission=False, ignored_files=IgnoreHandling.keep)[source]#

Upload one or more files as Work to the given Assignment.

Parameters:
  • multipart_data (UploadSubmissionAssignmentData) – The data that should form the body of the request. See UploadSubmissionAssignmentData for information about the possible fields.

  • assignment_id (int) – The id of the assignment

  • author_id (Union[Just[int], _Nothing[int]]) – The id of the user for which we should get the webhook settings. If not given defaults to the current user.

  • is_test_submission (bool) – Should we get the webhook settings for the test student.

  • ignored_files (IgnoreHandling) – How to handle ignored files. The options are: keep: this the default, sipmly do nothing about ignored files. delete: delete the ignored files. error: return an error when there are ignored files in the archive.

  • self (AssignmentService[AuthenticatedClient]) –

Returns:

The created work.

Return type:

ExtendedWork