@sp-api-sdk/sellers-api-v1 1.6.20 → 1.6.21
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 +3 -0
- package/dist/cjs/src/client.js +12 -9
- package/dist/es/src/client.js +12 -9
- package/dist/types/src/client.d.ts +3 -2
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
The Selling Partner API for Sellers lets you retrieve information on behalf of sellers about their seller account, such as the marketplaces they participate in. Along with listing the marketplaces that a seller can sell in, the API also provides additional information about the marketplace such as the default language and the default currency. The API also provides seller-specific information such as whether the seller has suspended listings in that marketplace.
|
|
4
4
|
|
|
5
|
+
[](https://www.npmjs.com/package/@sp-api-sdk/sellers-api-v1)
|
|
6
|
+
[](https://github.com/xojs/xo)
|
|
7
|
+
|
|
5
8
|
## Documentation
|
|
6
9
|
|
|
7
10
|
Learn more about this Selling Partner API by visiting the [official documentation](https://github.com/amzn/selling-partner-api-docs/tree/main/references/sellers-api/sellers.md).
|
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.SellersApiClient = exports.
|
|
3
|
+
exports.SellersApiClient = 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('^/sellers/v1/marketplaceParticipations$'),
|
|
@@ -15,20 +15,23 @@ exports.RATE_LIMITS = [
|
|
|
15
15
|
];
|
|
16
16
|
class SellersApiClient extends api_model_1.SellersApi {
|
|
17
17
|
constructor(parameters) {
|
|
18
|
-
const
|
|
18
|
+
const config = common_1.sellingPartnerRegions[parameters.region];
|
|
19
|
+
if (!config) {
|
|
20
|
+
throw new error_1.SellersApiError(`Unknown region: ${parameters.region}`);
|
|
21
|
+
}
|
|
19
22
|
const { rateLimiting, ...clientParameters } = parameters;
|
|
20
|
-
const axiosParameters = {
|
|
23
|
+
const axiosParameters = {
|
|
24
|
+
...clientParameters,
|
|
25
|
+
region: config.awsRegion,
|
|
26
|
+
};
|
|
21
27
|
if (rateLimiting?.retry) {
|
|
22
|
-
axiosParameters.rateLimits = exports.
|
|
28
|
+
axiosParameters.rateLimits = exports.clientRateLimits;
|
|
23
29
|
axiosParameters.onRetry = rateLimiting.onRetry;
|
|
24
30
|
}
|
|
25
31
|
const axiosInstance = (0, common_1.createAxiosInstance)(axiosParameters);
|
|
26
32
|
const configuration = new api_model_1.Configuration();
|
|
27
33
|
const environment = parameters.sandbox ? 'sandbox' : 'production';
|
|
28
|
-
const endpoint =
|
|
29
|
-
if (!endpoint) {
|
|
30
|
-
throw new error_1.SellersApiError(`Unknown region : ${region}`);
|
|
31
|
-
}
|
|
34
|
+
const endpoint = config.endpoints[environment];
|
|
32
35
|
super(configuration, endpoint, axiosInstance);
|
|
33
36
|
}
|
|
34
37
|
}
|
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, SellersApi } from './api-model';
|
|
4
4
|
import { SellersApiError } from './error';
|
|
5
|
-
export const
|
|
5
|
+
export const clientRateLimits = [
|
|
6
6
|
{
|
|
7
7
|
method: 'get',
|
|
8
8
|
urlRegex: new RegExp('^/sellers/v1/marketplaceParticipations$'),
|
|
@@ -12,20 +12,23 @@ export const RATE_LIMITS = [
|
|
|
12
12
|
];
|
|
13
13
|
export class SellersApiClient extends SellersApi {
|
|
14
14
|
constructor(parameters) {
|
|
15
|
-
const
|
|
15
|
+
const config = sellingPartnerRegions[parameters.region];
|
|
16
|
+
if (!config) {
|
|
17
|
+
throw new SellersApiError(`Unknown region: ${parameters.region}`);
|
|
18
|
+
}
|
|
16
19
|
const { rateLimiting, ...clientParameters } = parameters;
|
|
17
|
-
const axiosParameters = {
|
|
20
|
+
const axiosParameters = {
|
|
21
|
+
...clientParameters,
|
|
22
|
+
region: config.awsRegion,
|
|
23
|
+
};
|
|
18
24
|
if (rateLimiting?.retry) {
|
|
19
|
-
axiosParameters.rateLimits =
|
|
25
|
+
axiosParameters.rateLimits = clientRateLimits;
|
|
20
26
|
axiosParameters.onRetry = rateLimiting.onRetry;
|
|
21
27
|
}
|
|
22
28
|
const axiosInstance = createAxiosInstance(axiosParameters);
|
|
23
29
|
const configuration = new Configuration();
|
|
24
30
|
const environment = parameters.sandbox ? 'sandbox' : 'production';
|
|
25
|
-
const endpoint = endpoints[environment]
|
|
26
|
-
if (!endpoint) {
|
|
27
|
-
throw new SellersApiError(`Unknown region : ${region}`);
|
|
28
|
-
}
|
|
31
|
+
const endpoint = config.endpoints[environment];
|
|
29
32
|
super(configuration, endpoint, axiosInstance);
|
|
30
33
|
}
|
|
31
34
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type { ClientConfiguration, RateLimit, OnRetryHandler } from '@sp-api-sdk/common';
|
|
1
|
+
import type { ClientConfiguration, SellingPartnerRegion, RateLimit, OnRetryHandler } from '@sp-api-sdk/common';
|
|
2
2
|
import { SellersApi } from './api-model';
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const clientRateLimits: RateLimit[];
|
|
4
4
|
export interface ClientParameters extends Omit<ClientConfiguration, 'rateLimits' | 'onRetry'> {
|
|
5
|
+
region: SellingPartnerRegion;
|
|
5
6
|
rateLimiting?: {
|
|
6
7
|
retry: boolean;
|
|
7
8
|
onRetry?: OnRetryHandler;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@sp-api-sdk/sellers-api-v1",
|
|
3
3
|
"author": "Vincent Mesquita <vincent.mesquita@bizon.solutions>",
|
|
4
4
|
"description": "The Selling Partner API for Sellers lets you retrieve information on behalf of sellers about their seller account, such as the marketplaces they participate in. Along with listing the marketplaces that a seller can sell in, the API also provides additional information about the marketplace such as the default language and the default currency. The API also provides seller-specific information such as whether the seller has suspended listings in that marketplace.",
|
|
5
|
-
"version": "1.6.
|
|
5
|
+
"version": "1.6.21",
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
7
7
|
"module": "dist/es/index.js",
|
|
8
8
|
"types": "dist/types/index.d.ts",
|
|
@@ -25,8 +25,8 @@
|
|
|
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.
|
|
28
|
+
"@sp-api-sdk/auth": "^1.9.6",
|
|
29
|
+
"@sp-api-sdk/common": "^1.7.8",
|
|
30
30
|
"axios": "^0.24.0"
|
|
31
31
|
},
|
|
32
32
|
"repository": {
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"sp sdk",
|
|
49
49
|
"sellers api"
|
|
50
50
|
],
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "f21b5cb511abd110bf1f07843558719993f36187"
|
|
52
52
|
}
|