com.amadeus.airport.predictions.AirportOnTime Maven / Gradle / Ivy
package com.amadeus.airport.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/airport/predictions/on-time
endpoints.
*
*
*
* Access via the Amadeus client object.
*
*
*
* Amadeus amadeus = Amadeus.builder("clientId", "secret").build();
* amadeus.airport.predictions.onTime;
*/
public class AirportOnTime {
private Amadeus client;
/**
* Constructor.
* @hide
*/
public AirportOnTime(Amadeus client) {
this.client = client;
}
/**
*
* Returns a percentage of on-time flight from a given airport.
*
*
*
* OnTime airportOnTime = amadeus.airport.predictions.onTime.get(Params
* .with("airportCode", "NCE")
* .and("date", "2020-09-01"));
*
* @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/airport/predictions/on-time", params);
return (Prediction) Resource.fromObject(response, Prediction.class);
}
/**
* Convenience method for calling get
without any parameters.
* @see AirportOnTime#get()
*/
public Prediction get() throws ResponseException {
return get(null);
}
}