@teemill/product-catalog 1.10.0 → 1.12.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/.openapi-generator/FILES +8 -29
- package/.openapi-generator/VERSION +1 -1
- package/README.md +3 -3
- package/api.ts +1592 -0
- package/base.ts +86 -0
- package/common.ts +150 -0
- package/configuration.ts +110 -0
- package/dist/api.d.ts +1120 -0
- package/dist/api.js +819 -0
- package/dist/base.d.ts +66 -0
- package/dist/base.js +65 -0
- package/dist/common.d.ts +65 -0
- package/dist/common.js +161 -0
- package/dist/configuration.d.ts +91 -0
- package/dist/configuration.js +43 -0
- package/dist/esm/api.d.ts +1120 -0
- package/dist/esm/api.js +808 -0
- package/dist/esm/base.d.ts +66 -0
- package/dist/esm/base.js +60 -0
- package/dist/esm/common.d.ts +65 -0
- package/dist/esm/common.js +149 -0
- package/dist/esm/configuration.d.ts +91 -0
- package/dist/esm/configuration.js +39 -0
- package/dist/esm/index.d.ts +13 -0
- package/dist/esm/index.js +15 -0
- package/dist/index.d.ts +13 -3
- package/dist/index.js +15 -5
- package/git_push.sh +57 -0
- package/index.ts +18 -0
- package/package.json +18 -4
- package/tsconfig.esm.json +7 -0
- package/tsconfig.json +4 -6
- package/dist/apis/ProductsApi.d.ts +0 -107
- package/dist/apis/ProductsApi.js +0 -498
- package/dist/apis/VariantsApi.d.ts +0 -50
- package/dist/apis/VariantsApi.js +0 -235
- package/dist/apis/index.d.ts +0 -2
- package/dist/apis/index.js +0 -20
- package/dist/models/ApiError.d.ts +0 -37
- package/dist/models/ApiError.js +0 -49
- package/dist/models/Attribute.d.ts +0 -50
- package/dist/models/Attribute.js +0 -56
- package/dist/models/AttributeThumbnail.d.ts +0 -46
- package/dist/models/AttributeThumbnail.js +0 -55
- package/dist/models/CreateProductRequest.d.ts +0 -88
- package/dist/models/CreateProductRequest.js +0 -70
- package/dist/models/CreateProductRequestAdditionalFilesInner.d.ts +0 -31
- package/dist/models/CreateProductRequestAdditionalFilesInner.js +0 -50
- package/dist/models/CreateProductRequestImagesInner.d.ts +0 -31
- package/dist/models/CreateProductRequestImagesInner.js +0 -45
- package/dist/models/CreateProductRequestSeoMetadata.d.ts +0 -31
- package/dist/models/CreateProductRequestSeoMetadata.js +0 -45
- package/dist/models/CreateProductRequestVariantsInner.d.ts +0 -59
- package/dist/models/CreateProductRequestVariantsInner.js +0 -64
- package/dist/models/CreateProductRequestVariantsInnerApplicationsInner.d.ts +0 -63
- package/dist/models/CreateProductRequestVariantsInnerApplicationsInner.js +0 -74
- package/dist/models/CreateProductRequestVariantsInnerAttributesInner.d.ts +0 -37
- package/dist/models/CreateProductRequestVariantsInnerAttributesInner.js +0 -53
- package/dist/models/CreateProductRequestVariantsInnerImagesInner.d.ts +0 -31
- package/dist/models/CreateProductRequestVariantsInnerImagesInner.js +0 -50
- package/dist/models/CreateProductRequestVariantsInnerRetailPrice.d.ts +0 -37
- package/dist/models/CreateProductRequestVariantsInnerRetailPrice.js +0 -53
- package/dist/models/CreateProductVariant.d.ts +0 -59
- package/dist/models/CreateProductVariant.js +0 -61
- package/dist/models/CreateProductVariantApplicationsInner.d.ts +0 -63
- package/dist/models/CreateProductVariantApplicationsInner.js +0 -73
- package/dist/models/CreateProductVariantAttributesInner.d.ts +0 -37
- package/dist/models/CreateProductVariantAttributesInner.js +0 -51
- package/dist/models/CreateProductVariantRetailPrice.d.ts +0 -37
- package/dist/models/CreateProductVariantRetailPrice.js +0 -51
- package/dist/models/Image.d.ts +0 -67
- package/dist/models/Image.js +0 -57
- package/dist/models/ImportProducts200Response.d.ts +0 -31
- package/dist/models/ImportProducts200Response.js +0 -45
- package/dist/models/ModelFile.d.ts +0 -31
- package/dist/models/ModelFile.js +0 -45
- package/dist/models/Price.d.ts +0 -37
- package/dist/models/Price.js +0 -47
- package/dist/models/Product.d.ts +0 -113
- package/dist/models/Product.js +0 -78
- package/dist/models/ProductAdditionalFilesInner.d.ts +0 -37
- package/dist/models/ProductAdditionalFilesInner.js +0 -47
- package/dist/models/ProductsResponse.d.ts +0 -38
- package/dist/models/ProductsResponse.js +0 -48
- package/dist/models/SeoMetadata.d.ts +0 -31
- package/dist/models/SeoMetadata.js +0 -45
- package/dist/models/Stock.d.ts +0 -31
- package/dist/models/Stock.js +0 -45
- package/dist/models/UpdateProductRequest.d.ts +0 -87
- package/dist/models/UpdateProductRequest.js +0 -65
- package/dist/models/Variant.d.ts +0 -114
- package/dist/models/Variant.js +0 -78
- package/dist/models/VariantProduct.d.ts +0 -37
- package/dist/models/VariantProduct.js +0 -47
- package/dist/models/VariantsResponse.d.ts +0 -38
- package/dist/models/VariantsResponse.js +0 -48
- package/dist/models/index.d.ts +0 -23
- package/dist/models/index.js +0 -41
- package/dist/runtime.d.ts +0 -187
- package/dist/runtime.js +0 -565
- package/src/apis/ProductsApi.ts +0 -453
- package/src/apis/VariantsApi.ts +0 -186
- package/src/apis/index.ts +0 -4
- package/src/index.ts +0 -5
- package/src/models/ApiError.ts +0 -69
- package/src/models/Attribute.ts +0 -93
- package/src/models/AttributeThumbnail.ts +0 -80
- package/src/models/CreateProductRequest.ts +0 -153
- package/src/models/CreateProductRequestAdditionalFilesInner.ts +0 -65
- package/src/models/CreateProductRequestImagesInner.ts +0 -60
- package/src/models/CreateProductRequestSeoMetadata.ts +0 -60
- package/src/models/CreateProductRequestVariantsInner.ts +0 -124
- package/src/models/CreateProductRequestVariantsInnerApplicationsInner.ts +0 -108
- package/src/models/CreateProductRequestVariantsInnerAttributesInner.ts +0 -75
- package/src/models/CreateProductRequestVariantsInnerImagesInner.ts +0 -65
- package/src/models/CreateProductRequestVariantsInnerRetailPrice.ts +0 -75
- package/src/models/CreateProductVariant.ts +0 -119
- package/src/models/CreateProductVariantApplicationsInner.ts +0 -103
- package/src/models/CreateProductVariantAttributesInner.ts +0 -70
- package/src/models/CreateProductVariantRetailPrice.ts +0 -70
- package/src/models/Image.ts +0 -108
- package/src/models/ImportProducts200Response.ts +0 -60
- package/src/models/ModelFile.ts +0 -60
- package/src/models/Price.ts +0 -68
- package/src/models/Product.ts +0 -190
- package/src/models/ProductAdditionalFilesInner.ts +0 -68
- package/src/models/ProductsResponse.ts +0 -75
- package/src/models/SeoMetadata.ts +0 -60
- package/src/models/Stock.ts +0 -60
- package/src/models/UpdateProductRequest.ts +0 -145
- package/src/models/Variant.ts +0 -195
- package/src/models/VariantProduct.ts +0 -68
- package/src/models/VariantsResponse.ts +0 -75
- package/src/models/index.ts +0 -25
- package/src/runtime.ts +0 -441
package/src/apis/ProductsApi.ts
DELETED
|
@@ -1,453 +0,0 @@
|
|
|
1
|
-
/* tslint:disable */
|
|
2
|
-
/* eslint-disable */
|
|
3
|
-
/**
|
|
4
|
-
* Product Catalog API
|
|
5
|
-
* Manage Product Catalog A catalog product is an object that represents a product listing that can be purchased from the given project. It contains a combination of design applications and a warehouse product, plus listing information such as title, description and tags.
|
|
6
|
-
*
|
|
7
|
-
* The version of the OpenAPI document: 1.10.0
|
|
8
|
-
* Contact: hello@teemill.com
|
|
9
|
-
*
|
|
10
|
-
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
-
* https://openapi-generator.tech
|
|
12
|
-
* Do not edit the class manually.
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
import * as runtime from '../runtime';
|
|
17
|
-
import type {
|
|
18
|
-
ApiError,
|
|
19
|
-
CreateProductRequest,
|
|
20
|
-
ImportProducts200Response,
|
|
21
|
-
Product,
|
|
22
|
-
ProductsResponse,
|
|
23
|
-
UpdateProductRequest,
|
|
24
|
-
} from '../models/index';
|
|
25
|
-
import {
|
|
26
|
-
ApiErrorFromJSON,
|
|
27
|
-
ApiErrorToJSON,
|
|
28
|
-
CreateProductRequestFromJSON,
|
|
29
|
-
CreateProductRequestToJSON,
|
|
30
|
-
ImportProducts200ResponseFromJSON,
|
|
31
|
-
ImportProducts200ResponseToJSON,
|
|
32
|
-
ProductFromJSON,
|
|
33
|
-
ProductToJSON,
|
|
34
|
-
ProductsResponseFromJSON,
|
|
35
|
-
ProductsResponseToJSON,
|
|
36
|
-
UpdateProductRequestFromJSON,
|
|
37
|
-
UpdateProductRequestToJSON,
|
|
38
|
-
} from '../models/index';
|
|
39
|
-
|
|
40
|
-
export interface CreateProductOperationRequest {
|
|
41
|
-
project: string;
|
|
42
|
-
createProductRequest?: CreateProductRequest;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export interface DeleteProductRequest {
|
|
46
|
-
project: string;
|
|
47
|
-
productId: string;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export interface GetProductRequest {
|
|
51
|
-
project: string;
|
|
52
|
-
productId: string;
|
|
53
|
-
fields?: string;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export interface GetProductsRequest {
|
|
57
|
-
project: string;
|
|
58
|
-
pageToken?: number;
|
|
59
|
-
search?: string;
|
|
60
|
-
pageSize?: number;
|
|
61
|
-
fields?: string;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export interface ImportProductsRequest {
|
|
65
|
-
project: string;
|
|
66
|
-
body?: string;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export interface UpdateProductOperationRequest {
|
|
70
|
-
project: string;
|
|
71
|
-
productId: string;
|
|
72
|
-
updateProductRequest?: UpdateProductRequest;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
*
|
|
77
|
-
*/
|
|
78
|
-
export class ProductsApi extends runtime.BaseAPI {
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Creates a new catalog product based on a given warehouse product with the variants and design applications provided. To select a warehouse product to base this product on, use the GFN Catalog API to list available options.
|
|
82
|
-
* Create product
|
|
83
|
-
*/
|
|
84
|
-
async createProductRaw(requestParameters: CreateProductOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Product>> {
|
|
85
|
-
if (requestParameters.project === null || requestParameters.project === undefined) {
|
|
86
|
-
throw new runtime.RequiredError('project','Required parameter requestParameters.project was null or undefined when calling createProduct.');
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
const queryParameters: any = {};
|
|
90
|
-
|
|
91
|
-
if (requestParameters.project !== undefined) {
|
|
92
|
-
queryParameters['project'] = requestParameters.project;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
const headerParameters: runtime.HTTPHeaders = {};
|
|
96
|
-
|
|
97
|
-
headerParameters['Content-Type'] = 'application/json';
|
|
98
|
-
|
|
99
|
-
if (this.configuration && this.configuration.accessToken) {
|
|
100
|
-
// oauth required
|
|
101
|
-
headerParameters["Authorization"] = await this.configuration.accessToken("session-oauth", []);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
if (this.configuration && this.configuration.apiKey) {
|
|
105
|
-
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // api-key authentication
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
const response = await this.request({
|
|
109
|
-
path: `/v1/catalog/products`,
|
|
110
|
-
method: 'POST',
|
|
111
|
-
headers: headerParameters,
|
|
112
|
-
query: queryParameters,
|
|
113
|
-
body: CreateProductRequestToJSON(requestParameters.createProductRequest),
|
|
114
|
-
}, initOverrides);
|
|
115
|
-
|
|
116
|
-
return new runtime.JSONApiResponse(response, (jsonValue) => ProductFromJSON(jsonValue));
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Creates a new catalog product based on a given warehouse product with the variants and design applications provided. To select a warehouse product to base this product on, use the GFN Catalog API to list available options.
|
|
121
|
-
* Create product
|
|
122
|
-
*/
|
|
123
|
-
async createProduct(
|
|
124
|
-
project: string,
|
|
125
|
-
optionalParameters: runtime.OptionalOnly<CreateProductOperationRequest> = {},
|
|
126
|
-
initOverrides?: RequestInit | runtime.InitOverrideFunction
|
|
127
|
-
): Promise<Product> {
|
|
128
|
-
const response = await this.createProductRaw(
|
|
129
|
-
{
|
|
130
|
-
project: project,
|
|
131
|
-
...optionalParameters,
|
|
132
|
-
},
|
|
133
|
-
initOverrides
|
|
134
|
-
);
|
|
135
|
-
|
|
136
|
-
return await response.value();
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Deletes a catalog product
|
|
141
|
-
* Delete catalog product
|
|
142
|
-
*/
|
|
143
|
-
async deleteProductRaw(requestParameters: DeleteProductRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
|
|
144
|
-
if (requestParameters.project === null || requestParameters.project === undefined) {
|
|
145
|
-
throw new runtime.RequiredError('project','Required parameter requestParameters.project was null or undefined when calling deleteProduct.');
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
if (requestParameters.productId === null || requestParameters.productId === undefined) {
|
|
149
|
-
throw new runtime.RequiredError('productId','Required parameter requestParameters.productId was null or undefined when calling deleteProduct.');
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
const queryParameters: any = {};
|
|
153
|
-
|
|
154
|
-
if (requestParameters.project !== undefined) {
|
|
155
|
-
queryParameters['project'] = requestParameters.project;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
const headerParameters: runtime.HTTPHeaders = {};
|
|
159
|
-
|
|
160
|
-
if (this.configuration && this.configuration.accessToken) {
|
|
161
|
-
// oauth required
|
|
162
|
-
headerParameters["Authorization"] = await this.configuration.accessToken("session-oauth", []);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
if (this.configuration && this.configuration.apiKey) {
|
|
166
|
-
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // api-key authentication
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
const response = await this.request({
|
|
170
|
-
path: `/v1/catalog/products/{productId}`.replace(`{${"productId"}}`, encodeURIComponent(String(requestParameters.productId))),
|
|
171
|
-
method: 'DELETE',
|
|
172
|
-
headers: headerParameters,
|
|
173
|
-
query: queryParameters,
|
|
174
|
-
}, initOverrides);
|
|
175
|
-
|
|
176
|
-
return new runtime.VoidApiResponse(response);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* Deletes a catalog product
|
|
181
|
-
* Delete catalog product
|
|
182
|
-
*/
|
|
183
|
-
async deleteProduct(
|
|
184
|
-
project: string, productId: string,
|
|
185
|
-
initOverrides?: RequestInit | runtime.InitOverrideFunction
|
|
186
|
-
): Promise<void> {
|
|
187
|
-
await this.deleteProductRaw(
|
|
188
|
-
{
|
|
189
|
-
project: project,productId: productId,
|
|
190
|
-
},
|
|
191
|
-
initOverrides
|
|
192
|
-
);
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* Gets a product by a given ID.
|
|
197
|
-
* Get product
|
|
198
|
-
*/
|
|
199
|
-
async getProductRaw(requestParameters: GetProductRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Product>> {
|
|
200
|
-
if (requestParameters.project === null || requestParameters.project === undefined) {
|
|
201
|
-
throw new runtime.RequiredError('project','Required parameter requestParameters.project was null or undefined when calling getProduct.');
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
if (requestParameters.productId === null || requestParameters.productId === undefined) {
|
|
205
|
-
throw new runtime.RequiredError('productId','Required parameter requestParameters.productId was null or undefined when calling getProduct.');
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
const queryParameters: any = {};
|
|
209
|
-
|
|
210
|
-
if (requestParameters.project !== undefined) {
|
|
211
|
-
queryParameters['project'] = requestParameters.project;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
if (requestParameters.fields !== undefined) {
|
|
215
|
-
queryParameters['fields'] = requestParameters.fields;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
const headerParameters: runtime.HTTPHeaders = {};
|
|
219
|
-
|
|
220
|
-
if (this.configuration && this.configuration.accessToken) {
|
|
221
|
-
// oauth required
|
|
222
|
-
headerParameters["Authorization"] = await this.configuration.accessToken("session-oauth", []);
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
if (this.configuration && this.configuration.apiKey) {
|
|
226
|
-
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // api-key authentication
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
const response = await this.request({
|
|
230
|
-
path: `/v1/catalog/products/{productId}`.replace(`{${"productId"}}`, encodeURIComponent(String(requestParameters.productId))),
|
|
231
|
-
method: 'GET',
|
|
232
|
-
headers: headerParameters,
|
|
233
|
-
query: queryParameters,
|
|
234
|
-
}, initOverrides);
|
|
235
|
-
|
|
236
|
-
return new runtime.JSONApiResponse(response, (jsonValue) => ProductFromJSON(jsonValue));
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
/**
|
|
240
|
-
* Gets a product by a given ID.
|
|
241
|
-
* Get product
|
|
242
|
-
*/
|
|
243
|
-
async getProduct(
|
|
244
|
-
project: string, productId: string,
|
|
245
|
-
optionalParameters: runtime.OptionalOnly<GetProductRequest> = {},
|
|
246
|
-
initOverrides?: RequestInit | runtime.InitOverrideFunction
|
|
247
|
-
): Promise<Product> {
|
|
248
|
-
const response = await this.getProductRaw(
|
|
249
|
-
{
|
|
250
|
-
project: project,productId: productId,
|
|
251
|
-
...optionalParameters,
|
|
252
|
-
},
|
|
253
|
-
initOverrides
|
|
254
|
-
);
|
|
255
|
-
|
|
256
|
-
return await response.value();
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
/**
|
|
260
|
-
* Lists all enabled store listing products attached to the given project.
|
|
261
|
-
* List products
|
|
262
|
-
*/
|
|
263
|
-
async getProductsRaw(requestParameters: GetProductsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ProductsResponse>> {
|
|
264
|
-
if (requestParameters.project === null || requestParameters.project === undefined) {
|
|
265
|
-
throw new runtime.RequiredError('project','Required parameter requestParameters.project was null or undefined when calling getProducts.');
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
const queryParameters: any = {};
|
|
269
|
-
|
|
270
|
-
if (requestParameters.project !== undefined) {
|
|
271
|
-
queryParameters['project'] = requestParameters.project;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
if (requestParameters.pageToken !== undefined) {
|
|
275
|
-
queryParameters['pageToken'] = requestParameters.pageToken;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
if (requestParameters.search !== undefined) {
|
|
279
|
-
queryParameters['search'] = requestParameters.search;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
if (requestParameters.pageSize !== undefined) {
|
|
283
|
-
queryParameters['pageSize'] = requestParameters.pageSize;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
if (requestParameters.fields !== undefined) {
|
|
287
|
-
queryParameters['fields'] = requestParameters.fields;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
const headerParameters: runtime.HTTPHeaders = {};
|
|
291
|
-
|
|
292
|
-
if (this.configuration && this.configuration.accessToken) {
|
|
293
|
-
// oauth required
|
|
294
|
-
headerParameters["Authorization"] = await this.configuration.accessToken("session-oauth", []);
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
if (this.configuration && this.configuration.apiKey) {
|
|
298
|
-
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // api-key authentication
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
const response = await this.request({
|
|
302
|
-
path: `/v1/catalog/products`,
|
|
303
|
-
method: 'GET',
|
|
304
|
-
headers: headerParameters,
|
|
305
|
-
query: queryParameters,
|
|
306
|
-
}, initOverrides);
|
|
307
|
-
|
|
308
|
-
return new runtime.JSONApiResponse(response, (jsonValue) => ProductsResponseFromJSON(jsonValue));
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
/**
|
|
312
|
-
* Lists all enabled store listing products attached to the given project.
|
|
313
|
-
* List products
|
|
314
|
-
*/
|
|
315
|
-
async getProducts(
|
|
316
|
-
project: string,
|
|
317
|
-
optionalParameters: runtime.OptionalOnly<GetProductsRequest> = {},
|
|
318
|
-
initOverrides?: RequestInit | runtime.InitOverrideFunction
|
|
319
|
-
): Promise<ProductsResponse> {
|
|
320
|
-
const response = await this.getProductsRaw(
|
|
321
|
-
{
|
|
322
|
-
project: project,
|
|
323
|
-
...optionalParameters,
|
|
324
|
-
},
|
|
325
|
-
initOverrides
|
|
326
|
-
);
|
|
327
|
-
|
|
328
|
-
return await response.value();
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
/**
|
|
332
|
-
* Initiates a product import from a CSV file. The result will be available as a notification within the dashboard.
|
|
333
|
-
* Import products
|
|
334
|
-
*/
|
|
335
|
-
async importProductsRaw(requestParameters: ImportProductsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ImportProducts200Response>> {
|
|
336
|
-
if (requestParameters.project === null || requestParameters.project === undefined) {
|
|
337
|
-
throw new runtime.RequiredError('project','Required parameter requestParameters.project was null or undefined when calling importProducts.');
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
const queryParameters: any = {};
|
|
341
|
-
|
|
342
|
-
if (requestParameters.project !== undefined) {
|
|
343
|
-
queryParameters['project'] = requestParameters.project;
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
const headerParameters: runtime.HTTPHeaders = {};
|
|
347
|
-
|
|
348
|
-
headerParameters['Content-Type'] = 'text/csv';
|
|
349
|
-
|
|
350
|
-
if (this.configuration && this.configuration.accessToken) {
|
|
351
|
-
// oauth required
|
|
352
|
-
headerParameters["Authorization"] = await this.configuration.accessToken("session-oauth", []);
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
if (this.configuration && this.configuration.apiKey) {
|
|
356
|
-
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // api-key authentication
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
const response = await this.request({
|
|
360
|
-
path: `/v1/catalog/products/import`,
|
|
361
|
-
method: 'POST',
|
|
362
|
-
headers: headerParameters,
|
|
363
|
-
query: queryParameters,
|
|
364
|
-
body: requestParameters.body as any,
|
|
365
|
-
}, initOverrides);
|
|
366
|
-
|
|
367
|
-
return new runtime.JSONApiResponse(response, (jsonValue) => ImportProducts200ResponseFromJSON(jsonValue));
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
/**
|
|
371
|
-
* Initiates a product import from a CSV file. The result will be available as a notification within the dashboard.
|
|
372
|
-
* Import products
|
|
373
|
-
*/
|
|
374
|
-
async importProducts(
|
|
375
|
-
project: string,
|
|
376
|
-
optionalParameters: runtime.OptionalOnly<ImportProductsRequest> = {},
|
|
377
|
-
initOverrides?: RequestInit | runtime.InitOverrideFunction
|
|
378
|
-
): Promise<ImportProducts200Response> {
|
|
379
|
-
const response = await this.importProductsRaw(
|
|
380
|
-
{
|
|
381
|
-
project: project,
|
|
382
|
-
...optionalParameters,
|
|
383
|
-
},
|
|
384
|
-
initOverrides
|
|
385
|
-
);
|
|
386
|
-
|
|
387
|
-
return await response.value();
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
/**
|
|
391
|
-
* Updates a product by a given ID.
|
|
392
|
-
* Update product
|
|
393
|
-
*/
|
|
394
|
-
async updateProductRaw(requestParameters: UpdateProductOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Product>> {
|
|
395
|
-
if (requestParameters.project === null || requestParameters.project === undefined) {
|
|
396
|
-
throw new runtime.RequiredError('project','Required parameter requestParameters.project was null or undefined when calling updateProduct.');
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
if (requestParameters.productId === null || requestParameters.productId === undefined) {
|
|
400
|
-
throw new runtime.RequiredError('productId','Required parameter requestParameters.productId was null or undefined when calling updateProduct.');
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
const queryParameters: any = {};
|
|
404
|
-
|
|
405
|
-
if (requestParameters.project !== undefined) {
|
|
406
|
-
queryParameters['project'] = requestParameters.project;
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
const headerParameters: runtime.HTTPHeaders = {};
|
|
410
|
-
|
|
411
|
-
headerParameters['Content-Type'] = 'application/json';
|
|
412
|
-
|
|
413
|
-
if (this.configuration && this.configuration.accessToken) {
|
|
414
|
-
// oauth required
|
|
415
|
-
headerParameters["Authorization"] = await this.configuration.accessToken("session-oauth", []);
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
if (this.configuration && this.configuration.apiKey) {
|
|
419
|
-
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // api-key authentication
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
const response = await this.request({
|
|
423
|
-
path: `/v1/catalog/products/{productId}`.replace(`{${"productId"}}`, encodeURIComponent(String(requestParameters.productId))),
|
|
424
|
-
method: 'PATCH',
|
|
425
|
-
headers: headerParameters,
|
|
426
|
-
query: queryParameters,
|
|
427
|
-
body: UpdateProductRequestToJSON(requestParameters.updateProductRequest),
|
|
428
|
-
}, initOverrides);
|
|
429
|
-
|
|
430
|
-
return new runtime.JSONApiResponse(response, (jsonValue) => ProductFromJSON(jsonValue));
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
/**
|
|
434
|
-
* Updates a product by a given ID.
|
|
435
|
-
* Update product
|
|
436
|
-
*/
|
|
437
|
-
async updateProduct(
|
|
438
|
-
project: string, productId: string,
|
|
439
|
-
optionalParameters: runtime.OptionalOnly<UpdateProductOperationRequest> = {},
|
|
440
|
-
initOverrides?: RequestInit | runtime.InitOverrideFunction
|
|
441
|
-
): Promise<Product> {
|
|
442
|
-
const response = await this.updateProductRaw(
|
|
443
|
-
{
|
|
444
|
-
project: project,productId: productId,
|
|
445
|
-
...optionalParameters,
|
|
446
|
-
},
|
|
447
|
-
initOverrides
|
|
448
|
-
);
|
|
449
|
-
|
|
450
|
-
return await response.value();
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
}
|
package/src/apis/VariantsApi.ts
DELETED
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
/* tslint:disable */
|
|
2
|
-
/* eslint-disable */
|
|
3
|
-
/**
|
|
4
|
-
* Product Catalog API
|
|
5
|
-
* Manage Product Catalog A catalog product is an object that represents a product listing that can be purchased from the given project. It contains a combination of design applications and a warehouse product, plus listing information such as title, description and tags.
|
|
6
|
-
*
|
|
7
|
-
* The version of the OpenAPI document: 1.10.0
|
|
8
|
-
* Contact: hello@teemill.com
|
|
9
|
-
*
|
|
10
|
-
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
-
* https://openapi-generator.tech
|
|
12
|
-
* Do not edit the class manually.
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
import * as runtime from '../runtime';
|
|
17
|
-
import type {
|
|
18
|
-
ApiError,
|
|
19
|
-
Variant,
|
|
20
|
-
VariantsResponse,
|
|
21
|
-
} from '../models/index';
|
|
22
|
-
import {
|
|
23
|
-
ApiErrorFromJSON,
|
|
24
|
-
ApiErrorToJSON,
|
|
25
|
-
VariantFromJSON,
|
|
26
|
-
VariantToJSON,
|
|
27
|
-
VariantsResponseFromJSON,
|
|
28
|
-
VariantsResponseToJSON,
|
|
29
|
-
} from '../models/index';
|
|
30
|
-
|
|
31
|
-
export interface GetVariantRequest {
|
|
32
|
-
project: string;
|
|
33
|
-
variantId: string;
|
|
34
|
-
fields?: string;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export interface ListVariantsRequest {
|
|
38
|
-
project: string;
|
|
39
|
-
search?: string;
|
|
40
|
-
pageToken?: number;
|
|
41
|
-
pageSize?: number;
|
|
42
|
-
fields?: string;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
*
|
|
47
|
-
*/
|
|
48
|
-
export class VariantsApi extends runtime.BaseAPI {
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Gets a variant by a given ID.
|
|
52
|
-
* Get variant
|
|
53
|
-
*/
|
|
54
|
-
async getVariantRaw(requestParameters: GetVariantRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Variant>> {
|
|
55
|
-
if (requestParameters.project === null || requestParameters.project === undefined) {
|
|
56
|
-
throw new runtime.RequiredError('project','Required parameter requestParameters.project was null or undefined when calling getVariant.');
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (requestParameters.variantId === null || requestParameters.variantId === undefined) {
|
|
60
|
-
throw new runtime.RequiredError('variantId','Required parameter requestParameters.variantId was null or undefined when calling getVariant.');
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const queryParameters: any = {};
|
|
64
|
-
|
|
65
|
-
if (requestParameters.project !== undefined) {
|
|
66
|
-
queryParameters['project'] = requestParameters.project;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
if (requestParameters.fields !== undefined) {
|
|
70
|
-
queryParameters['fields'] = requestParameters.fields;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const headerParameters: runtime.HTTPHeaders = {};
|
|
74
|
-
|
|
75
|
-
if (this.configuration && this.configuration.accessToken) {
|
|
76
|
-
// oauth required
|
|
77
|
-
headerParameters["Authorization"] = await this.configuration.accessToken("session-oauth", []);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
if (this.configuration && this.configuration.apiKey) {
|
|
81
|
-
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // api-key authentication
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
const response = await this.request({
|
|
85
|
-
path: `/v1/catalog/variants/{variantId}`.replace(`{${"variantId"}}`, encodeURIComponent(String(requestParameters.variantId))),
|
|
86
|
-
method: 'GET',
|
|
87
|
-
headers: headerParameters,
|
|
88
|
-
query: queryParameters,
|
|
89
|
-
}, initOverrides);
|
|
90
|
-
|
|
91
|
-
return new runtime.JSONApiResponse(response, (jsonValue) => VariantFromJSON(jsonValue));
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Gets a variant by a given ID.
|
|
96
|
-
* Get variant
|
|
97
|
-
*/
|
|
98
|
-
async getVariant(
|
|
99
|
-
project: string, variantId: string,
|
|
100
|
-
optionalParameters: runtime.OptionalOnly<GetVariantRequest> = {},
|
|
101
|
-
initOverrides?: RequestInit | runtime.InitOverrideFunction
|
|
102
|
-
): Promise<Variant> {
|
|
103
|
-
const response = await this.getVariantRaw(
|
|
104
|
-
{
|
|
105
|
-
project: project,variantId: variantId,
|
|
106
|
-
...optionalParameters,
|
|
107
|
-
},
|
|
108
|
-
initOverrides
|
|
109
|
-
);
|
|
110
|
-
|
|
111
|
-
return await response.value();
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Lists all variants that belong to enabled products attached to the given project.
|
|
116
|
-
* List variants
|
|
117
|
-
*/
|
|
118
|
-
async listVariantsRaw(requestParameters: ListVariantsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<VariantsResponse>> {
|
|
119
|
-
if (requestParameters.project === null || requestParameters.project === undefined) {
|
|
120
|
-
throw new runtime.RequiredError('project','Required parameter requestParameters.project was null or undefined when calling listVariants.');
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
const queryParameters: any = {};
|
|
124
|
-
|
|
125
|
-
if (requestParameters.project !== undefined) {
|
|
126
|
-
queryParameters['project'] = requestParameters.project;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
if (requestParameters.search !== undefined) {
|
|
130
|
-
queryParameters['search'] = requestParameters.search;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
if (requestParameters.pageToken !== undefined) {
|
|
134
|
-
queryParameters['pageToken'] = requestParameters.pageToken;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
if (requestParameters.pageSize !== undefined) {
|
|
138
|
-
queryParameters['pageSize'] = requestParameters.pageSize;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
if (requestParameters.fields !== undefined) {
|
|
142
|
-
queryParameters['fields'] = requestParameters.fields;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
const headerParameters: runtime.HTTPHeaders = {};
|
|
146
|
-
|
|
147
|
-
if (this.configuration && this.configuration.accessToken) {
|
|
148
|
-
// oauth required
|
|
149
|
-
headerParameters["Authorization"] = await this.configuration.accessToken("session-oauth", []);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
if (this.configuration && this.configuration.apiKey) {
|
|
153
|
-
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // api-key authentication
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
const response = await this.request({
|
|
157
|
-
path: `/v1/catalog/variants`,
|
|
158
|
-
method: 'GET',
|
|
159
|
-
headers: headerParameters,
|
|
160
|
-
query: queryParameters,
|
|
161
|
-
}, initOverrides);
|
|
162
|
-
|
|
163
|
-
return new runtime.JSONApiResponse(response, (jsonValue) => VariantsResponseFromJSON(jsonValue));
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Lists all variants that belong to enabled products attached to the given project.
|
|
168
|
-
* List variants
|
|
169
|
-
*/
|
|
170
|
-
async listVariants(
|
|
171
|
-
project: string,
|
|
172
|
-
optionalParameters: runtime.OptionalOnly<ListVariantsRequest> = {},
|
|
173
|
-
initOverrides?: RequestInit | runtime.InitOverrideFunction
|
|
174
|
-
): Promise<VariantsResponse> {
|
|
175
|
-
const response = await this.listVariantsRaw(
|
|
176
|
-
{
|
|
177
|
-
project: project,
|
|
178
|
-
...optionalParameters,
|
|
179
|
-
},
|
|
180
|
-
initOverrides
|
|
181
|
-
);
|
|
182
|
-
|
|
183
|
-
return await response.value();
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
}
|
package/src/apis/index.ts
DELETED