com.amadeus.referencedata.Location 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.referencedata.locations.Airports;
import com.amadeus.resources.Resource;
/**
*
* A namespaced client for the
* /v2/reference-data/locations/:location_id
endpoints.
*
*
*
* Access via the Amadeus client object
*
*
*
* Amadeus amadeus = Amadeus.builder(API_KEY, API_SECRET).build();
* amadeus.referenceData.location(locationId);
*
* @hide
*/
public class Location {
private Amadeus client;
private String locationId;
/**
* Constructor.
* @hide
*/
public Location(Amadeus client, String locationId) {
this.locationId = locationId;
this.client = client;
}
/**
*
* Returns details for a specific airport.
*
*
*
* amadeus.referenceData.locations("ALHR').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.Location get(Params params) throws ResponseException {
String path = String.format("/v1/reference-data/locations/%s", locationId);
Response response = client.get(path, params);
return (com.amadeus.resources.Location)
Resource.fromObject(response, com.amadeus.resources.Location.class);
}
/**
* Convenience method for calling get
without any parameters.
* @see Airports#get()
*/
public com.amadeus.resources.Location get() throws ResponseException {
return get(null);
}
}