patch method
Updates the specified metadata for the specified version.
This method will fail with FAILED_PRECONDITION
in the event of an
invalid state transition. The supported
[state](../sites.versions#versionstatus) transitions for a version are
from CREATED
to FINALIZED
. Use [DeleteVersion
](delete) to set the
status of a version to DELETED
.
request
- The metadata request object.
Request parameters:
name
- The fully-qualified resource name for the version, in the format:
sites/ SITE_ID/versions/VERSION_ID This name is provided in the response
body when you call [CreateVersion
](sites.versions/create).
Value must have pattern ^sites/\[^/\]+/versions/\[^/\]+$
.
updateMask
- A set of field names from your
[version](../sites.versions) that you want to update. A field will be
overwritten if, and only if, it's in the mask. If a mask is not provided
then a default mask of only
[status
](../sites.versions#Version.FIELDS.status) will be used.
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a Version.
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<Version> patch(
Version 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 = 'v1beta1/' + core.Uri.encodeFull('$name');
final _response = await _requester.request(
_url,
'PATCH',
body: _body,
queryParams: _queryParams,
);
return Version.fromJson(_response as core.Map<core.String, core.dynamic>);
}