@sp-api-sdk/feeds-api-2021-06-30 1.7.3 → 1.7.7
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,15 @@
|
|
|
2
2
|
|
|
3
3
|
The Selling Partner API for Feeds lets you upload data to Amazon on behalf of a selling partner.
|
|
4
4
|
|
|
5
|
+
[](https://www.npmjs.com/package/@sp-api-sdk/feeds-api-2021-06-30)
|
|
6
|
+
[](https://github.com/xojs/xo)
|
|
7
|
+
|
|
8
|
+
## Documentation
|
|
9
|
+
|
|
10
|
+
Learn more about this Selling Partner API by visiting the [official documentation](https://github.com/amzn/selling-partner-api-docs/tree/main/references/feeds-api/feeds_2021-06-30.md).
|
|
11
|
+
|
|
12
|
+
Also, see the [generated documentation](https://bizon.github.io/selling-partner-api-sdk/modules/_sp_api_sdk_feeds_api_2021_06_30.html) for this API client.
|
|
13
|
+
|
|
5
14
|
## Installing
|
|
6
15
|
|
|
7
16
|
```sh
|
|
@@ -19,26 +28,25 @@ import {SellingPartnerApiAuth} from '@sp-api-sdk/auth'
|
|
|
19
28
|
import {FeedsApiClient} from '@sp-api-sdk/feeds-api-2021-06-30'
|
|
20
29
|
|
|
21
30
|
const auth = new SellingPartnerApiAuth({
|
|
22
|
-
clientId:
|
|
23
|
-
clientSecret:
|
|
24
|
-
refreshToken: '',
|
|
25
|
-
secretAccessKey: '',
|
|
31
|
+
clientId: process.env.LWA_CLIENT_ID,
|
|
32
|
+
clientSecret: process.env.LWA_CLIENT_SECRET,
|
|
33
|
+
refreshToken: 'Atzr|…',
|
|
26
34
|
accessKeyId: '',
|
|
27
|
-
|
|
35
|
+
secretAccessKey: '',
|
|
28
36
|
role: {
|
|
29
|
-
arn: '',
|
|
30
|
-
}
|
|
37
|
+
arn: 'arn:aws:iam::…',
|
|
38
|
+
},
|
|
31
39
|
})
|
|
32
40
|
|
|
33
41
|
const client = new FeedsApiClient({
|
|
34
42
|
auth,
|
|
35
|
-
region: 'eu'
|
|
43
|
+
region: 'eu',
|
|
36
44
|
})
|
|
37
45
|
```
|
|
38
46
|
|
|
39
|
-
##
|
|
47
|
+
## Rate Limiting
|
|
40
48
|
|
|
41
|
-
|
|
49
|
+
In order to retry rate limited requests (HTTP 429), you can configure the API client as such:
|
|
42
50
|
|
|
43
51
|
```javascript
|
|
44
52
|
const client = new FeedsApiClient({
|
|
@@ -46,13 +54,28 @@ const client = new FeedsApiClient({
|
|
|
46
54
|
region: 'eu',
|
|
47
55
|
rateLimiting: {
|
|
48
56
|
retry: true,
|
|
49
|
-
|
|
50
|
-
|
|
57
|
+
// Optionally specify a callback that will be called on every retry.
|
|
58
|
+
onRetry: (retryInfo) => {
|
|
59
|
+
console.log(retryInfo)
|
|
60
|
+
},
|
|
61
|
+
},
|
|
51
62
|
})
|
|
52
63
|
```
|
|
53
64
|
|
|
54
|
-
The
|
|
65
|
+
The rate limits used for each route are specified in the [API documentation](https://github.com/amzn/selling-partner-api-docs/tree/main/references/feeds-api/feeds_2021-06-30.md).
|
|
66
|
+
|
|
67
|
+
## License
|
|
68
|
+
|
|
69
|
+
MIT
|
|
55
70
|
|
|
56
|
-
##
|
|
71
|
+
## Miscellaneous
|
|
57
72
|
|
|
58
|
-
|
|
73
|
+
```
|
|
74
|
+
╚⊙ ⊙╝
|
|
75
|
+
╚═(███)═╝
|
|
76
|
+
╚═(███)═╝
|
|
77
|
+
╚═(███)═╝
|
|
78
|
+
╚═(███)═╝
|
|
79
|
+
╚═(███)═╝
|
|
80
|
+
╚═(███)═╝
|
|
81
|
+
```
|
package/dist/cjs/src/client.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FeedsApiClient = exports.
|
|
3
|
+
exports.FeedsApiClient = exports.clientRateLimits = void 0;
|
|
4
4
|
/* eslint-disable prefer-regex-literals */
|
|
5
5
|
const common_1 = require("@sp-api-sdk/common");
|
|
6
6
|
const api_model_1 = require("./api-model");
|
|
7
7
|
const error_1 = require("./error");
|
|
8
|
-
exports.
|
|
8
|
+
exports.clientRateLimits = [
|
|
9
9
|
{
|
|
10
10
|
method: 'get',
|
|
11
11
|
urlRegex: new RegExp('^/feeds/2021-06-30/feeds$'),
|
|
@@ -45,20 +45,23 @@ exports.RATE_LIMITS = [
|
|
|
45
45
|
];
|
|
46
46
|
class FeedsApiClient extends api_model_1.FeedsApi {
|
|
47
47
|
constructor(parameters) {
|
|
48
|
-
const
|
|
48
|
+
const config = common_1.sellingPartnerRegions[parameters.region];
|
|
49
|
+
if (!config) {
|
|
50
|
+
throw new error_1.FeedsApiError(`Unknown region: ${parameters.region}`);
|
|
51
|
+
}
|
|
49
52
|
const { rateLimiting, ...clientParameters } = parameters;
|
|
50
|
-
const axiosParameters = {
|
|
53
|
+
const axiosParameters = {
|
|
54
|
+
...clientParameters,
|
|
55
|
+
region: config.awsRegion,
|
|
56
|
+
};
|
|
51
57
|
if (rateLimiting?.retry) {
|
|
52
|
-
axiosParameters.rateLimits = exports.
|
|
58
|
+
axiosParameters.rateLimits = exports.clientRateLimits;
|
|
53
59
|
axiosParameters.onRetry = rateLimiting.onRetry;
|
|
54
60
|
}
|
|
55
61
|
const axiosInstance = (0, common_1.createAxiosInstance)(axiosParameters);
|
|
56
62
|
const configuration = new api_model_1.Configuration();
|
|
57
63
|
const environment = parameters.sandbox ? 'sandbox' : 'production';
|
|
58
|
-
const endpoint =
|
|
59
|
-
if (!endpoint) {
|
|
60
|
-
throw new error_1.FeedsApiError(`Unknown region : ${region}`);
|
|
61
|
-
}
|
|
64
|
+
const endpoint = config.endpoints[environment];
|
|
62
65
|
super(configuration, endpoint, axiosInstance);
|
|
63
66
|
}
|
|
64
67
|
}
|
package/dist/es/src/client.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/* eslint-disable prefer-regex-literals */
|
|
2
|
-
import {
|
|
2
|
+
import { sellingPartnerRegions, createAxiosInstance } from '@sp-api-sdk/common';
|
|
3
3
|
import { Configuration, FeedsApi } from './api-model';
|
|
4
4
|
import { FeedsApiError } from './error';
|
|
5
|
-
export const
|
|
5
|
+
export const clientRateLimits = [
|
|
6
6
|
{
|
|
7
7
|
method: 'get',
|
|
8
8
|
urlRegex: new RegExp('^/feeds/2021-06-30/feeds$'),
|
|
@@ -42,20 +42,23 @@ export const RATE_LIMITS = [
|
|
|
42
42
|
];
|
|
43
43
|
export class FeedsApiClient extends FeedsApi {
|
|
44
44
|
constructor(parameters) {
|
|
45
|
-
const
|
|
45
|
+
const config = sellingPartnerRegions[parameters.region];
|
|
46
|
+
if (!config) {
|
|
47
|
+
throw new FeedsApiError(`Unknown region: ${parameters.region}`);
|
|
48
|
+
}
|
|
46
49
|
const { rateLimiting, ...clientParameters } = parameters;
|
|
47
|
-
const axiosParameters = {
|
|
50
|
+
const axiosParameters = {
|
|
51
|
+
...clientParameters,
|
|
52
|
+
region: config.awsRegion,
|
|
53
|
+
};
|
|
48
54
|
if (rateLimiting?.retry) {
|
|
49
|
-
axiosParameters.rateLimits =
|
|
55
|
+
axiosParameters.rateLimits = clientRateLimits;
|
|
50
56
|
axiosParameters.onRetry = rateLimiting.onRetry;
|
|
51
57
|
}
|
|
52
58
|
const axiosInstance = createAxiosInstance(axiosParameters);
|
|
53
59
|
const configuration = new Configuration();
|
|
54
60
|
const environment = parameters.sandbox ? 'sandbox' : 'production';
|
|
55
|
-
const endpoint = endpoints[environment]
|
|
56
|
-
if (!endpoint) {
|
|
57
|
-
throw new FeedsApiError(`Unknown region : ${region}`);
|
|
58
|
-
}
|
|
61
|
+
const endpoint = config.endpoints[environment];
|
|
59
62
|
super(configuration, endpoint, axiosInstance);
|
|
60
63
|
}
|
|
61
64
|
}
|
|
@@ -309,7 +309,7 @@ export declare class FeedsApi extends BaseAPI {
|
|
|
309
309
|
* @throws {RequiredError}
|
|
310
310
|
* @memberof FeedsApi
|
|
311
311
|
*/
|
|
312
|
-
cancelFeed(requestParameters: FeedsApiCancelFeedRequest, options?: any): Promise<import("axios").AxiosResponse<void>>;
|
|
312
|
+
cancelFeed(requestParameters: FeedsApiCancelFeedRequest, options?: any): Promise<import("axios").AxiosResponse<void, any>>;
|
|
313
313
|
/**
|
|
314
314
|
* Creates a feed. Upload the contents of the feed document before calling this operation. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0083 | 15 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation.
|
|
315
315
|
* @param {FeedsApiCreateFeedRequest} requestParameters Request parameters.
|
|
@@ -317,7 +317,7 @@ export declare class FeedsApi extends BaseAPI {
|
|
|
317
317
|
* @throws {RequiredError}
|
|
318
318
|
* @memberof FeedsApi
|
|
319
319
|
*/
|
|
320
|
-
createFeed(requestParameters: FeedsApiCreateFeedRequest, options?: any): Promise<import("axios").AxiosResponse<CreateFeedResponse>>;
|
|
320
|
+
createFeed(requestParameters: FeedsApiCreateFeedRequest, options?: any): Promise<import("axios").AxiosResponse<CreateFeedResponse, any>>;
|
|
321
321
|
/**
|
|
322
322
|
* Creates a feed document for the feed type that you specify. This operation returns a presigned URL for uploading the feed document contents. It also returns a feedDocumentId value that you can pass in with a subsequent call to the createFeed operation. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0083 | 15 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation.
|
|
323
323
|
* @param {FeedsApiCreateFeedDocumentRequest} requestParameters Request parameters.
|
|
@@ -325,7 +325,7 @@ export declare class FeedsApi extends BaseAPI {
|
|
|
325
325
|
* @throws {RequiredError}
|
|
326
326
|
* @memberof FeedsApi
|
|
327
327
|
*/
|
|
328
|
-
createFeedDocument(requestParameters: FeedsApiCreateFeedDocumentRequest, options?: any): Promise<import("axios").AxiosResponse<CreateFeedDocumentResponse>>;
|
|
328
|
+
createFeedDocument(requestParameters: FeedsApiCreateFeedDocumentRequest, options?: any): Promise<import("axios").AxiosResponse<CreateFeedDocumentResponse, any>>;
|
|
329
329
|
/**
|
|
330
330
|
* Returns feed details (including the resultDocumentId, if available) for the feed that you specify. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 2.0 | 15 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation.
|
|
331
331
|
* @param {FeedsApiGetFeedRequest} requestParameters Request parameters.
|
|
@@ -333,7 +333,7 @@ export declare class FeedsApi extends BaseAPI {
|
|
|
333
333
|
* @throws {RequiredError}
|
|
334
334
|
* @memberof FeedsApi
|
|
335
335
|
*/
|
|
336
|
-
getFeed(requestParameters: FeedsApiGetFeedRequest, options?: any): Promise<import("axios").AxiosResponse<Feed>>;
|
|
336
|
+
getFeed(requestParameters: FeedsApiGetFeedRequest, options?: any): Promise<import("axios").AxiosResponse<Feed, any>>;
|
|
337
337
|
/**
|
|
338
338
|
* Returns the information required for retrieving a feed document\'s contents. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation.
|
|
339
339
|
* @param {FeedsApiGetFeedDocumentRequest} requestParameters Request parameters.
|
|
@@ -341,7 +341,7 @@ export declare class FeedsApi extends BaseAPI {
|
|
|
341
341
|
* @throws {RequiredError}
|
|
342
342
|
* @memberof FeedsApi
|
|
343
343
|
*/
|
|
344
|
-
getFeedDocument(requestParameters: FeedsApiGetFeedDocumentRequest, options?: any): Promise<import("axios").AxiosResponse<FeedDocument>>;
|
|
344
|
+
getFeedDocument(requestParameters: FeedsApiGetFeedDocumentRequest, options?: any): Promise<import("axios").AxiosResponse<FeedDocument, any>>;
|
|
345
345
|
/**
|
|
346
346
|
* Returns feed details for the feeds that match the filters that you specify. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation.
|
|
347
347
|
* @param {FeedsApiGetFeedsRequest} requestParameters Request parameters.
|
|
@@ -349,5 +349,5 @@ export declare class FeedsApi extends BaseAPI {
|
|
|
349
349
|
* @throws {RequiredError}
|
|
350
350
|
* @memberof FeedsApi
|
|
351
351
|
*/
|
|
352
|
-
getFeeds(requestParameters?: FeedsApiGetFeedsRequest, options?: any): Promise<import("axios").AxiosResponse<GetFeedsResponse>>;
|
|
352
|
+
getFeeds(requestParameters?: FeedsApiGetFeedsRequest, options?: any): Promise<import("axios").AxiosResponse<GetFeedsResponse, any>>;
|
|
353
353
|
}
|
|
@@ -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,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { ClientConfiguration, RateLimit } from '@sp-api-sdk/common';
|
|
1
|
+
import type { ClientConfiguration, SellingPartnerRegion, RateLimit, OnRetryHandler } from '@sp-api-sdk/common';
|
|
3
2
|
import { FeedsApi } from './api-model';
|
|
4
|
-
export declare const
|
|
3
|
+
export declare const clientRateLimits: RateLimit[];
|
|
5
4
|
export interface ClientParameters extends Omit<ClientConfiguration, 'rateLimits' | 'onRetry'> {
|
|
5
|
+
region: SellingPartnerRegion;
|
|
6
6
|
rateLimiting?: {
|
|
7
7
|
retry: boolean;
|
|
8
|
-
onRetry?:
|
|
8
|
+
onRetry?: OnRetryHandler;
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
11
|
export declare class FeedsApiClient extends FeedsApi {
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@sp-api-sdk/feeds-api-2021-06-30",
|
|
3
3
|
"author": "Vincent Mesquita <vincent.mesquita@bizon.solutions>",
|
|
4
4
|
"description": "The Selling Partner API for Feeds lets you upload data to Amazon on behalf of a selling partner.",
|
|
5
|
-
"version": "1.7.
|
|
5
|
+
"version": "1.7.7",
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
7
7
|
"module": "dist/es/index.js",
|
|
8
8
|
"types": "dist/types/index.d.ts",
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"dist/**/*.d.ts"
|
|
19
19
|
],
|
|
20
20
|
"scripts": {
|
|
21
|
+
"check:ts": "yarn tsc --noEmit",
|
|
21
22
|
"build:cjs": "tsc -p tsconfig.json",
|
|
22
23
|
"build:es": "tsc -p tsconfig.es.json",
|
|
23
24
|
"build": "yarn build:cjs && yarn build:es",
|
|
@@ -25,9 +26,9 @@
|
|
|
25
26
|
"test": "NODE_ENV='test' yarn jest"
|
|
26
27
|
},
|
|
27
28
|
"dependencies": {
|
|
28
|
-
"@sp-api-sdk/auth": "^1.9.
|
|
29
|
-
"@sp-api-sdk/common": "^1.7.
|
|
30
|
-
"axios": "^0.
|
|
29
|
+
"@sp-api-sdk/auth": "^1.9.8",
|
|
30
|
+
"@sp-api-sdk/common": "^1.7.10",
|
|
31
|
+
"axios": "^0.26.0"
|
|
31
32
|
},
|
|
32
33
|
"repository": {
|
|
33
34
|
"type": "git",
|
|
@@ -48,5 +49,5 @@
|
|
|
48
49
|
"sp sdk",
|
|
49
50
|
"feeds api"
|
|
50
51
|
],
|
|
51
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "3f4ecdeef2ce06ff28612448d263cc8d08eb69f6"
|
|
52
53
|
}
|