hotelsGetProperty method

Future<CatalogHotel?> hotelsGetProperty(
  1. String id, {
  2. Future<void>? abortTrigger,
})

Get a hotel

Returns one hotel's content: the item that search returns, without offers. Use it to show a hotel's information: name, description, star rating, address, images, amenities and contact. A hotel has no price without a stay, so the response has no offers key; send the id in a search's searchCriteria.hotelIds for its rates. The route serves the hotels of the OpenRoam catalog, as the catalog files list them. An ID that is unknown, not a hotel ID, or not in the catalog (such as a temporary ID a search gave a hotel outside the catalog) gives 404 / 10004. The route takes no query parameters.

Parameters:

  • String id (required): The hotel's id (hotel_…) from search or the catalog files.

Implementation

Future<CatalogHotel?> hotelsGetProperty(String id, { Future<void>? abortTrigger, }) async {
  final response = await hotelsGetPropertyWithHttpInfo(id, 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), 'CatalogHotel',) as CatalogHotel;

  }
  return null;
}