write method
Creates or replaces a document
Implementation
Future<Map<String, dynamic>> write(
String index,
String collection,
Map<String, dynamic> document, {
String? id,
bool waitForRefresh = false,
}) async {
final response = await kuzzle.query(KuzzleRequest(
action: 'write',
collection: collection,
controller: name,
index: index,
body: document,
uid: id,
waitForRefresh: waitForRefresh,
));
if (response.result != null) {
return response.result as Map<String, dynamic>;
}
throw BadResponseFormatError(
response.error?.id, '$name.exists: bad response format', response);
}