create method
Creates a rubric.
The requesting user and course owner must have rubrics creation
capabilities. For details, see
licensing requirements.
For further details, see [Rubrics structure and known
limitations](/classroom/rubrics/limitations). 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 user isn't permitted
to create rubrics for course work in the requested course. * INTERNAL
if
the request has insufficient OAuth scopes. * INVALID_ARGUMENT
if the
request is malformed and for the following request error: *
RubricCriteriaInvalidFormat
* NOT_FOUND
if the requested course or
course work don't exist or the user doesn't have access to the course or
course work. * FAILED_PRECONDITION
for the following request error: *
AttachmentNotVisible
request
- The metadata request object.
Request parameters:
courseId
- Required. Identifier of the course.
courseWorkId
- Required. Identifier of the course work.
$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> create(
Rubric request,
core.String courseId,
core.String courseWorkId, {
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
if ($fields != null) 'fields': [$fields],
};
final url_ = 'v1/courses/' +
commons.escapeVariable('$courseId') +
'/courseWork/' +
commons.escapeVariable('$courseWorkId') +
'/rubrics';
final response_ = await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
);
return Rubric.fromJson(response_ as core.Map<core.String, core.dynamic>);
}