Skip to content

Commit 5fa770f

Browse files
committed
add transfer management api
1 parent a447606 commit 5fa770f

File tree

6 files changed

+174
-1
lines changed

6 files changed

+174
-1
lines changed

src/main/java/com/amadeus/Ordering.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.amadeus;
22

33
import com.amadeus.ordering.TransferOrders;
4+
import com.amadeus.ordering.TransferOrder;
45

56
/**
67
* <p>
@@ -19,6 +20,8 @@
1920
* @hide
2021
*/
2122
public class Ordering {
23+
private Amadeus client;
24+
2225
/**
2326
* <p>
2427
* A namespaced client for the
@@ -27,11 +30,22 @@ public class Ordering {
2730
*/
2831
public TransferOrders tranferOrders;
2932

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+
3043
/**
3144
* Constructor.
3245
* @hide
3346
*/
3447
public Ordering(Amadeus client) {
3548
this.tranferOrders = new TransferOrders(client);
49+
this.client = client;
3650
}
3751
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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.ordering.transferOrders.Transfers;
8+
import com.amadeus.resources.Resource;
9+
10+
/**
11+
* <p>
12+
* A namespaced client for the
13+
* <code>/v2/shopping/hotel-offers/:offer_id</code> endpoints.
14+
* </p>
15+
*
16+
* <p>
17+
* Access via the Amadeus client object
18+
* </p>
19+
*
20+
* <pre>
21+
* Amadeus amadeus = Amadeus.builder(API_KEY, API_SECRET).build();
22+
* amadeus.shopping.HotelOffer(offerId);</pre>
23+
*
24+
* @hide
25+
*/
26+
public class TransferOrder {
27+
public Amadeus client;
28+
public String orderId;
29+
public Transfers transfers;
30+
31+
/**
32+
* Constructor.
33+
* @hide
34+
*/
35+
public TransferOrder(Amadeus client, String orderId) {
36+
this.orderId = orderId;
37+
this.client = client;
38+
this.transfers = new Transfers(client, orderId);
39+
}
40+
41+
}
42+
43+

src/main/java/com/amadeus/ordering/TransferOrders.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
*/
2525
public class TransferOrders {
2626
private Amadeus client;
27+
2728
private static final String TRANSFER_ORDERS_URL = "/v1/ordering/transfer-orders";
2829

2930
/**
Lines changed: 38 additions & 0 deletions
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+
}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
package com.amadeus.ordering.transferOrders.transfers;
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.TransferCancellation;
9+
import com.google.gson.JsonObject;
10+
11+
/**
12+
* <p>
13+
* A namespaced client for the
14+
* <code>/v1/ordering/transfer-orders/{orderId}/transfers/cancellation</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.transferOrder(orderId).transfers.cancellation;</pre>
24+
*/
25+
public class Cancellation {
26+
private Amadeus client;
27+
private String orderId;
28+
29+
/**
30+
* Constructor.
31+
*
32+
* @hide
33+
*/
34+
public Cancellation(Amadeus client, String orderId) {
35+
this.client = client;
36+
this.orderId = orderId;
37+
}
38+
39+
/**
40+
* <p>
41+
* The Amadeus Transfer Management API allows cancel private transfers.
42+
* </p>
43+
*
44+
* <pre>
45+
* amadeus.ordering.transferOrder(orderId).transfers.cancellation.post(body, params);</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 TransferCancellation post(JsonObject body, Params params) throws ResponseException {
53+
String path = String.format("/v1/ordering/transfer-orders/%s/transfers/cancellation", orderId);
54+
Response response = client.post(path, params, body);
55+
return (TransferCancellation) Resource.fromObject(response, TransferCancellation.class);
56+
}
57+
58+
/**
59+
* <p>
60+
* The Amadeus Transfer Management API allows cancel private transfers.
61+
* </p>
62+
*
63+
* <pre>
64+
* amadeus.ordering.transferOrders(orderId).transfers.cancellation.post(body, params);</pre>
65+
*
66+
* @param body the parameters to send to the API as a String
67+
* @param params URL parameters
68+
* @return an API resource
69+
* @throws ResponseException when an exception occurs
70+
*/
71+
public TransferCancellation post(String body, Params params) throws ResponseException {
72+
String path = String.format("/v1/ordering/transfer-orders/%s/transfers/cancellation", orderId);
73+
Response response = client.post(path, params, body);
74+
return (TransferCancellation) Resource.fromObject(response, TransferCancellation.class);
75+
}
76+
77+
}

src/main/java/com/amadeus/resources/TransferCancellation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
/**
88
* A TransferCancellation object as returned by the Transfer Management API.
9-
* @see com.amadeus.ordering.transferOrders.transfer.Cancellation#post()
9+
* @see com.amadeus.ordering.transferOrders.transfers.transfer.Cancellation#post()
1010
*/
1111
@ToString
1212
public class TransferCancellation extends Resource {

0 commit comments

Comments
 (0)