@wix/auto_sdk_bookings_services 1.0.34 → 1.0.35

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 (130) hide show
  1. package/build/cjs/index.d.ts +1 -0
  2. package/build/cjs/index.js +18 -0
  3. package/build/cjs/index.js.map +1 -0
  4. package/build/cjs/index.typings.d.ts +1 -0
  5. package/build/cjs/index.typings.js +18 -0
  6. package/build/cjs/index.typings.js.map +1 -0
  7. package/build/cjs/meta.d.ts +1 -0
  8. package/build/cjs/meta.js +18 -0
  9. package/build/cjs/meta.js.map +1 -0
  10. package/build/cjs/src/bookings-services-v2-service-services.context.d.ts +41 -0
  11. package/build/cjs/src/bookings-services-v2-service-services.context.js +82 -0
  12. package/build/cjs/src/bookings-services-v2-service-services.context.js.map +1 -0
  13. package/build/cjs/src/bookings-services-v2-service-services.http.d.ts +489 -0
  14. package/build/cjs/src/bookings-services-v2-service-services.http.js +1797 -0
  15. package/build/cjs/src/bookings-services-v2-service-services.http.js.map +1 -0
  16. package/build/cjs/src/bookings-services-v2-service-services.meta.d.ts +47 -0
  17. package/build/cjs/src/bookings-services-v2-service-services.meta.js +427 -0
  18. package/build/cjs/src/bookings-services-v2-service-services.meta.js.map +1 -0
  19. package/build/{internal/index.d.ts → cjs/src/bookings-services-v2-service-services.public.d.ts} +30 -62
  20. package/build/cjs/src/bookings-services-v2-service-services.public.js +304 -0
  21. package/build/cjs/src/bookings-services-v2-service-services.public.js.map +1 -0
  22. package/build/{bookings-services-v2-service-services.universal-Dn8Flkdi.d.mts → cjs/src/bookings-services-v2-service-services.types.d.ts} +424 -729
  23. package/build/cjs/src/bookings-services-v2-service-services.types.js +349 -0
  24. package/build/cjs/src/bookings-services-v2-service-services.types.js.map +1 -0
  25. package/build/cjs/src/bookings-services-v2-service-services.universal.d.ts +5234 -0
  26. package/build/cjs/src/bookings-services-v2-service-services.universal.js +2252 -0
  27. package/build/cjs/src/bookings-services-v2-service-services.universal.js.map +1 -0
  28. package/build/es/index.d.ts +1 -0
  29. package/build/es/index.js +2 -0
  30. package/build/es/index.js.map +1 -0
  31. package/build/es/index.typings.d.ts +1 -0
  32. package/build/es/index.typings.js +2 -0
  33. package/build/es/index.typings.js.map +1 -0
  34. package/build/es/meta.d.ts +1 -0
  35. package/build/es/meta.js +2 -0
  36. package/build/es/meta.js.map +1 -0
  37. package/build/es/package.json +3 -0
  38. package/build/es/src/bookings-services-v2-service-services.context.d.ts +41 -0
  39. package/build/es/src/bookings-services-v2-service-services.context.js +41 -0
  40. package/build/es/src/bookings-services-v2-service-services.context.js.map +1 -0
  41. package/build/es/src/bookings-services-v2-service-services.http.d.ts +489 -0
  42. package/build/es/src/bookings-services-v2-service-services.http.js +1773 -0
  43. package/build/es/src/bookings-services-v2-service-services.http.js.map +1 -0
  44. package/build/es/src/bookings-services-v2-service-services.meta.d.ts +47 -0
  45. package/build/es/src/bookings-services-v2-service-services.meta.js +380 -0
  46. package/build/es/src/bookings-services-v2-service-services.meta.js.map +1 -0
  47. package/build/{index.d.ts → es/src/bookings-services-v2-service-services.public.d.ts} +30 -62
  48. package/build/es/src/bookings-services-v2-service-services.public.js +242 -0
  49. package/build/es/src/bookings-services-v2-service-services.public.js.map +1 -0
  50. package/build/{bookings-services-v2-service-services.universal-Dn8Flkdi.d.ts → es/src/bookings-services-v2-service-services.types.d.ts} +424 -729
  51. package/build/es/src/bookings-services-v2-service-services.types.js +346 -0
  52. package/build/es/src/bookings-services-v2-service-services.types.js.map +1 -0
  53. package/build/es/src/bookings-services-v2-service-services.universal.d.ts +5234 -0
  54. package/build/es/src/bookings-services-v2-service-services.universal.js +2204 -0
  55. package/build/es/src/bookings-services-v2-service-services.universal.js.map +1 -0
  56. package/build/internal/cjs/index.d.ts +1 -0
  57. package/build/internal/cjs/index.js +18 -0
  58. package/build/internal/cjs/index.js.map +1 -0
  59. package/build/internal/cjs/index.typings.d.ts +1 -0
  60. package/build/internal/cjs/index.typings.js +18 -0
  61. package/build/internal/cjs/index.typings.js.map +1 -0
  62. package/build/internal/cjs/meta.d.ts +1 -0
  63. package/build/internal/cjs/meta.js +18 -0
  64. package/build/internal/cjs/meta.js.map +1 -0
  65. package/build/internal/cjs/src/bookings-services-v2-service-services.context.d.ts +41 -0
  66. package/build/internal/cjs/src/bookings-services-v2-service-services.context.js +82 -0
  67. package/build/internal/cjs/src/bookings-services-v2-service-services.context.js.map +1 -0
  68. package/build/internal/cjs/src/bookings-services-v2-service-services.http.d.ts +489 -0
  69. package/build/internal/cjs/src/bookings-services-v2-service-services.http.js +1797 -0
  70. package/build/internal/cjs/src/bookings-services-v2-service-services.http.js.map +1 -0
  71. package/build/internal/cjs/src/bookings-services-v2-service-services.meta.d.ts +47 -0
  72. package/build/internal/cjs/src/bookings-services-v2-service-services.meta.js +427 -0
  73. package/build/internal/cjs/src/bookings-services-v2-service-services.meta.js.map +1 -0
  74. package/build/internal/{index.d.mts → cjs/src/bookings-services-v2-service-services.public.d.ts} +30 -62
  75. package/build/internal/cjs/src/bookings-services-v2-service-services.public.js +304 -0
  76. package/build/internal/cjs/src/bookings-services-v2-service-services.public.js.map +1 -0
  77. package/build/internal/{bookings-services-v2-service-services.universal-Dn8Flkdi.d.ts → cjs/src/bookings-services-v2-service-services.types.d.ts} +424 -729
  78. package/build/internal/cjs/src/bookings-services-v2-service-services.types.js +349 -0
  79. package/build/internal/cjs/src/bookings-services-v2-service-services.types.js.map +1 -0
  80. package/build/internal/cjs/src/bookings-services-v2-service-services.universal.d.ts +5234 -0
  81. package/build/internal/cjs/src/bookings-services-v2-service-services.universal.js +2252 -0
  82. package/build/internal/cjs/src/bookings-services-v2-service-services.universal.js.map +1 -0
  83. package/build/internal/es/index.d.ts +1 -0
  84. package/build/internal/es/index.js +2 -0
  85. package/build/internal/es/index.js.map +1 -0
  86. package/build/internal/es/index.typings.d.ts +1 -0
  87. package/build/internal/es/index.typings.js +2 -0
  88. package/build/internal/es/index.typings.js.map +1 -0
  89. package/build/internal/es/meta.d.ts +1 -0
  90. package/build/internal/es/meta.js +2 -0
  91. package/build/internal/es/meta.js.map +1 -0
  92. package/build/internal/es/src/bookings-services-v2-service-services.context.d.ts +41 -0
  93. package/build/internal/es/src/bookings-services-v2-service-services.context.js +41 -0
  94. package/build/internal/es/src/bookings-services-v2-service-services.context.js.map +1 -0
  95. package/build/internal/es/src/bookings-services-v2-service-services.http.d.ts +489 -0
  96. package/build/internal/es/src/bookings-services-v2-service-services.http.js +1773 -0
  97. package/build/internal/es/src/bookings-services-v2-service-services.http.js.map +1 -0
  98. package/build/internal/es/src/bookings-services-v2-service-services.meta.d.ts +47 -0
  99. package/build/internal/es/src/bookings-services-v2-service-services.meta.js +380 -0
  100. package/build/internal/es/src/bookings-services-v2-service-services.meta.js.map +1 -0
  101. package/build/{index.d.mts → internal/es/src/bookings-services-v2-service-services.public.d.ts} +30 -62
  102. package/build/internal/es/src/bookings-services-v2-service-services.public.js +242 -0
  103. package/build/internal/es/src/bookings-services-v2-service-services.public.js.map +1 -0
  104. package/build/internal/{bookings-services-v2-service-services.universal-Dn8Flkdi.d.mts → es/src/bookings-services-v2-service-services.types.d.ts} +424 -729
  105. package/build/internal/es/src/bookings-services-v2-service-services.types.js +346 -0
  106. package/build/internal/es/src/bookings-services-v2-service-services.types.js.map +1 -0
  107. package/build/internal/es/src/bookings-services-v2-service-services.universal.d.ts +5234 -0
  108. package/build/internal/es/src/bookings-services-v2-service-services.universal.js +2204 -0
  109. package/build/internal/es/src/bookings-services-v2-service-services.universal.js.map +1 -0
  110. package/package.json +11 -12
  111. package/build/index.js +0 -3208
  112. package/build/index.js.map +0 -1
  113. package/build/index.mjs +0 -3124
  114. package/build/index.mjs.map +0 -1
  115. package/build/internal/index.js +0 -3208
  116. package/build/internal/index.js.map +0 -1
  117. package/build/internal/index.mjs +0 -3124
  118. package/build/internal/index.mjs.map +0 -1
  119. package/build/internal/meta.d.mts +0 -2302
  120. package/build/internal/meta.d.ts +0 -2302
  121. package/build/internal/meta.js +0 -1761
  122. package/build/internal/meta.js.map +0 -1
  123. package/build/internal/meta.mjs +0 -1714
  124. package/build/internal/meta.mjs.map +0 -1
  125. package/build/meta.d.mts +0 -2302
  126. package/build/meta.d.ts +0 -2302
  127. package/build/meta.js +0 -1761
  128. package/build/meta.js.map +0 -1
  129. package/build/meta.mjs +0 -1714
  130. package/build/meta.mjs.map +0 -1
@@ -0,0 +1,1773 @@
1
+ import { toURLSearchParams } from '@wix/sdk-runtime/rest-modules';
2
+ import { transformSDKFloatToRESTFloat } from '@wix/sdk-runtime/transformations/float';
3
+ import { transformRESTFloatToSDKFloat } from '@wix/sdk-runtime/transformations/float';
4
+ import { transformSDKTimestampToRESTTimestamp } from '@wix/sdk-runtime/transformations/timestamp';
5
+ import { transformRESTTimestampToSDKTimestamp } from '@wix/sdk-runtime/transformations/timestamp';
6
+ import { transformSDKFieldMaskToRESTFieldMask } from '@wix/sdk-runtime/transformations/field-mask';
7
+ import { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';
8
+ import { resolveUrl } from '@wix/sdk-runtime/rest-modules';
9
+ function resolveWixBookingsServicesV2ServicesServiceUrl(opts) {
10
+ const domainToMappings = {
11
+ '*.dev.wix-code.com': [
12
+ {
13
+ srcPath: '/_api/services-2',
14
+ destPath: '',
15
+ },
16
+ {
17
+ srcPath: '/_api/bookings/v2/services',
18
+ destPath: '/v2/services',
19
+ },
20
+ ],
21
+ 'www.wixapis.com': [
22
+ {
23
+ srcPath: '/_api/bookings/v2/services',
24
+ destPath: '/v2/services',
25
+ },
26
+ {
27
+ srcPath: '/bookings/v2/services',
28
+ destPath: '/v2/services',
29
+ },
30
+ {
31
+ srcPath: '/bookings/v2/bulk/services',
32
+ destPath: '/v2/bulk/services',
33
+ },
34
+ ],
35
+ 'manage._base_domain_': [
36
+ {
37
+ srcPath: '/_api/bookings/v2/services',
38
+ destPath: '/v2/services',
39
+ },
40
+ {
41
+ srcPath: '/_api/bookings/v2/bulk/services',
42
+ destPath: '/v2/bulk/services',
43
+ },
44
+ ],
45
+ 'editor._base_domain_': [
46
+ {
47
+ srcPath: '/_api/bookings/v2/services',
48
+ destPath: '/v2/services',
49
+ },
50
+ {
51
+ srcPath: '/_api/bookings/v2/bulk/services',
52
+ destPath: '/v2/bulk/services',
53
+ },
54
+ ],
55
+ 'blocks._base_domain_': [
56
+ {
57
+ srcPath: '/_api/bookings/v2/services',
58
+ destPath: '/v2/services',
59
+ },
60
+ {
61
+ srcPath: '/_api/bookings/v2/bulk/services',
62
+ destPath: '/v2/bulk/services',
63
+ },
64
+ ],
65
+ 'create.editorx': [
66
+ {
67
+ srcPath: '/_api/bookings/v2/services',
68
+ destPath: '/v2/services',
69
+ },
70
+ {
71
+ srcPath: '/_api/bookings/v2/bulk/services',
72
+ destPath: '/v2/bulk/services',
73
+ },
74
+ ],
75
+ _: [
76
+ {
77
+ srcPath: '/_api/bookings/v2/services',
78
+ destPath: '/v2/services',
79
+ },
80
+ ],
81
+ 'www._base_domain_': [
82
+ {
83
+ srcPath: '/_api/bookings/v2/services',
84
+ destPath: '/v2/services',
85
+ },
86
+ ],
87
+ 'bo._base_domain_': [
88
+ {
89
+ srcPath: '/_api/bookings/v2/services',
90
+ destPath: '/v2/services',
91
+ },
92
+ ],
93
+ 'wixbo.ai': [
94
+ {
95
+ srcPath: '/_api/bookings/v2/services',
96
+ destPath: '/v2/services',
97
+ },
98
+ ],
99
+ 'wix-bo.com': [
100
+ {
101
+ srcPath: '/_api/bookings/v2/services',
102
+ destPath: '/v2/services',
103
+ },
104
+ ],
105
+ 'editor.wixapps.net': [
106
+ {
107
+ srcPath: '/_api/bookings/v2/services',
108
+ destPath: '/v2/services',
109
+ },
110
+ ],
111
+ 'api._api_base_domain_': [
112
+ {
113
+ srcPath: '/services-2',
114
+ destPath: '',
115
+ },
116
+ ],
117
+ };
118
+ return resolveUrl(Object.assign(opts, { domainToMappings }));
119
+ }
120
+ const PACKAGE_NAME = '@wix/auto_sdk_bookings_services';
121
+ /**
122
+ * Creates a service.
123
+ *
124
+ *
125
+ * ## Required fields
126
+ *
127
+ * When creating a service you must specify the following fields:
128
+ * - `type`
129
+ * ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/services/about-service-types) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/about-service-types)):
130
+ * Whether it's an appointment-based service, class, or course.
131
+ * - `name`: Service name that's displayed to customers.
132
+ * - `onlineBooking`:
133
+ * Settings determining whether customers can book online, whether the business
134
+ * must manually confirm bookings, and whether customers can request to book an
135
+ * appointment time slot that already has a booking request awaiting business
136
+ * confirmation.
137
+ * - `payment`
138
+ * ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/services/about-service-payments) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/about-service-payments)):
139
+ * How customers can pay when signing up for the service.
140
+ *
141
+ * ### Session durations
142
+ *
143
+ * Depending on which type of service you're creating, you may also need to specify
144
+ * supported session durations.
145
+ *
146
+ * __Classes and courses__
147
+ *
148
+ * Don't specify `schedule.availabilityConstraints.sessionDurations`.
149
+ *
150
+ * __Appointment-based services without varied pricing based on session length__
151
+ *
152
+ * Specify the single supported session duration in the
153
+ * `schedule.availabilityConstraints.sessionDurations` array.
154
+ *
155
+ * __Appointment-based services with varied pricing based on session length__
156
+ *
157
+ * - Specify all supported session durations in `schedule.availabilityConstraints.sessionDurations`.
158
+ * - Note that Wix Bookings doesn't display these values to customers and
159
+ * ignores them in pricing and availability calculations. Instead session
160
+ * durations are retrieved from the relevant service *variants*
161
+ * ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/service-options-and-variants/introduction) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/service-options-and-variants/introduction)).
162
+ * - It is mandatory to specify `schedule.availabilityConstraints.sessionDurations`,
163
+ * even though these values are ignored.
164
+ */
165
+ export function createService(payload) {
166
+ function __createService({ host }) {
167
+ const serializedData = transformPaths(payload, [
168
+ {
169
+ transformFn: transformSDKTimestampToRESTTimestamp,
170
+ paths: [
171
+ { path: 'service.createdDate' },
172
+ { path: 'service.updatedDate' },
173
+ { path: 'service.media.items.image.urlExpirationDate' },
174
+ { path: 'service.media.mainMedia.image.urlExpirationDate' },
175
+ { path: 'service.media.coverMedia.image.urlExpirationDate' },
176
+ { path: 'service.bookingPolicy.createdDate' },
177
+ { path: 'service.bookingPolicy.updatedDate' },
178
+ { path: 'service.schedule.firstSessionStart' },
179
+ { path: 'service.schedule.lastSessionEnd' },
180
+ { path: 'service.staffMembers.mainMedia.image.urlExpirationDate' },
181
+ {
182
+ path: 'service.staffMemberDetails.staffMembers.mainMedia.image.urlExpirationDate',
183
+ },
184
+ { path: 'service.supportedSlugs.createdDate' },
185
+ { path: 'service.mainSlug.createdDate' },
186
+ ],
187
+ },
188
+ {
189
+ transformFn: transformSDKFloatToRESTFloat,
190
+ paths: [
191
+ { path: 'service.locations.business.address.geocode.latitude' },
192
+ { path: 'service.locations.business.address.geocode.longitude' },
193
+ { path: 'service.locations.custom.address.geocode.latitude' },
194
+ { path: 'service.locations.custom.address.geocode.longitude' },
195
+ { path: 'service.locations.calculatedAddress.geocode.latitude' },
196
+ { path: 'service.locations.calculatedAddress.geocode.longitude' },
197
+ ],
198
+ },
199
+ ]);
200
+ const metadata = {
201
+ entityFqdn: 'wix.bookings.services.v2.service',
202
+ method: 'POST',
203
+ methodFqn: 'wix.bookings.services.v2.ServicesService.CreateService',
204
+ packageName: PACKAGE_NAME,
205
+ url: resolveWixBookingsServicesV2ServicesServiceUrl({
206
+ protoPath: '/v2/services',
207
+ data: serializedData,
208
+ host,
209
+ }),
210
+ data: serializedData,
211
+ transformResponse: (payload) => transformPaths(payload, [
212
+ {
213
+ transformFn: transformRESTTimestampToSDKTimestamp,
214
+ paths: [
215
+ { path: 'service.createdDate' },
216
+ { path: 'service.updatedDate' },
217
+ { path: 'service.media.items.image.urlExpirationDate' },
218
+ { path: 'service.media.mainMedia.image.urlExpirationDate' },
219
+ { path: 'service.media.coverMedia.image.urlExpirationDate' },
220
+ { path: 'service.bookingPolicy.createdDate' },
221
+ { path: 'service.bookingPolicy.updatedDate' },
222
+ { path: 'service.schedule.firstSessionStart' },
223
+ { path: 'service.schedule.lastSessionEnd' },
224
+ {
225
+ path: 'service.staffMembers.mainMedia.image.urlExpirationDate',
226
+ },
227
+ {
228
+ path: 'service.staffMemberDetails.staffMembers.mainMedia.image.urlExpirationDate',
229
+ },
230
+ { path: 'service.supportedSlugs.createdDate' },
231
+ { path: 'service.mainSlug.createdDate' },
232
+ ],
233
+ },
234
+ {
235
+ transformFn: transformRESTFloatToSDKFloat,
236
+ paths: [
237
+ { path: 'service.locations.business.address.geocode.latitude' },
238
+ { path: 'service.locations.business.address.geocode.longitude' },
239
+ { path: 'service.locations.custom.address.geocode.latitude' },
240
+ { path: 'service.locations.custom.address.geocode.longitude' },
241
+ { path: 'service.locations.calculatedAddress.geocode.latitude' },
242
+ { path: 'service.locations.calculatedAddress.geocode.longitude' },
243
+ ],
244
+ },
245
+ ]),
246
+ };
247
+ return metadata;
248
+ }
249
+ return __createService;
250
+ }
251
+ /** Retrieves a service. */
252
+ export function getService(payload) {
253
+ function __getService({ host }) {
254
+ const metadata = {
255
+ entityFqdn: 'wix.bookings.services.v2.service',
256
+ method: 'GET',
257
+ methodFqn: 'wix.bookings.services.v2.ServicesService.GetService',
258
+ packageName: PACKAGE_NAME,
259
+ url: resolveWixBookingsServicesV2ServicesServiceUrl({
260
+ protoPath: '/v2/services/{serviceId}',
261
+ data: payload,
262
+ host,
263
+ }),
264
+ params: toURLSearchParams(payload),
265
+ transformResponse: (payload) => transformPaths(payload, [
266
+ {
267
+ transformFn: transformRESTTimestampToSDKTimestamp,
268
+ paths: [
269
+ { path: 'service.createdDate' },
270
+ { path: 'service.updatedDate' },
271
+ { path: 'service.media.items.image.urlExpirationDate' },
272
+ { path: 'service.media.mainMedia.image.urlExpirationDate' },
273
+ { path: 'service.media.coverMedia.image.urlExpirationDate' },
274
+ { path: 'service.bookingPolicy.createdDate' },
275
+ { path: 'service.bookingPolicy.updatedDate' },
276
+ { path: 'service.schedule.firstSessionStart' },
277
+ { path: 'service.schedule.lastSessionEnd' },
278
+ {
279
+ path: 'service.staffMembers.mainMedia.image.urlExpirationDate',
280
+ },
281
+ {
282
+ path: 'service.staffMemberDetails.staffMembers.mainMedia.image.urlExpirationDate',
283
+ },
284
+ { path: 'service.supportedSlugs.createdDate' },
285
+ { path: 'service.mainSlug.createdDate' },
286
+ ],
287
+ },
288
+ {
289
+ transformFn: transformRESTFloatToSDKFloat,
290
+ paths: [
291
+ { path: 'service.locations.business.address.geocode.latitude' },
292
+ { path: 'service.locations.business.address.geocode.longitude' },
293
+ { path: 'service.locations.custom.address.geocode.latitude' },
294
+ { path: 'service.locations.custom.address.geocode.longitude' },
295
+ { path: 'service.locations.calculatedAddress.geocode.latitude' },
296
+ { path: 'service.locations.calculatedAddress.geocode.longitude' },
297
+ ],
298
+ },
299
+ ]),
300
+ };
301
+ return metadata;
302
+ }
303
+ return __getService;
304
+ }
305
+ /**
306
+ * Updates a service.
307
+ *
308
+ *
309
+ * Each time the service is updated, `revision` increments by 1. You must
310
+ * include the number of the existing revision when updating the service.
311
+ * This ensures you're working with the latest service information and
312
+ * prevents unintended overwrites.
313
+ *
314
+ * ## Session durations
315
+ *
316
+ * Specify `schedule.availabilityConstraints.sessionDurations`
317
+ * only if you want to update it for appointment-based services without varied
318
+ * pricing based on session length. Don't specify `schedule.availabilityConstraints.sessionDurations`
319
+ * for all other appointment-based services, classes, or courses. See *Create Service*
320
+ * ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/services/create-service#session-durations) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/create-service#session-durations))
321
+ * for more details.
322
+ */
323
+ export function updateService(payload) {
324
+ function __updateService({ host }) {
325
+ const serializedData = transformPaths(payload, [
326
+ {
327
+ transformFn: transformSDKFieldMaskToRESTFieldMask,
328
+ paths: [{ path: 'mask' }],
329
+ },
330
+ {
331
+ transformFn: transformSDKTimestampToRESTTimestamp,
332
+ paths: [
333
+ { path: 'service.createdDate' },
334
+ { path: 'service.updatedDate' },
335
+ { path: 'service.media.items.image.urlExpirationDate' },
336
+ { path: 'service.media.mainMedia.image.urlExpirationDate' },
337
+ { path: 'service.media.coverMedia.image.urlExpirationDate' },
338
+ { path: 'service.bookingPolicy.createdDate' },
339
+ { path: 'service.bookingPolicy.updatedDate' },
340
+ { path: 'service.schedule.firstSessionStart' },
341
+ { path: 'service.schedule.lastSessionEnd' },
342
+ { path: 'service.staffMembers.mainMedia.image.urlExpirationDate' },
343
+ {
344
+ path: 'service.staffMemberDetails.staffMembers.mainMedia.image.urlExpirationDate',
345
+ },
346
+ { path: 'service.supportedSlugs.createdDate' },
347
+ { path: 'service.mainSlug.createdDate' },
348
+ ],
349
+ },
350
+ {
351
+ transformFn: transformSDKFloatToRESTFloat,
352
+ paths: [
353
+ { path: 'service.locations.business.address.geocode.latitude' },
354
+ { path: 'service.locations.business.address.geocode.longitude' },
355
+ { path: 'service.locations.custom.address.geocode.latitude' },
356
+ { path: 'service.locations.custom.address.geocode.longitude' },
357
+ { path: 'service.locations.calculatedAddress.geocode.latitude' },
358
+ { path: 'service.locations.calculatedAddress.geocode.longitude' },
359
+ ],
360
+ },
361
+ ]);
362
+ const metadata = {
363
+ entityFqdn: 'wix.bookings.services.v2.service',
364
+ method: 'PATCH',
365
+ methodFqn: 'wix.bookings.services.v2.ServicesService.UpdateService',
366
+ packageName: PACKAGE_NAME,
367
+ url: resolveWixBookingsServicesV2ServicesServiceUrl({
368
+ protoPath: '/v2/services/{service.id}',
369
+ data: serializedData,
370
+ host,
371
+ }),
372
+ data: serializedData,
373
+ transformResponse: (payload) => transformPaths(payload, [
374
+ {
375
+ transformFn: transformRESTTimestampToSDKTimestamp,
376
+ paths: [
377
+ { path: 'service.createdDate' },
378
+ { path: 'service.updatedDate' },
379
+ { path: 'service.media.items.image.urlExpirationDate' },
380
+ { path: 'service.media.mainMedia.image.urlExpirationDate' },
381
+ { path: 'service.media.coverMedia.image.urlExpirationDate' },
382
+ { path: 'service.bookingPolicy.createdDate' },
383
+ { path: 'service.bookingPolicy.updatedDate' },
384
+ { path: 'service.schedule.firstSessionStart' },
385
+ { path: 'service.schedule.lastSessionEnd' },
386
+ {
387
+ path: 'service.staffMembers.mainMedia.image.urlExpirationDate',
388
+ },
389
+ {
390
+ path: 'service.staffMemberDetails.staffMembers.mainMedia.image.urlExpirationDate',
391
+ },
392
+ { path: 'service.supportedSlugs.createdDate' },
393
+ { path: 'service.mainSlug.createdDate' },
394
+ ],
395
+ },
396
+ {
397
+ transformFn: transformRESTFloatToSDKFloat,
398
+ paths: [
399
+ { path: 'service.locations.business.address.geocode.latitude' },
400
+ { path: 'service.locations.business.address.geocode.longitude' },
401
+ { path: 'service.locations.custom.address.geocode.latitude' },
402
+ { path: 'service.locations.custom.address.geocode.longitude' },
403
+ { path: 'service.locations.calculatedAddress.geocode.latitude' },
404
+ { path: 'service.locations.calculatedAddress.geocode.longitude' },
405
+ ],
406
+ },
407
+ ]),
408
+ };
409
+ return metadata;
410
+ }
411
+ return __updateService;
412
+ }
413
+ /**
414
+ * Updates up to 100 services.
415
+ *
416
+ *
417
+ * See *Update Service*
418
+ * ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/services/update-service) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/update-service))
419
+ * for more details.
420
+ *
421
+ * The call succeeds even if one or more individual services can't be updated.
422
+ * Information about failures is returned in `bulkActionMetadata`.
423
+ */
424
+ export function bulkUpdateServices(payload) {
425
+ function __bulkUpdateServices({ host }) {
426
+ const serializedData = transformPaths(payload, [
427
+ {
428
+ transformFn: transformSDKFieldMaskToRESTFieldMask,
429
+ paths: [{ path: 'services.mask' }],
430
+ },
431
+ {
432
+ transformFn: transformSDKTimestampToRESTTimestamp,
433
+ paths: [
434
+ { path: 'services.service.createdDate' },
435
+ { path: 'services.service.updatedDate' },
436
+ { path: 'services.service.media.items.image.urlExpirationDate' },
437
+ { path: 'services.service.media.mainMedia.image.urlExpirationDate' },
438
+ { path: 'services.service.media.coverMedia.image.urlExpirationDate' },
439
+ { path: 'services.service.bookingPolicy.createdDate' },
440
+ { path: 'services.service.bookingPolicy.updatedDate' },
441
+ { path: 'services.service.schedule.firstSessionStart' },
442
+ { path: 'services.service.schedule.lastSessionEnd' },
443
+ {
444
+ path: 'services.service.staffMembers.mainMedia.image.urlExpirationDate',
445
+ },
446
+ {
447
+ path: 'services.service.staffMemberDetails.staffMembers.mainMedia.image.urlExpirationDate',
448
+ },
449
+ { path: 'services.service.supportedSlugs.createdDate' },
450
+ { path: 'services.service.mainSlug.createdDate' },
451
+ ],
452
+ },
453
+ {
454
+ transformFn: transformSDKFloatToRESTFloat,
455
+ paths: [
456
+ {
457
+ path: 'services.service.locations.business.address.geocode.latitude',
458
+ },
459
+ {
460
+ path: 'services.service.locations.business.address.geocode.longitude',
461
+ },
462
+ {
463
+ path: 'services.service.locations.custom.address.geocode.latitude',
464
+ },
465
+ {
466
+ path: 'services.service.locations.custom.address.geocode.longitude',
467
+ },
468
+ {
469
+ path: 'services.service.locations.calculatedAddress.geocode.latitude',
470
+ },
471
+ {
472
+ path: 'services.service.locations.calculatedAddress.geocode.longitude',
473
+ },
474
+ ],
475
+ },
476
+ ]);
477
+ const metadata = {
478
+ entityFqdn: 'wix.bookings.services.v2.service',
479
+ method: 'POST',
480
+ methodFqn: 'wix.bookings.services.v2.ServicesService.BulkUpdateServices',
481
+ packageName: PACKAGE_NAME,
482
+ url: resolveWixBookingsServicesV2ServicesServiceUrl({
483
+ protoPath: '/v2/bulk/services/update',
484
+ data: serializedData,
485
+ host,
486
+ }),
487
+ data: serializedData,
488
+ transformResponse: (payload) => transformPaths(payload, [
489
+ {
490
+ transformFn: transformRESTTimestampToSDKTimestamp,
491
+ paths: [
492
+ { path: 'results.item.createdDate' },
493
+ { path: 'results.item.updatedDate' },
494
+ { path: 'results.item.media.items.image.urlExpirationDate' },
495
+ { path: 'results.item.media.mainMedia.image.urlExpirationDate' },
496
+ { path: 'results.item.media.coverMedia.image.urlExpirationDate' },
497
+ { path: 'results.item.bookingPolicy.createdDate' },
498
+ { path: 'results.item.bookingPolicy.updatedDate' },
499
+ { path: 'results.item.schedule.firstSessionStart' },
500
+ { path: 'results.item.schedule.lastSessionEnd' },
501
+ {
502
+ path: 'results.item.staffMembers.mainMedia.image.urlExpirationDate',
503
+ },
504
+ {
505
+ path: 'results.item.staffMemberDetails.staffMembers.mainMedia.image.urlExpirationDate',
506
+ },
507
+ { path: 'results.item.supportedSlugs.createdDate' },
508
+ { path: 'results.item.mainSlug.createdDate' },
509
+ ],
510
+ },
511
+ {
512
+ transformFn: transformRESTFloatToSDKFloat,
513
+ paths: [
514
+ {
515
+ path: 'results.item.locations.business.address.geocode.latitude',
516
+ },
517
+ {
518
+ path: 'results.item.locations.business.address.geocode.longitude',
519
+ },
520
+ {
521
+ path: 'results.item.locations.custom.address.geocode.latitude',
522
+ },
523
+ {
524
+ path: 'results.item.locations.custom.address.geocode.longitude',
525
+ },
526
+ {
527
+ path: 'results.item.locations.calculatedAddress.geocode.latitude',
528
+ },
529
+ {
530
+ path: 'results.item.locations.calculatedAddress.geocode.longitude',
531
+ },
532
+ ],
533
+ },
534
+ ]),
535
+ };
536
+ return metadata;
537
+ }
538
+ return __bulkUpdateServices;
539
+ }
540
+ /**
541
+ * Updates multiple services by filter.
542
+ *
543
+ *
544
+ * Refer to the supported filters article
545
+ * ([REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/filtering-and-sorting#filtering))
546
+ * for more details.
547
+ *
548
+ * See *Update Service*
549
+ * ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/services/update-service) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/update-service))
550
+ * for more details about updating a service.
551
+ *
552
+ * The call succeeds even if one or more individual services can't be updated.
553
+ * Information about failures is returned in `bulkActionMetadata`.
554
+ */
555
+ export function bulkUpdateServicesByFilter(payload) {
556
+ function __bulkUpdateServicesByFilter({ host }) {
557
+ const serializedData = transformPaths(payload, [
558
+ {
559
+ transformFn: transformSDKFieldMaskToRESTFieldMask,
560
+ paths: [{ path: 'mask' }],
561
+ },
562
+ {
563
+ transformFn: transformSDKTimestampToRESTTimestamp,
564
+ paths: [
565
+ { path: 'service.createdDate' },
566
+ { path: 'service.updatedDate' },
567
+ { path: 'service.media.items.image.urlExpirationDate' },
568
+ { path: 'service.media.mainMedia.image.urlExpirationDate' },
569
+ { path: 'service.media.coverMedia.image.urlExpirationDate' },
570
+ { path: 'service.bookingPolicy.createdDate' },
571
+ { path: 'service.bookingPolicy.updatedDate' },
572
+ { path: 'service.schedule.firstSessionStart' },
573
+ { path: 'service.schedule.lastSessionEnd' },
574
+ { path: 'service.staffMembers.mainMedia.image.urlExpirationDate' },
575
+ {
576
+ path: 'service.staffMemberDetails.staffMembers.mainMedia.image.urlExpirationDate',
577
+ },
578
+ { path: 'service.supportedSlugs.createdDate' },
579
+ { path: 'service.mainSlug.createdDate' },
580
+ ],
581
+ },
582
+ {
583
+ transformFn: transformSDKFloatToRESTFloat,
584
+ paths: [
585
+ { path: 'service.locations.business.address.geocode.latitude' },
586
+ { path: 'service.locations.business.address.geocode.longitude' },
587
+ { path: 'service.locations.custom.address.geocode.latitude' },
588
+ { path: 'service.locations.custom.address.geocode.longitude' },
589
+ { path: 'service.locations.calculatedAddress.geocode.latitude' },
590
+ { path: 'service.locations.calculatedAddress.geocode.longitude' },
591
+ ],
592
+ },
593
+ ]);
594
+ const metadata = {
595
+ entityFqdn: 'wix.bookings.services.v2.service',
596
+ method: 'POST',
597
+ methodFqn: 'wix.bookings.services.v2.ServicesService.BulkUpdateServicesByFilter',
598
+ packageName: PACKAGE_NAME,
599
+ url: resolveWixBookingsServicesV2ServicesServiceUrl({
600
+ protoPath: '/v2/bulk/services/update-by-filter',
601
+ data: serializedData,
602
+ host,
603
+ }),
604
+ data: serializedData,
605
+ };
606
+ return metadata;
607
+ }
608
+ return __bulkUpdateServicesByFilter;
609
+ }
610
+ /**
611
+ * Deletes a service.
612
+ *
613
+ *
614
+ * Specify `{"preserveFutureSessionsWithParticipants": true}` to retain all
615
+ * future sessions for the service. By default, all future sessions are canceled.
616
+ */
617
+ export function deleteService(payload) {
618
+ function __deleteService({ host }) {
619
+ const metadata = {
620
+ entityFqdn: 'wix.bookings.services.v2.service',
621
+ method: 'DELETE',
622
+ methodFqn: 'wix.bookings.services.v2.ServicesService.DeleteService',
623
+ packageName: PACKAGE_NAME,
624
+ url: resolveWixBookingsServicesV2ServicesServiceUrl({
625
+ protoPath: '/v2/services/{serviceId}',
626
+ data: payload,
627
+ host,
628
+ }),
629
+ params: toURLSearchParams(payload),
630
+ };
631
+ return metadata;
632
+ }
633
+ return __deleteService;
634
+ }
635
+ /**
636
+ * Deletes multiple services.
637
+ *
638
+ *
639
+ * See *Delete Service*
640
+ * ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/services/delete-service) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/delete-service))
641
+ * for more details about deleting a service.
642
+ *
643
+ * The call succeeds even if one or more individual services can't be deleted.
644
+ * Information about failures is returned in `bulkActionMetadata`.
645
+ */
646
+ export function bulkDeleteServices(payload) {
647
+ function __bulkDeleteServices({ host }) {
648
+ const metadata = {
649
+ entityFqdn: 'wix.bookings.services.v2.service',
650
+ method: 'POST',
651
+ methodFqn: 'wix.bookings.services.v2.ServicesService.BulkDeleteServices',
652
+ packageName: PACKAGE_NAME,
653
+ url: resolveWixBookingsServicesV2ServicesServiceUrl({
654
+ protoPath: '/v2/bulk/services/delete',
655
+ data: payload,
656
+ host,
657
+ }),
658
+ data: payload,
659
+ transformResponse: (payload) => transformPaths(payload, [
660
+ {
661
+ transformFn: transformRESTTimestampToSDKTimestamp,
662
+ paths: [
663
+ { path: 'results.item.createdDate' },
664
+ { path: 'results.item.updatedDate' },
665
+ { path: 'results.item.media.items.image.urlExpirationDate' },
666
+ { path: 'results.item.media.mainMedia.image.urlExpirationDate' },
667
+ { path: 'results.item.media.coverMedia.image.urlExpirationDate' },
668
+ { path: 'results.item.bookingPolicy.createdDate' },
669
+ { path: 'results.item.bookingPolicy.updatedDate' },
670
+ { path: 'results.item.schedule.firstSessionStart' },
671
+ { path: 'results.item.schedule.lastSessionEnd' },
672
+ {
673
+ path: 'results.item.staffMembers.mainMedia.image.urlExpirationDate',
674
+ },
675
+ {
676
+ path: 'results.item.staffMemberDetails.staffMembers.mainMedia.image.urlExpirationDate',
677
+ },
678
+ { path: 'results.item.supportedSlugs.createdDate' },
679
+ { path: 'results.item.mainSlug.createdDate' },
680
+ ],
681
+ },
682
+ {
683
+ transformFn: transformRESTFloatToSDKFloat,
684
+ paths: [
685
+ {
686
+ path: 'results.item.locations.business.address.geocode.latitude',
687
+ },
688
+ {
689
+ path: 'results.item.locations.business.address.geocode.longitude',
690
+ },
691
+ {
692
+ path: 'results.item.locations.custom.address.geocode.latitude',
693
+ },
694
+ {
695
+ path: 'results.item.locations.custom.address.geocode.longitude',
696
+ },
697
+ {
698
+ path: 'results.item.locations.calculatedAddress.geocode.latitude',
699
+ },
700
+ {
701
+ path: 'results.item.locations.calculatedAddress.geocode.longitude',
702
+ },
703
+ ],
704
+ },
705
+ ]),
706
+ };
707
+ return metadata;
708
+ }
709
+ return __bulkDeleteServices;
710
+ }
711
+ /**
712
+ * Deletes multiple services by filter.
713
+ *
714
+ *
715
+ * See *Delete Service*
716
+ * ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/services/delete-service) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/delete-service))
717
+ * for more details about deleting a service.
718
+ *
719
+ * The call succeeds even if one or more individual services can't be deleted.
720
+ * Information about failures is returned in `bulkActionMetadata`.
721
+ *
722
+ * Refer to the supported filters article
723
+ * ([REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/filtering-and-sorting#filtering))
724
+ * for more details.
725
+ *
726
+ * To learn about working with filters in general, see
727
+ * [API Query Language](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#filters).
728
+ */
729
+ export function bulkDeleteServicesByFilter(payload) {
730
+ function __bulkDeleteServicesByFilter({ host }) {
731
+ const metadata = {
732
+ entityFqdn: 'wix.bookings.services.v2.service',
733
+ method: 'POST',
734
+ methodFqn: 'wix.bookings.services.v2.ServicesService.BulkDeleteServicesByFilter',
735
+ packageName: PACKAGE_NAME,
736
+ url: resolveWixBookingsServicesV2ServicesServiceUrl({
737
+ protoPath: '/v2/bulk/services/delete-by-filter',
738
+ data: payload,
739
+ host,
740
+ }),
741
+ data: payload,
742
+ };
743
+ return metadata;
744
+ }
745
+ return __bulkDeleteServicesByFilter;
746
+ }
747
+ /**
748
+ * Creates a query to retrieve a list of `service` objects.
749
+ *
750
+ * The `queryServices()` function builds a query to retrieve a list of `service` objects and returns a `ServicesQueryBuilder` object.
751
+ *
752
+ * The returned object contains the query definition, which is typically used to run the query using the [find()](https://dev.wix.com/docs/sdk/backend-modules/bookings/services/services-query-builder/find) function.
753
+ *
754
+ * You can refine the query by chaining `ServicesQueryBuilder` functions onto the query. `ServicesQueryBuilder` functions enable you to sort, filter, and control the results that `queryServices()` returns.
755
+ *
756
+ * `queryServices()` runs with the following `ServicesQueryBuilder` defaults that you can override:
757
+ *
758
+ * + `limit` is `100`.
759
+ * + Sorted by `createdDate` in ascending order.
760
+ *
761
+ * The functions that are chained to `queryServices()` are applied in the order they are called. For example, if you apply `ascending("category.name")` and then `ascending("name")`, the results are sorted first by `category.name`, and then, if there are multiple results with the same `category.name`, the items are sorted by `name`.
762
+ *
763
+ * The following `ServicesQueryBuilder` functions are supported for the `queryServices()` function. For a full description of the `service` object, see the object returned for the [items](https://dev.wix.com/docs/sdk/backend-modules/bookings/services/services-query-result/items) property in `ServicesQueryResult`.
764
+ */
765
+ export function queryServices(payload) {
766
+ function __queryServices({ host }) {
767
+ const metadata = {
768
+ entityFqdn: 'wix.bookings.services.v2.service',
769
+ method: 'POST',
770
+ methodFqn: 'wix.bookings.services.v2.ServicesService.QueryServices',
771
+ packageName: PACKAGE_NAME,
772
+ url: resolveWixBookingsServicesV2ServicesServiceUrl({
773
+ protoPath: '/v2/services/query',
774
+ data: payload,
775
+ host,
776
+ }),
777
+ data: payload,
778
+ transformResponse: (payload) => transformPaths(payload, [
779
+ {
780
+ transformFn: transformRESTTimestampToSDKTimestamp,
781
+ paths: [
782
+ { path: 'services.createdDate' },
783
+ { path: 'services.updatedDate' },
784
+ { path: 'services.media.items.image.urlExpirationDate' },
785
+ { path: 'services.media.mainMedia.image.urlExpirationDate' },
786
+ { path: 'services.media.coverMedia.image.urlExpirationDate' },
787
+ { path: 'services.bookingPolicy.createdDate' },
788
+ { path: 'services.bookingPolicy.updatedDate' },
789
+ { path: 'services.schedule.firstSessionStart' },
790
+ { path: 'services.schedule.lastSessionEnd' },
791
+ {
792
+ path: 'services.staffMembers.mainMedia.image.urlExpirationDate',
793
+ },
794
+ {
795
+ path: 'services.staffMemberDetails.staffMembers.mainMedia.image.urlExpirationDate',
796
+ },
797
+ { path: 'services.supportedSlugs.createdDate' },
798
+ { path: 'services.mainSlug.createdDate' },
799
+ ],
800
+ },
801
+ {
802
+ transformFn: transformRESTFloatToSDKFloat,
803
+ paths: [
804
+ { path: 'services.locations.business.address.geocode.latitude' },
805
+ { path: 'services.locations.business.address.geocode.longitude' },
806
+ { path: 'services.locations.custom.address.geocode.latitude' },
807
+ { path: 'services.locations.custom.address.geocode.longitude' },
808
+ { path: 'services.locations.calculatedAddress.geocode.latitude' },
809
+ {
810
+ path: 'services.locations.calculatedAddress.geocode.longitude',
811
+ },
812
+ ],
813
+ },
814
+ ]),
815
+ };
816
+ return metadata;
817
+ }
818
+ return __queryServices;
819
+ }
820
+ /**
821
+ * Retrieves a list of up to 100 services, given the provided filtering, paging,
822
+ * and sorting.
823
+ *
824
+ *
825
+ * ## Defaults
826
+ *
827
+ * Search Services has the following default settings, which you can override:
828
+ * + Sorted by `createdDate` in ascending order.
829
+ * + `paging.limit` set to `100`.
830
+ * + `paging.offset` set to `0`.
831
+ *
832
+ * ## Filters
833
+ *
834
+ * When using filters for dates, you must use
835
+ * [UTC time](https://en.wikipedia.org/wiki/Coordinated_Universal_Time).
836
+ *
837
+ * Refer to the supported filters article
838
+ * ([REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/filtering-and-sorting))
839
+ * for a complete list of supported filters and sorting options.
840
+ *
841
+ * ## See also
842
+ *
843
+ * To learn about working with *Search* methods, see
844
+ * _API Query Language_
845
+ * ([SDK](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/api-query-language) | [REST](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language))
846
+ * and *Sorting and Paging*
847
+ * ([SDK](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/api-query-language#the-sort-array) | [REST](https://dev.wix.com/docs/rest/articles/getting-started/sorting-and-paging)).
848
+ */
849
+ export function searchServices(payload) {
850
+ function __searchServices({ host }) {
851
+ const serializedData = transformPaths(payload, [
852
+ {
853
+ transformFn: transformSDKFloatToRESTFloat,
854
+ paths: [
855
+ { path: 'search.aggregations.range.buckets.from' },
856
+ { path: 'search.aggregations.range.buckets.to' },
857
+ {
858
+ path: 'search.aggregations.nested.nestedAggregations.range.buckets.from',
859
+ },
860
+ {
861
+ path: 'search.aggregations.nested.nestedAggregations.range.buckets.to',
862
+ },
863
+ ],
864
+ },
865
+ ]);
866
+ const metadata = {
867
+ entityFqdn: 'wix.bookings.services.v2.service',
868
+ method: 'POST',
869
+ methodFqn: 'wix.bookings.services.v2.ServicesService.SearchServices',
870
+ packageName: PACKAGE_NAME,
871
+ url: resolveWixBookingsServicesV2ServicesServiceUrl({
872
+ protoPath: '/v2/services/search',
873
+ data: serializedData,
874
+ host,
875
+ }),
876
+ data: serializedData,
877
+ transformResponse: (payload) => transformPaths(payload, [
878
+ {
879
+ transformFn: transformRESTTimestampToSDKTimestamp,
880
+ paths: [
881
+ { path: 'services.createdDate' },
882
+ { path: 'services.updatedDate' },
883
+ { path: 'services.media.items.image.urlExpirationDate' },
884
+ { path: 'services.media.mainMedia.image.urlExpirationDate' },
885
+ { path: 'services.media.coverMedia.image.urlExpirationDate' },
886
+ { path: 'services.bookingPolicy.createdDate' },
887
+ { path: 'services.bookingPolicy.updatedDate' },
888
+ { path: 'services.schedule.firstSessionStart' },
889
+ { path: 'services.schedule.lastSessionEnd' },
890
+ {
891
+ path: 'services.staffMembers.mainMedia.image.urlExpirationDate',
892
+ },
893
+ {
894
+ path: 'services.staffMemberDetails.staffMembers.mainMedia.image.urlExpirationDate',
895
+ },
896
+ { path: 'services.supportedSlugs.createdDate' },
897
+ { path: 'services.mainSlug.createdDate' },
898
+ ],
899
+ },
900
+ {
901
+ transformFn: transformRESTFloatToSDKFloat,
902
+ paths: [
903
+ { path: 'services.locations.business.address.geocode.latitude' },
904
+ { path: 'services.locations.business.address.geocode.longitude' },
905
+ { path: 'services.locations.custom.address.geocode.latitude' },
906
+ { path: 'services.locations.custom.address.geocode.longitude' },
907
+ { path: 'services.locations.calculatedAddress.geocode.latitude' },
908
+ {
909
+ path: 'services.locations.calculatedAddress.geocode.longitude',
910
+ },
911
+ { path: 'aggregationData.results.ranges.results.from' },
912
+ { path: 'aggregationData.results.ranges.results.to' },
913
+ {
914
+ path: 'aggregationData.results.groupedByValue.results.nestedResults.ranges.results.from',
915
+ },
916
+ {
917
+ path: 'aggregationData.results.groupedByValue.results.nestedResults.ranges.results.to',
918
+ },
919
+ {
920
+ path: 'aggregationData.results.nested.results.results.*.range.from',
921
+ },
922
+ {
923
+ path: 'aggregationData.results.nested.results.results.*.range.to',
924
+ },
925
+ { path: 'aggregationData.results.scalar.value' },
926
+ {
927
+ path: 'aggregationData.results.groupedByValue.results.nestedResults.scalar.value',
928
+ },
929
+ {
930
+ path: 'aggregationData.results.nested.results.results.*.scalar.value',
931
+ },
932
+ ],
933
+ },
934
+ ]),
935
+ };
936
+ return metadata;
937
+ }
938
+ return __searchServices;
939
+ }
940
+ /**
941
+ * Retrieves a list of up to 100 *booking policies*
942
+ * ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/booking-policies/introduction) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/policies/booking-policies/introduction)),
943
+ * and information about the services that are connected to them,
944
+ * given the provided filtering, paging, and sorting.
945
+ *
946
+ * ## Defaults
947
+ *
948
+ * Query Policies has the following default settings, which you can override:
949
+ *
950
+ * + Sorted by `id` in ascending order.
951
+ * + `cursorPaging.limit` set to `100`.
952
+ *
953
+ * ## Filters
954
+ *
955
+ * For a complete list of supported filters, refer to **Booking Policies API: Supported Filters**
956
+ * ([REST](https://dev.wix.com/docs/rest/business-solutions/bookings/policies/booking-policies/supported-filters)).
957
+ *
958
+ * When using date filters, you must use
959
+ * [UTC time](https://en.wikipedia.org/wiki/Coordinated_Universal_Time).
960
+ *
961
+ * ## Returned services
962
+ *
963
+ * If a booking policy is connected to more than 5 services, only a subset of
964
+ * those services is returned. The `bookingPolicies.totalServiceCount` values
965
+ * indicate the total number of services linked to each policy. You can call *Search Services*
966
+ * ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/services/search-services) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/search-services))
967
+ * and specify the relevant policy ID in the filter to retrieve all services
968
+ * connected to the booking policy.
969
+ *
970
+ * ## See also
971
+ *
972
+ * To learn about working with *Query* endpoints, see
973
+ * [API Query Language](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language)
974
+ * and [Sorting and Paging](https://dev.wix.com/docs/rest/articles/getting-started/sorting-and-paging).
975
+ */
976
+ export function queryPolicies(payload) {
977
+ function __queryPolicies({ host }) {
978
+ const metadata = {
979
+ entityFqdn: 'wix.bookings.services.v2.service',
980
+ method: 'POST',
981
+ methodFqn: 'wix.bookings.services.v2.ServicesService.QueryPolicies',
982
+ packageName: PACKAGE_NAME,
983
+ url: resolveWixBookingsServicesV2ServicesServiceUrl({
984
+ protoPath: '/v2/services/policies/query',
985
+ data: payload,
986
+ host,
987
+ }),
988
+ data: payload,
989
+ transformResponse: (payload) => transformPaths(payload, [
990
+ {
991
+ transformFn: transformRESTTimestampToSDKTimestamp,
992
+ paths: [
993
+ { path: 'bookingPolicies.bookingPolicy.createdDate' },
994
+ { path: 'bookingPolicies.bookingPolicy.updatedDate' },
995
+ { path: 'bookingPolicies.services.createdDate' },
996
+ { path: 'bookingPolicies.services.updatedDate' },
997
+ {
998
+ path: 'bookingPolicies.services.media.items.image.urlExpirationDate',
999
+ },
1000
+ {
1001
+ path: 'bookingPolicies.services.media.mainMedia.image.urlExpirationDate',
1002
+ },
1003
+ {
1004
+ path: 'bookingPolicies.services.media.coverMedia.image.urlExpirationDate',
1005
+ },
1006
+ { path: 'bookingPolicies.services.bookingPolicy.createdDate' },
1007
+ { path: 'bookingPolicies.services.bookingPolicy.updatedDate' },
1008
+ { path: 'bookingPolicies.services.schedule.firstSessionStart' },
1009
+ { path: 'bookingPolicies.services.schedule.lastSessionEnd' },
1010
+ {
1011
+ path: 'bookingPolicies.services.staffMembers.mainMedia.image.urlExpirationDate',
1012
+ },
1013
+ {
1014
+ path: 'bookingPolicies.services.staffMemberDetails.staffMembers.mainMedia.image.urlExpirationDate',
1015
+ },
1016
+ { path: 'bookingPolicies.services.supportedSlugs.createdDate' },
1017
+ { path: 'bookingPolicies.services.mainSlug.createdDate' },
1018
+ { path: 'bookingPolicies.connectedServices.createdDate' },
1019
+ { path: 'bookingPolicies.connectedServices.updatedDate' },
1020
+ {
1021
+ path: 'bookingPolicies.connectedServices.media.items.image.urlExpirationDate',
1022
+ },
1023
+ {
1024
+ path: 'bookingPolicies.connectedServices.media.mainMedia.image.urlExpirationDate',
1025
+ },
1026
+ {
1027
+ path: 'bookingPolicies.connectedServices.media.coverMedia.image.urlExpirationDate',
1028
+ },
1029
+ {
1030
+ path: 'bookingPolicies.connectedServices.bookingPolicy.createdDate',
1031
+ },
1032
+ {
1033
+ path: 'bookingPolicies.connectedServices.bookingPolicy.updatedDate',
1034
+ },
1035
+ {
1036
+ path: 'bookingPolicies.connectedServices.schedule.firstSessionStart',
1037
+ },
1038
+ {
1039
+ path: 'bookingPolicies.connectedServices.schedule.lastSessionEnd',
1040
+ },
1041
+ {
1042
+ path: 'bookingPolicies.connectedServices.staffMembers.mainMedia.image.urlExpirationDate',
1043
+ },
1044
+ {
1045
+ path: 'bookingPolicies.connectedServices.staffMemberDetails.staffMembers.mainMedia.image.urlExpirationDate',
1046
+ },
1047
+ {
1048
+ path: 'bookingPolicies.connectedServices.supportedSlugs.createdDate',
1049
+ },
1050
+ {
1051
+ path: 'bookingPolicies.connectedServices.mainSlug.createdDate',
1052
+ },
1053
+ ],
1054
+ },
1055
+ {
1056
+ transformFn: transformRESTFloatToSDKFloat,
1057
+ paths: [
1058
+ {
1059
+ path: 'bookingPolicies.services.locations.business.address.geocode.latitude',
1060
+ },
1061
+ {
1062
+ path: 'bookingPolicies.services.locations.business.address.geocode.longitude',
1063
+ },
1064
+ {
1065
+ path: 'bookingPolicies.services.locations.custom.address.geocode.latitude',
1066
+ },
1067
+ {
1068
+ path: 'bookingPolicies.services.locations.custom.address.geocode.longitude',
1069
+ },
1070
+ {
1071
+ path: 'bookingPolicies.services.locations.calculatedAddress.geocode.latitude',
1072
+ },
1073
+ {
1074
+ path: 'bookingPolicies.services.locations.calculatedAddress.geocode.longitude',
1075
+ },
1076
+ {
1077
+ path: 'bookingPolicies.connectedServices.locations.business.address.geocode.latitude',
1078
+ },
1079
+ {
1080
+ path: 'bookingPolicies.connectedServices.locations.business.address.geocode.longitude',
1081
+ },
1082
+ {
1083
+ path: 'bookingPolicies.connectedServices.locations.custom.address.geocode.latitude',
1084
+ },
1085
+ {
1086
+ path: 'bookingPolicies.connectedServices.locations.custom.address.geocode.longitude',
1087
+ },
1088
+ {
1089
+ path: 'bookingPolicies.connectedServices.locations.calculatedAddress.geocode.latitude',
1090
+ },
1091
+ {
1092
+ path: 'bookingPolicies.connectedServices.locations.calculatedAddress.geocode.longitude',
1093
+ },
1094
+ ],
1095
+ },
1096
+ ]),
1097
+ };
1098
+ return metadata;
1099
+ }
1100
+ return __queryPolicies;
1101
+ }
1102
+ /**
1103
+ * Retrieves a list of up to 100 *booking forms*
1104
+ * ([SDK](https://dev.wix.com/docs/sdk/backend-modules/forms/forms/introduction) | [REST](https://dev.wix.com/docs/rest/crm/forms/forms/introduction)),
1105
+ * and information about the services that are connected to them,
1106
+ * given the provided filtering, paging, and sorting.
1107
+ *
1108
+ *
1109
+ * ## Defaults
1110
+ *
1111
+ * Query Booking Forms has the following default settings, which you can override:
1112
+ *
1113
+ * + Sorted by `id` in ascending order.
1114
+ * + `cursorPaging.limit` set to `100`.
1115
+ *
1116
+ * ## Filters
1117
+ *
1118
+ * For a complete list of supported filters, refer to **Forms API: Supported Filters**
1119
+ * ([REST](https://dev.wix.com/docs/rest/crm/forms/forms/introduction/supported-filters)).
1120
+ *
1121
+ * When using date filters, you must use
1122
+ * [UTC time](https://en.wikipedia.org/wiki/Coordinated_Universal_Time).
1123
+ *
1124
+ * ## Returned services
1125
+ *
1126
+ * If a booking policy is connected to more than 5 services, only a subset of
1127
+ * these service IDs and names is returned. The `bookingForms.totalServiceCount`
1128
+ * values indicate the total number of services linked to each form. You can call *Query Services*
1129
+ * ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/services/query-services) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/query-services))
1130
+ * and specify the relevant form ID in the filter to retrieve all services
1131
+ * connected to the booking form.
1132
+ *
1133
+ * ## Default booking forms
1134
+ *
1135
+ * By default, all Wix Bookings services use a standard booking form. To retrieve
1136
+ * a site's default booking form with Query Booking Forms, specify
1137
+ * `{"conditionalFields": ["DEFAULT_BOOKING_FORM"]}`.
1138
+ *
1139
+ * ## See also
1140
+ *
1141
+ * To learn about working with *Query* endpoints, see
1142
+ * [API Query Language](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language)
1143
+ * and [Sorting and Paging](https://dev.wix.com/docs/rest/articles/getting-started/sorting-and-paging).
1144
+ */
1145
+ export function queryBookingForms(payload) {
1146
+ function __queryBookingForms({ host }) {
1147
+ const metadata = {
1148
+ entityFqdn: 'wix.bookings.services.v2.service',
1149
+ method: 'POST',
1150
+ methodFqn: 'wix.bookings.services.v2.ServicesService.QueryBookingForms',
1151
+ packageName: PACKAGE_NAME,
1152
+ url: resolveWixBookingsServicesV2ServicesServiceUrl({
1153
+ protoPath: '/v2/services/booking-forms/query',
1154
+ data: payload,
1155
+ host,
1156
+ }),
1157
+ data: payload,
1158
+ };
1159
+ return metadata;
1160
+ }
1161
+ return __queryBookingForms;
1162
+ }
1163
+ /**
1164
+ * Counts how many services match the given filter.
1165
+ *
1166
+ *
1167
+ * Refer to the supported filters article
1168
+ * ([REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/filtering-and-sorting#filtering))
1169
+ * for more details.
1170
+ *
1171
+ * To learn about working with filters in general, see
1172
+ * [API Query Language](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#filters)
1173
+ */
1174
+ export function countServices(payload) {
1175
+ function __countServices({ host }) {
1176
+ const metadata = {
1177
+ entityFqdn: 'wix.bookings.services.v2.service',
1178
+ method: 'POST',
1179
+ methodFqn: 'wix.bookings.services.v2.ServicesService.CountServices',
1180
+ packageName: PACKAGE_NAME,
1181
+ url: resolveWixBookingsServicesV2ServicesServiceUrl({
1182
+ protoPath: '/v2/services/count',
1183
+ data: payload,
1184
+ host,
1185
+ }),
1186
+ data: payload,
1187
+ };
1188
+ return metadata;
1189
+ }
1190
+ return __countServices;
1191
+ }
1192
+ /**
1193
+ * Retrieves 3 separate lists of business, custom, and customer *locations*
1194
+ * ([SDK](https://dev.wix.com/docs/sdk/backend-modules/business-tools/locations/introduction) | [REST](https://dev.wix.com/docs/rest/business-management/locations/introduction)),
1195
+ * given the provided filtering, and whether each location is connected to at
1196
+ * least one of the site's services.
1197
+ *
1198
+ *
1199
+ * ## Defaults
1200
+ *
1201
+ * Query Locations has the following default setting, which you can't override:
1202
+ * Sorted by `id` in ascending order.
1203
+ *
1204
+ * ## Filters
1205
+ *
1206
+ * For a complete list of supported filters, refer to the `location` object
1207
+ * ([REST](https://dev.wix.com/docs/rest/business-management/locations/location-object)).
1208
+ *
1209
+ * When using date filters, you must use
1210
+ * [UTC time](https://en.wikipedia.org/wiki/Coordinated_Universal_Time).
1211
+ *
1212
+ * ## See also
1213
+ *
1214
+ * To learn about working with *Query* endpoints, see
1215
+ * [API Query Language](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language)
1216
+ * and [Sorting and Paging](https://dev.wix.com/docs/rest/articles/getting-started/sorting-and-paging).
1217
+ */
1218
+ export function queryLocations(payload) {
1219
+ function __queryLocations({ host }) {
1220
+ const metadata = {
1221
+ entityFqdn: 'wix.bookings.services.v2.service',
1222
+ method: 'POST',
1223
+ methodFqn: 'wix.bookings.services.v2.ServicesService.QueryLocations',
1224
+ packageName: PACKAGE_NAME,
1225
+ url: resolveWixBookingsServicesV2ServicesServiceUrl({
1226
+ protoPath: '/v2/services/locations/query',
1227
+ data: payload,
1228
+ host,
1229
+ }),
1230
+ data: payload,
1231
+ transformResponse: (payload) => transformPaths(payload, [
1232
+ {
1233
+ transformFn: transformRESTFloatToSDKFloat,
1234
+ paths: [
1235
+ {
1236
+ path: 'businessLocations.locations.business.address.geocode.latitude',
1237
+ },
1238
+ {
1239
+ path: 'businessLocations.locations.business.address.geocode.longitude',
1240
+ },
1241
+ {
1242
+ path: 'businessLocations.locations.custom.address.geocode.latitude',
1243
+ },
1244
+ {
1245
+ path: 'businessLocations.locations.custom.address.geocode.longitude',
1246
+ },
1247
+ {
1248
+ path: 'businessLocations.locations.calculatedAddress.geocode.latitude',
1249
+ },
1250
+ {
1251
+ path: 'businessLocations.locations.calculatedAddress.geocode.longitude',
1252
+ },
1253
+ ],
1254
+ },
1255
+ ]),
1256
+ };
1257
+ return metadata;
1258
+ }
1259
+ return __queryLocations;
1260
+ }
1261
+ /**
1262
+ * Retrieves a list of service *categories*
1263
+ * ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/categories/setup) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/categories-v2/introduction)),
1264
+ * given the provided filtering.
1265
+ *
1266
+ *
1267
+ * ## Defaults
1268
+ *
1269
+ * Query Categories has the following default setting, which you can't override:
1270
+ * Sorted by `id` in ascending order.
1271
+ *
1272
+ * ## Filters
1273
+ *
1274
+ * For a complete list of supported filters, refer to the supported filters article
1275
+ * ([REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/filtering-and-sorting#filtering)).
1276
+ *
1277
+ * When using date filters, you must use
1278
+ * [UTC time](https://en.wikipedia.org/wiki/Coordinated_Universal_Time).
1279
+ *
1280
+ * ## See also
1281
+ *
1282
+ * To learn about working with *Query* endpoints, see
1283
+ * [API Query Language](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language)
1284
+ * and [Sorting and Paging](https://dev.wix.com/docs/rest/articles/getting-started/sorting-and-paging).
1285
+ */
1286
+ export function queryCategories(payload) {
1287
+ function __queryCategories({ host }) {
1288
+ const metadata = {
1289
+ entityFqdn: 'wix.bookings.services.v2.service',
1290
+ method: 'POST',
1291
+ methodFqn: 'wix.bookings.services.v2.ServicesService.QueryCategories',
1292
+ packageName: PACKAGE_NAME,
1293
+ url: resolveWixBookingsServicesV2ServicesServiceUrl({
1294
+ protoPath: '/v2/services/categories/query',
1295
+ data: payload,
1296
+ host,
1297
+ }),
1298
+ data: payload,
1299
+ };
1300
+ return metadata;
1301
+ }
1302
+ return __queryCategories;
1303
+ }
1304
+ /**
1305
+ * Replaces the list of the *locations*
1306
+ * ([SDK](https://dev.wix.com/docs/sdk/backend-modules/business-tools/locations/introduction) | [REST](https://dev.wix.com/docs/rest/business-management/locations/introduction))
1307
+ * where the business offers the service.
1308
+ *
1309
+ *
1310
+ * ## Consequences for customers
1311
+ *
1312
+ * Removing a service location may impact existing sessions and their
1313
+ * participants. If you remove at least one service location, you must
1314
+ * specify `removedLocationSessionsAction` to indicate what happens to all
1315
+ * future sessions scheduled at this location.
1316
+ *
1317
+ * - **Keep existing location**: If you want to retain future sessions at their
1318
+ * originally scheduled location, specify
1319
+ * `{"removedLocationSessionsAction.action": "KEEP_AT_CURRENT_LOCATION"}`.
1320
+ * This ensures nothing changes for the customer, but the business must be
1321
+ * able to provide access to the removed location in the future.
1322
+ * - **Update location**: If you want to update the location for future sessions
1323
+ * scheduled at the removed location, specify
1324
+ * `{"removedLocationSessionsAction.action": "MOVE_TO_LOCATION"}` and
1325
+ * `moveToLocationOptions.newLocation`.
1326
+ *
1327
+ * You can't mix and match to keep some sessions at the previous location while
1328
+ * moving other sessions to an updated location.
1329
+ *
1330
+ * Past session details aren't changed, no matter which option you choose for
1331
+ * future sessions.
1332
+ *
1333
+ * Future sessions scheduled for a location defined by the customer are also not
1334
+ * updated.
1335
+ *
1336
+ * ## Specify location details
1337
+ *
1338
+ * Depending on whether the new or updated location is a business or custom location,
1339
+ * you need to specify different fields.
1340
+ *
1341
+ * - **Business location**: Specify the relevant *location ID*
1342
+ * ([SDK](https://dev.wix.com/docs/sdk/backend-modules/business-tools/locations/introduction) | [REST](https://dev.wix.com/docs/rest/business-management/locations/introduction))
1343
+ * in `locations.business.id`.
1344
+ * - **Custom location**: Specify the complete address object as
1345
+ * `locations.custom.address`.
1346
+ *
1347
+ * ## Participant notifications
1348
+ *
1349
+ * You can specify a `participantNotification.message` that's immediately send
1350
+ * to all customers who had booked at a changed location. Ensure
1351
+ * `participantNotification.notifyParticipants` is set to `true` to send the
1352
+ * message.
1353
+ */
1354
+ export function setServiceLocations(payload) {
1355
+ function __setServiceLocations({ host }) {
1356
+ const serializedData = transformPaths(payload, [
1357
+ {
1358
+ transformFn: transformSDKFloatToRESTFloat,
1359
+ paths: [
1360
+ { path: 'locations.business.address.geocode.latitude' },
1361
+ { path: 'locations.business.address.geocode.longitude' },
1362
+ { path: 'locations.custom.address.geocode.latitude' },
1363
+ { path: 'locations.custom.address.geocode.longitude' },
1364
+ { path: 'locations.calculatedAddress.geocode.latitude' },
1365
+ { path: 'locations.calculatedAddress.geocode.longitude' },
1366
+ {
1367
+ path: 'removedLocationSessionsAction.moveToLocationOptions.newLocation.business.address.geocode.latitude',
1368
+ },
1369
+ {
1370
+ path: 'removedLocationSessionsAction.moveToLocationOptions.newLocation.business.address.geocode.longitude',
1371
+ },
1372
+ {
1373
+ path: 'removedLocationSessionsAction.moveToLocationOptions.newLocation.custom.address.geocode.latitude',
1374
+ },
1375
+ {
1376
+ path: 'removedLocationSessionsAction.moveToLocationOptions.newLocation.custom.address.geocode.longitude',
1377
+ },
1378
+ {
1379
+ path: 'removedLocationSessionsAction.moveToLocationOptions.newLocation.calculatedAddress.geocode.latitude',
1380
+ },
1381
+ {
1382
+ path: 'removedLocationSessionsAction.moveToLocationOptions.newLocation.calculatedAddress.geocode.longitude',
1383
+ },
1384
+ ],
1385
+ },
1386
+ ]);
1387
+ const metadata = {
1388
+ entityFqdn: 'wix.bookings.services.v2.service',
1389
+ method: 'POST',
1390
+ methodFqn: 'wix.bookings.services.v2.ServicesService.SetServiceLocations',
1391
+ packageName: PACKAGE_NAME,
1392
+ url: resolveWixBookingsServicesV2ServicesServiceUrl({
1393
+ protoPath: '/v2/services/{serviceId}/locations',
1394
+ data: serializedData,
1395
+ host,
1396
+ }),
1397
+ data: serializedData,
1398
+ transformResponse: (payload) => transformPaths(payload, [
1399
+ {
1400
+ transformFn: transformRESTTimestampToSDKTimestamp,
1401
+ paths: [
1402
+ { path: 'service.createdDate' },
1403
+ { path: 'service.updatedDate' },
1404
+ { path: 'service.media.items.image.urlExpirationDate' },
1405
+ { path: 'service.media.mainMedia.image.urlExpirationDate' },
1406
+ { path: 'service.media.coverMedia.image.urlExpirationDate' },
1407
+ { path: 'service.bookingPolicy.createdDate' },
1408
+ { path: 'service.bookingPolicy.updatedDate' },
1409
+ { path: 'service.schedule.firstSessionStart' },
1410
+ { path: 'service.schedule.lastSessionEnd' },
1411
+ {
1412
+ path: 'service.staffMembers.mainMedia.image.urlExpirationDate',
1413
+ },
1414
+ {
1415
+ path: 'service.staffMemberDetails.staffMembers.mainMedia.image.urlExpirationDate',
1416
+ },
1417
+ { path: 'service.supportedSlugs.createdDate' },
1418
+ { path: 'service.mainSlug.createdDate' },
1419
+ ],
1420
+ },
1421
+ {
1422
+ transformFn: transformRESTFloatToSDKFloat,
1423
+ paths: [
1424
+ { path: 'service.locations.business.address.geocode.latitude' },
1425
+ { path: 'service.locations.business.address.geocode.longitude' },
1426
+ { path: 'service.locations.custom.address.geocode.latitude' },
1427
+ { path: 'service.locations.custom.address.geocode.longitude' },
1428
+ { path: 'service.locations.calculatedAddress.geocode.latitude' },
1429
+ { path: 'service.locations.calculatedAddress.geocode.longitude' },
1430
+ ],
1431
+ },
1432
+ ]),
1433
+ };
1434
+ return metadata;
1435
+ }
1436
+ return __setServiceLocations;
1437
+ }
1438
+ /**
1439
+ * Adds a list of *pricing plan IDs*
1440
+ * ([SDK](https://dev.wix.com/docs/sdk/backend-modules/pricing-plans/plans/introduction) | [REST](https://dev.wix.com/api/rest/wix-pricing-plans/pricing-plans/plans/plan-object))
1441
+ * to a service's `payment.pricingPlanIds` array.
1442
+ *
1443
+ *
1444
+ * The call doesn't validate whether the service's `payment.options.pricingPlan`
1445
+ * is set to `true`. If it's set to `false`, customers aren't able to pay
1446
+ * for their bookings using pricing plans. You can call *Update Service*
1447
+ * ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/services/update-service) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/update-service))
1448
+ * to change a service's supported payment methods.
1449
+ */
1450
+ export function enablePricingPlansForService(payload) {
1451
+ function __enablePricingPlansForService({ host }) {
1452
+ const metadata = {
1453
+ entityFqdn: 'wix.bookings.services.v2.service',
1454
+ method: 'POST',
1455
+ methodFqn: 'wix.bookings.services.v2.ServicesService.EnablePricingPlansForService',
1456
+ packageName: PACKAGE_NAME,
1457
+ url: resolveWixBookingsServicesV2ServicesServiceUrl({
1458
+ protoPath: '/v2/services/{serviceId}/pricing-plans/add',
1459
+ data: payload,
1460
+ host,
1461
+ }),
1462
+ data: payload,
1463
+ transformResponse: (payload) => transformPaths(payload, [
1464
+ {
1465
+ transformFn: transformRESTTimestampToSDKTimestamp,
1466
+ paths: [
1467
+ { path: 'service.createdDate' },
1468
+ { path: 'service.updatedDate' },
1469
+ { path: 'service.media.items.image.urlExpirationDate' },
1470
+ { path: 'service.media.mainMedia.image.urlExpirationDate' },
1471
+ { path: 'service.media.coverMedia.image.urlExpirationDate' },
1472
+ { path: 'service.bookingPolicy.createdDate' },
1473
+ { path: 'service.bookingPolicy.updatedDate' },
1474
+ { path: 'service.schedule.firstSessionStart' },
1475
+ { path: 'service.schedule.lastSessionEnd' },
1476
+ {
1477
+ path: 'service.staffMembers.mainMedia.image.urlExpirationDate',
1478
+ },
1479
+ {
1480
+ path: 'service.staffMemberDetails.staffMembers.mainMedia.image.urlExpirationDate',
1481
+ },
1482
+ { path: 'service.supportedSlugs.createdDate' },
1483
+ { path: 'service.mainSlug.createdDate' },
1484
+ ],
1485
+ },
1486
+ {
1487
+ transformFn: transformRESTFloatToSDKFloat,
1488
+ paths: [
1489
+ { path: 'service.locations.business.address.geocode.latitude' },
1490
+ { path: 'service.locations.business.address.geocode.longitude' },
1491
+ { path: 'service.locations.custom.address.geocode.latitude' },
1492
+ { path: 'service.locations.custom.address.geocode.longitude' },
1493
+ { path: 'service.locations.calculatedAddress.geocode.latitude' },
1494
+ { path: 'service.locations.calculatedAddress.geocode.longitude' },
1495
+ ],
1496
+ },
1497
+ ]),
1498
+ };
1499
+ return metadata;
1500
+ }
1501
+ return __enablePricingPlansForService;
1502
+ }
1503
+ /**
1504
+ * Removes a list of *pricing plan IDs*
1505
+ * ([SDK](https://dev.wix.com/docs/sdk/backend-modules/pricing-plans/plans/introduction) | [REST](https://dev.wix.com/api/rest/wix-pricing-plans/pricing-plans/plans/plan-object))
1506
+ * from a service's `payment.pricingPlanIds` array.
1507
+ *
1508
+ *
1509
+ * If you remove all pricing plan IDs from `payment.pricingPlanIds` and the
1510
+ * service supports only payments by pricing plan, customers will no longer be
1511
+ * able to book the service, as they will have no payment options available.
1512
+ */
1513
+ export function disablePricingPlansForService(payload) {
1514
+ function __disablePricingPlansForService({ host }) {
1515
+ const metadata = {
1516
+ entityFqdn: 'wix.bookings.services.v2.service',
1517
+ method: 'POST',
1518
+ methodFqn: 'wix.bookings.services.v2.ServicesService.DisablePricingPlansForService',
1519
+ packageName: PACKAGE_NAME,
1520
+ url: resolveWixBookingsServicesV2ServicesServiceUrl({
1521
+ protoPath: '/v2/services/{serviceId}/pricing-plans/remove',
1522
+ data: payload,
1523
+ host,
1524
+ }),
1525
+ data: payload,
1526
+ transformResponse: (payload) => transformPaths(payload, [
1527
+ {
1528
+ transformFn: transformRESTTimestampToSDKTimestamp,
1529
+ paths: [
1530
+ { path: 'service.createdDate' },
1531
+ { path: 'service.updatedDate' },
1532
+ { path: 'service.media.items.image.urlExpirationDate' },
1533
+ { path: 'service.media.mainMedia.image.urlExpirationDate' },
1534
+ { path: 'service.media.coverMedia.image.urlExpirationDate' },
1535
+ { path: 'service.bookingPolicy.createdDate' },
1536
+ { path: 'service.bookingPolicy.updatedDate' },
1537
+ { path: 'service.schedule.firstSessionStart' },
1538
+ { path: 'service.schedule.lastSessionEnd' },
1539
+ {
1540
+ path: 'service.staffMembers.mainMedia.image.urlExpirationDate',
1541
+ },
1542
+ {
1543
+ path: 'service.staffMemberDetails.staffMembers.mainMedia.image.urlExpirationDate',
1544
+ },
1545
+ { path: 'service.supportedSlugs.createdDate' },
1546
+ { path: 'service.mainSlug.createdDate' },
1547
+ ],
1548
+ },
1549
+ {
1550
+ transformFn: transformRESTFloatToSDKFloat,
1551
+ paths: [
1552
+ { path: 'service.locations.business.address.geocode.latitude' },
1553
+ { path: 'service.locations.business.address.geocode.longitude' },
1554
+ { path: 'service.locations.custom.address.geocode.latitude' },
1555
+ { path: 'service.locations.custom.address.geocode.longitude' },
1556
+ { path: 'service.locations.calculatedAddress.geocode.latitude' },
1557
+ { path: 'service.locations.calculatedAddress.geocode.longitude' },
1558
+ ],
1559
+ },
1560
+ ]),
1561
+ };
1562
+ return metadata;
1563
+ }
1564
+ return __disablePricingPlansForService;
1565
+ }
1566
+ /**
1567
+ * Sets a new active slug for the service.
1568
+ *
1569
+ *
1570
+ * The call fails if at least one of these conditions is met:
1571
+ * - The slug doesn't adheres to the supported format.
1572
+ * - Another service is currently using the slug.
1573
+ * - Another service has used the slug in the past.
1574
+ */
1575
+ export function setCustomSlug(payload) {
1576
+ function __setCustomSlug({ host }) {
1577
+ const metadata = {
1578
+ entityFqdn: 'wix.bookings.services.v2.service',
1579
+ method: 'POST',
1580
+ methodFqn: 'wix.bookings.services.v2.ServicesService.SetCustomSlug',
1581
+ packageName: PACKAGE_NAME,
1582
+ url: resolveWixBookingsServicesV2ServicesServiceUrl({
1583
+ protoPath: '/v2/services/{serviceId}/slugs/custom',
1584
+ data: payload,
1585
+ host,
1586
+ }),
1587
+ data: payload,
1588
+ transformResponse: (payload) => transformPaths(payload, [
1589
+ {
1590
+ transformFn: transformRESTTimestampToSDKTimestamp,
1591
+ paths: [
1592
+ { path: 'slug.createdDate' },
1593
+ { path: 'service.createdDate' },
1594
+ { path: 'service.updatedDate' },
1595
+ { path: 'service.media.items.image.urlExpirationDate' },
1596
+ { path: 'service.media.mainMedia.image.urlExpirationDate' },
1597
+ { path: 'service.media.coverMedia.image.urlExpirationDate' },
1598
+ { path: 'service.bookingPolicy.createdDate' },
1599
+ { path: 'service.bookingPolicy.updatedDate' },
1600
+ { path: 'service.schedule.firstSessionStart' },
1601
+ { path: 'service.schedule.lastSessionEnd' },
1602
+ {
1603
+ path: 'service.staffMembers.mainMedia.image.urlExpirationDate',
1604
+ },
1605
+ {
1606
+ path: 'service.staffMemberDetails.staffMembers.mainMedia.image.urlExpirationDate',
1607
+ },
1608
+ { path: 'service.supportedSlugs.createdDate' },
1609
+ { path: 'service.mainSlug.createdDate' },
1610
+ ],
1611
+ },
1612
+ {
1613
+ transformFn: transformRESTFloatToSDKFloat,
1614
+ paths: [
1615
+ { path: 'service.locations.business.address.geocode.latitude' },
1616
+ { path: 'service.locations.business.address.geocode.longitude' },
1617
+ { path: 'service.locations.custom.address.geocode.latitude' },
1618
+ { path: 'service.locations.custom.address.geocode.longitude' },
1619
+ { path: 'service.locations.calculatedAddress.geocode.latitude' },
1620
+ { path: 'service.locations.calculatedAddress.geocode.longitude' },
1621
+ ],
1622
+ },
1623
+ ]),
1624
+ };
1625
+ return metadata;
1626
+ }
1627
+ return __setCustomSlug;
1628
+ }
1629
+ /**
1630
+ * Checks whether a custom slug is validate for the service.
1631
+ *
1632
+ *
1633
+ * The checks include:
1634
+ * - The slug adheres to the supported format.
1635
+ * - No other service is currently using the slug.
1636
+ * - No other service has used the slug in the past.
1637
+ *
1638
+ * The call fails if at least one of the checks fails.
1639
+ */
1640
+ export function validateSlug(payload) {
1641
+ function __validateSlug({ host }) {
1642
+ const metadata = {
1643
+ entityFqdn: 'wix.bookings.services.v2.service',
1644
+ method: 'POST',
1645
+ methodFqn: 'wix.bookings.services.v2.ServicesService.ValidateSlug',
1646
+ packageName: PACKAGE_NAME,
1647
+ url: resolveWixBookingsServicesV2ServicesServiceUrl({
1648
+ protoPath: '/v2/services/slugs/validate',
1649
+ data: payload,
1650
+ host,
1651
+ }),
1652
+ data: payload,
1653
+ };
1654
+ return metadata;
1655
+ }
1656
+ return __validateSlug;
1657
+ }
1658
+ /**
1659
+ * Clones a service.
1660
+ *
1661
+ *
1662
+ * ## Connected entities
1663
+ *
1664
+ * By default, not all entities connected to the service are cloned.
1665
+ *
1666
+ * ### Schedule
1667
+ *
1668
+ * Wix Bookings automatically creates a new active *schedule*
1669
+ * ([SDK](https://dev.wix.com/docs/sdk/backend-modules/calendar/schedules/introduction) | [REST](https://dev.wix.com/docs/rest/business-management/calendar/schedules-v3/introduction))
1670
+ * for the cloned service. If Wix Bookings can't create this schedule, the
1671
+ * Clone Service* call fails.
1672
+ *
1673
+ * - __For appointment-based services__: Future appointments aren't added to the
1674
+ * cloned service's schedule. Use the *Events API*
1675
+ * ([SDK](https://dev.wix.com/docs/sdk/backend-modules/calendar/events/introduction) | [REST](https://dev.wix.com/docs/rest/business-management/calendar/events-v3/introduction))
1676
+ * to add them as needed.
1677
+ * - __For classes and courses__: Future one-time events aren't added to the
1678
+ * cloned service's schedule, while future recurring events are added
1679
+ * asynchronously. The *Clone Service* call always succeeds, whether or not
1680
+ * recurring events are added.
1681
+ * If the response includes `RECURRING_EVENTS` in the `errors` array, it means the
1682
+ * cloned service doesn't have future recurring events, even though the original
1683
+ * service does. You can either delete the cloned service and try again or use
1684
+ * the *Events API*
1685
+ * ([SDK](https://dev.wix.com/docs/sdk/backend-modules/calendar/events/introduction) | [REST](https://dev.wix.com/docs/rest/business-management/calendar/events-v3/introduction))
1686
+ * to add missing events to the schedule.
1687
+ *
1688
+ * Wix Bookings never adds past events to the cloned service's schedule.
1689
+ *
1690
+ * ### Service options and variants
1691
+ *
1692
+ * If the original service has *variants*
1693
+ * ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/service-options-and-variants/introduction) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/service-options-and-variants/introduction)),
1694
+ * they're cloned asynchronously. The *Clone Service* call always succeeds,
1695
+ * regardless of whether variants were cloned.
1696
+ *
1697
+ * If the response includes `OPTIONS_AND_VARIANTS` in the `errors` array, the cloned
1698
+ * service doesn't have variants, even though the original service does. You can
1699
+ * delete the cloned service and call *Clone Service* again, or use the
1700
+ * _Service Options And Variants API_
1701
+ * ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/service-options-and-variants/introduction) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/service-options-and-variants/introduction))
1702
+ * to add variants.
1703
+ *
1704
+ * ### Booking form
1705
+ *
1706
+ * The original service's booking form isn't cloned, whether it's
1707
+ * the default or a custom booking form.
1708
+ *
1709
+ * ### Pricing plans
1710
+ *
1711
+ * If the original service's accepts payments via *pricing plans*
1712
+ * ([SDK](https://dev.wix.com/docs/sdk/backend-modules/pricing-plans/plans/introduction) | [REST](https://dev.wix.com/docs/rest/business-solutions/pricing-plans/pricing-plans/plans/introduction)),
1713
+ * the cloned service's `payment.options.pricingPlan` is also set to `true`. To
1714
+ * accept specific pricing plans, call *Enable Pricing Plans For Service*
1715
+ * ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/services/enable-pricing-plans-for-service) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/enable-pricing-plans-for-service)),
1716
+ * after cloning the service. If the original service accepts only
1717
+ * pricing plan payments and you don't call *Enable Pricing Plans For Service*
1718
+ * after cloning the service, customers will be unable to book the service.
1719
+ */
1720
+ export function cloneService(payload) {
1721
+ function __cloneService({ host }) {
1722
+ const metadata = {
1723
+ entityFqdn: 'wix.bookings.services.v2.service',
1724
+ method: 'POST',
1725
+ methodFqn: 'wix.bookings.services.v2.ServicesService.CloneService',
1726
+ packageName: PACKAGE_NAME,
1727
+ url: resolveWixBookingsServicesV2ServicesServiceUrl({
1728
+ protoPath: '/v2/services/clone',
1729
+ data: payload,
1730
+ host,
1731
+ }),
1732
+ data: payload,
1733
+ transformResponse: (payload) => transformPaths(payload, [
1734
+ {
1735
+ transformFn: transformRESTTimestampToSDKTimestamp,
1736
+ paths: [
1737
+ { path: 'service.createdDate' },
1738
+ { path: 'service.updatedDate' },
1739
+ { path: 'service.media.items.image.urlExpirationDate' },
1740
+ { path: 'service.media.mainMedia.image.urlExpirationDate' },
1741
+ { path: 'service.media.coverMedia.image.urlExpirationDate' },
1742
+ { path: 'service.bookingPolicy.createdDate' },
1743
+ { path: 'service.bookingPolicy.updatedDate' },
1744
+ { path: 'service.schedule.firstSessionStart' },
1745
+ { path: 'service.schedule.lastSessionEnd' },
1746
+ {
1747
+ path: 'service.staffMembers.mainMedia.image.urlExpirationDate',
1748
+ },
1749
+ {
1750
+ path: 'service.staffMemberDetails.staffMembers.mainMedia.image.urlExpirationDate',
1751
+ },
1752
+ { path: 'service.supportedSlugs.createdDate' },
1753
+ { path: 'service.mainSlug.createdDate' },
1754
+ ],
1755
+ },
1756
+ {
1757
+ transformFn: transformRESTFloatToSDKFloat,
1758
+ paths: [
1759
+ { path: 'service.locations.business.address.geocode.latitude' },
1760
+ { path: 'service.locations.business.address.geocode.longitude' },
1761
+ { path: 'service.locations.custom.address.geocode.latitude' },
1762
+ { path: 'service.locations.custom.address.geocode.longitude' },
1763
+ { path: 'service.locations.calculatedAddress.geocode.latitude' },
1764
+ { path: 'service.locations.calculatedAddress.geocode.longitude' },
1765
+ ],
1766
+ },
1767
+ ]),
1768
+ };
1769
+ return metadata;
1770
+ }
1771
+ return __cloneService;
1772
+ }
1773
+ //# sourceMappingURL=bookings-services-v2-service-services.http.js.map