Skip to content

Commit cdadf80

Browse files
committed
Add endpoint implementations for the new APIs
- Airline Code LookUp - Flight Busiest Traveling Period - Flight Most Booked Destinations
1 parent b1066bd commit cdadf80

File tree

12 files changed

+319
-3
lines changed

12 files changed

+319
-3
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,10 @@ FlightOffer[] flightOffers = amadeus.shopping.flightOffers.get(Params
226226
CheckinLink[] checkinLinks = amadeus.referenceData.urls.checkinLinks.get(Params
227227
.with("airline", "1X"));
228228

229+
// Airline Code LookUp
230+
Airline[] airlines = amadeus.referenceData.airlines.get(Params
231+
.with("IATACode", "BA"));
232+
229233
// Airport & City Search (autocomplete)
230234
// Find all the cities and airports starting by the keyword 'Lon'
231235
Location[] locations = amadeus.referenceData.locations.get(Params
@@ -252,6 +256,17 @@ AirTraffic[] airTraffics = amadeus.travel.analytics.airTraffic.traveled.get(Para
252256
.with("origin", "NCE")
253257
.and("period", "2017-08"));
254258

259+
// Flight Most Booked Destinations
260+
AirTraffic[] airTraffics = amadeus.travel.analytics.airTraffic.booked.get(Params
261+
.with("origin", "NCE")
262+
.and("period", "2017-08"));
263+
264+
// Flight Busiest Traveling Period
265+
Period[] busiestPeriods = amadeus.travel.analytics.airTraffic.busiestPeriod.get(Params
266+
.with("cityCode", "PAR")
267+
.and("period", "2017")
268+
.and("direction", BusiestPeriod.ARRIVING);
269+
255270
// Hotel Search API
256271
// Get list of hotels by cityCode
257272
HotelOffer[] offers = amadeus.shopping.hotelOffers.get(Params

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
GROUP=com.amadeus
2-
VERSION_NAME=1.0.1
2+
VERSION_NAME=1.1.0
33

44
POM_URL=https://github.com/amadeus4dev/amadeus-java
55
POM_SCM_URL[email protected]:amadeus4dev/amadeus-java.git

src/main/java/com/amadeus/ReferenceData.java

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

3+
import com.amadeus.referenceData.Airlines;
34
import com.amadeus.referenceData.Location;
45
import com.amadeus.referenceData.Locations;
56
import com.amadeus.referenceData.Urls;
@@ -39,6 +40,15 @@ public class ReferenceData {
3940
*/
4041
public Locations locations;
4142

43+
/**
44+
* <p>
45+
* A namespaced client for the
46+
* <code>/v2/reference-data/airlines</code> endpoints.
47+
* </p>
48+
*/
49+
public Airlines airlines;
50+
51+
4252
/**
4353
* Constructor.
4454
* @hide
@@ -47,6 +57,7 @@ public ReferenceData(Amadeus client) {
4757
this.client = client;
4858
this.urls = new Urls(client);
4959
this.locations = new Locations(client);
60+
this.airlines = new Airlines(client);
5061
}
5162

5263
/**
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
package com.amadeus.referenceData;
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.Airline;
8+
import com.amadeus.resources.Resource;
9+
import com.google.gson.Gson;
10+
11+
/**
12+
* <p>
13+
* A namespaced client for the
14+
* <code>/v1/reference-data/airlines</code> endpoints.
15+
* </p>
16+
*
17+
* <p>
18+
* Access via the Amadeus client object.
19+
* </p>
20+
*
21+
* <pre>
22+
* Amadeus amadeus = Amadeus.builder("clientId", "secret").build();
23+
* amadeus.referenceData.airlines;</pre>
24+
*/
25+
public class Airlines {
26+
private Amadeus client;
27+
28+
/**
29+
* Constructor.
30+
* @hide
31+
*/
32+
public Airlines(Amadeus client) {
33+
this.client = client;
34+
}
35+
36+
/**
37+
* <p>
38+
* Returns the airline name and code.
39+
* </p>
40+
*
41+
* <pre>
42+
* amadeus.referenceData.airlines.get(Params
43+
* .with("IATACode", "BA"));</pre>
44+
*
45+
* @param params the parameters to send to the API
46+
* @return an API response object
47+
* @throws ResponseException when an exception occurs
48+
*/
49+
public Airline[] get(Params params) throws ResponseException {
50+
Response response = client.get("/v1/reference-data/airlines", params);
51+
return (Airline[]) Resource.fromArray(response, Airline[].class);
52+
}
53+
54+
/**
55+
* Convenience method for calling <code>get</code> without any parameters.
56+
* @see Airlines#get()
57+
*/
58+
public Airline[] get() throws ResponseException {
59+
return get(null);
60+
}
61+
}

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

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

3-
import com.amadeus.travel.analytics.airTraffic.Traveled;
43
import lombok.Getter;
54
import lombok.ToString;
65

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.amadeus.resources;
2+
3+
import lombok.Getter;
4+
import lombok.ToString;
5+
6+
/**
7+
* An Airline object as returned by the Airline Code LookUp API.
8+
* @see com.amadeus.referenceData.airlines#get()
9+
*/
10+
@ToString
11+
public class Airline extends Resource {
12+
protected Airline() {}
13+
14+
private @Getter String type;
15+
private @Getter String iataCode;
16+
private @Getter String icaoCode;
17+
private @Getter String businessName;
18+
private @Getter String commonName;
19+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package com.amadeus.resources;
2+
3+
import lombok.Getter;
4+
import lombok.ToString;
5+
6+
/**
7+
* An Period object as returned by the BusiestPeriod API.
8+
* @see Traveled#get()
9+
*/
10+
@ToString
11+
public class Period extends Resource {
12+
protected Period() {}
13+
14+
private @Getter String type;
15+
private @Getter String period;
16+
private @Getter Analytics analytics;
17+
18+
/**
19+
* An Period-related object as returned by the Busiest Period API.
20+
* @see Traveled#get()
21+
*/
22+
@ToString
23+
public class Analytics {
24+
protected Analytics() {}
25+
26+
private @Getter Travellers travellers;
27+
28+
/**
29+
* An Period-related object as returned by the BusiestPeriod API.
30+
* @see Traveled#get()
31+
*/
32+
@ToString
33+
public class Travellers {
34+
protected Travellers() {}
35+
36+
private @Getter Double score;
37+
}
38+
}
39+
}

src/main/java/com/amadeus/travel/analytics/AirTraffic.java

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

33
import com.amadeus.Amadeus;
4+
import com.amadeus.travel.analytics.airTraffic.Booked;
5+
import com.amadeus.travel.analytics.airTraffic.BusiestPeriod;
46
import com.amadeus.travel.analytics.airTraffic.Traveled;
57

68
/**
@@ -28,11 +30,29 @@ public class AirTraffic {
2830
*/
2931
public Traveled traveled;
3032

33+
/**
34+
* <p>
35+
* A namespaced client for the
36+
* <code>/v1/travel/analytics/air-traffic/booked</code> endpoints.
37+
* </p>
38+
*/
39+
public Booked booked;
40+
41+
/**
42+
* <p>
43+
* A namespaced client for the
44+
* <code>/v1/travel/analytics/air-traffic/busiest-period</code> endpoints.
45+
* </p>
46+
*/
47+
public BusiestPeriod busiestPeriod;
48+
3149
/**
3250
* Constructor.
3351
* @hide
3452
*/
3553
public AirTraffic(Amadeus client) {
3654
this.traveled = new Traveled(client);
55+
this.booked = new Booked(client);
56+
this.busiestPeriod = new BusiestPeriod(client);
3757
}
3858
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
package com.amadeus.travel.analytics.airTraffic;
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.AirTraffic;
8+
import com.amadeus.resources.Resource;
9+
import com.google.gson.Gson;
10+
11+
/**
12+
* <p>
13+
* A namespaced client for the
14+
* <code>/v1/travel/analytics/air-traffic/booked</code> endpoints.
15+
* </p>
16+
*
17+
* <p>
18+
* Access via the Amadeus client object.
19+
* </p>
20+
*
21+
* <pre>
22+
* Amadeus amadeus = Amadeus.builder("clientId", "secret").build();
23+
* amadeus.travel.analytics.airTraffis.booked;</pre>
24+
*/
25+
public class Booked {
26+
private Amadeus client;
27+
28+
/**
29+
* Constructor.
30+
* @hide
31+
*/
32+
public Booked(Amadeus client) {
33+
this.client = client;
34+
}
35+
36+
/**
37+
* <p>
38+
* Returns a list of air traffic reports.
39+
* </p>
40+
*
41+
* <pre>
42+
* amadeus.travel.analytics.airTraffic.booked.get(Params
43+
* .with("origin", "LHR")
44+
* .and("period", "2017-03"));</pre>
45+
*
46+
* @param params the parameters to send to the API
47+
* @return an API response object
48+
* @throws ResponseException when an exception occurs
49+
*/
50+
public AirTraffic[] get(Params params) throws ResponseException {
51+
Response response = client.get("/v1/travel/analytics/air-traffic/booked", params);
52+
return (AirTraffic[]) Resource.fromArray(response, AirTraffic[].class);
53+
}
54+
55+
/**
56+
* Convenience method for calling <code>get</code> without any parameters.
57+
* @see Booked#get()
58+
*/
59+
public AirTraffic[] get() throws ResponseException {
60+
return get(null);
61+
}
62+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
package com.amadeus.travel.analytics.airTraffic;
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.Period;
8+
import com.amadeus.resources.Resource;
9+
import com.google.gson.Gson;
10+
11+
/**
12+
* <p>
13+
* A namespaced client for the
14+
* <code>/v1/travel/analytics/air-traffic/busiest-period</code> endpoints.
15+
* </p>
16+
*
17+
* <p>
18+
* Access via the Amadeus client object.
19+
* </p>
20+
*
21+
* <pre>
22+
* Amadeus amadeus = Amadeus.builder("clientId", "secret").build();
23+
* amadeus.travel.analytics.airTraffis.busiestPeriod;</pre>
24+
*/
25+
public class BusiestPeriod {
26+
private Amadeus client;
27+
public static String ARRIVING = "ARRIVING";
28+
public static String DEPARTING = "DEPARTING";
29+
30+
/**
31+
* Constructor.
32+
* @hide
33+
*/
34+
public BusiestPeriod(Amadeus client) {
35+
this.client = client;
36+
}
37+
38+
/**
39+
* <p>
40+
* Returns a list of busiest periods reports.
41+
* </p>
42+
*
43+
* <pre>
44+
* amadeus.travel.analytics.airTraffic.busiestPeriod.get(Params
45+
* .with("cityCode", "PAR")
46+
* .and("period", "2017"));</pre>
47+
*
48+
* @param params the parameters to send to the API
49+
* @return an API response object
50+
* @throws ResponseException when an exception occurs
51+
*/
52+
public Period[] get(Params params) throws ResponseException {
53+
Response response = client.get("/v1/travel/analytics/air-traffic/busiest-period", params);
54+
return (Period[]) Resource.fromArray(response, Period[].class);
55+
}
56+
57+
/**
58+
* Convenience method for calling <code>get</code> without any parameters.
59+
* @see Traveled#get()
60+
*/
61+
public Period[] get() throws ResponseException {
62+
return get(null);
63+
}
64+
}

0 commit comments

Comments
 (0)