-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #195 from amadeus4dev/transfer
Add Cars & Transfers APIs
- Loading branch information
Showing
12 changed files
with
235 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import TransferOrders from './ordering/transfer_orders'; | ||
import TransferOrder from './ordering/transfer_order'; | ||
|
||
/** | ||
* A namespaced client for the | ||
* `/v1/ordering` endpoints | ||
* | ||
* Access via the {@link Amadeus} object | ||
* | ||
* ```js | ||
* let amadeus = new Amadeus(); | ||
* amadeus.ordering; | ||
* ``` | ||
* | ||
* @param {Client} client | ||
* @property {TransferOrders} transferOrders | ||
* @property {TransferOrder} transferOrder | ||
*/ | ||
class Ordering { | ||
constructor(client) { | ||
this.client = client; | ||
this.transferOrders = new TransferOrders(client); | ||
this.transferOrder = (orderId) => new TransferOrder(client, orderId); | ||
} | ||
} | ||
|
||
export default Ordering; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import Transfers from './transfer_orders/transfers'; | ||
|
||
/** | ||
* A namespaced client for the | ||
* `/v1/ordering/transfer-orders/XXXXX` endpoints | ||
* | ||
* Access via the {@link Amadeus} object | ||
* | ||
* ```js | ||
* let amadeus = new Amadeus(); | ||
* amadeus.ordering.transferOrder('XXX'); | ||
* ``` | ||
* | ||
* @param {Client} client | ||
* @param {string} orderId | ||
*/ | ||
class TransferOrder { | ||
constructor(client, orderId) { | ||
this.client = client; | ||
this.orderId = orderId; | ||
this.transfers = new Transfers(client, orderId); | ||
} | ||
} | ||
|
||
export default TransferOrder; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* A namespaced client for the | ||
* `/v1/ordering/transfer-orders` endpoints | ||
* | ||
* Access via the {@link Amadeus} object | ||
* | ||
* ```js | ||
* let amadeus = new Amadeus(); | ||
* amadeus.ordering.transferOrders; | ||
* ``` | ||
* | ||
* @param {Client} client | ||
*/ | ||
class TransferOrders { | ||
constructor(client) { | ||
this.client = client; | ||
|
||
} | ||
|
||
/** | ||
* To book the selected transfer-offer and create a transfer-order | ||
* | ||
* @return {Promise.<Response,ResponseError>} a Promise | ||
* | ||
* To book the transfer-offer(s) suggested by transferOffers and create a transfer-order | ||
* | ||
* ```js | ||
* amadeus.ordering.transferOrders.post(body, '2094123123');; | ||
* ``` | ||
*/ | ||
post(body, offerId) { | ||
return this.client.post(`/v1/ordering/transfer-orders?offerId=${offerId}`, body); | ||
} | ||
} | ||
|
||
export default TransferOrders; |
24 changes: 24 additions & 0 deletions
24
src/amadeus/namespaces/ordering/transfer_orders/transfers.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import Cancellation from './transfers/cancellation'; | ||
|
||
/** | ||
* A namespaced client for the | ||
* `/v1/ordering/transfer-orders/XXXXX/transfers` endpoints | ||
* | ||
* Access via the {@link Amadeus} object | ||
* | ||
* ```js | ||
* let amadeus = new Amadeus(); | ||
* amadeus.ordering.transferOrders('XXX').transfers; | ||
* ``` | ||
* | ||
* @param {Client} client | ||
*/ | ||
class Transfers { | ||
constructor(client, orderId) { | ||
this.client = client; | ||
this.orderId = orderId; | ||
this.cancellation = new Cancellation(client, orderId); | ||
} | ||
} | ||
|
||
export default Transfers; |
36 changes: 36 additions & 0 deletions
36
src/amadeus/namespaces/ordering/transfer_orders/transfers/cancellation.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* A namespaced client for the | ||
* `/v1/ordering/transfer-orders/XXX/transfers/cancellation` endpoints | ||
* | ||
* Access via the {@link Amadeus} object | ||
* | ||
* ```js | ||
* let amadeus = new Amadeus(); | ||
* amadeus.ordering.transferOrder('XXX').transfers.cancellation.post(JSON.stringify({}), 12345);; | ||
* ``` | ||
* | ||
* @param {Client} client | ||
*/ | ||
class Cancellation { | ||
constructor(client, orderId) { | ||
this.client = client; | ||
this.orderId = orderId; | ||
} | ||
|
||
/** | ||
* To cancel a transfer order based on its id | ||
* @return {Promise.<Response,ResponseError>} a Promise | ||
* | ||
* To cancel a transfer order with ID 'XXX' and confirmation number '12345' | ||
* | ||
* ```js | ||
* amadeus.ordering.transferOrder('XXX').transfers.cancellation.post(JSON.stringify({}), 12345);; | ||
* ``` | ||
*/ | ||
post(body, confirmNbr) { | ||
return this.client.post( | ||
`/v1/ordering/transfer-orders/${this.orderId}/transfers/cancellation?confirmNbr=${confirmNbr}`, body); | ||
} | ||
} | ||
|
||
export default Cancellation; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
|
||
/** | ||
* A namespaced client for the | ||
* `/v1/shopping/transfer-offers` endpoints | ||
* | ||
* Access via the {@link Amadeus} object | ||
* | ||
* ```js | ||
* let amadeus = new Amadeus(); | ||
* amadeus.shopping.transferOffers; | ||
* ``` | ||
* | ||
* @param {Client} client | ||
*/ | ||
class TransferOffers { | ||
constructor(client) { | ||
this.client = client; | ||
} | ||
|
||
/** | ||
* To search the list of transfer offers. | ||
* | ||
* @param {Object} params | ||
* @return {Promise.<Response,ResponseError>} a Promise | ||
* | ||
* To search the list of transfer offers | ||
* | ||
* ```js | ||
* amadeus.shopping.transferOffers.post(body) | ||
* ``` | ||
*/ | ||
post(params = {}) { | ||
return this.client.post('/v1/shopping/transfer-offers', params); | ||
} | ||
} | ||
|
||
export default TransferOffers; |