@sp-api-sdk/replenishment-api-2022-11-07 1.1.0
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/LICENSE +21 -0
- package/README.md +103 -0
- package/dist/cjs/index.js +18 -0
- package/dist/cjs/src/api-model/api/offers-api.js +231 -0
- package/dist/cjs/src/api-model/api.js +30 -0
- package/dist/cjs/src/api-model/base.js +66 -0
- package/dist/cjs/src/api-model/common.js +145 -0
- package/dist/cjs/src/api-model/configuration.js +91 -0
- package/dist/cjs/src/api-model/index.js +32 -0
- package/dist/cjs/src/api-model/models/aggregation-frequency.js +27 -0
- package/dist/cjs/src/api-model/models/auto-enrollment-preference.js +25 -0
- package/dist/cjs/src/api-model/models/discount-funding.js +15 -0
- package/dist/cjs/src/api-model/models/eligibility-status.js +27 -0
- package/dist/cjs/src/api-model/models/enrollment-method.js +25 -0
- package/dist/cjs/src/api-model/models/error-list.js +15 -0
- package/dist/cjs/src/api-model/models/get-selling-partner-metrics-request.js +15 -0
- package/dist/cjs/src/api-model/models/get-selling-partner-metrics-response-metric.js +15 -0
- package/dist/cjs/src/api-model/models/get-selling-partner-metrics-response.js +15 -0
- package/dist/cjs/src/api-model/models/index.js +52 -0
- package/dist/cjs/src/api-model/models/list-offer-metrics-request-filters.js +15 -0
- package/dist/cjs/src/api-model/models/list-offer-metrics-request-pagination.js +15 -0
- package/dist/cjs/src/api-model/models/list-offer-metrics-request-sort.js +15 -0
- package/dist/cjs/src/api-model/models/list-offer-metrics-request.js +15 -0
- package/dist/cjs/src/api-model/models/list-offer-metrics-response-offer.js +15 -0
- package/dist/cjs/src/api-model/models/list-offer-metrics-response.js +15 -0
- package/dist/cjs/src/api-model/models/list-offer-metrics-sort-key.js +32 -0
- package/dist/cjs/src/api-model/models/list-offers-request-filters.js +15 -0
- package/dist/cjs/src/api-model/models/list-offers-request-pagination.js +15 -0
- package/dist/cjs/src/api-model/models/list-offers-request-sort.js +15 -0
- package/dist/cjs/src/api-model/models/list-offers-request.js +15 -0
- package/dist/cjs/src/api-model/models/list-offers-response-offer.js +15 -0
- package/dist/cjs/src/api-model/models/list-offers-response.js +15 -0
- package/dist/cjs/src/api-model/models/list-offers-sort-key.js +28 -0
- package/dist/cjs/src/api-model/models/metric.js +28 -0
- package/dist/cjs/src/api-model/models/model-error.js +15 -0
- package/dist/cjs/src/api-model/models/offer-program-configuration-preferences.js +15 -0
- package/dist/cjs/src/api-model/models/offer-program-configuration-promotions-discount-funding.js +15 -0
- package/dist/cjs/src/api-model/models/offer-program-configuration-promotions.js +15 -0
- package/dist/cjs/src/api-model/models/offer-program-configuration.js +15 -0
- package/dist/cjs/src/api-model/models/pagination-response.js +15 -0
- package/dist/cjs/src/api-model/models/preference.js +15 -0
- package/dist/cjs/src/api-model/models/program-type.js +24 -0
- package/dist/cjs/src/api-model/models/promotion.js +15 -0
- package/dist/cjs/src/api-model/models/sort-order.js +25 -0
- package/dist/cjs/src/api-model/models/time-interval.js +15 -0
- package/dist/cjs/src/api-model/models/time-period-type.js +25 -0
- package/dist/cjs/src/client.js +35 -0
- package/dist/es/index.js +2 -0
- package/dist/es/src/api-model/api/offers-api.js +221 -0
- package/dist/es/src/api-model/api.js +14 -0
- package/dist/es/src/api-model/base.js +58 -0
- package/dist/es/src/api-model/common.js +133 -0
- package/dist/es/src/api-model/configuration.js +87 -0
- package/dist/es/src/api-model/index.js +16 -0
- package/dist/es/src/api-model/models/aggregation-frequency.js +24 -0
- package/dist/es/src/api-model/models/auto-enrollment-preference.js +22 -0
- package/dist/es/src/api-model/models/discount-funding.js +14 -0
- package/dist/es/src/api-model/models/eligibility-status.js +24 -0
- package/dist/es/src/api-model/models/enrollment-method.js +22 -0
- package/dist/es/src/api-model/models/error-list.js +14 -0
- package/dist/es/src/api-model/models/get-selling-partner-metrics-request.js +14 -0
- package/dist/es/src/api-model/models/get-selling-partner-metrics-response-metric.js +14 -0
- package/dist/es/src/api-model/models/get-selling-partner-metrics-response.js +14 -0
- package/dist/es/src/api-model/models/index.js +36 -0
- package/dist/es/src/api-model/models/list-offer-metrics-request-filters.js +14 -0
- package/dist/es/src/api-model/models/list-offer-metrics-request-pagination.js +14 -0
- package/dist/es/src/api-model/models/list-offer-metrics-request-sort.js +14 -0
- package/dist/es/src/api-model/models/list-offer-metrics-request.js +14 -0
- package/dist/es/src/api-model/models/list-offer-metrics-response-offer.js +14 -0
- package/dist/es/src/api-model/models/list-offer-metrics-response.js +14 -0
- package/dist/es/src/api-model/models/list-offer-metrics-sort-key.js +29 -0
- package/dist/es/src/api-model/models/list-offers-request-filters.js +14 -0
- package/dist/es/src/api-model/models/list-offers-request-pagination.js +14 -0
- package/dist/es/src/api-model/models/list-offers-request-sort.js +14 -0
- package/dist/es/src/api-model/models/list-offers-request.js +14 -0
- package/dist/es/src/api-model/models/list-offers-response-offer.js +14 -0
- package/dist/es/src/api-model/models/list-offers-response.js +14 -0
- package/dist/es/src/api-model/models/list-offers-sort-key.js +25 -0
- package/dist/es/src/api-model/models/metric.js +25 -0
- package/dist/es/src/api-model/models/model-error.js +14 -0
- package/dist/es/src/api-model/models/offer-program-configuration-preferences.js +14 -0
- package/dist/es/src/api-model/models/offer-program-configuration-promotions-discount-funding.js +14 -0
- package/dist/es/src/api-model/models/offer-program-configuration-promotions.js +14 -0
- package/dist/es/src/api-model/models/offer-program-configuration.js +14 -0
- package/dist/es/src/api-model/models/pagination-response.js +14 -0
- package/dist/es/src/api-model/models/preference.js +14 -0
- package/dist/es/src/api-model/models/program-type.js +21 -0
- package/dist/es/src/api-model/models/promotion.js +14 -0
- package/dist/es/src/api-model/models/sort-order.js +22 -0
- package/dist/es/src/api-model/models/time-interval.js +14 -0
- package/dist/es/src/api-model/models/time-period-type.js +22 -0
- package/dist/es/src/client.js +31 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/src/api-model/api/offers-api.d.ts +172 -0
- package/dist/types/src/api-model/api.d.ts +12 -0
- package/dist/types/src/api-model/base.d.ts +54 -0
- package/dist/types/src/api-model/common.d.ts +66 -0
- package/dist/types/src/api-model/configuration.d.ts +83 -0
- package/dist/types/src/api-model/index.d.ts +14 -0
- package/dist/types/src/api-model/models/aggregation-frequency.d.ts +23 -0
- package/dist/types/src/api-model/models/auto-enrollment-preference.d.ts +21 -0
- package/dist/types/src/api-model/models/discount-funding.d.ts +24 -0
- package/dist/types/src/api-model/models/eligibility-status.d.ts +23 -0
- package/dist/types/src/api-model/models/enrollment-method.d.ts +21 -0
- package/dist/types/src/api-model/models/error-list.d.ts +24 -0
- package/dist/types/src/api-model/models/get-selling-partner-metrics-request.d.ts +59 -0
- package/dist/types/src/api-model/models/get-selling-partner-metrics-response-metric.d.ts +67 -0
- package/dist/types/src/api-model/models/get-selling-partner-metrics-response.d.ts +25 -0
- package/dist/types/src/api-model/models/index.d.ts +36 -0
- package/dist/types/src/api-model/models/list-offer-metrics-request-filters.d.ts +58 -0
- package/dist/types/src/api-model/models/list-offer-metrics-request-pagination.d.ts +30 -0
- package/dist/types/src/api-model/models/list-offer-metrics-request-sort.d.ts +32 -0
- package/dist/types/src/api-model/models/list-offer-metrics-request.d.ts +39 -0
- package/dist/types/src/api-model/models/list-offer-metrics-response-offer.d.ts +103 -0
- package/dist/types/src/api-model/models/list-offer-metrics-response.d.ts +32 -0
- package/dist/types/src/api-model/models/list-offer-metrics-sort-key.d.ts +28 -0
- package/dist/types/src/api-model/models/list-offers-request-filters.d.ts +64 -0
- package/dist/types/src/api-model/models/list-offers-request-pagination.d.ts +30 -0
- package/dist/types/src/api-model/models/list-offers-request-sort.d.ts +32 -0
- package/dist/types/src/api-model/models/list-offers-request.d.ts +39 -0
- package/dist/types/src/api-model/models/list-offers-response-offer.d.ts +63 -0
- package/dist/types/src/api-model/models/list-offers-response.d.ts +32 -0
- package/dist/types/src/api-model/models/list-offers-sort-key.d.ts +24 -0
- package/dist/types/src/api-model/models/metric.d.ts +24 -0
- package/dist/types/src/api-model/models/model-error.d.ts +36 -0
- package/dist/types/src/api-model/models/offer-program-configuration-preferences.d.ts +25 -0
- package/dist/types/src/api-model/models/offer-program-configuration-promotions-discount-funding.d.ts +24 -0
- package/dist/types/src/api-model/models/offer-program-configuration-promotions.d.ts +43 -0
- package/dist/types/src/api-model/models/offer-program-configuration.d.ts +39 -0
- package/dist/types/src/api-model/models/pagination-response.d.ts +24 -0
- package/dist/types/src/api-model/models/preference.d.ts +25 -0
- package/dist/types/src/api-model/models/program-type.d.ts +20 -0
- package/dist/types/src/api-model/models/promotion.d.ts +43 -0
- package/dist/types/src/api-model/models/sort-order.d.ts +21 -0
- package/dist/types/src/api-model/models/time-interval.d.ts +30 -0
- package/dist/types/src/api-model/models/time-period-type.d.ts +21 -0
- package/dist/types/src/client.d.ts +6 -0
- package/package.json +44 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Bizon
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# `replenishment-api-2022-11-07`
|
|
2
|
+
|
|
3
|
+
The Selling Partner API for Replenishment (Replenishment API) provides programmatic access to replenishment program metrics and offers. These programs provide recurring delivery (automatic or manual) of any replenishable item at a frequency chosen by the customer.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@sp-api-sdk/replenishment-api-2022-11-07)
|
|
6
|
+
[](https://github.com/xojs/xo)
|
|
7
|
+
|
|
8
|
+
## Documentation
|
|
9
|
+
|
|
10
|
+
Learn more about this Selling Partner API by visiting the [official documentation](https://developer-docs.amazon.com/sp-api/docs).
|
|
11
|
+
|
|
12
|
+
Also, see the [generated documentation](https://bizon.github.io/selling-partner-api-sdk/modules/_sp_api_sdk_replenishment_api_2022_11_07.html) for this API client.
|
|
13
|
+
|
|
14
|
+
## Installing
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
npm install @sp-api-sdk/replenishment-api-2022-11-07
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Getting Started
|
|
21
|
+
|
|
22
|
+
```javascript
|
|
23
|
+
import {SellingPartnerApiAuth} from '@sp-api-sdk/auth'
|
|
24
|
+
import {ReplenishmentApiClient} from '@sp-api-sdk/replenishment-api-2022-11-07'
|
|
25
|
+
|
|
26
|
+
const auth = new SellingPartnerApiAuth({
|
|
27
|
+
clientId: process.env.LWA_CLIENT_ID,
|
|
28
|
+
clientSecret: process.env.LWA_CLIENT_SECRET,
|
|
29
|
+
refreshToken: 'Atzr|…',
|
|
30
|
+
accessKeyId: '',
|
|
31
|
+
secretAccessKey: '',
|
|
32
|
+
region: 'eu-west-1',
|
|
33
|
+
role: {
|
|
34
|
+
arn: 'arn:aws:iam::…',
|
|
35
|
+
},
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
const client = new ReplenishmentApiClient({
|
|
39
|
+
auth,
|
|
40
|
+
region: 'eu',
|
|
41
|
+
})
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Rate Limiting
|
|
45
|
+
|
|
46
|
+
In order to retry rate limited requests (HTTP 429), you can configure the API client as such:
|
|
47
|
+
|
|
48
|
+
```javascript
|
|
49
|
+
const client = new ReplenishmentApiClient({
|
|
50
|
+
auth,
|
|
51
|
+
region: 'eu',
|
|
52
|
+
rateLimiting: {
|
|
53
|
+
retry: true,
|
|
54
|
+
// Optionally specify a callback that will be called on every retry.
|
|
55
|
+
onRetry: (retryInfo) => {
|
|
56
|
+
console.log(retryInfo)
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
})
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
The rate limits used for each route are specified in the [API documentation](https://developer-docs.amazon.com/sp-api/docs).
|
|
63
|
+
|
|
64
|
+
## Logging
|
|
65
|
+
|
|
66
|
+
You can enable logging for both SP-API requests and responses by configuring the `logging.request` and `logging.response` properties.
|
|
67
|
+
|
|
68
|
+
```javascript
|
|
69
|
+
const client = new ReplenishmentApiClient({
|
|
70
|
+
auth,
|
|
71
|
+
region: 'eu',
|
|
72
|
+
logging: {
|
|
73
|
+
request: {
|
|
74
|
+
logger: console.debug
|
|
75
|
+
},
|
|
76
|
+
response: {
|
|
77
|
+
logger: console.debug
|
|
78
|
+
},
|
|
79
|
+
error: true,
|
|
80
|
+
},
|
|
81
|
+
})
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Specifying `true` will use the default options, specifying an object will allow you to override the default options.
|
|
85
|
+
This uses [axios-logger](https://github.com/hg-pyun/axios-logger) under the hood.
|
|
86
|
+
By default, if enabled, the `request` and `response` loggers will use `console.info` and the `error` logger will use `console.error`.
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
## License
|
|
90
|
+
|
|
91
|
+
MIT
|
|
92
|
+
|
|
93
|
+
## Miscellaneous
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
╚⊙ ⊙╝
|
|
97
|
+
╚═(███)═╝
|
|
98
|
+
╚═(███)═╝
|
|
99
|
+
╚═(███)═╝
|
|
100
|
+
╚═(███)═╝
|
|
101
|
+
╚═(███)═╝
|
|
102
|
+
╚═(███)═╝
|
|
103
|
+
```
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./src/client"), exports);
|
|
18
|
+
__exportStar(require("./src/api-model/models"), exports);
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
/**
|
|
5
|
+
* Selling Partner API for Replenishment
|
|
6
|
+
* The Selling Partner API for Replenishment (Replenishment API) provides programmatic access to replenishment program metrics and offers. These programs provide recurring delivery (automatic or manual) of any replenishable item at a frequency chosen by the customer.
|
|
7
|
+
*
|
|
8
|
+
* The version of the OpenAPI document: 2022-11-07
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
16
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
17
|
+
};
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.OffersApi = exports.OffersApiFactory = exports.OffersApiFp = exports.OffersApiAxiosParamCreator = void 0;
|
|
20
|
+
const axios_1 = __importDefault(require("axios"));
|
|
21
|
+
// Some imports not used depending on template conditions
|
|
22
|
+
// @ts-ignore
|
|
23
|
+
const common_1 = require("../common");
|
|
24
|
+
// @ts-ignore
|
|
25
|
+
const base_1 = require("../base");
|
|
26
|
+
/**
|
|
27
|
+
* OffersApi - axios parameter creator
|
|
28
|
+
* @export
|
|
29
|
+
*/
|
|
30
|
+
const OffersApiAxiosParamCreator = function (configuration) {
|
|
31
|
+
return {
|
|
32
|
+
/**
|
|
33
|
+
* Returns aggregated replenishment program metrics for a selling partner. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 1 | 1 | The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
|
|
34
|
+
* @param {GetSellingPartnerMetricsRequest} [body]
|
|
35
|
+
* @param {*} [options] Override http request option.
|
|
36
|
+
* @throws {RequiredError}
|
|
37
|
+
*/
|
|
38
|
+
getSellingPartnerMetrics: async (body, options = {}) => {
|
|
39
|
+
const localVarPath = `/replenishment/2022-11-07/sellingPartners/metrics/search`;
|
|
40
|
+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
41
|
+
const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
|
|
42
|
+
let baseOptions;
|
|
43
|
+
if (configuration) {
|
|
44
|
+
baseOptions = configuration.baseOptions;
|
|
45
|
+
}
|
|
46
|
+
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
|
|
47
|
+
const localVarHeaderParameter = {};
|
|
48
|
+
const localVarQueryParameter = {};
|
|
49
|
+
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
50
|
+
(0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
|
|
51
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
52
|
+
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
53
|
+
localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(body, localVarRequestOptions, configuration);
|
|
54
|
+
return {
|
|
55
|
+
url: (0, common_1.toPathString)(localVarUrlObj),
|
|
56
|
+
options: localVarRequestOptions,
|
|
57
|
+
};
|
|
58
|
+
},
|
|
59
|
+
/**
|
|
60
|
+
* Returns aggregated replenishment program metrics for a selling partner\'s offers. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 1 | 1 | The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
|
|
61
|
+
* @param {ListOfferMetricsRequest} [body] The request body for the `listOfferMetrics` operation.
|
|
62
|
+
* @param {*} [options] Override http request option.
|
|
63
|
+
* @throws {RequiredError}
|
|
64
|
+
*/
|
|
65
|
+
listOfferMetrics: async (body, options = {}) => {
|
|
66
|
+
const localVarPath = `/replenishment/2022-11-07/offers/metrics/search`;
|
|
67
|
+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
68
|
+
const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
|
|
69
|
+
let baseOptions;
|
|
70
|
+
if (configuration) {
|
|
71
|
+
baseOptions = configuration.baseOptions;
|
|
72
|
+
}
|
|
73
|
+
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
|
|
74
|
+
const localVarHeaderParameter = {};
|
|
75
|
+
const localVarQueryParameter = {};
|
|
76
|
+
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
77
|
+
(0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
|
|
78
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
79
|
+
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
80
|
+
localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(body, localVarRequestOptions, configuration);
|
|
81
|
+
return {
|
|
82
|
+
url: (0, common_1.toPathString)(localVarUrlObj),
|
|
83
|
+
options: localVarRequestOptions,
|
|
84
|
+
};
|
|
85
|
+
},
|
|
86
|
+
/**
|
|
87
|
+
* Returns the details of a selling partner\'s replenishment program offers. Note that this operation only supports sellers at this time. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 1 | 1 | The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
|
|
88
|
+
* @param {ListOffersRequest} [body]
|
|
89
|
+
* @param {*} [options] Override http request option.
|
|
90
|
+
* @throws {RequiredError}
|
|
91
|
+
*/
|
|
92
|
+
listOffers: async (body, options = {}) => {
|
|
93
|
+
const localVarPath = `/replenishment/2022-11-07/offers/search`;
|
|
94
|
+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
95
|
+
const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
|
|
96
|
+
let baseOptions;
|
|
97
|
+
if (configuration) {
|
|
98
|
+
baseOptions = configuration.baseOptions;
|
|
99
|
+
}
|
|
100
|
+
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
|
|
101
|
+
const localVarHeaderParameter = {};
|
|
102
|
+
const localVarQueryParameter = {};
|
|
103
|
+
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
104
|
+
(0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
|
|
105
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
106
|
+
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
107
|
+
localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(body, localVarRequestOptions, configuration);
|
|
108
|
+
return {
|
|
109
|
+
url: (0, common_1.toPathString)(localVarUrlObj),
|
|
110
|
+
options: localVarRequestOptions,
|
|
111
|
+
};
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
exports.OffersApiAxiosParamCreator = OffersApiAxiosParamCreator;
|
|
116
|
+
/**
|
|
117
|
+
* OffersApi - functional programming interface
|
|
118
|
+
* @export
|
|
119
|
+
*/
|
|
120
|
+
const OffersApiFp = function (configuration) {
|
|
121
|
+
const localVarAxiosParamCreator = (0, exports.OffersApiAxiosParamCreator)(configuration);
|
|
122
|
+
return {
|
|
123
|
+
/**
|
|
124
|
+
* Returns aggregated replenishment program metrics for a selling partner. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 1 | 1 | The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
|
|
125
|
+
* @param {GetSellingPartnerMetricsRequest} [body]
|
|
126
|
+
* @param {*} [options] Override http request option.
|
|
127
|
+
* @throws {RequiredError}
|
|
128
|
+
*/
|
|
129
|
+
async getSellingPartnerMetrics(body, options) {
|
|
130
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.getSellingPartnerMetrics(body, options);
|
|
131
|
+
return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
|
|
132
|
+
},
|
|
133
|
+
/**
|
|
134
|
+
* Returns aggregated replenishment program metrics for a selling partner\'s offers. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 1 | 1 | The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
|
|
135
|
+
* @param {ListOfferMetricsRequest} [body] The request body for the `listOfferMetrics` operation.
|
|
136
|
+
* @param {*} [options] Override http request option.
|
|
137
|
+
* @throws {RequiredError}
|
|
138
|
+
*/
|
|
139
|
+
async listOfferMetrics(body, options) {
|
|
140
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.listOfferMetrics(body, options);
|
|
141
|
+
return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
|
|
142
|
+
},
|
|
143
|
+
/**
|
|
144
|
+
* Returns the details of a selling partner\'s replenishment program offers. Note that this operation only supports sellers at this time. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 1 | 1 | The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
|
|
145
|
+
* @param {ListOffersRequest} [body]
|
|
146
|
+
* @param {*} [options] Override http request option.
|
|
147
|
+
* @throws {RequiredError}
|
|
148
|
+
*/
|
|
149
|
+
async listOffers(body, options) {
|
|
150
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.listOffers(body, options);
|
|
151
|
+
return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
|
|
152
|
+
},
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
exports.OffersApiFp = OffersApiFp;
|
|
156
|
+
/**
|
|
157
|
+
* OffersApi - factory interface
|
|
158
|
+
* @export
|
|
159
|
+
*/
|
|
160
|
+
const OffersApiFactory = function (configuration, basePath, axios) {
|
|
161
|
+
const localVarFp = (0, exports.OffersApiFp)(configuration);
|
|
162
|
+
return {
|
|
163
|
+
/**
|
|
164
|
+
* Returns aggregated replenishment program metrics for a selling partner. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 1 | 1 | The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
|
|
165
|
+
* @param {OffersApiGetSellingPartnerMetricsRequest} requestParameters Request parameters.
|
|
166
|
+
* @param {*} [options] Override http request option.
|
|
167
|
+
* @throws {RequiredError}
|
|
168
|
+
*/
|
|
169
|
+
getSellingPartnerMetrics(requestParameters = {}, options) {
|
|
170
|
+
return localVarFp.getSellingPartnerMetrics(requestParameters.body, options).then((request) => request(axios, basePath));
|
|
171
|
+
},
|
|
172
|
+
/**
|
|
173
|
+
* Returns aggregated replenishment program metrics for a selling partner\'s offers. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 1 | 1 | The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
|
|
174
|
+
* @param {OffersApiListOfferMetricsRequest} requestParameters Request parameters.
|
|
175
|
+
* @param {*} [options] Override http request option.
|
|
176
|
+
* @throws {RequiredError}
|
|
177
|
+
*/
|
|
178
|
+
listOfferMetrics(requestParameters = {}, options) {
|
|
179
|
+
return localVarFp.listOfferMetrics(requestParameters.body, options).then((request) => request(axios, basePath));
|
|
180
|
+
},
|
|
181
|
+
/**
|
|
182
|
+
* Returns the details of a selling partner\'s replenishment program offers. Note that this operation only supports sellers at this time. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 1 | 1 | The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
|
|
183
|
+
* @param {OffersApiListOffersRequest} requestParameters Request parameters.
|
|
184
|
+
* @param {*} [options] Override http request option.
|
|
185
|
+
* @throws {RequiredError}
|
|
186
|
+
*/
|
|
187
|
+
listOffers(requestParameters = {}, options) {
|
|
188
|
+
return localVarFp.listOffers(requestParameters.body, options).then((request) => request(axios, basePath));
|
|
189
|
+
},
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
exports.OffersApiFactory = OffersApiFactory;
|
|
193
|
+
/**
|
|
194
|
+
* OffersApi - object-oriented interface
|
|
195
|
+
* @export
|
|
196
|
+
* @class OffersApi
|
|
197
|
+
* @extends {BaseAPI}
|
|
198
|
+
*/
|
|
199
|
+
class OffersApi extends base_1.BaseAPI {
|
|
200
|
+
/**
|
|
201
|
+
* Returns aggregated replenishment program metrics for a selling partner. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 1 | 1 | The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
|
|
202
|
+
* @param {OffersApiGetSellingPartnerMetricsRequest} requestParameters Request parameters.
|
|
203
|
+
* @param {*} [options] Override http request option.
|
|
204
|
+
* @throws {RequiredError}
|
|
205
|
+
* @memberof OffersApi
|
|
206
|
+
*/
|
|
207
|
+
getSellingPartnerMetrics(requestParameters = {}, options) {
|
|
208
|
+
return (0, exports.OffersApiFp)(this.configuration).getSellingPartnerMetrics(requestParameters.body, options).then((request) => request(this.axios, this.basePath));
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Returns aggregated replenishment program metrics for a selling partner\'s offers. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 1 | 1 | The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
|
|
212
|
+
* @param {OffersApiListOfferMetricsRequest} requestParameters Request parameters.
|
|
213
|
+
* @param {*} [options] Override http request option.
|
|
214
|
+
* @throws {RequiredError}
|
|
215
|
+
* @memberof OffersApi
|
|
216
|
+
*/
|
|
217
|
+
listOfferMetrics(requestParameters = {}, options) {
|
|
218
|
+
return (0, exports.OffersApiFp)(this.configuration).listOfferMetrics(requestParameters.body, options).then((request) => request(this.axios, this.basePath));
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Returns the details of a selling partner\'s replenishment program offers. Note that this operation only supports sellers at this time. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 1 | 1 | The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
|
|
222
|
+
* @param {OffersApiListOffersRequest} requestParameters Request parameters.
|
|
223
|
+
* @param {*} [options] Override http request option.
|
|
224
|
+
* @throws {RequiredError}
|
|
225
|
+
* @memberof OffersApi
|
|
226
|
+
*/
|
|
227
|
+
listOffers(requestParameters = {}, options) {
|
|
228
|
+
return (0, exports.OffersApiFp)(this.configuration).listOffers(requestParameters.body, options).then((request) => request(this.axios, this.basePath));
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
exports.OffersApi = OffersApi;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
/**
|
|
5
|
+
* Selling Partner API for Replenishment
|
|
6
|
+
* The Selling Partner API for Replenishment (Replenishment API) provides programmatic access to replenishment program metrics and offers. These programs provide recurring delivery (automatic or manual) of any replenishable item at a frequency chosen by the customer.
|
|
7
|
+
*
|
|
8
|
+
* The version of the OpenAPI document: 2022-11-07
|
|
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
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
18
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
19
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
20
|
+
}
|
|
21
|
+
Object.defineProperty(o, k2, desc);
|
|
22
|
+
}) : (function(o, m, k, k2) {
|
|
23
|
+
if (k2 === undefined) k2 = k;
|
|
24
|
+
o[k2] = m[k];
|
|
25
|
+
}));
|
|
26
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
27
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
28
|
+
};
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
__exportStar(require("./api/offers-api"), exports);
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
/**
|
|
5
|
+
* Selling Partner API for Replenishment
|
|
6
|
+
* The Selling Partner API for Replenishment (Replenishment API) provides programmatic access to replenishment program metrics and offers. These programs provide recurring delivery (automatic or manual) of any replenishable item at a frequency chosen by the customer.
|
|
7
|
+
*
|
|
8
|
+
* The version of the OpenAPI document: 2022-11-07
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
16
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
17
|
+
};
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.RequiredError = exports.BaseAPI = exports.COLLECTION_FORMATS = exports.BASE_PATH = void 0;
|
|
20
|
+
const axios_1 = __importDefault(require("axios"));
|
|
21
|
+
exports.BASE_PATH = "https://sellingpartnerapi-na.amazon.com".replace(/\/+$/, "");
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* @export
|
|
25
|
+
*/
|
|
26
|
+
exports.COLLECTION_FORMATS = {
|
|
27
|
+
csv: ",",
|
|
28
|
+
ssv: " ",
|
|
29
|
+
tsv: "\t",
|
|
30
|
+
pipes: "|",
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
*
|
|
34
|
+
* @export
|
|
35
|
+
* @class BaseAPI
|
|
36
|
+
*/
|
|
37
|
+
class BaseAPI {
|
|
38
|
+
basePath;
|
|
39
|
+
axios;
|
|
40
|
+
configuration;
|
|
41
|
+
constructor(configuration, basePath = exports.BASE_PATH, axios = axios_1.default) {
|
|
42
|
+
this.basePath = basePath;
|
|
43
|
+
this.axios = axios;
|
|
44
|
+
if (configuration) {
|
|
45
|
+
this.configuration = configuration;
|
|
46
|
+
this.basePath = configuration.basePath || this.basePath;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.BaseAPI = BaseAPI;
|
|
51
|
+
;
|
|
52
|
+
/**
|
|
53
|
+
*
|
|
54
|
+
* @export
|
|
55
|
+
* @class RequiredError
|
|
56
|
+
* @extends {Error}
|
|
57
|
+
*/
|
|
58
|
+
class RequiredError extends Error {
|
|
59
|
+
field;
|
|
60
|
+
constructor(field, msg) {
|
|
61
|
+
super(msg);
|
|
62
|
+
this.field = field;
|
|
63
|
+
this.name = "RequiredError";
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.RequiredError = RequiredError;
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
/**
|
|
5
|
+
* Selling Partner API for Replenishment
|
|
6
|
+
* The Selling Partner API for Replenishment (Replenishment API) provides programmatic access to replenishment program metrics and offers. These programs provide recurring delivery (automatic or manual) of any replenishable item at a frequency chosen by the customer.
|
|
7
|
+
*
|
|
8
|
+
* The version of the OpenAPI document: 2022-11-07
|
|
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.createRequestFunction = exports.toPathString = exports.serializeDataIfNeeded = exports.setSearchParams = exports.setOAuthToObject = exports.setBearerAuthToObject = exports.setBasicAuthToObject = exports.setApiKeyToObject = exports.assertParamExists = exports.DUMMY_BASE_URL = void 0;
|
|
17
|
+
const base_1 = require("./base");
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @export
|
|
21
|
+
*/
|
|
22
|
+
exports.DUMMY_BASE_URL = 'https://example.com';
|
|
23
|
+
/**
|
|
24
|
+
*
|
|
25
|
+
* @throws {RequiredError}
|
|
26
|
+
* @export
|
|
27
|
+
*/
|
|
28
|
+
const assertParamExists = function (functionName, paramName, paramValue) {
|
|
29
|
+
if (paramValue === null || paramValue === undefined) {
|
|
30
|
+
throw new base_1.RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
exports.assertParamExists = assertParamExists;
|
|
34
|
+
/**
|
|
35
|
+
*
|
|
36
|
+
* @export
|
|
37
|
+
*/
|
|
38
|
+
const setApiKeyToObject = async function (object, keyParamName, configuration) {
|
|
39
|
+
if (configuration && configuration.apiKey) {
|
|
40
|
+
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
|
|
41
|
+
? await configuration.apiKey(keyParamName)
|
|
42
|
+
: await configuration.apiKey;
|
|
43
|
+
object[keyParamName] = localVarApiKeyValue;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
exports.setApiKeyToObject = setApiKeyToObject;
|
|
47
|
+
/**
|
|
48
|
+
*
|
|
49
|
+
* @export
|
|
50
|
+
*/
|
|
51
|
+
const setBasicAuthToObject = function (object, configuration) {
|
|
52
|
+
if (configuration && (configuration.username || configuration.password)) {
|
|
53
|
+
object["auth"] = { username: configuration.username, password: configuration.password };
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
exports.setBasicAuthToObject = setBasicAuthToObject;
|
|
57
|
+
/**
|
|
58
|
+
*
|
|
59
|
+
* @export
|
|
60
|
+
*/
|
|
61
|
+
const setBearerAuthToObject = async function (object, configuration) {
|
|
62
|
+
if (configuration && configuration.accessToken) {
|
|
63
|
+
const accessToken = typeof configuration.accessToken === 'function'
|
|
64
|
+
? await configuration.accessToken()
|
|
65
|
+
: await configuration.accessToken;
|
|
66
|
+
object["Authorization"] = "Bearer " + accessToken;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
exports.setBearerAuthToObject = setBearerAuthToObject;
|
|
70
|
+
/**
|
|
71
|
+
*
|
|
72
|
+
* @export
|
|
73
|
+
*/
|
|
74
|
+
const setOAuthToObject = async function (object, name, scopes, configuration) {
|
|
75
|
+
if (configuration && configuration.accessToken) {
|
|
76
|
+
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
|
|
77
|
+
? await configuration.accessToken(name, scopes)
|
|
78
|
+
: await configuration.accessToken;
|
|
79
|
+
object["Authorization"] = "Bearer " + localVarAccessTokenValue;
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
exports.setOAuthToObject = setOAuthToObject;
|
|
83
|
+
function setFlattenedQueryParams(urlSearchParams, parameter, key = "") {
|
|
84
|
+
if (parameter == null)
|
|
85
|
+
return;
|
|
86
|
+
if (typeof parameter === "object") {
|
|
87
|
+
if (Array.isArray(parameter)) {
|
|
88
|
+
parameter.forEach(item => setFlattenedQueryParams(urlSearchParams, item, key));
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
Object.keys(parameter).forEach(currentKey => setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`));
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
if (urlSearchParams.has(key)) {
|
|
96
|
+
urlSearchParams.append(key, parameter);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
urlSearchParams.set(key, parameter);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
*
|
|
105
|
+
* @export
|
|
106
|
+
*/
|
|
107
|
+
const setSearchParams = function (url, ...objects) {
|
|
108
|
+
const searchParams = new URLSearchParams(url.search);
|
|
109
|
+
setFlattenedQueryParams(searchParams, objects);
|
|
110
|
+
url.search = searchParams.toString();
|
|
111
|
+
};
|
|
112
|
+
exports.setSearchParams = setSearchParams;
|
|
113
|
+
/**
|
|
114
|
+
*
|
|
115
|
+
* @export
|
|
116
|
+
*/
|
|
117
|
+
const serializeDataIfNeeded = function (value, requestOptions, configuration) {
|
|
118
|
+
const nonString = typeof value !== 'string';
|
|
119
|
+
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
|
120
|
+
? configuration.isJsonMime(requestOptions.headers['Content-Type'])
|
|
121
|
+
: nonString;
|
|
122
|
+
return needsSerialization
|
|
123
|
+
? JSON.stringify(value !== undefined ? value : {})
|
|
124
|
+
: (value || "");
|
|
125
|
+
};
|
|
126
|
+
exports.serializeDataIfNeeded = serializeDataIfNeeded;
|
|
127
|
+
/**
|
|
128
|
+
*
|
|
129
|
+
* @export
|
|
130
|
+
*/
|
|
131
|
+
const toPathString = function (url) {
|
|
132
|
+
return url.pathname + url.search + url.hash;
|
|
133
|
+
};
|
|
134
|
+
exports.toPathString = toPathString;
|
|
135
|
+
/**
|
|
136
|
+
*
|
|
137
|
+
* @export
|
|
138
|
+
*/
|
|
139
|
+
const createRequestFunction = function (axiosArgs, globalAxios, BASE_PATH, configuration) {
|
|
140
|
+
return (axios = globalAxios, basePath = BASE_PATH) => {
|
|
141
|
+
const axiosRequestArgs = { ...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url };
|
|
142
|
+
return axios.request(axiosRequestArgs);
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
exports.createRequestFunction = createRequestFunction;
|