com.amadeus.referencedata.Airlines Maven / Gradle / Ivy
package com.amadeus.referencedata;
import com.amadeus.Amadeus;
import com.amadeus.Params;
import com.amadeus.Response;
import com.amadeus.exceptions.ResponseException;
import com.amadeus.resources.Airline;
import com.amadeus.resources.Resource;
import com.google.gson.Gson;
/**
*
* A namespaced client for the
* /v1/reference-data/airlines
endpoints.
*
*
*
* Access via the Amadeus client object.
*
*
*
* Amadeus amadeus = Amadeus.builder("clientId", "secret").build();
* amadeus.referenceData.airlines;
*/
public class Airlines {
private Amadeus client;
/**
* Constructor.
* @hide
*/
public Airlines(Amadeus client) {
this.client = client;
}
/**
*
* Returns the airline name and code.
*
*
*
* amadeus.referenceData.airlines.get(Params
* .with("airlineCodes", "BA"));
*
* @param params the parameters to send to the API
* @return an API response object
* @throws ResponseException when an exception occurs
*/
public Airline[] get(Params params) throws ResponseException {
Response response = client.get("/v1/reference-data/airlines", params);
return (Airline[]) Resource.fromArray(response, Airline[].class);
}
/**
* Convenience method for calling get
without any parameters.
* @see Airlines#get()
*/
public Airline[] get() throws ResponseException {
return get(null);
}
}