com.amadeus.booking.HotelOrders Maven / Gradle / Ivy
package com.amadeus.booking;
import com.amadeus.Amadeus;
import com.amadeus.Response;
import com.amadeus.exceptions.ResponseException;
import com.amadeus.resources.HotelOrder;
import com.amadeus.resources.Resource;
import com.google.gson.JsonObject;
/**
*
* A namespaced client for the
* /v2/booking/hotel-orders
endpoints.
*
*
*
* Access via the Amadeus client object.
*
*
*
* Amadeus amadeus = Amadeus.builder(API_KEY, API_SECRET).build();
* amadeus.booking.HotelOrders;
*/
public class HotelOrders {
private Amadeus client;
/**
* Constructor.
*
* @hide
*/
public HotelOrders(Amadeus client) {
this.client = client;
}
/**
*
* The Hotel Booking API allows you to perform hotel booking.
*
*
*
* amadeus.booking.hotelOrders.post(body);
*
* @param body the parameters to send to the API as a JSonObject
* @return an API resource
* @throws ResponseException when an exception occurs
*/
public HotelOrder post(JsonObject body) throws ResponseException {
Response response = client.post("/v2/booking/hotel-orders", body);
return (HotelOrder) Resource.fromObject(response, HotelOrder.class);
}
/**
*
* The Hotel Booking API allows you to perform hotel booking.
*
*
*
* amadeus.booking.hotelOrders.post(body);
*
* @param body the parameters to send to the API as a String
* @return an API resource
* @throws ResponseException when an exception occurs
*/
public HotelOrder post(String body) throws ResponseException {
Response response = client.post("/v2/booking/hotel-orders", body);
return (HotelOrder) Resource.fromObject(response, HotelOrder.class);
}
/**
* Convenience method for calling post
without any parameters.
*
* @see HotelBookings#post()
*/
public HotelOrder post() throws ResponseException {
return post((String) null);
}
}