utilitySearch method
Search billers
Searches the billers of a country and returns them with their offers, one page at a time. Returns { items, pagination }. countryCode is required; category, serviceType and q select billers. Utility has no value or price filter. Pages count billers that still have an offer, and prices are indicative, in currency. Quote and order take an offer's publicId, never the biller's id. An invalid or unknown parameter gives 400 / 10001; an unsupported currency gives 404 / 10004.
Parameters:
-
String countryCode (required): Required ISO 3166-1 alpha-2 country code of the billers, in either case.
-
String category: Keep the billers of this category, for example
electricity. -
String serviceType: Keep
prepaidorpostpaidbillers. -
String q: Text in the biller name, case-insensitive; at most 100 characters, without control characters.
-
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<UtilitySearchResult?> utilitySearch(String countryCode, { String? category, String? serviceType, String? q, String? currency, int? page, int? limit, Future<void>? abortTrigger, }) async {
final response = await utilitySearchWithHttpInfo(countryCode, category: category, serviceType: serviceType, q: q, currency: currency, page: page, 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), 'UtilitySearchResult',) as UtilitySearchResult;
}
return null;
}