utilityGetCatalog method

Future<UtilityCatalogPage?> utilityGetCatalog({
  1. String? countryCode,
  2. String? category,
  3. String? serviceType,
  4. String? currency,
  5. String? cursor,
  6. int? limit,
  7. Future<void>? abortTrigger,
})

Utility catalog

Returns every biller with its offers, page by page, for partner inventory. Returns { items, nextCursor }, ordered by biller 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 billers 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: update your copy by biller id, and remove a biller only when a complete walk did not return it. On 429, wait for Retry-After and request the same page again.

Parameters:

  • String countryCode: Optional ISO 3166-1 alpha-2 country filter, in either case; every country when omitted. A blank value is rejected.

  • String category: Keep the billers of this category, for example electricity.

  • String serviceType: Keep prepaid or postpaid billers.

  • 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<UtilityCatalogPage?> utilityGetCatalog({ String? countryCode, String? category, String? serviceType, String? currency, String? cursor, int? limit, Future<void>? abortTrigger, }) async {
  final response = await utilityGetCatalogWithHttpInfo(countryCode: countryCode, category: category, serviceType: serviceType, 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), 'UtilityCatalogPage',) as UtilityCatalogPage;

  }
  return null;
}