giftCardsGetCatalog method

Future<GiftCardCatalogPage?> giftCardsGetCatalog({
  1. String? countryCode,
  2. String? category,
  3. String? valueType,
  4. bool? isRedeemableGlobally,
  5. String? currency,
  6. String? cursor,
  7. int? limit,
  8. Future<void>? abortTrigger,
})

Gift card catalog

Returns every gift card with its offers, page by page, for partner inventory. Returns { items, nextCursor }, ordered by card ID, with the search filters except q. Continue with nextCursor as cursor, the same filters and the same currency until it is null; a page can hold fewer cards than limit, even none, while nextCursor is not null. A cursor reused with other filters or another currency gives 400 / 10001. The walk is not a frozen snapshot: a card that appears or disappears during it may be missing. Quote confirms the final price and availability.

Parameters:

  • String countryCode: Optional ISO 3166-1 alpha-2 issuing country, in either case; every country when omitted. A card without a country is not listed when it is set, and a blank value or GLOBAL is rejected.

  • String category: Keep the cards of this category; categories lists the values.

  • String valueType: Keep only fixed or only range offers; a card left without an offer is dropped.

  • bool isRedeemableGlobally: true keeps only cards that can be redeemed in any country.

  • String currency: Price currency, three letters in either case; the API key's currency when omitted. An unsupported code gives 404 / 10004.

  • String cursor: The nextCursor of the previous page; omit it for the first page. Reuse it only with the same filters and currency.

  • int limit: Page size, 1 to 100; default 100.

Implementation

Future<GiftCardCatalogPage?> giftCardsGetCatalog({ String? countryCode, String? category, String? valueType, bool? isRedeemableGlobally, String? currency, String? cursor, int? limit, Future<void>? abortTrigger, }) async {
  final response = await giftCardsGetCatalogWithHttpInfo(countryCode: countryCode, category: category, valueType: valueType, isRedeemableGlobally: isRedeemableGlobally, currency: currency, cursor: cursor, limit: limit, abortTrigger: abortTrigger,);
  if (response.statusCode >= HttpStatus.badRequest) {
    throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  }
  // When a remote server returns no body with a status of 204, we shall not decode it.
  // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  // FormatException when trying to decode an empty string.
  if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
    return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'GiftCardCatalogPage',) as GiftCardCatalogPage;

  }
  return null;
}