append method
- Map<
String, dynamic> values, - String parentId, [
- AppendOptions? options
Appends the input object to the object list field of a parent object
identified by parentId
. This method is valid only for sub-model
object-lists, object-lists with a parent. If this method is called
for a top-level model object or sub-model object, an error will be
returned.
If the id
is provided as input to this DBObject, its value will be
ignored by this method since Altogic will automatically assign an id
for new objects created in the database.
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 create in
the database.
parentId
the id of the parent object.
options
Create operation options. By default no caching of the newly
created object in Redis store and no top level object return.
Returns the newly create object in the database.
Implementation
Future<APIResponse<Map<String, dynamic>>> append(
Map<String, dynamic> values, String parentId,
[AppendOptions? options]) =>
_fetcher
.post<Map<String, dynamic>>('/_api/rest/v1/db/object/append', body: {
'values': values,
'options': DEFAULT_APPEND_OPTIONS.merge(options).toJson(),
'model': _modelName,
if (_id != null) 'id': _id,
'parentId': parentId
});