@sp-api-sdk/data-kiosk-api-2023-11-15 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 +97 -0
- package/dist/cjs/index.js +18 -0
- package/dist/cjs/src/api-model/api/queries-api.js +373 -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/create-query-response.js +15 -0
- package/dist/cjs/src/api-model/models/create-query-specification.js +15 -0
- package/dist/cjs/src/api-model/models/error-list.js +15 -0
- package/dist/cjs/src/api-model/models/get-document-response.js +15 -0
- package/dist/cjs/src/api-model/models/get-queries-response-pagination.js +15 -0
- package/dist/cjs/src/api-model/models/get-queries-response.js +15 -0
- package/dist/cjs/src/api-model/models/index.js +25 -0
- package/dist/cjs/src/api-model/models/model-error.js +15 -0
- package/dist/cjs/src/api-model/models/query-pagination.js +15 -0
- package/dist/cjs/src/api-model/models/query.js +23 -0
- package/dist/cjs/src/client.js +49 -0
- package/dist/es/index.js +2 -0
- package/dist/es/src/api-model/api/queries-api.js +363 -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/create-query-response.js +14 -0
- package/dist/es/src/api-model/models/create-query-specification.js +14 -0
- package/dist/es/src/api-model/models/error-list.js +14 -0
- package/dist/es/src/api-model/models/get-document-response.js +14 -0
- package/dist/es/src/api-model/models/get-queries-response-pagination.js +14 -0
- package/dist/es/src/api-model/models/get-queries-response.js +14 -0
- package/dist/es/src/api-model/models/index.js +9 -0
- package/dist/es/src/api-model/models/model-error.js +14 -0
- package/dist/es/src/api-model/models/query-pagination.js +14 -0
- package/dist/es/src/api-model/models/query.js +20 -0
- package/dist/es/src/client.js +45 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/src/api-model/api/queries-api.d.ts +287 -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/create-query-response.d.ts +24 -0
- package/dist/types/src/api-model/models/create-query-specification.d.ts +30 -0
- package/dist/types/src/api-model/models/error-list.d.ts +24 -0
- package/dist/types/src/api-model/models/get-document-response.d.ts +30 -0
- package/dist/types/src/api-model/models/get-queries-response-pagination.d.ts +24 -0
- package/dist/types/src/api-model/models/get-queries-response.d.ts +32 -0
- package/dist/types/src/api-model/models/index.d.ts +9 -0
- package/dist/types/src/api-model/models/model-error.d.ts +36 -0
- package/dist/types/src/api-model/models/query-pagination.d.ts +24 -0
- package/dist/types/src/api-model/models/query.d.ts +81 -0
- package/dist/types/src/client.d.ts +6 -0
- package/package.json +44 -0
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Selling Partner API for Data Kiosk
|
|
5
|
+
* The Selling Partner API for Data Kiosk lets you submit GraphQL queries from a variety of schemas to help selling partners manage their businesses.
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 2023-11-15
|
|
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
|
+
import globalAxios from 'axios';
|
|
15
|
+
// Some imports not used depending on template conditions
|
|
16
|
+
// @ts-ignore
|
|
17
|
+
import { DUMMY_BASE_URL, assertParamExists, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common';
|
|
18
|
+
// @ts-ignore
|
|
19
|
+
import { BASE_PATH, COLLECTION_FORMATS, BaseAPI } from '../base';
|
|
20
|
+
/**
|
|
21
|
+
* QueriesApi - axios parameter creator
|
|
22
|
+
* @export
|
|
23
|
+
*/
|
|
24
|
+
export const QueriesApiAxiosParamCreator = function (configuration) {
|
|
25
|
+
return {
|
|
26
|
+
/**
|
|
27
|
+
* Cancels the query specified by the `queryId` parameter. Only queries with a non-terminal `processingStatus` (`IN_QUEUE`, `IN_PROGRESS`) can be cancelled. Cancelling a query that already has a `processingStatus` of `CANCELLED` will no-op. Cancelled queries are returned in subsequent calls to the `getQuery` and `getQueries` operations. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 | 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, refer to [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).
|
|
28
|
+
* @param {string} queryId The identifier for the query. This identifier is unique only in combination with a selling partner account ID.
|
|
29
|
+
* @param {*} [options] Override http request option.
|
|
30
|
+
* @throws {RequiredError}
|
|
31
|
+
*/
|
|
32
|
+
cancelQuery: async (queryId, options = {}) => {
|
|
33
|
+
// verify required parameter 'queryId' is not null or undefined
|
|
34
|
+
assertParamExists('cancelQuery', 'queryId', queryId);
|
|
35
|
+
const localVarPath = `/dataKiosk/2023-11-15/queries/{queryId}`
|
|
36
|
+
.replace(`{${"queryId"}}`, encodeURIComponent(String(queryId)));
|
|
37
|
+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
38
|
+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
39
|
+
let baseOptions;
|
|
40
|
+
if (configuration) {
|
|
41
|
+
baseOptions = configuration.baseOptions;
|
|
42
|
+
}
|
|
43
|
+
const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options };
|
|
44
|
+
const localVarHeaderParameter = {};
|
|
45
|
+
const localVarQueryParameter = {};
|
|
46
|
+
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
47
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
48
|
+
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
49
|
+
return {
|
|
50
|
+
url: toPathString(localVarUrlObj),
|
|
51
|
+
options: localVarRequestOptions,
|
|
52
|
+
};
|
|
53
|
+
},
|
|
54
|
+
/**
|
|
55
|
+
* Creates a Data Kiosk query request. **Note:** The retention of a query varies based on the fields requested. Each field within a schema is annotated with a `@resultRetention` directive that defines how long a query containing that field will be retained. When a query contains multiple fields with different retentions, the shortest (minimum) retention is applied. The retention of a query\'s resulting documents always matches the retention of the query. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0167 | 15 | 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, refer to [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).
|
|
56
|
+
* @param {CreateQuerySpecification} body
|
|
57
|
+
* @param {*} [options] Override http request option.
|
|
58
|
+
* @throws {RequiredError}
|
|
59
|
+
*/
|
|
60
|
+
createQuery: async (body, options = {}) => {
|
|
61
|
+
// verify required parameter 'body' is not null or undefined
|
|
62
|
+
assertParamExists('createQuery', 'body', body);
|
|
63
|
+
const localVarPath = `/dataKiosk/2023-11-15/queries`;
|
|
64
|
+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
65
|
+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
66
|
+
let baseOptions;
|
|
67
|
+
if (configuration) {
|
|
68
|
+
baseOptions = configuration.baseOptions;
|
|
69
|
+
}
|
|
70
|
+
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
|
|
71
|
+
const localVarHeaderParameter = {};
|
|
72
|
+
const localVarQueryParameter = {};
|
|
73
|
+
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
74
|
+
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
75
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
76
|
+
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
77
|
+
localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration);
|
|
78
|
+
return {
|
|
79
|
+
url: toPathString(localVarUrlObj),
|
|
80
|
+
options: localVarRequestOptions,
|
|
81
|
+
};
|
|
82
|
+
},
|
|
83
|
+
/**
|
|
84
|
+
* Returns the information required for retrieving a Data Kiosk document\'s contents. See the `createQuery` operation for details about document retention. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0167 | 15 | 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, refer to [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).
|
|
85
|
+
* @param {string} documentId The identifier for the Data Kiosk document.
|
|
86
|
+
* @param {*} [options] Override http request option.
|
|
87
|
+
* @throws {RequiredError}
|
|
88
|
+
*/
|
|
89
|
+
getDocument: async (documentId, options = {}) => {
|
|
90
|
+
// verify required parameter 'documentId' is not null or undefined
|
|
91
|
+
assertParamExists('getDocument', 'documentId', documentId);
|
|
92
|
+
const localVarPath = `/dataKiosk/2023-11-15/documents/{documentId}`
|
|
93
|
+
.replace(`{${"documentId"}}`, encodeURIComponent(String(documentId)));
|
|
94
|
+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
95
|
+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
96
|
+
let baseOptions;
|
|
97
|
+
if (configuration) {
|
|
98
|
+
baseOptions = configuration.baseOptions;
|
|
99
|
+
}
|
|
100
|
+
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
|
|
101
|
+
const localVarHeaderParameter = {};
|
|
102
|
+
const localVarQueryParameter = {};
|
|
103
|
+
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
104
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
105
|
+
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
106
|
+
return {
|
|
107
|
+
url: toPathString(localVarUrlObj),
|
|
108
|
+
options: localVarRequestOptions,
|
|
109
|
+
};
|
|
110
|
+
},
|
|
111
|
+
/**
|
|
112
|
+
* Returns details for the Data Kiosk queries that match the specified filters. See the `createQuery` operation for details about query retention. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 | 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, refer to [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).
|
|
113
|
+
* @param {Array<'CANCELLED' | 'DONE' | 'FATAL' | 'IN_PROGRESS' | 'IN_QUEUE'>} [processingStatuses] A list of processing statuses used to filter queries.
|
|
114
|
+
* @param {number} [pageSize] The maximum number of queries to return in a single call.
|
|
115
|
+
* @param {string} [createdSince] The earliest query creation date and time for queries to include in the response, in ISO 8601 date time format. The default is 90 days ago.
|
|
116
|
+
* @param {string} [createdUntil] The latest query creation date and time for queries to include in the response, in ISO 8601 date time format. The default is the time of the `getQueries` request.
|
|
117
|
+
* @param {string} [paginationToken] A token to fetch a certain page of results when there are multiple pages of results available. The value of this token is fetched from the `pagination.nextToken` field returned in the `GetQueriesResponse` object. All other parameters must be provided with the same values that were provided with the request that generated this token, with the exception of `pageSize` which can be modified between calls to `getQueries`. In the absence of this token value, `getQueries` returns the first page of results.
|
|
118
|
+
* @param {*} [options] Override http request option.
|
|
119
|
+
* @throws {RequiredError}
|
|
120
|
+
*/
|
|
121
|
+
getQueries: async (processingStatuses, pageSize, createdSince, createdUntil, paginationToken, options = {}) => {
|
|
122
|
+
const localVarPath = `/dataKiosk/2023-11-15/queries`;
|
|
123
|
+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
124
|
+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
125
|
+
let baseOptions;
|
|
126
|
+
if (configuration) {
|
|
127
|
+
baseOptions = configuration.baseOptions;
|
|
128
|
+
}
|
|
129
|
+
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
|
|
130
|
+
const localVarHeaderParameter = {};
|
|
131
|
+
const localVarQueryParameter = {};
|
|
132
|
+
if (processingStatuses) {
|
|
133
|
+
localVarQueryParameter['processingStatuses'] = processingStatuses.join(COLLECTION_FORMATS.csv);
|
|
134
|
+
}
|
|
135
|
+
if (pageSize !== undefined) {
|
|
136
|
+
localVarQueryParameter['pageSize'] = pageSize;
|
|
137
|
+
}
|
|
138
|
+
if (createdSince !== undefined) {
|
|
139
|
+
localVarQueryParameter['createdSince'] = (createdSince instanceof Date) ?
|
|
140
|
+
createdSince.toISOString() :
|
|
141
|
+
createdSince;
|
|
142
|
+
}
|
|
143
|
+
if (createdUntil !== undefined) {
|
|
144
|
+
localVarQueryParameter['createdUntil'] = (createdUntil instanceof Date) ?
|
|
145
|
+
createdUntil.toISOString() :
|
|
146
|
+
createdUntil;
|
|
147
|
+
}
|
|
148
|
+
if (paginationToken !== undefined) {
|
|
149
|
+
localVarQueryParameter['paginationToken'] = paginationToken;
|
|
150
|
+
}
|
|
151
|
+
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
152
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
153
|
+
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
154
|
+
return {
|
|
155
|
+
url: toPathString(localVarUrlObj),
|
|
156
|
+
options: localVarRequestOptions,
|
|
157
|
+
};
|
|
158
|
+
},
|
|
159
|
+
/**
|
|
160
|
+
* Returns query details for the query specified by the `queryId` parameter. See the `createQuery` operation for details about query retention. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 2.0 | 15 | 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, refer to [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).
|
|
161
|
+
* @param {string} queryId The query identifier.
|
|
162
|
+
* @param {*} [options] Override http request option.
|
|
163
|
+
* @throws {RequiredError}
|
|
164
|
+
*/
|
|
165
|
+
getQuery: async (queryId, options = {}) => {
|
|
166
|
+
// verify required parameter 'queryId' is not null or undefined
|
|
167
|
+
assertParamExists('getQuery', 'queryId', queryId);
|
|
168
|
+
const localVarPath = `/dataKiosk/2023-11-15/queries/{queryId}`
|
|
169
|
+
.replace(`{${"queryId"}}`, encodeURIComponent(String(queryId)));
|
|
170
|
+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
171
|
+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
172
|
+
let baseOptions;
|
|
173
|
+
if (configuration) {
|
|
174
|
+
baseOptions = configuration.baseOptions;
|
|
175
|
+
}
|
|
176
|
+
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
|
|
177
|
+
const localVarHeaderParameter = {};
|
|
178
|
+
const localVarQueryParameter = {};
|
|
179
|
+
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
180
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
181
|
+
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
182
|
+
return {
|
|
183
|
+
url: toPathString(localVarUrlObj),
|
|
184
|
+
options: localVarRequestOptions,
|
|
185
|
+
};
|
|
186
|
+
},
|
|
187
|
+
};
|
|
188
|
+
};
|
|
189
|
+
/**
|
|
190
|
+
* QueriesApi - functional programming interface
|
|
191
|
+
* @export
|
|
192
|
+
*/
|
|
193
|
+
export const QueriesApiFp = function (configuration) {
|
|
194
|
+
const localVarAxiosParamCreator = QueriesApiAxiosParamCreator(configuration);
|
|
195
|
+
return {
|
|
196
|
+
/**
|
|
197
|
+
* Cancels the query specified by the `queryId` parameter. Only queries with a non-terminal `processingStatus` (`IN_QUEUE`, `IN_PROGRESS`) can be cancelled. Cancelling a query that already has a `processingStatus` of `CANCELLED` will no-op. Cancelled queries are returned in subsequent calls to the `getQuery` and `getQueries` operations. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 | 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, refer to [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).
|
|
198
|
+
* @param {string} queryId The identifier for the query. This identifier is unique only in combination with a selling partner account ID.
|
|
199
|
+
* @param {*} [options] Override http request option.
|
|
200
|
+
* @throws {RequiredError}
|
|
201
|
+
*/
|
|
202
|
+
async cancelQuery(queryId, options) {
|
|
203
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.cancelQuery(queryId, options);
|
|
204
|
+
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
|
205
|
+
},
|
|
206
|
+
/**
|
|
207
|
+
* Creates a Data Kiosk query request. **Note:** The retention of a query varies based on the fields requested. Each field within a schema is annotated with a `@resultRetention` directive that defines how long a query containing that field will be retained. When a query contains multiple fields with different retentions, the shortest (minimum) retention is applied. The retention of a query\'s resulting documents always matches the retention of the query. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0167 | 15 | 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, refer to [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).
|
|
208
|
+
* @param {CreateQuerySpecification} body
|
|
209
|
+
* @param {*} [options] Override http request option.
|
|
210
|
+
* @throws {RequiredError}
|
|
211
|
+
*/
|
|
212
|
+
async createQuery(body, options) {
|
|
213
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.createQuery(body, options);
|
|
214
|
+
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
|
215
|
+
},
|
|
216
|
+
/**
|
|
217
|
+
* Returns the information required for retrieving a Data Kiosk document\'s contents. See the `createQuery` operation for details about document retention. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0167 | 15 | 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, refer to [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).
|
|
218
|
+
* @param {string} documentId The identifier for the Data Kiosk document.
|
|
219
|
+
* @param {*} [options] Override http request option.
|
|
220
|
+
* @throws {RequiredError}
|
|
221
|
+
*/
|
|
222
|
+
async getDocument(documentId, options) {
|
|
223
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.getDocument(documentId, options);
|
|
224
|
+
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
|
225
|
+
},
|
|
226
|
+
/**
|
|
227
|
+
* Returns details for the Data Kiosk queries that match the specified filters. See the `createQuery` operation for details about query retention. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 | 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, refer to [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).
|
|
228
|
+
* @param {Array<'CANCELLED' | 'DONE' | 'FATAL' | 'IN_PROGRESS' | 'IN_QUEUE'>} [processingStatuses] A list of processing statuses used to filter queries.
|
|
229
|
+
* @param {number} [pageSize] The maximum number of queries to return in a single call.
|
|
230
|
+
* @param {string} [createdSince] The earliest query creation date and time for queries to include in the response, in ISO 8601 date time format. The default is 90 days ago.
|
|
231
|
+
* @param {string} [createdUntil] The latest query creation date and time for queries to include in the response, in ISO 8601 date time format. The default is the time of the `getQueries` request.
|
|
232
|
+
* @param {string} [paginationToken] A token to fetch a certain page of results when there are multiple pages of results available. The value of this token is fetched from the `pagination.nextToken` field returned in the `GetQueriesResponse` object. All other parameters must be provided with the same values that were provided with the request that generated this token, with the exception of `pageSize` which can be modified between calls to `getQueries`. In the absence of this token value, `getQueries` returns the first page of results.
|
|
233
|
+
* @param {*} [options] Override http request option.
|
|
234
|
+
* @throws {RequiredError}
|
|
235
|
+
*/
|
|
236
|
+
async getQueries(processingStatuses, pageSize, createdSince, createdUntil, paginationToken, options) {
|
|
237
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.getQueries(processingStatuses, pageSize, createdSince, createdUntil, paginationToken, options);
|
|
238
|
+
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
|
239
|
+
},
|
|
240
|
+
/**
|
|
241
|
+
* Returns query details for the query specified by the `queryId` parameter. See the `createQuery` operation for details about query retention. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 2.0 | 15 | 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, refer to [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).
|
|
242
|
+
* @param {string} queryId The query identifier.
|
|
243
|
+
* @param {*} [options] Override http request option.
|
|
244
|
+
* @throws {RequiredError}
|
|
245
|
+
*/
|
|
246
|
+
async getQuery(queryId, options) {
|
|
247
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.getQuery(queryId, options);
|
|
248
|
+
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
|
249
|
+
},
|
|
250
|
+
};
|
|
251
|
+
};
|
|
252
|
+
/**
|
|
253
|
+
* QueriesApi - factory interface
|
|
254
|
+
* @export
|
|
255
|
+
*/
|
|
256
|
+
export const QueriesApiFactory = function (configuration, basePath, axios) {
|
|
257
|
+
const localVarFp = QueriesApiFp(configuration);
|
|
258
|
+
return {
|
|
259
|
+
/**
|
|
260
|
+
* Cancels the query specified by the `queryId` parameter. Only queries with a non-terminal `processingStatus` (`IN_QUEUE`, `IN_PROGRESS`) can be cancelled. Cancelling a query that already has a `processingStatus` of `CANCELLED` will no-op. Cancelled queries are returned in subsequent calls to the `getQuery` and `getQueries` operations. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 | 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, refer to [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).
|
|
261
|
+
* @param {QueriesApiCancelQueryRequest} requestParameters Request parameters.
|
|
262
|
+
* @param {*} [options] Override http request option.
|
|
263
|
+
* @throws {RequiredError}
|
|
264
|
+
*/
|
|
265
|
+
cancelQuery(requestParameters, options) {
|
|
266
|
+
return localVarFp.cancelQuery(requestParameters.queryId, options).then((request) => request(axios, basePath));
|
|
267
|
+
},
|
|
268
|
+
/**
|
|
269
|
+
* Creates a Data Kiosk query request. **Note:** The retention of a query varies based on the fields requested. Each field within a schema is annotated with a `@resultRetention` directive that defines how long a query containing that field will be retained. When a query contains multiple fields with different retentions, the shortest (minimum) retention is applied. The retention of a query\'s resulting documents always matches the retention of the query. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0167 | 15 | 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, refer to [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).
|
|
270
|
+
* @param {QueriesApiCreateQueryRequest} requestParameters Request parameters.
|
|
271
|
+
* @param {*} [options] Override http request option.
|
|
272
|
+
* @throws {RequiredError}
|
|
273
|
+
*/
|
|
274
|
+
createQuery(requestParameters, options) {
|
|
275
|
+
return localVarFp.createQuery(requestParameters.body, options).then((request) => request(axios, basePath));
|
|
276
|
+
},
|
|
277
|
+
/**
|
|
278
|
+
* Returns the information required for retrieving a Data Kiosk document\'s contents. See the `createQuery` operation for details about document retention. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0167 | 15 | 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, refer to [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).
|
|
279
|
+
* @param {QueriesApiGetDocumentRequest} requestParameters Request parameters.
|
|
280
|
+
* @param {*} [options] Override http request option.
|
|
281
|
+
* @throws {RequiredError}
|
|
282
|
+
*/
|
|
283
|
+
getDocument(requestParameters, options) {
|
|
284
|
+
return localVarFp.getDocument(requestParameters.documentId, options).then((request) => request(axios, basePath));
|
|
285
|
+
},
|
|
286
|
+
/**
|
|
287
|
+
* Returns details for the Data Kiosk queries that match the specified filters. See the `createQuery` operation for details about query retention. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 | 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, refer to [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).
|
|
288
|
+
* @param {QueriesApiGetQueriesRequest} requestParameters Request parameters.
|
|
289
|
+
* @param {*} [options] Override http request option.
|
|
290
|
+
* @throws {RequiredError}
|
|
291
|
+
*/
|
|
292
|
+
getQueries(requestParameters = {}, options) {
|
|
293
|
+
return localVarFp.getQueries(requestParameters.processingStatuses, requestParameters.pageSize, requestParameters.createdSince, requestParameters.createdUntil, requestParameters.paginationToken, options).then((request) => request(axios, basePath));
|
|
294
|
+
},
|
|
295
|
+
/**
|
|
296
|
+
* Returns query details for the query specified by the `queryId` parameter. See the `createQuery` operation for details about query retention. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 2.0 | 15 | 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, refer to [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).
|
|
297
|
+
* @param {QueriesApiGetQueryRequest} requestParameters Request parameters.
|
|
298
|
+
* @param {*} [options] Override http request option.
|
|
299
|
+
* @throws {RequiredError}
|
|
300
|
+
*/
|
|
301
|
+
getQuery(requestParameters, options) {
|
|
302
|
+
return localVarFp.getQuery(requestParameters.queryId, options).then((request) => request(axios, basePath));
|
|
303
|
+
},
|
|
304
|
+
};
|
|
305
|
+
};
|
|
306
|
+
/**
|
|
307
|
+
* QueriesApi - object-oriented interface
|
|
308
|
+
* @export
|
|
309
|
+
* @class QueriesApi
|
|
310
|
+
* @extends {BaseAPI}
|
|
311
|
+
*/
|
|
312
|
+
export class QueriesApi extends BaseAPI {
|
|
313
|
+
/**
|
|
314
|
+
* Cancels the query specified by the `queryId` parameter. Only queries with a non-terminal `processingStatus` (`IN_QUEUE`, `IN_PROGRESS`) can be cancelled. Cancelling a query that already has a `processingStatus` of `CANCELLED` will no-op. Cancelled queries are returned in subsequent calls to the `getQuery` and `getQueries` operations. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 | 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, refer to [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).
|
|
315
|
+
* @param {QueriesApiCancelQueryRequest} requestParameters Request parameters.
|
|
316
|
+
* @param {*} [options] Override http request option.
|
|
317
|
+
* @throws {RequiredError}
|
|
318
|
+
* @memberof QueriesApi
|
|
319
|
+
*/
|
|
320
|
+
cancelQuery(requestParameters, options) {
|
|
321
|
+
return QueriesApiFp(this.configuration).cancelQuery(requestParameters.queryId, options).then((request) => request(this.axios, this.basePath));
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Creates a Data Kiosk query request. **Note:** The retention of a query varies based on the fields requested. Each field within a schema is annotated with a `@resultRetention` directive that defines how long a query containing that field will be retained. When a query contains multiple fields with different retentions, the shortest (minimum) retention is applied. The retention of a query\'s resulting documents always matches the retention of the query. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0167 | 15 | 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, refer to [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).
|
|
325
|
+
* @param {QueriesApiCreateQueryRequest} requestParameters Request parameters.
|
|
326
|
+
* @param {*} [options] Override http request option.
|
|
327
|
+
* @throws {RequiredError}
|
|
328
|
+
* @memberof QueriesApi
|
|
329
|
+
*/
|
|
330
|
+
createQuery(requestParameters, options) {
|
|
331
|
+
return QueriesApiFp(this.configuration).createQuery(requestParameters.body, options).then((request) => request(this.axios, this.basePath));
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Returns the information required for retrieving a Data Kiosk document\'s contents. See the `createQuery` operation for details about document retention. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0167 | 15 | 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, refer to [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).
|
|
335
|
+
* @param {QueriesApiGetDocumentRequest} requestParameters Request parameters.
|
|
336
|
+
* @param {*} [options] Override http request option.
|
|
337
|
+
* @throws {RequiredError}
|
|
338
|
+
* @memberof QueriesApi
|
|
339
|
+
*/
|
|
340
|
+
getDocument(requestParameters, options) {
|
|
341
|
+
return QueriesApiFp(this.configuration).getDocument(requestParameters.documentId, options).then((request) => request(this.axios, this.basePath));
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Returns details for the Data Kiosk queries that match the specified filters. See the `createQuery` operation for details about query retention. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 | 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, refer to [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).
|
|
345
|
+
* @param {QueriesApiGetQueriesRequest} requestParameters Request parameters.
|
|
346
|
+
* @param {*} [options] Override http request option.
|
|
347
|
+
* @throws {RequiredError}
|
|
348
|
+
* @memberof QueriesApi
|
|
349
|
+
*/
|
|
350
|
+
getQueries(requestParameters = {}, options) {
|
|
351
|
+
return QueriesApiFp(this.configuration).getQueries(requestParameters.processingStatuses, requestParameters.pageSize, requestParameters.createdSince, requestParameters.createdUntil, requestParameters.paginationToken, options).then((request) => request(this.axios, this.basePath));
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Returns query details for the query specified by the `queryId` parameter. See the `createQuery` operation for details about query retention. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 2.0 | 15 | 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, refer to [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).
|
|
355
|
+
* @param {QueriesApiGetQueryRequest} requestParameters Request parameters.
|
|
356
|
+
* @param {*} [options] Override http request option.
|
|
357
|
+
* @throws {RequiredError}
|
|
358
|
+
* @memberof QueriesApi
|
|
359
|
+
*/
|
|
360
|
+
getQuery(requestParameters, options) {
|
|
361
|
+
return QueriesApiFp(this.configuration).getQuery(requestParameters.queryId, options).then((request) => request(this.axios, this.basePath));
|
|
362
|
+
}
|
|
363
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Selling Partner API for Data Kiosk
|
|
5
|
+
* The Selling Partner API for Data Kiosk lets you submit GraphQL queries from a variety of schemas to help selling partners manage their businesses.
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 2023-11-15
|
|
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 * from './api/queries-api';
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Selling Partner API for Data Kiosk
|
|
5
|
+
* The Selling Partner API for Data Kiosk lets you submit GraphQL queries from a variety of schemas to help selling partners manage their businesses.
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 2023-11-15
|
|
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
|
+
import globalAxios from 'axios';
|
|
15
|
+
export const BASE_PATH = "https://sellingpartnerapi-na.amazon.com".replace(/\/+$/, "");
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
* @export
|
|
19
|
+
*/
|
|
20
|
+
export const COLLECTION_FORMATS = {
|
|
21
|
+
csv: ",",
|
|
22
|
+
ssv: " ",
|
|
23
|
+
tsv: "\t",
|
|
24
|
+
pipes: "|",
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
* @export
|
|
29
|
+
* @class BaseAPI
|
|
30
|
+
*/
|
|
31
|
+
export class BaseAPI {
|
|
32
|
+
basePath;
|
|
33
|
+
axios;
|
|
34
|
+
configuration;
|
|
35
|
+
constructor(configuration, basePath = BASE_PATH, axios = globalAxios) {
|
|
36
|
+
this.basePath = basePath;
|
|
37
|
+
this.axios = axios;
|
|
38
|
+
if (configuration) {
|
|
39
|
+
this.configuration = configuration;
|
|
40
|
+
this.basePath = configuration.basePath || this.basePath;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
;
|
|
45
|
+
/**
|
|
46
|
+
*
|
|
47
|
+
* @export
|
|
48
|
+
* @class RequiredError
|
|
49
|
+
* @extends {Error}
|
|
50
|
+
*/
|
|
51
|
+
export class RequiredError extends Error {
|
|
52
|
+
field;
|
|
53
|
+
constructor(field, msg) {
|
|
54
|
+
super(msg);
|
|
55
|
+
this.field = field;
|
|
56
|
+
this.name = "RequiredError";
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Selling Partner API for Data Kiosk
|
|
5
|
+
* The Selling Partner API for Data Kiosk lets you submit GraphQL queries from a variety of schemas to help selling partners manage their businesses.
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 2023-11-15
|
|
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
|
+
import { RequiredError } from "./base";
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
* @export
|
|
18
|
+
*/
|
|
19
|
+
export const DUMMY_BASE_URL = 'https://example.com';
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
* @throws {RequiredError}
|
|
23
|
+
* @export
|
|
24
|
+
*/
|
|
25
|
+
export const assertParamExists = function (functionName, paramName, paramValue) {
|
|
26
|
+
if (paramValue === null || paramValue === undefined) {
|
|
27
|
+
throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
*
|
|
32
|
+
* @export
|
|
33
|
+
*/
|
|
34
|
+
export const setApiKeyToObject = async function (object, keyParamName, configuration) {
|
|
35
|
+
if (configuration && configuration.apiKey) {
|
|
36
|
+
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
|
|
37
|
+
? await configuration.apiKey(keyParamName)
|
|
38
|
+
: await configuration.apiKey;
|
|
39
|
+
object[keyParamName] = localVarApiKeyValue;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
*
|
|
44
|
+
* @export
|
|
45
|
+
*/
|
|
46
|
+
export const setBasicAuthToObject = function (object, configuration) {
|
|
47
|
+
if (configuration && (configuration.username || configuration.password)) {
|
|
48
|
+
object["auth"] = { username: configuration.username, password: configuration.password };
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
*
|
|
53
|
+
* @export
|
|
54
|
+
*/
|
|
55
|
+
export const setBearerAuthToObject = async function (object, configuration) {
|
|
56
|
+
if (configuration && configuration.accessToken) {
|
|
57
|
+
const accessToken = typeof configuration.accessToken === 'function'
|
|
58
|
+
? await configuration.accessToken()
|
|
59
|
+
: await configuration.accessToken;
|
|
60
|
+
object["Authorization"] = "Bearer " + accessToken;
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
*
|
|
65
|
+
* @export
|
|
66
|
+
*/
|
|
67
|
+
export const setOAuthToObject = async function (object, name, scopes, configuration) {
|
|
68
|
+
if (configuration && configuration.accessToken) {
|
|
69
|
+
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
|
|
70
|
+
? await configuration.accessToken(name, scopes)
|
|
71
|
+
: await configuration.accessToken;
|
|
72
|
+
object["Authorization"] = "Bearer " + localVarAccessTokenValue;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
function setFlattenedQueryParams(urlSearchParams, parameter, key = "") {
|
|
76
|
+
if (parameter == null)
|
|
77
|
+
return;
|
|
78
|
+
if (typeof parameter === "object") {
|
|
79
|
+
if (Array.isArray(parameter)) {
|
|
80
|
+
parameter.forEach(item => setFlattenedQueryParams(urlSearchParams, item, key));
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
Object.keys(parameter).forEach(currentKey => setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`));
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
if (urlSearchParams.has(key)) {
|
|
88
|
+
urlSearchParams.append(key, parameter);
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
urlSearchParams.set(key, parameter);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
*
|
|
97
|
+
* @export
|
|
98
|
+
*/
|
|
99
|
+
export const setSearchParams = function (url, ...objects) {
|
|
100
|
+
const searchParams = new URLSearchParams(url.search);
|
|
101
|
+
setFlattenedQueryParams(searchParams, objects);
|
|
102
|
+
url.search = searchParams.toString();
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
*
|
|
106
|
+
* @export
|
|
107
|
+
*/
|
|
108
|
+
export const serializeDataIfNeeded = function (value, requestOptions, configuration) {
|
|
109
|
+
const nonString = typeof value !== 'string';
|
|
110
|
+
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
|
111
|
+
? configuration.isJsonMime(requestOptions.headers['Content-Type'])
|
|
112
|
+
: nonString;
|
|
113
|
+
return needsSerialization
|
|
114
|
+
? JSON.stringify(value !== undefined ? value : {})
|
|
115
|
+
: (value || "");
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
*
|
|
119
|
+
* @export
|
|
120
|
+
*/
|
|
121
|
+
export const toPathString = function (url) {
|
|
122
|
+
return url.pathname + url.search + url.hash;
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
*
|
|
126
|
+
* @export
|
|
127
|
+
*/
|
|
128
|
+
export const createRequestFunction = function (axiosArgs, globalAxios, BASE_PATH, configuration) {
|
|
129
|
+
return (axios = globalAxios, basePath = BASE_PATH) => {
|
|
130
|
+
const axiosRequestArgs = { ...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url };
|
|
131
|
+
return axios.request(axiosRequestArgs);
|
|
132
|
+
};
|
|
133
|
+
};
|