flightsSearchWithHttpInfo method
- FlightSearchRequest? flightSearchRequest,
- Future<
void> ? abortTrigger,
Search flights
Searches flight itineraries and the fares bookable on them. Send one slice per flight (one for one-way, two for a return, more for a multi-city trip) and every passenger; at least one passenger must be an adult, and children and infants need an age. Optional filters: maxStops, preferredAirlines and excludedAirlines select itineraries; refundableOnly and maxPrice select fares, and an itinerary left without a fare is not returned. The body rejects an unknown field at every level, and the route takes no query parameters. Returns { items, pagination }. Each item is one itinerary, the same flights sold by the same airline, with its fares as offers, cheapest first; items are ordered by their cheapest fare, then total duration. page and limit (defaults 1 and 10, limit at most 100) page through itineraries, and pagination.totalCount counts them. Each page runs a new airline search, so fares can change between pages. An item's id is valid only within this response and cannot be ordered; quote and order an offer's publicId before its details.expiresAt. Prices are for all passengers, in currency or the API key's currency, and are indicative. Errors: an invalid or unknown field, or a query parameter, 400 / 10001; an unsupported currency 404 / 10004.
Note: This method returns the HTTP Response.
Parameters:
- FlightSearchRequest flightSearchRequest:
Implementation
Future<Response> flightsSearchWithHttpInfo({ FlightSearchRequest? flightSearchRequest, Future<void>? abortTrigger, }) async {
// ignore: prefer_const_declarations
final path = r'/api/v1/b2b/flights/search';
// ignore: prefer_final_locals
Object? postBody = flightSearchRequest;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
const contentTypes = <String>['application/json', 'text/json', 'application/*+json'];
return apiClient.invokeAPI(
path,
'POST',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
abortTrigger: abortTrigger,
);
}