com.amadeus.ordering.TransferOrders Maven / Gradle / Ivy
package com.amadeus.ordering;
import com.amadeus.Amadeus;
import com.amadeus.Params;
import com.amadeus.Response;
import com.amadeus.exceptions.ResponseException;
import com.amadeus.resources.Resource;
import com.amadeus.resources.TransferOrder;
import com.google.gson.JsonObject;
/**
*
* A namespaced client for the
* /v1/ordering/transfer-orders
endpoints.
*
*
*
* Access via the Amadeus client object.
*
*
*
* Amadeus amadeus = Amadeus.builder(API_KEY, API_SECRET).build();
* amadeus.ordering.transferOrders;
*/
public class TransferOrders {
private Amadeus client;
private static final String TRANSFER_ORDERS_URL = "/v1/ordering/transfer-orders";
/**
* Constructor.
*
* @hide
*/
public TransferOrders(Amadeus client) {
this.client = client;
}
/**
*
* The Amadeus Transfer Offers API allows travelers to book private transfers.
*
*
*
* amadeus.ordering.transferOrders.post(body);
*
* @param body the parameters to send to the API as a JsonObject
* @param params URL parameters
* @return an API resource
* @throws ResponseException when an exception occurs
*/
public TransferOrder post(JsonObject body, Params params) throws ResponseException {
Response response = client.post(TRANSFER_ORDERS_URL, params, body);
return (TransferOrder) Resource.fromObject(response, TransferOrder.class);
}
/**
*
* The Amadeus Transfer Offers API allows travelers to book private transfers.
*
*
*
* amadeus.ordering.transferOrders.post(body);
*
* @param body the parameters to send to the API as a String
* @param params URL parameters
* @return an API resource
* @throws ResponseException when an exception occurs
*/
public TransferOrder post(String body, Params params) throws ResponseException {
Response response = client.post(TRANSFER_ORDERS_URL, params, body);
return (TransferOrder) Resource.fromObject(response, TransferOrder.class);
}
}