append method

Future<BagelResponse> append(
  1. dynamic fieldSlug,
  2. dynamic value
)

Append a reference to an ItemRef field to avoid having to put the enire array This halps avoid conflicts between different clients

Implementation

Future<BagelResponse> append(fieldSlug, value) async {
  String url =
      '$baseEndpoint/collection/$collectionID/items/$_item/field/$fieldSlug';
  if (nestedCollectionsIDs.isNotEmpty) {
    String nestedID = nestedCollectionsIDs.join(".");
    url = '$url?nestedID=$nestedID';
  }
  Dio dio = await _dio();
  Response response = await dio.put(url, data: {"value": value});
  BagelResponse res = BagelResponse(
    data: response.data,
    statusCode: response.statusCode!,
  );
  return res;
}