create method
Creates a student group for a course.
This method returns the following error codes: * PERMISSION_DENIED if
the requesting user is not permitted to create the student group or for
access errors. * NOT_FOUND if the course does not exist or the
requesting user doesn't have access to the course. * FAILED_PRECONDITION
if creating the student group would exceed the maximum number of student
groups per course.
request - The metadata request object.
Request parameters:
courseId - Required. The identifier of the course.
$fields - Selector specifying which fields to include in a partial
response.
Completes with a StudentGroup.
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<StudentGroup> create(
StudentGroup request,
core.String courseId, {
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
'fields': ?$fields == null ? null : [$fields],
};
final url_ =
'v1/courses/' + commons.escapeVariable('$courseId') + '/studentGroups';
final response_ = await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
);
return StudentGroup.fromJson(
response_ as core.Map<core.String, core.dynamic>,
);
}