patch method
Updates or inserts a document.
request - The metadata request object.
Request parameters:
name - The resource name of the document, for example
projects/{project_id}/databases/{database_id}/documents/{document_path}.
Value must have pattern
^projects/\[^/\]+/databases/\[^/\]+/documents/\[^/\]+/.*$.
currentDocument_exists - When set to true, the target document must
exist. When set to false, the target document must not exist.
currentDocument_updateTime - When set, the target document must exist
and have been last updated at that time. Timestamp must be microsecond
aligned.
mask_fieldPaths - The list of field paths in the mask. See
Document.fields for a field path syntax reference.
updateMask_fieldPaths - The list of field paths in the mask. See
Document.fields for a field path syntax reference.
$fields - Selector specifying which fields to include in a partial
response.
Completes with a Document.
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<Document> patch(
Document request,
core.String name, {
core.bool? currentDocument_exists,
core.String? currentDocument_updateTime,
core.List<core.String>? mask_fieldPaths,
core.List<core.String>? updateMask_fieldPaths,
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
'currentDocument.exists': ?currentDocument_exists == null
? null
: ['${currentDocument_exists}'],
'currentDocument.updateTime': ?currentDocument_updateTime == null
? null
: [currentDocument_updateTime],
'mask.fieldPaths': ?mask_fieldPaths,
'updateMask.fieldPaths': ?updateMask_fieldPaths,
'fields': ?$fields == null ? null : [$fields],
};
final url_ = 'v1/' + core.Uri.encodeFull('$name');
final response_ = await _requester.request(
url_,
'PATCH',
body: body_,
queryParams: queryParams_,
);
return Document.fromJson(response_ as core.Map<core.String, core.dynamic>);
}