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

Get all the assignments that the current user can see.

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_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_all_feedback

Get all feedbacks for all the latest submissions for a given assignment.

get_auto_test

Get the AutoTest for this assignment.

get_comments_by_user

Get all the comments threads that a user replied on.

get_course

Get the course connected to an 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.

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.

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, extra_parameters=None)[source]#

Return the rubric corresponding to the given assignment_id.

Parameters:
Returns:

A list of RubricRow items.

Return type:

Sequence[RubricRowBase]

put_rubric(json_body, *, assignment_id, extra_parameters=None)[source]#

Add or update rubric of an assignment.

Parameters:
Returns:

The updated or created rubric.

Return type:

Sequence[RubricRowBase]

delete_rubric(*, assignment_id, extra_parameters=None)[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, extra_parameters=None)[source]#

Change the type of a rubric category.

Parameters:
Returns:

The updated rubric row.

Return type:

RubricRowBase

get(*, assignment_id, extra_parameters=None)[source]#

Get a single assignment by id.

Parameters:
Returns:

The requested assignment.

Return type:

Assignment

delete(*, assignment_id, extra_parameters=None)[source]#

Delete a given Assignment.

Parameters:
Returns:

Nothing.

Return type:

None

patch(json_body, *, assignment_id, extra_parameters=None)[source]#

Update the given assignment with new values.

Parameters:
Returns:

The updated assignment.

Return type:

Assignment

get_description(*, assignment_id, extra_parameters=None)[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, extra_parameters=None)[source]#

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

Parameters:
Returns:

An empty response.

Return type:

None

delete_description(*, assignment_id, extra_parameters=None)[source]#

Deletes the description for a given Assignment.

Parameters:
Returns:

An empty response.

Return type:

None

get_template(*, assignment_id, extra_parameters=None)[source]#

Return the template corresponding to the given assignment_id.

Parameters:
Returns:

The template for this assignment.

Return type:

AssignmentTemplate

delete_template(*, assignment_id, extra_parameters=None)[source]#

Delete the template corresponding to the given assignment_id.

Parameters:
Returns:

Nothing.

Return type:

None

update_peer_feedback_settings(json_body, *, assignment_id, extra_parameters=None)[source]#

Enable peer feedback for an assignment.

Parameters:
Returns:

The just created peer feedback settings.

Return type:

AssignmentPeerFeedbackSettings

disable_peer_feedback(*, assignment_id, extra_parameters=None)[source]#

Disabled peer feedback for an assignment.

Parameters:
Returns:

Nothing; an empty response.

Return type:

None

export(json_body, *, assignment_id, extra_parameters=None)[source]#

Generate a CSV report for this assignment.

Parameters:
Returns:

A CSV report for this assignment.

Return type:

Job

get_all(*, only_with_rubric=False, extra_parameters=None)[source]#

Get all the assignments that the current user can see.

Parameters:
Returns:

All assignments (with a rubric if specified) that the current user can see.

Return type:

Sequence[Assignment]

get_all_graders(*, assignment_id, extra_parameters=None)[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:

Sequence[AssignmentGrader]

get_submissions_by_user(*, assignment_id, user_id, extra_parameters=None)[source]#

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

This always returns extended version of the submissions.

Parameters:
Returns:

A response containing the JSON serialized submissions.

Return type:

Sequence[ExtendedWork]

get_all_submissions(*, assignment_id, extended=False, latest_only=True, extra_parameters=None)[source]#

Return all submissions for the given assignment.

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

  • extended (bool) – Whether to get extended or normal submissions.

  • latest_only (bool) – Only get the latest submission of a user. Please use this option if at all possible, as students have a tendency to submit many attempts and that can make this route quite slow. The default value was changed to True in version “O”.

  • extra_parameters (Optional[Mapping[str, Union[str, bool, int, float]]]) – The extra query parameters you might want to add. By default no extra query parameters are added.

  • self (AssignmentService[AuthenticatedClient]) –

Returns:

A response containing the JSON serialized submissions.

Return type:

Sequence[ExtendedWork] | Sequence[Work]

get_template_file(*, assignment_id, file_id, extra_parameters=None)[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, extra_parameters=None)[source]#

Get the schedule for the specified Assignment.

Parameters:
Returns:

The assignment schedule.

Return type:

AssignmentTimeframes

put_timeframes(json_body, *, assignment_id, extra_parameters=None)[source]#

Updates the schedule for the specified Assignment.

Parameters:
Returns:

The updated assignment schedule.

Return type:

AssignmentTimeframes

get_all_feedback(*, assignment_id, extra_parameters=None)[source]#

Get all feedbacks for all the latest submissions for a given assignment.

Parameters:
Returns:

A mapping between the id of the submission and a AssignmentFeeback object.

Return type:

Mapping[str, AssignmentFeedback]

get_auto_test(*, assignment_id, extra_parameters=None)[source]#

Get the AutoTest for this assignment.

Parameters:
Returns:

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

Return type:

AutoTest

get_comments_by_user(*, assignment_id, user_id, extra_parameters=None)[source]#

Get all the comments threads that a user replied on.

This route is especially useful in the context of peer feedback. With this route you can get all the comments placed by the student, so you don’t have to get all the submissions (including old ones) by the peer feedback subjects.

Parameters:
Returns:

A list of comments that all have at least one reply by the given user. There might be replies missing from these bases if these replies where not given by the user with id user_id, however no guarantee is made that all replies are by the user with id user_id.

Return type:

Sequence[InlineFeedbackCommentBase | GeneralFeedbackCommentBase]

get_course(*, assignment_id, extra_parameters=None)[source]#

Get the course connected to an assignment.

Parameters:
Returns:

A response containing the JSON serialized course.

Return type:

ExtendedCourse

get_webhook_settings(*, assignment_id, webhook_type, author_id=Nothing, is_test_submission=False, extra_parameters=None)[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.

  • extra_parameters (Optional[Mapping[str, Union[str, bool, int, float]]]) – The extra query parameters you might want to add. By default no extra query parameters are added.

  • 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, extra_parameters=None)[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, extra_parameters=None)[source]#

Get the peer feedback subjects for a given user.

Parameters:
  • assignment_id (int) – The id of the assignment in which you want to get the peer feedback subjects.

  • user_id (int) – The id of the user from which you want to retrieve the peer feedback subjects.

  • extra_parameters (Optional[Mapping[str, Union[str, bool, int, float]]]) – The extra query parameters you might want to add. By default no extra query parameters are added.

  • self (AssignmentService[AuthenticatedClient]) –

Returns:

The peer feedback subjects. If the deadline has not expired, or if the assignment is not a peer feedback assignment an empty list will be returned.

Return type:

Sequence[AssignmentPeerFeedbackConnection]

get_all_plagiarism_runs(*, assignment_id, extra_parameters=None)[source]#

Get all plagiarism runs for the given assignment.

Parameters:
Returns:

A response containing the JSON serialized list of plagiarism runs.

Return type:

Sequence[PlagiarismRun]

import_into(json_body, *, into_assignment_id, extra_parameters=None)[source]#

Import an assignment into another assignment.

Parameters:
Returns:

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

Return type:

Assignment

copy_rubric(json_body, *, assignment_id, extra_parameters=None)[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, extra_parameters=None)[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, extra_parameters=None)[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

patch_submit_types(multipart_data, *, assignment_id, extra_parameters=None)[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:

Assignment

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

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

Parameters:
  • multipart_data (Union[dict, list, 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.

  • extra_parameters (Optional[Mapping[str, Union[str, bool, int, float]]]) – The extra query parameters you might want to add. By default no extra query parameters are added.

  • self (AssignmentService[AuthenticatedClient]) –

Returns:

The created work.

Return type:

ExtendedWork