src/amadeus/namespaces/shopping/flight_offers/flight_choice_prediction.js
/**
* A namespaced client for the
* `/v1/shopping/flight-offers/prediction` endpoints
*
* Access via the {@link Amadeus} object
*
* ```js
* let amadeus = new Amadeus();
* amadeus.shopping.flightOffers.prediction;
* ```
*
* @param {Client} client
*/
class FlightChoicePrediction {
constructor(client) {
this.client = client;
}
/**
* Returns a list of flight offers with the probability to be chosen.
*
* @param {Object} params
* @return {Promise.<Response,ResponseError>} a Promise
*
* Returns flights from NYC to MAD with the probability to be chosen.
*
* ```js
* amadeus.shopping.flightOffersSearch.get({
* originLocationCode: 'SYD',
* destinationLocationCode: 'BKK',
* departureDate: '2020-08-01',
* adults: '2'
* }).then(function(response){
* return amadeus.shopping.flightOffers.prediction.post(
* JSON.stringify(response)
* );
* }).then(function(response){
* console.log(response.data);
* }).catch(function(responseError){
* console.log(responseError);
* });
* ```
*/
post(params = {}) {
return this.client.post('/v2/shopping/flight-offers/prediction', params);
}
}
export default FlightChoicePrediction;