update method
Updates the entire contents of a resource.
Implements the FHIR standard update interaction
(DSTU2,
STU3,
R4,
R5). If the specified resource
does not exist and the FHIR store has enable_update_create set, creates
the resource with the client-specified ID. It is strongly advised not to
include or encode any sensitive data such as patient identifiers in
client-specified resource IDs. Those IDs are part of the FHIR resource
path recorded in Cloud Audit Logs and Pub/Sub notifications. Those IDs can
also be contained in reference fields within other resources. The request
body must contain a JSON-encoded FHIR resource, and the request headers
must contain Content-Type: application/fhir+json. The resource must
contain an id element having an identical value to the ID in the REST
path of the request. On success, the response body contains a JSON-encoded
representation of the updated resource, including the server-assigned
version ID. Errors generated by the FHIR store contain a JSON-encoded
OperationOutcome resource describing the reason for the error. If the
request cannot be mapped to a valid API method on a FHIR store, a generic
GCP error might be returned instead. The conditional update interaction
If-None-Match is supported, including the wildcard behaviour, as defined
by the R5 spec. This functionality is supported in R4 and R5. For samples
that show how to call update, see
Updating a FHIR resource.
request - The metadata request object.
Request parameters:
name - Required. The name of the resource to update.
Value must have pattern
^projects/\[^/\]+/locations/\[^/\]+/datasets/\[^/\]+/fhirStores/\[^/\]+/fhir/\[^/\]+/\[^/\]+$.
$fields - Selector specifying which fields to include in a partial
response.
Completes with a HttpBody.
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<HttpBody> update(
HttpBody request,
core.String name, {
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('$name');
final response_ = await _requester.request(
url_,
'PUT',
body: body_,
queryParams: queryParams_,
);
return HttpBody.fromJson(response_ as core.Map<core.String, core.dynamic>);
}