flightsQuote method
- FlightOrderRequest? flightOrderRequest,
- Future<
void> ? abortTrigger,
Quote flights
Prices flight fares again with the airline, without placing an order. Takes the same body as order: { currency, referenceId, items[] } with 1 to 5 items, each { publicId, quantity, inputs } and quantity 1. inputs may be left out: the quote then prices the fare alone. Inputs that are sent are checked as the order checks them, and their paid extras are added to the price. Prices are in currency, or in the API key's currency when it is omitted. Nothing is charged or held. Returns { currency, items, total }. Each item has a new publicId: order with it before details.expiresAt. It keeps the fare's price, which caps an order without inputs.maxPrice. details carries the fare's conditions, included baggage and price breakdown, hasSeatMaps, the paid extras (availableServices) that can be sent in the order's inputs.selectedServices, and fareOptions: the fares for the same flights and airline, cheapest first and including the quoted one, each with its own publicId that can be quoted or ordered. A higher airline price is returned with 200; only inputs.maxPrice stops a quote. Each item is checked completely, its inputs, its publicId and its price, before the next one, and the first failure names its item: an invalid input or a quantity other than 1 gives 400 / 10001 at its path under items[i]; a price above inputs.maxPrice 409 / 11002 at items[i].inputs.maxPrice; an offer the airline no longer sells 409 / 11003 at items[i]; an unknown, expired or another partner's publicId, or a search itinerary id, 400 / 11004 at items[i]. An unsupported currency gives 404 / 10004.
Parameters:
- FlightOrderRequest flightOrderRequest:
Implementation
Future<FlightQuote?> flightsQuote({ FlightOrderRequest? flightOrderRequest, Future<void>? abortTrigger, }) async {
final response = await flightsQuoteWithHttpInfo(flightOrderRequest: flightOrderRequest, 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), 'FlightQuote',) as FlightQuote;
}
return null;
}