|
| 1 | +package com.amadeus.travel.analytics.airTraffic; |
| 2 | + |
| 3 | +import com.amadeus.Amadeus; |
| 4 | +import com.amadeus.Params; |
| 5 | +import com.amadeus.Response; |
| 6 | +import com.amadeus.exceptions.ResponseException; |
| 7 | +import com.amadeus.resources.AirTraffic; |
| 8 | +import com.amadeus.resources.Resource; |
| 9 | +import com.google.gson.Gson; |
| 10 | + |
| 11 | +/** |
| 12 | + * <p> |
| 13 | + * A namespaced client for the |
| 14 | + * <code>/v1/travel/analytics/air-traffic/booked</code> endpoints. |
| 15 | + * </p> |
| 16 | + * |
| 17 | + * <p> |
| 18 | + * Access via the Amadeus client object. |
| 19 | + * </p> |
| 20 | + * |
| 21 | + * <pre> |
| 22 | + * Amadeus amadeus = Amadeus.builder("clientId", "secret").build(); |
| 23 | + * amadeus.travel.analytics.airTraffis.booked;</pre> |
| 24 | + */ |
| 25 | +public class Booked { |
| 26 | + private Amadeus client; |
| 27 | + |
| 28 | + /** |
| 29 | + * Constructor. |
| 30 | + * @hide |
| 31 | + */ |
| 32 | + public Booked(Amadeus client) { |
| 33 | + this.client = client; |
| 34 | + } |
| 35 | + |
| 36 | + /** |
| 37 | + * <p> |
| 38 | + * Returns a list of air traffic reports. |
| 39 | + * </p> |
| 40 | + * |
| 41 | + * <pre> |
| 42 | + * amadeus.travel.analytics.airTraffic.booked.get(Params |
| 43 | + * .with("origin", "LHR") |
| 44 | + * .and("period", "2017-03"));</pre> |
| 45 | + * |
| 46 | + * @param params the parameters to send to the API |
| 47 | + * @return an API response object |
| 48 | + * @throws ResponseException when an exception occurs |
| 49 | + */ |
| 50 | + public AirTraffic[] get(Params params) throws ResponseException { |
| 51 | + Response response = client.get("/v1/travel/analytics/air-traffic/booked", params); |
| 52 | + return (AirTraffic[]) Resource.fromArray(response, AirTraffic[].class); |
| 53 | + } |
| 54 | + |
| 55 | + /** |
| 56 | + * Convenience method for calling <code>get</code> without any parameters. |
| 57 | + * @see Booked#get() |
| 58 | + */ |
| 59 | + public AirTraffic[] get() throws ResponseException { |
| 60 | + return get(null); |
| 61 | + } |
| 62 | +} |
0 commit comments