airtimeSearchWithHttpInfo method
Search airtime by phone number
Searches for a phone number's operator by carrier lookup and returns it with its offers (detected flow). Returns { items, pagination, details: { phoneLookup: { status, carrierName, countryCode } } }. items holds at most the detected operator with its offers. It is empty when status is not detected or no offer remains after the filters; then let the customer choose the operator with GET operators?countryCode=, using details.phoneLookup.countryCode. Each call makes exactly one carrier lookup and returns at most one item, so page must be 1. A phoneNumber that is not in international format gives 400 / 10001; a carrier lookup that fails gives 503 / 10007, retry later.
Note: This method returns the HTTP Response.
Parameters:
-
String phoneNumber (required): The recipient's number in international format, starting with + or 00; spaces, hyphens and parentheses are allowed.
-
String valueType: Keep only
fixedor onlyrangeoffers. -
String valueCurrency: Currency of
minValueandmaxValue, three letters; required with either of them. -
num minValue: Keep the offers whose value reaches at least this amount, in
valueCurrency. -
num maxValue: Keep the offers whose value starts at or below this amount, in
valueCurrency. -
num minPrice: Keep the offers whose indicative price reaches at least this amount, in the price currency.
-
num maxPrice: Keep the offers whose indicative price starts at or below this amount, in the price currency. A filter, not the
inputs.maxPricelimit of a purchase. -
String currency: Price currency, three letters in either case; the API key's currency when omitted. An unsupported code gives 404 / 10004.
-
int page: Must be 1: search returns at most one operator.
-
int limit: Page size, 1 to 100; default 10.
Implementation
Future<Response> airtimeSearchWithHttpInfo(String phoneNumber, { String? valueType, String? valueCurrency, num? minValue, num? maxValue, num? minPrice, num? maxPrice, String? currency, int? page, int? limit, Future<void>? abortTrigger, }) async {
// ignore: prefer_const_declarations
final path = r'/api/v1/b2b/airtime/search';
// ignore: prefer_final_locals
Object? postBody;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
queryParams.addAll(_queryParams('', 'phoneNumber', phoneNumber));
if (valueType != null) {
queryParams.addAll(_queryParams('', 'valueType', valueType));
}
if (valueCurrency != null) {
queryParams.addAll(_queryParams('', 'valueCurrency', valueCurrency));
}
if (minValue != null) {
queryParams.addAll(_queryParams('', 'minValue', minValue));
}
if (maxValue != null) {
queryParams.addAll(_queryParams('', 'maxValue', maxValue));
}
if (minPrice != null) {
queryParams.addAll(_queryParams('', 'minPrice', minPrice));
}
if (maxPrice != null) {
queryParams.addAll(_queryParams('', 'maxPrice', maxPrice));
}
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,
);
}