patch method
- GuardianInvitation request,
- String studentId,
- String invitationId, {
- String? updateMask,
- String? $fields,
Modifies a guardian invitation.
Currently, the only valid modification is to change the state
from
PENDING
to COMPLETE
. This has the effect of withdrawing the
invitation. This method returns the following error codes: *
PERMISSION_DENIED
if the current user does not have permission to manage
guardians, if guardians are not enabled for the domain in question or for
other access errors. * FAILED_PRECONDITION
if the guardian link is not
in the PENDING
state. * INVALID_ARGUMENT
if the format of the student
ID provided cannot be recognized (it is not an email address, nor a
user_id
from this API), or if the passed GuardianInvitation
has a
state
other than COMPLETE
, or if it modifies fields other than
state
. * NOT_FOUND
if the student ID provided is a valid student ID,
but Classroom has no record of that student, or if the id
field does not
refer to a guardian invitation known to Classroom.
request
- The metadata request object.
Request parameters:
studentId
- The ID of the student whose guardian invitation is to be
modified.
invitationId
- The id
field of the GuardianInvitation
to be
modified.
updateMask
- Mask that identifies which fields on the course to update.
This field is required to do an update. The update fails if invalid fields
are specified. The following fields are valid: * state
When set in a
query parameter, this field should be specified as updateMask=,,...
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a GuardianInvitation.
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<GuardianInvitation> patch(
GuardianInvitation request,
core.String studentId,
core.String invitationId, {
core.String? updateMask,
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
if (updateMask != null) 'updateMask': [updateMask],
if ($fields != null) 'fields': [$fields],
};
final url_ = 'v1/userProfiles/' +
commons.escapeVariable('$studentId') +
'/guardianInvitations/' +
commons.escapeVariable('$invitationId');
final response_ = await _requester.request(
url_,
'PATCH',
body: body_,
queryParams: queryParams_,
);
return GuardianInvitation.fromJson(
response_ as core.Map<core.String, core.dynamic>);
}