updateRubric method

Future<Rubric> updateRubric(
  1. Rubric request,
  2. String courseId,
  3. String courseWorkId, {
  4. String? id,
  5. String? updateMask,
  6. String? $fields,
})

Updates a rubric.

See google.classroom.v1.Rubric for details of which fields can be updated. Rubric update capabilities are [limited](/classroom/rubrics/limitations) once grading has started. The requesting user and course owner must have rubrics creation capabilities. For details, see licensing requirements. This request must be made by the Google Cloud console of the OAuth client ID used to create the parent course work item. This method returns the following error codes: * PERMISSION_DENIED if the requesting developer project didn't create the corresponding course work, if the user isn't permitted to make the requested modification to the rubric, or for access errors. This error code is also returned if grading has already started on the rubric. * INVALID_ARGUMENT if the request is malformed and for the following request error: * RubricCriteriaInvalidFormat * NOT_FOUND if the requested course, course work, or rubric doesn't exist or if the user doesn't have access to the corresponding course work. * INTERNAL if grading has already started on the rubric.

request - The metadata request object.

Request parameters:

courseId - Required. Identifier of the course.

courseWorkId - Required. Identifier of the course work.

id - Optional. Identifier of the rubric.

updateMask - Optional. Mask that identifies which fields on the rubric to update. This field is required to do an update. The update fails if invalid fields are specified. There are multiple options to define the criteria of a rubric: the source_spreadsheet_id and the criteria list. Only one of these can be used at a time to define a rubric. The rubric criteria list is fully replaced by the rubric criteria specified in the update request. For example, if a criterion or level is missing from the request, it is deleted. New criteria and levels are added and an ID is assigned. Existing criteria and levels retain the previously assigned ID if the ID is specified in the request. The following fields can be specified by teachers: * criteria * source_spreadsheet_id

$fields - Selector specifying which fields to include in a partial response.

Completes with a Rubric.

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<Rubric> updateRubric(
  Rubric request,
  core.String courseId,
  core.String courseWorkId, {
  core.String? id,
  core.String? updateMask,
  core.String? $fields,
}) async {
  final body_ = convert.json.encode(request);
  final queryParams_ = <core.String, core.List<core.String>>{
    if (id != null) 'id': [id],
    if (updateMask != null) 'updateMask': [updateMask],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'v1/courses/' +
      commons.escapeVariable('$courseId') +
      '/courseWork/' +
      commons.escapeVariable('$courseWorkId') +
      '/rubric';

  final response_ = await _requester.request(
    url_,
    'PATCH',
    body: body_,
    queryParams: queryParams_,
  );
  return Rubric.fromJson(response_ as core.Map<core.String, core.dynamic>);
}