@sp-api-sdk/aplus-content-api-2020-11-01 1.7.6 → 1.7.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
  With the A+ Content API, you can build applications that help selling partners add rich marketing content to their Amazon product detail pages. A+ content helps selling partners share their brand and product story, which helps buyers make informed purchasing decisions. Selling partners assemble content by choosing from content modules and adding images and text.
4
4
 
5
+ [![npm version](https://badgen.net/npm/v/@sp-api-sdk/aplus-content-api-2020-11-01)](https://www.npmjs.com/package/@sp-api-sdk/aplus-content-api-2020-11-01)
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/aplus-content-api/aplusContent_2020-11-01.md).
@@ -59,7 +62,7 @@ const client = new AplusContentApiClient({
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/aplus-content-api/aplusContent_2020-11-01.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/aplus-content-api/aplusContent_2020-11-01.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.AplusContentApiClient = exports.RATE_LIMITS = void 0;
3
+ exports.AplusContentApiClient = 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('^/aplus/2020-11-01/contentDocuments$'),
@@ -69,20 +69,23 @@ exports.RATE_LIMITS = [
69
69
  ];
70
70
  class AplusContentApiClient extends api_model_1.AplusContentApi {
71
71
  constructor(parameters) {
72
- const region = common_1.awsRegionByCode[parameters.region] ?? parameters.region;
72
+ const config = common_1.sellingPartnerRegions[parameters.region];
73
+ if (!config) {
74
+ throw new error_1.AplusContentApiError(`Unknown region: ${parameters.region}`);
75
+ }
73
76
  const { rateLimiting, ...clientParameters } = parameters;
74
- const axiosParameters = { ...clientParameters, region };
77
+ const axiosParameters = {
78
+ ...clientParameters,
79
+ region: config.awsRegion,
80
+ };
75
81
  if (rateLimiting?.retry) {
76
- axiosParameters.rateLimits = exports.RATE_LIMITS;
82
+ axiosParameters.rateLimits = exports.clientRateLimits;
77
83
  axiosParameters.onRetry = rateLimiting.onRetry;
78
84
  }
79
85
  const axiosInstance = (0, common_1.createAxiosInstance)(axiosParameters);
80
86
  const configuration = new api_model_1.Configuration();
81
87
  const environment = parameters.sandbox ? 'sandbox' : 'production';
82
- const endpoint = common_1.endpoints[environment][region];
83
- if (!endpoint) {
84
- throw new error_1.AplusContentApiError(`Unknown region : ${region}`);
85
- }
88
+ const endpoint = config.endpoints[environment];
86
89
  super(configuration, endpoint, axiosInstance);
87
90
  }
88
91
  }
@@ -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, AplusContentApi } from './api-model';
4
4
  import { AplusContentApiError } from './error';
5
- export const RATE_LIMITS = [
5
+ export const clientRateLimits = [
6
6
  {
7
7
  method: 'get',
8
8
  urlRegex: new RegExp('^/aplus/2020-11-01/contentDocuments$'),
@@ -66,20 +66,23 @@ export const RATE_LIMITS = [
66
66
  ];
67
67
  export class AplusContentApiClient extends AplusContentApi {
68
68
  constructor(parameters) {
69
- const region = awsRegionByCode[parameters.region] ?? parameters.region;
69
+ const config = sellingPartnerRegions[parameters.region];
70
+ if (!config) {
71
+ throw new AplusContentApiError(`Unknown region: ${parameters.region}`);
72
+ }
70
73
  const { rateLimiting, ...clientParameters } = parameters;
71
- const axiosParameters = { ...clientParameters, region };
74
+ const axiosParameters = {
75
+ ...clientParameters,
76
+ region: config.awsRegion,
77
+ };
72
78
  if (rateLimiting?.retry) {
73
- axiosParameters.rateLimits = RATE_LIMITS;
79
+ axiosParameters.rateLimits = clientRateLimits;
74
80
  axiosParameters.onRetry = rateLimiting.onRetry;
75
81
  }
76
82
  const axiosInstance = createAxiosInstance(axiosParameters);
77
83
  const configuration = new Configuration();
78
84
  const environment = parameters.sandbox ? 'sandbox' : 'production';
79
- const endpoint = endpoints[environment][region];
80
- if (!endpoint) {
81
- throw new AplusContentApiError(`Unknown region : ${region}`);
82
- }
85
+ const endpoint = config.endpoints[environment];
83
86
  super(configuration, endpoint, axiosInstance);
84
87
  }
85
88
  }
@@ -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 { AplusContentApi } 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/aplus-content-api-2020-11-01",
3
3
  "author": "Vincent Mesquita <vincent.mesquita@bizon.solutions>",
4
4
  "description": "With the A+ Content API, you can build applications that help selling partners add rich marketing content to their Amazon product detail pages. A+ content helps selling partners share their brand and product story, which helps buyers make informed purchasing decisions. Selling partners assemble content by choosing from content modules and adding images and text.",
5
- "version": "1.7.6",
5
+ "version": "1.7.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
  "aplus content api"
50
51
  ],
51
- "gitHead": "e8c21d7d481263e8a6663ee11f6708d4dc6968b6"
52
+ "gitHead": "3f4ecdeef2ce06ff28612448d263cc8d08eb69f6"
52
53
  }
@@ -1,26 +0,0 @@
1
- "use strict";
2
- /* tslint:disable */
3
- /* eslint-disable */
4
- /**
5
- * Selling Partner API for A+ Content Management
6
- * With the A+ Content API, you can build applications that help selling partners add rich marketing content to their Amazon product detail pages. A+ content helps selling partners share their brand and product story, which helps buyers make informed purchasing decisions. Selling partners assemble content by choosing from content modules and adding images and text.
7
- *
8
- * The version of the OpenAPI document: 2020-11-01
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 });
16
- exports.GetContentDocumentIncludedDataType = void 0;
17
- /**
18
- * The type of data to include in the response, such as the contents or the metadata of the A+ Content documents.
19
- * @export
20
- * @enum {string}
21
- */
22
- var GetContentDocumentIncludedDataType;
23
- (function (GetContentDocumentIncludedDataType) {
24
- GetContentDocumentIncludedDataType["Contents"] = "CONTENTS";
25
- GetContentDocumentIncludedDataType["Metadata"] = "METADATA";
26
- })(GetContentDocumentIncludedDataType = exports.GetContentDocumentIncludedDataType || (exports.GetContentDocumentIncludedDataType = {}));
@@ -1,25 +0,0 @@
1
- "use strict";
2
- /* tslint:disable */
3
- /* eslint-disable */
4
- /**
5
- * Selling Partner API for A+ Content Management
6
- * With the A+ Content API, you can build applications that help selling partners add rich marketing content to their Amazon product detail pages. A+ content helps selling partners share their brand and product story, which helps buyers make informed purchasing decisions. Selling partners assemble content by choosing from content modules and adding images and text.
7
- *
8
- * The version of the OpenAPI document: 2020-11-01
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 });
16
- exports.ListContentDocumentAsinRelationsIncludedDataType = void 0;
17
- /**
18
- * The type of data to include in the response, such as metadata about the related ASINs.
19
- * @export
20
- * @enum {string}
21
- */
22
- var ListContentDocumentAsinRelationsIncludedDataType;
23
- (function (ListContentDocumentAsinRelationsIncludedDataType) {
24
- ListContentDocumentAsinRelationsIncludedDataType["Metadata"] = "METADATA";
25
- })(ListContentDocumentAsinRelationsIncludedDataType = exports.ListContentDocumentAsinRelationsIncludedDataType || (exports.ListContentDocumentAsinRelationsIncludedDataType = {}));
@@ -1,23 +0,0 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
- /**
4
- * Selling Partner API for A+ Content Management
5
- * With the A+ Content API, you can build applications that help selling partners add rich marketing content to their Amazon product detail pages. A+ content helps selling partners share their brand and product story, which helps buyers make informed purchasing decisions. Selling partners assemble content by choosing from content modules and adding images and text.
6
- *
7
- * The version of the OpenAPI document: 2020-11-01
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
- /**
15
- * The type of data to include in the response, such as the contents or the metadata of the A+ Content documents.
16
- * @export
17
- * @enum {string}
18
- */
19
- export var GetContentDocumentIncludedDataType;
20
- (function (GetContentDocumentIncludedDataType) {
21
- GetContentDocumentIncludedDataType["Contents"] = "CONTENTS";
22
- GetContentDocumentIncludedDataType["Metadata"] = "METADATA";
23
- })(GetContentDocumentIncludedDataType || (GetContentDocumentIncludedDataType = {}));
@@ -1,22 +0,0 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
- /**
4
- * Selling Partner API for A+ Content Management
5
- * With the A+ Content API, you can build applications that help selling partners add rich marketing content to their Amazon product detail pages. A+ content helps selling partners share their brand and product story, which helps buyers make informed purchasing decisions. Selling partners assemble content by choosing from content modules and adding images and text.
6
- *
7
- * The version of the OpenAPI document: 2020-11-01
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
- /**
15
- * The type of data to include in the response, such as metadata about the related ASINs.
16
- * @export
17
- * @enum {string}
18
- */
19
- export var ListContentDocumentAsinRelationsIncludedDataType;
20
- (function (ListContentDocumentAsinRelationsIncludedDataType) {
21
- ListContentDocumentAsinRelationsIncludedDataType["Metadata"] = "METADATA";
22
- })(ListContentDocumentAsinRelationsIncludedDataType || (ListContentDocumentAsinRelationsIncludedDataType = {}));
@@ -1,20 +0,0 @@
1
- /**
2
- * Selling Partner API for A+ Content Management
3
- * With the A+ Content API, you can build applications that help selling partners add rich marketing content to their Amazon product detail pages. A+ content helps selling partners share their brand and product story, which helps buyers make informed purchasing decisions. Selling partners assemble content by choosing from content modules and adding images and text.
4
- *
5
- * The version of the OpenAPI document: 2020-11-01
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 type of data to include in the response, such as the contents or the metadata of the A+ Content documents.
14
- * @export
15
- * @enum {string}
16
- */
17
- export declare enum GetContentDocumentIncludedDataType {
18
- Contents = "CONTENTS",
19
- Metadata = "METADATA"
20
- }
@@ -1,19 +0,0 @@
1
- /**
2
- * Selling Partner API for A+ Content Management
3
- * With the A+ Content API, you can build applications that help selling partners add rich marketing content to their Amazon product detail pages. A+ content helps selling partners share their brand and product story, which helps buyers make informed purchasing decisions. Selling partners assemble content by choosing from content modules and adding images and text.
4
- *
5
- * The version of the OpenAPI document: 2020-11-01
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 type of data to include in the response, such as metadata about the related ASINs.
14
- * @export
15
- * @enum {string}
16
- */
17
- export declare enum ListContentDocumentAsinRelationsIncludedDataType {
18
- Metadata = "METADATA"
19
- }