airtimeGetOperator method

Future<AirtimeOperator?> airtimeGetOperator(
  1. String id,
  2. String phoneNumber, {
  3. String? valueType,
  4. String? valueCurrency,
  5. num? minValue,
  6. num? maxValue,
  7. num? minPrice,
  8. num? maxPrice,
  9. String? currency,
  10. Future<void>? abortTrigger,
})

Get an airtime operator

Returns one operator with its offers for a phone number of its country (manual flow, step 2). Returns the operator in the item shape that search returns, without a carrier lookup. A number of another country than the operator's gives 400 / 10001 with COUNTRY_MISMATCH at phoneNumber. An unknown or unparseable ID, or an operator without an orderable offer, gives 404 / 10004. Offer filters that match none of the operator's offers leave offers empty. A manual choice is not checked against the number's carrier, so have the customer confirm the operator before ordering.

Parameters:

  • String id (required): The operator ID from the operator list, the catalog or search.

  • String phoneNumber (required): The recipient's number in international format, starting with + or 00. It must belong to the operator's country.

  • String valueType: Keep only fixed or only range offers.

  • String valueCurrency: Currency of minValue and maxValue, 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.maxPrice limit 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.

Implementation

Future<AirtimeOperator?> airtimeGetOperator(String id, String phoneNumber, { String? valueType, String? valueCurrency, num? minValue, num? maxValue, num? minPrice, num? maxPrice, String? currency, Future<void>? abortTrigger, }) async {
  final response = await airtimeGetOperatorWithHttpInfo(id, phoneNumber, valueType: valueType, valueCurrency: valueCurrency, minValue: minValue, maxValue: maxValue, minPrice: minPrice, maxPrice: maxPrice, currency: currency, 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), 'AirtimeOperator',) as AirtimeOperator;

  }
  return null;
}