com.amadeus.shopping.availability.FlightAvailabilities Maven / Gradle / Ivy
package com.amadeus.shopping.availability;
import com.amadeus.Amadeus;
import com.amadeus.Response;
import com.amadeus.exceptions.ResponseException;
import com.amadeus.resources.FlightAvailability;
import com.amadeus.resources.Resource;
import com.google.gson.JsonObject;
/**
*
* A namespaced client for the
* /v1/shopping/availability/flight-availabilities
endpoints.
*
*
*
* Access via the Amadeus client object.
*
*
*
* Amadeus amadeus = Amadeus.builder(API_KEY, API_SECRET).build();
* amadeus.shopping.availability.flightAvailabilities;
*/
public class FlightAvailabilities {
private Amadeus client;
/**
* Constructor.
*
* @hide
*/
public FlightAvailabilities(Amadeus client) {
this.client = client;
}
/**
*
* The Amadeus Flight Availability API provides a list of flights with seats for sale,
* and the quantity of seats available in different fare classes on a given itinerary.
* Additional information such as carrier and aircraft information,
* the departure and arrival terminals, schedule, and route are also provided.
*
*
*
* amadeus.shopping.availability.flightAvailabilities.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 FlightAvailability[] post(JsonObject body) throws ResponseException {
Response response = client.post("/v1/shopping/availability/flight-availabilities", body);
return
(FlightAvailability[]) Resource.fromArray(response, FlightAvailability[].class);
}
/**
*
* The Amadeus Flight Availability API provides a list of flights with seats for sale,
* and the quantity of seats available in different fare classes on a given itinerary.
* Additional information such as carrier and aircraft information,
* the departure and arrival terminals, schedule, and route are also provided.
*
*
*
* amadeus.shopping.availability.flightAvailabilities.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 FlightAvailability[] post(String body) throws ResponseException {
Response response = client.post("/v1/shopping/availability/flight-availabilities", body);
return
(FlightAvailability[]) Resource.fromArray(response, FlightAvailability[].class);
}
/**
* Convenience method for calling post
without any parameters.
*
* @see FlightAvailabilities#post()
*/
public FlightAvailability[] post() throws ResponseException {
return post((String) null);
}
}