com.amadeus.safety.SafetyRatedLocations Maven / Gradle / Ivy
package com.amadeus.safety;
import com.amadeus.Amadeus;
import com.amadeus.Params;
import com.amadeus.Response;
import com.amadeus.exceptions.ResponseException;
import com.amadeus.resources.Resource;
import com.amadeus.resources.SafePlace;
import com.amadeus.safety.safetyratedlocations.BySquare;
/**
*
* A namespaced client for the
* /v1/safety/safety-rated-locations
endpoints.
*
*
*
* Access via the Amadeus client object.
*
*
*
* Amadeus amadeus = Amadeus.builder("clientId", "secret").build();
* amadeus.safety.safetyRatedLocations;
*/
public class SafetyRatedLocations {
private Amadeus client;
/**
*
* A namespaced client for the
* /v1/safety/safety-rated-locations/by-square
endpoints.
*
*/
public BySquare bySquare;
/**
* Constructor.
* @hide
*/
public SafetyRatedLocations(Amadeus client) {
this.client = client;
this.bySquare = new BySquare(client);
}
/**
*
* Returns a list of safety information near to a given point.
*
*
*
* amadeus.safety.safetyRatedLocations.get(Params
* .with("longitude", 2.160873)
* .and("latitude", 41.397158));
*
* @param params the parameters to send to the API
* @return an API response object
* @throws ResponseException when an exception occurs
*/
public SafePlace[] get(Params params) throws ResponseException {
Response response = client.get("/v1/safety/safety-rated-locations", params);
return (SafePlace[]) Resource.fromArray(response, SafePlace[].class);
}
/**
* Convenience method for calling get
without any parameters.
* @see SafetyRatedLocations#get()
*/
public SafePlace[] get() throws ResponseException {
return get(null);
}
}