listBuckets method

Lists all buckets. @param {ICollectionFilters} params Filter for listing collections. @returns Array of StorageBucket objects.

Implementation

Future<IApillonList<StorageBucket>> listBuckets(
    IApillonPagination? params) async {
  final url = constructUrlWithQueryParams(apiPrefix, params?.toJson());
  final data =
      await ApillonApi.get<IApillonList>(url, mapper: IApillonList.fromJson);

  return IApillonList<StorageBucket>(
      total: data.total,
      items: data.items
          .map<StorageBucket>(
              (bucket) => StorageBucket(bucket["bucketUuid"], data: bucket))
          .toList());
}