@sp-api-sdk/catalog-items-api-v0 1.8.6 → 1.8.10

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,9 @@
2
2
 
3
3
  The Selling Partner API for Catalog Items helps you programmatically retrieve item details for items in the catalog.
4
4
 
5
+ [![npm version](https://badgen.net/npm/v/@sp-api-sdk/catalog-items-api-v0)](https://www.npmjs.com/package/@sp-api-sdk/catalog-items-api-v0)
6
+ [![XO code style](https://badgen.net/badge/code%20style/XO/cyan)](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/catalog-items-api/catalogItemsV0.md).
@@ -59,7 +62,7 @@ const client = new CatalogItemsApiClient({
59
62
  })
60
63
  ```
61
64
 
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/catalog-items-api/catalogItemsV0.md)).
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/catalog-items-api/catalogItemsV0.md).
63
66
 
64
67
  ## License
65
68
 
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CatalogItemsApiClient = exports.RATE_LIMITS = void 0;
3
+ exports.CatalogItemsApiClient = 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('^/catalog/v0/items$'),
@@ -27,20 +27,23 @@ exports.RATE_LIMITS = [
27
27
  ];
28
28
  class CatalogItemsApiClient extends api_model_1.CatalogApi {
29
29
  constructor(parameters) {
30
- const region = common_1.awsRegionByCode[parameters.region] ?? parameters.region;
30
+ const config = common_1.sellingPartnerRegions[parameters.region];
31
+ if (!config) {
32
+ throw new error_1.CatalogItemsApiError(`Unknown region: ${parameters.region}`);
33
+ }
31
34
  const { rateLimiting, ...clientParameters } = parameters;
32
- const axiosParameters = { ...clientParameters, region };
35
+ const axiosParameters = {
36
+ ...clientParameters,
37
+ region: config.awsRegion,
38
+ };
33
39
  if (rateLimiting?.retry) {
34
- axiosParameters.rateLimits = exports.RATE_LIMITS;
40
+ axiosParameters.rateLimits = exports.clientRateLimits;
35
41
  axiosParameters.onRetry = rateLimiting.onRetry;
36
42
  }
37
43
  const axiosInstance = (0, common_1.createAxiosInstance)(axiosParameters);
38
44
  const configuration = new api_model_1.Configuration();
39
45
  const environment = parameters.sandbox ? 'sandbox' : 'production';
40
- const endpoint = common_1.endpoints[environment][region];
41
- if (!endpoint) {
42
- throw new error_1.CatalogItemsApiError(`Unknown region : ${region}`);
43
- }
46
+ const endpoint = config.endpoints[environment];
44
47
  super(configuration, endpoint, axiosInstance);
45
48
  }
46
49
  }
@@ -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, CatalogApi } from './api-model';
4
4
  import { CatalogItemsApiError } from './error';
5
- export const RATE_LIMITS = [
5
+ export const clientRateLimits = [
6
6
  {
7
7
  method: 'get',
8
8
  urlRegex: new RegExp('^/catalog/v0/items$'),
@@ -24,20 +24,23 @@ export const RATE_LIMITS = [
24
24
  ];
25
25
  export class CatalogItemsApiClient extends CatalogApi {
26
26
  constructor(parameters) {
27
- const region = awsRegionByCode[parameters.region] ?? parameters.region;
27
+ const config = sellingPartnerRegions[parameters.region];
28
+ if (!config) {
29
+ throw new CatalogItemsApiError(`Unknown region: ${parameters.region}`);
30
+ }
28
31
  const { rateLimiting, ...clientParameters } = parameters;
29
- const axiosParameters = { ...clientParameters, region };
32
+ const axiosParameters = {
33
+ ...clientParameters,
34
+ region: config.awsRegion,
35
+ };
30
36
  if (rateLimiting?.retry) {
31
- axiosParameters.rateLimits = RATE_LIMITS;
37
+ axiosParameters.rateLimits = clientRateLimits;
32
38
  axiosParameters.onRetry = rateLimiting.onRetry;
33
39
  }
34
40
  const axiosInstance = createAxiosInstance(axiosParameters);
35
41
  const configuration = new Configuration();
36
42
  const environment = parameters.sandbox ? 'sandbox' : 'production';
37
- const endpoint = endpoints[environment][region];
38
- if (!endpoint) {
39
- throw new CatalogItemsApiError(`Unknown region : ${region}`);
40
- }
43
+ const endpoint = config.endpoints[environment];
41
44
  super(configuration, endpoint, axiosInstance);
42
45
  }
43
46
  }
@@ -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 { CatalogApi } from './api-model';
3
- export declare const RATE_LIMITS: RateLimit[];
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/catalog-items-api-v0",
3
3
  "author": "Vincent Mesquita <vincent.mesquita@bizon.solutions>",
4
4
  "description": "The Selling Partner API for Catalog Items helps you programmatically retrieve item details for items in the catalog.",
5
- "version": "1.8.6",
5
+ "version": "1.8.10",
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.5",
29
- "@sp-api-sdk/common": "^1.7.7",
30
- "axios": "^0.24.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
  "catalog items api"
50
51
  ],
51
- "gitHead": "e8c21d7d481263e8a6663ee11f6708d4dc6968b6"
52
+ "gitHead": "3f4ecdeef2ce06ff28612448d263cc8d08eb69f6"
52
53
  }
@@ -1,15 +0,0 @@
1
- "use strict";
2
- /* tslint:disable */
3
- /* eslint-disable */
4
- /**
5
- * Selling Partner API for Catalog Items
6
- * The Selling Partner API for Catalog Items helps you programmatically retrieve item details for items in the catalog.
7
- *
8
- * The version of the OpenAPI document: v0
9
- *
10
- *
11
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
- * https://openapi-generator.tech
13
- * Do not edit the class manually.
14
- */
15
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,15 +0,0 @@
1
- "use strict";
2
- /* tslint:disable */
3
- /* eslint-disable */
4
- /**
5
- * Selling Partner API for Catalog Items
6
- * The Selling Partner API for Catalog Items helps you programmatically retrieve item details for items in the catalog.
7
- *
8
- * The version of the OpenAPI document: v0
9
- *
10
- *
11
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
- * https://openapi-generator.tech
13
- * Do not edit the class manually.
14
- */
15
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,15 +0,0 @@
1
- "use strict";
2
- /* tslint:disable */
3
- /* eslint-disable */
4
- /**
5
- * Selling Partner API for Catalog Items
6
- * The Selling Partner API for Catalog Items helps you programmatically retrieve item details for items in the catalog.
7
- *
8
- * The version of the OpenAPI document: v0
9
- *
10
- *
11
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
- * https://openapi-generator.tech
13
- * Do not edit the class manually.
14
- */
15
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,14 +0,0 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
- /**
4
- * Selling Partner API for Catalog Items
5
- * The Selling Partner API for Catalog Items helps you programmatically retrieve item details for items in the catalog.
6
- *
7
- * The version of the OpenAPI document: v0
8
- *
9
- *
10
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
- * https://openapi-generator.tech
12
- * Do not edit the class manually.
13
- */
14
- export {};
@@ -1,14 +0,0 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
- /**
4
- * Selling Partner API for Catalog Items
5
- * The Selling Partner API for Catalog Items helps you programmatically retrieve item details for items in the catalog.
6
- *
7
- * The version of the OpenAPI document: v0
8
- *
9
- *
10
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
- * https://openapi-generator.tech
12
- * Do not edit the class manually.
13
- */
14
- export {};
@@ -1,14 +0,0 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
- /**
4
- * Selling Partner API for Catalog Items
5
- * The Selling Partner API for Catalog Items helps you programmatically retrieve item details for items in the catalog.
6
- *
7
- * The version of the OpenAPI document: v0
8
- *
9
- *
10
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
- * https://openapi-generator.tech
12
- * Do not edit the class manually.
13
- */
14
- export {};
@@ -1,30 +0,0 @@
1
- /**
2
- * Selling Partner API for Catalog Items
3
- * The Selling Partner API for Catalog Items helps you programmatically retrieve item details for items in the catalog.
4
- *
5
- * The version of the OpenAPI document: v0
6
- *
7
- *
8
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
- * https://openapi-generator.tech
10
- * Do not edit the class manually.
11
- */
12
- /**
13
- * The number of offer listings with the specified condition.
14
- * @export
15
- * @interface OfferListingCountType
16
- */
17
- export interface OfferListingCountType {
18
- /**
19
- * The number of offer listings.
20
- * @type {number}
21
- * @memberof OfferListingCountType
22
- */
23
- Count: number;
24
- /**
25
- * The condition of the item.
26
- * @type {string}
27
- * @memberof OfferListingCountType
28
- */
29
- condition: string;
30
- }
@@ -1,55 +0,0 @@
1
- /**
2
- * Selling Partner API for Catalog Items
3
- * The Selling Partner API for Catalog Items helps you programmatically retrieve item details for items in the catalog.
4
- *
5
- * The version of the OpenAPI document: v0
6
- *
7
- *
8
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
- * https://openapi-generator.tech
10
- * Do not edit the class manually.
11
- */
12
- import { ShippingTimeType } from './shipping-time-type';
13
- /**
14
- *
15
- * @export
16
- * @interface QualifiersType
17
- */
18
- export interface QualifiersType {
19
- /**
20
- * The condition of the item. Possible values: New, Used, Collectible, Refurbished, or Club.
21
- * @type {string}
22
- * @memberof QualifiersType
23
- */
24
- ItemCondition: string;
25
- /**
26
- * The item subcondition for the offer listing. Possible values: New, Mint, Very Good, Good, Acceptable, Poor, Club, OEM, Warranty, Refurbished Warranty, Refurbished, Open Box, or Other.
27
- * @type {string}
28
- * @memberof QualifiersType
29
- */
30
- ItemSubcondition: string;
31
- /**
32
- * The fulfillment channel for the item. Possible values: * Amazon - Fulfilled by Amazon. * Merchant - Fulfilled by the seller.
33
- * @type {string}
34
- * @memberof QualifiersType
35
- */
36
- FulfillmentChannel: string;
37
- /**
38
- * Indicates whether the marketplace specified in the request and the location that the item ships from are in the same country. Possible values: True, False, or Unknown.
39
- * @type {string}
40
- * @memberof QualifiersType
41
- */
42
- ShipsDomestically: string;
43
- /**
44
- *
45
- * @type {ShippingTimeType}
46
- * @memberof QualifiersType
47
- */
48
- ShippingTime: ShippingTimeType;
49
- /**
50
- * (98-100%, 95-97%, 90-94%, 80-89%, 70-79%, Less than 70%, or Just launched ) – Indicates the percentage of feedback ratings that were positive over the past 12 months.
51
- * @type {string}
52
- * @memberof QualifiersType
53
- */
54
- SellerPositiveFeedbackRating: string;
55
- }
@@ -1,24 +0,0 @@
1
- /**
2
- * Selling Partner API for Catalog Items
3
- * The Selling Partner API for Catalog Items helps you programmatically retrieve item details for items in the catalog.
4
- *
5
- * The version of the OpenAPI document: v0
6
- *
7
- *
8
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
- * https://openapi-generator.tech
10
- * Do not edit the class manually.
11
- */
12
- /**
13
- *
14
- * @export
15
- * @interface ShippingTimeType
16
- */
17
- export interface ShippingTimeType {
18
- /**
19
- * (0-2 days, 3-7 days, 8-13 days, or 14 or more days) – Indicates the maximum time within which the item will likely be shipped once an order has been placed.
20
- * @type {string}
21
- * @memberof ShippingTimeType
22
- */
23
- Max?: string;
24
- }