From c35e09ab9b5b7a84dd314771860ee642df62c4b2 Mon Sep 17 00:00:00 2001 From: MinjiK Date: Tue, 5 Dec 2023 16:49:55 +0100 Subject: [PATCH] post method support JSON.springify --- src/amadeus/namespaces/booking/flight_orders.js | 2 +- src/amadeus/namespaces/ordering/transfer_orders.js | 2 +- .../ordering/transfer_orders/transfers/cancellation.js | 6 +++--- .../shopping/availability/flight_availabilities.js | 2 +- src/amadeus/namespaces/shopping/flight_offers/upselling.js | 2 +- src/amadeus/namespaces/shopping/flight_offers_search.js | 6 +++--- src/amadeus/namespaces/shopping/seatmaps.js | 6 +++--- src/amadeus/namespaces/shopping/transfer_offers.js | 2 +- src/amadeus/namespaces/travel/trip_parser.js | 2 +- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/amadeus/namespaces/booking/flight_orders.js b/src/amadeus/namespaces/booking/flight_orders.js index 94554f1..e8d564d 100644 --- a/src/amadeus/namespaces/booking/flight_orders.js +++ b/src/amadeus/namespaces/booking/flight_orders.js @@ -33,7 +33,7 @@ class FlightOrders { * ``` */ post(params = {}) { - return this.client.post('/v1/booking/flight-orders', params); + return this.client.post('/v1/booking/flight-orders', JSON.stringify(params)); } } diff --git a/src/amadeus/namespaces/ordering/transfer_orders.js b/src/amadeus/namespaces/ordering/transfer_orders.js index ff4871f..61c0d84 100644 --- a/src/amadeus/namespaces/ordering/transfer_orders.js +++ b/src/amadeus/namespaces/ordering/transfer_orders.js @@ -29,7 +29,7 @@ class TransferOrders { * ``` */ post(body, offerId) { - return this.client.post(`/v1/ordering/transfer-orders?offerId=${offerId}`, body); + return this.client.post(`/v1/ordering/transfer-orders?offerId=${offerId}`, JSON.stringify(body)); } } diff --git a/src/amadeus/namespaces/ordering/transfer_orders/transfers/cancellation.js b/src/amadeus/namespaces/ordering/transfer_orders/transfers/cancellation.js index 99288a9..73c2f8d 100644 --- a/src/amadeus/namespaces/ordering/transfer_orders/transfers/cancellation.js +++ b/src/amadeus/namespaces/ordering/transfer_orders/transfers/cancellation.js @@ -6,7 +6,7 @@ * * ```js * let amadeus = new Amadeus(); - * amadeus.ordering.transferOrder('XXX').transfers.cancellation.post(JSON.stringify({}), 12345);; + * amadeus.ordering.transferOrder('XXX').transfers.cancellation.post({}, '12345');; * ``` * * @param {Client} client @@ -24,12 +24,12 @@ class Cancellation { * To cancel a transfer order with ID 'XXX' and confirmation number '12345' * * ```js - * amadeus.ordering.transferOrder('XXX').transfers.cancellation.post(JSON.stringify({}), 12345);; + * amadeus.ordering.transferOrder('XXX').transfers.cancellation.post({}, '12345');; * ``` */ post(body, confirmNbr) { return this.client.post( - `/v1/ordering/transfer-orders/${this.orderId}/transfers/cancellation?confirmNbr=${confirmNbr}`, body); + `/v1/ordering/transfer-orders/${this.orderId}/transfers/cancellation?confirmNbr=${confirmNbr}`, JSON.stringify(body)); } } diff --git a/src/amadeus/namespaces/shopping/availability/flight_availabilities.js b/src/amadeus/namespaces/shopping/availability/flight_availabilities.js index 8b41300..59e6da5 100644 --- a/src/amadeus/namespaces/shopping/availability/flight_availabilities.js +++ b/src/amadeus/namespaces/shopping/availability/flight_availabilities.js @@ -27,7 +27,7 @@ class FlightAvailabilities { * ``` */ post(params = {}) { - return this.client.post('/v1/shopping/availability/flight-availabilities', params); + return this.client.post('/v1/shopping/availability/flight-availabilities', JSON.stringify(params)); } } diff --git a/src/amadeus/namespaces/shopping/flight_offers/upselling.js b/src/amadeus/namespaces/shopping/flight_offers/upselling.js index 258816b..393f993 100644 --- a/src/amadeus/namespaces/shopping/flight_offers/upselling.js +++ b/src/amadeus/namespaces/shopping/flight_offers/upselling.js @@ -27,7 +27,7 @@ class Upselling { * ``` */ post(params = {}) { - return this.client.post('/v1/shopping/flight-offers/upselling', params); + return this.client.post('/v1/shopping/flight-offers/upselling', JSON.stringify(params)); } } diff --git a/src/amadeus/namespaces/shopping/flight_offers_search.js b/src/amadeus/namespaces/shopping/flight_offers_search.js index d2198d6..5f461f2 100644 --- a/src/amadeus/namespaces/shopping/flight_offers_search.js +++ b/src/amadeus/namespaces/shopping/flight_offers_search.js @@ -52,7 +52,7 @@ class FlightOffersSearch { * To do a customized search with given options. * * ```js - * amadeus.shopping.flightOffersSearch.post (JSON.stringify({ + * amadeus.shopping.flightOffersSearch.post ({ "currencyCode": "USD", "originDestinations": [ { @@ -114,11 +114,11 @@ class FlightOffersSearch { } } } - })) + }) * ``` */ post(params = {}) { - return this.client.post('/v2/shopping/flight-offers', params); + return this.client.post('/v2/shopping/flight-offers',JSON.stringify(params)); } } diff --git a/src/amadeus/namespaces/shopping/seatmaps.js b/src/amadeus/namespaces/shopping/seatmaps.js index 749d180..225a613 100644 --- a/src/amadeus/namespaces/shopping/seatmaps.js +++ b/src/amadeus/namespaces/shopping/seatmaps.js @@ -51,15 +51,15 @@ class Seatmaps { * departureDate: '2020-08-01' * }).then(function(response){ * return amadeus.shopping.flightOffers.seatmaps.post( - * JSON.stringify({ + * { * 'data': response.data - * }) + * } * ); * }); * ``` */ post(params = {}) { - return this.client.post('/v1/shopping/seatmaps', params); + return this.client.post('/v1/shopping/seatmaps', JSON.stringify(params)); } } diff --git a/src/amadeus/namespaces/shopping/transfer_offers.js b/src/amadeus/namespaces/shopping/transfer_offers.js index 951a462..f3d3c55 100644 --- a/src/amadeus/namespaces/shopping/transfer_offers.js +++ b/src/amadeus/namespaces/shopping/transfer_offers.js @@ -31,7 +31,7 @@ class TransferOffers { * ``` */ post(params = {}) { - return this.client.post('/v1/shopping/transfer-offers', params); + return this.client.post('/v1/shopping/transfer-offers', JSON.stringify(params)); } } diff --git a/src/amadeus/namespaces/travel/trip_parser.js b/src/amadeus/namespaces/travel/trip_parser.js index 382a8a1..660cd5b 100644 --- a/src/amadeus/namespaces/travel/trip_parser.js +++ b/src/amadeus/namespaces/travel/trip_parser.js @@ -29,7 +29,7 @@ class TripParser { * ``` */ post(params = {}) { - return this.client.post('/v3/travel/trip-parser', params); + return this.client.post('/v3/travel/trip-parser', JSON.stringify(params)); } /** * Helper method to convert file contents in UTF-8 encoded string