feat: 初始化旅游API项目并添加基础功能
- 添加Amadeus Java SDK依赖 - 实现酒店查询功能 - 添加.gitignore文件忽略IDE和构建文件 - 添加README文档说明项目功能 - 创建基础测试类
This commit is contained in:
+39
@@ -0,0 +1,39 @@
|
|||||||
|
target/
|
||||||
|
!.mvn/wrapper/maven-wrapper.jar
|
||||||
|
!**/src/main/**/target/
|
||||||
|
!**/src/test/**/target/
|
||||||
|
.kotlin
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea/modules.xml
|
||||||
|
.idea/jarRepositories.xml
|
||||||
|
.idea/compiler.xml
|
||||||
|
.idea/libraries/
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
|
||||||
|
### Eclipse ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
build/
|
||||||
|
!**/src/main/**/build/
|
||||||
|
!**/src/test/**/build/
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
### Mac OS ###
|
||||||
|
.DS_Store
|
||||||
Generated
+10
@@ -0,0 +1,10 @@
|
|||||||
|
# 默认忽略的文件
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# 已忽略包含查询文件的默认文件夹
|
||||||
|
/queries/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
||||||
|
# 基于编辑器的 HTTP 客户端请求
|
||||||
|
/httpRequests/
|
||||||
Generated
+7
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding">
|
||||||
|
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
Generated
+14
@@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
|
<component name="MavenProjectsManager">
|
||||||
|
<option name="originalFiles">
|
||||||
|
<list>
|
||||||
|
<option value="$PROJECT_DIR$/pom.xml" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,262 @@
|
|||||||
|
// Flight Inspiration Search
|
||||||
|
FlightDestination[] flightDestinations = amadeus.shopping.flightDestinations.get(Params
|
||||||
|
.with("origin", "MAD"));
|
||||||
|
|
||||||
|
// Flight Cheapest Date Search
|
||||||
|
FlightDate[] flightDates = amadeus.shopping.flightDates.get(Params
|
||||||
|
.with("origin", "MAD")
|
||||||
|
.and("destination", "MUC"));
|
||||||
|
|
||||||
|
// Flight Offers Search v2 GET
|
||||||
|
FlightOfferSearch[] flightOffersSearches = amadeus.shopping.flightOffersSearch.get(
|
||||||
|
Params.with("originLocationCode", "SYD")
|
||||||
|
.and("destinationLocationCode", "BKK")
|
||||||
|
.and("departureDate", "2023-11-01")
|
||||||
|
.and("returnDate", "2023-11-08")
|
||||||
|
.and("adults", 2)
|
||||||
|
.and("max", 3));
|
||||||
|
|
||||||
|
// Flight Offers Search v2 POST
|
||||||
|
// body can be a String version of your JSON or a JsonObject
|
||||||
|
FlightOfferSearch[] flightOffersSearches = amadeus.shopping.flightOffersSearch.post(body);
|
||||||
|
|
||||||
|
// Flight Order Management
|
||||||
|
// The flightOrderID comes from the Flight Create Orders (in test environment it's temporary)
|
||||||
|
// Retrieve a flight order
|
||||||
|
FlightOrder order = amadeus.booking.flightOrder("eJzTd9f3NjIJdzUGAAp%2fAiY=").get();
|
||||||
|
// Cancel a flight order
|
||||||
|
Response order = amadeus.booking.flightOrder("eJzTd9f3NjIJdzUGAAp%2fAiY=").delete();
|
||||||
|
|
||||||
|
// Flight Offers price
|
||||||
|
FlightPrice[] flightPricing = amadeus.shopping.flightOffersSearch.pricing.post(
|
||||||
|
body,
|
||||||
|
Params.with("include", "other-services")
|
||||||
|
.and("forceClass", "false"));
|
||||||
|
|
||||||
|
// Flight Choice Prediction
|
||||||
|
// Note that the example calls 2 APIs: Flight Offers Search & Flight Choice Prediction
|
||||||
|
FlightOfferSearch[] flightOffers = amadeus.shopping.flightOffersSearch.get(
|
||||||
|
Params.with("originLocationCode", "NYC")
|
||||||
|
.and("destinationLocationCode", "MAD")
|
||||||
|
.and("departureDate", "2024-04-01")
|
||||||
|
.and("returnDate", "2024-04-08")
|
||||||
|
.and("adults", 1));
|
||||||
|
|
||||||
|
// Using a JSonObject
|
||||||
|
JsonObject result = flightOffers[0].getResponse().getResult();
|
||||||
|
FlightOfferSearch[] flightOffersPrediction = amadeus.shopping.flightOffers.prediction.post(result);
|
||||||
|
|
||||||
|
// Using a String
|
||||||
|
String body = flightOffers[0].getResponse().getBody();
|
||||||
|
FlightOfferSearch[] flightOffersPrediction = amadeus.shopping.flightOffers.prediction.post(body);
|
||||||
|
|
||||||
|
// Flight Check-in Links
|
||||||
|
CheckinLink[] checkinLinks = amadeus.referenceData.urls.checkinLinks.get(Params
|
||||||
|
.with("airlineCode", "BA"));
|
||||||
|
|
||||||
|
// Airline Code LookUp
|
||||||
|
Airline[] airlines = amadeus.referenceData.airlines.get(Params
|
||||||
|
.with("airlineCodes", "BA"));
|
||||||
|
|
||||||
|
// Airport & City Search (autocomplete)
|
||||||
|
// Find all the cities and airports starting by the keyword 'LON'
|
||||||
|
Location[] locations = amadeus.referenceData.locations.get(Params
|
||||||
|
.with("keyword", "LON")
|
||||||
|
.and("subType", Locations.ANY));
|
||||||
|
// Get a specific city or airport based on its id
|
||||||
|
Location location = amadeus.referenceData
|
||||||
|
.location("ALHR").get();
|
||||||
|
|
||||||
|
// Airport Nearest Relevant (for London)
|
||||||
|
Location[] locations = amadeus.referenceData.locations.airports.get(Params
|
||||||
|
.with("latitude", 0.1278)
|
||||||
|
.and("longitude", 51.5074));
|
||||||
|
|
||||||
|
// City Search
|
||||||
|
City[] cities = amadeus.referenceData.locations.cities.get(Params
|
||||||
|
.with("keyword","PARIS"));
|
||||||
|
|
||||||
|
// Flight Most Booked Destinations
|
||||||
|
AirTraffic[] airTraffics = amadeus.travel.analytics.airTraffic.booked.get(Params
|
||||||
|
.with("originCityCode", "MAD")
|
||||||
|
.and("period", "2017-08"));
|
||||||
|
|
||||||
|
// Flight Most Traveled Destinations
|
||||||
|
AirTraffic[] airTraffics = amadeus.travel.analytics.airTraffic.traveled.get(Params
|
||||||
|
.with("originCityCode", "MAD")
|
||||||
|
.and("period", "2017-01"));
|
||||||
|
|
||||||
|
// Flight Busiest Traveling Period
|
||||||
|
Period[] busiestPeriods = amadeus.travel.analytics.airTraffic.busiestPeriod.get(Params
|
||||||
|
.with("cityCode", "MAD")
|
||||||
|
.and("period", "2017")
|
||||||
|
.and("direction", BusiestPeriod.ARRIVING));
|
||||||
|
|
||||||
|
// Points of Interest
|
||||||
|
// What are the popular places in Barcelona (based a geo location and a radius)
|
||||||
|
PointOfInterest[] pointsOfInterest = amadeus.referenceData.locations.pointsOfInterest.get(Params
|
||||||
|
.with("latitude", "41.39715")
|
||||||
|
.and("longitude", "2.160873"));
|
||||||
|
|
||||||
|
// What are the popular places in Barcelona? (based on a square)
|
||||||
|
PointOfInterest[] pointsOfInterest = amadeus.referenceData.locations.pointsOfInterest.bySquare.get(Params
|
||||||
|
.with("north", "41.397158")
|
||||||
|
.and("west", "2.160873")
|
||||||
|
.and("south", "41.394582")
|
||||||
|
.and("east", "2.177181"));
|
||||||
|
|
||||||
|
// Returns a single Point of Interest from a given id
|
||||||
|
PointOfInterest pointOfInterest = amadeus.referenceData.locations.pointOfInterest("9CB40CB5D0").get();
|
||||||
|
|
||||||
|
// Tours and Activities
|
||||||
|
// What are the popular activities in Barcelona (based a geo location and a radius)
|
||||||
|
Activity[] activities = amadeus.shopping.activities.get(Params
|
||||||
|
.with("latitude", "41.39715")
|
||||||
|
.and("longitude", "2.160873"));
|
||||||
|
|
||||||
|
// What are the popular activities in Barcelona? (based on a square)
|
||||||
|
Activity[] activities = amadeus.shopping.activities.bySquare.get(Params
|
||||||
|
.with("north", "41.397158")
|
||||||
|
.and("west", "2.160873")
|
||||||
|
.and("south", "41.394582")
|
||||||
|
.and("east", "2.177181"));
|
||||||
|
|
||||||
|
// Returns a single activity from a given id
|
||||||
|
Activity activity = amadeus.shopping.activity("4615").get();
|
||||||
|
|
||||||
|
// What's the likelihood flights from this airport will leave on time?
|
||||||
|
Prediction AirportOnTime = amadeus.airport.predictions.onTime.get(Params
|
||||||
|
.with("airportCode", "NCE")
|
||||||
|
.and("date", "2024-04-01"));
|
||||||
|
|
||||||
|
// What's the likelihood of a given flight to be delayed?
|
||||||
|
Prediction[] flightDelay = amadeus.travel.predictions.flightDelay.get(Params
|
||||||
|
.with("originLocationCode", "NCE")
|
||||||
|
.and("destinationLocationCode", "IST")
|
||||||
|
.and("departureDate", "2020-08-01")
|
||||||
|
.and("departureTime", "18:20:00")
|
||||||
|
.and("arrivalDate", "2020-08-01")
|
||||||
|
.and("arrivalTime", "22:15:00")
|
||||||
|
.and("aircraftCode", "321")
|
||||||
|
.and("carrierCode", "TK")
|
||||||
|
.and("flightNumber", "1816")
|
||||||
|
.and("duration", "PT31H10M"));
|
||||||
|
|
||||||
|
// Flight Create Orders to book a flight
|
||||||
|
// Using a JSonObject or String
|
||||||
|
FlightOrder createdOrder = amadeus.booking.flightOrders.post(body);
|
||||||
|
|
||||||
|
// Using a JsonObject for flight offer and Traveler[] as traveler information
|
||||||
|
// see example at src/main/java/examples/flight/createorders/FlightCreateOrders.java
|
||||||
|
FlightOrder createdOrder = amadeus.booking.flightOrders.post(flightOffersSearches, travelerArray);
|
||||||
|
|
||||||
|
// What is the the seat map of a given flight?
|
||||||
|
SeatMap[] seatmap = amadeus.shopping.seatMaps.get(Params
|
||||||
|
.with("flight-orderId", "eJzTd9f3NjIJdzUGAAp%2fAiY="));
|
||||||
|
|
||||||
|
// What is the the seat map of a given flight?
|
||||||
|
// The body can be a String version of your JSON or a JsonObject
|
||||||
|
SeatMap[] seatmap = amadeus.shopping.seatMaps.post(body);
|
||||||
|
|
||||||
|
// Trip Purpose Prediction
|
||||||
|
Prediction tripPurpose = amadeus.travel.predictions.tripPurpose.get(Params
|
||||||
|
.with("originLocationCode", "NYC")
|
||||||
|
.and("destinationLocationCode", "MAD")
|
||||||
|
.and("departureDate", "2024-04-01")
|
||||||
|
.and("returnDate", "2024-04-08"));
|
||||||
|
|
||||||
|
// Travel Recommendations
|
||||||
|
Location destinations = amadeus.referenceData.recommendedLocations.get(Params
|
||||||
|
.with("cityCodes", "PAR")
|
||||||
|
.and("travelerCountryCode", "FR"));
|
||||||
|
|
||||||
|
// On Demand Flight Status
|
||||||
|
DatedFlight[] flightStatus = amadeus.schedule.flights.get(Params
|
||||||
|
.with("carrierCode", "AZ")
|
||||||
|
.and("flightNumber", "319")
|
||||||
|
.and("scheduledDepartureDate", "2024-03-13"));
|
||||||
|
|
||||||
|
// Flight Price Analysis
|
||||||
|
ItineraryPriceMetric[] metrics = amadeus.analytics.itineraryPriceMetrics.get(Params
|
||||||
|
.with("originIataCode", "MAD")
|
||||||
|
.and("destinationIataCode", "CDG")
|
||||||
|
.and("departureDate", "2024-03-21"));
|
||||||
|
|
||||||
|
// Airport Routes
|
||||||
|
Destination[] directDestinations = amadeus.airport.directDestinations.get(Params
|
||||||
|
.with("departureAirportCode","MAD")
|
||||||
|
.and("max","2"));
|
||||||
|
|
||||||
|
// Flight Availabilites Search POST
|
||||||
|
// body can be a String version of your JSON or a JsonObject
|
||||||
|
FlightAvailability[] flightAvailabilities
|
||||||
|
= amadeus.shopping.availability.flightAvailabilities.post(body);
|
||||||
|
|
||||||
|
|
||||||
|
// Location Score GET
|
||||||
|
ScoredLocation[] scoredLocations
|
||||||
|
= amadeus.location.analytics.categoryRatedAreas.get(Params
|
||||||
|
.with("latitude", "41.397158")
|
||||||
|
.and("longitude", "2.160873"));
|
||||||
|
|
||||||
|
// Branded Fares Upsell Post
|
||||||
|
// body can be a String version of your JSON or a JsonObject
|
||||||
|
FlightOfferSearch[] upsellFlightOffers
|
||||||
|
= amadeus.shopping.flightOffers.upselling.post(body);
|
||||||
|
|
||||||
|
// Hotel List
|
||||||
|
// Get list of hotels by hotel id
|
||||||
|
Hotel[] hotels = amadeus.referenceData.locations.hotels.byHotels.get(Params
|
||||||
|
.with("hotelIds", "ADPAR001"));
|
||||||
|
// Get list of hotels by city code
|
||||||
|
Hotel[] hotels = amadeus.referenceData.locations.hotels.byCity.get(Params
|
||||||
|
.with("cityCode", "PAR"));
|
||||||
|
// Get list of hotels by a geocode
|
||||||
|
Hotel[] hotels = amadeus.referenceData.locations.hotels.byGeocode.get(Params
|
||||||
|
.with("longitude", 2.160873)
|
||||||
|
.and("latitude", 41.397158));
|
||||||
|
|
||||||
|
// Hotel autocomplete names
|
||||||
|
Hotel[] result = amadeus.referenceData.locations.hotel.get(Params
|
||||||
|
.with("keyword", "PARI")
|
||||||
|
.and("subType", "HOTEL_GDS")
|
||||||
|
.and("countryCode", "FR")
|
||||||
|
.and("lang", "EN")
|
||||||
|
.and("max", "20"));
|
||||||
|
|
||||||
|
// Hotel Offers Search API v3
|
||||||
|
// Get multiple hotel offers
|
||||||
|
HotelOfferSearch[] offers = amadeus.shopping.hotelOffersSearch.get(Params
|
||||||
|
.with("hotelIds", "MCLONGHM")
|
||||||
|
.and("adults", 1)
|
||||||
|
.and("checkInDate", "2023-11-22")
|
||||||
|
.and("roomQuantity", 1)
|
||||||
|
.and("paymentPolicy", "NONE")
|
||||||
|
.and("bestRateOnly", true));
|
||||||
|
// Get hotel offer pricing by offer id
|
||||||
|
HotelOfferSearch offer = amadeus.shopping.hotelOfferSearch("QF3MNOBDQ8").get();
|
||||||
|
|
||||||
|
// Hotel Booking
|
||||||
|
// The body can be a String version of your JSON or a JsonObject
|
||||||
|
HotelBooking[] hotel = amadeus.booking.hotelBookings.post(body);
|
||||||
|
|
||||||
|
// Hotel Booking v2
|
||||||
|
HotelOrder hotel = amadeus.booking.hotelOrders.post(body);
|
||||||
|
|
||||||
|
// Hotel Ratings / Sentiments
|
||||||
|
HotelSentiment[] hotelSentiments = amadeus.ereputation.hotelSentiments.get(Params.with("hotelIds", "ELONMFS,ADNYCCTB"));
|
||||||
|
|
||||||
|
// Airline Routes
|
||||||
|
// Get airline destinations
|
||||||
|
Destination[] destinations = amadeus.airline.destinations.get(Params
|
||||||
|
.with("airlineCode", "BA")
|
||||||
|
.and("max", 2));
|
||||||
|
|
||||||
|
// Transfer Search
|
||||||
|
TransferOffersPost[] transfers = amadeus.shopping.transferOffers.post(body);
|
||||||
|
|
||||||
|
// Transfer Booking
|
||||||
|
TransferOrder transfers = amadeus.ordering.transferOrders.post(body, params);
|
||||||
|
|
||||||
|
// Transfer Management
|
||||||
|
TransferCancellation transfers = amadeus.ordering.transferOrder("123456").transfers.cancellation.post(params);
|
||||||
@@ -0,0 +1,297 @@
|
|||||||
|
# 旅游 API 项目
|
||||||
|
|
||||||
|
本项目演示了如何使用 Amadeus 旅游 API 访问各种与旅游相关的端点。
|
||||||
|
|
||||||
|
## 目录
|
||||||
|
|
||||||
|
- [项目概述](#项目概述)
|
||||||
|
- [支持的端点](#支持的端点)
|
||||||
|
|
||||||
|
## 项目概述
|
||||||
|
|
||||||
|
本项目提供了如何使用 Amadeus 旅游 API 执行各种与旅游相关操作的示例,例如搜索航班、酒店、景点等。
|
||||||
|
|
||||||
|
### 参考地址:
|
||||||
|
|
||||||
|
```
|
||||||
|
https://github.com/amadeus4dev/amadeus-java
|
||||||
|
```
|
||||||
|
|
||||||
|
### 接口地址
|
||||||
|
```
|
||||||
|
https://developers.amadeus.com/self-service/apis-docs/guides/developer-guides/resources/hotels/
|
||||||
|
```
|
||||||
|
|
||||||
|
### 机场地址查询
|
||||||
|
```
|
||||||
|
https://www.iata.org/en/publications/directories/code-search/?airport.search=WUH
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## 接口列表 参考github
|
||||||
|
|
||||||
|
```java
|
||||||
|
// Flight Inspiration Search
|
||||||
|
FlightDestination[] flightDestinations = amadeus.shopping.flightDestinations.get(Params
|
||||||
|
.with("origin", "MAD"));
|
||||||
|
|
||||||
|
// Flight Cheapest Date Search
|
||||||
|
FlightDate[] flightDates = amadeus.shopping.flightDates.get(Params
|
||||||
|
.with("origin", "MAD")
|
||||||
|
.and("destination", "MUC"));
|
||||||
|
|
||||||
|
// Flight Offers Search v2 GET
|
||||||
|
FlightOfferSearch[] flightOffersSearches = amadeus.shopping.flightOffersSearch.get(
|
||||||
|
Params.with("originLocationCode", "SYD")
|
||||||
|
.and("destinationLocationCode", "BKK")
|
||||||
|
.and("departureDate", "2023-11-01")
|
||||||
|
.and("returnDate", "2023-11-08")
|
||||||
|
.and("adults", 2)
|
||||||
|
.and("max", 3));
|
||||||
|
|
||||||
|
// Flight Offers Search v2 POST
|
||||||
|
// body can be a String version of your JSON or a JsonObject
|
||||||
|
FlightOfferSearch[] flightOffersSearches = amadeus.shopping.flightOffersSearch.post(body);
|
||||||
|
|
||||||
|
// Flight Order Management
|
||||||
|
// The flightOrderID comes from the Flight Create Orders (in test environment it's temporary)
|
||||||
|
// Retrieve a flight order
|
||||||
|
FlightOrder order = amadeus.booking.flightOrder("eJzTd9f3NjIJdzUGAAp%2fAiY=").get();
|
||||||
|
// Cancel a flight order
|
||||||
|
Response order = amadeus.booking.flightOrder("eJzTd9f3NjIJdzUGAAp%2fAiY=").delete();
|
||||||
|
|
||||||
|
// Flight Offers price
|
||||||
|
FlightPrice[] flightPricing = amadeus.shopping.flightOffersSearch.pricing.post(
|
||||||
|
body,
|
||||||
|
Params.with("include", "other-services")
|
||||||
|
.and("forceClass", "false"));
|
||||||
|
|
||||||
|
// Flight Choice Prediction
|
||||||
|
// Note that the example calls 2 APIs: Flight Offers Search & Flight Choice Prediction
|
||||||
|
FlightOfferSearch[] flightOffers = amadeus.shopping.flightOffersSearch.get(
|
||||||
|
Params.with("originLocationCode", "NYC")
|
||||||
|
.and("destinationLocationCode", "MAD")
|
||||||
|
.and("departureDate", "2024-04-01")
|
||||||
|
.and("returnDate", "2024-04-08")
|
||||||
|
.and("adults", 1));
|
||||||
|
|
||||||
|
// Using a JSonObject
|
||||||
|
JsonObject result = flightOffers[0].getResponse().getResult();
|
||||||
|
FlightOfferSearch[] flightOffersPrediction = amadeus.shopping.flightOffers.prediction.post(result);
|
||||||
|
|
||||||
|
// Using a String
|
||||||
|
String body = flightOffers[0].getResponse().getBody();
|
||||||
|
FlightOfferSearch[] flightOffersPrediction = amadeus.shopping.flightOffers.prediction.post(body);
|
||||||
|
|
||||||
|
// Flight Check-in Links
|
||||||
|
CheckinLink[] checkinLinks = amadeus.referenceData.urls.checkinLinks.get(Params
|
||||||
|
.with("airlineCode", "BA"));
|
||||||
|
|
||||||
|
// Airline Code LookUp
|
||||||
|
Airline[] airlines = amadeus.referenceData.airlines.get(Params
|
||||||
|
.with("airlineCodes", "BA"));
|
||||||
|
|
||||||
|
// Airport & City Search (autocomplete)
|
||||||
|
// Find all the cities and airports starting by the keyword 'LON'
|
||||||
|
Location[] locations = amadeus.referenceData.locations.get(Params
|
||||||
|
.with("keyword", "LON")
|
||||||
|
.and("subType", Locations.ANY));
|
||||||
|
// Get a specific city or airport based on its id
|
||||||
|
Location location = amadeus.referenceData
|
||||||
|
.location("ALHR").get();
|
||||||
|
|
||||||
|
// Airport Nearest Relevant (for London)
|
||||||
|
Location[] locations = amadeus.referenceData.locations.airports.get(Params
|
||||||
|
.with("latitude", 0.1278)
|
||||||
|
.and("longitude", 51.5074));
|
||||||
|
|
||||||
|
// City Search
|
||||||
|
City[] cities = amadeus.referenceData.locations.cities.get(Params
|
||||||
|
.with("keyword","PARIS"));
|
||||||
|
|
||||||
|
// Flight Most Booked Destinations
|
||||||
|
AirTraffic[] airTraffics = amadeus.travel.analytics.airTraffic.booked.get(Params
|
||||||
|
.with("originCityCode", "MAD")
|
||||||
|
.and("period", "2017-08"));
|
||||||
|
|
||||||
|
// Flight Most Traveled Destinations
|
||||||
|
AirTraffic[] airTraffics = amadeus.travel.analytics.airTraffic.traveled.get(Params
|
||||||
|
.with("originCityCode", "MAD")
|
||||||
|
.and("period", "2017-01"));
|
||||||
|
|
||||||
|
// Flight Busiest Traveling Period
|
||||||
|
Period[] busiestPeriods = amadeus.travel.analytics.airTraffic.busiestPeriod.get(Params
|
||||||
|
.with("cityCode", "MAD")
|
||||||
|
.and("period", "2017")
|
||||||
|
.and("direction", BusiestPeriod.ARRIVING));
|
||||||
|
|
||||||
|
// Points of Interest
|
||||||
|
// What are the popular places in Barcelona (based a geo location and a radius)
|
||||||
|
PointOfInterest[] pointsOfInterest = amadeus.referenceData.locations.pointsOfInterest.get(Params
|
||||||
|
.with("latitude", "41.39715")
|
||||||
|
.and("longitude", "2.160873"));
|
||||||
|
|
||||||
|
// What are the popular places in Barcelona? (based on a square)
|
||||||
|
PointOfInterest[] pointsOfInterest = amadeus.referenceData.locations.pointsOfInterest.bySquare.get(Params
|
||||||
|
.with("north", "41.397158")
|
||||||
|
.and("west", "2.160873")
|
||||||
|
.and("south", "41.394582")
|
||||||
|
.and("east", "2.177181"));
|
||||||
|
|
||||||
|
// Returns a single Point of Interest from a given id
|
||||||
|
PointOfInterest pointOfInterest = amadeus.referenceData.locations.pointOfInterest("9CB40CB5D0").get();
|
||||||
|
|
||||||
|
// Tours and Activities
|
||||||
|
// What are the popular activities in Barcelona (based a geo location and a radius)
|
||||||
|
Activity[] activities = amadeus.shopping.activities.get(Params
|
||||||
|
.with("latitude", "41.39715")
|
||||||
|
.and("longitude", "2.160873"));
|
||||||
|
|
||||||
|
// What are the popular activities in Barcelona? (based on a square)
|
||||||
|
Activity[] activities = amadeus.shopping.activities.bySquare.get(Params
|
||||||
|
.with("north", "41.397158")
|
||||||
|
.and("west", "2.160873")
|
||||||
|
.and("south", "41.394582")
|
||||||
|
.and("east", "2.177181"));
|
||||||
|
|
||||||
|
// Returns a single activity from a given id
|
||||||
|
Activity activity = amadeus.shopping.activity("4615").get();
|
||||||
|
|
||||||
|
// What's the likelihood flights from this airport will leave on time?
|
||||||
|
Prediction AirportOnTime = amadeus.airport.predictions.onTime.get(Params
|
||||||
|
.with("airportCode", "NCE")
|
||||||
|
.and("date", "2024-04-01"));
|
||||||
|
|
||||||
|
// What's the likelihood of a given flight to be delayed?
|
||||||
|
Prediction[] flightDelay = amadeus.travel.predictions.flightDelay.get(Params
|
||||||
|
.with("originLocationCode", "NCE")
|
||||||
|
.and("destinationLocationCode", "IST")
|
||||||
|
.and("departureDate", "2020-08-01")
|
||||||
|
.and("departureTime", "18:20:00")
|
||||||
|
.and("arrivalDate", "2020-08-01")
|
||||||
|
.and("arrivalTime", "22:15:00")
|
||||||
|
.and("aircraftCode", "321")
|
||||||
|
.and("carrierCode", "TK")
|
||||||
|
.and("flightNumber", "1816")
|
||||||
|
.and("duration", "PT31H10M"));
|
||||||
|
|
||||||
|
// Flight Create Orders to book a flight
|
||||||
|
// Using a JSonObject or String
|
||||||
|
FlightOrder createdOrder = amadeus.booking.flightOrders.post(body);
|
||||||
|
|
||||||
|
// Using a JsonObject for flight offer and Traveler[] as traveler information
|
||||||
|
// see example at src/main/java/examples/flight/createorders/FlightCreateOrders.java
|
||||||
|
FlightOrder createdOrder = amadeus.booking.flightOrders.post(flightOffersSearches, travelerArray);
|
||||||
|
|
||||||
|
// What is the the seat map of a given flight?
|
||||||
|
SeatMap[] seatmap = amadeus.shopping.seatMaps.get(Params
|
||||||
|
.with("flight-orderId", "eJzTd9f3NjIJdzUGAAp%2fAiY="));
|
||||||
|
|
||||||
|
// What is the the seat map of a given flight?
|
||||||
|
// The body can be a String version of your JSON or a JsonObject
|
||||||
|
SeatMap[] seatmap = amadeus.shopping.seatMaps.post(body);
|
||||||
|
|
||||||
|
// Trip Purpose Prediction
|
||||||
|
Prediction tripPurpose = amadeus.travel.predictions.tripPurpose.get(Params
|
||||||
|
.with("originLocationCode", "NYC")
|
||||||
|
.and("destinationLocationCode", "MAD")
|
||||||
|
.and("departureDate", "2024-04-01")
|
||||||
|
.and("returnDate", "2024-04-08"));
|
||||||
|
|
||||||
|
// Travel Recommendations
|
||||||
|
Location destinations = amadeus.referenceData.recommendedLocations.get(Params
|
||||||
|
.with("cityCodes", "PAR")
|
||||||
|
.and("travelerCountryCode", "FR"));
|
||||||
|
|
||||||
|
// On Demand Flight Status
|
||||||
|
DatedFlight[] flightStatus = amadeus.schedule.flights.get(Params
|
||||||
|
.with("carrierCode", "AZ")
|
||||||
|
.and("flightNumber", "319")
|
||||||
|
.and("scheduledDepartureDate", "2024-03-13"));
|
||||||
|
|
||||||
|
// Flight Price Analysis
|
||||||
|
ItineraryPriceMetric[] metrics = amadeus.analytics.itineraryPriceMetrics.get(Params
|
||||||
|
.with("originIataCode", "MAD")
|
||||||
|
.and("destinationIataCode", "CDG")
|
||||||
|
.and("departureDate", "2024-03-21"));
|
||||||
|
|
||||||
|
// Airport Routes
|
||||||
|
Destination[] directDestinations = amadeus.airport.directDestinations.get(Params
|
||||||
|
.with("departureAirportCode","MAD")
|
||||||
|
.and("max","2"));
|
||||||
|
|
||||||
|
// Flight Availabilites Search POST
|
||||||
|
// body can be a String version of your JSON or a JsonObject
|
||||||
|
FlightAvailability[] flightAvailabilities
|
||||||
|
= amadeus.shopping.availability.flightAvailabilities.post(body);
|
||||||
|
|
||||||
|
|
||||||
|
// Location Score GET
|
||||||
|
ScoredLocation[] scoredLocations
|
||||||
|
= amadeus.location.analytics.categoryRatedAreas.get(Params
|
||||||
|
.with("latitude", "41.397158")
|
||||||
|
.and("longitude", "2.160873"));
|
||||||
|
|
||||||
|
// Branded Fares Upsell Post
|
||||||
|
// body can be a String version of your JSON or a JsonObject
|
||||||
|
FlightOfferSearch[] upsellFlightOffers
|
||||||
|
= amadeus.shopping.flightOffers.upselling.post(body);
|
||||||
|
|
||||||
|
// Hotel List
|
||||||
|
// Get list of hotels by hotel id
|
||||||
|
Hotel[] hotels = amadeus.referenceData.locations.hotels.byHotels.get(Params
|
||||||
|
.with("hotelIds", "ADPAR001"));
|
||||||
|
// Get list of hotels by city code
|
||||||
|
Hotel[] hotels = amadeus.referenceData.locations.hotels.byCity.get(Params
|
||||||
|
.with("cityCode", "PAR"));
|
||||||
|
// Get list of hotels by a geocode
|
||||||
|
Hotel[] hotels = amadeus.referenceData.locations.hotels.byGeocode.get(Params
|
||||||
|
.with("longitude", 2.160873)
|
||||||
|
.and("latitude", 41.397158));
|
||||||
|
|
||||||
|
// Hotel autocomplete names
|
||||||
|
Hotel[] result = amadeus.referenceData.locations.hotel.get(Params
|
||||||
|
.with("keyword", "PARI")
|
||||||
|
.and("subType", "HOTEL_GDS")
|
||||||
|
.and("countryCode", "FR")
|
||||||
|
.and("lang", "EN")
|
||||||
|
.and("max", "20"));
|
||||||
|
|
||||||
|
// Hotel Offers Search API v3
|
||||||
|
// Get multiple hotel offers
|
||||||
|
HotelOfferSearch[] offers = amadeus.shopping.hotelOffersSearch.get(Params
|
||||||
|
.with("hotelIds", "MCLONGHM")
|
||||||
|
.and("adults", 1)
|
||||||
|
.and("checkInDate", "2023-11-22")
|
||||||
|
.and("roomQuantity", 1)
|
||||||
|
.and("paymentPolicy", "NONE")
|
||||||
|
.and("bestRateOnly", true));
|
||||||
|
// Get hotel offer pricing by offer id
|
||||||
|
HotelOfferSearch offer = amadeus.shopping.hotelOfferSearch("QF3MNOBDQ8").get();
|
||||||
|
|
||||||
|
// Hotel Booking
|
||||||
|
// The body can be a String version of your JSON or a JsonObject
|
||||||
|
HotelBooking[] hotel = amadeus.booking.hotelBookings.post(body);
|
||||||
|
|
||||||
|
// Hotel Booking v2
|
||||||
|
HotelOrder hotel = amadeus.booking.hotelOrders.post(body);
|
||||||
|
|
||||||
|
// Hotel Ratings / Sentiments
|
||||||
|
HotelSentiment[] hotelSentiments = amadeus.ereputation.hotelSentiments.get(Params.with("hotelIds", "ELONMFS,ADNYCCTB"));
|
||||||
|
|
||||||
|
// Airline Routes
|
||||||
|
// Get airline destinations
|
||||||
|
Destination[] destinations = amadeus.airline.destinations.get(Params
|
||||||
|
.with("airlineCode", "BA")
|
||||||
|
.and("max", 2));
|
||||||
|
|
||||||
|
// Transfer Search
|
||||||
|
TransferOffersPost[] transfers = amadeus.shopping.transferOffers.post(body);
|
||||||
|
|
||||||
|
// Transfer Booking
|
||||||
|
TransferOrder transfers = amadeus.ordering.transferOrders.post(body, params);
|
||||||
|
|
||||||
|
// Transfer Management
|
||||||
|
TransferCancellation transfers = amadeus.ordering.transferOrder("123456").transfers.cancellation.post(params);
|
||||||
|
```
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
[33532:33536:0128/145139.894:INFO:electron\shell\app\electron_main_delegate.cc:543] #### AhaElectron (relauncher) Startup #### cmd: --no-sandbox
|
||||||
|
[33532:33536:0128/145140.119:INFO:electron\shell\app\electron_main_delegate.cc:298] #### AhaElectron (relauncher) Shutdown ####
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>org.example</groupId>
|
||||||
|
<artifactId>travel1</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<name>travel1</name>
|
||||||
|
<url>http://maven.apache.org</url>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>3.8.1</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.amadeus</groupId>
|
||||||
|
<artifactId>amadeus-java</artifactId>
|
||||||
|
<version>10.0.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>1.18.32</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Source: https://mvnrepository.com/artifact/ch.qos.logback/logback-classic -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>ch.qos.logback</groupId>
|
||||||
|
<artifactId>logback-classic</artifactId>
|
||||||
|
<version>1.5.26</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package org.example;
|
||||||
|
|
||||||
|
import com.amadeus.Amadeus;
|
||||||
|
import com.amadeus.Params;
|
||||||
|
import com.amadeus.exceptions.ResponseException;
|
||||||
|
import com.amadeus.resources.Hotel;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hello world!
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class App
|
||||||
|
{
|
||||||
|
public static void main( String[] args ) throws ResponseException {
|
||||||
|
System.out.println( "Hello World!" );
|
||||||
|
|
||||||
|
Amadeus amadeus = Amadeus
|
||||||
|
.builder("jDKskm2fvqyM0rh098G3rcSzKaJIK8ZF",
|
||||||
|
"rBZHbs2DGb0QznzU")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
//
|
||||||
|
Params params = Params.with("cityCode", "WUH");
|
||||||
|
Hotel[] rs = amadeus.referenceData.locations.hotels.byCity.get(params);
|
||||||
|
log.info("rs:{}",rs);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package org.example;
|
||||||
|
|
||||||
|
import junit.framework.Test;
|
||||||
|
import junit.framework.TestCase;
|
||||||
|
import junit.framework.TestSuite;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unit test for simple App.
|
||||||
|
*/
|
||||||
|
public class AppTest
|
||||||
|
extends TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Create the test case
|
||||||
|
*
|
||||||
|
* @param testName name of the test case
|
||||||
|
*/
|
||||||
|
public AppTest( String testName )
|
||||||
|
{
|
||||||
|
super( testName );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the suite of tests being tested
|
||||||
|
*/
|
||||||
|
public static Test suite()
|
||||||
|
{
|
||||||
|
return new TestSuite( AppTest.class );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rigourous Test :-)
|
||||||
|
*/
|
||||||
|
public void testApp()
|
||||||
|
{
|
||||||
|
assertTrue( true );
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user