com.amadeus.Amadeus Maven / Gradle / Ivy
package com.amadeus;
import java.util.Map;
import lombok.NonNull;
/**
* The Amadeus API client. To initialize, use the builder as follows:
*
*
* Amadeus amadeus = Amadeus.builder("CLIENT_ID", "CLIENT_SECRET").build();
*
*
* Or pass in environment variables directly:
*
*
* Amadeus.builder(System.getenv()).build();
*
*/
public class Amadeus extends HTTPClient {
/**
* The API version.
*/
public static final String VERSION = "1.0.1";
/**
*
* A namespaced client for the
* /v2/reference-data
endpoints.
*
*/
public ReferenceData referenceData;
/**
*
* A namespaced client for the
* /v1/travel
endpoints.
*
*/
public Travel travel;
/**
*
* A namespaced client for the
* /v1/shopping
endpoints.
*
*/
public Shopping shopping;
protected Amadeus(Configuration configuration) {
super(configuration);
this.referenceData = new ReferenceData(this);
this.travel = new Travel(this);
this.shopping = new Shopping(this);
}
/**
* Creates a builder object that can be used to build
* an Amadeus com.amadeus.client.
*
*
* Amadeus amadeus = Amadeus.builder("CLIENT_ID", "CLIENT_SECRET").build();
*
*
* @param clientId Your API com.amadeus.client credential ID
* @param clientSecret Your API com.amadeus.client credential secret
* @return a Configuration object
*/
public static Configuration builder(@NonNull String clientId, @NonNull String clientSecret) {
return new Configuration(clientId, clientSecret);
}
/**
* Creates a builder object initialized with the environment variables that can be used to
* build an Amadeus API com.amadeus.client.
*
*
* Amadeus amadeus = Amadeus.builder(System.getenv()).build();
*
*
* @param environment The system environment
* @return a Configuration object
*/
public static Configuration builder(Map environment) {
String clientId = environment.get("AMADEUS_CLIENT_ID");
String clientSecret = environment.get("AMADEUS_CLIENT_ID");
Configuration configuration = Amadeus.builder(clientId, clientSecret);
configuration.parseEnvironment(environment);
return configuration;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy