com.amadeus.travel.predictions.TripPurpose Maven / Gradle / Ivy
package com.amadeus.travel.predictions;
import com.amadeus.Amadeus;
import com.amadeus.Params;
import com.amadeus.Response;
import com.amadeus.exceptions.ResponseException;
import com.amadeus.resources.Prediction;
import com.amadeus.resources.Resource;
/**
*
* A namespaced client for the
* /v1/travel/predictions/trip-purpose
endpoints.
*
*
*
* Access via the Amadeus client object.
*
*
*
* Amadeus amadeus = Amadeus.builder("clientId", "secret").build();
* amadeus.travel.predictions.tripPurpose;
*/
public class TripPurpose {
private Amadeus client;
/**
* Constructor.
*
* @hide
*/
public TripPurpose(Amadeus client) {
this.client = client;
}
/**
*
* Returns a trip purpose prediction.
*
*
*
* amadeus.travel.predictions.tripPurpose.get(Params
* .with("originLocationCode", "NYC")
* .and("destinationLocationCode", "MAD")
* .and("departureDate", "2020-08-01")
* .and("returnDate", "2020-08-12"));
*
*
* @param params the parameters to send to the API
* @return an API response object
* @throws ResponseException when an exception occurs
*/
public Prediction get(Params params) throws ResponseException {
Response response = client.get("/v1/travel/predictions/trip-purpose", params);
return (Prediction) Resource.fromObject(response, Prediction.class);
}
/**
* Convenience method for calling get
without any parameters.
*
* @see TripPurpose#get()
*/
public Prediction get() throws ResponseException {
return get(null);
}
}