patch method

Future<Space> patch(
  1. Space request,
  2. String name, {
  3. String? updateMask,
  4. bool? useAdminAccess,
  5. String? $fields,
})

Updates a space.

For an example, see Update a space. If you're updating the displayName field and receive the error message ALREADY_EXISTS, try a different display name.. An existing space within the Google Workspace organization might already use this display name. Supports the following types of authentication:

App authentication with administrator approval in Developer Preview - User authentication You can authenticate and authorize this method with administrator privileges by setting the use_admin_access field in the request.

request - The metadata request object.

Request parameters:

name - Identifier. Resource name of the space. Format: spaces/{space} Where {space} represents the system-assigned ID for the space. You can obtain the space ID by calling the [spaces.list()](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/list) method or from the space URL. For example, if the space URL is https://mail.google.com/mail/u/0/#chat/space/AAAAAAAAA, the space ID is AAAAAAAAA. Value must have pattern ^spaces/\[^/\]+$.

updateMask - Required. The updated field paths, comma separated if there are multiple. You can update the following fields for a space: space_details: Updates the space's description. Supports up to 150 characters. display_name: Only supports updating the display name for spaces where spaceType field is SPACE. If you receive the error message ALREADY_EXISTS, try a different value. An existing space within the Google Workspace organization might already use this display name. space_type: Only supports changing a GROUP_CHAT space type to SPACE. Include display_name together with space_type in the update mask and ensure that the specified space has a non-empty display name and the SPACE space type. Including the space_type mask and the SPACE type in the specified space when updating the display name is optional if the existing space already has the SPACE type. Trying to update the space type in other ways results in an invalid argument error. space_type is not supported with useAdminAccess. space_history_state: Updates space history settings by turning history on or off for the space. Only supported if history settings are enabled for the Google Workspace organization. To update the space history state, you must omit all other field masks in your request. space_history_state is not supported with useAdminAccess. access_settings.audience: Updates the access setting of who can discover the space, join the space, and preview the messages in named space where spaceType field is SPACE. If the existing space has a target audience, you can remove the audience and restrict space access by omitting a value for this field mask. To update access settings for a space, the authenticating user must be a space manager and omit all other field masks in your request. You can't update this field if the space is in import mode. To learn more, see Make a space discoverable to specific users. access_settings.audience is not supported with useAdminAccess. permission_settings: Supports changing the permission settings of a space. When updating permission settings, you can only specify permissionSettings field masks; you cannot update other field masks at the same time. permissionSettings is not supported with useAdminAccess. The supported field masks include: - permission_settings.manageMembersAndGroups - permission_settings.modifySpaceDetails - permission_settings.toggleHistory - permission_settings.useAtMentionAll - permission_settings.manageApps - permission_settings.manageWebhooks - permission_settings.replyMessages

useAdminAccess - Optional. When true, the method runs using the user's Google Workspace administrator privileges. The calling user must be a Google Workspace administrator with the manage chat and spaces conversations privilege. Requires the chat.admin.spaces OAuth 2.0 scope. Some FieldMask values are not supported using admin access. For details, see the description of update_mask.

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

Completes with a Space.

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<Space> patch(
  Space request,
  core.String name, {
  core.String? updateMask,
  core.bool? useAdminAccess,
  core.String? $fields,
}) async {
  final body_ = convert.json.encode(request);
  final queryParams_ = <core.String, core.List<core.String>>{
    if (updateMask != null) 'updateMask': [updateMask],
    if (useAdminAccess != null) 'useAdminAccess': ['${useAdminAccess}'],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'v1/' + core.Uri.encodeFull('$name');

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