airtimeGetOperators method
List airtime operators
Lists the operators of a country that the customer can choose manually (manual flow, step 1). Returns the complete list, without paging or prices, as { items: [{ id, name, countryCode, category, logoUrl }] }, ordered by name. Only operators with an offer that can be sold for a chosen operator are listed. An invalid countryCode gives 400 / 10001. Continue with operators/{id}?phoneNumber=.
Parameters:
- String countryCode (required):
Required ISO 3166-1 alpha-2 country code, in either case, for example the
details.phoneLookup.countryCodeof a search.
Implementation
Future<AirtimeOperatorList?> airtimeGetOperators(String countryCode, { Future<void>? abortTrigger, }) async {
final response = await airtimeGetOperatorsWithHttpInfo(countryCode, 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), 'AirtimeOperatorList',) as AirtimeOperatorList;
}
return null;
}