createDocument method
Create Document
Create a new Document. Before using this route, you should create a new collection resource using either a server integration API or directly from your database console.
Implementation
Future<req.Response> createDocument(
{required String collectionId,
required Map data,
List? read,
List? write,
String? parentDocument,
String? parentProperty,
String? parentPropertyType}) {
final String path = '/database/collections/{collectionId}/documents'
.replaceAll(RegExp('{collectionId}'), collectionId);
final Map<String, dynamic> params = {
'data': data,
'read': read,
'write': write,
'parentDocument': parentDocument,
'parentProperty': parentProperty,
'parentPropertyType': parentPropertyType,
};
final Map<String, String> headers = {
'content-type': 'application/json',
};
return client.call(HttpMethod.post,
path: path, params: params, headers: headers);
}