hotelsGetDestinations method
Search hotel destinations
Finds the places to search hotels in by name: a country, a region, a city or a district. Returns { items }: at most limit places whose names match q, most relevant first, without paging. Send a place's id as searchCriteria.location.geoNodeId in a search; it finds the hotels of every place inside it. name includes the place's parents, for example "Downtown Dubai, Dubai, United Arab Emirates", and category is its level: country, region, city or area. Only places where OpenRoam has had hotels are listed. q is required: plain text, at most 100 characters, without control characters. countryCode keeps the places of one ISO 3166-1 alpha-2 country; limit is 1–100 (default 10). An invalid or blank value, or any other query parameter, gives 400 / 10001. 503 / 10007 when the destination index is unavailable or does not answer within 5 seconds: retry.
Parameters:
-
String q (required): Required. Free text over place names, for example
downtown dub; at most 100 characters, without control characters. -
String countryCode: Optional ISO 3166-1 alpha-2 country, in either case: only places in that country. A blank value is rejected.
-
int limit: The most places to return, 1 to 100; default 10.
Implementation
Future<HotelDestinationList?> hotelsGetDestinations(String q, { String? countryCode, int? limit, Future<void>? abortTrigger, }) async {
final response = await hotelsGetDestinationsWithHttpInfo(q, countryCode: countryCode, limit: limit, 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), 'HotelDestinationList',) as HotelDestinationList;
}
return null;
}