com.amadeus.referencedata.locations.Airports Maven / Gradle / Ivy
package com.amadeus.referencedata.locations;
import com.amadeus.Amadeus;
import com.amadeus.Params;
import com.amadeus.Response;
import com.amadeus.exceptions.ResponseException;
import com.amadeus.resources.Location;
import com.amadeus.resources.Resource;
import com.google.gson.Gson;
/**
*
* A namespaced client for the
* /v1/reference-data/locations/airports
endpoints.
*
*
*
* Access via the Amadeus client object.
*
*
*
* Amadeus amadeus = Amadeus.builder("clientId", "secret").build();
* amadeus.referenceData.locations.airports;
*/
public class Airports {
private Amadeus client;
/**
* Constructor.
* @hide
*/
public Airports(Amadeus client) {
this.client = client;
}
/**
*
* Returns a list of relevant airports near to a given point.
*
*
*
* amadeus.referenceData.locations.airports.get(Params
* .with("longitude", 49.0000)
* .and("latitude", 2.55));
*
* @param params the parameters to send to the API
* @return an API response object
* @throws ResponseException when an exception occurs
*/
public Location[] get(Params params) throws ResponseException {
Response response = client.get("/v1/reference-data/locations/airports", params);
return (Location[]) Resource.fromArray(response, Location[].class);
}
/**
* Convenience method for calling get
without any parameters.
* @see Airports#get()
*/
public Location[] get() throws ResponseException {
return get(null);
}
}