@wix/pro-gallery 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.
Files changed (31) hide show
  1. package/build/cjs/index.d.ts +1 -0
  2. package/build/cjs/index.js +24 -0
  3. package/build/cjs/index.js.map +1 -0
  4. package/build/cjs/src/pro-gallery-v2-gallery.http.d.ts +88 -0
  5. package/build/cjs/src/pro-gallery-v2-gallery.http.js +537 -0
  6. package/build/cjs/src/pro-gallery-v2-gallery.http.js.map +1 -0
  7. package/build/cjs/src/pro-gallery-v2-gallery.public.d.ts +14 -0
  8. package/build/cjs/src/pro-gallery-v2-gallery.public.js +73 -0
  9. package/build/cjs/src/pro-gallery-v2-gallery.public.js.map +1 -0
  10. package/build/cjs/src/pro-gallery-v2-gallery.types.d.ts +867 -0
  11. package/build/cjs/src/pro-gallery-v2-gallery.types.js +64 -0
  12. package/build/cjs/src/pro-gallery-v2-gallery.types.js.map +1 -0
  13. package/build/cjs/src/pro-gallery-v2-gallery.universal.d.ts +1106 -0
  14. package/build/cjs/src/pro-gallery-v2-gallery.universal.js +703 -0
  15. package/build/cjs/src/pro-gallery-v2-gallery.universal.js.map +1 -0
  16. package/build/es/index.d.ts +1 -0
  17. package/build/es/index.js +2 -0
  18. package/build/es/index.js.map +1 -0
  19. package/build/es/src/pro-gallery-v2-gallery.http.d.ts +88 -0
  20. package/build/es/src/pro-gallery-v2-gallery.http.js +524 -0
  21. package/build/es/src/pro-gallery-v2-gallery.http.js.map +1 -0
  22. package/build/es/src/pro-gallery-v2-gallery.public.d.ts +14 -0
  23. package/build/es/src/pro-gallery-v2-gallery.public.js +53 -0
  24. package/build/es/src/pro-gallery-v2-gallery.public.js.map +1 -0
  25. package/build/es/src/pro-gallery-v2-gallery.types.d.ts +867 -0
  26. package/build/es/src/pro-gallery-v2-gallery.types.js +61 -0
  27. package/build/es/src/pro-gallery-v2-gallery.types.js.map +1 -0
  28. package/build/es/src/pro-gallery-v2-gallery.universal.d.ts +1106 -0
  29. package/build/es/src/pro-gallery-v2-gallery.universal.js +671 -0
  30. package/build/es/src/pro-gallery-v2-gallery.universal.js.map +1 -0
  31. package/package.json +37 -0
@@ -0,0 +1,703 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
22
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
23
+ return new (P || (P = Promise))(function (resolve, reject) {
24
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
25
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
26
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
27
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
28
+ });
29
+ };
30
+ Object.defineProperty(exports, "__esModule", { value: true });
31
+ exports.deleteGalleryItem = exports.updateGalleryItem = exports.createGalleryItem = exports.deleteGallery = exports.updateGallery = exports.createGallery = exports.getGalleryItem = exports.listGalleryItems = exports.getGallery = exports.listGalleries = exports.State = exports.SearchIndexingNotificationState = exports.Enum = exports.VideoType = exports.ImageType = exports.Type = exports.LinkType = exports.__debug = void 0;
32
+ const velo_1 = require("@wix/metro-runtime/velo");
33
+ const ambassadorWixProGalleryV2Gallery = __importStar(require("./pro-gallery-v2-gallery.http"));
34
+ let __verbose = false;
35
+ function __log(...args) {
36
+ __verbose && console.log(...args);
37
+ }
38
+ function __inspect(obj) {
39
+ return obj;
40
+ }
41
+ exports.__debug = {
42
+ verboseLogging: {
43
+ on: () => (__verbose = true),
44
+ off: () => (__verbose = false),
45
+ },
46
+ };
47
+ const _toVeloEntity = '$';
48
+ const _fromVeloEntity = '$';
49
+ var LinkType;
50
+ (function (LinkType) {
51
+ LinkType["UNDEFINED"] = "UNDEFINED";
52
+ /** external link */
53
+ LinkType["EXTERNAL"] = "EXTERNAL";
54
+ /** for internal usage using wixLinkData */
55
+ LinkType["INTERNAL"] = "INTERNAL";
56
+ })(LinkType = exports.LinkType || (exports.LinkType = {}));
57
+ var Type;
58
+ (function (Type) {
59
+ Type["UNDEFINED"] = "UNDEFINED";
60
+ Type["IMAGE"] = "IMAGE";
61
+ Type["VIDEO"] = "VIDEO";
62
+ Type["TEXT"] = "TEXT";
63
+ })(Type = exports.Type || (exports.Type = {}));
64
+ var ImageType;
65
+ (function (ImageType) {
66
+ ImageType["UNDEFINED"] = "UNDEFINED";
67
+ ImageType["WIX_MEDIA"] = "WIX_MEDIA";
68
+ ImageType["EXTERNAL"] = "EXTERNAL";
69
+ })(ImageType = exports.ImageType || (exports.ImageType = {}));
70
+ var VideoType;
71
+ (function (VideoType) {
72
+ VideoType["UNDEFINED"] = "UNDEFINED";
73
+ VideoType["WIX_MEDIA"] = "WIX_MEDIA";
74
+ VideoType["YOUTUBE"] = "YOUTUBE";
75
+ VideoType["VIMEO"] = "VIMEO";
76
+ })(VideoType = exports.VideoType || (exports.VideoType = {}));
77
+ var Enum;
78
+ (function (Enum) {
79
+ /** Default value. Means that permission not set */
80
+ Enum["UNKNOWN"] = "UNKNOWN";
81
+ /** Protected exposure. Exposed to members and owners */
82
+ Enum["PROTECTED"] = "PROTECTED";
83
+ /** Private exposure. Exposed to owners */
84
+ Enum["PRIVATE"] = "PRIVATE";
85
+ /** Public exposure. Visible to everyone */
86
+ Enum["PUBLIC"] = "PUBLIC";
87
+ /** Used for partial updates, to state that exposure is not changing */
88
+ Enum["UNCHANGED"] = "UNCHANGED";
89
+ /** Protected to members of permitted groups and owners */
90
+ Enum["GROUP_PROTECTED"] = "GROUP_PROTECTED";
91
+ })(Enum = exports.Enum || (exports.Enum = {}));
92
+ var SearchIndexingNotificationState;
93
+ (function (SearchIndexingNotificationState) {
94
+ /** default state */
95
+ SearchIndexingNotificationState["Unknown"] = "Unknown";
96
+ /** metasite does not require site search indexing */
97
+ SearchIndexingNotificationState["Off"] = "Off";
98
+ /** metasite requires site search indexing */
99
+ SearchIndexingNotificationState["On"] = "On";
100
+ })(SearchIndexingNotificationState = exports.SearchIndexingNotificationState || (exports.SearchIndexingNotificationState = {}));
101
+ var State;
102
+ (function (State) {
103
+ State["UNDEFINED"] = "UNDEFINED";
104
+ /** The gallery in the Editor segment */
105
+ State["SAVED"] = "SAVED";
106
+ /** The gallery in the LiveSite segment */
107
+ State["PUBLISHED"] = "PUBLISHED";
108
+ })(State = exports.State || (exports.State = {}));
109
+ const _createGalleryItemRequest = { item: '_item' };
110
+ const _createGalleryItemResponse = { item: '_item' };
111
+ const _createGalleryRequest = { gallery: '_gallery' };
112
+ const _createGalleryResponse = { gallery: '_gallery' };
113
+ const _deleteGalleryItemRequest = {};
114
+ const _deleteGalleryItemResponse = {};
115
+ const _deleteGalleryRequest = {};
116
+ const _deleteGalleryResponse = {};
117
+ const _gallery = { items: '_item' };
118
+ const _getGalleryItemRequest = {};
119
+ const _getGalleryItemResponse = { item: '_item' };
120
+ const _getGalleryRequest = {};
121
+ const _getGalleryResponse = { gallery: '_gallery' };
122
+ const _image = { imageInfo: 'wix.common.Image' };
123
+ const _item = {
124
+ secondaryMedia: '_secondaryMedia',
125
+ image: '_image',
126
+ video: '_video',
127
+ };
128
+ const _listGalleriesRequest = {};
129
+ const _listGalleriesResponse = { galleries: '_gallery' };
130
+ const _listGalleryItemsRequest = {};
131
+ const _listGalleryItemsResponse = { items: '_item' };
132
+ const _secondaryMedia = { image: '_image' };
133
+ const _updateGalleryItemRequest = { item: '_item' };
134
+ const _updateGalleryItemResponse = { item: '_item' };
135
+ const _updateGalleryRequest = { gallery: '_gallery' };
136
+ const _updateGalleryResponse = { gallery: '_gallery' };
137
+ const _video = { videoInfo: 'wix.common.VideoV2' };
138
+ /**
139
+ * Lists galleries.
140
+ *
141
+ * The `listGalleries()` function returns a Promise that resolves to a list of up to 10 galleries at a given time. To list the next 10 galleries in your site's backend, use the `offset` parameter.
142
+ * @public
143
+ * @param options - Options to use when getting the list of galleries.
144
+ */
145
+ function listGalleries(options) {
146
+ return __awaiter(this, arguments, void 0, function* () {
147
+ const requestTransformation = {
148
+ itemLimit: '$[0].itemLimit',
149
+ offset: '$[0].offset',
150
+ limit: '$[0].limit',
151
+ };
152
+ const responseTransformation = '$';
153
+ // @ts-ignore
154
+ const httpClient = arguments[1].httpClient;
155
+ const { toAmbassadorRequest } = velo_1.serializer({
156
+ rootSchema: _listGalleriesRequest,
157
+ depSchemas: {},
158
+ fqdnTransformation: {
159
+ paths: [],
160
+ transformation: _fromVeloEntity,
161
+ },
162
+ customTransformation: requestTransformation,
163
+ });
164
+ const { fromJSON } = velo_1.serializer({
165
+ rootSchema: _listGalleriesResponse,
166
+ depSchemas: { _gallery, _image, _item, _secondaryMedia, _video },
167
+ fqdnTransformation: {
168
+ paths: [...['Array#galleries']],
169
+ transformation: _toVeloEntity,
170
+ },
171
+ customTransformation: responseTransformation,
172
+ });
173
+ const payload = toAmbassadorRequest([options]);
174
+ const reqOpts = ambassadorWixProGalleryV2Gallery.listGalleries(payload);
175
+ __log(`"ListGalleries" sending request with: ${__inspect(reqOpts)}`);
176
+ try {
177
+ const { data } = yield httpClient.request(reqOpts);
178
+ return fromJSON(data);
179
+ }
180
+ catch (err) {
181
+ const transformedError = velo_1.transformError(err, requestTransformation, [
182
+ 'options',
183
+ ]);
184
+ throw transformedError;
185
+ }
186
+ });
187
+ }
188
+ exports.listGalleries = listGalleries;
189
+ /**
190
+ * Gets an existing gallery by ID.
191
+ *
192
+ * The `getGallery()` function returns a Promise that resolves to a gallery whose ID matches the given ID.
193
+ * @param galleryId - Gallery ID.
194
+ * @public
195
+ * @requiredField galleryId
196
+ * @param options - Options to use when getting the gallery.
197
+ * @returns Returned gallery.
198
+ */
199
+ function getGallery(galleryId, options) {
200
+ return __awaiter(this, arguments, void 0, function* () {
201
+ const requestTransformation = {
202
+ galleryId: '$[0]',
203
+ itemOffset: '$[1].itemOffset',
204
+ itemLimit: '$[1].itemLimit',
205
+ };
206
+ const responseTransformation = '$.gallery';
207
+ // @ts-ignore
208
+ const httpClient = arguments[2].httpClient;
209
+ const { toAmbassadorRequest } = velo_1.serializer({
210
+ rootSchema: _getGalleryRequest,
211
+ depSchemas: {},
212
+ fqdnTransformation: {
213
+ paths: [],
214
+ transformation: _fromVeloEntity,
215
+ },
216
+ customTransformation: requestTransformation,
217
+ });
218
+ const { fromJSON } = velo_1.serializer({
219
+ rootSchema: _getGalleryResponse,
220
+ depSchemas: { _gallery, _image, _item, _secondaryMedia, _video },
221
+ fqdnTransformation: {
222
+ paths: [...['gallery']],
223
+ transformation: _toVeloEntity,
224
+ },
225
+ customTransformation: responseTransformation,
226
+ });
227
+ const payload = toAmbassadorRequest([galleryId, options]);
228
+ const reqOpts = ambassadorWixProGalleryV2Gallery.getGallery(payload);
229
+ __log(`"GetGallery" sending request with: ${__inspect(reqOpts)}`);
230
+ try {
231
+ const { data } = yield httpClient.request(reqOpts);
232
+ return fromJSON(data);
233
+ }
234
+ catch (err) {
235
+ const transformedError = velo_1.transformError(err, requestTransformation, [
236
+ 'galleryId',
237
+ 'options',
238
+ ]);
239
+ throw transformedError;
240
+ }
241
+ });
242
+ }
243
+ exports.getGallery = getGallery;
244
+ /**
245
+ * Lists media items in a specified gallery.
246
+ *
247
+ * The `listGalleryItems()` function returns a Promise that resolves to a list of up to 100 gallery items.
248
+ * @param galleryId - Gallery ID.
249
+ * @public
250
+ * @requiredField galleryId
251
+ * @param options - Options to use when getting the list of gallery items.
252
+ */
253
+ function listGalleryItems(galleryId, options) {
254
+ return __awaiter(this, arguments, void 0, function* () {
255
+ const requestTransformation = {
256
+ galleryId: '$[0]',
257
+ itemOffset: '$[1].itemOffset',
258
+ itemLimit: '$[1].itemLimit',
259
+ };
260
+ const responseTransformation = '$';
261
+ // @ts-ignore
262
+ const httpClient = arguments[2].httpClient;
263
+ const { toAmbassadorRequest } = velo_1.serializer({
264
+ rootSchema: _listGalleryItemsRequest,
265
+ depSchemas: {},
266
+ fqdnTransformation: {
267
+ paths: [],
268
+ transformation: _fromVeloEntity,
269
+ },
270
+ customTransformation: requestTransformation,
271
+ });
272
+ const { fromJSON } = velo_1.serializer({
273
+ rootSchema: _listGalleryItemsResponse,
274
+ depSchemas: { _image, _item, _secondaryMedia, _video },
275
+ fqdnTransformation: {
276
+ paths: [],
277
+ transformation: _toVeloEntity,
278
+ },
279
+ customTransformation: responseTransformation,
280
+ });
281
+ const payload = toAmbassadorRequest([galleryId, options]);
282
+ const reqOpts = ambassadorWixProGalleryV2Gallery.listGalleryItems(payload);
283
+ __log(`"ListGalleryItems" sending request with: ${__inspect(reqOpts)}`);
284
+ try {
285
+ const { data } = yield httpClient.request(reqOpts);
286
+ return fromJSON(data);
287
+ }
288
+ catch (err) {
289
+ const transformedError = velo_1.transformError(err, requestTransformation, [
290
+ 'galleryId',
291
+ 'options',
292
+ ]);
293
+ throw transformedError;
294
+ }
295
+ });
296
+ }
297
+ exports.listGalleryItems = listGalleryItems;
298
+ /**
299
+ * Gets an existing gallery item by ID.
300
+ *
301
+ * The `getGalleryItem()` function returns a Promise that resolves to a media item in a specified gallery whose ID matches the given ID.
302
+ * @public
303
+ * @requiredField identifiers
304
+ * @requiredField identifiers.galleryId
305
+ * @requiredField identifiers.itemId
306
+ * @param identifiers - Gallery ID and Item ID.
307
+ * @returns Returned media item.
308
+ */
309
+ function getGalleryItem(identifiers) {
310
+ return __awaiter(this, arguments, void 0, function* () {
311
+ const requestTransformation = {
312
+ galleryId: '$[0].galleryId',
313
+ itemId: '$[0].itemId',
314
+ };
315
+ const responseTransformation = '$.item';
316
+ // @ts-ignore
317
+ const httpClient = arguments[1].httpClient;
318
+ const { toAmbassadorRequest } = velo_1.serializer({
319
+ rootSchema: _getGalleryItemRequest,
320
+ depSchemas: {},
321
+ fqdnTransformation: {
322
+ paths: [],
323
+ transformation: _fromVeloEntity,
324
+ },
325
+ customTransformation: requestTransformation,
326
+ });
327
+ const { fromJSON } = velo_1.serializer({
328
+ rootSchema: _getGalleryItemResponse,
329
+ depSchemas: { _image, _item, _secondaryMedia, _video },
330
+ fqdnTransformation: {
331
+ paths: [],
332
+ transformation: _toVeloEntity,
333
+ },
334
+ customTransformation: responseTransformation,
335
+ });
336
+ const payload = toAmbassadorRequest([identifiers]);
337
+ const reqOpts = ambassadorWixProGalleryV2Gallery.getGalleryItem(payload);
338
+ __log(`"GetGalleryItem" sending request with: ${__inspect(reqOpts)}`);
339
+ try {
340
+ const { data } = yield httpClient.request(reqOpts);
341
+ return fromJSON(data);
342
+ }
343
+ catch (err) {
344
+ const transformedError = velo_1.transformError(err, requestTransformation, [
345
+ 'identifiers',
346
+ ]);
347
+ throw transformedError;
348
+ }
349
+ });
350
+ }
351
+ exports.getGalleryItem = getGalleryItem;
352
+ /**
353
+ * Creates a gallery.
354
+ *
355
+ * The `createGallery()` function returns a Promise that resolves to a newly-created gallery after it has successfully been created.
356
+ *
357
+ * You can create your own gallery by providing the gallery information, or clone an existing gallery using the ID of that existing gallery. When a gallery is cloned, the newly-created gallery includes the same properties as the existing gallery except for the gallery and item IDs, sort order, and created and updated dates.
358
+ *
359
+ * The newly-created gallery is only available on your backend, and doesn't appear on your live site. To display your backend gallery on your live site, you need to connect it to a gallery component on your live site. To do this, import the `createGallery()` function to your page code, and write code to convert the backend gallery object to the frontend gallery component object. Once converted, the newly created backend gallery is visible on your live site. For reference, check out the code example, "Create a gallery and display it on your live site". To learn more, see [Displaying a Pro Gallery on Your Site Using the Pro Gallery Backend API](https://support.wix.com/en/article/velo-tutorial-displaying-a-pro-gallery-on-your-site-using-the-pro-gallery-backend-api).
360
+ *
361
+ *
362
+ * Only [site admins](https://support.wix.com/en/article/roles-permissions-overview) can create a gallery. You can override the permissions with the `wix-auth` [`elevate()`](https://www.wix.com/velo/reference/wix-auth/elevate) function.
363
+ *
364
+ * <blockquote class="important">
365
+ *
366
+ * __Important:__
367
+ * When creating `image` items in your gallery, the images must be uploaded to the [Wix Media Manager](https://support.wix.com/en/article/wix-media-uploading-media-to-the-media-manager) first as the `imageInfo` parameter currently only supports the Wix media URL.
368
+ *
369
+ * </blockquote>
370
+ * @public
371
+ * @requiredField options.gallery.items.image.imageInfo
372
+ * @requiredField options.gallery.items.text.html
373
+ * @requiredField options.gallery.items.video.videoInfo
374
+ * @param options - Options to use when creating the gallery.
375
+ * @returns Created gallery.
376
+ */
377
+ function createGallery(options) {
378
+ return __awaiter(this, arguments, void 0, function* () {
379
+ const requestTransformation = {
380
+ gallery: '$[0].gallery',
381
+ cloneFromGalleryId: '$[0].cloneFromGalleryId',
382
+ };
383
+ const responseTransformation = '$.gallery';
384
+ // @ts-ignore
385
+ const httpClient = arguments[1].httpClient;
386
+ const { toAmbassadorRequest } = velo_1.serializer({
387
+ rootSchema: _createGalleryRequest,
388
+ depSchemas: { _gallery, _image, _item, _secondaryMedia, _video },
389
+ fqdnTransformation: {
390
+ paths: [...['gallery']],
391
+ transformation: _fromVeloEntity,
392
+ },
393
+ customTransformation: requestTransformation,
394
+ });
395
+ const { fromJSON } = velo_1.serializer({
396
+ rootSchema: _createGalleryResponse,
397
+ depSchemas: { _gallery, _image, _item, _secondaryMedia, _video },
398
+ fqdnTransformation: {
399
+ paths: [...['gallery']],
400
+ transformation: _toVeloEntity,
401
+ },
402
+ customTransformation: responseTransformation,
403
+ });
404
+ const payload = toAmbassadorRequest([options]);
405
+ const reqOpts = ambassadorWixProGalleryV2Gallery.createGallery(payload);
406
+ __log(`"CreateGallery" sending request with: ${__inspect(reqOpts)}`);
407
+ try {
408
+ const { data } = yield httpClient.request(reqOpts);
409
+ return fromJSON(data);
410
+ }
411
+ catch (err) {
412
+ const transformedError = velo_1.transformError(err, requestTransformation, [
413
+ 'options',
414
+ ]);
415
+ throw transformedError;
416
+ }
417
+ });
418
+ }
419
+ exports.createGallery = createGallery;
420
+ /**
421
+ * Updates a gallery.
422
+ *
423
+ * The `updateGallery()` function returns a Promise that resolves to an updated gallery. Only the fields in the `gallery` object parameter can be updated. Specify which fields to update. Unspecified fields remain the same.
424
+ *
425
+ * >**Note:** Only [site admins](https://support.wix.com/en/article/roles-permissions-overview) can update a gallery. You can override the permissions with the `wix-auth` [`elevate()`](https://www.wix.com/velo/reference/wix-auth/elevate) function.
426
+ * @public
427
+ * @requiredField _id
428
+ * @requiredField gallery
429
+ * @requiredField gallery.items.image.imageInfo
430
+ * @requiredField gallery.items.text.html
431
+ * @requiredField gallery.items.video.videoInfo
432
+ * @param _id - ID of the gallery to update.
433
+ * @param gallery - The information for the gallery being updated.
434
+ * @returns Updated gallery.
435
+ */
436
+ function updateGallery(_id, gallery) {
437
+ return __awaiter(this, arguments, void 0, function* () {
438
+ const requestTransformation = { gallery: { '*': '$[1]', id: '$[0]' } };
439
+ const responseTransformation = '$.gallery';
440
+ // @ts-ignore
441
+ const httpClient = arguments[2].httpClient;
442
+ const { toAmbassadorRequest } = velo_1.serializer({
443
+ rootSchema: _updateGalleryRequest,
444
+ depSchemas: { _gallery, _image, _item, _secondaryMedia, _video },
445
+ fqdnTransformation: {
446
+ paths: [...['gallery']],
447
+ transformation: _fromVeloEntity,
448
+ },
449
+ customTransformation: requestTransformation,
450
+ });
451
+ const { fromJSON } = velo_1.serializer({
452
+ rootSchema: _updateGalleryResponse,
453
+ depSchemas: { _gallery, _image, _item, _secondaryMedia, _video },
454
+ fqdnTransformation: {
455
+ paths: [...['gallery']],
456
+ transformation: _toVeloEntity,
457
+ },
458
+ customTransformation: responseTransformation,
459
+ });
460
+ const payload = toAmbassadorRequest([_id, gallery]);
461
+ const reqOpts = ambassadorWixProGalleryV2Gallery.updateGallery(payload);
462
+ __log(`"UpdateGallery" sending request with: ${__inspect(reqOpts)}`);
463
+ try {
464
+ const { data } = yield httpClient.request(reqOpts);
465
+ return fromJSON(data);
466
+ }
467
+ catch (err) {
468
+ const transformedError = velo_1.transformError(err, requestTransformation, [
469
+ '_id',
470
+ 'gallery',
471
+ ]);
472
+ throw transformedError;
473
+ }
474
+ });
475
+ }
476
+ exports.updateGallery = updateGallery;
477
+ /**
478
+ * Deletes a gallery.
479
+ *
480
+ * The `deleteGallery()` function returns a Promise that resolves to the ID of the deleted gallery. When a gallery is deleted, the deleted gallery is no longer returned when calling the [`listGalleries()`](#listgalleries) function.
481
+ *
482
+ * >**Note:** Only [site admins](https://support.wix.com/en/article/roles-permissions-overview) can delete a gallery. You can override the permissions with the `wix-auth` [`elevate()`](https://www.wix.com/velo/reference/wix-auth/elevate) function.
483
+ * @param galleryId - ID of the gallery to delete.
484
+ * @public
485
+ * @requiredField galleryId
486
+ */
487
+ function deleteGallery(galleryId) {
488
+ return __awaiter(this, arguments, void 0, function* () {
489
+ const requestTransformation = { galleryId: '$[0]' };
490
+ const responseTransformation = '$';
491
+ // @ts-ignore
492
+ const httpClient = arguments[1].httpClient;
493
+ const { toAmbassadorRequest } = velo_1.serializer({
494
+ rootSchema: _deleteGalleryRequest,
495
+ depSchemas: {},
496
+ fqdnTransformation: {
497
+ paths: [],
498
+ transformation: _fromVeloEntity,
499
+ },
500
+ customTransformation: requestTransformation,
501
+ });
502
+ const { fromJSON } = velo_1.serializer({
503
+ rootSchema: _deleteGalleryResponse,
504
+ depSchemas: {},
505
+ fqdnTransformation: {
506
+ paths: [],
507
+ transformation: _toVeloEntity,
508
+ },
509
+ customTransformation: responseTransformation,
510
+ });
511
+ const payload = toAmbassadorRequest([galleryId]);
512
+ const reqOpts = ambassadorWixProGalleryV2Gallery.deleteGallery(payload);
513
+ __log(`"DeleteGallery" sending request with: ${__inspect(reqOpts)}`);
514
+ try {
515
+ const { data } = yield httpClient.request(reqOpts);
516
+ return fromJSON(data);
517
+ }
518
+ catch (err) {
519
+ const transformedError = velo_1.transformError(err, requestTransformation, [
520
+ 'galleryId',
521
+ ]);
522
+ throw transformedError;
523
+ }
524
+ });
525
+ }
526
+ exports.deleteGallery = deleteGallery;
527
+ /**
528
+ * Creates a media item in a specified gallery.
529
+ *
530
+ * The `createGalleryItem()` function returns a Promise that resolves to a newly-created gallery item after it has successfully been created.
531
+ *
532
+ * When creating `image` items, the images in your gallery must be uploaded to the [Wix Media Manager](https://support.wix.com/en/article/wix-media-uploading-media-to-the-media-manager) first as the `imageInfo` parameter currently only supports the Wix media URL.
533
+ *
534
+ * >**Note:** Only [site admins](https://support.wix.com/en/article/roles-permissions-overview) can create a gallery item. You can override the permissions with the `wix-auth` [`elevate()`](https://www.wix.com/velo/reference/wix-auth/elevate) function.
535
+ * @param galleryId - Gallery ID.
536
+ * @param item - Media item to create.
537
+ * @public
538
+ * @requiredField galleryId
539
+ * @requiredField item
540
+ * @requiredField item.image.imageInfo
541
+ * @requiredField item.text.html
542
+ * @requiredField item.video.videoInfo
543
+ * @returns Created media item.
544
+ */
545
+ function createGalleryItem(galleryId, item) {
546
+ return __awaiter(this, arguments, void 0, function* () {
547
+ const requestTransformation = { galleryId: '$[0]', item: '$[1]' };
548
+ const responseTransformation = '$.item';
549
+ // @ts-ignore
550
+ const httpClient = arguments[2].httpClient;
551
+ const { toAmbassadorRequest } = velo_1.serializer({
552
+ rootSchema: _createGalleryItemRequest,
553
+ depSchemas: { _image, _item, _secondaryMedia, _video },
554
+ fqdnTransformation: {
555
+ paths: [],
556
+ transformation: _fromVeloEntity,
557
+ },
558
+ customTransformation: requestTransformation,
559
+ });
560
+ const { fromJSON } = velo_1.serializer({
561
+ rootSchema: _createGalleryItemResponse,
562
+ depSchemas: { _image, _item, _secondaryMedia, _video },
563
+ fqdnTransformation: {
564
+ paths: [],
565
+ transformation: _toVeloEntity,
566
+ },
567
+ customTransformation: responseTransformation,
568
+ });
569
+ const payload = toAmbassadorRequest([galleryId, item]);
570
+ const reqOpts = ambassadorWixProGalleryV2Gallery.createGalleryItem(payload);
571
+ __log(`"CreateGalleryItem" sending request with: ${__inspect(reqOpts)}`);
572
+ try {
573
+ const { data } = yield httpClient.request(reqOpts);
574
+ return fromJSON(data);
575
+ }
576
+ catch (err) {
577
+ const transformedError = velo_1.transformError(err, requestTransformation, [
578
+ 'galleryId',
579
+ 'item',
580
+ ]);
581
+ throw transformedError;
582
+ }
583
+ });
584
+ }
585
+ exports.createGalleryItem = createGalleryItem;
586
+ /**
587
+ * Updates a media item in a specified gallery.
588
+ *
589
+ * The `updateGalleryItem()` function returns a Promise that resolves to an updated gallery item. Only the fields in the `item` object parameter can be updated. Specify which fields to update. Unspecified fields remain the same.
590
+ *
591
+ * >**Note:** Only [site admins](https://support.wix.com/en/article/roles-permissions-overview) can update a gallery item. You can override the permissions with the `wix-auth` [`elevate()`](https://www.wix.com/velo/reference/wix-auth/elevate) function.
592
+ * @public
593
+ * @requiredField identifiers
594
+ * @requiredField identifiers.galleryId
595
+ * @requiredField identifiers.itemId
596
+ * @requiredField item
597
+ * @requiredField item.image.imageInfo
598
+ * @requiredField item.text.html
599
+ * @requiredField item.video.videoInfo
600
+ * @param item - The information for the gallery item being updated.
601
+ * @param identifiers - Gallery ID and Item ID.
602
+ * @returns Updated media item.
603
+ */
604
+ function updateGalleryItem(identifiers, item) {
605
+ return __awaiter(this, arguments, void 0, function* () {
606
+ const requestTransformation = {
607
+ galleryId: '$[0].galleryId',
608
+ item: { '*': '$[1]', id: '$[0].itemId' },
609
+ };
610
+ const responseTransformation = '$.item';
611
+ // @ts-ignore
612
+ const httpClient = arguments[2].httpClient;
613
+ const { toAmbassadorRequest } = velo_1.serializer({
614
+ rootSchema: _updateGalleryItemRequest,
615
+ depSchemas: { _image, _item, _secondaryMedia, _video },
616
+ fqdnTransformation: {
617
+ paths: [],
618
+ transformation: _fromVeloEntity,
619
+ },
620
+ customTransformation: requestTransformation,
621
+ });
622
+ const { fromJSON } = velo_1.serializer({
623
+ rootSchema: _updateGalleryItemResponse,
624
+ depSchemas: { _image, _item, _secondaryMedia, _video },
625
+ fqdnTransformation: {
626
+ paths: [],
627
+ transformation: _toVeloEntity,
628
+ },
629
+ customTransformation: responseTransformation,
630
+ });
631
+ const payload = toAmbassadorRequest([identifiers, item]);
632
+ const reqOpts = ambassadorWixProGalleryV2Gallery.updateGalleryItem(payload);
633
+ __log(`"UpdateGalleryItem" sending request with: ${__inspect(reqOpts)}`);
634
+ try {
635
+ const { data } = yield httpClient.request(reqOpts);
636
+ return fromJSON(data);
637
+ }
638
+ catch (err) {
639
+ const transformedError = velo_1.transformError(err, requestTransformation, [
640
+ 'identifiers',
641
+ 'item',
642
+ ]);
643
+ throw transformedError;
644
+ }
645
+ });
646
+ }
647
+ exports.updateGalleryItem = updateGalleryItem;
648
+ /**
649
+ * Deletes a media item from a gallery.
650
+ *
651
+ * The `deleteGalleryItem()` function returns a Promise that resolves to the ID of the deleted gallery item. When a gallery item is deleted, the deleted gallery item is no longer returned when calling the [`listGalleryItems()`](#listgalleryitems) function.
652
+ *
653
+ * >**Note:** Only [site admins](https://support.wix.com/en/article/roles-permissions-overview) can delete a gallery item. You can override the permissions with the `wix-auth` [`elevate()`](https://www.wix.com/velo/reference/wix-auth/elevate) function.
654
+ * @public
655
+ * @requiredField identifiers
656
+ * @requiredField identifiers.galleryId
657
+ * @requiredField identifiers.itemId
658
+ * @param identifiers - Gallery ID and Item ID.
659
+ */
660
+ function deleteGalleryItem(identifiers) {
661
+ return __awaiter(this, arguments, void 0, function* () {
662
+ const requestTransformation = {
663
+ galleryId: '$[0].galleryId',
664
+ itemId: '$[0].itemId',
665
+ };
666
+ const responseTransformation = '$';
667
+ // @ts-ignore
668
+ const httpClient = arguments[1].httpClient;
669
+ const { toAmbassadorRequest } = velo_1.serializer({
670
+ rootSchema: _deleteGalleryItemRequest,
671
+ depSchemas: {},
672
+ fqdnTransformation: {
673
+ paths: [],
674
+ transformation: _fromVeloEntity,
675
+ },
676
+ customTransformation: requestTransformation,
677
+ });
678
+ const { fromJSON } = velo_1.serializer({
679
+ rootSchema: _deleteGalleryItemResponse,
680
+ depSchemas: {},
681
+ fqdnTransformation: {
682
+ paths: [],
683
+ transformation: _toVeloEntity,
684
+ },
685
+ customTransformation: responseTransformation,
686
+ });
687
+ const payload = toAmbassadorRequest([identifiers]);
688
+ const reqOpts = ambassadorWixProGalleryV2Gallery.deleteGalleryItem(payload);
689
+ __log(`"DeleteGalleryItem" sending request with: ${__inspect(reqOpts)}`);
690
+ try {
691
+ const { data } = yield httpClient.request(reqOpts);
692
+ return fromJSON(data);
693
+ }
694
+ catch (err) {
695
+ const transformedError = velo_1.transformError(err, requestTransformation, [
696
+ 'identifiers',
697
+ ]);
698
+ throw transformedError;
699
+ }
700
+ });
701
+ }
702
+ exports.deleteGalleryItem = deleteGalleryItem;
703
+ //# sourceMappingURL=pro-gallery-v2-gallery.universal.js.map