|
| 1 | +package com.amadeus.booking; |
| 2 | + |
| 3 | +import com.amadeus.Amadeus; |
| 4 | +import com.amadeus.Response; |
| 5 | +import com.amadeus.exceptions.ResponseException; |
| 6 | +import com.amadeus.resources.HotelBooking; |
| 7 | +import com.amadeus.resources.Resource; |
| 8 | +import com.google.gson.JsonObject; |
| 9 | + |
| 10 | +/** |
| 11 | + * <p> |
| 12 | + * A namespaced client for the |
| 13 | + * <code>/v1/booking/hotel-bookings</code> endpoints. |
| 14 | + * </p> |
| 15 | + * |
| 16 | + * <p> |
| 17 | + * Access via the Amadeus client object. |
| 18 | + * </p> |
| 19 | + * |
| 20 | + * <pre> |
| 21 | + * Amadeus amadeus = Amadeus.builder(API_KEY, API_SECRET).build(); |
| 22 | + * amadeus.booking.hotelBookings;</pre> |
| 23 | + */ |
| 24 | +public class HotelBookings { |
| 25 | + private Amadeus client; |
| 26 | + |
| 27 | + /** |
| 28 | + * Constructor. |
| 29 | + * |
| 30 | + * @hide |
| 31 | + */ |
| 32 | + public HotelBookings(Amadeus client) { |
| 33 | + this.client = client; |
| 34 | + } |
| 35 | + |
| 36 | + /** |
| 37 | + * <p> |
| 38 | + * The Hotel Booking API allows you to perform hotel booking. |
| 39 | + * </p> |
| 40 | + * |
| 41 | + * <pre> |
| 42 | + * amadeus.booking.hotelBookings.post(body);</pre> |
| 43 | + * |
| 44 | + * @param body the parameters to send to the API as a JSonObject |
| 45 | + * @return an API resource |
| 46 | + * @throws ResponseException when an exception occurs |
| 47 | + */ |
| 48 | + public HotelBooking[] post(JsonObject body) throws ResponseException { |
| 49 | + Response response = client.post("/v1/booking/hotel-bookings", body); |
| 50 | + return (HotelBooking[]) Resource.fromArray(response, HotelBooking[].class); |
| 51 | + } |
| 52 | + |
| 53 | + /** |
| 54 | + * <p> |
| 55 | + * The Hotel Booking API allows you to perform hotel booking. |
| 56 | + * </p> |
| 57 | + * |
| 58 | + * <pre> |
| 59 | + * amadeus.booking.hotelBookings.post(body);</pre> |
| 60 | + * |
| 61 | + * @param body the parameters to send to the API as a String |
| 62 | + * @return an API resource |
| 63 | + * @throws ResponseException when an exception occurs |
| 64 | + */ |
| 65 | + public HotelBooking[] post(String body) throws ResponseException { |
| 66 | + Response response = client.post("/v1/booking/hotel-bookings", body); |
| 67 | + return (HotelBooking[]) Resource.fromArray(response, HotelBooking[].class); |
| 68 | + } |
| 69 | + |
| 70 | + /** |
| 71 | + * Convenience method for calling <code>post</code> without any parameters. |
| 72 | + * |
| 73 | + * @see HotelBookings#post() |
| 74 | + */ |
| 75 | + public HotelBooking[] post() throws ResponseException { |
| 76 | + return post((String) null); |
| 77 | + } |
| 78 | +} |
0 commit comments