create method

Future<StudentGroupMember> create(
  1. StudentGroupMember request,
  2. String courseId,
  3. String studentGroupId, {
  4. String? $fields,
})

Creates a student group member for a student group.

This method returns the following error codes: * PERMISSION_DENIED if the requesting user is not permitted to create the student group or member for access errors. * NOT_FOUND if the student group does not exist or the user does not have access to the student group. * ALREADY_EXISTS if the student group member already exists. * FAILED_PRECONDITION if attempting to add a member to a student group that has reached its member limit.

request - The metadata request object.

Request parameters:

courseId - Required. The identifier of the course.

studentGroupId - Required. The identifier of the student group.

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

Completes with a StudentGroupMember.

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<StudentGroupMember> create(
  StudentGroupMember request,
  core.String courseId,
  core.String studentGroupId, {
  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/' +
      commons.escapeVariable('$studentGroupId') +
      '/studentGroupMembers';

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