com.amadeus.referencedata.Locations 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.referencedata.locations.Cities;
import com.amadeus.referencedata.locations.Hotel;
import com.amadeus.referencedata.locations.Hotels;
import com.amadeus.referencedata.locations.PointOfInterest;
import com.amadeus.referencedata.locations.PointsOfInterest;
import com.amadeus.resources.Location;
import com.amadeus.resources.Resource;
/**
*
* A namespaced client for the
* /v2/reference-data/locations
endpoints.
*
*
*
* Access via the Amadeus client object
*
*
*
* Amadeus amadeus = Amadeus.builder("clientId", "secret").build();
* amadeus.referenceData.locations;
*
* @hide
*/
public class Locations {
public static String ANY = "AIRPORT,CITY";
public static String AIRPORT = "AIRPORT";
public static String CITY = "CITY";
private Amadeus client;
/**
*
* A namespaced client for the
* /v2/reference-data/locations/airports
endpoints.
*
*/
public Airports airports;
/**
*
* A namespaced client for the
* /v2/reference-data/locations/pois
endpoints.
*
*/
public PointsOfInterest pointsOfInterest;
/**
*
* A namespaced client for the
* /v2/reference-data/locations/pois
endpoints.
*
*/
public PointOfInterest pointOfInterest;
/**
*
* A namespaced client for the
* /v1/reference-data/locations/hotels
endpoints.
*
*/
public Hotels hotels;
/**
*
* A namespaced client for the
* /v1/reference-data/locations/hotel
endpoints.
*
*/
public Hotel hotel;
/**
*
* A namespaced client for the
* /v1/reference-data/locations/cities
endpoints.
*
*/
public Cities cities;
/**
* Constructor.
* @hide
*/
public Locations(Amadeus client) {
this.client = client;
this.airports = new Airports(client);
this.pointsOfInterest = new PointsOfInterest(client);
this.hotels = new Hotels(client);
this.hotel = new Hotel(client);
this.cities = new Cities(client);
}
/**
*
* Returns a list of airports and cities matching a given keyword.
*
*
*
* amadeus.referenceData.locations.get(Params
* .with("keyword", "lon)
* .and("subType", Locations.ANY));
*
* @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", params);
return (Location[]) Resource.fromArray(response, Location[].class);
}
/**
* Convenience method for calling get
without any parameters.
* @see Locations#get()
*/
public Location[] get() throws ResponseException {
return get(null);
}
public PointOfInterest pointOfInterest(String id) {
return new PointOfInterest(client, id);
}
}