patch method

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

Updates a Folder, changing its display_name.

Changes to the folder display_name will be rejected if they violate either the display_name formatting rules or naming constraints described in the CreateFolder documentation. The Folder's display name must start and end with a letter or digit, may contain letters, digits, spaces, hyphens and underscores and can be between 3 and 30 characters. This is captured by the regular expression: \p{L}\p{N}{1,28}[\p{L}\p{N}]. The caller must have resourcemanager.folders.update permission on the identified folder. If the update fails due to the unique name constraint then a PreconditionFailure explaining this violation will be returned in the Status.details field.

request - The metadata request object.

Request parameters:

name - Output only. The resource name of the Folder. Its format is folders/{folder_id}, for example: "folders/1234". Value must have pattern ^folders/\[^/\]+$.

updateMask - Required. Fields to be updated. Only the display_name can be updated.

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

Completes with a Folder.

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<Folder> patch(
  Folder request,
  core.String name, {
  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_ = 'v2/' + core.Uri.encodeFull('$name');

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