update method

Future<APIResponse<Map<String, dynamic>>> update(
  1. Map<String, dynamic> values, [
  2. UpdateOptions? options
])

Updates the object referred to by this db object and identified by the id using the input values. This method directly sets the field values of the object in the database with the values provided in the input.

If the client library key is set to enforce session, an active user session is required (e.g., user needs to be logged in) to call this method.

values An object that contains the fields and their values to update in the database

options Update operation options. By default no caching of the updated object in Redis store and no top level object return.

Returns the updated object in the database. If returnTop is set to true in UpdateOptions and if the updated object is a sub-model or sub-model-list object, it returns the updated top-level object.

Implementation

Future<APIResponse<Map<String, dynamic>>> update(Map<String, dynamic> values,
        [UpdateOptions? options]) =>
    _fetcher
        .post<Map<String, dynamic>>('/_api/rest/v1/db/object/update', body: {
      'values': values,
      'options': DEFAULT_UPDATE_OPTIONS.merge(options).toJson(),
      'model': _modelName,
      'id': _id,
    });