hotelsQuote method
- HotelOrderRequest? hotelOrderRequest,
- Future<
void> ? abortTrigger,
Quote hotel rates
Prices up to 5 searched or quoted rates again with the hotel system and issues a new offer for each. Takes the same body as order, { currency, referenceId, items }, and checks it the same way: the whole body first, so a body error gives 400 / 10001 also when it is in a later item, then each item completely (its inputs, its publicId, then a fresh price from the hotel system) before the next, in request order. inputs may be left out; when sent, they are checked as the order checks them. The body and every object in it reject an unknown member (400 / 10001). Stay dates and rooms come from the offer and are returned in each item's details. Nothing is charged or reserved. Each item returns a new publicId for its rate at the current price (the whole stay, all rooms and nights): order with it before details.expiresAt, which is at most 30 minutes away and never past an expiry the hotel system states. A price that rose since the search is returned with 200; only inputs.maxPrice stops a quote, with 409 / 11002 at items[i].inputs.maxPrice. details.availability is onRequest for a rate that is held only on request, which an order refuses with 409 / 11003. Errors name the failing item: a rate that is no longer sold is 409 / 11003, and an unknown, expired or another partner's publicId, another product's offer, a hotel's own id or an expired search session (search again) is 400 / 11004, each at items[i]; input errors (400 / 10001) are at items[i].inputs…. Offer and hotel-system failures return their hotel codes without a path: 503 / 21003 when offers are temporarily unavailable, 21007–21009, and 400 / 21010 when the hotel's room layout no longer matches the searched occupancy (search again).
Parameters:
- HotelOrderRequest hotelOrderRequest:
Implementation
Future<HotelQuote?> hotelsQuote({ HotelOrderRequest? hotelOrderRequest, Future<void>? abortTrigger, }) async {
final response = await hotelsQuoteWithHttpInfo(hotelOrderRequest: hotelOrderRequest, 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), 'HotelQuote',) as HotelQuote;
}
return null;
}