listCollections method

Future<IApillonList<NftCollection>> listCollections(
  1. ICollectionFilters? params
)

Lists all nft collections available. @param {ICollectionFilters} params Filter for listing collections. @returns Array of NftCollection.

Implementation

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

  return IApillonList<NftCollection>(
      total: data.total,
      items: data.items
          .map<NftCollection>(
              (nft) => NftCollection(nft["collectionUuid"], nft))
          .toList());
}