update method

Future<ContactGroup> update(
  1. UpdateContactGroupRequest request,
  2. String resourceName, {
  3. String? $fields,
})

Update the name of an existing contact group owned by the authenticated user.

Updated contact group names must be unique to the users contact groups. Attempting to create a group with a duplicate name will return a HTTP 409 error. Mutate requests for the same user should be sent sequentially to avoid increased latency and failures.

request - The metadata request object.

Request parameters:

resourceName - The resource name for the contact group, assigned by the server. An ASCII string, in the form of contactGroups/{contact_group_id}. Value must have pattern ^contactGroups/\[^/\]+$.

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

Completes with a ContactGroup.

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<ContactGroup> update(
  UpdateContactGroupRequest request,
  core.String resourceName, {
  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/' + core.Uri.encodeFull('$resourceName');

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