diff --git a/README.md b/README.md index 629decd..83ee4ea 100644 --- a/README.md +++ b/README.md @@ -368,6 +368,13 @@ amadeus.referenceData.locations.cities.get({ keyword: 'Paris' }) +//Hotel Name Autocomplete API +//Autocomplete a hotel search field +amadeus.referenceData.locations.hotel.get({ + keyword: 'PARI', + subType: 'HOTEL_GDS' +}) + //Hotel List API //Get list of hotels by city code amadeus.referenceData.locations.hotels.byCity.get({ @@ -385,25 +392,6 @@ amadeus.referenceData.locations.hotels.byHotels.get({ hotelIds: 'ACPAR245' }) -//Hotel Name Autocomplete API -//Autocomplete a hotel search field -amadeus.referenceData.locations.hotel.get({ - keyword: 'PARI', - subType: 'HOTEL_GDS' -}) - -// Hotel Search API V2 -// Get list of hotels by city code -amadeus.shopping.hotelOffers.get({ - cityCode : 'MAD' -}) -// Get list of offers for a specific hotel -amadeus.shopping.hotelOffersByHotel.get({ - hotelId : 'XKPARC12' -}) -// Confirm the availability of a specific offer id -amadeus.shopping.hotelOffer('XXX').get() - // Hotel Search API V3 // Get list of available offers in specific hotels by hotel ids amadeus.shopping.hotelOffersSearch.get({ @@ -554,12 +542,6 @@ amadeus.dutyOfCare.diseases.covid19Report.get({ language: 'EN' }); -// Travel Restrictions API v1 -amadeus.dutyOfCare.diseases.covid19AreaReport.get({ - countryCode: 'US', - cityCode: 'NYC' -}); - ``` ## Development & Contributing diff --git a/spec/amadeus/namespaces.test.js b/spec/amadeus/namespaces.test.js index 8f55cd6..5bc2f96 100644 --- a/spec/amadeus/namespaces.test.js +++ b/spec/amadeus/namespaces.test.js @@ -66,10 +66,6 @@ describe('Namespaces', () => { expect(amadeus.booking).toBeDefined(); expect(amadeus.booking.flightOrders).toBeDefined(); - expect(amadeus.shopping.hotelOffers).toBeDefined(); - expect(amadeus.shopping.hotelOffersByHotel).toBeDefined(); - expect(amadeus.shopping.hotelOffer).toBeDefined(); - expect(amadeus.shopping.hotelOfferSearch).toBeDefined(); expect(amadeus.shopping.hotelOffersSearch).toBeDefined(); @@ -101,7 +97,6 @@ describe('Namespaces', () => { expect(amadeus.dutyOfCare).toBeDefined(); expect(amadeus.dutyOfCare.diseases).toBeDefined(); - expect(amadeus.dutyOfCare.diseases.covid19AreaReport).toBeDefined(); expect(amadeus.dutyOfCare.diseases.covid19Report).toBeDefined(); expect(amadeus.airline.destinations).toBeDefined(); @@ -134,10 +129,6 @@ describe('Namespaces', () => { expect(amadeus.shopping.flightOffersSearch.get).toBeDefined(); expect(amadeus.shopping.seatmaps.get).toBeDefined(); - expect(amadeus.shopping.hotelOffers.get).toBeDefined(); - expect(amadeus.shopping.hotelOffersByHotel.get).toBeDefined(); - expect(amadeus.shopping.hotelOffer('XXX').get).toBeDefined(); - expect(amadeus.shopping.hotelOfferSearch('XXX').get).toBeDefined(); expect(amadeus.shopping.hotelOffersSearch.get).toBeDefined(); @@ -161,7 +152,6 @@ describe('Namespaces', () => { expect(amadeus.location.analytics.categoryRatedAreas.get).toBeDefined(); - expect(amadeus.dutyOfCare.diseases.covid19AreaReport.get).toBeDefined(); expect(amadeus.dutyOfCare.diseases.covid19Report.get).toBeDefined(); expect(amadeus.airline.destinations.get).toBeDefined(); @@ -391,27 +381,6 @@ describe('Namespaces', () => { .toHaveBeenCalledWith('/v1/shopping/seatmaps', {}); }); - it('.amadeus.shopping.hotelOffers.get', () => { - amadeus.client.get = jest.fn(); - amadeus.shopping.hotelOffers.get(); - expect(amadeus.client.get) - .toHaveBeenCalledWith('/v2/shopping/hotel-offers', {}); - }); - - it('.amadeus.shopping.hotelOffersByHotel.get', () => { - amadeus.client.get = jest.fn(); - amadeus.shopping.hotelOffersByHotel.get(); - expect(amadeus.client.get) - .toHaveBeenCalledWith('/v2/shopping/hotel-offers/by-hotel', {}); - }); - - it('.amadeus.shopping.hotelOffer().get', () => { - amadeus.client.get = jest.fn(); - amadeus.shopping.hotelOffer('XXX').get(); - expect(amadeus.client.get) - .toHaveBeenCalledWith('/v2/shopping/hotel-offers/XXX', {}); - }); - it('.amadeus.shopping.hotelOfferSearch().get', () => { amadeus.client.get = jest.fn(); amadeus.shopping.hotelOfferSearch('XXX').get(); @@ -538,13 +507,6 @@ describe('Namespaces', () => { .toHaveBeenCalledWith('/v1/shopping/flight-offers/upselling', {}); }); - it('.amadeus.dutyOfCare.diseases.covid19AreaReport.get', () => { - amadeus.client.get = jest.fn(); - amadeus.dutyOfCare.diseases.covid19AreaReport.get(); - expect(amadeus.client.get) - .toHaveBeenCalledWith('/v1/duty-of-care/diseases/covid19-area-report', {}); - }); - it('.amadeus.dutyOfCare.diseases.covid19Report.get', () => { amadeus.client.get = jest.fn(); amadeus.dutyOfCare.diseases.covid19Report.get(); diff --git a/src/amadeus/namespaces/duty_of_care/diseases.js b/src/amadeus/namespaces/duty_of_care/diseases.js index 050dc5b..76f2816 100644 --- a/src/amadeus/namespaces/duty_of_care/diseases.js +++ b/src/amadeus/namespaces/duty_of_care/diseases.js @@ -1,8 +1,7 @@ -import Covid19AreaReport from './diseases/covid19_area_report'; import Covid19Report from './diseases/covid19_report'; /** * A namespaced client for the - * `/v1/duty-of-care/diseases` and `/v2/duty-of-care/diseases` endpoints + * `/v2/duty-of-care/diseases` endpoints * * Access via the {@link Amadeus} object * @@ -16,7 +15,6 @@ import Covid19Report from './diseases/covid19_report'; class Diseases { constructor(client) { this.client = client; - this.covid19AreaReport = new Covid19AreaReport(client); this.covid19Report = new Covid19Report(client); } } diff --git a/src/amadeus/namespaces/duty_of_care/diseases/covid19_area_report.js b/src/amadeus/namespaces/duty_of_care/diseases/covid19_area_report.js deleted file mode 100644 index 9f6a5c0..0000000 --- a/src/amadeus/namespaces/duty_of_care/diseases/covid19_area_report.js +++ /dev/null @@ -1,45 +0,0 @@ -/** - * A namespaced client for the - * `/v1/duty-of-care/diseases/covid19-area-report` endpoints - * - * Access via the {@link Amadeus} object - * - * ```js - * let amadeus = new Amadeus(); - * amadeus.dutyOfCare.diseases.covid19AreaReport; - * ``` - * - * @param {Client} client - */ -class Covid19AreaReport { - constructor(client) { - this.client = client; - } - - /** - * Returns Covid-19 related restrictions for a given country - * - * @param {Object} params - * @param {string} params.countryCode ISO 3166 Alpha-2 code. e.g. "US" United States of America. - * @return {Promise.} a Promise - * - * Returns Covid-19 restrictions in the United States - * - * ```js - * amadeus.dutyOfCare.diseases.covid19AreaReport.get({ - * countryCode: 'US' - * }).then(function(response){ - * console.log(response.data); - * }).catch(function(responseError){ - * console.log(responseError); - * }); - * ``` - */ - - - get(params = {}) { - return this.client.get('/v1/duty-of-care/diseases/covid19-area-report', params); - } -} - -export default Covid19AreaReport; diff --git a/src/amadeus/namespaces/shopping.js b/src/amadeus/namespaces/shopping.js index 8ea65cc..c63f9fe 100644 --- a/src/amadeus/namespaces/shopping.js +++ b/src/amadeus/namespaces/shopping.js @@ -3,9 +3,6 @@ import FlightOffers from './shopping/flight_offers'; import FlightOffersSearch from './shopping/flight_offers_search'; import FlightDates from './shopping/flight_dates'; import Seatmaps from './shopping/seatmaps'; -import HotelOffers from './shopping/hotel_offers'; -import HotelOffersByHotel from './shopping/hotel_offers_by_hotel'; -import HotelOffer from './shopping/hotel_offer'; import HotelOfferSearch from './shopping/hotel_offer_search'; import HotelOffersSearch from './shopping/hotel_offers_search'; import Activities from './shopping/activities'; @@ -30,9 +27,6 @@ import Availability from './shopping/availability'; * @property {FlightOffersSearch} flightOffersSearch * @property {FlightDates} flightDates * @property {Seatmaps} seatmaps - * @property {HotelOffers} hotelOffers - * @property {HotelOffer} hotelOffer - * @property {HotelOffersByHotel} hotelOffersByHotel * @property {HotelOfferSearch} hotelOffers * @property {HotelOffersSearch} hotelOffers * @property {Availability} availability @@ -45,24 +39,11 @@ class Shopping { this.flightOffersSearch = new FlightOffersSearch(client); this.flightDates = new FlightDates(client); this.seatmaps = new Seatmaps(client); - this.hotelOffers = new HotelOffers(client); - this.hotelOffersByHotel = new HotelOffersByHotel(client); this.hotelOffersSearch = new HotelOffersSearch(client); this.activities = new Activities(client); this.availability = new Availability(client); } - - /** - * Loads a namespaced path for a specific offer ID for Hotel Search V2 - * - * @param {string} [offerId] The ID of the offer for a dedicated hotel - * @return {HotelOffer} - **/ - hotelOffer(offerId) { - return new HotelOffer(this.client, offerId); - } - /** * Loads a namespaced path for a specific offer ID for Hotel Search V3 * diff --git a/src/amadeus/namespaces/shopping/hotel_offer.js b/src/amadeus/namespaces/shopping/hotel_offer.js deleted file mode 100644 index 0a2e149..0000000 --- a/src/amadeus/namespaces/shopping/hotel_offer.js +++ /dev/null @@ -1,40 +0,0 @@ -/** - * A namespaced client for the - * `/v2/shopping/hotel-offers/:offer_id` endpoints - * - * Access via the {@link Amadeus} object - * - * ```js - * let amadeus = new Amadeus(); - * amadeus.shopping.hotelOffer('XXX'); - * ``` - * - * @param {Client} client - * @property {number} offerId - */ -class HotelOffer { - constructor(client, offerId) { - this.client = client; - this.offerId = offerId; - } - - /** - * Returns details for a specific offer - * - * @param {Object} params - * @return {Promise.} a Promise - * - * Find details for the offer with ID 'XXX' - * - * ```js - * amadeus.shopping.hotelOffer('XXX').get(); - * ``` - */ - get(params = {}) { - return this.client.get( - `/v2/shopping/hotel-offers/${this.offerId}`, params - ); - } -} - -export default HotelOffer; \ No newline at end of file diff --git a/src/amadeus/namespaces/shopping/hotel_offers.js b/src/amadeus/namespaces/shopping/hotel_offers.js deleted file mode 100644 index 3c56036..0000000 --- a/src/amadeus/namespaces/shopping/hotel_offers.js +++ /dev/null @@ -1,45 +0,0 @@ -/** - * A namespaced client for the - * `/v2/shopping/hotel-offers` endpoints - * - * Access via the {@link Amadeus} object - * - * ```js - * let amadeus = new Amadeus(); - * amadeus.shopping.hotelOffers; - * ``` - * - * @param {Client} client - */ -class HotelOffers { - constructor(client) { - this.client = client; - } - - /** - * Find the list of hotels for a dedicated city. - * - * @param {Object} params - * @param {string} params.cityCode City IATA code - * @param {number} params.latitude latitude of geographic location to - * search around. Example: 52.5238 - * @param {number} params.longitude Longitude of geographic location to - * search around. Example: 13.3835 - * @param {string} params.hotelIds Comma separated list of Amadeus hotel - * codes to request. Example: RTPAR001 - * @return {Promise.} a Promise - * - * Search for hotels in Paris - * - * ```js - * amadeus.shopping.hotelOffers.get({ - * cityCode: 'PAR' - * }) - * ``` - */ - get(params = {}) { - return this.client.get('/v2/shopping/hotel-offers', params); - } -} - -export default HotelOffers; diff --git a/src/amadeus/namespaces/shopping/hotel_offers_by_hotel.js b/src/amadeus/namespaces/shopping/hotel_offers_by_hotel.js deleted file mode 100644 index b7a0c36..0000000 --- a/src/amadeus/namespaces/shopping/hotel_offers_by_hotel.js +++ /dev/null @@ -1,40 +0,0 @@ -/** - * A namespaced client for the - * `/v2/shopping/hotel-offers/by-hotel` endpoints - * - * Access via the {@link Amadeus} object - * - * ```js - * let amadeus = new Amadeus(); - * amadeus.shopping.hotelOffersByHotel; - * ``` - * - * @param {Client} client - */ -class HotelOffersByHotel { - constructor(client) { - this.client = client; - } - - /** - * Get all offers for a dedicated hotel - * - * @param {Object} params - * @param {string} params.hotelId Amadeus Property Code (8 chars), - * Example: XKPARC12. - * @return {Promise.} a Promise - * - * Get all offers for Holiday Inn Paris Notre Dame. - * - * ```js - * amadeus.shopping.hotelOffersByHotel.get({ - * hotelId: 'XKPARC12' - * }) - * ``` - */ - get(params = {}) { - return this.client.get('/v2/shopping/hotel-offers/by-hotel', params); - } -} - -export default HotelOffersByHotel; \ No newline at end of file