@wix/events 1.0.11 → 1.0.13

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 (121) hide show
  1. package/build/cjs/index.d.ts +5 -0
  2. package/build/cjs/index.js +6 -1
  3. package/build/cjs/index.js.map +1 -1
  4. package/build/cjs/src/events-schedule-v1-schedule-item-schedule-bookmarks.public.d.ts +6 -0
  5. package/build/cjs/src/events-schedule-v1-schedule-item-schedule-bookmarks.public.js +27 -0
  6. package/build/cjs/src/events-schedule-v1-schedule-item-schedule-bookmarks.public.js.map +1 -0
  7. package/build/cjs/src/events-schedule-v1-schedule-item-schedule-bookmarks.universal.d.ts +353 -0
  8. package/build/cjs/src/events-schedule-v1-schedule-item-schedule-bookmarks.universal.js +237 -0
  9. package/build/cjs/src/events-schedule-v1-schedule-item-schedule-bookmarks.universal.js.map +1 -0
  10. package/build/cjs/src/events-schedule-v1-schedule-item-schedule.public.d.ts +13 -0
  11. package/build/cjs/src/events-schedule-v1-schedule-item-schedule.public.js +63 -0
  12. package/build/cjs/src/events-schedule-v1-schedule-item-schedule.public.js.map +1 -0
  13. package/build/cjs/src/events-schedule-v1-schedule-item-schedule.universal.d.ts +490 -0
  14. package/build/cjs/src/events-schedule-v1-schedule-item-schedule.universal.js +600 -0
  15. package/build/cjs/src/events-schedule-v1-schedule-item-schedule.universal.js.map +1 -0
  16. package/build/cjs/src/events-schedule-v1-schedule-item.http.d.ts +49 -0
  17. package/build/cjs/src/events-schedule-v1-schedule-item.http.js +485 -0
  18. package/build/cjs/src/events-schedule-v1-schedule-item.http.js.map +1 -0
  19. package/build/cjs/src/events-schedule-v1-schedule-item.types.d.ts +318 -0
  20. package/build/cjs/src/events-schedule-v1-schedule-item.types.js +27 -0
  21. package/build/cjs/src/events-schedule-v1-schedule-item.types.js.map +1 -0
  22. package/build/cjs/src/events-v1-category.http.d.ts +35 -0
  23. package/build/cjs/src/events-v1-category.http.js +592 -0
  24. package/build/cjs/src/events-v1-category.http.js.map +1 -0
  25. package/build/cjs/src/events-v1-category.public.d.ts +17 -0
  26. package/build/cjs/src/events-v1-category.public.js +87 -0
  27. package/build/cjs/src/events-v1-category.public.js.map +1 -0
  28. package/build/cjs/src/events-v1-category.types.d.ts +234 -0
  29. package/build/cjs/src/events-v1-category.types.js +27 -0
  30. package/build/cjs/src/events-v1-category.types.js.map +1 -0
  31. package/build/cjs/src/events-v1-category.universal.d.ts +399 -0
  32. package/build/cjs/src/events-v1-category.universal.js +778 -0
  33. package/build/cjs/src/events-v1-category.universal.js.map +1 -0
  34. package/build/cjs/src/events-v1-event.http.d.ts +90 -0
  35. package/build/cjs/src/events-v1-event.http.js +932 -0
  36. package/build/cjs/src/events-v1-event.http.js.map +1 -0
  37. package/build/cjs/src/events-v1-event.public.d.ts +19 -0
  38. package/build/cjs/src/events-v1-event.public.js +112 -0
  39. package/build/cjs/src/events-v1-event.public.js.map +1 -0
  40. package/build/cjs/src/events-v1-event.types.d.ts +1473 -0
  41. package/build/cjs/src/events-v1-event.types.js +198 -0
  42. package/build/cjs/src/events-v1-event.types.js.map +1 -0
  43. package/build/cjs/src/events-v1-event.universal.d.ts +1784 -0
  44. package/build/cjs/src/events-v1-event.universal.js +1130 -0
  45. package/build/cjs/src/events-v1-event.universal.js.map +1 -0
  46. package/build/cjs/src/events-v1-form.http.d.ts +25 -0
  47. package/build/cjs/src/events-v1-form.http.js +431 -0
  48. package/build/cjs/src/events-v1-form.http.js.map +1 -0
  49. package/build/cjs/src/events-v1-form.public.d.ts +11 -0
  50. package/build/cjs/src/events-v1-form.public.js +53 -0
  51. package/build/cjs/src/events-v1-form.public.js.map +1 -0
  52. package/build/cjs/src/events-v1-form.types.d.ts +657 -0
  53. package/build/cjs/src/events-v1-form.types.js +69 -0
  54. package/build/cjs/src/events-v1-form.types.js.map +1 -0
  55. package/build/cjs/src/events-v1-form.universal.d.ts +778 -0
  56. package/build/cjs/src/events-v1-form.universal.js +528 -0
  57. package/build/cjs/src/events-v1-form.universal.js.map +1 -0
  58. package/build/cjs/src/events-v2-policy.universal.d.ts +8 -1
  59. package/build/cjs/src/events-v2-policy.universal.js +8 -1
  60. package/build/cjs/src/events-v2-policy.universal.js.map +1 -1
  61. package/build/es/index.d.ts +5 -0
  62. package/build/es/index.js +5 -0
  63. package/build/es/index.js.map +1 -1
  64. package/build/es/src/events-schedule-v1-schedule-item-schedule-bookmarks.public.d.ts +6 -0
  65. package/build/es/src/events-schedule-v1-schedule-item-schedule-bookmarks.public.js +18 -0
  66. package/build/es/src/events-schedule-v1-schedule-item-schedule-bookmarks.public.js.map +1 -0
  67. package/build/es/src/events-schedule-v1-schedule-item-schedule-bookmarks.universal.d.ts +353 -0
  68. package/build/es/src/events-schedule-v1-schedule-item-schedule-bookmarks.universal.js +212 -0
  69. package/build/es/src/events-schedule-v1-schedule-item-schedule-bookmarks.universal.js.map +1 -0
  70. package/build/es/src/events-schedule-v1-schedule-item-schedule.public.d.ts +13 -0
  71. package/build/es/src/events-schedule-v1-schedule-item-schedule.public.js +48 -0
  72. package/build/es/src/events-schedule-v1-schedule-item-schedule.public.js.map +1 -0
  73. package/build/es/src/events-schedule-v1-schedule-item-schedule.universal.d.ts +490 -0
  74. package/build/es/src/events-schedule-v1-schedule-item-schedule.universal.js +569 -0
  75. package/build/es/src/events-schedule-v1-schedule-item-schedule.universal.js.map +1 -0
  76. package/build/es/src/events-schedule-v1-schedule-item.http.d.ts +49 -0
  77. package/build/es/src/events-schedule-v1-schedule-item.http.js +470 -0
  78. package/build/es/src/events-schedule-v1-schedule-item.http.js.map +1 -0
  79. package/build/es/src/events-schedule-v1-schedule-item.types.d.ts +318 -0
  80. package/build/es/src/events-schedule-v1-schedule-item.types.js +24 -0
  81. package/build/es/src/events-schedule-v1-schedule-item.types.js.map +1 -0
  82. package/build/es/src/events-v1-category.http.d.ts +35 -0
  83. package/build/es/src/events-v1-category.http.js +576 -0
  84. package/build/es/src/events-v1-category.http.js.map +1 -0
  85. package/build/es/src/events-v1-category.public.d.ts +17 -0
  86. package/build/es/src/events-v1-category.public.js +68 -0
  87. package/build/es/src/events-v1-category.public.js.map +1 -0
  88. package/build/es/src/events-v1-category.types.d.ts +234 -0
  89. package/build/es/src/events-v1-category.types.js +24 -0
  90. package/build/es/src/events-v1-category.types.js.map +1 -0
  91. package/build/es/src/events-v1-category.universal.d.ts +399 -0
  92. package/build/es/src/events-v1-category.universal.js +743 -0
  93. package/build/es/src/events-v1-category.universal.js.map +1 -0
  94. package/build/es/src/events-v1-event.http.d.ts +90 -0
  95. package/build/es/src/events-v1-event.http.js +914 -0
  96. package/build/es/src/events-v1-event.http.js.map +1 -0
  97. package/build/es/src/events-v1-event.public.d.ts +19 -0
  98. package/build/es/src/events-v1-event.public.js +78 -0
  99. package/build/es/src/events-v1-event.public.js.map +1 -0
  100. package/build/es/src/events-v1-event.types.d.ts +1473 -0
  101. package/build/es/src/events-v1-event.types.js +195 -0
  102. package/build/es/src/events-v1-event.types.js.map +1 -0
  103. package/build/es/src/events-v1-event.universal.d.ts +1784 -0
  104. package/build/es/src/events-v1-event.universal.js +1093 -0
  105. package/build/es/src/events-v1-event.universal.js.map +1 -0
  106. package/build/es/src/events-v1-form.http.d.ts +25 -0
  107. package/build/es/src/events-v1-form.http.js +421 -0
  108. package/build/es/src/events-v1-form.http.js.map +1 -0
  109. package/build/es/src/events-v1-form.public.d.ts +11 -0
  110. package/build/es/src/events-v1-form.public.js +38 -0
  111. package/build/es/src/events-v1-form.public.js.map +1 -0
  112. package/build/es/src/events-v1-form.types.d.ts +657 -0
  113. package/build/es/src/events-v1-form.types.js +66 -0
  114. package/build/es/src/events-v1-form.types.js.map +1 -0
  115. package/build/es/src/events-v1-form.universal.d.ts +778 -0
  116. package/build/es/src/events-v1-form.universal.js +499 -0
  117. package/build/es/src/events-v1-form.universal.js.map +1 -0
  118. package/build/es/src/events-v2-policy.universal.d.ts +8 -1
  119. package/build/es/src/events-v2-policy.universal.js +8 -1
  120. package/build/es/src/events-v2-policy.universal.js.map +1 -1
  121. package/package.json +2 -2
@@ -0,0 +1,778 @@
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.reorderCategoryEvents = exports.listEventCategories = exports.bulkUnassignEventsAsync = exports.bulkUnassignEvents = exports.unassignEvents = exports.bulkAssignEventsAsync = exports.bulkAssignEvents = exports.assignEvents = exports.queryCategories = exports.deleteCategory = exports.updateCategory = exports.bulkCreateCategory = exports.createCategory = exports.CategoryFieldset = exports.SortOrder = exports.State = exports.__debug = void 0;
32
+ const velo_1 = require("@wix/metro-runtime/velo");
33
+ const ambassadorWixEventsV1Category = __importStar(require("./events-v1-category.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 State;
50
+ (function (State) {
51
+ /** Created manually by the user. */
52
+ State["MANUAL"] = "MANUAL";
53
+ /** Created automatically. */
54
+ State["AUTO"] = "AUTO";
55
+ /** Created when publishing recurring events. */
56
+ State["RECURRING_EVENT"] = "RECURRING_EVENT";
57
+ /** Category is hidden. */
58
+ State["HIDDEN"] = "HIDDEN";
59
+ /** Category is used to store component events. */
60
+ State["COMPONENT"] = "COMPONENT";
61
+ })(State = exports.State || (exports.State = {}));
62
+ var SortOrder;
63
+ (function (SortOrder) {
64
+ SortOrder["ASC"] = "ASC";
65
+ SortOrder["DESC"] = "DESC";
66
+ })(SortOrder = exports.SortOrder || (exports.SortOrder = {}));
67
+ var CategoryFieldset;
68
+ (function (CategoryFieldset) {
69
+ /** Include `assignedEventsCount` in the response. */
70
+ CategoryFieldset["COUNTS"] = "COUNTS";
71
+ })(CategoryFieldset = exports.CategoryFieldset || (exports.CategoryFieldset = {}));
72
+ const _assignEventsRequest = {};
73
+ const _assignEventsResponse = {};
74
+ const _bulkAssignEventsAsyncRequest = {};
75
+ const _bulkAssignEventsAsyncResponse = {};
76
+ const _bulkAssignEventsRequest = {};
77
+ const _bulkAssignEventsResponse = {};
78
+ const _bulkCreateCategoryRequest = {};
79
+ const _bulkCreateCategoryResponse = {};
80
+ const _bulkUnassignEventsAsyncRequest = {};
81
+ const _bulkUnassignEventsAsyncResponse = {};
82
+ const _bulkUnassignEventsRequest = {};
83
+ const _bulkUnassignEventsResponse = {};
84
+ const _createCategoryRequest = {};
85
+ const _createCategoryResponse = {};
86
+ const _deleteCategoryRequest = {};
87
+ const _deleteCategoryResponse = {};
88
+ const _listEventCategoriesRequest = {};
89
+ const _listEventCategoriesResponse = {};
90
+ const _queryCategoriesRequest = {};
91
+ const _queryCategoriesResponse = {};
92
+ const _reorderCategoryEventsRequest = {};
93
+ const _reorderCategoryEventsResponse = {};
94
+ const _unassignEventsRequest = {};
95
+ const _unassignEventsResponse = {};
96
+ const _updateCategoryRequest = {};
97
+ const _updateCategoryResponse = {};
98
+ /**
99
+ * Creates a new category.
100
+ * @public
101
+ * @documentationMaturity preview
102
+ * @requiredField category
103
+ */
104
+ function createCategory(category) {
105
+ var _a, _b, _c;
106
+ return __awaiter(this, arguments, void 0, function* () {
107
+ const requestTransformation = { category: '$[0]' };
108
+ const responseTransformation = '$';
109
+ // @ts-ignore
110
+ const { httpClient, sideEffects } = arguments[1];
111
+ const { toAmbassadorRequest } = velo_1.serializer({
112
+ rootSchema: _createCategoryRequest,
113
+ depSchemas: {},
114
+ fqdnTransformation: {
115
+ paths: [...['category']],
116
+ transformation: _fromVeloEntity,
117
+ },
118
+ customTransformation: requestTransformation,
119
+ });
120
+ const { fromJSON } = velo_1.serializer({
121
+ rootSchema: _createCategoryResponse,
122
+ depSchemas: {},
123
+ fqdnTransformation: {
124
+ paths: [...['category']],
125
+ transformation: _toVeloEntity,
126
+ },
127
+ customTransformation: responseTransformation,
128
+ });
129
+ const payload = toAmbassadorRequest([category]);
130
+ const reqOpts = ambassadorWixEventsV1Category.createCategory(payload);
131
+ __log(`"CreateCategory" sending request with: ${__inspect(reqOpts)}`);
132
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
133
+ try {
134
+ const result = yield httpClient.request(reqOpts);
135
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
136
+ return fromJSON(result.data);
137
+ }
138
+ catch (err) {
139
+ const transformedError = velo_1.transformError(err, requestTransformation, [
140
+ 'category',
141
+ ]);
142
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
143
+ throw transformedError;
144
+ }
145
+ });
146
+ }
147
+ exports.createCategory = createCategory;
148
+ /**
149
+ * Creates new categories.
150
+ * @public
151
+ * @documentationMaturity preview
152
+ * @requiredField categories
153
+ */
154
+ function bulkCreateCategory(categories) {
155
+ var _a, _b, _c;
156
+ return __awaiter(this, arguments, void 0, function* () {
157
+ const requestTransformation = { categories: '$[0]' };
158
+ const responseTransformation = '$';
159
+ // @ts-ignore
160
+ const { httpClient, sideEffects } = arguments[1];
161
+ const { toAmbassadorRequest } = velo_1.serializer({
162
+ rootSchema: _bulkCreateCategoryRequest,
163
+ depSchemas: {},
164
+ fqdnTransformation: {
165
+ paths: [...['Array#categories']],
166
+ transformation: _fromVeloEntity,
167
+ },
168
+ customTransformation: requestTransformation,
169
+ });
170
+ const { fromJSON } = velo_1.serializer({
171
+ rootSchema: _bulkCreateCategoryResponse,
172
+ depSchemas: {},
173
+ fqdnTransformation: {
174
+ paths: [...['Array#results.item']],
175
+ transformation: _toVeloEntity,
176
+ },
177
+ customTransformation: responseTransformation,
178
+ });
179
+ const payload = toAmbassadorRequest([categories]);
180
+ const reqOpts = ambassadorWixEventsV1Category.bulkCreateCategory(payload);
181
+ __log(`"BulkCreateCategory" sending request with: ${__inspect(reqOpts)}`);
182
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
183
+ try {
184
+ const result = yield httpClient.request(reqOpts);
185
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
186
+ return fromJSON(result.data);
187
+ }
188
+ catch (err) {
189
+ const transformedError = velo_1.transformError(err, requestTransformation, [
190
+ 'categories',
191
+ ]);
192
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
193
+ throw transformedError;
194
+ }
195
+ });
196
+ }
197
+ exports.bulkCreateCategory = bulkCreateCategory;
198
+ /**
199
+ * Updates an existing category.
200
+ * @param _id - Category ID.
201
+ * @public
202
+ * @documentationMaturity preview
203
+ * @requiredField _id
204
+ * @requiredField category
205
+ */
206
+ function updateCategory(_id, category) {
207
+ var _a, _b, _c;
208
+ return __awaiter(this, arguments, void 0, function* () {
209
+ const requestTransformation = { category: { '*': '$[1]', id: '$[0]' } };
210
+ const responseTransformation = '$';
211
+ // @ts-ignore
212
+ const { httpClient, sideEffects } = arguments[2];
213
+ const { toAmbassadorRequest } = velo_1.serializer({
214
+ rootSchema: _updateCategoryRequest,
215
+ depSchemas: {},
216
+ fqdnTransformation: {
217
+ paths: [...['category']],
218
+ transformation: _fromVeloEntity,
219
+ },
220
+ customTransformation: requestTransformation,
221
+ });
222
+ const { fromJSON } = velo_1.serializer({
223
+ rootSchema: _updateCategoryResponse,
224
+ depSchemas: {},
225
+ fqdnTransformation: {
226
+ paths: [...['category']],
227
+ transformation: _toVeloEntity,
228
+ },
229
+ customTransformation: responseTransformation,
230
+ });
231
+ const payload = toAmbassadorRequest([_id, category]);
232
+ const reqOpts = ambassadorWixEventsV1Category.updateCategory(payload);
233
+ __log(`"UpdateCategory" sending request with: ${__inspect(reqOpts)}`);
234
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
235
+ try {
236
+ const result = yield httpClient.request(reqOpts);
237
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
238
+ return fromJSON(result.data);
239
+ }
240
+ catch (err) {
241
+ const transformedError = velo_1.transformError(err, requestTransformation, [
242
+ '_id',
243
+ 'category',
244
+ ]);
245
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
246
+ throw transformedError;
247
+ }
248
+ });
249
+ }
250
+ exports.updateCategory = updateCategory;
251
+ /**
252
+ * Deletes existing category.
253
+ * @public
254
+ * @documentationMaturity preview
255
+ * @requiredField categoryId
256
+ */
257
+ function deleteCategory(categoryId) {
258
+ var _a, _b, _c;
259
+ return __awaiter(this, arguments, void 0, function* () {
260
+ const requestTransformation = { categoryId: '$[0]' };
261
+ const responseTransformation = '$';
262
+ // @ts-ignore
263
+ const { httpClient, sideEffects } = arguments[1];
264
+ const { toAmbassadorRequest } = velo_1.serializer({
265
+ rootSchema: _deleteCategoryRequest,
266
+ depSchemas: {},
267
+ fqdnTransformation: {
268
+ paths: [],
269
+ transformation: _fromVeloEntity,
270
+ },
271
+ customTransformation: requestTransformation,
272
+ });
273
+ const { fromJSON } = velo_1.serializer({
274
+ rootSchema: _deleteCategoryResponse,
275
+ depSchemas: {},
276
+ fqdnTransformation: {
277
+ paths: [],
278
+ transformation: _toVeloEntity,
279
+ },
280
+ customTransformation: responseTransformation,
281
+ });
282
+ const payload = toAmbassadorRequest([categoryId]);
283
+ const reqOpts = ambassadorWixEventsV1Category.deleteCategory(payload);
284
+ __log(`"DeleteCategory" sending request with: ${__inspect(reqOpts)}`);
285
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
286
+ try {
287
+ const result = yield httpClient.request(reqOpts);
288
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
289
+ return fromJSON(result.data);
290
+ }
291
+ catch (err) {
292
+ const transformedError = velo_1.transformError(err, requestTransformation, [
293
+ 'categoryId',
294
+ ]);
295
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
296
+ throw transformedError;
297
+ }
298
+ });
299
+ }
300
+ exports.deleteCategory = deleteCategory;
301
+ /**
302
+ * - `filter` - supported for `name`, `id` and `states` fields.
303
+ * - `sort` - supported for `created` and `name` fields.
304
+ * - `paging` - supported, see [paging](https://dev.wix.com/api/rest/getting-started/pagination).
305
+ * - `fields` - not supported.
306
+ * - `fieldsets` - not supported.
307
+ * - `cursorPaging` - not supported, use offset pagination instead.
308
+ * @public
309
+ * @documentationMaturity preview
310
+ * @requiredField query
311
+ */
312
+ function queryCategories(query, options) {
313
+ var _a, _b, _c;
314
+ return __awaiter(this, arguments, void 0, function* () {
315
+ const requestTransformation = { query: '$[0]', fieldset: '$[1].fieldset' };
316
+ const responseTransformation = '$';
317
+ // @ts-ignore
318
+ const { httpClient, sideEffects } = arguments[2];
319
+ const { toAmbassadorRequest } = velo_1.serializer({
320
+ rootSchema: _queryCategoriesRequest,
321
+ depSchemas: {},
322
+ fqdnTransformation: {
323
+ paths: [],
324
+ transformation: _fromVeloEntity,
325
+ },
326
+ customTransformation: requestTransformation,
327
+ });
328
+ const { fromJSON } = velo_1.serializer({
329
+ rootSchema: _queryCategoriesResponse,
330
+ depSchemas: {},
331
+ fqdnTransformation: {
332
+ paths: [...['Array#categories']],
333
+ transformation: _toVeloEntity,
334
+ },
335
+ customTransformation: responseTransformation,
336
+ });
337
+ const payload = toAmbassadorRequest([query, options]);
338
+ const reqOpts = ambassadorWixEventsV1Category.queryCategories(payload);
339
+ __log(`"QueryCategories" sending request with: ${__inspect(reqOpts)}`);
340
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
341
+ try {
342
+ const result = yield httpClient.request(reqOpts);
343
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
344
+ return fromJSON(result.data);
345
+ }
346
+ catch (err) {
347
+ const transformedError = velo_1.transformError(err, requestTransformation, [
348
+ 'query',
349
+ 'options',
350
+ ]);
351
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
352
+ throw transformedError;
353
+ }
354
+ });
355
+ }
356
+ exports.queryCategories = queryCategories;
357
+ /**
358
+ * Assigns events to a single category.
359
+ * @public
360
+ * @documentationMaturity preview
361
+ * @requiredField categoryId
362
+ * @requiredField eventId
363
+ */
364
+ function assignEvents(categoryId, eventId) {
365
+ var _a, _b, _c;
366
+ return __awaiter(this, arguments, void 0, function* () {
367
+ const requestTransformation = { categoryId: '$[0]', eventId: '$[1]' };
368
+ const responseTransformation = '$';
369
+ // @ts-ignore
370
+ const { httpClient, sideEffects } = arguments[2];
371
+ const { toAmbassadorRequest } = velo_1.serializer({
372
+ rootSchema: _assignEventsRequest,
373
+ depSchemas: {},
374
+ fqdnTransformation: {
375
+ paths: [],
376
+ transformation: _fromVeloEntity,
377
+ },
378
+ customTransformation: requestTransformation,
379
+ });
380
+ const { fromJSON } = velo_1.serializer({
381
+ rootSchema: _assignEventsResponse,
382
+ depSchemas: {},
383
+ fqdnTransformation: {
384
+ paths: [],
385
+ transformation: _toVeloEntity,
386
+ },
387
+ customTransformation: responseTransformation,
388
+ });
389
+ const payload = toAmbassadorRequest([categoryId, eventId]);
390
+ const reqOpts = ambassadorWixEventsV1Category.assignEvents(payload);
391
+ __log(`"AssignEvents" sending request with: ${__inspect(reqOpts)}`);
392
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
393
+ try {
394
+ const result = yield httpClient.request(reqOpts);
395
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
396
+ return fromJSON(result.data);
397
+ }
398
+ catch (err) {
399
+ const transformedError = velo_1.transformError(err, requestTransformation, [
400
+ 'categoryId',
401
+ 'eventId',
402
+ ]);
403
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
404
+ throw transformedError;
405
+ }
406
+ });
407
+ }
408
+ exports.assignEvents = assignEvents;
409
+ /**
410
+ * Assigns events to multiple categories.
411
+ * @public
412
+ * @documentationMaturity preview
413
+ * @requiredField categoryId
414
+ * @requiredField options
415
+ * @requiredField options.eventId
416
+ */
417
+ function bulkAssignEvents(categoryId, options) {
418
+ var _a, _b, _c;
419
+ return __awaiter(this, arguments, void 0, function* () {
420
+ const requestTransformation = { categoryId: '$[0]', eventId: '$[1].eventId' };
421
+ const responseTransformation = '$';
422
+ // @ts-ignore
423
+ const { httpClient, sideEffects } = arguments[2];
424
+ const { toAmbassadorRequest } = velo_1.serializer({
425
+ rootSchema: _bulkAssignEventsRequest,
426
+ depSchemas: {},
427
+ fqdnTransformation: {
428
+ paths: [],
429
+ transformation: _fromVeloEntity,
430
+ },
431
+ customTransformation: requestTransformation,
432
+ });
433
+ const { fromJSON } = velo_1.serializer({
434
+ rootSchema: _bulkAssignEventsResponse,
435
+ depSchemas: {},
436
+ fqdnTransformation: {
437
+ paths: [...['Array#results.item']],
438
+ transformation: _toVeloEntity,
439
+ },
440
+ customTransformation: responseTransformation,
441
+ });
442
+ const payload = toAmbassadorRequest([categoryId, options]);
443
+ const reqOpts = ambassadorWixEventsV1Category.bulkAssignEvents(payload);
444
+ __log(`"BulkAssignEvents" sending request with: ${__inspect(reqOpts)}`);
445
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
446
+ try {
447
+ const result = yield httpClient.request(reqOpts);
448
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
449
+ return fromJSON(result.data);
450
+ }
451
+ catch (err) {
452
+ const transformedError = velo_1.transformError(err, requestTransformation, [
453
+ 'categoryId',
454
+ 'options',
455
+ ]);
456
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
457
+ throw transformedError;
458
+ }
459
+ });
460
+ }
461
+ exports.bulkAssignEvents = bulkAssignEvents;
462
+ /**
463
+ * Assigns filtered events to multiple categories.
464
+ * @public
465
+ * @documentationMaturity preview
466
+ * @requiredField categoryId
467
+ * @requiredField options
468
+ * @requiredField options.filter
469
+ */
470
+ function bulkAssignEventsAsync(categoryId, options) {
471
+ var _a, _b, _c;
472
+ return __awaiter(this, arguments, void 0, function* () {
473
+ const requestTransformation = { categoryId: '$[0]', filter: '$[1].filter' };
474
+ const responseTransformation = '$';
475
+ // @ts-ignore
476
+ const { httpClient, sideEffects } = arguments[2];
477
+ const { toAmbassadorRequest } = velo_1.serializer({
478
+ rootSchema: _bulkAssignEventsAsyncRequest,
479
+ depSchemas: {},
480
+ fqdnTransformation: {
481
+ paths: [],
482
+ transformation: _fromVeloEntity,
483
+ },
484
+ customTransformation: requestTransformation,
485
+ });
486
+ const { fromJSON } = velo_1.serializer({
487
+ rootSchema: _bulkAssignEventsAsyncResponse,
488
+ depSchemas: {},
489
+ fqdnTransformation: {
490
+ paths: [],
491
+ transformation: _toVeloEntity,
492
+ },
493
+ customTransformation: responseTransformation,
494
+ });
495
+ const payload = toAmbassadorRequest([categoryId, options]);
496
+ const reqOpts = ambassadorWixEventsV1Category.bulkAssignEventsAsync(payload);
497
+ __log(`"BulkAssignEventsAsync" sending request with: ${__inspect(reqOpts)}`);
498
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
499
+ try {
500
+ const result = yield httpClient.request(reqOpts);
501
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
502
+ return fromJSON(result.data);
503
+ }
504
+ catch (err) {
505
+ const transformedError = velo_1.transformError(err, requestTransformation, [
506
+ 'categoryId',
507
+ 'options',
508
+ ]);
509
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
510
+ throw transformedError;
511
+ }
512
+ });
513
+ }
514
+ exports.bulkAssignEventsAsync = bulkAssignEventsAsync;
515
+ /**
516
+ * Unassigns events from a single category.
517
+ * @public
518
+ * @documentationMaturity preview
519
+ * @requiredField categoryId
520
+ * @requiredField eventId
521
+ */
522
+ function unassignEvents(categoryId, eventId) {
523
+ var _a, _b, _c;
524
+ return __awaiter(this, arguments, void 0, function* () {
525
+ const requestTransformation = { categoryId: '$[0]', eventId: '$[1]' };
526
+ const responseTransformation = '$';
527
+ // @ts-ignore
528
+ const { httpClient, sideEffects } = arguments[2];
529
+ const { toAmbassadorRequest } = velo_1.serializer({
530
+ rootSchema: _unassignEventsRequest,
531
+ depSchemas: {},
532
+ fqdnTransformation: {
533
+ paths: [],
534
+ transformation: _fromVeloEntity,
535
+ },
536
+ customTransformation: requestTransformation,
537
+ });
538
+ const { fromJSON } = velo_1.serializer({
539
+ rootSchema: _unassignEventsResponse,
540
+ depSchemas: {},
541
+ fqdnTransformation: {
542
+ paths: [],
543
+ transformation: _toVeloEntity,
544
+ },
545
+ customTransformation: responseTransformation,
546
+ });
547
+ const payload = toAmbassadorRequest([categoryId, eventId]);
548
+ const reqOpts = ambassadorWixEventsV1Category.unassignEvents(payload);
549
+ __log(`"UnassignEvents" sending request with: ${__inspect(reqOpts)}`);
550
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
551
+ try {
552
+ const result = yield httpClient.request(reqOpts);
553
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
554
+ return fromJSON(result.data);
555
+ }
556
+ catch (err) {
557
+ const transformedError = velo_1.transformError(err, requestTransformation, [
558
+ 'categoryId',
559
+ 'eventId',
560
+ ]);
561
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
562
+ throw transformedError;
563
+ }
564
+ });
565
+ }
566
+ exports.unassignEvents = unassignEvents;
567
+ /**
568
+ * Unassigns events from multiple categories.
569
+ * @public
570
+ * @documentationMaturity preview
571
+ * @requiredField categoryId
572
+ */
573
+ function bulkUnassignEvents(categoryId, options) {
574
+ var _a, _b, _c;
575
+ return __awaiter(this, arguments, void 0, function* () {
576
+ const requestTransformation = { categoryId: '$[0]', eventId: '$[1].eventId' };
577
+ const responseTransformation = '$';
578
+ // @ts-ignore
579
+ const { httpClient, sideEffects } = arguments[2];
580
+ const { toAmbassadorRequest } = velo_1.serializer({
581
+ rootSchema: _bulkUnassignEventsRequest,
582
+ depSchemas: {},
583
+ fqdnTransformation: {
584
+ paths: [],
585
+ transformation: _fromVeloEntity,
586
+ },
587
+ customTransformation: requestTransformation,
588
+ });
589
+ const { fromJSON } = velo_1.serializer({
590
+ rootSchema: _bulkUnassignEventsResponse,
591
+ depSchemas: {},
592
+ fqdnTransformation: {
593
+ paths: [...['Array#results.item']],
594
+ transformation: _toVeloEntity,
595
+ },
596
+ customTransformation: responseTransformation,
597
+ });
598
+ const payload = toAmbassadorRequest([categoryId, options]);
599
+ const reqOpts = ambassadorWixEventsV1Category.bulkUnassignEvents(payload);
600
+ __log(`"BulkUnassignEvents" sending request with: ${__inspect(reqOpts)}`);
601
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
602
+ try {
603
+ const result = yield httpClient.request(reqOpts);
604
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
605
+ return fromJSON(result.data);
606
+ }
607
+ catch (err) {
608
+ const transformedError = velo_1.transformError(err, requestTransformation, [
609
+ 'categoryId',
610
+ 'options',
611
+ ]);
612
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
613
+ throw transformedError;
614
+ }
615
+ });
616
+ }
617
+ exports.bulkUnassignEvents = bulkUnassignEvents;
618
+ /**
619
+ * Unassigns filtered events from multiple categories.
620
+ * @public
621
+ * @documentationMaturity preview
622
+ * @requiredField categoryId
623
+ * @requiredField options
624
+ * @requiredField options.filter
625
+ */
626
+ function bulkUnassignEventsAsync(categoryId, options) {
627
+ var _a, _b, _c;
628
+ return __awaiter(this, arguments, void 0, function* () {
629
+ const requestTransformation = { categoryId: '$[0]', filter: '$[1].filter' };
630
+ const responseTransformation = '$';
631
+ // @ts-ignore
632
+ const { httpClient, sideEffects } = arguments[2];
633
+ const { toAmbassadorRequest } = velo_1.serializer({
634
+ rootSchema: _bulkUnassignEventsAsyncRequest,
635
+ depSchemas: {},
636
+ fqdnTransformation: {
637
+ paths: [],
638
+ transformation: _fromVeloEntity,
639
+ },
640
+ customTransformation: requestTransformation,
641
+ });
642
+ const { fromJSON } = velo_1.serializer({
643
+ rootSchema: _bulkUnassignEventsAsyncResponse,
644
+ depSchemas: {},
645
+ fqdnTransformation: {
646
+ paths: [],
647
+ transformation: _toVeloEntity,
648
+ },
649
+ customTransformation: responseTransformation,
650
+ });
651
+ const payload = toAmbassadorRequest([categoryId, options]);
652
+ const reqOpts = ambassadorWixEventsV1Category.bulkUnassignEventsAsync(payload);
653
+ __log(`"BulkUnassignEventsAsync" sending request with: ${__inspect(reqOpts)}`);
654
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
655
+ try {
656
+ const result = yield httpClient.request(reqOpts);
657
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
658
+ return fromJSON(result.data);
659
+ }
660
+ catch (err) {
661
+ const transformedError = velo_1.transformError(err, requestTransformation, [
662
+ 'categoryId',
663
+ 'options',
664
+ ]);
665
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
666
+ throw transformedError;
667
+ }
668
+ });
669
+ }
670
+ exports.bulkUnassignEventsAsync = bulkUnassignEventsAsync;
671
+ /**
672
+ * Lists visible event categories.
673
+ * @public
674
+ * @documentationMaturity preview
675
+ * @requiredField eventId
676
+ */
677
+ function listEventCategories(eventId) {
678
+ var _a, _b, _c;
679
+ return __awaiter(this, arguments, void 0, function* () {
680
+ const requestTransformation = { eventId: '$[0]' };
681
+ const responseTransformation = '$';
682
+ // @ts-ignore
683
+ const { httpClient, sideEffects } = arguments[1];
684
+ const { toAmbassadorRequest } = velo_1.serializer({
685
+ rootSchema: _listEventCategoriesRequest,
686
+ depSchemas: {},
687
+ fqdnTransformation: {
688
+ paths: [],
689
+ transformation: _fromVeloEntity,
690
+ },
691
+ customTransformation: requestTransformation,
692
+ });
693
+ const { fromJSON } = velo_1.serializer({
694
+ rootSchema: _listEventCategoriesResponse,
695
+ depSchemas: {},
696
+ fqdnTransformation: {
697
+ paths: [...['Array#categories']],
698
+ transformation: _toVeloEntity,
699
+ },
700
+ customTransformation: responseTransformation,
701
+ });
702
+ const payload = toAmbassadorRequest([eventId]);
703
+ const reqOpts = ambassadorWixEventsV1Category.listEventCategories(payload);
704
+ __log(`"ListEventCategories" sending request with: ${__inspect(reqOpts)}`);
705
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
706
+ try {
707
+ const result = yield httpClient.request(reqOpts);
708
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
709
+ return fromJSON(result.data);
710
+ }
711
+ catch (err) {
712
+ const transformedError = velo_1.transformError(err, requestTransformation, [
713
+ 'eventId',
714
+ ]);
715
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
716
+ throw transformedError;
717
+ }
718
+ });
719
+ }
720
+ exports.listEventCategories = listEventCategories;
721
+ /**
722
+ * Change the order of category events.
723
+ * @param categoryId - Category ID
724
+ * @public
725
+ * @documentationMaturity preview
726
+ * @requiredField categoryId
727
+ */
728
+ function reorderCategoryEvents(categoryId, options) {
729
+ var _a, _b, _c;
730
+ return __awaiter(this, arguments, void 0, function* () {
731
+ const requestTransformation = {
732
+ categoryId: '$[0]',
733
+ eventId: '$[1].eventId',
734
+ beforeEventId: '$[1].beforeEventId',
735
+ afterEventId: '$[1].afterEventId',
736
+ };
737
+ const responseTransformation = '$';
738
+ // @ts-ignore
739
+ const { httpClient, sideEffects } = arguments[2];
740
+ const { toAmbassadorRequest } = velo_1.serializer({
741
+ rootSchema: _reorderCategoryEventsRequest,
742
+ depSchemas: {},
743
+ fqdnTransformation: {
744
+ paths: [],
745
+ transformation: _fromVeloEntity,
746
+ },
747
+ customTransformation: requestTransformation,
748
+ });
749
+ const { fromJSON } = velo_1.serializer({
750
+ rootSchema: _reorderCategoryEventsResponse,
751
+ depSchemas: {},
752
+ fqdnTransformation: {
753
+ paths: [],
754
+ transformation: _toVeloEntity,
755
+ },
756
+ customTransformation: responseTransformation,
757
+ });
758
+ const payload = toAmbassadorRequest([categoryId, options]);
759
+ const reqOpts = ambassadorWixEventsV1Category.reorderCategoryEvents(payload);
760
+ __log(`"ReorderCategoryEvents" sending request with: ${__inspect(reqOpts)}`);
761
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
762
+ try {
763
+ const result = yield httpClient.request(reqOpts);
764
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
765
+ return fromJSON(result.data);
766
+ }
767
+ catch (err) {
768
+ const transformedError = velo_1.transformError(err, requestTransformation, [
769
+ 'categoryId',
770
+ 'options',
771
+ ]);
772
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
773
+ throw transformedError;
774
+ }
775
+ });
776
+ }
777
+ exports.reorderCategoryEvents = reorderCategoryEvents;
778
+ //# sourceMappingURL=events-v1-category.universal.js.map