@wix/auto_sdk_fast-gallery_galleries 1.0.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.
@@ -0,0 +1,1030 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ SortOrder: () => SortOrder,
24
+ Variant: () => Variant,
25
+ WebhookIdentityType: () => WebhookIdentityType,
26
+ bulkCreateGalleries: () => bulkCreateGalleries4,
27
+ bulkDeleteGalleries: () => bulkDeleteGalleries4,
28
+ bulkUpdateGalleries: () => bulkUpdateGalleries4,
29
+ createGallery: () => createGallery4,
30
+ getDeletedGallery: () => getDeletedGallery4,
31
+ getGallery: () => getGallery4,
32
+ getGalleryByDraftGalleryId: () => getGalleryByDraftGalleryId4,
33
+ listDeletedGalleries: () => listDeletedGalleries4,
34
+ onGalleryRemovedFromTrashBin: () => onGalleryRemovedFromTrashBin2,
35
+ queryGalleries: () => queryGalleries4,
36
+ removeGalleryFromTrashBin: () => removeGalleryFromTrashBin4,
37
+ restoreGalleryFromTrashBin: () => restoreGalleryFromTrashBin4,
38
+ updateExtendedFields: () => updateExtendedFields4,
39
+ updateGallery: () => updateGallery4
40
+ });
41
+ module.exports = __toCommonJS(index_exports);
42
+
43
+ // src/fastgallery-gallery-v1-gallery-galleries.public.ts
44
+ var import_rename_all_nested_keys2 = require("@wix/sdk-runtime/rename-all-nested-keys");
45
+ var import_timestamp3 = require("@wix/sdk-runtime/transformations/timestamp");
46
+ var import_transform_paths3 = require("@wix/sdk-runtime/transformations/transform-paths");
47
+ var import_sdk_types = require("@wix/sdk-types");
48
+
49
+ // src/fastgallery-gallery-v1-gallery-galleries.universal.ts
50
+ var import_transform_error = require("@wix/sdk-runtime/transform-error");
51
+ var import_query_builder = require("@wix/sdk-runtime/query-builder");
52
+ var import_rename_all_nested_keys = require("@wix/sdk-runtime/rename-all-nested-keys");
53
+
54
+ // src/fastgallery-gallery-v1-gallery-galleries.http.ts
55
+ var import_rest_modules = require("@wix/sdk-runtime/rest-modules");
56
+ var import_timestamp = require("@wix/sdk-runtime/transformations/timestamp");
57
+ var import_timestamp2 = require("@wix/sdk-runtime/transformations/timestamp");
58
+ var import_field_mask = require("@wix/sdk-runtime/transformations/field-mask");
59
+ var import_transform_paths = require("@wix/sdk-runtime/transformations/transform-paths");
60
+ var import_rest_modules2 = require("@wix/sdk-runtime/rest-modules");
61
+ function resolveWixFastgalleryGalleryV1GalleryServiceUrl(opts) {
62
+ const domainToMappings = {
63
+ "editor._base_domain_": [
64
+ {
65
+ srcPath: "/_api/gallery",
66
+ destPath: ""
67
+ }
68
+ ],
69
+ "blocks._base_domain_": [
70
+ {
71
+ srcPath: "/_api/gallery",
72
+ destPath: ""
73
+ }
74
+ ],
75
+ "create.editorx": [
76
+ {
77
+ srcPath: "/_api/gallery",
78
+ destPath: ""
79
+ }
80
+ ],
81
+ _: [
82
+ {
83
+ srcPath: "/_api/gallery",
84
+ destPath: ""
85
+ }
86
+ ],
87
+ "*.dev.wix-code.com": [
88
+ {
89
+ srcPath: "/_api/gallery",
90
+ destPath: ""
91
+ }
92
+ ],
93
+ "www.wixapis.com": [
94
+ {
95
+ srcPath: "/fastgallery/gallery/v1/bulk/galleries",
96
+ destPath: "/v1/bulk/galleries"
97
+ },
98
+ {
99
+ srcPath: "/fastgallery/gallery/v1/galleries",
100
+ destPath: "/v1/galleries"
101
+ }
102
+ ]
103
+ };
104
+ return (0, import_rest_modules2.resolveUrl)(Object.assign(opts, { domainToMappings }));
105
+ }
106
+ var PACKAGE_NAME = "@wix/auto_sdk_fast-gallery_galleries";
107
+ function createGallery(payload) {
108
+ function __createGallery({ host }) {
109
+ const serializedData = (0, import_transform_paths.transformPaths)(payload, [
110
+ {
111
+ transformFn: import_timestamp.transformSDKTimestampToRESTTimestamp,
112
+ paths: [
113
+ { path: "gallery.createdDate" },
114
+ { path: "gallery.updatedDate" }
115
+ ]
116
+ }
117
+ ]);
118
+ const metadata = {
119
+ entityFqdn: "wix.fastgallery.gallery.v1.gallery",
120
+ method: "POST",
121
+ methodFqn: "wix.fastgallery.gallery.v1.GalleryService.CreateGallery",
122
+ packageName: PACKAGE_NAME,
123
+ url: resolveWixFastgalleryGalleryV1GalleryServiceUrl({
124
+ protoPath: "/v1/galleries",
125
+ data: serializedData,
126
+ host
127
+ }),
128
+ data: serializedData,
129
+ transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
130
+ {
131
+ transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
132
+ paths: [
133
+ { path: "gallery.createdDate" },
134
+ { path: "gallery.updatedDate" }
135
+ ]
136
+ }
137
+ ])
138
+ };
139
+ return metadata;
140
+ }
141
+ return __createGallery;
142
+ }
143
+ function getGallery(payload) {
144
+ function __getGallery({ host }) {
145
+ const metadata = {
146
+ entityFqdn: "wix.fastgallery.gallery.v1.gallery",
147
+ method: "GET",
148
+ methodFqn: "wix.fastgallery.gallery.v1.GalleryService.GetGallery",
149
+ packageName: PACKAGE_NAME,
150
+ url: resolveWixFastgalleryGalleryV1GalleryServiceUrl({
151
+ protoPath: "/v1/galleries/{galleryId}",
152
+ data: payload,
153
+ host
154
+ }),
155
+ params: (0, import_rest_modules.toURLSearchParams)(payload),
156
+ transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
157
+ {
158
+ transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
159
+ paths: [
160
+ { path: "gallery.createdDate" },
161
+ { path: "gallery.updatedDate" }
162
+ ]
163
+ }
164
+ ])
165
+ };
166
+ return metadata;
167
+ }
168
+ return __getGallery;
169
+ }
170
+ function getGalleryByDraftGalleryId(payload) {
171
+ function __getGalleryByDraftGalleryId({ host }) {
172
+ const metadata = {
173
+ entityFqdn: "wix.fastgallery.gallery.v1.gallery",
174
+ method: "GET",
175
+ methodFqn: "wix.fastgallery.gallery.v1.GalleryService.GetGalleryByDraftGalleryId",
176
+ packageName: PACKAGE_NAME,
177
+ url: resolveWixFastgalleryGalleryV1GalleryServiceUrl({
178
+ protoPath: "/v1/galleries/draft-gallery-id/{draftGalleryId}",
179
+ data: payload,
180
+ host
181
+ }),
182
+ params: (0, import_rest_modules.toURLSearchParams)(payload),
183
+ transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
184
+ {
185
+ transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
186
+ paths: [
187
+ { path: "gallery.createdDate" },
188
+ { path: "gallery.updatedDate" }
189
+ ]
190
+ }
191
+ ])
192
+ };
193
+ return metadata;
194
+ }
195
+ return __getGalleryByDraftGalleryId;
196
+ }
197
+ function updateGallery(payload) {
198
+ function __updateGallery({ host }) {
199
+ const serializedData = (0, import_transform_paths.transformPaths)(payload, [
200
+ {
201
+ transformFn: import_field_mask.transformSDKFieldMaskToRESTFieldMask,
202
+ paths: [{ path: "fieldMask" }]
203
+ },
204
+ {
205
+ transformFn: import_timestamp.transformSDKTimestampToRESTTimestamp,
206
+ paths: [
207
+ { path: "gallery.createdDate" },
208
+ { path: "gallery.updatedDate" }
209
+ ]
210
+ }
211
+ ]);
212
+ const metadata = {
213
+ entityFqdn: "wix.fastgallery.gallery.v1.gallery",
214
+ method: "PATCH",
215
+ methodFqn: "wix.fastgallery.gallery.v1.GalleryService.UpdateGallery",
216
+ packageName: PACKAGE_NAME,
217
+ url: resolveWixFastgalleryGalleryV1GalleryServiceUrl({
218
+ protoPath: "/v1/galleries/{gallery.id}",
219
+ data: serializedData,
220
+ host
221
+ }),
222
+ data: serializedData,
223
+ transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
224
+ {
225
+ transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
226
+ paths: [
227
+ { path: "gallery.createdDate" },
228
+ { path: "gallery.updatedDate" }
229
+ ]
230
+ }
231
+ ])
232
+ };
233
+ return metadata;
234
+ }
235
+ return __updateGallery;
236
+ }
237
+ function queryGalleries(payload) {
238
+ function __queryGalleries({ host }) {
239
+ const metadata = {
240
+ entityFqdn: "wix.fastgallery.gallery.v1.gallery",
241
+ method: "POST",
242
+ methodFqn: "wix.fastgallery.gallery.v1.GalleryService.QueryGalleries",
243
+ packageName: PACKAGE_NAME,
244
+ url: resolveWixFastgalleryGalleryV1GalleryServiceUrl({
245
+ protoPath: "/v1/galleries/query",
246
+ data: payload,
247
+ host
248
+ }),
249
+ data: payload,
250
+ transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
251
+ {
252
+ transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
253
+ paths: [
254
+ { path: "galleries.createdDate" },
255
+ { path: "galleries.updatedDate" }
256
+ ]
257
+ }
258
+ ]),
259
+ fallback: [
260
+ {
261
+ method: "POST",
262
+ url: resolveWixFastgalleryGalleryV1GalleryServiceUrl({
263
+ protoPath: "/v1/galleries/query",
264
+ data: payload,
265
+ host
266
+ }),
267
+ data: payload
268
+ }
269
+ ]
270
+ };
271
+ return metadata;
272
+ }
273
+ return __queryGalleries;
274
+ }
275
+ function updateExtendedFields(payload) {
276
+ function __updateExtendedFields({ host }) {
277
+ const metadata = {
278
+ entityFqdn: "wix.fastgallery.gallery.v1.gallery",
279
+ method: "POST",
280
+ methodFqn: "wix.fastgallery.gallery.v1.GalleryService.UpdateExtendedFields",
281
+ packageName: PACKAGE_NAME,
282
+ url: resolveWixFastgalleryGalleryV1GalleryServiceUrl({
283
+ protoPath: "/v1/galleries/{id}/update-extended-fields",
284
+ data: payload,
285
+ host
286
+ }),
287
+ data: payload,
288
+ transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
289
+ {
290
+ transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
291
+ paths: [
292
+ { path: "gallery.createdDate" },
293
+ { path: "gallery.updatedDate" }
294
+ ]
295
+ }
296
+ ])
297
+ };
298
+ return metadata;
299
+ }
300
+ return __updateExtendedFields;
301
+ }
302
+ function bulkCreateGalleries(payload) {
303
+ function __bulkCreateGalleries({ host }) {
304
+ const serializedData = (0, import_transform_paths.transformPaths)(payload, [
305
+ {
306
+ transformFn: import_timestamp.transformSDKTimestampToRESTTimestamp,
307
+ paths: [
308
+ { path: "galleries.createdDate" },
309
+ { path: "galleries.updatedDate" }
310
+ ]
311
+ }
312
+ ]);
313
+ const metadata = {
314
+ entityFqdn: "wix.fastgallery.gallery.v1.gallery",
315
+ method: "POST",
316
+ methodFqn: "wix.fastgallery.gallery.v1.GalleryService.BulkCreateGalleries",
317
+ packageName: PACKAGE_NAME,
318
+ url: resolveWixFastgalleryGalleryV1GalleryServiceUrl({
319
+ protoPath: "/v1/bulk/galleries/create",
320
+ data: serializedData,
321
+ host
322
+ }),
323
+ data: serializedData,
324
+ transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
325
+ {
326
+ transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
327
+ paths: [
328
+ { path: "results.item.createdDate" },
329
+ { path: "results.item.updatedDate" }
330
+ ]
331
+ }
332
+ ])
333
+ };
334
+ return metadata;
335
+ }
336
+ return __bulkCreateGalleries;
337
+ }
338
+ function bulkUpdateGalleries(payload) {
339
+ function __bulkUpdateGalleries({ host }) {
340
+ const serializedData = (0, import_transform_paths.transformPaths)(payload, [
341
+ {
342
+ transformFn: import_field_mask.transformSDKFieldMaskToRESTFieldMask,
343
+ paths: [{ path: "galleries.fieldMask" }]
344
+ },
345
+ {
346
+ transformFn: import_timestamp.transformSDKTimestampToRESTTimestamp,
347
+ paths: [
348
+ { path: "galleries.gallery.createdDate" },
349
+ { path: "galleries.gallery.updatedDate" }
350
+ ]
351
+ }
352
+ ]);
353
+ const metadata = {
354
+ entityFqdn: "wix.fastgallery.gallery.v1.gallery",
355
+ method: "POST",
356
+ methodFqn: "wix.fastgallery.gallery.v1.GalleryService.BulkUpdateGalleries",
357
+ packageName: PACKAGE_NAME,
358
+ url: resolveWixFastgalleryGalleryV1GalleryServiceUrl({
359
+ protoPath: "/v1/bulk/galleries/update",
360
+ data: serializedData,
361
+ host
362
+ }),
363
+ data: serializedData,
364
+ transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
365
+ {
366
+ transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
367
+ paths: [
368
+ { path: "results.item.createdDate" },
369
+ { path: "results.item.updatedDate" }
370
+ ]
371
+ }
372
+ ])
373
+ };
374
+ return metadata;
375
+ }
376
+ return __bulkUpdateGalleries;
377
+ }
378
+ function bulkDeleteGalleries(payload) {
379
+ function __bulkDeleteGalleries({ host }) {
380
+ const metadata = {
381
+ entityFqdn: "wix.fastgallery.gallery.v1.gallery",
382
+ method: "POST",
383
+ methodFqn: "wix.fastgallery.gallery.v1.GalleryService.BulkDeleteGalleries",
384
+ packageName: PACKAGE_NAME,
385
+ url: resolveWixFastgalleryGalleryV1GalleryServiceUrl({
386
+ protoPath: "/v1/bulk/galleries/delete",
387
+ data: payload,
388
+ host
389
+ }),
390
+ data: payload
391
+ };
392
+ return metadata;
393
+ }
394
+ return __bulkDeleteGalleries;
395
+ }
396
+ function getDeletedGallery(payload) {
397
+ function __getDeletedGallery({ host }) {
398
+ const metadata = {
399
+ entityFqdn: "wix.fastgallery.gallery.v1.gallery",
400
+ method: "GET",
401
+ methodFqn: "wix.fastgallery.gallery.v1.GalleryService.GetDeletedGallery",
402
+ packageName: PACKAGE_NAME,
403
+ url: resolveWixFastgalleryGalleryV1GalleryServiceUrl({
404
+ protoPath: "/v1/galleries/trash-bin/{galleryId}",
405
+ data: payload,
406
+ host
407
+ }),
408
+ params: (0, import_rest_modules.toURLSearchParams)(payload),
409
+ transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
410
+ {
411
+ transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
412
+ paths: [
413
+ { path: "gallery.createdDate" },
414
+ { path: "gallery.updatedDate" }
415
+ ]
416
+ }
417
+ ])
418
+ };
419
+ return metadata;
420
+ }
421
+ return __getDeletedGallery;
422
+ }
423
+ function listDeletedGalleries(payload) {
424
+ function __listDeletedGalleries({ host }) {
425
+ const metadata = {
426
+ entityFqdn: "wix.fastgallery.gallery.v1.gallery",
427
+ method: "GET",
428
+ methodFqn: "wix.fastgallery.gallery.v1.GalleryService.ListDeletedGalleries",
429
+ packageName: PACKAGE_NAME,
430
+ url: resolveWixFastgalleryGalleryV1GalleryServiceUrl({
431
+ protoPath: "/v1/galleries/trash-bin",
432
+ data: payload,
433
+ host
434
+ }),
435
+ params: (0, import_rest_modules.toURLSearchParams)(payload),
436
+ transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
437
+ {
438
+ transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
439
+ paths: [
440
+ { path: "galleries.createdDate" },
441
+ { path: "galleries.updatedDate" }
442
+ ]
443
+ }
444
+ ])
445
+ };
446
+ return metadata;
447
+ }
448
+ return __listDeletedGalleries;
449
+ }
450
+ function restoreGalleryFromTrashBin(payload) {
451
+ function __restoreGalleryFromTrashBin({ host }) {
452
+ const metadata = {
453
+ entityFqdn: "wix.fastgallery.gallery.v1.gallery",
454
+ method: "POST",
455
+ methodFqn: "wix.fastgallery.gallery.v1.GalleryService.RestoreGalleryFromTrashBin",
456
+ packageName: PACKAGE_NAME,
457
+ url: resolveWixFastgalleryGalleryV1GalleryServiceUrl({
458
+ protoPath: "/v1/galleries/trash-bin/{galleryId}/restore",
459
+ data: payload,
460
+ host
461
+ }),
462
+ data: payload,
463
+ transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
464
+ {
465
+ transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
466
+ paths: [
467
+ { path: "gallery.createdDate" },
468
+ { path: "gallery.updatedDate" }
469
+ ]
470
+ }
471
+ ])
472
+ };
473
+ return metadata;
474
+ }
475
+ return __restoreGalleryFromTrashBin;
476
+ }
477
+ function removeGalleryFromTrashBin(payload) {
478
+ function __removeGalleryFromTrashBin({ host }) {
479
+ const metadata = {
480
+ entityFqdn: "wix.fastgallery.gallery.v1.gallery",
481
+ method: "DELETE",
482
+ methodFqn: "wix.fastgallery.gallery.v1.GalleryService.RemoveGalleryFromTrashBin",
483
+ packageName: PACKAGE_NAME,
484
+ url: resolveWixFastgalleryGalleryV1GalleryServiceUrl({
485
+ protoPath: "/v1/galleries/trash-bin/{galleryId}",
486
+ data: payload,
487
+ host
488
+ }),
489
+ params: (0, import_rest_modules.toURLSearchParams)(payload)
490
+ };
491
+ return metadata;
492
+ }
493
+ return __removeGalleryFromTrashBin;
494
+ }
495
+
496
+ // src/fastgallery-gallery-v1-gallery-galleries.universal.ts
497
+ var import_transform_paths2 = require("@wix/sdk-runtime/transformations/transform-paths");
498
+ var Variant = /* @__PURE__ */ ((Variant2) => {
499
+ Variant2["UNKNOWN_VARIANT"] = "UNKNOWN_VARIANT";
500
+ Variant2["LIVE"] = "LIVE";
501
+ Variant2["RC"] = "RC";
502
+ return Variant2;
503
+ })(Variant || {});
504
+ var SortOrder = /* @__PURE__ */ ((SortOrder2) => {
505
+ SortOrder2["ASC"] = "ASC";
506
+ SortOrder2["DESC"] = "DESC";
507
+ return SortOrder2;
508
+ })(SortOrder || {});
509
+ var WebhookIdentityType = /* @__PURE__ */ ((WebhookIdentityType2) => {
510
+ WebhookIdentityType2["UNKNOWN"] = "UNKNOWN";
511
+ WebhookIdentityType2["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
512
+ WebhookIdentityType2["MEMBER"] = "MEMBER";
513
+ WebhookIdentityType2["WIX_USER"] = "WIX_USER";
514
+ WebhookIdentityType2["APP"] = "APP";
515
+ return WebhookIdentityType2;
516
+ })(WebhookIdentityType || {});
517
+ async function createGallery2(gallery) {
518
+ const { httpClient, sideEffects } = arguments[1];
519
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({ gallery });
520
+ const reqOpts = createGallery(payload);
521
+ sideEffects?.onSiteCall?.();
522
+ try {
523
+ const result = await httpClient.request(reqOpts);
524
+ sideEffects?.onSuccess?.(result);
525
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data)?.gallery;
526
+ } catch (err) {
527
+ const transformedError = (0, import_transform_error.transformError)(
528
+ err,
529
+ {
530
+ spreadPathsToArguments: {},
531
+ explicitPathsToArguments: { gallery: "$[0]" },
532
+ singleArgumentUnchanged: false
533
+ },
534
+ ["gallery"]
535
+ );
536
+ sideEffects?.onError?.(err);
537
+ throw transformedError;
538
+ }
539
+ }
540
+ async function getGallery2(galleryId) {
541
+ const { httpClient, sideEffects } = arguments[1];
542
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
543
+ galleryId
544
+ });
545
+ const reqOpts = getGallery(payload);
546
+ sideEffects?.onSiteCall?.();
547
+ try {
548
+ const result = await httpClient.request(reqOpts);
549
+ sideEffects?.onSuccess?.(result);
550
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data)?.gallery;
551
+ } catch (err) {
552
+ const transformedError = (0, import_transform_error.transformError)(
553
+ err,
554
+ {
555
+ spreadPathsToArguments: {},
556
+ explicitPathsToArguments: { galleryId: "$[0]" },
557
+ singleArgumentUnchanged: false
558
+ },
559
+ ["galleryId"]
560
+ );
561
+ sideEffects?.onError?.(err);
562
+ throw transformedError;
563
+ }
564
+ }
565
+ async function getGalleryByDraftGalleryId2(draftGalleryId) {
566
+ const { httpClient, sideEffects } = arguments[1];
567
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
568
+ draftGalleryId
569
+ });
570
+ const reqOpts = getGalleryByDraftGalleryId(
571
+ payload
572
+ );
573
+ sideEffects?.onSiteCall?.();
574
+ try {
575
+ const result = await httpClient.request(reqOpts);
576
+ sideEffects?.onSuccess?.(result);
577
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
578
+ } catch (err) {
579
+ const transformedError = (0, import_transform_error.transformError)(
580
+ err,
581
+ {
582
+ spreadPathsToArguments: {},
583
+ explicitPathsToArguments: { draftGalleryId: "$[0]" },
584
+ singleArgumentUnchanged: false
585
+ },
586
+ ["draftGalleryId"]
587
+ );
588
+ sideEffects?.onError?.(err);
589
+ throw transformedError;
590
+ }
591
+ }
592
+ async function updateGallery2(_id, gallery) {
593
+ const { httpClient, sideEffects } = arguments[2];
594
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
595
+ gallery: { ...gallery, id: _id }
596
+ });
597
+ const reqOpts = updateGallery(payload);
598
+ sideEffects?.onSiteCall?.();
599
+ try {
600
+ const result = await httpClient.request(reqOpts);
601
+ sideEffects?.onSuccess?.(result);
602
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data)?.gallery;
603
+ } catch (err) {
604
+ const transformedError = (0, import_transform_error.transformError)(
605
+ err,
606
+ {
607
+ spreadPathsToArguments: { gallery: "$[1]" },
608
+ explicitPathsToArguments: { "gallery.id": "$[0]" },
609
+ singleArgumentUnchanged: false
610
+ },
611
+ ["_id", "gallery"]
612
+ );
613
+ sideEffects?.onError?.(err);
614
+ throw transformedError;
615
+ }
616
+ }
617
+ function queryGalleries2() {
618
+ const { httpClient, sideEffects } = arguments[0];
619
+ return (0, import_query_builder.queryBuilder)({
620
+ func: async (payload) => {
621
+ const reqOpts = queryGalleries(payload);
622
+ sideEffects?.onSiteCall?.();
623
+ try {
624
+ const result = await httpClient.request(reqOpts);
625
+ sideEffects?.onSuccess?.(result);
626
+ return result;
627
+ } catch (err) {
628
+ sideEffects?.onError?.(err);
629
+ throw err;
630
+ }
631
+ },
632
+ requestTransformer: (query) => {
633
+ const args = [query, {}];
634
+ return (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
635
+ ...args?.[1],
636
+ query: args?.[0]
637
+ });
638
+ },
639
+ responseTransformer: ({ data }) => {
640
+ const transformedData = (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(
641
+ (0, import_transform_paths2.transformPaths)(data, [])
642
+ );
643
+ return {
644
+ items: transformedData?.galleries,
645
+ pagingMetadata: transformedData?.pagingMetadata
646
+ };
647
+ },
648
+ errorTransformer: (err) => {
649
+ const transformedError = (0, import_transform_error.transformError)(err, {
650
+ spreadPathsToArguments: {},
651
+ explicitPathsToArguments: { query: "$[0]" },
652
+ singleArgumentUnchanged: false
653
+ });
654
+ throw transformedError;
655
+ },
656
+ pagingMethod: "CURSOR",
657
+ transformationPaths: {}
658
+ });
659
+ }
660
+ async function updateExtendedFields2(_id, namespace, options) {
661
+ const { httpClient, sideEffects } = arguments[3];
662
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
663
+ id: _id,
664
+ namespace,
665
+ namespaceData: options?.namespaceData
666
+ });
667
+ const reqOpts = updateExtendedFields(payload);
668
+ sideEffects?.onSiteCall?.();
669
+ try {
670
+ const result = await httpClient.request(reqOpts);
671
+ sideEffects?.onSuccess?.(result);
672
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
673
+ } catch (err) {
674
+ const transformedError = (0, import_transform_error.transformError)(
675
+ err,
676
+ {
677
+ spreadPathsToArguments: {},
678
+ explicitPathsToArguments: {
679
+ id: "$[0]",
680
+ namespace: "$[1]",
681
+ namespaceData: "$[2].namespaceData"
682
+ },
683
+ singleArgumentUnchanged: false
684
+ },
685
+ ["_id", "namespace", "options"]
686
+ );
687
+ sideEffects?.onError?.(err);
688
+ throw transformedError;
689
+ }
690
+ }
691
+ async function bulkCreateGalleries2(galleries, options) {
692
+ const { httpClient, sideEffects } = arguments[2];
693
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
694
+ galleries,
695
+ returnEntity: options?.returnEntity
696
+ });
697
+ const reqOpts = bulkCreateGalleries(payload);
698
+ sideEffects?.onSiteCall?.();
699
+ try {
700
+ const result = await httpClient.request(reqOpts);
701
+ sideEffects?.onSuccess?.(result);
702
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
703
+ } catch (err) {
704
+ const transformedError = (0, import_transform_error.transformError)(
705
+ err,
706
+ {
707
+ spreadPathsToArguments: {},
708
+ explicitPathsToArguments: {
709
+ galleries: "$[0]",
710
+ returnEntity: "$[1].returnEntity"
711
+ },
712
+ singleArgumentUnchanged: false
713
+ },
714
+ ["galleries", "options"]
715
+ );
716
+ sideEffects?.onError?.(err);
717
+ throw transformedError;
718
+ }
719
+ }
720
+ async function bulkUpdateGalleries2(galleries, options) {
721
+ const { httpClient, sideEffects } = arguments[2];
722
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
723
+ galleries,
724
+ returnEntity: options?.returnEntity
725
+ });
726
+ const reqOpts = bulkUpdateGalleries(payload);
727
+ sideEffects?.onSiteCall?.();
728
+ try {
729
+ const result = await httpClient.request(reqOpts);
730
+ sideEffects?.onSuccess?.(result);
731
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
732
+ } catch (err) {
733
+ const transformedError = (0, import_transform_error.transformError)(
734
+ err,
735
+ {
736
+ spreadPathsToArguments: {},
737
+ explicitPathsToArguments: {
738
+ galleries: "$[0]",
739
+ returnEntity: "$[1].returnEntity"
740
+ },
741
+ singleArgumentUnchanged: false
742
+ },
743
+ ["galleries", "options"]
744
+ );
745
+ sideEffects?.onError?.(err);
746
+ throw transformedError;
747
+ }
748
+ }
749
+ async function bulkDeleteGalleries2(galleryIds) {
750
+ const { httpClient, sideEffects } = arguments[1];
751
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
752
+ galleryIds
753
+ });
754
+ const reqOpts = bulkDeleteGalleries(payload);
755
+ sideEffects?.onSiteCall?.();
756
+ try {
757
+ const result = await httpClient.request(reqOpts);
758
+ sideEffects?.onSuccess?.(result);
759
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
760
+ } catch (err) {
761
+ const transformedError = (0, import_transform_error.transformError)(
762
+ err,
763
+ {
764
+ spreadPathsToArguments: {},
765
+ explicitPathsToArguments: { galleryIds: "$[0]" },
766
+ singleArgumentUnchanged: false
767
+ },
768
+ ["galleryIds"]
769
+ );
770
+ sideEffects?.onError?.(err);
771
+ throw transformedError;
772
+ }
773
+ }
774
+ async function getDeletedGallery2(galleryId) {
775
+ const { httpClient, sideEffects } = arguments[1];
776
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
777
+ galleryId
778
+ });
779
+ const reqOpts = getDeletedGallery(payload);
780
+ sideEffects?.onSiteCall?.();
781
+ try {
782
+ const result = await httpClient.request(reqOpts);
783
+ sideEffects?.onSuccess?.(result);
784
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
785
+ } catch (err) {
786
+ const transformedError = (0, import_transform_error.transformError)(
787
+ err,
788
+ {
789
+ spreadPathsToArguments: {},
790
+ explicitPathsToArguments: { galleryId: "$[0]" },
791
+ singleArgumentUnchanged: false
792
+ },
793
+ ["galleryId"]
794
+ );
795
+ sideEffects?.onError?.(err);
796
+ throw transformedError;
797
+ }
798
+ }
799
+ async function listDeletedGalleries2(options) {
800
+ const { httpClient, sideEffects } = arguments[1];
801
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
802
+ cursorPaging: options?.cursorPaging,
803
+ galleryIds: options?.galleryIds
804
+ });
805
+ const reqOpts = listDeletedGalleries(payload);
806
+ sideEffects?.onSiteCall?.();
807
+ try {
808
+ const result = await httpClient.request(reqOpts);
809
+ sideEffects?.onSuccess?.(result);
810
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
811
+ } catch (err) {
812
+ const transformedError = (0, import_transform_error.transformError)(
813
+ err,
814
+ {
815
+ spreadPathsToArguments: {},
816
+ explicitPathsToArguments: {
817
+ cursorPaging: "$[0].cursorPaging",
818
+ galleryIds: "$[0].galleryIds"
819
+ },
820
+ singleArgumentUnchanged: false
821
+ },
822
+ ["options"]
823
+ );
824
+ sideEffects?.onError?.(err);
825
+ throw transformedError;
826
+ }
827
+ }
828
+ async function restoreGalleryFromTrashBin2(galleryId) {
829
+ const { httpClient, sideEffects } = arguments[1];
830
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
831
+ galleryId
832
+ });
833
+ const reqOpts = restoreGalleryFromTrashBin(
834
+ payload
835
+ );
836
+ sideEffects?.onSiteCall?.();
837
+ try {
838
+ const result = await httpClient.request(reqOpts);
839
+ sideEffects?.onSuccess?.(result);
840
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
841
+ } catch (err) {
842
+ const transformedError = (0, import_transform_error.transformError)(
843
+ err,
844
+ {
845
+ spreadPathsToArguments: {},
846
+ explicitPathsToArguments: { galleryId: "$[0]" },
847
+ singleArgumentUnchanged: false
848
+ },
849
+ ["galleryId"]
850
+ );
851
+ sideEffects?.onError?.(err);
852
+ throw transformedError;
853
+ }
854
+ }
855
+ async function removeGalleryFromTrashBin2(galleryId) {
856
+ const { httpClient, sideEffects } = arguments[1];
857
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
858
+ galleryId
859
+ });
860
+ const reqOpts = removeGalleryFromTrashBin(payload);
861
+ sideEffects?.onSiteCall?.();
862
+ try {
863
+ const result = await httpClient.request(reqOpts);
864
+ sideEffects?.onSuccess?.(result);
865
+ } catch (err) {
866
+ const transformedError = (0, import_transform_error.transformError)(
867
+ err,
868
+ {
869
+ spreadPathsToArguments: {},
870
+ explicitPathsToArguments: { galleryId: "$[0]" },
871
+ singleArgumentUnchanged: false
872
+ },
873
+ ["galleryId"]
874
+ );
875
+ sideEffects?.onError?.(err);
876
+ throw transformedError;
877
+ }
878
+ }
879
+
880
+ // src/fastgallery-gallery-v1-gallery-galleries.public.ts
881
+ function createGallery3(httpClient) {
882
+ return (gallery) => createGallery2(
883
+ gallery,
884
+ // @ts-ignore
885
+ { httpClient }
886
+ );
887
+ }
888
+ function getGallery3(httpClient) {
889
+ return (galleryId) => getGallery2(
890
+ galleryId,
891
+ // @ts-ignore
892
+ { httpClient }
893
+ );
894
+ }
895
+ function getGalleryByDraftGalleryId3(httpClient) {
896
+ return (draftGalleryId) => getGalleryByDraftGalleryId2(
897
+ draftGalleryId,
898
+ // @ts-ignore
899
+ { httpClient }
900
+ );
901
+ }
902
+ function updateGallery3(httpClient) {
903
+ return (_id, gallery) => updateGallery2(
904
+ _id,
905
+ gallery,
906
+ // @ts-ignore
907
+ { httpClient }
908
+ );
909
+ }
910
+ function queryGalleries3(httpClient) {
911
+ return () => queryGalleries2(
912
+ // @ts-ignore
913
+ { httpClient }
914
+ );
915
+ }
916
+ function updateExtendedFields3(httpClient) {
917
+ return (_id, namespace, options) => updateExtendedFields2(
918
+ _id,
919
+ namespace,
920
+ options,
921
+ // @ts-ignore
922
+ { httpClient }
923
+ );
924
+ }
925
+ function bulkCreateGalleries3(httpClient) {
926
+ return (galleries, options) => bulkCreateGalleries2(
927
+ galleries,
928
+ options,
929
+ // @ts-ignore
930
+ { httpClient }
931
+ );
932
+ }
933
+ function bulkUpdateGalleries3(httpClient) {
934
+ return (galleries, options) => bulkUpdateGalleries2(
935
+ galleries,
936
+ options,
937
+ // @ts-ignore
938
+ { httpClient }
939
+ );
940
+ }
941
+ function bulkDeleteGalleries3(httpClient) {
942
+ return (galleryIds) => bulkDeleteGalleries2(
943
+ galleryIds,
944
+ // @ts-ignore
945
+ { httpClient }
946
+ );
947
+ }
948
+ function getDeletedGallery3(httpClient) {
949
+ return (galleryId) => getDeletedGallery2(
950
+ galleryId,
951
+ // @ts-ignore
952
+ { httpClient }
953
+ );
954
+ }
955
+ function listDeletedGalleries3(httpClient) {
956
+ return (options) => listDeletedGalleries2(
957
+ options,
958
+ // @ts-ignore
959
+ { httpClient }
960
+ );
961
+ }
962
+ function restoreGalleryFromTrashBin3(httpClient) {
963
+ return (galleryId) => restoreGalleryFromTrashBin2(
964
+ galleryId,
965
+ // @ts-ignore
966
+ { httpClient }
967
+ );
968
+ }
969
+ function removeGalleryFromTrashBin3(httpClient) {
970
+ return (galleryId) => removeGalleryFromTrashBin2(
971
+ galleryId,
972
+ // @ts-ignore
973
+ { httpClient }
974
+ );
975
+ }
976
+ var onGalleryRemovedFromTrashBin = (0, import_sdk_types.EventDefinition)(
977
+ "wix.fastgallery.gallery.v1.gallery_gallery_removed_from_trash_bin",
978
+ true,
979
+ (event) => (0, import_rename_all_nested_keys2.renameKeysFromRESTResponseToSDKResponse)(
980
+ (0, import_transform_paths3.transformPaths)(event, [
981
+ {
982
+ transformFn: import_timestamp3.transformRESTTimestampToSDKTimestamp,
983
+ paths: [
984
+ { path: "data.gallery.createdDate" },
985
+ { path: "data.gallery.updatedDate" },
986
+ { path: "metadata.eventTime" }
987
+ ]
988
+ }
989
+ ])
990
+ )
991
+ )();
992
+
993
+ // src/fastgallery-gallery-v1-gallery-galleries.context.ts
994
+ var import_rest_modules3 = require("@wix/sdk-runtime/rest-modules");
995
+ var import_event_definition_modules = require("@wix/sdk-runtime/event-definition-modules");
996
+ var createGallery4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(createGallery3);
997
+ var getGallery4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(getGallery3);
998
+ var getGalleryByDraftGalleryId4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(getGalleryByDraftGalleryId3);
999
+ var updateGallery4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(updateGallery3);
1000
+ var queryGalleries4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(queryGalleries3);
1001
+ var updateExtendedFields4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(updateExtendedFields3);
1002
+ var bulkCreateGalleries4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(bulkCreateGalleries3);
1003
+ var bulkUpdateGalleries4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(bulkUpdateGalleries3);
1004
+ var bulkDeleteGalleries4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(bulkDeleteGalleries3);
1005
+ var getDeletedGallery4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(getDeletedGallery3);
1006
+ var listDeletedGalleries4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(listDeletedGalleries3);
1007
+ var restoreGalleryFromTrashBin4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(restoreGalleryFromTrashBin3);
1008
+ var removeGalleryFromTrashBin4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(removeGalleryFromTrashBin3);
1009
+ var onGalleryRemovedFromTrashBin2 = (0, import_event_definition_modules.createEventModule)(onGalleryRemovedFromTrashBin);
1010
+ // Annotate the CommonJS export names for ESM import in node:
1011
+ 0 && (module.exports = {
1012
+ SortOrder,
1013
+ Variant,
1014
+ WebhookIdentityType,
1015
+ bulkCreateGalleries,
1016
+ bulkDeleteGalleries,
1017
+ bulkUpdateGalleries,
1018
+ createGallery,
1019
+ getDeletedGallery,
1020
+ getGallery,
1021
+ getGalleryByDraftGalleryId,
1022
+ listDeletedGalleries,
1023
+ onGalleryRemovedFromTrashBin,
1024
+ queryGalleries,
1025
+ removeGalleryFromTrashBin,
1026
+ restoreGalleryFromTrashBin,
1027
+ updateExtendedFields,
1028
+ updateGallery
1029
+ });
1030
+ //# sourceMappingURL=index.js.map