@sp-api-sdk/fba-inbound-eligibility-api-v1 1.6.19 → 1.6.23

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
  With the FBA Inbound Eligibility API, you can build applications that let sellers get eligibility previews for items before shipping them to Amazon's fulfillment centers. With this API you can find out if an item is eligible for inbound shipment to Amazon's fulfillment centers in a specific marketplace. You can also find out if an item is eligible for using the manufacturer barcode for FBA inventory tracking. Sellers can use this information to inform their decisions about which items to ship Amazon's fulfillment centers.
4
4
 
5
+ [![npm version](https://badgen.net/npm/v/@sp-api-sdk/fba-inbound-eligibility-api-v1)](https://www.npmjs.com/package/@sp-api-sdk/fba-inbound-eligibility-api-v1)
6
+ [![XO code style](https://badgen.net/badge/code%20style/XO/cyan)](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/fba-inbound-eligibility-api/fbaInbound.md).
11
+
12
+ Also, see the [generated documentation](https://bizon.github.io/selling-partner-api-sdk/modules/_sp_api_sdk_fba_inbound_eligibility_api_v1.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 {FbaInboundEligibilityApiClient} from '@sp-api-sdk/fba-inbound-eligibility-api-v1'
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
- region: '',
35
+ secretAccessKey: '',
28
36
  role: {
29
- arn: '',
30
- }
37
+ arn: 'arn:aws:iam::…',
38
+ },
31
39
  })
32
40
 
33
41
  const client = new FbaInboundEligibilityApiClient({
34
42
  auth,
35
- region: 'eu' // or 'eu-west-1'
43
+ region: 'eu',
36
44
  })
37
45
  ```
38
46
 
39
- ## Handle Rate Limiting
47
+ ## Rate Limiting
40
48
 
41
- If you want to let the SDK retry after each 429 responses, instanciate the client like this:
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 FbaInboundEligibilityApiClient({
@@ -46,13 +54,28 @@ const client = new FbaInboundEligibilityApiClient({
46
54
  region: 'eu',
47
55
  rateLimiting: {
48
56
  retry: true,
49
- onRetry: (retryInfo) => console.log(retryInfo) // Optional
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 SDK gets the rate limits for each routes from the API documentation
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/fba-inbound-eligibility-api/fbaInbound.md)).
66
+
67
+ ## License
68
+
69
+ MIT
55
70
 
56
- ## API documentation
71
+ ## Miscellaneous
57
72
 
58
- See [here](https://github.com/amzn/selling-partner-api-docs/tree/main/references/fba-inbound-eligibility-api/fbaInbound.md)
73
+ ```
74
+ ╚⊙ ⊙╝
75
+ ╚═(███)═╝
76
+ ╚═(███)═╝
77
+ ╚═(███)═╝
78
+ ╚═(███)═╝
79
+ ╚═(███)═╝
80
+ ╚═(███)═╝
81
+ ```
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FbaInboundEligibilityApiClient = exports.RATE_LIMITS = void 0;
3
+ exports.FbaInboundEligibilityApiClient = 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.RATE_LIMITS = [
8
+ exports.clientRateLimits = [
9
9
  {
10
10
  method: 'get',
11
11
  urlRegex: new RegExp('^/fba/inbound/v1/eligibility/itemPreview$'),
@@ -15,20 +15,23 @@ exports.RATE_LIMITS = [
15
15
  ];
16
16
  class FbaInboundEligibilityApiClient extends api_model_1.FbaInboundApi {
17
17
  constructor(parameters) {
18
- const region = common_1.awsRegionByCode[parameters.region] ?? parameters.region;
18
+ const config = common_1.sellingPartnerRegions[parameters.region];
19
+ if (!config) {
20
+ throw new error_1.FbaInboundEligibilityApiError(`Unknown region: ${parameters.region}`);
21
+ }
19
22
  const { rateLimiting, ...clientParameters } = parameters;
20
- const axiosParameters = { ...clientParameters, region };
23
+ const axiosParameters = {
24
+ ...clientParameters,
25
+ region: config.awsRegion,
26
+ };
21
27
  if (rateLimiting?.retry) {
22
- axiosParameters.rateLimits = exports.RATE_LIMITS;
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 = common_1.endpoints[environment][region];
29
- if (!endpoint) {
30
- throw new error_1.FbaInboundEligibilityApiError(`Unknown region : ${region}`);
31
- }
34
+ const endpoint = config.endpoints[environment];
32
35
  super(configuration, endpoint, axiosInstance);
33
36
  }
34
37
  }
@@ -1,8 +1,8 @@
1
1
  /* eslint-disable prefer-regex-literals */
2
- import { endpoints, awsRegionByCode, createAxiosInstance } from '@sp-api-sdk/common';
2
+ import { sellingPartnerRegions, createAxiosInstance } from '@sp-api-sdk/common';
3
3
  import { Configuration, FbaInboundApi } from './api-model';
4
4
  import { FbaInboundEligibilityApiError } from './error';
5
- export const RATE_LIMITS = [
5
+ export const clientRateLimits = [
6
6
  {
7
7
  method: 'get',
8
8
  urlRegex: new RegExp('^/fba/inbound/v1/eligibility/itemPreview$'),
@@ -12,20 +12,23 @@ export const RATE_LIMITS = [
12
12
  ];
13
13
  export class FbaInboundEligibilityApiClient extends FbaInboundApi {
14
14
  constructor(parameters) {
15
- const region = awsRegionByCode[parameters.region] ?? parameters.region;
15
+ const config = sellingPartnerRegions[parameters.region];
16
+ if (!config) {
17
+ throw new FbaInboundEligibilityApiError(`Unknown region: ${parameters.region}`);
18
+ }
16
19
  const { rateLimiting, ...clientParameters } = parameters;
17
- const axiosParameters = { ...clientParameters, region };
20
+ const axiosParameters = {
21
+ ...clientParameters,
22
+ region: config.awsRegion,
23
+ };
18
24
  if (rateLimiting?.retry) {
19
- axiosParameters.rateLimits = RATE_LIMITS;
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][region];
26
- if (!endpoint) {
27
- throw new FbaInboundEligibilityApiError(`Unknown region : ${region}`);
28
- }
31
+ const endpoint = config.endpoints[environment];
29
32
  super(configuration, endpoint, axiosInstance);
30
33
  }
31
34
  }
@@ -97,5 +97,5 @@ export declare class FbaInboundApi extends BaseAPI {
97
97
  * @throws {RequiredError}
98
98
  * @memberof FbaInboundApi
99
99
  */
100
- getItemEligibilityPreview(requestParameters: FbaInboundApiGetItemEligibilityPreviewRequest, options?: any): Promise<import("axios").AxiosResponse<GetItemEligibilityPreviewResponse>>;
100
+ getItemEligibilityPreview(requestParameters: FbaInboundApiGetItemEligibilityPreviewRequest, options?: any): Promise<import("axios").AxiosResponse<GetItemEligibilityPreviewResponse, any>>;
101
101
  }
@@ -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 { onRetry } from '@sp-api-sdk/common';
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 { FbaInboundApi } from './api-model';
4
- export declare const RATE_LIMITS: RateLimit[];
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?: onRetry;
8
+ onRetry?: OnRetryHandler;
9
9
  };
10
10
  }
11
11
  export declare class FbaInboundEligibilityApiClient extends FbaInboundApi {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@sp-api-sdk/fba-inbound-eligibility-api-v1",
3
3
  "author": "Vincent Mesquita <vincent.mesquita@bizon.solutions>",
4
4
  "description": "With the FBA Inbound Eligibility API, you can build applications that let sellers get eligibility previews for items before shipping them to Amazon's fulfillment centers. With this API you can find out if an item is eligible for inbound shipment to Amazon's fulfillment centers in a specific marketplace. You can also find out if an item is eligible for using the manufacturer barcode for FBA inventory tracking. Sellers can use this information to inform their decisions about which items to ship Amazon's fulfillment centers.",
5
- "version": "1.6.19",
5
+ "version": "1.6.23",
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.4",
29
- "@sp-api-sdk/common": "^1.7.5",
30
- "axios": "^0.21.1"
28
+ "@sp-api-sdk/auth": "^1.9.7",
29
+ "@sp-api-sdk/common": "^1.7.9",
30
+ "axios": "^0.24.0"
31
31
  },
32
32
  "repository": {
33
33
  "type": "git",
@@ -48,5 +48,5 @@
48
48
  "sp sdk",
49
49
  "fba inbound eligibility api"
50
50
  ],
51
- "gitHead": "634245dca301dd9c49f6b53447e0aa9bdb752c1a"
51
+ "gitHead": "dd52e8a895f590c62d06f19f4d8715eb7740df66"
52
52
  }