giftCardsSearchWithHttpInfo method
Search gift cards
Searches gift cards and returns them with their offers, one page at a time. Returns { items, pagination }. countryCode, category, q and isRedeemableGlobally select cards; valueType selects offers within them, and a card left without an offer is dropped. Pages count cards. Prices are indicative, in currency; a fixed offer is listed only when it is cheaper than the card's range at the same value. An invalid or unknown parameter gives 400 / 10001; an unsupported currency gives 404 / 10004.
Note: This method returns the HTTP Response.
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
GLOBALis rejected. -
String category: Keep the cards of this category;
categorieslists the values. -
String valueType: Keep only
fixedor onlyrangeoffers; a card left without an offer is dropped. -
String q: Brand name or card ID, case-insensitive; at most 100 characters, without control characters.
-
bool isRedeemableGlobally:
truekeeps 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.
-
int page: Page number, from 1; default 1.
-
int limit: Page size, 1 to 100; default 10.
Implementation
Future<Response> giftCardsSearchWithHttpInfo({ String? countryCode, String? category, String? valueType, String? q, bool? isRedeemableGlobally, String? currency, int? page, int? limit, Future<void>? abortTrigger, }) async {
// ignore: prefer_const_declarations
final path = r'/api/v1/b2b/giftcards/search';
// ignore: prefer_final_locals
Object? postBody;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
if (countryCode != null) {
queryParams.addAll(_queryParams('', 'countryCode', countryCode));
}
if (category != null) {
queryParams.addAll(_queryParams('', 'category', category));
}
if (valueType != null) {
queryParams.addAll(_queryParams('', 'valueType', valueType));
}
if (q != null) {
queryParams.addAll(_queryParams('', 'q', q));
}
if (isRedeemableGlobally != null) {
queryParams.addAll(_queryParams('', 'isRedeemableGlobally', isRedeemableGlobally));
}
if (currency != null) {
queryParams.addAll(_queryParams('', 'currency', currency));
}
if (page != null) {
queryParams.addAll(_queryParams('', 'page', page));
}
if (limit != null) {
queryParams.addAll(_queryParams('', 'limit', limit));
}
const contentTypes = <String>[];
return apiClient.invokeAPI(
path,
'GET',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
abortTrigger: abortTrigger,
);
}