@sokol111/ecommerce-image-service-api 1.0.27 → 1.0.29

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/api.js CHANGED
@@ -1,834 +1,71 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
1
  /**
2
+ * Generated by orval v7.13.2 🍺
3
+ * Do not edit manually.
4
4
  * Image Service API
5
5
  * API for managing images
6
- *
7
- * The version of the OpenAPI document: 1.0.27
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.
6
+ * OpenAPI spec version: 1.0.29
13
7
  */
14
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
- return new (P || (P = Promise))(function (resolve, reject) {
17
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
- step((generator = generator.apply(thisArg, _arguments || [])).next());
21
- });
22
- };
23
- import globalAxios from 'axios';
24
- // Some imports not used depending on template conditions
25
- // @ts-ignore
26
- import { DUMMY_BASE_URL, assertParamExists, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common';
27
- // @ts-ignore
28
- import { BASE_PATH, BaseAPI, operationServerMap } from './base';
29
- export const BatchUrlRequestFitEnum = {
30
- Cover: 'cover',
31
- Contain: 'contain',
32
- Fill: 'fill',
33
- Inside: 'inside',
34
- Outside: 'outside'
35
- };
36
- export const BatchUrlRequestFormatEnum = {
37
- Original: 'original',
38
- Webp: 'webp',
39
- Avif: 'avif',
40
- Jpeg: 'jpeg',
41
- Png: 'png'
42
- };
43
- export const ImageRole = {
44
- Main: 'main',
45
- Gallery: 'gallery',
46
- Other: 'other'
47
- };
48
- export const ImageStatus = {
49
- Pending: 'pending',
50
- Uploaded: 'uploaded',
51
- Processing: 'processing',
52
- Ready: 'ready',
53
- Failed: 'failed',
54
- Deleted: 'deleted'
55
- };
56
- export const OwnerType = {
57
- ProductDraft: 'productDraft',
58
- Product: 'product',
59
- User: 'user'
60
- };
61
- export const PresignRequestContentTypeEnum = {
62
- ImageJpeg: 'image/jpeg',
63
- ImagePng: 'image/png',
64
- ImageWebp: 'image/webp',
65
- ImageAvif: 'image/avif'
66
- };
67
- /**
68
- * DefaultApi - axios parameter creator
69
- */
70
- export const DefaultApiAxiosParamCreator = function (configuration) {
71
- return {
72
- /**
73
- *
74
- * @summary Confirm upload (HEAD against S3), persist metadata
75
- * @param {ConfirmRequest} confirmRequest
76
- * @param {*} [options] Override http request option.
77
- * @throws {RequiredError}
78
- */
79
- confirmUpload: (confirmRequest_1, ...args_1) => __awaiter(this, [confirmRequest_1, ...args_1], void 0, function* (confirmRequest, options = {}) {
80
- // verify required parameter 'confirmRequest' is not null or undefined
81
- assertParamExists('confirmUpload', 'confirmRequest', confirmRequest);
82
- const localVarPath = `/v1/images/confirm`;
83
- // use dummy base URL string because the URL constructor only accepts absolute URLs.
84
- const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
85
- let baseOptions;
86
- if (configuration) {
87
- baseOptions = configuration.baseOptions;
88
- }
89
- const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
90
- const localVarHeaderParameter = {};
91
- const localVarQueryParameter = {};
92
- localVarHeaderParameter['Content-Type'] = 'application/json';
93
- setSearchParams(localVarUrlObj, localVarQueryParameter);
94
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
95
- localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
96
- localVarRequestOptions.data = serializeDataIfNeeded(confirmRequest, localVarRequestOptions, configuration);
97
- return {
98
- url: toPathString(localVarUrlObj),
99
- options: localVarRequestOptions,
100
- };
101
- }),
102
- /**
103
- *
104
- * @summary Create a presigned PUT URL for uploading an image to MinIO/S3
105
- * @param {PresignRequest} presignRequest
106
- * @param {*} [options] Override http request option.
107
- * @throws {RequiredError}
108
- */
109
- createPresign: (presignRequest_1, ...args_1) => __awaiter(this, [presignRequest_1, ...args_1], void 0, function* (presignRequest, options = {}) {
110
- // verify required parameter 'presignRequest' is not null or undefined
111
- assertParamExists('createPresign', 'presignRequest', presignRequest);
112
- const localVarPath = `/v1/images/presign`;
113
- // use dummy base URL string because the URL constructor only accepts absolute URLs.
114
- const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
115
- let baseOptions;
116
- if (configuration) {
117
- baseOptions = configuration.baseOptions;
118
- }
119
- const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
120
- const localVarHeaderParameter = {};
121
- const localVarQueryParameter = {};
122
- localVarHeaderParameter['Content-Type'] = 'application/json';
123
- setSearchParams(localVarUrlObj, localVarQueryParameter);
124
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
125
- localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
126
- localVarRequestOptions.data = serializeDataIfNeeded(presignRequest, localVarRequestOptions, configuration);
127
- return {
128
- url: toPathString(localVarUrlObj),
129
- options: localVarRequestOptions,
130
- };
131
- }),
132
- /**
133
- *
134
- * @summary Delete image (soft or hard, per policy)
135
- * @param {string} id
136
- * @param {boolean} [hard]
137
- * @param {*} [options] Override http request option.
138
- * @throws {RequiredError}
139
- */
140
- deleteImage: (id_1, hard_1, ...args_1) => __awaiter(this, [id_1, hard_1, ...args_1], void 0, function* (id, hard, options = {}) {
141
- // verify required parameter 'id' is not null or undefined
142
- assertParamExists('deleteImage', 'id', id);
143
- const localVarPath = `/v1/images/{id}`
144
- .replace(`{${"id"}}`, encodeURIComponent(String(id)));
145
- // use dummy base URL string because the URL constructor only accepts absolute URLs.
146
- const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
147
- let baseOptions;
148
- if (configuration) {
149
- baseOptions = configuration.baseOptions;
150
- }
151
- const localVarRequestOptions = Object.assign(Object.assign({ method: 'DELETE' }, baseOptions), options);
152
- const localVarHeaderParameter = {};
153
- const localVarQueryParameter = {};
154
- if (hard !== undefined) {
155
- localVarQueryParameter['hard'] = hard;
156
- }
157
- setSearchParams(localVarUrlObj, localVarQueryParameter);
158
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
159
- localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
160
- return {
161
- url: toPathString(localVarUrlObj),
162
- options: localVarRequestOptions,
163
- };
164
- }),
165
- /**
166
- *
167
- * @summary Generate a signed imgproxy URL for delivery with requested params
168
- * @param {string} id
169
- * @param {string} [variant]
170
- * @param {number} [w]
171
- * @param {number} [h]
172
- * @param {GetDeliveryUrlFitEnum} [fit]
173
- * @param {GetDeliveryUrlFormatEnum} [format]
174
- * @param {number} [quality]
175
- * @param {number} [dpr]
176
- * @param {number} [ttlSeconds]
177
- * @param {*} [options] Override http request option.
178
- * @throws {RequiredError}
179
- */
180
- getDeliveryUrl: (id_1, variant_1, w_1, h_1, fit_1, format_1, quality_1, dpr_1, ttlSeconds_1, ...args_1) => __awaiter(this, [id_1, variant_1, w_1, h_1, fit_1, format_1, quality_1, dpr_1, ttlSeconds_1, ...args_1], void 0, function* (id, variant, w, h, fit, format, quality, dpr, ttlSeconds, options = {}) {
181
- // verify required parameter 'id' is not null or undefined
182
- assertParamExists('getDeliveryUrl', 'id', id);
183
- const localVarPath = `/v1/images/{id}/url`
184
- .replace(`{${"id"}}`, encodeURIComponent(String(id)));
185
- // use dummy base URL string because the URL constructor only accepts absolute URLs.
186
- const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
187
- let baseOptions;
188
- if (configuration) {
189
- baseOptions = configuration.baseOptions;
190
- }
191
- const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
192
- const localVarHeaderParameter = {};
193
- const localVarQueryParameter = {};
194
- if (variant !== undefined) {
195
- localVarQueryParameter['variant'] = variant;
196
- }
197
- if (w !== undefined) {
198
- localVarQueryParameter['w'] = w;
199
- }
200
- if (h !== undefined) {
201
- localVarQueryParameter['h'] = h;
202
- }
203
- if (fit !== undefined) {
204
- localVarQueryParameter['fit'] = fit;
205
- }
206
- if (format !== undefined) {
207
- localVarQueryParameter['format'] = format;
208
- }
209
- if (quality !== undefined) {
210
- localVarQueryParameter['quality'] = quality;
211
- }
212
- if (dpr !== undefined) {
213
- localVarQueryParameter['dpr'] = dpr;
214
- }
215
- if (ttlSeconds !== undefined) {
216
- localVarQueryParameter['ttlSeconds'] = ttlSeconds;
217
- }
218
- setSearchParams(localVarUrlObj, localVarQueryParameter);
219
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
220
- localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
221
- return {
222
- url: toPathString(localVarUrlObj),
223
- options: localVarRequestOptions,
224
- };
225
- }),
226
- /**
227
- *
228
- * @summary Generate signed imgproxy URLs for multiple images in a single request
229
- * @param {BatchUrlRequest} batchUrlRequest
230
- * @param {*} [options] Override http request option.
231
- * @throws {RequiredError}
232
- */
233
- getDeliveryUrls: (batchUrlRequest_1, ...args_1) => __awaiter(this, [batchUrlRequest_1, ...args_1], void 0, function* (batchUrlRequest, options = {}) {
234
- // verify required parameter 'batchUrlRequest' is not null or undefined
235
- assertParamExists('getDeliveryUrls', 'batchUrlRequest', batchUrlRequest);
236
- const localVarPath = `/v1/images/urls`;
237
- // use dummy base URL string because the URL constructor only accepts absolute URLs.
238
- const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
239
- let baseOptions;
240
- if (configuration) {
241
- baseOptions = configuration.baseOptions;
242
- }
243
- const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
244
- const localVarHeaderParameter = {};
245
- const localVarQueryParameter = {};
246
- localVarHeaderParameter['Content-Type'] = 'application/json';
247
- setSearchParams(localVarUrlObj, localVarQueryParameter);
248
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
249
- localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
250
- localVarRequestOptions.data = serializeDataIfNeeded(batchUrlRequest, localVarRequestOptions, configuration);
251
- return {
252
- url: toPathString(localVarUrlObj),
253
- options: localVarRequestOptions,
254
- };
255
- }),
256
- /**
257
- *
258
- * @summary Get image metadata
259
- * @param {string} id
260
- * @param {*} [options] Override http request option.
261
- * @throws {RequiredError}
262
- */
263
- getImage: (id_1, ...args_1) => __awaiter(this, [id_1, ...args_1], void 0, function* (id, options = {}) {
264
- // verify required parameter 'id' is not null or undefined
265
- assertParamExists('getImage', 'id', id);
266
- const localVarPath = `/v1/images/{id}`
267
- .replace(`{${"id"}}`, encodeURIComponent(String(id)));
268
- // use dummy base URL string because the URL constructor only accepts absolute URLs.
269
- const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
270
- let baseOptions;
271
- if (configuration) {
272
- baseOptions = configuration.baseOptions;
273
- }
274
- const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
275
- const localVarHeaderParameter = {};
276
- const localVarQueryParameter = {};
277
- setSearchParams(localVarUrlObj, localVarQueryParameter);
278
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
279
- localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
280
- return {
281
- url: toPathString(localVarUrlObj),
282
- options: localVarRequestOptions,
283
- };
284
- }),
285
- /**
286
- *
287
- * @summary List/search images by owner/filters
288
- * @param {OwnerType} [ownerType]
289
- * @param {string} [ownerId]
290
- * @param {ImageStatus} [status]
291
- * @param {number} [page]
292
- * @param {number} [pageSize]
293
- * @param {*} [options] Override http request option.
294
- * @throws {RequiredError}
295
- */
296
- listImages: (ownerType_1, ownerId_1, status_1, page_1, pageSize_1, ...args_1) => __awaiter(this, [ownerType_1, ownerId_1, status_1, page_1, pageSize_1, ...args_1], void 0, function* (ownerType, ownerId, status, page, pageSize, options = {}) {
297
- const localVarPath = `/v1/images`;
298
- // use dummy base URL string because the URL constructor only accepts absolute URLs.
299
- const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
300
- let baseOptions;
301
- if (configuration) {
302
- baseOptions = configuration.baseOptions;
303
- }
304
- const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
305
- const localVarHeaderParameter = {};
306
- const localVarQueryParameter = {};
307
- if (ownerType !== undefined) {
308
- localVarQueryParameter['ownerType'] = ownerType;
309
- }
310
- if (ownerId !== undefined) {
311
- localVarQueryParameter['ownerId'] = ownerId;
312
- }
313
- if (status !== undefined) {
314
- localVarQueryParameter['status'] = status;
315
- }
316
- if (page !== undefined) {
317
- localVarQueryParameter['page'] = page;
318
- }
319
- if (pageSize !== undefined) {
320
- localVarQueryParameter['pageSize'] = pageSize;
321
- }
322
- setSearchParams(localVarUrlObj, localVarQueryParameter);
323
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
324
- localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
325
- return {
326
- url: toPathString(localVarUrlObj),
327
- options: localVarRequestOptions,
328
- };
329
- }),
330
- /**
331
- *
332
- * @summary Trigger (or retry) variant generation for an image
333
- * @param {ProcessImageRequest} processImageRequest
334
- * @param {*} [options] Override http request option.
335
- * @throws {RequiredError}
336
- */
337
- processImage: (processImageRequest_1, ...args_1) => __awaiter(this, [processImageRequest_1, ...args_1], void 0, function* (processImageRequest, options = {}) {
338
- // verify required parameter 'processImageRequest' is not null or undefined
339
- assertParamExists('processImage', 'processImageRequest', processImageRequest);
340
- const localVarPath = `/v1/internal/images/process`;
341
- // use dummy base URL string because the URL constructor only accepts absolute URLs.
342
- const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
343
- let baseOptions;
344
- if (configuration) {
345
- baseOptions = configuration.baseOptions;
346
- }
347
- const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
348
- const localVarHeaderParameter = {};
349
- const localVarQueryParameter = {};
350
- localVarHeaderParameter['Content-Type'] = 'application/json';
351
- setSearchParams(localVarUrlObj, localVarQueryParameter);
352
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
353
- localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
354
- localVarRequestOptions.data = serializeDataIfNeeded(processImageRequest, localVarRequestOptions, configuration);
355
- return {
356
- url: toPathString(localVarUrlObj),
357
- options: localVarRequestOptions,
358
- };
359
- }),
360
- /**
361
- *
362
- * @summary Promote images from a product draft to a final product
363
- * @param {PromoteRequest} promoteRequest
364
- * @param {*} [options] Override http request option.
365
- * @throws {RequiredError}
366
- */
367
- promoteImages: (promoteRequest_1, ...args_1) => __awaiter(this, [promoteRequest_1, ...args_1], void 0, function* (promoteRequest, options = {}) {
368
- // verify required parameter 'promoteRequest' is not null or undefined
369
- assertParamExists('promoteImages', 'promoteRequest', promoteRequest);
370
- const localVarPath = `/v1/images/promote`;
371
- // use dummy base URL string because the URL constructor only accepts absolute URLs.
372
- const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
373
- let baseOptions;
374
- if (configuration) {
375
- baseOptions = configuration.baseOptions;
376
- }
377
- const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
378
- const localVarHeaderParameter = {};
379
- const localVarQueryParameter = {};
380
- localVarHeaderParameter['Content-Type'] = 'application/json';
381
- setSearchParams(localVarUrlObj, localVarQueryParameter);
382
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
383
- localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
384
- localVarRequestOptions.data = serializeDataIfNeeded(promoteRequest, localVarRequestOptions, configuration);
385
- return {
386
- url: toPathString(localVarUrlObj),
387
- options: localVarRequestOptions,
388
- };
389
- }),
390
- /**
391
- *
392
- * @summary Update image metadata (alt, role, order)
393
- * @param {string} id
394
- * @param {ImagePatch} imagePatch
395
- * @param {*} [options] Override http request option.
396
- * @throws {RequiredError}
397
- */
398
- updateImage: (id_1, imagePatch_1, ...args_1) => __awaiter(this, [id_1, imagePatch_1, ...args_1], void 0, function* (id, imagePatch, options = {}) {
399
- // verify required parameter 'id' is not null or undefined
400
- assertParamExists('updateImage', 'id', id);
401
- // verify required parameter 'imagePatch' is not null or undefined
402
- assertParamExists('updateImage', 'imagePatch', imagePatch);
403
- const localVarPath = `/v1/images/{id}`
404
- .replace(`{${"id"}}`, encodeURIComponent(String(id)));
405
- // use dummy base URL string because the URL constructor only accepts absolute URLs.
406
- const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
407
- let baseOptions;
408
- if (configuration) {
409
- baseOptions = configuration.baseOptions;
410
- }
411
- const localVarRequestOptions = Object.assign(Object.assign({ method: 'PATCH' }, baseOptions), options);
412
- const localVarHeaderParameter = {};
413
- const localVarQueryParameter = {};
414
- localVarHeaderParameter['Content-Type'] = 'application/json';
415
- setSearchParams(localVarUrlObj, localVarQueryParameter);
416
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
417
- localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
418
- localVarRequestOptions.data = serializeDataIfNeeded(imagePatch, localVarRequestOptions, configuration);
419
- return {
420
- url: toPathString(localVarUrlObj),
421
- options: localVarRequestOptions,
422
- };
423
- }),
424
- };
425
- };
426
- /**
427
- * DefaultApi - functional programming interface
428
- */
429
- export const DefaultApiFp = function (configuration) {
430
- const localVarAxiosParamCreator = DefaultApiAxiosParamCreator(configuration);
431
- return {
432
- /**
433
- *
434
- * @summary Confirm upload (HEAD against S3), persist metadata
435
- * @param {ConfirmRequest} confirmRequest
436
- * @param {*} [options] Override http request option.
437
- * @throws {RequiredError}
438
- */
439
- confirmUpload(confirmRequest, options) {
440
- return __awaiter(this, void 0, void 0, function* () {
441
- var _a, _b, _c;
442
- const localVarAxiosArgs = yield localVarAxiosParamCreator.confirmUpload(confirmRequest, options);
443
- const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
444
- const localVarOperationServerBasePath = (_c = (_b = operationServerMap['DefaultApi.confirmUpload']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
445
- return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
446
- });
447
- },
448
- /**
449
- *
450
- * @summary Create a presigned PUT URL for uploading an image to MinIO/S3
451
- * @param {PresignRequest} presignRequest
452
- * @param {*} [options] Override http request option.
453
- * @throws {RequiredError}
454
- */
455
- createPresign(presignRequest, options) {
456
- return __awaiter(this, void 0, void 0, function* () {
457
- var _a, _b, _c;
458
- const localVarAxiosArgs = yield localVarAxiosParamCreator.createPresign(presignRequest, options);
459
- const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
460
- const localVarOperationServerBasePath = (_c = (_b = operationServerMap['DefaultApi.createPresign']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
461
- return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
462
- });
463
- },
464
- /**
465
- *
466
- * @summary Delete image (soft or hard, per policy)
467
- * @param {string} id
468
- * @param {boolean} [hard]
469
- * @param {*} [options] Override http request option.
470
- * @throws {RequiredError}
471
- */
472
- deleteImage(id, hard, options) {
473
- return __awaiter(this, void 0, void 0, function* () {
474
- var _a, _b, _c;
475
- const localVarAxiosArgs = yield localVarAxiosParamCreator.deleteImage(id, hard, options);
476
- const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
477
- const localVarOperationServerBasePath = (_c = (_b = operationServerMap['DefaultApi.deleteImage']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
478
- return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
479
- });
480
- },
481
- /**
482
- *
483
- * @summary Generate a signed imgproxy URL for delivery with requested params
484
- * @param {string} id
485
- * @param {string} [variant]
486
- * @param {number} [w]
487
- * @param {number} [h]
488
- * @param {GetDeliveryUrlFitEnum} [fit]
489
- * @param {GetDeliveryUrlFormatEnum} [format]
490
- * @param {number} [quality]
491
- * @param {number} [dpr]
492
- * @param {number} [ttlSeconds]
493
- * @param {*} [options] Override http request option.
494
- * @throws {RequiredError}
495
- */
496
- getDeliveryUrl(id, variant, w, h, fit, format, quality, dpr, ttlSeconds, options) {
497
- return __awaiter(this, void 0, void 0, function* () {
498
- var _a, _b, _c;
499
- const localVarAxiosArgs = yield localVarAxiosParamCreator.getDeliveryUrl(id, variant, w, h, fit, format, quality, dpr, ttlSeconds, options);
500
- const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
501
- const localVarOperationServerBasePath = (_c = (_b = operationServerMap['DefaultApi.getDeliveryUrl']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
502
- return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
503
- });
504
- },
505
- /**
506
- *
507
- * @summary Generate signed imgproxy URLs for multiple images in a single request
508
- * @param {BatchUrlRequest} batchUrlRequest
509
- * @param {*} [options] Override http request option.
510
- * @throws {RequiredError}
511
- */
512
- getDeliveryUrls(batchUrlRequest, options) {
513
- return __awaiter(this, void 0, void 0, function* () {
514
- var _a, _b, _c;
515
- const localVarAxiosArgs = yield localVarAxiosParamCreator.getDeliveryUrls(batchUrlRequest, options);
516
- const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
517
- const localVarOperationServerBasePath = (_c = (_b = operationServerMap['DefaultApi.getDeliveryUrls']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
518
- return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
519
- });
520
- },
521
- /**
522
- *
523
- * @summary Get image metadata
524
- * @param {string} id
525
- * @param {*} [options] Override http request option.
526
- * @throws {RequiredError}
527
- */
528
- getImage(id, options) {
529
- return __awaiter(this, void 0, void 0, function* () {
530
- var _a, _b, _c;
531
- const localVarAxiosArgs = yield localVarAxiosParamCreator.getImage(id, options);
532
- const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
533
- const localVarOperationServerBasePath = (_c = (_b = operationServerMap['DefaultApi.getImage']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
534
- return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
535
- });
536
- },
537
- /**
538
- *
539
- * @summary List/search images by owner/filters
540
- * @param {OwnerType} [ownerType]
541
- * @param {string} [ownerId]
542
- * @param {ImageStatus} [status]
543
- * @param {number} [page]
544
- * @param {number} [pageSize]
545
- * @param {*} [options] Override http request option.
546
- * @throws {RequiredError}
547
- */
548
- listImages(ownerType, ownerId, status, page, pageSize, options) {
549
- return __awaiter(this, void 0, void 0, function* () {
550
- var _a, _b, _c;
551
- const localVarAxiosArgs = yield localVarAxiosParamCreator.listImages(ownerType, ownerId, status, page, pageSize, options);
552
- const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
553
- const localVarOperationServerBasePath = (_c = (_b = operationServerMap['DefaultApi.listImages']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
554
- return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
555
- });
556
- },
557
- /**
558
- *
559
- * @summary Trigger (or retry) variant generation for an image
560
- * @param {ProcessImageRequest} processImageRequest
561
- * @param {*} [options] Override http request option.
562
- * @throws {RequiredError}
563
- */
564
- processImage(processImageRequest, options) {
565
- return __awaiter(this, void 0, void 0, function* () {
566
- var _a, _b, _c;
567
- const localVarAxiosArgs = yield localVarAxiosParamCreator.processImage(processImageRequest, options);
568
- const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
569
- const localVarOperationServerBasePath = (_c = (_b = operationServerMap['DefaultApi.processImage']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
570
- return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
571
- });
572
- },
573
- /**
574
- *
575
- * @summary Promote images from a product draft to a final product
576
- * @param {PromoteRequest} promoteRequest
577
- * @param {*} [options] Override http request option.
578
- * @throws {RequiredError}
579
- */
580
- promoteImages(promoteRequest, options) {
581
- return __awaiter(this, void 0, void 0, function* () {
582
- var _a, _b, _c;
583
- const localVarAxiosArgs = yield localVarAxiosParamCreator.promoteImages(promoteRequest, options);
584
- const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
585
- const localVarOperationServerBasePath = (_c = (_b = operationServerMap['DefaultApi.promoteImages']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
586
- return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
587
- });
588
- },
589
- /**
590
- *
591
- * @summary Update image metadata (alt, role, order)
592
- * @param {string} id
593
- * @param {ImagePatch} imagePatch
594
- * @param {*} [options] Override http request option.
595
- * @throws {RequiredError}
596
- */
597
- updateImage(id, imagePatch, options) {
598
- return __awaiter(this, void 0, void 0, function* () {
599
- var _a, _b, _c;
600
- const localVarAxiosArgs = yield localVarAxiosParamCreator.updateImage(id, imagePatch, options);
601
- const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
602
- const localVarOperationServerBasePath = (_c = (_b = operationServerMap['DefaultApi.updateImage']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
603
- return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
604
- });
605
- },
606
- };
607
- };
608
- /**
609
- * DefaultApi - factory interface
610
- */
611
- export const DefaultApiFactory = function (configuration, basePath, axios) {
612
- const localVarFp = DefaultApiFp(configuration);
613
- return {
614
- /**
615
- *
616
- * @summary Confirm upload (HEAD against S3), persist metadata
617
- * @param {DefaultApiConfirmUploadRequest} requestParameters Request parameters.
618
- * @param {*} [options] Override http request option.
619
- * @throws {RequiredError}
620
- */
621
- confirmUpload(requestParameters, options) {
622
- return localVarFp.confirmUpload(requestParameters.confirmRequest, options).then((request) => request(axios, basePath));
623
- },
624
- /**
625
- *
626
- * @summary Create a presigned PUT URL for uploading an image to MinIO/S3
627
- * @param {DefaultApiCreatePresignRequest} requestParameters Request parameters.
628
- * @param {*} [options] Override http request option.
629
- * @throws {RequiredError}
630
- */
631
- createPresign(requestParameters, options) {
632
- return localVarFp.createPresign(requestParameters.presignRequest, options).then((request) => request(axios, basePath));
633
- },
634
- /**
635
- *
636
- * @summary Delete image (soft or hard, per policy)
637
- * @param {DefaultApiDeleteImageRequest} requestParameters Request parameters.
638
- * @param {*} [options] Override http request option.
639
- * @throws {RequiredError}
640
- */
641
- deleteImage(requestParameters, options) {
642
- return localVarFp.deleteImage(requestParameters.id, requestParameters.hard, options).then((request) => request(axios, basePath));
643
- },
644
- /**
645
- *
646
- * @summary Generate a signed imgproxy URL for delivery with requested params
647
- * @param {DefaultApiGetDeliveryUrlRequest} requestParameters Request parameters.
648
- * @param {*} [options] Override http request option.
649
- * @throws {RequiredError}
650
- */
651
- getDeliveryUrl(requestParameters, options) {
652
- return localVarFp.getDeliveryUrl(requestParameters.id, requestParameters.variant, requestParameters.w, requestParameters.h, requestParameters.fit, requestParameters.format, requestParameters.quality, requestParameters.dpr, requestParameters.ttlSeconds, options).then((request) => request(axios, basePath));
653
- },
654
- /**
655
- *
656
- * @summary Generate signed imgproxy URLs for multiple images in a single request
657
- * @param {DefaultApiGetDeliveryUrlsRequest} requestParameters Request parameters.
658
- * @param {*} [options] Override http request option.
659
- * @throws {RequiredError}
660
- */
661
- getDeliveryUrls(requestParameters, options) {
662
- return localVarFp.getDeliveryUrls(requestParameters.batchUrlRequest, options).then((request) => request(axios, basePath));
663
- },
664
- /**
665
- *
666
- * @summary Get image metadata
667
- * @param {DefaultApiGetImageRequest} requestParameters Request parameters.
668
- * @param {*} [options] Override http request option.
669
- * @throws {RequiredError}
670
- */
671
- getImage(requestParameters, options) {
672
- return localVarFp.getImage(requestParameters.id, options).then((request) => request(axios, basePath));
673
- },
674
- /**
675
- *
676
- * @summary List/search images by owner/filters
677
- * @param {DefaultApiListImagesRequest} requestParameters Request parameters.
678
- * @param {*} [options] Override http request option.
679
- * @throws {RequiredError}
680
- */
681
- listImages(requestParameters = {}, options) {
682
- return localVarFp.listImages(requestParameters.ownerType, requestParameters.ownerId, requestParameters.status, requestParameters.page, requestParameters.pageSize, options).then((request) => request(axios, basePath));
683
- },
684
- /**
685
- *
686
- * @summary Trigger (or retry) variant generation for an image
687
- * @param {DefaultApiProcessImageRequest} requestParameters Request parameters.
688
- * @param {*} [options] Override http request option.
689
- * @throws {RequiredError}
690
- */
691
- processImage(requestParameters, options) {
692
- return localVarFp.processImage(requestParameters.processImageRequest, options).then((request) => request(axios, basePath));
693
- },
694
- /**
695
- *
696
- * @summary Promote images from a product draft to a final product
697
- * @param {DefaultApiPromoteImagesRequest} requestParameters Request parameters.
698
- * @param {*} [options] Override http request option.
699
- * @throws {RequiredError}
700
- */
701
- promoteImages(requestParameters, options) {
702
- return localVarFp.promoteImages(requestParameters.promoteRequest, options).then((request) => request(axios, basePath));
703
- },
704
- /**
705
- *
706
- * @summary Update image metadata (alt, role, order)
707
- * @param {DefaultApiUpdateImageRequest} requestParameters Request parameters.
708
- * @param {*} [options] Override http request option.
709
- * @throws {RequiredError}
710
- */
711
- updateImage(requestParameters, options) {
712
- return localVarFp.updateImage(requestParameters.id, requestParameters.imagePatch, options).then((request) => request(axios, basePath));
713
- },
714
- };
715
- };
716
- /**
717
- * DefaultApi - object-oriented interface
718
- */
719
- export class DefaultApi extends BaseAPI {
8
+ import axios from 'axios';
9
+ export const getImageServiceAPI = () => {
720
10
  /**
721
- *
722
- * @summary Confirm upload (HEAD against S3), persist metadata
723
- * @param {DefaultApiConfirmUploadRequest} requestParameters Request parameters.
724
- * @param {*} [options] Override http request option.
725
- * @throws {RequiredError}
11
+ * @summary Create a presigned PUT URL for uploading an image to MinIO/S3
726
12
  */
727
- confirmUpload(requestParameters, options) {
728
- return DefaultApiFp(this.configuration).confirmUpload(requestParameters.confirmRequest, options).then((request) => request(this.axios, this.basePath));
729
- }
13
+ const createPresign = (presignRequest, options) => {
14
+ return axios.post(`/v1/images/presign`, presignRequest, options);
15
+ };
730
16
  /**
731
- *
732
- * @summary Create a presigned PUT URL for uploading an image to MinIO/S3
733
- * @param {DefaultApiCreatePresignRequest} requestParameters Request parameters.
734
- * @param {*} [options] Override http request option.
735
- * @throws {RequiredError}
17
+ * @summary Confirm upload (HEAD against S3), persist metadata
736
18
  */
737
- createPresign(requestParameters, options) {
738
- return DefaultApiFp(this.configuration).createPresign(requestParameters.presignRequest, options).then((request) => request(this.axios, this.basePath));
739
- }
19
+ const confirmUpload = (confirmRequest, options) => {
20
+ return axios.post(`/v1/images/confirm`, confirmRequest, options);
21
+ };
740
22
  /**
741
- *
742
- * @summary Delete image (soft or hard, per policy)
743
- * @param {DefaultApiDeleteImageRequest} requestParameters Request parameters.
744
- * @param {*} [options] Override http request option.
745
- * @throws {RequiredError}
23
+ * @summary List/search images by owner/filters
746
24
  */
747
- deleteImage(requestParameters, options) {
748
- return DefaultApiFp(this.configuration).deleteImage(requestParameters.id, requestParameters.hard, options).then((request) => request(this.axios, this.basePath));
749
- }
25
+ const listImages = (params, options) => {
26
+ return axios.get(`/v1/images`, Object.assign(Object.assign({}, options), { params: Object.assign(Object.assign({}, params), options === null || options === void 0 ? void 0 : options.params) }));
27
+ };
750
28
  /**
751
- *
752
- * @summary Generate a signed imgproxy URL for delivery with requested params
753
- * @param {DefaultApiGetDeliveryUrlRequest} requestParameters Request parameters.
754
- * @param {*} [options] Override http request option.
755
- * @throws {RequiredError}
29
+ * @summary Get image metadata
756
30
  */
757
- getDeliveryUrl(requestParameters, options) {
758
- return DefaultApiFp(this.configuration).getDeliveryUrl(requestParameters.id, requestParameters.variant, requestParameters.w, requestParameters.h, requestParameters.fit, requestParameters.format, requestParameters.quality, requestParameters.dpr, requestParameters.ttlSeconds, options).then((request) => request(this.axios, this.basePath));
759
- }
31
+ const getImage = (id, options) => {
32
+ return axios.get(`/v1/images/${id}`, options);
33
+ };
760
34
  /**
761
- *
762
- * @summary Generate signed imgproxy URLs for multiple images in a single request
763
- * @param {DefaultApiGetDeliveryUrlsRequest} requestParameters Request parameters.
764
- * @param {*} [options] Override http request option.
765
- * @throws {RequiredError}
35
+ * @summary Update image metadata (alt, role, order)
766
36
  */
767
- getDeliveryUrls(requestParameters, options) {
768
- return DefaultApiFp(this.configuration).getDeliveryUrls(requestParameters.batchUrlRequest, options).then((request) => request(this.axios, this.basePath));
769
- }
37
+ const updateImage = (id, imagePatch, options) => {
38
+ return axios.patch(`/v1/images/${id}`, imagePatch, options);
39
+ };
770
40
  /**
771
- *
772
- * @summary Get image metadata
773
- * @param {DefaultApiGetImageRequest} requestParameters Request parameters.
774
- * @param {*} [options] Override http request option.
775
- * @throws {RequiredError}
41
+ * @summary Delete image (soft or hard, per policy)
776
42
  */
777
- getImage(requestParameters, options) {
778
- return DefaultApiFp(this.configuration).getImage(requestParameters.id, options).then((request) => request(this.axios, this.basePath));
779
- }
43
+ const deleteImage = (id, params, options) => {
44
+ return axios.delete(`/v1/images/${id}`, Object.assign(Object.assign({}, options), { params: Object.assign(Object.assign({}, params), options === null || options === void 0 ? void 0 : options.params) }));
45
+ };
780
46
  /**
781
- *
782
- * @summary List/search images by owner/filters
783
- * @param {DefaultApiListImagesRequest} requestParameters Request parameters.
784
- * @param {*} [options] Override http request option.
785
- * @throws {RequiredError}
47
+ * @summary Generate a signed imgproxy URL for delivery with requested params
786
48
  */
787
- listImages(requestParameters = {}, options) {
788
- return DefaultApiFp(this.configuration).listImages(requestParameters.ownerType, requestParameters.ownerId, requestParameters.status, requestParameters.page, requestParameters.pageSize, options).then((request) => request(this.axios, this.basePath));
789
- }
49
+ const getDeliveryUrl = (id, params, options) => {
50
+ return axios.get(`/v1/images/${id}/url`, Object.assign(Object.assign({}, options), { params: Object.assign(Object.assign({}, params), options === null || options === void 0 ? void 0 : options.params) }));
51
+ };
790
52
  /**
791
- *
792
- * @summary Trigger (or retry) variant generation for an image
793
- * @param {DefaultApiProcessImageRequest} requestParameters Request parameters.
794
- * @param {*} [options] Override http request option.
795
- * @throws {RequiredError}
53
+ * @summary Generate signed imgproxy URLs for multiple images in a single request
796
54
  */
797
- processImage(requestParameters, options) {
798
- return DefaultApiFp(this.configuration).processImage(requestParameters.processImageRequest, options).then((request) => request(this.axios, this.basePath));
799
- }
55
+ const getDeliveryUrls = (batchUrlRequest, options) => {
56
+ return axios.post(`/v1/images/urls`, batchUrlRequest, options);
57
+ };
800
58
  /**
801
- *
802
59
  * @summary Promote images from a product draft to a final product
803
- * @param {DefaultApiPromoteImagesRequest} requestParameters Request parameters.
804
- * @param {*} [options] Override http request option.
805
- * @throws {RequiredError}
806
60
  */
807
- promoteImages(requestParameters, options) {
808
- return DefaultApiFp(this.configuration).promoteImages(requestParameters.promoteRequest, options).then((request) => request(this.axios, this.basePath));
809
- }
61
+ const promoteImages = (promoteRequest, options) => {
62
+ return axios.post(`/v1/images/promote`, promoteRequest, options);
63
+ };
810
64
  /**
811
- *
812
- * @summary Update image metadata (alt, role, order)
813
- * @param {DefaultApiUpdateImageRequest} requestParameters Request parameters.
814
- * @param {*} [options] Override http request option.
815
- * @throws {RequiredError}
65
+ * @summary Trigger (or retry) variant generation for an image
816
66
  */
817
- updateImage(requestParameters, options) {
818
- return DefaultApiFp(this.configuration).updateImage(requestParameters.id, requestParameters.imagePatch, options).then((request) => request(this.axios, this.basePath));
819
- }
820
- }
821
- export const GetDeliveryUrlFitEnum = {
822
- Cover: 'cover',
823
- Contain: 'contain',
824
- Fill: 'fill',
825
- Inside: 'inside',
826
- Outside: 'outside'
827
- };
828
- export const GetDeliveryUrlFormatEnum = {
829
- Original: 'original',
830
- Webp: 'webp',
831
- Avif: 'avif',
832
- Jpeg: 'jpeg',
833
- Png: 'png'
67
+ const processImage = (processImageBody, options) => {
68
+ return axios.post(`/v1/internal/images/process`, processImageBody, options);
69
+ };
70
+ return { createPresign, confirmUpload, listImages, getImage, updateImage, deleteImage, getDeliveryUrl, getDeliveryUrls, promoteImages, processImage };
834
71
  };