@sp-api-sdk/external-fulfillment-inventory-api-2024-09-11 2.0.0 → 2.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/dist/index.js CHANGED
@@ -1,276 +1,284 @@
1
- // src/client.ts
2
1
  import { createAxiosInstance } from "@sp-api-sdk/common";
3
-
4
- // src/api-model/api/external-fulfillment-inventory-api.ts
5
- import globalAxios2 from "axios";
6
-
7
- // src/api-model/base.ts
8
2
  import globalAxios from "axios";
9
- var BASE_PATH = "https://sellingpartnerapi-na.amazon.com".replace(/\/+$/, "");
3
+ //#region src/api-model/base.ts
4
+ const BASE_PATH = "https://sellingpartnerapi-na.amazon.com".replace(/\/+$/, "");
10
5
  var BaseAPI = class {
11
- constructor(configuration, basePath = BASE_PATH, axios = globalAxios) {
12
- this.basePath = basePath;
13
- this.axios = axios;
14
- if (configuration) {
15
- this.configuration = configuration;
16
- this.basePath = configuration.basePath ?? basePath;
17
- }
18
- }
19
- basePath;
20
- axios;
21
- configuration;
6
+ basePath;
7
+ axios;
8
+ configuration;
9
+ constructor(configuration, basePath = BASE_PATH, axios = globalAxios) {
10
+ this.basePath = basePath;
11
+ this.axios = axios;
12
+ if (configuration) {
13
+ this.configuration = configuration;
14
+ this.basePath = configuration.basePath ?? basePath;
15
+ }
16
+ }
22
17
  };
23
18
  var RequiredError = class extends Error {
24
- constructor(field, msg) {
25
- super(msg);
26
- this.field = field;
27
- this.name = "RequiredError";
28
- }
29
- field;
19
+ field;
20
+ constructor(field, msg) {
21
+ super(msg);
22
+ this.field = field;
23
+ this.name = "RequiredError";
24
+ }
30
25
  };
31
- var operationServerMap = {};
32
-
33
- // src/api-model/common.ts
34
- var DUMMY_BASE_URL = "https://example.com";
35
- var assertParamExists = function(functionName, paramName, paramValue) {
36
- if (paramValue === null || paramValue === void 0) {
37
- throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
38
- }
26
+ const operationServerMap = {};
27
+ //#endregion
28
+ //#region src/api-model/common.ts
29
+ const DUMMY_BASE_URL = "https://example.com";
30
+ /**
31
+ *
32
+ * @throws {RequiredError}
33
+ */
34
+ const assertParamExists = function(functionName, paramName, paramValue) {
35
+ if (paramValue === null || paramValue === void 0) throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
39
36
  };
40
37
  function setFlattenedQueryParams(urlSearchParams, parameter, key = "") {
41
- if (parameter == null) return;
42
- if (typeof parameter === "object") {
43
- if (Array.isArray(parameter) || parameter instanceof Set) {
44
- parameter.forEach((item) => setFlattenedQueryParams(urlSearchParams, item, key));
45
- } else {
46
- Object.keys(parameter).forEach(
47
- (currentKey) => setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== "" ? "." : ""}${currentKey}`)
48
- );
49
- }
50
- } else {
51
- if (urlSearchParams.has(key)) {
52
- urlSearchParams.append(key, parameter);
53
- } else {
54
- urlSearchParams.set(key, parameter);
55
- }
56
- }
38
+ if (parameter == null) return;
39
+ if (typeof parameter === "object") if (Array.isArray(parameter) || parameter instanceof Set) parameter.forEach((item) => setFlattenedQueryParams(urlSearchParams, item, key));
40
+ else Object.keys(parameter).forEach((currentKey) => setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== "" ? "." : ""}${currentKey}`));
41
+ else if (urlSearchParams.has(key)) urlSearchParams.append(key, parameter);
42
+ else urlSearchParams.set(key, parameter);
57
43
  }
58
- var setSearchParams = function(url, ...objects) {
59
- const searchParams = new URLSearchParams(url.search);
60
- setFlattenedQueryParams(searchParams, objects);
61
- url.search = searchParams.toString();
44
+ const setSearchParams = function(url, ...objects) {
45
+ const searchParams = new URLSearchParams(url.search);
46
+ setFlattenedQueryParams(searchParams, objects);
47
+ url.search = searchParams.toString();
62
48
  };
63
- var replaceWithSerializableTypeIfNeeded = function(key, value) {
64
- if (value instanceof Set) {
65
- return Array.from(value);
66
- } else {
67
- return value;
68
- }
49
+ /**
50
+ * JSON serialization helper function which replaces instances of unserializable types with serializable ones.
51
+ * This function will run for every key-value pair encountered by JSON.stringify while traversing an object.
52
+ * Converting a set to a string will return an empty object, so an intermediate conversion to an array is required.
53
+ */
54
+ const replaceWithSerializableTypeIfNeeded = function(key, value) {
55
+ if (value instanceof Set) return Array.from(value);
56
+ else return value;
69
57
  };
70
- var serializeDataIfNeeded = function(value, requestOptions, configuration) {
71
- const nonString = typeof value !== "string";
72
- const needsSerialization = nonString && configuration && configuration.isJsonMime ? configuration.isJsonMime(requestOptions.headers["Content-Type"]) : nonString;
73
- return needsSerialization ? JSON.stringify(value !== void 0 ? value : {}, replaceWithSerializableTypeIfNeeded) : value || "";
58
+ const serializeDataIfNeeded = function(value, requestOptions, configuration) {
59
+ const nonString = typeof value !== "string";
60
+ return (nonString && configuration && configuration.isJsonMime ? configuration.isJsonMime(requestOptions.headers["Content-Type"]) : nonString) ? JSON.stringify(value !== void 0 ? value : {}, replaceWithSerializableTypeIfNeeded) : value || "";
74
61
  };
75
- var toPathString = function(url) {
76
- return url.pathname + url.search + url.hash;
62
+ const toPathString = function(url) {
63
+ return url.pathname + url.search + url.hash;
77
64
  };
78
- var createRequestFunction = function(axiosArgs, globalAxios3, BASE_PATH2, configuration) {
79
- return (axios = globalAxios3, basePath = BASE_PATH2) => {
80
- const axiosRequestArgs = { ...axiosArgs.options, url: (axios.defaults.baseURL ? "" : configuration?.basePath ?? basePath) + axiosArgs.url };
81
- return axios.request(axiosRequestArgs);
82
- };
65
+ const createRequestFunction = function(axiosArgs, globalAxios, BASE_PATH, configuration) {
66
+ return (axios = globalAxios, basePath = BASE_PATH) => {
67
+ const axiosRequestArgs = {
68
+ ...axiosArgs.options,
69
+ url: (axios.defaults.baseURL ? "" : configuration?.basePath ?? basePath) + axiosArgs.url
70
+ };
71
+ return axios.request(axiosRequestArgs);
72
+ };
83
73
  };
84
-
85
- // src/api-model/api/external-fulfillment-inventory-api.ts
86
- var ExternalFulfillmentInventoryApiAxiosParamCreator = function(configuration) {
87
- return {
88
- /**
89
- * Make up to 10 inventory requests. The response includes the set of responses that correspond to requests. The response for each successful request in the set includes the inventory count for the provided `sku` and `locationId` pair.
90
- * @param {BatchInventoryRequest} body A list of inventory requests.
91
- * @param {*} [options] Override http request option.
92
- * @throws {RequiredError}
93
- */
94
- batchInventory: async (body, options = {}) => {
95
- assertParamExists("batchInventory", "body", body);
96
- const localVarPath = `/externalFulfillment/inventory/2024-09-11/inventories`;
97
- const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
98
- let baseOptions;
99
- if (configuration) {
100
- baseOptions = configuration.baseOptions;
101
- }
102
- const localVarRequestOptions = { method: "POST", ...baseOptions, ...options };
103
- const localVarHeaderParameter = {};
104
- const localVarQueryParameter = {};
105
- localVarHeaderParameter["Content-Type"] = "application/json";
106
- localVarHeaderParameter["Accept"] = "application/json";
107
- setSearchParams(localVarUrlObj, localVarQueryParameter);
108
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
109
- localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
110
- localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration);
111
- return {
112
- url: toPathString(localVarUrlObj),
113
- options: localVarRequestOptions
114
- };
115
- }
116
- };
74
+ //#endregion
75
+ //#region src/api-model/api/external-fulfillment-inventory-api.ts
76
+ /**
77
+ * ExternalFulfillmentInventoryApi - axios parameter creator
78
+ */
79
+ const ExternalFulfillmentInventoryApiAxiosParamCreator = function(configuration) {
80
+ return {
81
+ /**
82
+ * Make up to 10 inventory requests. The response includes the set of responses that correspond to requests. The response for each successful request in the set includes the inventory count for the provided `sku` and `locationId` pair.
83
+ * @param {BatchInventoryRequest} body A list of inventory requests.
84
+ * @param {*} [options] Override http request option.
85
+ * @throws {RequiredError}
86
+ */
87
+ batchInventory: async (body, options = {}) => {
88
+ assertParamExists("batchInventory", "body", body);
89
+ const localVarUrlObj = new URL(`/externalFulfillment/inventory/2024-09-11/inventories`, DUMMY_BASE_URL);
90
+ let baseOptions;
91
+ if (configuration) baseOptions = configuration.baseOptions;
92
+ const localVarRequestOptions = {
93
+ method: "POST",
94
+ ...baseOptions,
95
+ ...options
96
+ };
97
+ const localVarHeaderParameter = {};
98
+ const localVarQueryParameter = {};
99
+ localVarHeaderParameter["Content-Type"] = "application/json";
100
+ localVarHeaderParameter["Accept"] = "application/json";
101
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
102
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
103
+ localVarRequestOptions.headers = {
104
+ ...localVarHeaderParameter,
105
+ ...headersFromBaseOptions,
106
+ ...options.headers
107
+ };
108
+ localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration);
109
+ return {
110
+ url: toPathString(localVarUrlObj),
111
+ options: localVarRequestOptions
112
+ };
113
+ } };
117
114
  };
118
- var ExternalFulfillmentInventoryApiFp = function(configuration) {
119
- const localVarAxiosParamCreator = ExternalFulfillmentInventoryApiAxiosParamCreator(configuration);
120
- return {
121
- /**
122
- * Make up to 10 inventory requests. The response includes the set of responses that correspond to requests. The response for each successful request in the set includes the inventory count for the provided `sku` and `locationId` pair.
123
- * @param {BatchInventoryRequest} body A list of inventory requests.
124
- * @param {*} [options] Override http request option.
125
- * @throws {RequiredError}
126
- */
127
- async batchInventory(body, options) {
128
- const localVarAxiosArgs = await localVarAxiosParamCreator.batchInventory(body, options);
129
- const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
130
- const localVarOperationServerBasePath = operationServerMap["ExternalFulfillmentInventoryApi.batchInventory"]?.[localVarOperationServerIndex]?.url;
131
- return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
132
- }
133
- };
115
+ /**
116
+ * ExternalFulfillmentInventoryApi - functional programming interface
117
+ */
118
+ const ExternalFulfillmentInventoryApiFp = function(configuration) {
119
+ const localVarAxiosParamCreator = ExternalFulfillmentInventoryApiAxiosParamCreator(configuration);
120
+ return {
121
+ /**
122
+ * Make up to 10 inventory requests. The response includes the set of responses that correspond to requests. The response for each successful request in the set includes the inventory count for the provided `sku` and `locationId` pair.
123
+ * @param {BatchInventoryRequest} body A list of inventory requests.
124
+ * @param {*} [options] Override http request option.
125
+ * @throws {RequiredError}
126
+ */
127
+ async batchInventory(body, options) {
128
+ const localVarAxiosArgs = await localVarAxiosParamCreator.batchInventory(body, options);
129
+ const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
130
+ const localVarOperationServerBasePath = operationServerMap["ExternalFulfillmentInventoryApi.batchInventory"]?.[localVarOperationServerIndex]?.url;
131
+ return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
132
+ } };
134
133
  };
135
- var ExternalFulfillmentInventoryApiFactory = function(configuration, basePath, axios) {
136
- const localVarFp = ExternalFulfillmentInventoryApiFp(configuration);
137
- return {
138
- /**
139
- * Make up to 10 inventory requests. The response includes the set of responses that correspond to requests. The response for each successful request in the set includes the inventory count for the provided `sku` and `locationId` pair.
140
- * @param {ExternalFulfillmentInventoryApiBatchInventoryRequest} requestParameters Request parameters.
141
- * @param {*} [options] Override http request option.
142
- * @throws {RequiredError}
143
- */
144
- batchInventory(requestParameters, options) {
145
- return localVarFp.batchInventory(requestParameters.body, options).then((request) => request(axios, basePath));
146
- }
147
- };
134
+ /**
135
+ * ExternalFulfillmentInventoryApi - factory interface
136
+ */
137
+ const ExternalFulfillmentInventoryApiFactory = function(configuration, basePath, axios) {
138
+ const localVarFp = ExternalFulfillmentInventoryApiFp(configuration);
139
+ return {
140
+ /**
141
+ * Make up to 10 inventory requests. The response includes the set of responses that correspond to requests. The response for each successful request in the set includes the inventory count for the provided `sku` and `locationId` pair.
142
+ * @param {ExternalFulfillmentInventoryApiBatchInventoryRequest} requestParameters Request parameters.
143
+ * @param {*} [options] Override http request option.
144
+ * @throws {RequiredError}
145
+ */
146
+ batchInventory(requestParameters, options) {
147
+ return localVarFp.batchInventory(requestParameters.body, options).then((request) => request(axios, basePath));
148
+ } };
148
149
  };
150
+ /**
151
+ * ExternalFulfillmentInventoryApi - object-oriented interface
152
+ */
149
153
  var ExternalFulfillmentInventoryApi = class extends BaseAPI {
150
- /**
151
- * Make up to 10 inventory requests. The response includes the set of responses that correspond to requests. The response for each successful request in the set includes the inventory count for the provided `sku` and `locationId` pair.
152
- * @param {ExternalFulfillmentInventoryApiBatchInventoryRequest} requestParameters Request parameters.
153
- * @param {*} [options] Override http request option.
154
- * @throws {RequiredError}
155
- */
156
- batchInventory(requestParameters, options) {
157
- return ExternalFulfillmentInventoryApiFp(this.configuration).batchInventory(requestParameters.body, options).then((request) => request(this.axios, this.basePath));
158
- }
154
+ /**
155
+ * Make up to 10 inventory requests. The response includes the set of responses that correspond to requests. The response for each successful request in the set includes the inventory count for the provided `sku` and `locationId` pair.
156
+ * @param {ExternalFulfillmentInventoryApiBatchInventoryRequest} requestParameters Request parameters.
157
+ * @param {*} [options] Override http request option.
158
+ * @throws {RequiredError}
159
+ */
160
+ batchInventory(requestParameters, options) {
161
+ return ExternalFulfillmentInventoryApiFp(this.configuration).batchInventory(requestParameters.body, options).then((request) => request(this.axios, this.basePath));
162
+ }
159
163
  };
160
-
161
- // src/api-model/configuration.ts
164
+ //#endregion
165
+ //#region src/api-model/configuration.ts
162
166
  var Configuration = class {
163
- /**
164
- * parameter for apiKey security
165
- * @param name security name
166
- */
167
- apiKey;
168
- /**
169
- * parameter for basic security
170
- */
171
- username;
172
- /**
173
- * parameter for basic security
174
- */
175
- password;
176
- /**
177
- * parameter for oauth2 security
178
- * @param name security name
179
- * @param scopes oauth2 scope
180
- */
181
- accessToken;
182
- /**
183
- * parameter for aws4 signature security
184
- * @param {Object} AWS4Signature - AWS4 Signature security
185
- * @param {string} options.region - aws region
186
- * @param {string} options.service - name of the service.
187
- * @param {string} credentials.accessKeyId - aws access key id
188
- * @param {string} credentials.secretAccessKey - aws access key
189
- * @param {string} credentials.sessionToken - aws session token
190
- * @memberof Configuration
191
- */
192
- awsv4;
193
- /**
194
- * override base path
195
- */
196
- basePath;
197
- /**
198
- * override server index
199
- */
200
- serverIndex;
201
- /**
202
- * base options for axios calls
203
- */
204
- baseOptions;
205
- /**
206
- * The FormData constructor that will be used to create multipart form data
207
- * requests. You can inject this here so that execution environments that
208
- * do not support the FormData class can still run the generated client.
209
- *
210
- * @type {new () => FormData}
211
- */
212
- formDataCtor;
213
- constructor(param = {}) {
214
- this.apiKey = param.apiKey;
215
- this.username = param.username;
216
- this.password = param.password;
217
- this.accessToken = param.accessToken;
218
- this.awsv4 = param.awsv4;
219
- this.basePath = param.basePath;
220
- this.serverIndex = param.serverIndex;
221
- this.baseOptions = {
222
- ...param.baseOptions,
223
- headers: {
224
- ...param.baseOptions?.headers
225
- }
226
- };
227
- this.formDataCtor = param.formDataCtor;
228
- }
229
- /**
230
- * Check if the given MIME is a JSON MIME.
231
- * JSON MIME examples:
232
- * application/json
233
- * application/json; charset=UTF8
234
- * APPLICATION/JSON
235
- * application/vnd.company+json
236
- * @param mime - MIME (Multipurpose Internet Mail Extensions)
237
- * @return True if the given MIME is JSON, false otherwise.
238
- */
239
- isJsonMime(mime) {
240
- const jsonMime = /^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$/i;
241
- return mime !== null && jsonMime.test(mime);
242
- }
167
+ /**
168
+ * parameter for apiKey security
169
+ * @param name security name
170
+ */
171
+ apiKey;
172
+ /**
173
+ * parameter for basic security
174
+ */
175
+ username;
176
+ /**
177
+ * parameter for basic security
178
+ */
179
+ password;
180
+ /**
181
+ * parameter for oauth2 security
182
+ * @param name security name
183
+ * @param scopes oauth2 scope
184
+ */
185
+ accessToken;
186
+ /**
187
+ * parameter for aws4 signature security
188
+ * @param {Object} AWS4Signature - AWS4 Signature security
189
+ * @param {string} options.region - aws region
190
+ * @param {string} options.service - name of the service.
191
+ * @param {string} credentials.accessKeyId - aws access key id
192
+ * @param {string} credentials.secretAccessKey - aws access key
193
+ * @param {string} credentials.sessionToken - aws session token
194
+ * @memberof Configuration
195
+ */
196
+ awsv4;
197
+ /**
198
+ * override base path
199
+ */
200
+ basePath;
201
+ /**
202
+ * override server index
203
+ */
204
+ serverIndex;
205
+ /**
206
+ * base options for axios calls
207
+ */
208
+ baseOptions;
209
+ /**
210
+ * The FormData constructor that will be used to create multipart form data
211
+ * requests. You can inject this here so that execution environments that
212
+ * do not support the FormData class can still run the generated client.
213
+ *
214
+ * @type {new () => FormData}
215
+ */
216
+ formDataCtor;
217
+ constructor(param = {}) {
218
+ this.apiKey = param.apiKey;
219
+ this.username = param.username;
220
+ this.password = param.password;
221
+ this.accessToken = param.accessToken;
222
+ this.awsv4 = param.awsv4;
223
+ this.basePath = param.basePath;
224
+ this.serverIndex = param.serverIndex;
225
+ this.baseOptions = {
226
+ ...param.baseOptions,
227
+ headers: { ...param.baseOptions?.headers }
228
+ };
229
+ this.formDataCtor = param.formDataCtor;
230
+ }
231
+ /**
232
+ * Check if the given MIME is a JSON MIME.
233
+ * JSON MIME examples:
234
+ * application/json
235
+ * application/json; charset=UTF8
236
+ * APPLICATION/JSON
237
+ * application/vnd.company+json
238
+ * @param mime - MIME (Multipurpose Internet Mail Extensions)
239
+ * @return True if the given MIME is JSON, false otherwise.
240
+ */
241
+ isJsonMime(mime) {
242
+ return mime !== null && /^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$/i.test(mime);
243
+ }
243
244
  };
244
-
245
- // src/api-model/models/http-method.ts
246
- var HttpMethod = {
247
- Get: "GET",
248
- Post: "POST"
245
+ //#endregion
246
+ //#region src/api-model/models/http-method.ts
247
+ /**
248
+ * The Selling Partner API for External Fulfillment Inventory Management
249
+ * You can use the Amazon External Fulfillment Inventory API to manage inventory operations in Amazon\'s External Fulfillment network, including batch inventory updates and retrievals.
250
+ *
251
+ * The version of the OpenAPI document: 2024-09-11
252
+ *
253
+ *
254
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
255
+ * https://openapi-generator.tech
256
+ * Do not edit the class manually.
257
+ */
258
+ /**
259
+ * The HTTP method associated with an individual request within a batch.
260
+ */
261
+ const HttpMethod = {
262
+ Get: "GET",
263
+ Post: "POST"
249
264
  };
250
-
251
- // src/api-model/models/marketplace-attributes.ts
252
- var MarketplaceAttributesChannelNameEnum = {
253
- Fba: "FBA",
254
- Mfn: "MFN",
255
- Df: "DF"
265
+ //#endregion
266
+ //#region src/api-model/models/marketplace-attributes.ts
267
+ const MarketplaceAttributesChannelNameEnum = {
268
+ Fba: "FBA",
269
+ Mfn: "MFN",
270
+ Df: "DF"
256
271
  };
257
-
258
- // src/client.ts
259
- var clientRateLimits = [];
272
+ //#endregion
273
+ //#region src/client.ts
274
+ const clientRateLimits = [];
260
275
  var ExternalFulfillmentInventoryApiClient = class extends ExternalFulfillmentInventoryApi {
261
- constructor(configuration) {
262
- const { axios, endpoint } = createAxiosInstance(configuration, clientRateLimits);
263
- super(new Configuration(), endpoint, axios);
264
- }
265
- };
266
- export {
267
- ExternalFulfillmentInventoryApi,
268
- ExternalFulfillmentInventoryApiAxiosParamCreator,
269
- ExternalFulfillmentInventoryApiClient,
270
- ExternalFulfillmentInventoryApiFactory,
271
- ExternalFulfillmentInventoryApiFp,
272
- HttpMethod,
273
- MarketplaceAttributesChannelNameEnum,
274
- clientRateLimits
276
+ constructor(configuration) {
277
+ const { axios, endpoint } = createAxiosInstance(configuration, clientRateLimits);
278
+ super(new Configuration(), endpoint, axios);
279
+ }
275
280
  };
281
+ //#endregion
282
+ export { ExternalFulfillmentInventoryApi, ExternalFulfillmentInventoryApiAxiosParamCreator, ExternalFulfillmentInventoryApiClient, ExternalFulfillmentInventoryApiFactory, ExternalFulfillmentInventoryApiFp, HttpMethod, MarketplaceAttributesChannelNameEnum, clientRateLimits };
283
+
276
284
  //# sourceMappingURL=index.js.map