|
6 | 6 | import com.amadeus.exceptions.ResponseException; |
7 | 7 | import com.amadeus.resources.FlightOfferSearch; |
8 | 8 | import com.amadeus.resources.Resource; |
| 9 | +import com.google.gson.JsonObject; |
9 | 10 |
|
| 11 | +/** |
| 12 | + * <p> |
| 13 | + * A namespaced client for the |
| 14 | + * <code>/v2/shopping/flight-offers</code> endpoints. |
| 15 | + * </p> |
| 16 | + * |
| 17 | + * <p> |
| 18 | + * Access via the Amadeus client object. |
| 19 | + * </p> |
| 20 | + * |
| 21 | + * <pre> |
| 22 | + * Amadeus amadeus = Amadeus.builder(API_KEY, API_SECRET).build(); |
| 23 | + * amadeus.shopping.flightOffersSearch;</pre> |
| 24 | + */ |
10 | 25 | public class FlightOffersSearch { |
11 | 26 | private Amadeus client; |
12 | 27 |
|
| 28 | + /** |
| 29 | + * Constructor. |
| 30 | + * |
| 31 | + * @hide |
| 32 | + */ |
13 | 33 | public FlightOffersSearch(Amadeus client) { |
14 | 34 | this.client = client; |
15 | 35 | } |
16 | 36 |
|
| 37 | + /** |
| 38 | + * <p> |
| 39 | + * The Flight Offers Search API allows to get cheapest flight recommendations on a given journey. |
| 40 | + * It provides a list of flight recommendations and fares from a given origin, |
| 41 | + * for a given date and for a given list of passengers. |
| 42 | + * Additional information such as bag allowance, |
| 43 | + * first ancillary bag prices or fare details are also provided. |
| 44 | + * </p> |
| 45 | + * |
| 46 | + * <pre> |
| 47 | + * amadeus.shopping.flightOffersSearch.get(params);</pre> |
| 48 | + * |
| 49 | + * @param params the parameters to send to the API |
| 50 | + * @return an API resource |
| 51 | + * @throws ResponseException when an exception occurs |
| 52 | + */ |
17 | 53 | public FlightOfferSearch[] get(Params params) throws ResponseException { |
18 | 54 | Response response = client.get("/v2/shopping/flight-offers", params); |
19 | 55 | return (FlightOfferSearch[]) Resource.fromArray(response, FlightOfferSearch[].class); |
20 | 56 | } |
| 57 | + |
| 58 | + /** |
| 59 | + * Convenience method for calling <code>get</code> without any parameters. |
| 60 | + * @see FlightOffersSearch#get() |
| 61 | + */ |
| 62 | + public FlightOfferSearch[] get() throws ResponseException { |
| 63 | + return get(null); |
| 64 | + } |
| 65 | + |
| 66 | + /** |
| 67 | + * <p> |
| 68 | + * The Flight Offers Search API allows to get cheapest flight recommendations on a given journey. |
| 69 | + * It provides a list of flight recommendations and fares from a given origin, |
| 70 | + * for a given date and for a given list of passengers. |
| 71 | + * Additional information such as bag allowance, |
| 72 | + * first ancillary bag prices or fare details are also provided. |
| 73 | + * </p> |
| 74 | + * |
| 75 | + * <pre> |
| 76 | + * amadeus.shopping.flightOffersSearch.post(body);</pre> |
| 77 | + * |
| 78 | + * @param body the parameters to send to the API as a JSonObject |
| 79 | + * @return an API resource |
| 80 | + * @throws ResponseException when an exception occurs |
| 81 | + */ |
| 82 | + public FlightOfferSearch[] post(JsonObject body) throws ResponseException { |
| 83 | + Response response = client.post("/v2/shopping/flight-offers", body); |
| 84 | + return (FlightOfferSearch[]) Resource.fromArray(response, FlightOfferSearch[].class); |
| 85 | + } |
| 86 | + |
| 87 | + /** |
| 88 | + * <p> |
| 89 | + * The Flight Offers Search API allows to get cheapest flight recommendations on a given journey. |
| 90 | + * It provides a list of flight recommendations and fares from a given origin, |
| 91 | + * for a given date and for a given list of passengers. |
| 92 | + * Additional information such as bag allowance, |
| 93 | + * first ancillary bag prices or fare details are also provided. |
| 94 | + * </p> |
| 95 | + * |
| 96 | + * <pre> |
| 97 | + * amadeus.shopping.flightOffers.prediction.post(body);</pre> |
| 98 | + * |
| 99 | + * @param body the parameters to send to the API as a String |
| 100 | + * @return an API resource |
| 101 | + * @throws ResponseException when an exception occurs |
| 102 | + */ |
| 103 | + public FlightOfferSearch[] post(String body) throws ResponseException { |
| 104 | + Response response = client.post("/v2/shopping/flight-offers", body); |
| 105 | + return (FlightOfferSearch[]) Resource.fromArray(response, FlightOfferSearch[].class); |
| 106 | + } |
| 107 | + |
| 108 | + /** |
| 109 | + * Convenience method for calling <code>post</code> without any parameters. |
| 110 | + * |
| 111 | + * @see FlightOffersSearch#post() |
| 112 | + */ |
| 113 | + public FlightOfferSearch[] post() throws ResponseException { |
| 114 | + return post((String) null); |
| 115 | + } |
21 | 116 | } |
0 commit comments