patch method
Updates data associated with an add-on attachment submission.
Requires the add-on to have been the original creator of the attachment
and the attachment to have a positive max_points value set. This method
returns the following error codes: * PERMISSION_DENIED for access
errors. * INVALID_ARGUMENT if the request is malformed. * NOT_FOUND if
one of the identified resources does not exist.
request - The metadata request object.
Request parameters:
courseId - Required. Identifier of the course.
itemId - Identifier of the Announcement, CourseWork, or
CourseWorkMaterial under which the attachment is attached. This field is
required, but is not marked as such while we are migrating from post_id.
attachmentId - Required. Identifier of the attachment.
submissionId - Required. Identifier of the student's submission.
postId - Optional. Deprecated, use item_id instead.
updateMask - Required. Mask that identifies which fields on the
attachment to update. The update fails if invalid fields are specified. If
a field supports empty values, it can be cleared by specifying it in the
update mask and not in the AddOnAttachmentStudentSubmission object. The
following fields may be specified by teachers: * points_earned
$fields - Selector specifying which fields to include in a partial
response.
Completes with a AddOnAttachmentStudentSubmission.
Completes with a commons.ApiRequestError if the API endpoint returned an error.
If the used http.Client completes with an error when making a REST call,
this method will complete with the same error.
Implementation
async.Future<AddOnAttachmentStudentSubmission> patch(
AddOnAttachmentStudentSubmission request,
core.String courseId,
core.String itemId,
core.String attachmentId,
core.String submissionId, {
core.String? postId,
core.String? updateMask,
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
if (postId != null) 'postId': [postId],
if (updateMask != null) 'updateMask': [updateMask],
if ($fields != null) 'fields': [$fields],
};
final url_ =
'v1/courses/' +
commons.escapeVariable('$courseId') +
'/courseWork/' +
commons.escapeVariable('$itemId') +
'/addOnAttachments/' +
commons.escapeVariable('$attachmentId') +
'/studentSubmissions/' +
commons.escapeVariable('$submissionId');
final response_ = await _requester.request(
url_,
'PATCH',
body: body_,
queryParams: queryParams_,
);
return AddOnAttachmentStudentSubmission.fromJson(
response_ as core.Map<core.String, core.dynamic>,
);
}