put method
Sends a put requests to the database to write some data.
Tries to write the body to path, or to the virtual root, if not set.
The printMode can be used to control how data is formatted by the
server.
Finally, the eTag parameter can be set to true to request an eTag for
the given data. If you only want to be able to write data if it was not
changed, pass a previously acquired eTag as ifMatch. In case the eTag
does not match, the request will fail with the
ApiConstants.statusCodeETagMismatch status code. To only write data that
does not exist yet, use ApiConstants.nullETag as value for ifMatch.
Implementation
Future<DbResponse> put(
dynamic body, {
String? path,
PrintMode? printMode,
bool eTag = false,
String? ifMatch,
}) async {
final response = await client.put(
_buildUri(
path: path,
printMode: printMode,
),
body: json.encode(body),
headers: _buildHeaders(
hasBody: true,
eTag: eTag,
ifMatch: ifMatch,
),
);
return _parseResponse(response, eTag);
}