com.amadeus.travel.predictions.FlightDelay 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/flight-delay
endpoints.
*
*
*
* Access via the Amadeus client object.
*
*
*
* Amadeus amadeus = Amadeus.builder("clientId", "secret").build();
* amadeus.travel.predictions.flightDelay;
*/
public class FlightDelay {
private Amadeus client;
/**
* Constructor.
* @hide
*/
public FlightDelay(Amadeus client) {
this.client = client;
}
/**
*
* Predicts delay of a given flight.
*
*
*
* Delay[] flightDelay = amadeus.travel.predictions.flightDelay.get(Params
* .with("originLocationCode", "NCE")
* .and("destinationLocationCode", "IST")
* .and("departureDate", "2020-08-01")
* .and("departureTime", "18:20:00"))
* .and("arrivalDate", "2020-08-01")
* .and("arrivalTime", "22:15:00")
* .and("aircraftCode", "321"))
* .and("carrierCode", "TK")
* .and("flightNumber", "1816")
* .and("duration", "PT31H10M"));
*
* @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/flight-delay", params);
return (Prediction[]) Resource.fromArray(response, Prediction[].class);
}
/**
* Convenience method for calling get
without any parameters.
* @see FlightDelay#get()
*/
public Prediction[] get() throws ResponseException {
return get(null);
}
}