listFiles method

Future<FileList> listFiles({
  1. required String bucketId,
  2. List<String>? queries,
  3. String? search,
  4. bool? total,
})

Get a list of all the user files. You can use the query params to filter your results.

Implementation

Future<models.FileList> listFiles(
    {required String bucketId,
    List<String>? queries,
    String? search,
    bool? total}) async {
  final String apiPath =
      '/storage/buckets/{bucketId}/files'.replaceAll('{bucketId}', bucketId);

  final Map<String, dynamic> apiParams = {
    if (queries != null) 'queries': queries,
    if (search != null) 'search': search,
    if (total != null) 'total': total,
  };

  final Map<String, String> apiHeaders = {
    'X-Appwrite-Project': client.config['project'] ?? '',
    'accept': 'application/json',
  };

  final res = await client.call(HttpMethod.get,
      path: apiPath, params: apiParams, headers: apiHeaders);

  return models.FileList.fromMap(res.data);
}