Skip to content

Commit 0cb4920

Browse files
authored
Merge pull request #18 from anthonyroux/sdk-updates-NOV2018
Redesign of Flight Most Searched Destinations API
2 parents 51d2325 + ba7f7dc commit 0cb4920

File tree

14 files changed

+190
-100
lines changed

14 files changed

+190
-100
lines changed

CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,29 @@
11
# Changelog
22

3+
## 2.0.0 - 2018-10-12
4+
5+
[Flight Most Searched Destinations](https://developers.amadeus.com/self-service/category/203/api-doc/6): Redesign of the API - Split the previous endpoint in 2 endpoints:
6+
* 1st endpoint to find the most searched destinations
7+
* 2nd endpoint to have more data about a dedicated origin & destination
8+
9+
[Flight Most Booked Destinations](https://developers.amadeus.com/self-service/category/203/api-doc/27):
10+
* Rename origin to originCityCode
11+
12+
[Flight Most Traveled Destinations](https://developers.amadeus.com/self-service/category/203/api-doc/7):
13+
* Rename origin in originCityCode
14+
15+
[Flight Check-in Links](https://developers.amadeus.com/self-service/category/203/api-doc/8):
16+
* Rename airline to airlineCode
17+
18+
[Airport & City Search](https://developers.amadeus.com/self-service/category/203/api-doc/10):
19+
* Remove parameter onlyMajor
20+
21+
[Airport Nearest Relevant](https://developers.amadeus.com/self-service/category/203/api-doc/9):
22+
* Add radius as parameter
23+
24+
[Airline Code Lookup](https://developers.amadeus.com/self-service/category/203/api-doc/26):
25+
* Regroup parameters _IATACode_ and _ICAOCode_ under the same name _airlineCodes_
26+
327
## 1.1.0 - 2018-08-01
428

529
Release 1.1.0.

README.md

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ var amadeus = new Amadeus({
3636
});
3737

3838
amadeus.referenceData.urls.checkinLinks.get({
39-
airline: 'BA'
39+
airlineCode: 'BA'
4040
}).then(function(response){
4141
console.log(response.data[0].href);
4242
}).catch(function(responseError){
@@ -97,7 +97,7 @@ This library conveniently maps every API path to a similar path.
9797
For example, `GET /v2/reference-data/urls/checkin-links?airline=BA` would be:
9898

9999
```js
100-
amadeus.referenceData.urls.checkinLinks.get({ airline: 'BA' });
100+
amadeus.referenceData.urls.checkinLinks.get({ airlineCode: 'BA' });
101101
```
102102

103103
Similarly, to select a resource by ID, you can pass in the ID to the **singular** path.
@@ -111,7 +111,7 @@ amadeus.shopping.hotel(123).offer(234).get(...);
111111
You can make any arbitrary API call as well directly with the `.client.get` method:
112112

113113
```js
114-
amadeus.client.get('/v2/reference-data/urls/checkin-links', { airline: 'BA' });
114+
amadeus.client.get('/v2/reference-data/urls/checkin-links', { airlineCode: 'BA' });
115115
```
116116

117117
## Promises
@@ -127,7 +127,7 @@ containing the (parsed or unparsed) response, the request, and an error code.
127127

128128
```js
129129
amadeus.referenceData.urls.checkinLinks.get({
130-
airline: 'BA'
130+
airlineCode: 'BA'
131131
}).then(function(response){
132132
console.log(response.body); //=> The raw body
133133
console.log(response.result); //=> The fully parsed result
@@ -206,12 +206,12 @@ amadeus.shopping.flightDates.get({
206206

207207
// Flight Checkin Links
208208
amadeus.referenceData.urls.checkinLinks.get({
209-
airline : 'BA'
209+
airlineCode : 'BA'
210210
})
211211

212212
// Airline Code Lookup
213213
amadeus.referenceData.airlines.get({
214-
IATACode : 'U2'
214+
airlineCodes : 'U2'
215215
})
216216

217217
// Airports and City Search (autocomplete)
@@ -231,21 +231,29 @@ amadeus.referenceData.locations.airports.get({
231231
})
232232

233233
// Flight Most Searched Destinations
234-
amadeus.travel.analytics.fareSearches.get({
235-
origin : 'MAD',
236-
sourceCountry : 'SP',
237-
period : '2017-08'
234+
// Which were the most searched flight destinations from Madrid in August 2017?
235+
amadeus.travel.analytics.airTraffic.searched.get({
236+
originCityCode : 'MAD',
237+
searchPeriod : '2017-08',
238+
marketCountryCode : 'ES'
239+
})
240+
// How many people in Spain searched for a trip from Madrid to New-York in September 2017?
241+
amadeus.travel.analytics.airTraffic.searchedByDestination.get({
242+
originCityCode : 'MAD',
243+
destinationCityCode : 'NYC',
244+
searchPeriod : '2017-08',
245+
marketCountryCode : 'ES'
238246
})
239247

240248
// Flight Most Booked Destinations
241249
amadeus.travel.analytics.airTraffic.booked.get({
242-
origin : 'MAD',
250+
originCityCode : 'MAD',
243251
period : '2017-08'
244252
})
245253

246254
// Flight Most Traveled Destinations
247255
amadeus.travel.analytics.airTraffic.traveled.get({
248-
origin : 'MAD',
256+
originCityCode : 'MAD',
249257
period : '2017-01'
250258
})
251259

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "amadeus",
3-
"version": "1.1.0",
3+
"version": "2.0.0",
44
"description": "Node library for the Amadeus travel APIs",
55
"main": "lib/amadeus.js",
66
"scripts": {
@@ -43,7 +43,8 @@
4343
},
4444
"homepage": "https://developer.amadeus.com",
4545
"contributors": [
46-
"cbetta"
46+
"cbetta",
47+
"Anthony Roux"
4748
],
4849
"devDependencies": {
4950
"babel-cli": "^6.26.0",
@@ -52,7 +53,8 @@
5253
"documentation": "^5.3.5",
5354
"eslint": "^4.16.0",
5455
"jest": "^23.4.2",
55-
"watch": "^1.0.2"
56+
"watch": "^1.0.2",
57+
"merge": "^1.2.1"
5658
},
5759
"dependencies": {
5860
"bluebird": "^3.5.1",

spec/amadeus/namespaces.test.js

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,11 @@ describe('Namespaces', () => {
2828
expect(amadeus.travel.analytics).toBeDefined();
2929
expect(amadeus.travel.analytics.airTraffic).toBeDefined();
3030
expect(amadeus.travel.analytics.airTraffic.traveled).toBeDefined();
31+
expect(amadeus.travel.analytics.airTraffic.searched).toBeDefined();
32+
expect(amadeus.travel.analytics.airTraffic.searchedByDestination).toBeDefined();
3133
expect(amadeus.travel.analytics.airTraffic.booked).toBeDefined();
3234
expect(amadeus.travel.analytics.airTraffic.busiestPeriod).toBeDefined();
33-
expect(amadeus.travel.analytics.fareSearches).toBeDefined();
35+
3436

3537
expect(amadeus.shopping).toBeDefined();
3638
expect(amadeus.shopping.flightDates).toBeDefined();
@@ -50,10 +52,11 @@ describe('Namespaces', () => {
5052
expect(amadeus.referenceData.locations.airports.get).toBeDefined();
5153
expect(amadeus.referenceData.airlines.get).toBeDefined();
5254

55+
expect(amadeus.travel.analytics.airTraffic.searched.get).toBeDefined();
56+
expect(amadeus.travel.analytics.airTraffic.searchedByDestination.get).toBeDefined();
5357
expect(amadeus.travel.analytics.airTraffic.traveled.get).toBeDefined();
5458
expect(amadeus.travel.analytics.airTraffic.booked.get).toBeDefined();
5559
expect(amadeus.travel.analytics.airTraffic.busiestPeriod.get).toBeDefined();
56-
expect(amadeus.travel.analytics.fareSearches.get).toBeDefined();
5760

5861
expect(amadeus.shopping.flightDates.get).toBeDefined();
5962
expect(amadeus.shopping.flightDestinations.get).toBeDefined();
@@ -99,6 +102,20 @@ describe('Namespaces', () => {
99102
.toHaveBeenCalledWith('/v1/reference-data/airlines', {});
100103
});
101104

105+
it('.amadeus.travel.analytics.airTraffic.searched.get', () => {
106+
amadeus.client.get = jest.fn();
107+
amadeus.travel.analytics.airTraffic.searched.get();
108+
expect(amadeus.client.get)
109+
.toHaveBeenCalledWith('/v1/travel/analytics/air-traffic/searched', {});
110+
});
111+
112+
it('.amadeus.travel.analytics.airTraffic.searchedByDestination.get', () => {
113+
amadeus.client.get = jest.fn();
114+
amadeus.travel.analytics.airTraffic.searchedByDestination.get();
115+
expect(amadeus.client.get)
116+
.toHaveBeenCalledWith('/v1/travel/analytics/air-traffic/searched/by-destination', {});
117+
});
118+
102119
it('.amadeus.travel.analytics.airTraffic.traveled.get', () => {
103120
amadeus.client.get = jest.fn();
104121
amadeus.travel.analytics.airTraffic.traveled.get();
@@ -120,13 +137,6 @@ describe('Namespaces', () => {
120137
.toHaveBeenCalledWith('/v1/travel/analytics/air-traffic/busiest-period', {});
121138
});
122139

123-
it('.amadeus.travel.analytics.fareSearches.get', () => {
124-
amadeus.client.get = jest.fn();
125-
amadeus.travel.analytics.fareSearches.get();
126-
expect(amadeus.client.get)
127-
.toHaveBeenCalledWith('/v1/travel/analytics/fare-searches', {});
128-
});
129-
130140
it('.amadeus.shopping.flightDates.get', () => {
131141
amadeus.client.get = jest.fn();
132142
amadeus.shopping.flightDates.get();

src/amadeus/namespaces/reference_data/airlines.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,14 @@ class Airlines{
2020
* Returns the airline name and code.
2121
*
2222
* @param {Object} params
23-
* @param {string} params.IATACode Code of the airline following IATA standard.
24-
* @param {string} params.ICAOCode Code of the airline following ICAO standard.
23+
* @param {string} params.airlineCodes Code of the airline following IATA or ICAO standard.
2524
* @return {Promise.<Response,ResponseError>} a Promise
2625
*
2726
* Find to which airlines belongs IATA Code BA
2827
*
2928
* ```js
3029
* amadeus.referenceData.airlines.get({
31-
* IATACode : 'BA'
30+
* airlineCodes : 'BA'
3231
* });
3332
* ```
3433
*/

src/amadeus/namespaces/reference_data/urls/checkin_links.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ class CheckinLinks {
2121
* language of your choice
2222
*
2323
* @param {Object} params
24-
* @param {string} params.airline airline ID - required
24+
* @param {string} params.airlineCode airline ID - required
2525
* @param {string} [params.language="en-GB"] the locale for the links
2626
* @return {Promise.<Response,ResponseError>} a Promise
2727
*
2828
* Find a the checkin links for Air France
2929
*
3030
* ```js
3131
* amadeus.referenceData.urls.checkinLinks.get({
32-
* airline: 'AF'
32+
* airlineCode: 'AF'
3333
* });
3434
* ```
3535
*/

src/amadeus/namespaces/travel/analytics.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import AirTraffic from './analytics/air_traffic';
2-
import FareSearches from './analytics/fare_searches';
32

43
/**
54
* A namespaced client for the
@@ -20,7 +19,6 @@ class Analytics {
2019
constructor(client) {
2120
this.client = client;
2221
this.airTraffic = new AirTraffic(client);
23-
this.fareSearches = new FareSearches(client);
2422
}
2523
}
2624

src/amadeus/namespaces/travel/analytics/air_traffic.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import Traveled from './air_traffic/traveled.js';
22
import Booked from './air_traffic/booked.js';
3+
import Searched from './air_traffic/searched.js';
4+
import SearchedByDestination from './air_traffic/searched_by_destination.js';
35
import BusiestPeriod from './air_traffic/busiest_period.js';
46

57
/**
@@ -20,6 +22,8 @@ class AirTraffic {
2022
this.client = client;
2123
this.traveled = new Traveled(client);
2224
this.booked = new Booked(client);
25+
this.searched = new Searched(client);
26+
this.searchedByDestination = new SearchedByDestination(client);
2327
this.busiestPeriod = new BusiestPeriod(client);
2428
}
2529

src/amadeus/namespaces/travel/analytics/air_traffic/booked.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@ class Booked{
2020
* Returns a list of air traffic reports based on the number of bookings.
2121
*
2222
* @param {Object} params
23-
* @param {string} params.origin IATA code of the origin city - e.g. BOS for
24-
* Boston - required
25-
* @param {string} params.query period when consumers are travelling in
23+
* @param {string} params.originCityCode IATA code of the origin city - e.g. MAD for
24+
* Madrid - required
25+
* @param {string} params.period period when consumers are travelling in
2626
* YYYY-MM format
2727
* @return {Promise.<Response,ResponseError>} a Promise
2828
*
29-
* Find the air traffic from London in May 2016
29+
* Where were people flying to from Madrid in the August 2017?
3030
*
3131
* ```js
3232
* amadeus.travel.analytics.AirTraffic.Booked.get({
33-
* origin: 'LON',
34-
* period: '2016-05'
33+
* originCityCode: 'MAD',
34+
* period: '2017-08'
3535
* });
3636
* ```
3737
*/

src/amadeus/namespaces/travel/analytics/air_traffic/busiest_period.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,19 @@ class BusiestPeriod{
2020
* Returns a list of air traffic reports.
2121
*
2222
* @param {Object} params
23-
* @param {string} params.origin IATA code of the origin city - e.g. BOS for
24-
* Boston - required
25-
* @param {string} params.query period when consumers are travelling in
23+
* @param {string} params.cityCode IATA code of the origin city - e.g. MAD for
24+
* Madrid - required
25+
* @param {string} params.period period when consumers are travelling in
26+
* YYYY-MM format
27+
* @param {string} params.direction to select between arrivals and departures (default: arrivals)
2628
* YYYY-MM format
2729
* @return {Promise.<Response,ResponseError>} a Promise
2830
*
29-
* Find the air traffic for travelers arriving in Paris in 2017
31+
* What were the busiest months for Madrid in 2017?
3032
*
3133
* ```js
3234
* amadeus.travel.analytics.AirTraffic.BusiestPeriod.get({
33-
* cityCode: 'PAR',
35+
* cityCode: 'MAD',
3436
* period: '2017',
3537
* direction: Amadeus.direction.arriving
3638
* });

0 commit comments

Comments
 (0)