com.amadeus.shopping.TransferOffers Maven / Gradle / Ivy
package com.amadeus.shopping;
import com.amadeus.Amadeus;
import com.amadeus.Response;
import com.amadeus.exceptions.ResponseException;
import com.amadeus.resources.Resource;
import com.amadeus.resources.TransferOffersPost;
import com.google.gson.JsonObject;
/**
*
* A namespaced client for the
* /v1/shopping/transfer-offers
endpoints.
*
*
*
* Access via the Amadeus client object.
*
*
*
* Amadeus amadeus = Amadeus.builder(API_KEY, API_SECRET).build();
* amadeus.shopping.transferOffers;
*/
public class TransferOffers {
private Amadeus client;
private static final String TRANSFER_OFFERS_URL = "/v1/shopping/transfer-offers";
/**
* Constructor.
*
* @hide
*/
public TransferOffers(Amadeus client) {
this.client = client;
}
/**
*
* The Amadeus Transfer Offers API allows travelers to search and bookig private transfers.
*
*
*
* amadeus.shopping.transferOffers.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 TransferOffersPost[] post(JsonObject body) throws ResponseException {
Response response = client.post(TRANSFER_OFFERS_URL, body);
return
(TransferOffersPost[]) Resource.fromArray(response, TransferOffersPost[].class);
}
/**
*
* The Amadeus Transfer Offers API allows travelers to search and bookig private transfers.
*
*
*
* amadeus.shopping.transferOffers.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 TransferOffersPost[] post(String body) throws ResponseException {
Response response = client.post(TRANSFER_OFFERS_URL, body);
return
(TransferOffersPost[]) Resource.fromArray(response, TransferOffersPost[].class);
}
/**
* Convenience method for calling post
without any parameters.
*
* @see TransferOffersPost#post()
*/
public TransferOffersPost[] post() throws ResponseException {
return post((String) null);
}
}