listDocuments method

Future<Response> listDocuments({
  1. required String collectionId,
  2. List? filters,
  3. int? limit,
  4. int? offset,
  5. String? orderField,
  6. OrderType? orderType,
  7. String? orderCast,
  8. String? search,
})

List Documents

Get a list of all the user documents. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project's documents. Learn more about different API modes.

Implementation

Future<req.Response> listDocuments(
    {required String collectionId,
    List? filters,
    int? limit,
    int? offset,
    String? orderField,
    OrderType? orderType,
    String? orderCast,
    String? search}) {
  final String path = '/database/collections/{collectionId}/documents'
      .replaceAll(RegExp('{collectionId}'), collectionId);

  final Map<String, dynamic> params = {
    'filters': filters,
    'limit': limit,
    'offset': offset,
    'orderField': orderField,
    'orderType': orderType?.name(),
    'orderCast': orderCast,
    'search': search,
  };

  final Map<String, String> headers = {
    'content-type': 'application/json',
  };

  return client.call(HttpMethod.get,
      path: path, params: params, headers: headers);
}