import method

Future<void> import(
  1. List<CollectionModel> collections, {
  2. bool deleteMissing = false,
  3. Map<String, dynamic> body = const {},
  4. Map<String, dynamic> query = const {},
  5. Map<String, String> headers = const {},
})

Imports the provided collections.

If deleteMissing is true, all local collections and schema fields, that are not present in the imported configuration, WILL BE DELETED (including their related records data)!

Implementation

Future<void> import(
  List<CollectionModel> collections, {
  bool deleteMissing = false,
  Map<String, dynamic> body = const {},
  Map<String, dynamic> query = const {},
  Map<String, String> headers = const {},
}) {
  final enrichedBody = Map<String, dynamic>.of(body);
  enrichedBody["collections"] = collections;
  enrichedBody["deleteMissing"] = deleteMissing;

  return client.send(
    "$baseCrudPath/import",
    method: "PUT",
    body: enrichedBody,
    query: query,
    headers: headers,
  );
}