Skip to content

Commit a71d586

Browse files
authored
Merge pull request #252 from amadeus4dev/transfer-apis
Support for Transfer APIs
2 parents e7430af + c9fbe6b commit a71d586

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1946
-212
lines changed

README.md

+19-10
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,8 @@ FlightDate[] flightDates = amadeus.shopping.flightDates.get(Params
187187
FlightOfferSearch[] flightOffersSearches = amadeus.shopping.flightOffersSearch.get(
188188
Params.with("originLocationCode", "SYD")
189189
.and("destinationLocationCode", "BKK")
190-
.and("departureDate", "2022-09-01")
191-
.and("returnDate", "2022-09-08")
190+
.and("departureDate", "2023-11-01")
191+
.and("returnDate", "2023-11-08")
192192
.and("adults", 2)
193193
.and("max", 3));
194194

@@ -214,8 +214,8 @@ FlightPrice[] flightPricing = amadeus.shopping.flightOffersSearch.pricing.post(
214214
FlightOfferSearch[] flightOffers = amadeus.shopping.flightOffersSearch.get(
215215
Params.with("originLocationCode", "NYC")
216216
.and("destinationLocationCode", "MAD")
217-
.and("departureDate", "2021-04-01")
218-
.and("returnDate", "2021-04-08")
217+
.and("departureDate", "2024-04-01")
218+
.and("returnDate", "2024-04-08")
219219
.and("adults", 1));
220220

221221
// Using a JSonObject
@@ -319,7 +319,7 @@ Activity activity = amadeus.shopping.activity("4615").get();
319319
// What's the likelihood flights from this airport will leave on time?
320320
Prediction AirportOnTime = amadeus.airport.predictions.onTime.get(Params
321321
.with("airportCode", "NCE")
322-
.and("date", "2021-04-01"));
322+
.and("date", "2024-04-01"));
323323

324324
// What's the likelihood of a given flight to be delayed?
325325
Prediction[] flightDelay = amadeus.travel.predictions.flightDelay.get(Params
@@ -354,8 +354,8 @@ SeatMap[] seatmap = amadeus.shopping.seatMaps.post(body);
354354
Prediction tripPurpose = amadeus.travel.predictions.tripPurpose.get(Params
355355
.with("originLocationCode", "NYC")
356356
.and("destinationLocationCode", "MAD")
357-
.and("departureDate", "2021-04-01")
358-
.and("returnDate", "2021-04-08"));
357+
.and("departureDate", "2024-04-01")
358+
.and("returnDate", "2024-04-08"));
359359

360360
// Travel Recommendations
361361
Location destinations = amadeus.referenceData.recommendedLocations.get(Params
@@ -366,13 +366,13 @@ Location destinations = amadeus.referenceData.recommendedLocations.get(Params
366366
DatedFlight[] flightStatus = amadeus.schedule.flights.get(Params
367367
.with("carrierCode", "AZ")
368368
.and("flightNumber", "319")
369-
.and("scheduledDepartureDate", "2021-03-13"));
369+
.and("scheduledDepartureDate", "2024-03-13"));
370370

371371
// Flight Price Analysis
372372
ItineraryPriceMetric[] metrics = amadeus.analytics.itineraryPriceMetrics.get(Params
373373
.with("originIataCode", "MAD")
374374
.and("destinationIataCode", "CDG")
375-
.and("departureDate", "2021-03-21"));
375+
.and("departureDate", "2024-03-21"));
376376

377377
// Trip Parser v3 POST
378378
// body can be a String version of your JSON or a JsonObject or a compatible File object
@@ -428,7 +428,7 @@ Hotel[] result = amadeus.referenceData.locations.hotel.get(Params
428428
HotelOfferSearch[] offers = amadeus.shopping.hotelOffersSearch.get(Params
429429
.with("hotelIds", "MCLONGHM")
430430
.and("adults", 1)
431-
.and("checkInDate", "2023-05-22")
431+
.and("checkInDate", "2023-11-22")
432432
.and("roomQuantity", 1)
433433
.and("paymentPolicy", "NONE")
434434
.and("bestRateOnly", true));
@@ -447,6 +447,15 @@ HotelSentiment[] hotelSentiments = amadeus.ereputation.hotelSentiments.get(Param
447447
Destination[] destinations = amadeus.airline.destinations.get(Params
448448
.with("airlineCode", "BA")
449449
.and("max", 2));
450+
451+
// Transfer Search
452+
TransferOffersPost[] transfers = amadeus.shopping.transferOffers.post(body);
453+
454+
// Transfer Booking
455+
TransferOrder transfers = amadeus.ordering.transferOrders.post(body, params);
456+
457+
// Transfer Management
458+
TransferCancellation transfers = amadeus.ordering.transferOrder("123456").transfers.cancellation.post(params);
450459
```
451460

452461
## Development & Contributing

src/main/java/com/amadeus/Amadeus.java

+8
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,13 @@ public class Amadeus extends HTTPClient {
111111
*/
112112
public Airline airline;
113113

114+
/**
115+
* <p>
116+
* A namespaced client for the <code>/v1/ordering</code> endpoints.
117+
* </p>
118+
*/
119+
public Ordering ordering;
120+
114121
protected Amadeus(Configuration configuration) {
115122
super(configuration);
116123
this.referenceData = new ReferenceData(this);
@@ -125,6 +132,7 @@ protected Amadeus(Configuration configuration) {
125132
this.dutyOfCare = new DutyOfCare(this);
126133
this.location = new Location(this);
127134
this.airline = new Airline(this);
135+
this.ordering = new Ordering(this);
128136
}
129137

130138
/**
+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
package com.amadeus;
2+
3+
import com.amadeus.ordering.TransferOrder;
4+
import com.amadeus.ordering.TransferOrders;
5+
6+
/**
7+
* <p>
8+
* A namespaced client for the
9+
* <code>/v1/ordering</code> endpoints.
10+
* </p>
11+
*
12+
* <p>
13+
* Access via the Amadeus client object.
14+
* </p>
15+
*
16+
* <pre>
17+
* Amadeus amadeus = Amadeus.builder("clientId", "secret").build();
18+
* amadeus.ordering;</pre>
19+
*
20+
* @hide
21+
*/
22+
public class Ordering {
23+
private Amadeus client;
24+
25+
/**
26+
* <p>
27+
* A namespaced client for the
28+
* <code>/v1/ordering/transfer-orders</code> endpoints.
29+
* </p>
30+
*/
31+
public TransferOrders transferOrders;
32+
33+
/**
34+
* <p>
35+
* A namespaced client for the
36+
* <code>/v1/ordering/transafer-orders/:orderId</code> endpoints.
37+
* </p>
38+
*/
39+
public TransferOrder transferOrder(String orderId) {
40+
return new TransferOrder(client, orderId);
41+
}
42+
43+
/**
44+
* Constructor.
45+
* @hide
46+
*/
47+
public Ordering(Amadeus client) {
48+
this.transferOrders = new TransferOrders(client);
49+
this.client = client;
50+
}
51+
}

src/main/java/com/amadeus/Shopping.java

+10
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import com.amadeus.shopping.HotelOfferSearch;
1111
import com.amadeus.shopping.HotelOffersSearch;
1212
import com.amadeus.shopping.SeatMaps;
13+
import com.amadeus.shopping.TransferOffers;
1314

1415

1516
/**
@@ -103,6 +104,14 @@ public class Shopping {
103104
*/
104105
public Availability availability;
105106

107+
/**
108+
* <p>
109+
* A namespaced client for the
110+
* <code>/v1/shopping/transfer-offers</code> endpoints.
111+
* </p>
112+
*/
113+
public TransferOffers transferOffers;
114+
106115
/**
107116
* Constructor.
108117
* @hide
@@ -117,6 +126,7 @@ public Shopping(Amadeus client) {
117126
this.seatMaps = new SeatMaps(client);
118127
this.activities = new Activities(client);
119128
this.availability = new Availability(client);
129+
this.transferOffers = new TransferOffers(client);
120130
}
121131

122132
/**
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package com.amadeus.ordering;
2+
3+
import com.amadeus.Amadeus;
4+
import com.amadeus.ordering.transferOrders.Transfers;
5+
6+
/**
7+
* <p>
8+
* A namespaced client for the
9+
* <code>/v1/ordering/transfer-orders/:orderId</code> endpoints.
10+
* </p>
11+
*
12+
* <p>
13+
* Access via the Amadeus client object
14+
* </p>
15+
*
16+
* <pre>
17+
* Amadeus amadeus = Amadeus.builder(API_KEY, API_SECRET).build();
18+
* amadeus.ordering.transferOrder(orderId);</pre>
19+
*
20+
* @hide
21+
*/
22+
public class TransferOrder {
23+
public Amadeus client;
24+
public String orderId;
25+
public Transfers transfers;
26+
27+
/**
28+
* Constructor.
29+
* @hide
30+
*/
31+
public TransferOrder(Amadeus client, String orderId) {
32+
this.orderId = orderId;
33+
this.client = client;
34+
this.transfers = new Transfers(client, orderId);
35+
}
36+
37+
}
38+
39+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
package com.amadeus.ordering;
2+
3+
import com.amadeus.Amadeus;
4+
import com.amadeus.Params;
5+
import com.amadeus.Response;
6+
import com.amadeus.exceptions.ResponseException;
7+
import com.amadeus.resources.Resource;
8+
import com.amadeus.resources.TransferOrder;
9+
import com.google.gson.JsonObject;
10+
11+
/**
12+
* <p>
13+
* A namespaced client for the
14+
* <code>/v1/ordering/transfer-orders</code> endpoints.
15+
* </p>
16+
*
17+
* <p>
18+
* Access via the Amadeus client object.
19+
* </p>
20+
*
21+
* <pre>
22+
* Amadeus amadeus = Amadeus.builder(API_KEY, API_SECRET).build();
23+
* amadeus.ordering.transferOrders;</pre>
24+
*/
25+
public class TransferOrders {
26+
private Amadeus client;
27+
28+
private static final String TRANSFER_ORDERS_URL = "/v1/ordering/transfer-orders";
29+
30+
/**
31+
* Constructor.
32+
*
33+
* @hide
34+
*/
35+
public TransferOrders(Amadeus client) {
36+
this.client = client;
37+
}
38+
39+
/**
40+
* <p>
41+
* The Amadeus Transfer Offers API allows travelers to book private transfers.
42+
* </p>
43+
*
44+
* <pre>
45+
* amadeus.ordering.transferOrders.post(body);</pre>
46+
*
47+
* @param body the parameters to send to the API as a JsonObject
48+
* @param params URL parameters
49+
* @return an API resource
50+
* @throws ResponseException when an exception occurs
51+
*/
52+
public TransferOrder post(JsonObject body, Params params) throws ResponseException {
53+
Response response = client.post(TRANSFER_ORDERS_URL, params, body);
54+
return (TransferOrder) Resource.fromObject(response, TransferOrder.class);
55+
}
56+
57+
/**
58+
* <p>
59+
* The Amadeus Transfer Offers API allows travelers to book private transfers.
60+
* </p>
61+
*
62+
* <pre>
63+
* amadeus.ordering.transferOrders.post(body);</pre>
64+
*
65+
* @param body the parameters to send to the API as a String
66+
* @param params URL parameters
67+
* @return an API resource
68+
* @throws ResponseException when an exception occurs
69+
*/
70+
public TransferOrder post(String body, Params params) throws ResponseException {
71+
Response response = client.post(TRANSFER_ORDERS_URL, params, body);
72+
return (TransferOrder) Resource.fromObject(response, TransferOrder.class);
73+
}
74+
75+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package com.amadeus.ordering.transferOrders;
2+
3+
import com.amadeus.Amadeus;
4+
import com.amadeus.ordering.transferOrders.transfers.Cancellation;
5+
6+
/**
7+
* <p>
8+
* A namespaced client for the
9+
* <code>/v1/ordering/transfer-orders/{orderId}/transfers/cancellation</code> endpoints.
10+
* </p>
11+
*
12+
* <p>
13+
* Access via the Amadeus client object
14+
* </p>
15+
*
16+
* <pre>
17+
* Amadeus amadeus = Amadeus.builder("clientId", "secret").build();
18+
* amadeus.ordering.transferOrders(orderId).urls;</pre>
19+
*
20+
* @hide
21+
*/
22+
public class Transfers {
23+
/**
24+
* <p>
25+
* A namespaced client for the
26+
* <code>/v1/ordering/transfer-orders/{orderId}/transfers/cancellation</code> endpoints.
27+
* </p>
28+
*/
29+
public Cancellation cancellation;
30+
31+
/**
32+
* Constructor.
33+
* @hide
34+
*/
35+
public Transfers(Amadeus client, String orderId) {
36+
this.cancellation = new Cancellation(client, orderId);
37+
}
38+
}

0 commit comments

Comments
 (0)