com.amadeus.booking.FlightOrder Maven / Gradle / Ivy
package com.amadeus.booking;
import com.amadeus.Amadeus;
import com.amadeus.Params;
import com.amadeus.Response;
import com.amadeus.exceptions.ResponseException;
import com.amadeus.resources.Resource;
/**
*
* A namespaced client for the
* /v1/booking/flight-orders/:flightOrderId
endpoints.
*
*
*
* Access via the Amadeus client object.
*
*
*
* Amadeus amadeus = Amadeus.builder("clientId", "secret").build();
* amadeus.booking.flightOrder;
*/
public class FlightOrder {
private Amadeus client;
private String flightOfferId;
/**
* Constructor.
* @hide
*/
public FlightOrder(Amadeus client, String flightOfferId) {
this.client = client;
this.flightOfferId = flightOfferId;
}
/**
*
* Allows you to manipulate a flight order. The flightOfferId
* used is an example for educational purposes. In test enviromnent
* it's temporary.
*
*
*
* FlightOrder order = amadeus.booking.flightOrder.(
* "eJzTd9f3NjIJdzUGAAp%2fAiY=").get();
*
* @param params the parameters to send to the API
* @return an API response object
* @throws ResponseException when an exception occurs
*/
public com.amadeus.resources.FlightOrder get(Params params) throws ResponseException {
String path = String.format("/v1/booking/flight-orders/%s", flightOfferId);
Response response = client.get(path, params);
return (com.amadeus.resources.FlightOrder) Resource.fromObject(
response, com.amadeus.resources.FlightOrder.class);
}
/**
* Convenience method for calling get
without any parameters.
* @see com.amadeus.booking.FlightOrder#get()
*/
public com.amadeus.resources.FlightOrder get() throws ResponseException {
return get(null);
}
/**
*
* Allows you to cancel a flight order. The flightOfferId
* used is an example for educational purposes. In test enviromnent
* it's temporary.
*
*
*
* Response order = amadeus.booking.flightOrder.(
* "eJzTd9f3NjIJdzUGAAp%2fAiY=").delete();
*
* @param params the parameters to send to the API
* @return an API response object
* @throws ResponseException when an exception occurs
*/
public Response delete(Params params) throws ResponseException {
String path = String.format("/v1/booking/flight-orders/%s", flightOfferId);
Response response = client.delete(path, params);
return response;
}
/**
* Convenience method for calling delete
without any parameters.
* @see com.amadeus.booking.FlightOrder#delete()
*/
public Response delete() throws ResponseException {
return delete(null);
}
}