diff --git a/README.md b/README.md index f7bae34..72daf69 100644 --- a/README.md +++ b/README.md @@ -386,6 +386,12 @@ amadeus.referenceData.locations.pointsOfInterest.bySquare.get({ // Extract the information about point of interest with ID '9CB40CB5D0' amadeus.referenceData.locations.pointOfInterest('9CB40CB5D0').get() +// Location Score +amadeus.location.analytics.categoryRatedAreas.get({ + latitude : 41.397158, + longitude : 2.160873 +}) + // Safe Place // How safe is Barcelona? (based a geo location and a radius) amadeus.safety.safetyRatedLocations.get({ diff --git a/src/amadeus.js b/src/amadeus.js index 5a46dd0..463a478 100644 --- a/src/amadeus.js +++ b/src/amadeus.js @@ -11,6 +11,7 @@ import Airport from './amadeus/namespaces/airport'; import Safety from './amadeus/namespaces/safety'; import Schedule from './amadeus/namespaces/schedule'; import Analytics from './amadeus/namespaces/analytics'; +import Location from './amadeus/namespaces/location'; /** @@ -74,6 +75,7 @@ class Amadeus { this.safety = new Safety(this.client); this.schedule = new Schedule(this.client); this.analytics = new Analytics(this.client); + this.location = new Location(this.client); } /** diff --git a/src/amadeus/namespaces/location.js b/src/amadeus/namespaces/location.js new file mode 100644 index 0000000..f0c0eb2 --- /dev/null +++ b/src/amadeus/namespaces/location.js @@ -0,0 +1,24 @@ +import Analytics from './location/analytics'; + +/** + * A namespaced client for the + * `/v1/location` endpoints + * + * Access via the {@link Amadeus} object + * + * ```js + * let amadeus = new Amadeus(); + * amadeus.location; + * ``` + * + * @param {Client} client + * @property {analytics} analytics + */ +class Location { + constructor(client) { + this.client = client; + this.analytics = new Analytics(client); + } +} + +export default Location; \ No newline at end of file diff --git a/src/amadeus/namespaces/location/analytics.js b/src/amadeus/namespaces/location/analytics.js new file mode 100644 index 0000000..83ce7d0 --- /dev/null +++ b/src/amadeus/namespaces/location/analytics.js @@ -0,0 +1,24 @@ +import CategoryRatedAreas from './analytics/category_rated_areas'; + +/** + * A namespaced client for the + * `/v1/location/analytics` endpoints + * + * Access via the {@link Amadeus} object + * + * ```js + * let amadeus = new Amadeus(); + * amadeus.location; + * ``` + * + * @param {Client} client + * @property {analytics} CategoryRatedAreas + */ +class Analytics { + constructor(client) { + this.client = client; + this.categoryRatedAreas = new CategoryRatedAreas(client); + } +} + +export default Analytics; \ No newline at end of file diff --git a/src/amadeus/namespaces/location/analytics/category_rated_areas.js b/src/amadeus/namespaces/location/analytics/category_rated_areas.js new file mode 100644 index 0000000..8613e7a --- /dev/null +++ b/src/amadeus/namespaces/location/analytics/category_rated_areas.js @@ -0,0 +1,44 @@ +/** + * A namespaced client for the + * `/v1/location/analytics/category-rated-areas` endpoints + * + * Access via the {@link Amadeus} object + * + * ```js + * let amadeus = new Amadeus(); + * amadeus.referenceData.locations.pointsOfInterest; + * ``` + * + * @param {Client} client + */ +class CategoryRatedAreas { + constructor(client) { + this.client = client; + } + + /** + * Gets popularity score for location categories + * + * @param {Object} params + * @param {Double} params.latitude latitude location to be at the center of + * the search circle - required + * @param {Double} params.longitude longitude location to be at the center of + * the search circle - required + * @param {Double} params.radius radius of the search in Kilometer - optional + * @return {Promise.} a Promise + * + * ets popularity score for location categories in Barcelona + * + * ```js + * amadeus.location.analytics.categoryRatedAreas.get({ + * longitude: 2.160873, + * latitude: 41.397158 + * }); + * ``` + */ + get(params = {}) { + return this.client.get('/v1/location/analytics/category-rated-areas', params); + } +} + +export default CategoryRatedAreas;