@amazon-sp-api-release/amazon-sp-api-sdk-js 1.0.0-rc7 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +104 -0
- package/helper/DefaultRateLimitFetcher.mjs +2 -35
- package/helper/DefaultRateLimitMap.mjs +266 -0
- package/helper/SuperagentRateLimiter.mjs +26 -14
- package/package.json +1 -1
- package/sample-node-app/index.js +27 -13
- package/src/apluscontent_v2020_11_01/ApiClient.js +48 -38
- package/src/apluscontent_v2020_11_01/api/AplusContentApi.js +50 -11
- package/src/appintegrations_v2024_04_01/ApiClient.js +48 -38
- package/src/appintegrations_v2024_04_01/api/AppIntegrationsApi.js +36 -4
- package/src/applications_v2023_11_30/ApiClient.js +48 -38
- package/src/applications_v2023_11_30/api/ApplicationsApi.js +32 -2
- package/src/awd_v2024_05_09/ApiClient.js +48 -38
- package/src/awd_v2024_05_09/api/AwdApi.js +52 -12
- package/src/catalogitems_v2022_04_01/ApiClient.js +48 -38
- package/src/catalogitems_v2022_04_01/api/CatalogApi.js +34 -3
- package/src/datakiosk_v2023_11_15/ApiClient.js +48 -38
- package/src/datakiosk_v2023_11_15/api/QueriesApi.js +40 -6
- package/src/easyship_v2022_03_23/ApiClient.js +48 -38
- package/src/easyship_v2022_03_23/api/EasyShipApi.js +40 -6
- package/src/fbaeligibility_v1/ApiClient.js +48 -38
- package/src/fbaeligibility_v1/api/FbaInboundApi.js +32 -2
- package/src/fbainventory_v1/ApiClient.js +48 -38
- package/src/fbainventory_v1/api/FbaInventoryApi.js +38 -5
- package/src/feeds_v2021_06_30/ApiClient.js +48 -38
- package/src/feeds_v2021_06_30/api/FeedsApi.js +42 -7
- package/src/finances_2024_06_19/ApiClient.js +48 -38
- package/src/finances_2024_06_19/api/DefaultApi.js +32 -2
- package/src/finances_v0/ApiClient.js +48 -38
- package/src/finances_v0/api/DefaultApi.js +38 -5
- package/src/fulfillmentinbound_v0/ApiClient.js +48 -38
- package/src/fulfillmentinbound_v0/api/FbaInboundApi.js +42 -7
- package/src/fulfillmentinbound_v2024_03_20/ApiClient.js +48 -38
- package/src/fulfillmentinbound_v2024_03_20/api/FbaInboundApi.js +120 -46
- package/src/fulfillmentoutbound_v2020_07_01/ApiClient.js +48 -38
- package/src/fulfillmentoutbound_v2020_07_01/api/FbaOutboundApi.js +58 -15
- package/src/invoices_v2024_06_19/ApiClient.js +48 -38
- package/src/invoices_v2024_06_19/api/InvoicesApi.js +44 -8
- package/src/invoicing_v0/ApiClient.js +48 -38
- package/src/invoicing_v0/api/ShipmentInvoiceApi.js +36 -4
- package/src/listingsitems_v2021_08_01/ApiClient.js +48 -38
- package/src/listingsitems_v2021_08_01/api/ListingsApi.js +40 -6
- package/src/listingsrestrictions_v2021_08_01/ApiClient.js +48 -38
- package/src/listingsrestrictions_v2021_08_01/api/ListingsApi.js +32 -2
- package/src/merchantfulfillment_v0/ApiClient.js +48 -38
- package/src/merchantfulfillment_v0/api/MerchantFulfillmentApi.js +40 -6
- package/src/messaging_v1/ApiClient.js +48 -38
- package/src/messaging_v1/api/MessagingApi.js +56 -14
- package/src/notifications_v1/ApiClient.js +48 -38
- package/src/notifications_v1/api/NotificationsApi.js +46 -9
- package/src/orders_v0/ApiClient.js +48 -38
- package/src/orders_v0/api/OrdersV0Api.js +48 -10
- package/src/orders_v0/api/ShipmentApi.js +32 -2
- package/src/pricing_v0/ApiClient.js +48 -38
- package/src/pricing_v0/api/ProductPricingApi.js +42 -7
- package/src/pricing_v2022_05_01/ApiClient.js +48 -38
- package/src/pricing_v2022_05_01/api/ProductPricingApi.js +34 -3
- package/src/productfees_v0/ApiClient.js +48 -38
- package/src/productfees_v0/api/FeesApi.js +36 -4
- package/src/producttypedefinitions_v2020_09_01/ApiClient.js +48 -38
- package/src/producttypedefinitions_v2020_09_01/api/DefinitionsApi.js +34 -3
- package/src/replenishment_v2022_11_07/ApiClient.js +48 -38
- package/src/replenishment_v2022_11_07/api/OffersApi.js +34 -3
- package/src/replenishment_v2022_11_07/api/SellingpartnersApi.js +32 -2
- package/src/reports_v2021_06_30/ApiClient.js +48 -38
- package/src/reports_v2021_06_30/api/ReportsApi.js +48 -10
- package/src/sales_v1/ApiClient.js +48 -38
- package/src/sales_v1/api/SalesApi.js +32 -2
- package/src/sellers_v1/ApiClient.js +48 -38
- package/src/sellers_v1/api/SellersApi.js +34 -3
- package/src/services_v1/ApiClient.js +48 -38
- package/src/services_v1/api/ServiceApi.js +64 -18
- package/src/shipping_v2/ApiClient.js +48 -38
- package/src/shipping_v2/api/ShippingApi.js +70 -21
- package/src/solicitations_v1/ApiClient.js +48 -38
- package/src/solicitations_v1/api/SolicitationsApi.js +34 -3
- package/src/supplysources_v2020_07_01/ApiClient.js +48 -38
- package/src/supplysources_v2020_07_01/api/SupplySourcesApi.js +42 -7
- package/src/tokens_v2021_03_01/ApiClient.js +48 -38
- package/src/tokens_v2021_03_01/api/TokensApi.js +32 -2
- package/src/transfers_v2024_06_01/ApiClient.js +48 -38
- package/src/transfers_v2024_06_01/api/DefaultApi.js +34 -3
- package/src/uploads_v2020_11_01/ApiClient.js +48 -38
- package/src/uploads_v2020_11_01/api/UploadsApi.js +32 -2
- package/src/vehicles_v2024_11_01/ApiClient.js +48 -38
- package/src/vehicles_v2024_11_01/api/AutomotiveApi.js +32 -2
- package/src/vehicles_v2024_11_01/api/VehiclesApi.js +32 -2
- package/src/vendordfinventory_v1/ApiClient.js +48 -38
- package/src/vendordfinventory_v1/api/UpdateInventoryApi.js +32 -2
- package/src/vendordforders_v2021_12_28/ApiClient.js +48 -38
- package/src/vendordforders_v2021_12_28/api/VendorOrdersApi.js +36 -4
- package/src/vendordfpayments_v1/ApiClient.js +48 -38
- package/src/vendordfpayments_v1/api/VendorInvoiceApi.js +32 -2
- package/src/vendordfshipping_v2021_12_28/ApiClient.js +48 -38
- package/src/vendordfshipping_v2021_12_28/api/CreateContainerLabelApi.js +32 -2
- package/src/vendordfshipping_v2021_12_28/api/CustomerInvoicesApi.js +34 -3
- package/src/vendordfshipping_v2021_12_28/api/VendorShippingApi.js +38 -5
- package/src/vendordfshipping_v2021_12_28/api/VendorShippingLabelsApi.js +38 -5
- package/src/vendordftransactions_v2021_12_28/ApiClient.js +48 -38
- package/src/vendordftransactions_v2021_12_28/api/VendorTransactionApi.js +32 -2
- package/src/vendorinvoices_v1/ApiClient.js +48 -38
- package/src/vendorinvoices_v1/api/VendorPaymentsApi.js +32 -2
- package/src/vendororders_v1/ApiClient.js +48 -38
- package/src/vendororders_v1/api/VendorOrdersApi.js +38 -5
- package/src/vendorshipments_v1/ApiClient.js +48 -38
- package/src/vendorshipments_v1/api/VendorShippingApi.js +38 -5
- package/src/vendortransactionstatus_v1/ApiClient.js +48 -38
- package/src/vendortransactionstatus_v1/api/VendorTransactionApi.js +32 -2
- package/helper/rate-limits.yml +0 -874
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
import {ApiClient} from
|
|
14
|
+
import {ApiClient} from '../ApiClient.js';
|
|
15
15
|
import {CancelInboundPlanResponse} from '../model/CancelInboundPlanResponse.js';
|
|
16
16
|
import {CancelSelfShipAppointmentRequest} from '../model/CancelSelfShipAppointmentRequest.js';
|
|
17
17
|
import {CancelSelfShipAppointmentResponse} from '../model/CancelSelfShipAppointmentResponse.js';
|
|
@@ -72,6 +72,8 @@ import {UpdateShipmentSourceAddressRequest} from '../model/UpdateShipmentSourceA
|
|
|
72
72
|
import {UpdateShipmentSourceAddressResponse} from '../model/UpdateShipmentSourceAddressResponse.js';
|
|
73
73
|
import {UpdateShipmentTrackingDetailsRequest} from '../model/UpdateShipmentTrackingDetailsRequest.js';
|
|
74
74
|
import {UpdateShipmentTrackingDetailsResponse} from '../model/UpdateShipmentTrackingDetailsResponse.js';
|
|
75
|
+
import {SuperagentRateLimiter} from '../../../helper/SuperagentRateLimiter.mjs';
|
|
76
|
+
import {DefaultRateLimitFetcher} from '../../../helper/DefaultRateLimitFetcher.mjs';
|
|
75
77
|
|
|
76
78
|
/**
|
|
77
79
|
* FbaInbound service.
|
|
@@ -80,6 +82,9 @@ import {UpdateShipmentTrackingDetailsResponse} from '../model/UpdateShipmentTrac
|
|
|
80
82
|
*/
|
|
81
83
|
export class FbaInboundApi {
|
|
82
84
|
|
|
85
|
+
// Private memeber stores the default rate limiters
|
|
86
|
+
#defaultRateLimiterMap;
|
|
87
|
+
|
|
83
88
|
/**
|
|
84
89
|
* Constructs a new FbaInboundApi.
|
|
85
90
|
* @alias module:fulfillmentinbound_v2024_03_20/api/FbaInboundApi
|
|
@@ -89,6 +94,75 @@ export class FbaInboundApi {
|
|
|
89
94
|
*/
|
|
90
95
|
constructor(apiClient) {
|
|
91
96
|
this.apiClient = apiClient || ApiClient.instance;
|
|
97
|
+
this.initializeDefaultRateLimiterMap();
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Initialize rate limiters for API operations
|
|
102
|
+
*/
|
|
103
|
+
initializeDefaultRateLimiterMap() {
|
|
104
|
+
this.#defaultRateLimiterMap = new Map()
|
|
105
|
+
const defaultRateLimitFetcher = new DefaultRateLimitFetcher();
|
|
106
|
+
const operations = [
|
|
107
|
+
'FbaInboundApi-cancelInboundPlan',
|
|
108
|
+
'FbaInboundApi-cancelSelfShipAppointment',
|
|
109
|
+
'FbaInboundApi-confirmDeliveryWindowOptions',
|
|
110
|
+
'FbaInboundApi-confirmPackingOption',
|
|
111
|
+
'FbaInboundApi-confirmPlacementOption',
|
|
112
|
+
'FbaInboundApi-confirmShipmentContentUpdatePreview',
|
|
113
|
+
'FbaInboundApi-confirmTransportationOptions',
|
|
114
|
+
'FbaInboundApi-createInboundPlan',
|
|
115
|
+
'FbaInboundApi-createMarketplaceItemLabels',
|
|
116
|
+
'FbaInboundApi-generateDeliveryWindowOptions',
|
|
117
|
+
'FbaInboundApi-generatePackingOptions',
|
|
118
|
+
'FbaInboundApi-generatePlacementOptions',
|
|
119
|
+
'FbaInboundApi-generateSelfShipAppointmentSlots',
|
|
120
|
+
'FbaInboundApi-generateShipmentContentUpdatePreviews',
|
|
121
|
+
'FbaInboundApi-generateTransportationOptions',
|
|
122
|
+
'FbaInboundApi-getDeliveryChallanDocument',
|
|
123
|
+
'FbaInboundApi-getInboundOperationStatus',
|
|
124
|
+
'FbaInboundApi-getInboundPlan',
|
|
125
|
+
'FbaInboundApi-getSelfShipAppointmentSlots',
|
|
126
|
+
'FbaInboundApi-getShipment',
|
|
127
|
+
'FbaInboundApi-getShipmentContentUpdatePreview',
|
|
128
|
+
'FbaInboundApi-listDeliveryWindowOptions',
|
|
129
|
+
'FbaInboundApi-listInboundPlanBoxes',
|
|
130
|
+
'FbaInboundApi-listInboundPlanItems',
|
|
131
|
+
'FbaInboundApi-listInboundPlanPallets',
|
|
132
|
+
'FbaInboundApi-listInboundPlans',
|
|
133
|
+
'FbaInboundApi-listItemComplianceDetails',
|
|
134
|
+
'FbaInboundApi-listPackingGroupBoxes',
|
|
135
|
+
'FbaInboundApi-listPackingGroupItems',
|
|
136
|
+
'FbaInboundApi-listPackingOptions',
|
|
137
|
+
'FbaInboundApi-listPlacementOptions',
|
|
138
|
+
'FbaInboundApi-listPrepDetails',
|
|
139
|
+
'FbaInboundApi-listShipmentBoxes',
|
|
140
|
+
'FbaInboundApi-listShipmentContentUpdatePreviews',
|
|
141
|
+
'FbaInboundApi-listShipmentItems',
|
|
142
|
+
'FbaInboundApi-listShipmentPallets',
|
|
143
|
+
'FbaInboundApi-listTransportationOptions',
|
|
144
|
+
'FbaInboundApi-scheduleSelfShipAppointment',
|
|
145
|
+
'FbaInboundApi-setPackingInformation',
|
|
146
|
+
'FbaInboundApi-setPrepDetails',
|
|
147
|
+
'FbaInboundApi-updateInboundPlanName',
|
|
148
|
+
'FbaInboundApi-updateItemComplianceDetails',
|
|
149
|
+
'FbaInboundApi-updateShipmentName',
|
|
150
|
+
'FbaInboundApi-updateShipmentSourceAddress',
|
|
151
|
+
'FbaInboundApi-updateShipmentTrackingDetails',
|
|
152
|
+
];
|
|
153
|
+
|
|
154
|
+
for (const operation of operations) {
|
|
155
|
+
const config = defaultRateLimitFetcher.getLimit(operation);
|
|
156
|
+
this.#defaultRateLimiterMap.set(operation, new SuperagentRateLimiter(config));
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Get rate limiter for a specific operation
|
|
162
|
+
* @param {String} operation name
|
|
163
|
+
*/
|
|
164
|
+
getRateLimiter(operation) {
|
|
165
|
+
return this.#defaultRateLimiterMap.get(operation);
|
|
92
166
|
}
|
|
93
167
|
|
|
94
168
|
|
|
@@ -124,7 +198,7 @@ export class FbaInboundApi {
|
|
|
124
198
|
return this.apiClient.callApi( 'FbaInboundApi-cancelInboundPlan',
|
|
125
199
|
'/inbound/fba/2024-03-20/inboundPlans/{inboundPlanId}/cancellation', 'PUT',
|
|
126
200
|
pathParams, queryParams, headerParams, formParams, postBody,
|
|
127
|
-
contentTypes, accepts, returnType
|
|
201
|
+
contentTypes, accepts, returnType, this.getRateLimiter('FbaInboundApi-cancelInboundPlan')
|
|
128
202
|
);
|
|
129
203
|
}
|
|
130
204
|
|
|
@@ -185,7 +259,7 @@ export class FbaInboundApi {
|
|
|
185
259
|
return this.apiClient.callApi( 'FbaInboundApi-cancelSelfShipAppointment',
|
|
186
260
|
'/inbound/fba/2024-03-20/inboundPlans/{inboundPlanId}/shipments/{shipmentId}/selfShipAppointmentCancellation', 'PUT',
|
|
187
261
|
pathParams, queryParams, headerParams, formParams, postBody,
|
|
188
|
-
contentTypes, accepts, returnType
|
|
262
|
+
contentTypes, accepts, returnType, this.getRateLimiter('FbaInboundApi-cancelSelfShipAppointment')
|
|
189
263
|
);
|
|
190
264
|
}
|
|
191
265
|
|
|
@@ -249,7 +323,7 @@ export class FbaInboundApi {
|
|
|
249
323
|
return this.apiClient.callApi( 'FbaInboundApi-confirmDeliveryWindowOptions',
|
|
250
324
|
'/inbound/fba/2024-03-20/inboundPlans/{inboundPlanId}/shipments/{shipmentId}/deliveryWindowOptions/{deliveryWindowOptionId}/confirmation', 'POST',
|
|
251
325
|
pathParams, queryParams, headerParams, formParams, postBody,
|
|
252
|
-
contentTypes, accepts, returnType
|
|
326
|
+
contentTypes, accepts, returnType, this.getRateLimiter('FbaInboundApi-confirmDeliveryWindowOptions')
|
|
253
327
|
);
|
|
254
328
|
}
|
|
255
329
|
|
|
@@ -306,7 +380,7 @@ export class FbaInboundApi {
|
|
|
306
380
|
return this.apiClient.callApi( 'FbaInboundApi-confirmPackingOption',
|
|
307
381
|
'/inbound/fba/2024-03-20/inboundPlans/{inboundPlanId}/packingOptions/{packingOptionId}/confirmation', 'POST',
|
|
308
382
|
pathParams, queryParams, headerParams, formParams, postBody,
|
|
309
|
-
contentTypes, accepts, returnType
|
|
383
|
+
contentTypes, accepts, returnType, this.getRateLimiter('FbaInboundApi-confirmPackingOption')
|
|
310
384
|
);
|
|
311
385
|
}
|
|
312
386
|
|
|
@@ -362,7 +436,7 @@ export class FbaInboundApi {
|
|
|
362
436
|
return this.apiClient.callApi( 'FbaInboundApi-confirmPlacementOption',
|
|
363
437
|
'/inbound/fba/2024-03-20/inboundPlans/{inboundPlanId}/placementOptions/{placementOptionId}/confirmation', 'POST',
|
|
364
438
|
pathParams, queryParams, headerParams, formParams, postBody,
|
|
365
|
-
contentTypes, accepts, returnType
|
|
439
|
+
contentTypes, accepts, returnType, this.getRateLimiter('FbaInboundApi-confirmPlacementOption')
|
|
366
440
|
);
|
|
367
441
|
}
|
|
368
442
|
|
|
@@ -425,7 +499,7 @@ export class FbaInboundApi {
|
|
|
425
499
|
return this.apiClient.callApi( 'FbaInboundApi-confirmShipmentContentUpdatePreview',
|
|
426
500
|
'/inbound/fba/2024-03-20/inboundPlans/{inboundPlanId}/shipments/{shipmentId}/contentUpdatePreviews/{contentUpdatePreviewId}/confirmation', 'POST',
|
|
427
501
|
pathParams, queryParams, headerParams, formParams, postBody,
|
|
428
|
-
contentTypes, accepts, returnType
|
|
502
|
+
contentTypes, accepts, returnType, this.getRateLimiter('FbaInboundApi-confirmShipmentContentUpdatePreview')
|
|
429
503
|
);
|
|
430
504
|
}
|
|
431
505
|
|
|
@@ -481,7 +555,7 @@ export class FbaInboundApi {
|
|
|
481
555
|
return this.apiClient.callApi( 'FbaInboundApi-confirmTransportationOptions',
|
|
482
556
|
'/inbound/fba/2024-03-20/inboundPlans/{inboundPlanId}/transportationOptions/confirmation', 'POST',
|
|
483
557
|
pathParams, queryParams, headerParams, formParams, postBody,
|
|
484
|
-
contentTypes, accepts, returnType
|
|
558
|
+
contentTypes, accepts, returnType, this.getRateLimiter('FbaInboundApi-confirmTransportationOptions')
|
|
485
559
|
);
|
|
486
560
|
}
|
|
487
561
|
|
|
@@ -529,7 +603,7 @@ export class FbaInboundApi {
|
|
|
529
603
|
return this.apiClient.callApi( 'FbaInboundApi-createInboundPlan',
|
|
530
604
|
'/inbound/fba/2024-03-20/inboundPlans', 'POST',
|
|
531
605
|
pathParams, queryParams, headerParams, formParams, postBody,
|
|
532
|
-
contentTypes, accepts, returnType
|
|
606
|
+
contentTypes, accepts, returnType, this.getRateLimiter('FbaInboundApi-createInboundPlan')
|
|
533
607
|
);
|
|
534
608
|
}
|
|
535
609
|
|
|
@@ -576,7 +650,7 @@ export class FbaInboundApi {
|
|
|
576
650
|
return this.apiClient.callApi( 'FbaInboundApi-createMarketplaceItemLabels',
|
|
577
651
|
'/inbound/fba/2024-03-20/items/labels', 'POST',
|
|
578
652
|
pathParams, queryParams, headerParams, formParams, postBody,
|
|
579
|
-
contentTypes, accepts, returnType
|
|
653
|
+
contentTypes, accepts, returnType, this.getRateLimiter('FbaInboundApi-createMarketplaceItemLabels')
|
|
580
654
|
);
|
|
581
655
|
}
|
|
582
656
|
|
|
@@ -631,7 +705,7 @@ export class FbaInboundApi {
|
|
|
631
705
|
return this.apiClient.callApi( 'FbaInboundApi-generateDeliveryWindowOptions',
|
|
632
706
|
'/inbound/fba/2024-03-20/inboundPlans/{inboundPlanId}/shipments/{shipmentId}/deliveryWindowOptions', 'POST',
|
|
633
707
|
pathParams, queryParams, headerParams, formParams, postBody,
|
|
634
|
-
contentTypes, accepts, returnType
|
|
708
|
+
contentTypes, accepts, returnType, this.getRateLimiter('FbaInboundApi-generateDeliveryWindowOptions')
|
|
635
709
|
);
|
|
636
710
|
}
|
|
637
711
|
|
|
@@ -680,7 +754,7 @@ export class FbaInboundApi {
|
|
|
680
754
|
return this.apiClient.callApi( 'FbaInboundApi-generatePackingOptions',
|
|
681
755
|
'/inbound/fba/2024-03-20/inboundPlans/{inboundPlanId}/packingOptions', 'POST',
|
|
682
756
|
pathParams, queryParams, headerParams, formParams, postBody,
|
|
683
|
-
contentTypes, accepts, returnType
|
|
757
|
+
contentTypes, accepts, returnType, this.getRateLimiter('FbaInboundApi-generatePackingOptions')
|
|
684
758
|
);
|
|
685
759
|
}
|
|
686
760
|
|
|
@@ -734,7 +808,7 @@ export class FbaInboundApi {
|
|
|
734
808
|
return this.apiClient.callApi( 'FbaInboundApi-generatePlacementOptions',
|
|
735
809
|
'/inbound/fba/2024-03-20/inboundPlans/{inboundPlanId}/placementOptions', 'POST',
|
|
736
810
|
pathParams, queryParams, headerParams, formParams, postBody,
|
|
737
|
-
contentTypes, accepts, returnType
|
|
811
|
+
contentTypes, accepts, returnType, this.getRateLimiter('FbaInboundApi-generatePlacementOptions')
|
|
738
812
|
);
|
|
739
813
|
}
|
|
740
814
|
|
|
@@ -796,7 +870,7 @@ export class FbaInboundApi {
|
|
|
796
870
|
return this.apiClient.callApi( 'FbaInboundApi-generateSelfShipAppointmentSlots',
|
|
797
871
|
'/inbound/fba/2024-03-20/inboundPlans/{inboundPlanId}/shipments/{shipmentId}/selfShipAppointmentSlots', 'POST',
|
|
798
872
|
pathParams, queryParams, headerParams, formParams, postBody,
|
|
799
|
-
contentTypes, accepts, returnType
|
|
873
|
+
contentTypes, accepts, returnType, this.getRateLimiter('FbaInboundApi-generateSelfShipAppointmentSlots')
|
|
800
874
|
);
|
|
801
875
|
}
|
|
802
876
|
|
|
@@ -859,7 +933,7 @@ export class FbaInboundApi {
|
|
|
859
933
|
return this.apiClient.callApi( 'FbaInboundApi-generateShipmentContentUpdatePreviews',
|
|
860
934
|
'/inbound/fba/2024-03-20/inboundPlans/{inboundPlanId}/shipments/{shipmentId}/contentUpdatePreviews', 'POST',
|
|
861
935
|
pathParams, queryParams, headerParams, formParams, postBody,
|
|
862
|
-
contentTypes, accepts, returnType
|
|
936
|
+
contentTypes, accepts, returnType, this.getRateLimiter('FbaInboundApi-generateShipmentContentUpdatePreviews')
|
|
863
937
|
);
|
|
864
938
|
}
|
|
865
939
|
|
|
@@ -915,7 +989,7 @@ export class FbaInboundApi {
|
|
|
915
989
|
return this.apiClient.callApi( 'FbaInboundApi-generateTransportationOptions',
|
|
916
990
|
'/inbound/fba/2024-03-20/inboundPlans/{inboundPlanId}/transportationOptions', 'POST',
|
|
917
991
|
pathParams, queryParams, headerParams, formParams, postBody,
|
|
918
|
-
contentTypes, accepts, returnType
|
|
992
|
+
contentTypes, accepts, returnType, this.getRateLimiter('FbaInboundApi-generateTransportationOptions')
|
|
919
993
|
);
|
|
920
994
|
}
|
|
921
995
|
|
|
@@ -971,7 +1045,7 @@ export class FbaInboundApi {
|
|
|
971
1045
|
return this.apiClient.callApi( 'FbaInboundApi-getDeliveryChallanDocument',
|
|
972
1046
|
'/inbound/fba/2024-03-20/inboundPlans/{inboundPlanId}/shipments/{shipmentId}/deliveryChallanDocument', 'GET',
|
|
973
1047
|
pathParams, queryParams, headerParams, formParams, postBody,
|
|
974
|
-
contentTypes, accepts, returnType
|
|
1048
|
+
contentTypes, accepts, returnType, this.getRateLimiter('FbaInboundApi-getDeliveryChallanDocument')
|
|
975
1049
|
);
|
|
976
1050
|
}
|
|
977
1051
|
|
|
@@ -1020,7 +1094,7 @@ export class FbaInboundApi {
|
|
|
1020
1094
|
return this.apiClient.callApi( 'FbaInboundApi-getInboundOperationStatus',
|
|
1021
1095
|
'/inbound/fba/2024-03-20/operations/{operationId}', 'GET',
|
|
1022
1096
|
pathParams, queryParams, headerParams, formParams, postBody,
|
|
1023
|
-
contentTypes, accepts, returnType
|
|
1097
|
+
contentTypes, accepts, returnType, this.getRateLimiter('FbaInboundApi-getInboundOperationStatus')
|
|
1024
1098
|
);
|
|
1025
1099
|
}
|
|
1026
1100
|
|
|
@@ -1068,7 +1142,7 @@ export class FbaInboundApi {
|
|
|
1068
1142
|
return this.apiClient.callApi( 'FbaInboundApi-getInboundPlan',
|
|
1069
1143
|
'/inbound/fba/2024-03-20/inboundPlans/{inboundPlanId}', 'GET',
|
|
1070
1144
|
pathParams, queryParams, headerParams, formParams, postBody,
|
|
1071
|
-
contentTypes, accepts, returnType
|
|
1145
|
+
contentTypes, accepts, returnType, this.getRateLimiter('FbaInboundApi-getInboundPlan')
|
|
1072
1146
|
);
|
|
1073
1147
|
}
|
|
1074
1148
|
|
|
@@ -1129,7 +1203,7 @@ export class FbaInboundApi {
|
|
|
1129
1203
|
return this.apiClient.callApi( 'FbaInboundApi-getSelfShipAppointmentSlots',
|
|
1130
1204
|
'/inbound/fba/2024-03-20/inboundPlans/{inboundPlanId}/shipments/{shipmentId}/selfShipAppointmentSlots', 'GET',
|
|
1131
1205
|
pathParams, queryParams, headerParams, formParams, postBody,
|
|
1132
|
-
contentTypes, accepts, returnType
|
|
1206
|
+
contentTypes, accepts, returnType, this.getRateLimiter('FbaInboundApi-getSelfShipAppointmentSlots')
|
|
1133
1207
|
);
|
|
1134
1208
|
}
|
|
1135
1209
|
|
|
@@ -1188,7 +1262,7 @@ export class FbaInboundApi {
|
|
|
1188
1262
|
return this.apiClient.callApi( 'FbaInboundApi-getShipment',
|
|
1189
1263
|
'/inbound/fba/2024-03-20/inboundPlans/{inboundPlanId}/shipments/{shipmentId}', 'GET',
|
|
1190
1264
|
pathParams, queryParams, headerParams, formParams, postBody,
|
|
1191
|
-
contentTypes, accepts, returnType
|
|
1265
|
+
contentTypes, accepts, returnType, this.getRateLimiter('FbaInboundApi-getShipment')
|
|
1192
1266
|
);
|
|
1193
1267
|
}
|
|
1194
1268
|
|
|
@@ -1251,7 +1325,7 @@ export class FbaInboundApi {
|
|
|
1251
1325
|
return this.apiClient.callApi( 'FbaInboundApi-getShipmentContentUpdatePreview',
|
|
1252
1326
|
'/inbound/fba/2024-03-20/inboundPlans/{inboundPlanId}/shipments/{shipmentId}/contentUpdatePreviews/{contentUpdatePreviewId}', 'GET',
|
|
1253
1327
|
pathParams, queryParams, headerParams, formParams, postBody,
|
|
1254
|
-
contentTypes, accepts, returnType
|
|
1328
|
+
contentTypes, accepts, returnType, this.getRateLimiter('FbaInboundApi-getShipmentContentUpdatePreview')
|
|
1255
1329
|
);
|
|
1256
1330
|
}
|
|
1257
1331
|
|
|
@@ -1314,7 +1388,7 @@ export class FbaInboundApi {
|
|
|
1314
1388
|
return this.apiClient.callApi( 'FbaInboundApi-listDeliveryWindowOptions',
|
|
1315
1389
|
'/inbound/fba/2024-03-20/inboundPlans/{inboundPlanId}/shipments/{shipmentId}/deliveryWindowOptions', 'GET',
|
|
1316
1390
|
pathParams, queryParams, headerParams, formParams, postBody,
|
|
1317
|
-
contentTypes, accepts, returnType
|
|
1391
|
+
contentTypes, accepts, returnType, this.getRateLimiter('FbaInboundApi-listDeliveryWindowOptions')
|
|
1318
1392
|
);
|
|
1319
1393
|
}
|
|
1320
1394
|
|
|
@@ -1372,7 +1446,7 @@ export class FbaInboundApi {
|
|
|
1372
1446
|
return this.apiClient.callApi( 'FbaInboundApi-listInboundPlanBoxes',
|
|
1373
1447
|
'/inbound/fba/2024-03-20/inboundPlans/{inboundPlanId}/boxes', 'GET',
|
|
1374
1448
|
pathParams, queryParams, headerParams, formParams, postBody,
|
|
1375
|
-
contentTypes, accepts, returnType
|
|
1449
|
+
contentTypes, accepts, returnType, this.getRateLimiter('FbaInboundApi-listInboundPlanBoxes')
|
|
1376
1450
|
);
|
|
1377
1451
|
}
|
|
1378
1452
|
|
|
@@ -1429,7 +1503,7 @@ export class FbaInboundApi {
|
|
|
1429
1503
|
return this.apiClient.callApi( 'FbaInboundApi-listInboundPlanItems',
|
|
1430
1504
|
'/inbound/fba/2024-03-20/inboundPlans/{inboundPlanId}/items', 'GET',
|
|
1431
1505
|
pathParams, queryParams, headerParams, formParams, postBody,
|
|
1432
|
-
contentTypes, accepts, returnType
|
|
1506
|
+
contentTypes, accepts, returnType, this.getRateLimiter('FbaInboundApi-listInboundPlanItems')
|
|
1433
1507
|
);
|
|
1434
1508
|
}
|
|
1435
1509
|
|
|
@@ -1486,7 +1560,7 @@ export class FbaInboundApi {
|
|
|
1486
1560
|
return this.apiClient.callApi( 'FbaInboundApi-listInboundPlanPallets',
|
|
1487
1561
|
'/inbound/fba/2024-03-20/inboundPlans/{inboundPlanId}/pallets', 'GET',
|
|
1488
1562
|
pathParams, queryParams, headerParams, formParams, postBody,
|
|
1489
|
-
contentTypes, accepts, returnType
|
|
1563
|
+
contentTypes, accepts, returnType, this.getRateLimiter('FbaInboundApi-listInboundPlanPallets')
|
|
1490
1564
|
);
|
|
1491
1565
|
}
|
|
1492
1566
|
|
|
@@ -1542,7 +1616,7 @@ export class FbaInboundApi {
|
|
|
1542
1616
|
return this.apiClient.callApi( 'FbaInboundApi-listInboundPlans',
|
|
1543
1617
|
'/inbound/fba/2024-03-20/inboundPlans', 'GET',
|
|
1544
1618
|
pathParams, queryParams, headerParams, formParams, postBody,
|
|
1545
|
-
contentTypes, accepts, returnType
|
|
1619
|
+
contentTypes, accepts, returnType, this.getRateLimiter('FbaInboundApi-listInboundPlans')
|
|
1546
1620
|
);
|
|
1547
1621
|
}
|
|
1548
1622
|
|
|
@@ -1602,7 +1676,7 @@ export class FbaInboundApi {
|
|
|
1602
1676
|
return this.apiClient.callApi( 'FbaInboundApi-listItemComplianceDetails',
|
|
1603
1677
|
'/inbound/fba/2024-03-20/items/compliance', 'GET',
|
|
1604
1678
|
pathParams, queryParams, headerParams, formParams, postBody,
|
|
1605
|
-
contentTypes, accepts, returnType
|
|
1679
|
+
contentTypes, accepts, returnType, this.getRateLimiter('FbaInboundApi-listItemComplianceDetails')
|
|
1606
1680
|
);
|
|
1607
1681
|
}
|
|
1608
1682
|
|
|
@@ -1664,7 +1738,7 @@ export class FbaInboundApi {
|
|
|
1664
1738
|
return this.apiClient.callApi( 'FbaInboundApi-listPackingGroupBoxes',
|
|
1665
1739
|
'/inbound/fba/2024-03-20/inboundPlans/{inboundPlanId}/packingGroups/{packingGroupId}/boxes', 'GET',
|
|
1666
1740
|
pathParams, queryParams, headerParams, formParams, postBody,
|
|
1667
|
-
contentTypes, accepts, returnType
|
|
1741
|
+
contentTypes, accepts, returnType, this.getRateLimiter('FbaInboundApi-listPackingGroupBoxes')
|
|
1668
1742
|
);
|
|
1669
1743
|
}
|
|
1670
1744
|
|
|
@@ -1729,7 +1803,7 @@ export class FbaInboundApi {
|
|
|
1729
1803
|
return this.apiClient.callApi( 'FbaInboundApi-listPackingGroupItems',
|
|
1730
1804
|
'/inbound/fba/2024-03-20/inboundPlans/{inboundPlanId}/packingGroups/{packingGroupId}/items', 'GET',
|
|
1731
1805
|
pathParams, queryParams, headerParams, formParams, postBody,
|
|
1732
|
-
contentTypes, accepts, returnType
|
|
1806
|
+
contentTypes, accepts, returnType, this.getRateLimiter('FbaInboundApi-listPackingGroupItems')
|
|
1733
1807
|
);
|
|
1734
1808
|
}
|
|
1735
1809
|
|
|
@@ -1787,7 +1861,7 @@ export class FbaInboundApi {
|
|
|
1787
1861
|
return this.apiClient.callApi( 'FbaInboundApi-listPackingOptions',
|
|
1788
1862
|
'/inbound/fba/2024-03-20/inboundPlans/{inboundPlanId}/packingOptions', 'GET',
|
|
1789
1863
|
pathParams, queryParams, headerParams, formParams, postBody,
|
|
1790
|
-
contentTypes, accepts, returnType
|
|
1864
|
+
contentTypes, accepts, returnType, this.getRateLimiter('FbaInboundApi-listPackingOptions')
|
|
1791
1865
|
);
|
|
1792
1866
|
}
|
|
1793
1867
|
|
|
@@ -1844,7 +1918,7 @@ export class FbaInboundApi {
|
|
|
1844
1918
|
return this.apiClient.callApi( 'FbaInboundApi-listPlacementOptions',
|
|
1845
1919
|
'/inbound/fba/2024-03-20/inboundPlans/{inboundPlanId}/placementOptions', 'GET',
|
|
1846
1920
|
pathParams, queryParams, headerParams, formParams, postBody,
|
|
1847
|
-
contentTypes, accepts, returnType
|
|
1921
|
+
contentTypes, accepts, returnType, this.getRateLimiter('FbaInboundApi-listPlacementOptions')
|
|
1848
1922
|
);
|
|
1849
1923
|
}
|
|
1850
1924
|
|
|
@@ -1902,7 +1976,7 @@ export class FbaInboundApi {
|
|
|
1902
1976
|
return this.apiClient.callApi( 'FbaInboundApi-listPrepDetails',
|
|
1903
1977
|
'/inbound/fba/2024-03-20/items/prepDetails', 'GET',
|
|
1904
1978
|
pathParams, queryParams, headerParams, formParams, postBody,
|
|
1905
|
-
contentTypes, accepts, returnType
|
|
1979
|
+
contentTypes, accepts, returnType, this.getRateLimiter('FbaInboundApi-listPrepDetails')
|
|
1906
1980
|
);
|
|
1907
1981
|
}
|
|
1908
1982
|
|
|
@@ -1964,7 +2038,7 @@ export class FbaInboundApi {
|
|
|
1964
2038
|
return this.apiClient.callApi( 'FbaInboundApi-listShipmentBoxes',
|
|
1965
2039
|
'/inbound/fba/2024-03-20/inboundPlans/{inboundPlanId}/shipments/{shipmentId}/boxes', 'GET',
|
|
1966
2040
|
pathParams, queryParams, headerParams, formParams, postBody,
|
|
1967
|
-
contentTypes, accepts, returnType
|
|
2041
|
+
contentTypes, accepts, returnType, this.getRateLimiter('FbaInboundApi-listShipmentBoxes')
|
|
1968
2042
|
);
|
|
1969
2043
|
}
|
|
1970
2044
|
|
|
@@ -2029,7 +2103,7 @@ export class FbaInboundApi {
|
|
|
2029
2103
|
return this.apiClient.callApi( 'FbaInboundApi-listShipmentContentUpdatePreviews',
|
|
2030
2104
|
'/inbound/fba/2024-03-20/inboundPlans/{inboundPlanId}/shipments/{shipmentId}/contentUpdatePreviews', 'GET',
|
|
2031
2105
|
pathParams, queryParams, headerParams, formParams, postBody,
|
|
2032
|
-
contentTypes, accepts, returnType
|
|
2106
|
+
contentTypes, accepts, returnType, this.getRateLimiter('FbaInboundApi-listShipmentContentUpdatePreviews')
|
|
2033
2107
|
);
|
|
2034
2108
|
}
|
|
2035
2109
|
|
|
@@ -2094,7 +2168,7 @@ export class FbaInboundApi {
|
|
|
2094
2168
|
return this.apiClient.callApi( 'FbaInboundApi-listShipmentItems',
|
|
2095
2169
|
'/inbound/fba/2024-03-20/inboundPlans/{inboundPlanId}/shipments/{shipmentId}/items', 'GET',
|
|
2096
2170
|
pathParams, queryParams, headerParams, formParams, postBody,
|
|
2097
|
-
contentTypes, accepts, returnType
|
|
2171
|
+
contentTypes, accepts, returnType, this.getRateLimiter('FbaInboundApi-listShipmentItems')
|
|
2098
2172
|
);
|
|
2099
2173
|
}
|
|
2100
2174
|
|
|
@@ -2159,7 +2233,7 @@ export class FbaInboundApi {
|
|
|
2159
2233
|
return this.apiClient.callApi( 'FbaInboundApi-listShipmentPallets',
|
|
2160
2234
|
'/inbound/fba/2024-03-20/inboundPlans/{inboundPlanId}/shipments/{shipmentId}/pallets', 'GET',
|
|
2161
2235
|
pathParams, queryParams, headerParams, formParams, postBody,
|
|
2162
|
-
contentTypes, accepts, returnType
|
|
2236
|
+
contentTypes, accepts, returnType, this.getRateLimiter('FbaInboundApi-listShipmentPallets')
|
|
2163
2237
|
);
|
|
2164
2238
|
}
|
|
2165
2239
|
|
|
@@ -2221,7 +2295,7 @@ export class FbaInboundApi {
|
|
|
2221
2295
|
return this.apiClient.callApi( 'FbaInboundApi-listTransportationOptions',
|
|
2222
2296
|
'/inbound/fba/2024-03-20/inboundPlans/{inboundPlanId}/transportationOptions', 'GET',
|
|
2223
2297
|
pathParams, queryParams, headerParams, formParams, postBody,
|
|
2224
|
-
contentTypes, accepts, returnType
|
|
2298
|
+
contentTypes, accepts, returnType, this.getRateLimiter('FbaInboundApi-listTransportationOptions')
|
|
2225
2299
|
);
|
|
2226
2300
|
}
|
|
2227
2301
|
|
|
@@ -2294,7 +2368,7 @@ export class FbaInboundApi {
|
|
|
2294
2368
|
return this.apiClient.callApi( 'FbaInboundApi-scheduleSelfShipAppointment',
|
|
2295
2369
|
'/inbound/fba/2024-03-20/inboundPlans/{inboundPlanId}/shipments/{shipmentId}/selfShipAppointmentSlots/{slotId}/schedule', 'POST',
|
|
2296
2370
|
pathParams, queryParams, headerParams, formParams, postBody,
|
|
2297
|
-
contentTypes, accepts, returnType
|
|
2371
|
+
contentTypes, accepts, returnType, this.getRateLimiter('FbaInboundApi-scheduleSelfShipAppointment')
|
|
2298
2372
|
);
|
|
2299
2373
|
}
|
|
2300
2374
|
|
|
@@ -2351,7 +2425,7 @@ export class FbaInboundApi {
|
|
|
2351
2425
|
return this.apiClient.callApi( 'FbaInboundApi-setPackingInformation',
|
|
2352
2426
|
'/inbound/fba/2024-03-20/inboundPlans/{inboundPlanId}/packingInformation', 'POST',
|
|
2353
2427
|
pathParams, queryParams, headerParams, formParams, postBody,
|
|
2354
|
-
contentTypes, accepts, returnType
|
|
2428
|
+
contentTypes, accepts, returnType, this.getRateLimiter('FbaInboundApi-setPackingInformation')
|
|
2355
2429
|
);
|
|
2356
2430
|
}
|
|
2357
2431
|
|
|
@@ -2399,7 +2473,7 @@ export class FbaInboundApi {
|
|
|
2399
2473
|
return this.apiClient.callApi( 'FbaInboundApi-setPrepDetails',
|
|
2400
2474
|
'/inbound/fba/2024-03-20/items/prepDetails', 'POST',
|
|
2401
2475
|
pathParams, queryParams, headerParams, formParams, postBody,
|
|
2402
|
-
contentTypes, accepts, returnType
|
|
2476
|
+
contentTypes, accepts, returnType, this.getRateLimiter('FbaInboundApi-setPrepDetails')
|
|
2403
2477
|
);
|
|
2404
2478
|
}
|
|
2405
2479
|
|
|
@@ -2453,7 +2527,7 @@ export class FbaInboundApi {
|
|
|
2453
2527
|
return this.apiClient.callApi( 'FbaInboundApi-updateInboundPlanName',
|
|
2454
2528
|
'/inbound/fba/2024-03-20/inboundPlans/{inboundPlanId}/name', 'PUT',
|
|
2455
2529
|
pathParams, queryParams, headerParams, formParams, postBody,
|
|
2456
|
-
contentTypes, accepts, returnType
|
|
2530
|
+
contentTypes, accepts, returnType, this.getRateLimiter('FbaInboundApi-updateInboundPlanName')
|
|
2457
2531
|
);
|
|
2458
2532
|
}
|
|
2459
2533
|
|
|
@@ -2508,7 +2582,7 @@ export class FbaInboundApi {
|
|
|
2508
2582
|
return this.apiClient.callApi( 'FbaInboundApi-updateItemComplianceDetails',
|
|
2509
2583
|
'/inbound/fba/2024-03-20/items/compliance', 'PUT',
|
|
2510
2584
|
pathParams, queryParams, headerParams, formParams, postBody,
|
|
2511
|
-
contentTypes, accepts, returnType
|
|
2585
|
+
contentTypes, accepts, returnType, this.getRateLimiter('FbaInboundApi-updateItemComplianceDetails')
|
|
2512
2586
|
);
|
|
2513
2587
|
}
|
|
2514
2588
|
|
|
@@ -2570,7 +2644,7 @@ export class FbaInboundApi {
|
|
|
2570
2644
|
return this.apiClient.callApi( 'FbaInboundApi-updateShipmentName',
|
|
2571
2645
|
'/inbound/fba/2024-03-20/inboundPlans/{inboundPlanId}/shipments/{shipmentId}/name', 'PUT',
|
|
2572
2646
|
pathParams, queryParams, headerParams, formParams, postBody,
|
|
2573
|
-
contentTypes, accepts, returnType
|
|
2647
|
+
contentTypes, accepts, returnType, this.getRateLimiter('FbaInboundApi-updateShipmentName')
|
|
2574
2648
|
);
|
|
2575
2649
|
}
|
|
2576
2650
|
|
|
@@ -2633,7 +2707,7 @@ export class FbaInboundApi {
|
|
|
2633
2707
|
return this.apiClient.callApi( 'FbaInboundApi-updateShipmentSourceAddress',
|
|
2634
2708
|
'/inbound/fba/2024-03-20/inboundPlans/{inboundPlanId}/shipments/{shipmentId}/sourceAddress', 'PUT',
|
|
2635
2709
|
pathParams, queryParams, headerParams, formParams, postBody,
|
|
2636
|
-
contentTypes, accepts, returnType
|
|
2710
|
+
contentTypes, accepts, returnType, this.getRateLimiter('FbaInboundApi-updateShipmentSourceAddress')
|
|
2637
2711
|
);
|
|
2638
2712
|
}
|
|
2639
2713
|
|
|
@@ -2696,7 +2770,7 @@ export class FbaInboundApi {
|
|
|
2696
2770
|
return this.apiClient.callApi( 'FbaInboundApi-updateShipmentTrackingDetails',
|
|
2697
2771
|
'/inbound/fba/2024-03-20/inboundPlans/{inboundPlanId}/shipments/{shipmentId}/trackingDetails', 'PUT',
|
|
2698
2772
|
pathParams, queryParams, headerParams, formParams, postBody,
|
|
2699
|
-
contentTypes, accepts, returnType
|
|
2773
|
+
contentTypes, accepts, returnType, this.getRateLimiter('FbaInboundApi-updateShipmentTrackingDetails')
|
|
2700
2774
|
);
|
|
2701
2775
|
}
|
|
2702
2776
|
|
|
@@ -11,12 +11,11 @@
|
|
|
11
11
|
*
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
import superagent from
|
|
15
|
-
import querystring from
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import { DefaultRateLimitFetcher } from "../../helper/DefaultRateLimitFetcher.mjs";
|
|
14
|
+
import superagent from 'superagent';
|
|
15
|
+
import querystring from 'querystring';
|
|
16
|
+
import {URL} from 'node:url';
|
|
17
|
+
import {RateLimitConfiguration} from '../../helper/RateLimitConfiguration.mjs';
|
|
18
|
+
import {SuperagentRateLimiter} from '../../helper/SuperagentRateLimiter.mjs';
|
|
20
19
|
|
|
21
20
|
/**
|
|
22
21
|
* @module fulfillmentoutbound_v2020_07_01/ApiClient
|
|
@@ -193,9 +192,8 @@ export class ApiClient {
|
|
|
193
192
|
#tokenForApiCall = null;
|
|
194
193
|
#lwaClient = null;
|
|
195
194
|
#rdtClient = null;
|
|
196
|
-
#
|
|
197
|
-
#
|
|
198
|
-
#useDefaultRateLimiter = false;
|
|
195
|
+
#customizedRateLimiterMap = null;
|
|
196
|
+
#useRateLimiter = true;
|
|
199
197
|
|
|
200
198
|
/**
|
|
201
199
|
* Constructs a new ApiClient.
|
|
@@ -259,42 +257,54 @@ export class ApiClient {
|
|
|
259
257
|
* Allow user to override superagent agent
|
|
260
258
|
*/
|
|
261
259
|
this.requestAgent = null;
|
|
260
|
+
|
|
261
|
+
/*
|
|
262
|
+
* Initialize customized rate limiter map
|
|
263
|
+
*/
|
|
264
|
+
this.#customizedRateLimiterMap = new Map();
|
|
262
265
|
}
|
|
263
266
|
|
|
264
267
|
/**
|
|
265
|
-
*
|
|
268
|
+
* Set customized rate limiter for one operation
|
|
269
|
+
* For operations that customized rate limiter are not set
|
|
270
|
+
* Will use default rate limiter
|
|
271
|
+
* @param {String} operationName
|
|
272
|
+
* @param {RateLimitConfiguration} config
|
|
266
273
|
*/
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
this.#defaultRateLimitFetcher = await DefaultRateLimitFetcher.getInstance();
|
|
270
|
-
} catch (err) {
|
|
271
|
-
throw new Error('Error reading default rate limit:', err);
|
|
272
|
-
}
|
|
274
|
+
setCustomizedRateLimiterForOperation(operationName, config) {
|
|
275
|
+
this.#customizedRateLimiterMap.set(operationName, new SuperagentRateLimiter(config));
|
|
273
276
|
}
|
|
274
277
|
|
|
275
278
|
/**
|
|
276
|
-
*
|
|
279
|
+
* Disable customized rate limiter for one operation
|
|
280
|
+
* Fall back to default rate limiter
|
|
281
|
+
* @param {String} operationName
|
|
277
282
|
*/
|
|
278
|
-
|
|
279
|
-
this.#
|
|
280
|
-
this.#customizedRateLimiter = null;
|
|
283
|
+
disableCustomizedRatelimiterForOperation(operationName) {
|
|
284
|
+
this.#customizedRateLimiterMap.delete(operationName);
|
|
281
285
|
}
|
|
282
286
|
|
|
283
287
|
/**
|
|
284
|
-
*
|
|
285
|
-
*
|
|
288
|
+
* Clear customized rate limiter for all operations
|
|
289
|
+
* All operations will fall back to default rate limiter
|
|
290
|
+
* @param {String} operationName
|
|
291
|
+
*/
|
|
292
|
+
disableCustomizedRatelimiterForAll() {
|
|
293
|
+
this.#customizedRateLimiterMap.clear();
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Disable both default and customized rate limiter for all operations
|
|
286
298
|
*/
|
|
287
|
-
|
|
288
|
-
this.#
|
|
289
|
-
this.#useDefaultRateLimiter = false;
|
|
299
|
+
disableRateLimiter() {
|
|
300
|
+
this.#useRateLimiter = false;
|
|
290
301
|
}
|
|
291
302
|
|
|
292
303
|
/**
|
|
293
|
-
*
|
|
304
|
+
* Enable default or customized rate limiter for all operations
|
|
294
305
|
*/
|
|
295
|
-
|
|
296
|
-
this.#
|
|
297
|
-
this.defaultRateLimiter = false;
|
|
306
|
+
enableRateLimiter() {
|
|
307
|
+
this.#useRateLimiter = true;
|
|
298
308
|
}
|
|
299
309
|
|
|
300
310
|
/**
|
|
@@ -597,11 +607,12 @@ export class ApiClient {
|
|
|
597
607
|
* @param {Array<String>} accepts An array of acceptable response MIME types.
|
|
598
608
|
* @param {(String|Array|ObjectFunction)} returnType The required type to return; can be a string for simple types or the
|
|
599
609
|
* constructor for a complex type.
|
|
610
|
+
* @param {SuperagentRateLimiter} defaultRateLimiter The default rate limiter.
|
|
600
611
|
* @returns {Promise} A {@link https://www.promisejs.org/|Promise} object.
|
|
601
612
|
*/
|
|
602
613
|
async callApi(operation, path, httpMethod, pathParams,
|
|
603
614
|
queryParams, headerParams, formParams, bodyParam, contentTypes, accepts,
|
|
604
|
-
returnType) {
|
|
615
|
+
returnType, defaultRateLimiter) {
|
|
605
616
|
|
|
606
617
|
var url = this.buildUrl(path, pathParams);
|
|
607
618
|
var request = superagent(httpMethod, url);
|
|
@@ -609,15 +620,14 @@ export class ApiClient {
|
|
|
609
620
|
throw new Error('none of accessToken, RDT token and auto-retrieval is set.');
|
|
610
621
|
}
|
|
611
622
|
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
623
|
+
if (this.#useRateLimiter) {
|
|
624
|
+
//Set rate limiter
|
|
625
|
+
if (this.#customizedRateLimiterMap.get(operation)) {
|
|
626
|
+
request.use(this.#customizedRateLimiterMap.get(operation).getPlugin());
|
|
627
|
+
} else if (defaultRateLimiter) {
|
|
628
|
+
request.use(defaultRateLimiter.getPlugin());
|
|
629
|
+
}
|
|
619
630
|
}
|
|
620
|
-
|
|
621
631
|
|
|
622
632
|
// set query parameters
|
|
623
633
|
if (httpMethod.toUpperCase() === 'GET' && this.cache === false) {
|