@sp-api-sdk/shipping-api-v1 1.6.16 → 1.6.20
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
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Provides programmatic access to Amazon Shipping APIs.
|
|
4
4
|
|
|
5
|
+
## Documentation
|
|
6
|
+
|
|
7
|
+
Learn more about this Selling Partner API by visiting the [official documentation](https://github.com/amzn/selling-partner-api-docs/tree/main/references/shipping-api/shipping.md).
|
|
8
|
+
|
|
9
|
+
Also, see the [generated documentation](https://bizon.github.io/selling-partner-api-sdk/modules/_sp_api_sdk_shipping_api_v1.html) for this API client.
|
|
10
|
+
|
|
5
11
|
## Installing
|
|
6
12
|
|
|
7
13
|
```sh
|
|
@@ -19,26 +25,25 @@ import {SellingPartnerApiAuth} from '@sp-api-sdk/auth'
|
|
|
19
25
|
import {ShippingApiClient} from '@sp-api-sdk/shipping-api-v1'
|
|
20
26
|
|
|
21
27
|
const auth = new SellingPartnerApiAuth({
|
|
22
|
-
clientId:
|
|
23
|
-
clientSecret:
|
|
24
|
-
refreshToken: '',
|
|
25
|
-
secretAccessKey: '',
|
|
28
|
+
clientId: process.env.LWA_CLIENT_ID,
|
|
29
|
+
clientSecret: process.env.LWA_CLIENT_SECRET,
|
|
30
|
+
refreshToken: 'Atzr|…',
|
|
26
31
|
accessKeyId: '',
|
|
27
|
-
|
|
32
|
+
secretAccessKey: '',
|
|
28
33
|
role: {
|
|
29
|
-
arn: '',
|
|
30
|
-
}
|
|
34
|
+
arn: 'arn:aws:iam::…',
|
|
35
|
+
},
|
|
31
36
|
})
|
|
32
37
|
|
|
33
38
|
const client = new ShippingApiClient({
|
|
34
39
|
auth,
|
|
35
|
-
region: 'eu'
|
|
40
|
+
region: 'eu',
|
|
36
41
|
})
|
|
37
42
|
```
|
|
38
43
|
|
|
39
|
-
##
|
|
44
|
+
## Rate Limiting
|
|
40
45
|
|
|
41
|
-
|
|
46
|
+
In order to retry rate limited requests (HTTP 429), you can configure the API client as such:
|
|
42
47
|
|
|
43
48
|
```javascript
|
|
44
49
|
const client = new ShippingApiClient({
|
|
@@ -46,13 +51,28 @@ const client = new ShippingApiClient({
|
|
|
46
51
|
region: 'eu',
|
|
47
52
|
rateLimiting: {
|
|
48
53
|
retry: true,
|
|
49
|
-
|
|
50
|
-
|
|
54
|
+
// Optionally specify a callback that will be called on every retry.
|
|
55
|
+
onRetry: (retryInfo) => {
|
|
56
|
+
console.log(retryInfo)
|
|
57
|
+
},
|
|
58
|
+
},
|
|
51
59
|
})
|
|
52
60
|
```
|
|
53
61
|
|
|
54
|
-
The
|
|
62
|
+
The rate limits used for each route are specified in the [API documentation]((https://github.com/amzn/selling-partner-api-docs/tree/main/references/shipping-api/shipping.md)).
|
|
63
|
+
|
|
64
|
+
## License
|
|
65
|
+
|
|
66
|
+
MIT
|
|
55
67
|
|
|
56
|
-
##
|
|
68
|
+
## Miscellaneous
|
|
57
69
|
|
|
58
|
-
|
|
70
|
+
```
|
|
71
|
+
╚⊙ ⊙╝
|
|
72
|
+
╚═(███)═╝
|
|
73
|
+
╚═(███)═╝
|
|
74
|
+
╚═(███)═╝
|
|
75
|
+
╚═(███)═╝
|
|
76
|
+
╚═(███)═╝
|
|
77
|
+
╚═(███)═╝
|
|
78
|
+
```
|
|
@@ -375,7 +375,7 @@ export declare class ShippingApi extends BaseAPI {
|
|
|
375
375
|
* @throws {RequiredError}
|
|
376
376
|
* @memberof ShippingApi
|
|
377
377
|
*/
|
|
378
|
-
cancelShipment(requestParameters: ShippingApiCancelShipmentRequest, options?: any): Promise<import("axios").AxiosResponse<CancelShipmentResponse>>;
|
|
378
|
+
cancelShipment(requestParameters: ShippingApiCancelShipmentRequest, options?: any): Promise<import("axios").AxiosResponse<CancelShipmentResponse, any>>;
|
|
379
379
|
/**
|
|
380
380
|
* Create a new shipment. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 5 | 15 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation.
|
|
381
381
|
* @param {ShippingApiCreateShipmentRequest} requestParameters Request parameters.
|
|
@@ -383,14 +383,14 @@ export declare class ShippingApi extends BaseAPI {
|
|
|
383
383
|
* @throws {RequiredError}
|
|
384
384
|
* @memberof ShippingApi
|
|
385
385
|
*/
|
|
386
|
-
createShipment(requestParameters: ShippingApiCreateShipmentRequest, options?: any): Promise<import("axios").AxiosResponse<CreateShipmentResponse>>;
|
|
386
|
+
createShipment(requestParameters: ShippingApiCreateShipmentRequest, options?: any): Promise<import("axios").AxiosResponse<CreateShipmentResponse, any>>;
|
|
387
387
|
/**
|
|
388
388
|
* Verify if the current account is valid. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 5 | 15 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation.
|
|
389
389
|
* @param {*} [options] Override http request option.
|
|
390
390
|
* @throws {RequiredError}
|
|
391
391
|
* @memberof ShippingApi
|
|
392
392
|
*/
|
|
393
|
-
getAccount(options?: any): Promise<import("axios").AxiosResponse<GetAccountResponse>>;
|
|
393
|
+
getAccount(options?: any): Promise<import("axios").AxiosResponse<GetAccountResponse, any>>;
|
|
394
394
|
/**
|
|
395
395
|
* Get service rates. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 5 | 15 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation.
|
|
396
396
|
* @param {ShippingApiGetRatesRequest} requestParameters Request parameters.
|
|
@@ -398,7 +398,7 @@ export declare class ShippingApi extends BaseAPI {
|
|
|
398
398
|
* @throws {RequiredError}
|
|
399
399
|
* @memberof ShippingApi
|
|
400
400
|
*/
|
|
401
|
-
getRates(requestParameters: ShippingApiGetRatesRequest, options?: any): Promise<import("axios").AxiosResponse<GetRatesResponse>>;
|
|
401
|
+
getRates(requestParameters: ShippingApiGetRatesRequest, options?: any): Promise<import("axios").AxiosResponse<GetRatesResponse, any>>;
|
|
402
402
|
/**
|
|
403
403
|
* Return the entire shipment object for the shipmentId. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 5 | 15 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation.
|
|
404
404
|
* @param {ShippingApiGetShipmentRequest} requestParameters Request parameters.
|
|
@@ -406,7 +406,7 @@ export declare class ShippingApi extends BaseAPI {
|
|
|
406
406
|
* @throws {RequiredError}
|
|
407
407
|
* @memberof ShippingApi
|
|
408
408
|
*/
|
|
409
|
-
getShipment(requestParameters: ShippingApiGetShipmentRequest, options?: any): Promise<import("axios").AxiosResponse<GetShipmentResponse>>;
|
|
409
|
+
getShipment(requestParameters: ShippingApiGetShipmentRequest, options?: any): Promise<import("axios").AxiosResponse<GetShipmentResponse, any>>;
|
|
410
410
|
/**
|
|
411
411
|
* Return the tracking information of a shipment. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 1 | 1 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation.
|
|
412
412
|
* @param {ShippingApiGetTrackingInformationRequest} requestParameters Request parameters.
|
|
@@ -414,7 +414,7 @@ export declare class ShippingApi extends BaseAPI {
|
|
|
414
414
|
* @throws {RequiredError}
|
|
415
415
|
* @memberof ShippingApi
|
|
416
416
|
*/
|
|
417
|
-
getTrackingInformation(requestParameters: ShippingApiGetTrackingInformationRequest, options?: any): Promise<import("axios").AxiosResponse<GetTrackingInformationResponse>>;
|
|
417
|
+
getTrackingInformation(requestParameters: ShippingApiGetTrackingInformationRequest, options?: any): Promise<import("axios").AxiosResponse<GetTrackingInformationResponse, any>>;
|
|
418
418
|
/**
|
|
419
419
|
* Purchase shipping labels based on a given rate. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 5 | 15 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation.
|
|
420
420
|
* @param {ShippingApiPurchaseLabelsRequest} requestParameters Request parameters.
|
|
@@ -422,7 +422,7 @@ export declare class ShippingApi extends BaseAPI {
|
|
|
422
422
|
* @throws {RequiredError}
|
|
423
423
|
* @memberof ShippingApi
|
|
424
424
|
*/
|
|
425
|
-
purchaseLabels(requestParameters: ShippingApiPurchaseLabelsRequest, options?: any): Promise<import("axios").AxiosResponse<PurchaseLabelsResponse>>;
|
|
425
|
+
purchaseLabels(requestParameters: ShippingApiPurchaseLabelsRequest, options?: any): Promise<import("axios").AxiosResponse<PurchaseLabelsResponse, any>>;
|
|
426
426
|
/**
|
|
427
427
|
* Purchase shipping labels. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 5 | 15 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation.
|
|
428
428
|
* @param {ShippingApiPurchaseShipmentRequest} requestParameters Request parameters.
|
|
@@ -430,7 +430,7 @@ export declare class ShippingApi extends BaseAPI {
|
|
|
430
430
|
* @throws {RequiredError}
|
|
431
431
|
* @memberof ShippingApi
|
|
432
432
|
*/
|
|
433
|
-
purchaseShipment(requestParameters: ShippingApiPurchaseShipmentRequest, options?: any): Promise<import("axios").AxiosResponse<PurchaseShipmentResponse>>;
|
|
433
|
+
purchaseShipment(requestParameters: ShippingApiPurchaseShipmentRequest, options?: any): Promise<import("axios").AxiosResponse<PurchaseShipmentResponse, any>>;
|
|
434
434
|
/**
|
|
435
435
|
* Retrieve shipping label based on the shipment id and tracking id. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 5 | 15 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation.
|
|
436
436
|
* @param {ShippingApiRetrieveShippingLabelRequest} requestParameters Request parameters.
|
|
@@ -438,5 +438,5 @@ export declare class ShippingApi extends BaseAPI {
|
|
|
438
438
|
* @throws {RequiredError}
|
|
439
439
|
* @memberof ShippingApi
|
|
440
440
|
*/
|
|
441
|
-
retrieveShippingLabel(requestParameters: ShippingApiRetrieveShippingLabelRequest, options?: any): Promise<import("axios").AxiosResponse<RetrieveShippingLabelResponse>>;
|
|
441
|
+
retrieveShippingLabel(requestParameters: ShippingApiRetrieveShippingLabelRequest, options?: any): Promise<import("axios").AxiosResponse<RetrieveShippingLabelResponse, any>>;
|
|
442
442
|
}
|
|
@@ -62,4 +62,4 @@ export declare const toPathString: (url: URL) => string;
|
|
|
62
62
|
*
|
|
63
63
|
* @export
|
|
64
64
|
*/
|
|
65
|
-
export declare const createRequestFunction: (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration | undefined) => (axios?: AxiosInstance, basePath?: string) => Promise<import("axios").AxiosResponse<any>>;
|
|
65
|
+
export declare const createRequestFunction: (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration | undefined) => (axios?: AxiosInstance, basePath?: string) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { ClientConfiguration, RateLimit } from '@sp-api-sdk/common';
|
|
1
|
+
import type { ClientConfiguration, RateLimit, OnRetryHandler } from '@sp-api-sdk/common';
|
|
3
2
|
import { ShippingApi } from './api-model';
|
|
4
3
|
export declare const RATE_LIMITS: RateLimit[];
|
|
5
4
|
export interface ClientParameters extends Omit<ClientConfiguration, 'rateLimits' | 'onRetry'> {
|
|
6
5
|
rateLimiting?: {
|
|
7
6
|
retry: boolean;
|
|
8
|
-
onRetry?:
|
|
7
|
+
onRetry?: OnRetryHandler;
|
|
9
8
|
};
|
|
10
9
|
}
|
|
11
10
|
export declare class ShippingApiClient extends ShippingApi {
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@sp-api-sdk/shipping-api-v1",
|
|
3
3
|
"author": "Vincent Mesquita <vincent.mesquita@bizon.solutions>",
|
|
4
4
|
"description": "Provides programmatic access to Amazon Shipping APIs.",
|
|
5
|
-
"version": "1.6.
|
|
5
|
+
"version": "1.6.20",
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
7
7
|
"module": "dist/es/index.js",
|
|
8
8
|
"types": "dist/types/index.d.ts",
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"test": "NODE_ENV='test' yarn jest"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@sp-api-sdk/auth": "^1.9.
|
|
29
|
-
"@sp-api-sdk/common": "^1.7.
|
|
30
|
-
"axios": "^0.
|
|
28
|
+
"@sp-api-sdk/auth": "^1.9.5",
|
|
29
|
+
"@sp-api-sdk/common": "^1.7.7",
|
|
30
|
+
"axios": "^0.24.0"
|
|
31
31
|
},
|
|
32
32
|
"repository": {
|
|
33
33
|
"type": "git",
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"sp sdk",
|
|
49
49
|
"shipping api"
|
|
50
50
|
],
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "e8c21d7d481263e8a6663ee11f6708d4dc6968b6"
|
|
52
52
|
}
|