|
| 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.Period; |
| 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/busiest-period</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.busiestPeriod;</pre> |
| 24 | + */ |
| 25 | +public class BusiestPeriod { |
| 26 | + private Amadeus client; |
| 27 | + public static String ARRIVING = "ARRIVING"; |
| 28 | + public static String DEPARTING = "DEPARTING"; |
| 29 | + |
| 30 | + /** |
| 31 | + * Constructor. |
| 32 | + * @hide |
| 33 | + */ |
| 34 | + public BusiestPeriod(Amadeus client) { |
| 35 | + this.client = client; |
| 36 | + } |
| 37 | + |
| 38 | + /** |
| 39 | + * <p> |
| 40 | + * Returns a list of busiest periods reports. |
| 41 | + * </p> |
| 42 | + * |
| 43 | + * <pre> |
| 44 | + * amadeus.travel.analytics.airTraffic.busiestPeriod.get(Params |
| 45 | + * .with("cityCode", "PAR") |
| 46 | + * .and("period", "2017"));</pre> |
| 47 | + * |
| 48 | + * @param params the parameters to send to the API |
| 49 | + * @return an API response object |
| 50 | + * @throws ResponseException when an exception occurs |
| 51 | + */ |
| 52 | + public Period[] get(Params params) throws ResponseException { |
| 53 | + Response response = client.get("/v1/travel/analytics/air-traffic/busiest-period", params); |
| 54 | + return (Period[]) Resource.fromArray(response, Period[].class); |
| 55 | + } |
| 56 | + |
| 57 | + /** |
| 58 | + * Convenience method for calling <code>get</code> without any parameters. |
| 59 | + * @see Traveled#get() |
| 60 | + */ |
| 61 | + public Period[] get() throws ResponseException { |
| 62 | + return get(null); |
| 63 | + } |
| 64 | +} |
0 commit comments