airtimeQuote method
Future<AirtimeQuote?>
airtimeQuote({
- AirtimeOrderRequest? airtimeOrderRequest,
- Future<
void> ? abortTrigger,
Quote airtime
Prices the order body with current prices, without placing an order. Takes the same body as order and resolves the number's operator as the order does, with a carrier lookup per item. Each item is priced on its own, in request order; the first failing item aborts the quote and is named at items[i], for example 409 / 11002 at items[i].inputs.maxPrice when the current price is above it. 409 / 20000 means the lookup shows that the offer's operator cannot be the number's: search again. A carrier lookup that fails gives 503 / 10007. A quote reserves nothing and does not expire; to hold the quoted price, send it as inputs.maxPrice in the order.
Parameters:
- AirtimeOrderRequest airtimeOrderRequest:
Implementation
Future<AirtimeQuote?> airtimeQuote({ AirtimeOrderRequest? airtimeOrderRequest, Future<void>? abortTrigger, }) async {
final response = await airtimeQuoteWithHttpInfo(airtimeOrderRequest: airtimeOrderRequest, 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), 'AirtimeQuote',) as AirtimeQuote;
}
return null;
}