@wix/auto_sdk_table-reservations_reservations 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) 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/table-reservations-v1-reservation-reservations.context.d.ts +30 -0
  11. package/build/cjs/src/table-reservations-v1-reservation-reservations.context.js +49 -0
  12. package/build/cjs/src/table-reservations-v1-reservation-reservations.context.js.map +1 -0
  13. package/build/cjs/src/table-reservations-v1-reservation-reservations.http.d.ts +96 -0
  14. package/build/cjs/src/table-reservations-v1-reservation-reservations.http.js +561 -0
  15. package/build/cjs/src/table-reservations-v1-reservation-reservations.http.js.map +1 -0
  16. package/build/cjs/src/table-reservations-v1-reservation-reservations.meta.d.ts +32 -0
  17. package/build/cjs/src/table-reservations-v1-reservation-reservations.meta.js +218 -0
  18. package/build/cjs/src/table-reservations-v1-reservation-reservations.meta.js.map +1 -0
  19. package/build/cjs/src/table-reservations-v1-reservation-reservations.public.d.ts +161 -0
  20. package/build/cjs/src/table-reservations-v1-reservation-reservations.public.js +123 -0
  21. package/build/cjs/src/table-reservations-v1-reservation-reservations.public.js.map +1 -0
  22. package/build/cjs/src/table-reservations-v1-reservation-reservations.types.d.ts +1149 -0
  23. package/build/cjs/src/table-reservations-v1-reservation-reservations.types.js +180 -0
  24. package/build/cjs/src/table-reservations-v1-reservation-reservations.types.js.map +1 -0
  25. package/build/cjs/src/table-reservations-v1-reservation-reservations.universal.d.ts +1740 -0
  26. package/build/cjs/src/table-reservations-v1-reservation-reservations.universal.js +775 -0
  27. package/build/cjs/src/table-reservations-v1-reservation-reservations.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/table-reservations-v1-reservation-reservations.context.d.ts +30 -0
  39. package/build/es/src/table-reservations-v1-reservation-reservations.context.js +30 -0
  40. package/build/es/src/table-reservations-v1-reservation-reservations.context.js.map +1 -0
  41. package/build/es/src/table-reservations-v1-reservation-reservations.http.d.ts +96 -0
  42. package/build/es/src/table-reservations-v1-reservation-reservations.http.js +548 -0
  43. package/build/es/src/table-reservations-v1-reservation-reservations.http.js.map +1 -0
  44. package/build/es/src/table-reservations-v1-reservation-reservations.meta.d.ts +32 -0
  45. package/build/es/src/table-reservations-v1-reservation-reservations.meta.js +182 -0
  46. package/build/es/src/table-reservations-v1-reservation-reservations.meta.js.map +1 -0
  47. package/build/es/src/table-reservations-v1-reservation-reservations.public.d.ts +161 -0
  48. package/build/es/src/table-reservations-v1-reservation-reservations.public.js +94 -0
  49. package/build/es/src/table-reservations-v1-reservation-reservations.public.js.map +1 -0
  50. package/build/es/src/table-reservations-v1-reservation-reservations.types.d.ts +1149 -0
  51. package/build/es/src/table-reservations-v1-reservation-reservations.types.js +177 -0
  52. package/build/es/src/table-reservations-v1-reservation-reservations.types.js.map +1 -0
  53. package/build/es/src/table-reservations-v1-reservation-reservations.universal.d.ts +1740 -0
  54. package/build/es/src/table-reservations-v1-reservation-reservations.universal.js +739 -0
  55. package/build/es/src/table-reservations-v1-reservation-reservations.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/table-reservations-v1-reservation-reservations.context.d.ts +30 -0
  66. package/build/internal/cjs/src/table-reservations-v1-reservation-reservations.context.js +49 -0
  67. package/build/internal/cjs/src/table-reservations-v1-reservation-reservations.context.js.map +1 -0
  68. package/build/internal/cjs/src/table-reservations-v1-reservation-reservations.http.d.ts +96 -0
  69. package/build/internal/cjs/src/table-reservations-v1-reservation-reservations.http.js +561 -0
  70. package/build/internal/cjs/src/table-reservations-v1-reservation-reservations.http.js.map +1 -0
  71. package/build/internal/cjs/src/table-reservations-v1-reservation-reservations.meta.d.ts +32 -0
  72. package/build/internal/cjs/src/table-reservations-v1-reservation-reservations.meta.js +218 -0
  73. package/build/internal/cjs/src/table-reservations-v1-reservation-reservations.meta.js.map +1 -0
  74. package/build/internal/cjs/src/table-reservations-v1-reservation-reservations.public.d.ts +161 -0
  75. package/build/internal/cjs/src/table-reservations-v1-reservation-reservations.public.js +123 -0
  76. package/build/internal/cjs/src/table-reservations-v1-reservation-reservations.public.js.map +1 -0
  77. package/build/internal/cjs/src/table-reservations-v1-reservation-reservations.types.d.ts +1149 -0
  78. package/build/internal/cjs/src/table-reservations-v1-reservation-reservations.types.js +180 -0
  79. package/build/internal/cjs/src/table-reservations-v1-reservation-reservations.types.js.map +1 -0
  80. package/build/internal/cjs/src/table-reservations-v1-reservation-reservations.universal.d.ts +1740 -0
  81. package/build/internal/cjs/src/table-reservations-v1-reservation-reservations.universal.js +775 -0
  82. package/build/internal/cjs/src/table-reservations-v1-reservation-reservations.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/table-reservations-v1-reservation-reservations.context.d.ts +30 -0
  93. package/build/internal/es/src/table-reservations-v1-reservation-reservations.context.js +30 -0
  94. package/build/internal/es/src/table-reservations-v1-reservation-reservations.context.js.map +1 -0
  95. package/build/internal/es/src/table-reservations-v1-reservation-reservations.http.d.ts +96 -0
  96. package/build/internal/es/src/table-reservations-v1-reservation-reservations.http.js +548 -0
  97. package/build/internal/es/src/table-reservations-v1-reservation-reservations.http.js.map +1 -0
  98. package/build/internal/es/src/table-reservations-v1-reservation-reservations.meta.d.ts +32 -0
  99. package/build/internal/es/src/table-reservations-v1-reservation-reservations.meta.js +182 -0
  100. package/build/internal/es/src/table-reservations-v1-reservation-reservations.meta.js.map +1 -0
  101. package/build/internal/es/src/table-reservations-v1-reservation-reservations.public.d.ts +161 -0
  102. package/build/internal/es/src/table-reservations-v1-reservation-reservations.public.js +94 -0
  103. package/build/internal/es/src/table-reservations-v1-reservation-reservations.public.js.map +1 -0
  104. package/build/internal/es/src/table-reservations-v1-reservation-reservations.types.d.ts +1149 -0
  105. package/build/internal/es/src/table-reservations-v1-reservation-reservations.types.js +177 -0
  106. package/build/internal/es/src/table-reservations-v1-reservation-reservations.types.js.map +1 -0
  107. package/build/internal/es/src/table-reservations-v1-reservation-reservations.universal.d.ts +1740 -0
  108. package/build/internal/es/src/table-reservations-v1-reservation-reservations.universal.js +739 -0
  109. package/build/internal/es/src/table-reservations-v1-reservation-reservations.universal.js.map +1 -0
  110. package/meta/package.json +3 -0
  111. package/package.json +52 -0
@@ -0,0 +1,739 @@
1
+ import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';
2
+ import { queryBuilder } from '@wix/sdk-runtime/query-builder';
3
+ import { renameKeysFromSDKRequestToRESTRequest, renameKeysFromRESTResponseToSDKResponse, } from '@wix/sdk-runtime/rename-all-nested-keys';
4
+ import * as ambassadorWixTableReservationsV1Reservation from './table-reservations-v1-reservation-reservations.http.js';
5
+ export var Status;
6
+ (function (Status) {
7
+ /** Undefined reservation status. */
8
+ Status["UNKNOWN"] = "UNKNOWN";
9
+ /** A customer has begun the reservation flow, a temporary reservation is created and will expire in 10 minutes unless the customer moves forward with the reservation flow. This phase temporarily reserves the required number of seats and tables for a given party size at a chosen time while a customer enters details and/or confirms their reservation request. */
10
+ Status["HELD"] = "HELD";
11
+ /** The reservation is confirmed. */
12
+ Status["RESERVED"] = "RESERVED";
13
+ /** The reservation is canceled. */
14
+ Status["CANCELED"] = "CANCELED";
15
+ /** The reservation completed successfully. */
16
+ Status["FINISHED"] = "FINISHED";
17
+ /** The customer didn't show up for their reservation. */
18
+ Status["NO_SHOW"] = "NO_SHOW";
19
+ /** The customer is currently occupying the table. */
20
+ Status["SEATED"] = "SEATED";
21
+ /** A customer finished requesting this reservation, meaning they have added all necessary details and confirmed the request. Restaurant staff can now either approve or decline the reservation request. */
22
+ Status["REQUESTED"] = "REQUESTED";
23
+ /** The restaurant’s owner or staff declined the customer’s request to make the reservation. */
24
+ Status["DECLINED"] = "DECLINED";
25
+ /** A customer has begun the checkout flow, the temporary reservation is moved to this status and will expire in 10 minutes from the created time, during which time the reservee should pay. This status is set automatically when the reserve reservation endpoint is called for a reservation in `HELD` status and payment is needed. After payment is completed status will be changed automatically to `RESERVED`. */
26
+ Status["PAYMENT_PENDING"] = "PAYMENT_PENDING";
27
+ })(Status || (Status = {}));
28
+ export var Source;
29
+ (function (Source) {
30
+ /** Undefined reservation source. */
31
+ Source["UNKNOWN"] = "UNKNOWN";
32
+ /** The reservation was made by a restaurant employee, for example when a customer calls to make a reservation. */
33
+ Source["OFFLINE"] = "OFFLINE";
34
+ /** The reservation was made through a website or app. */
35
+ Source["ONLINE"] = "ONLINE";
36
+ /** The reservation was made by a restaurant employee when the customer arrived at the restaurant without a prior reservation. */
37
+ Source["WALK_IN"] = "WALK_IN";
38
+ })(Source || (Source = {}));
39
+ export var PaymentStatus;
40
+ (function (PaymentStatus) {
41
+ /** Undefined payment status. */
42
+ PaymentStatus["UNKNOWN"] = "UNKNOWN";
43
+ /** A reservation is free of charge. */
44
+ PaymentStatus["FREE"] = "FREE";
45
+ /** Payment is not received yet. */
46
+ PaymentStatus["NOT_PAID"] = "NOT_PAID";
47
+ /** The corresponding reservation order was fully paid. */
48
+ PaymentStatus["PAID"] = "PAID";
49
+ /** The corresponding reservation order was refunded, but the refund amount is less than the order total price. */
50
+ PaymentStatus["PARTIALLY_REFUNDED"] = "PARTIALLY_REFUNDED";
51
+ /** The corresponding reservation order was fully refunded. The refund amount equals the total price. */
52
+ PaymentStatus["FULLY_REFUNDED"] = "FULLY_REFUNDED";
53
+ /** The corresponding reservation order was partially paid. */
54
+ PaymentStatus["PARTIALLY_PAID"] = "PARTIALLY_PAID";
55
+ })(PaymentStatus || (PaymentStatus = {}));
56
+ export var TableCombinationConflictType;
57
+ (function (TableCombinationConflictType) {
58
+ /** Undefined conflict type. */
59
+ TableCombinationConflictType["UNKNOWN"] = "UNKNOWN";
60
+ /** One or more of the chosen tables are already reserved. */
61
+ TableCombinationConflictType["RESERVED"] = "RESERVED";
62
+ /** The party is too big for the selected table. */
63
+ TableCombinationConflictType["TOO_BIG"] = "TOO_BIG";
64
+ /** The party is too small for the selected table. */
65
+ TableCombinationConflictType["TOO_SMALL"] = "TOO_SMALL";
66
+ /** The restaurant does not allow online reservations. */
67
+ TableCombinationConflictType["OFFLINE_ONLY"] = "OFFLINE_ONLY";
68
+ })(TableCombinationConflictType || (TableCombinationConflictType = {}));
69
+ export var Type;
70
+ (function (Type) {
71
+ /** Undefined reservation location conflict type. */
72
+ Type["UNKNOWN"] = "UNKNOWN";
73
+ /** The restaurant cannot accommodate a party of the given size according to party pacing settings. */
74
+ Type["PARTY_PACING"] = "PARTY_PACING";
75
+ /** The required number of seats are unavailable according to seat pacing settings. */
76
+ Type["SEAT_PACING"] = "SEAT_PACING";
77
+ })(Type || (Type = {}));
78
+ export var Set;
79
+ (function (Set) {
80
+ /**
81
+ * Returns `id`, `status`, `details.reservationLocationId`, `details.startDate`, `details.endDate`, `details.partySize`, `createdDate`, `revision`, `declineReason`,
82
+ * `configuration.reservationForm.customFieldDefinitions`, `configuration.reservationForm.lastNameRequired`, `configuration.reservationForm.emailRequired`, `configuration.reservationForm.emailMarketingCheckbox`.
83
+ */
84
+ Set["PUBLIC"] = "PUBLIC";
85
+ /** Returns all fields. */
86
+ Set["FULL"] = "FULL";
87
+ })(Set || (Set = {}));
88
+ export var SortOrder;
89
+ (function (SortOrder) {
90
+ /** Sort by ascending order. */
91
+ SortOrder["ASC"] = "ASC";
92
+ /** Sort by descending order. */
93
+ SortOrder["DESC"] = "DESC";
94
+ })(SortOrder || (SortOrder = {}));
95
+ export var SortType;
96
+ (function (SortType) {
97
+ /** Sort by number of matches. */
98
+ SortType["COUNT"] = "COUNT";
99
+ /** Sort by value of the field alphabetically. */
100
+ SortType["VALUE"] = "VALUE";
101
+ })(SortType || (SortType = {}));
102
+ export var SortDirection;
103
+ (function (SortDirection) {
104
+ /** Sort in descending order. */
105
+ SortDirection["DESC"] = "DESC";
106
+ /** Sort in ascending order. */
107
+ SortDirection["ASC"] = "ASC";
108
+ })(SortDirection || (SortDirection = {}));
109
+ export var MissingValues;
110
+ (function (MissingValues) {
111
+ /** Exclude missing values from the aggregation results */
112
+ MissingValues["EXCLUDE"] = "EXCLUDE";
113
+ /** Include missing values in the aggregation results */
114
+ MissingValues["INCLUDE"] = "INCLUDE";
115
+ })(MissingValues || (MissingValues = {}));
116
+ export var ScalarType;
117
+ (function (ScalarType) {
118
+ /** Undefined scalar type. */
119
+ ScalarType["UNKNOWN_SCALAR_TYPE"] = "UNKNOWN_SCALAR_TYPE";
120
+ /** Count of distinct values. */
121
+ ScalarType["COUNT_DISTINCT"] = "COUNT_DISTINCT";
122
+ /** Minimum value. */
123
+ ScalarType["MIN"] = "MIN";
124
+ /** Maximum value. */
125
+ ScalarType["MAX"] = "MAX";
126
+ })(ScalarType || (ScalarType = {}));
127
+ export var NestedAggregationType;
128
+ (function (NestedAggregationType) {
129
+ /** Undefined aggregation type. */
130
+ NestedAggregationType["UNKNOWN_AGGREGATION_TYPE"] = "UNKNOWN_AGGREGATION_TYPE";
131
+ /** An aggregation where result buckets are dynamically built - one per unique value. */
132
+ NestedAggregationType["VALUE"] = "VALUE";
133
+ /** An aggregation where you can define a set of ranges - each representing a bucket. */
134
+ NestedAggregationType["RANGE"] = "RANGE";
135
+ /** A single-value metric aggregation - such as min, max, sum, and avg. */
136
+ NestedAggregationType["SCALAR"] = "SCALAR";
137
+ /** An aggregation where result buckets are dynamically built - one per time interval such as hour, day, or week. */
138
+ NestedAggregationType["DATE_HISTOGRAM"] = "DATE_HISTOGRAM";
139
+ })(NestedAggregationType || (NestedAggregationType = {}));
140
+ export var Interval;
141
+ (function (Interval) {
142
+ Interval["UNKNOWN_INTERVAL"] = "UNKNOWN_INTERVAL";
143
+ Interval["YEAR"] = "YEAR";
144
+ Interval["MONTH"] = "MONTH";
145
+ Interval["WEEK"] = "WEEK";
146
+ Interval["DAY"] = "DAY";
147
+ Interval["HOUR"] = "HOUR";
148
+ Interval["MINUTE"] = "MINUTE";
149
+ Interval["SECOND"] = "SECOND";
150
+ })(Interval || (Interval = {}));
151
+ export var AggregationType;
152
+ (function (AggregationType) {
153
+ /** Undefined aggregation type. */
154
+ AggregationType["UNKNOWN_AGGREGATION_TYPE"] = "UNKNOWN_AGGREGATION_TYPE";
155
+ /** An aggregation where result buckets are dynamically built - one per unique value. */
156
+ AggregationType["VALUE"] = "VALUE";
157
+ /** An aggregation where you can define a set of ranges - each representing a bucket. */
158
+ AggregationType["RANGE"] = "RANGE";
159
+ /** A single-value metric aggregation - such as min, max, sum, or avg. */
160
+ AggregationType["SCALAR"] = "SCALAR";
161
+ /** An aggregation where result buckets are dynamically built - one per time interval such as hour, day, or week. */
162
+ AggregationType["DATE_HISTOGRAM"] = "DATE_HISTOGRAM";
163
+ /** Multi-level aggregation, where each next aggregation is nested within the previous one. */
164
+ AggregationType["NESTED"] = "NESTED";
165
+ })(AggregationType || (AggregationType = {}));
166
+ export var Mode;
167
+ (function (Mode) {
168
+ /** Returns instances where any terms in the expression occur. */
169
+ Mode["OR"] = "OR";
170
+ /** Returns instances where all the terms in the expression occur. */
171
+ Mode["AND"] = "AND";
172
+ })(Mode || (Mode = {}));
173
+ export var WebhookIdentityType;
174
+ (function (WebhookIdentityType) {
175
+ WebhookIdentityType["UNKNOWN"] = "UNKNOWN";
176
+ WebhookIdentityType["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
177
+ WebhookIdentityType["MEMBER"] = "MEMBER";
178
+ WebhookIdentityType["WIX_USER"] = "WIX_USER";
179
+ WebhookIdentityType["APP"] = "APP";
180
+ })(WebhookIdentityType || (WebhookIdentityType = {}));
181
+ /**
182
+ * Creates a new reservation.
183
+ *
184
+ * `createReservation()` accepts and requires different fields depending on the `status` provided and your permissions.
185
+ *
186
+ * **Status and source**
187
+ *
188
+ * If a `status` is not provided, it will be set to:
189
+ * * `RESERVED` if manual approval is not required for confirmation
190
+ * * `REQUESTED` if manual approval is required for confirmation.
191
+ *
192
+ * A reservation created with any `source` other than `WALK_IN` requires the `reservation.reservee.phone` and `reservation.reservee.firstName` fields.
193
+ * Attempting to create a reservation without these fields will result in an error.
194
+ *
195
+ * **Permissions**
196
+ *
197
+ * Including the fields `status`, `source`, `reservation.details.tableIds`, `reservation.details.endDate`, `ignoreReservationLocationConflicts`, or `ignoreTableCombinationConflicts` in the request requires additional permissions. See this API's Introduction article for more information.
198
+ *
199
+ * If `source` is not provided, its value is set depending on the permissions of the user making the call. See this API's Introduction article for more information.
200
+ *
201
+ *
202
+ * > **Note:** `createReservation()` requires all details of the reservation upfront. The process of creating a reservation can be broken up using `createHeldReservation`. `createHeldReservation` creates a temporary reservation that expires automatically unless it is completed with the addition of more details using `reserveReservation()`.
203
+ * @param reservation - Reservation details.
204
+ * @public
205
+ * @documentationMaturity preview
206
+ * @requiredField reservation
207
+ * @requiredField reservation.details
208
+ * @requiredField reservation.details.partySize
209
+ * @requiredField reservation.details.reservationLocationId
210
+ * @requiredField reservation.details.startDate
211
+ * @param options - Options for creating the reservation.
212
+ * @permissionId TABLE_RESERVATIONS.RESERVATION_CREATE
213
+ * @permissionId TABLE_RESERVATIONS.RESERVATION_CREATE_FORCE
214
+ * @permissionScope Manage Reservations (Medium)
215
+ * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-MEDIUM
216
+ * @permissionScope Manage Reservations (Full)
217
+ * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-FULL
218
+ * @permissionScope Manage Restaurants - all permissions
219
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
220
+ * @permissionScope Manage Reservations (Basic)
221
+ * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-BASIC
222
+ * @permissionScope Manage Reservations (Full)
223
+ * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-FULL
224
+ * @permissionScope Manage Restaurants - all permissions
225
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
226
+ * @applicableIdentity APP
227
+ * @applicableIdentity VISITOR
228
+ * @returns Reservation.
229
+ * @fqn wix.table_reservations.reservation.v1.ReservationsService.CreateReservation
230
+ */
231
+ export async function createReservation(reservation, options) {
232
+ // @ts-ignore
233
+ const { httpClient, sideEffects } = arguments[2];
234
+ const payload = renameKeysFromSDKRequestToRESTRequest({
235
+ reservation: reservation,
236
+ ignoreTableCombinationConflicts: options?.ignoreTableCombinationConflicts,
237
+ ignoreReservationLocationConflicts: options?.ignoreReservationLocationConflicts,
238
+ });
239
+ const reqOpts = ambassadorWixTableReservationsV1Reservation.createReservation(payload);
240
+ sideEffects?.onSiteCall?.();
241
+ try {
242
+ const result = await httpClient.request(reqOpts);
243
+ sideEffects?.onSuccess?.(result);
244
+ return renameKeysFromRESTResponseToSDKResponse(result.data)?.reservation;
245
+ }
246
+ catch (err) {
247
+ const transformedError = sdkTransformError(err, {
248
+ spreadPathsToArguments: {},
249
+ explicitPathsToArguments: {
250
+ reservation: '$[0]',
251
+ ignoreTableCombinationConflicts: '$[1].ignoreTableCombinationConflicts',
252
+ ignoreReservationLocationConflicts: '$[1].ignoreReservationLocationConflicts',
253
+ },
254
+ singleArgumentUnchanged: false,
255
+ }, ['reservation', 'options']);
256
+ sideEffects?.onError?.(err);
257
+ throw transformedError;
258
+ }
259
+ }
260
+ /**
261
+ * Retrieves a reservation.
262
+ *
263
+ * Calling this method with `fieldsets` set to `FULL` requires additional permissions. See this API's Introduction article for more information.
264
+ * @param reservationId - Reservation ID.
265
+ * @public
266
+ * @documentationMaturity preview
267
+ * @requiredField reservationId
268
+ * @permissionId TABLE_RESERVATIONS.RESERVATION_READ
269
+ * @permissionId TABLE_RESERVATIONS.RESERVATION_READ_FULL
270
+ * @permissionScope Manage Reservations (Medium)
271
+ * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-MEDIUM
272
+ * @permissionScope Manage Reservations (Full)
273
+ * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-FULL
274
+ * @permissionScope Manage Restaurants - all permissions
275
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
276
+ * @permissionScope Manage Reservations (Basic)
277
+ * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-BASIC
278
+ * @permissionScope Manage Reservations (Medium)
279
+ * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-MEDIUM
280
+ * @permissionScope Manage Reservations (Full)
281
+ * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-FULL
282
+ * @permissionScope Manage Restaurants - all permissions
283
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
284
+ * @applicableIdentity APP
285
+ * @applicableIdentity VISITOR
286
+ * @returns Reservation.
287
+ * @fqn wix.table_reservations.reservation.v1.ReservationsService.GetReservation
288
+ */
289
+ export async function getReservation(reservationId, options) {
290
+ // @ts-ignore
291
+ const { httpClient, sideEffects } = arguments[2];
292
+ const payload = renameKeysFromSDKRequestToRESTRequest({
293
+ reservationId: reservationId,
294
+ fieldsets: options?.fieldsets,
295
+ });
296
+ const reqOpts = ambassadorWixTableReservationsV1Reservation.getReservation(payload);
297
+ sideEffects?.onSiteCall?.();
298
+ try {
299
+ const result = await httpClient.request(reqOpts);
300
+ sideEffects?.onSuccess?.(result);
301
+ return renameKeysFromRESTResponseToSDKResponse(result.data)?.reservation;
302
+ }
303
+ catch (err) {
304
+ const transformedError = sdkTransformError(err, {
305
+ spreadPathsToArguments: {},
306
+ explicitPathsToArguments: {
307
+ reservationId: '$[0]',
308
+ fieldsets: '$[1].fieldsets',
309
+ },
310
+ singleArgumentUnchanged: false,
311
+ }, ['reservationId', 'options']);
312
+ sideEffects?.onError?.(err);
313
+ throw transformedError;
314
+ }
315
+ }
316
+ /**
317
+ * Updates a reservation.
318
+ *
319
+ * Including the fields `status`, `source`, `reservation.details.tableIds`, `reservation.details.endDate`, `ignoreReservationLocationConflicts`, and `ignoreTableCombinationConflicts` in the request requires additional permissions. See this API's Introduction article for more information.
320
+ *
321
+ * Each time the reservation is updated, revision increments by 1. The existing revision must be included when updating the reservation. This ensures you're working with the latest reservation information, and it prevents unintended overwrites.
322
+ * @param _id - Reservation ID.
323
+ * @public
324
+ * @documentationMaturity preview
325
+ * @requiredField _id
326
+ * @requiredField reservation
327
+ * @requiredField reservation.revision
328
+ * @param options - Options for updating the reservation.
329
+ * @param reservation - Reservation information to update.
330
+ * @permissionId TABLE_RESERVATIONS.RESERVATION_UPDATE
331
+ * @permissionId TABLE_RESERVATIONS.RESERVATION_UPDATE_FORCE
332
+ * @permissionScope Manage Reservations (Medium)
333
+ * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-MEDIUM
334
+ * @permissionScope Manage Reservations (Full)
335
+ * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-FULL
336
+ * @permissionScope Manage Restaurants - all permissions
337
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
338
+ * @permissionScope Manage Reservations (Full)
339
+ * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-FULL
340
+ * @permissionScope Manage Restaurants - all permissions
341
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
342
+ * @applicableIdentity APP
343
+ * @returns Reservation.
344
+ * @fqn wix.table_reservations.reservation.v1.ReservationsService.UpdateReservation
345
+ */
346
+ export async function updateReservation(_id, reservation, options) {
347
+ // @ts-ignore
348
+ const { httpClient, sideEffects } = arguments[3];
349
+ const payload = renameKeysFromSDKRequestToRESTRequest({
350
+ reservation: { ...reservation, id: _id },
351
+ ignoreTableCombinationConflicts: options?.ignoreTableCombinationConflicts,
352
+ ignoreReservationLocationConflicts: options?.ignoreReservationLocationConflicts,
353
+ });
354
+ const reqOpts = ambassadorWixTableReservationsV1Reservation.updateReservation(payload);
355
+ sideEffects?.onSiteCall?.();
356
+ try {
357
+ const result = await httpClient.request(reqOpts);
358
+ sideEffects?.onSuccess?.(result);
359
+ return renameKeysFromRESTResponseToSDKResponse(result.data)?.reservation;
360
+ }
361
+ catch (err) {
362
+ const transformedError = sdkTransformError(err, {
363
+ spreadPathsToArguments: { reservation: '$[1]' },
364
+ explicitPathsToArguments: {
365
+ 'reservation.id': '$[0]',
366
+ ignoreTableCombinationConflicts: '$[2].ignoreTableCombinationConflicts',
367
+ ignoreReservationLocationConflicts: '$[2].ignoreReservationLocationConflicts',
368
+ },
369
+ singleArgumentUnchanged: false,
370
+ }, ['_id', 'reservation', 'options']);
371
+ sideEffects?.onError?.(err);
372
+ throw transformedError;
373
+ }
374
+ }
375
+ /**
376
+ * Creates a new temporary reservation and holds it for the customer for 10 minutes.
377
+ *
378
+ * Creates a new reservation with the `HELD` status. `HELD` reservations are intended to reserve seats and tables for a party in a selected time slot while they enter further reservation details, such as names and contact information. Reservations with the `HELD` status are only valid for 10 minutes. Trying to change a `HELD` reservation’s status after 10 minutes returns an error.
379
+ *
380
+ * You cannot call `updateReservation()` to change a reservation’s status from `HELD`. Trying to do so returns an error. Instead, you should use `reserveReservation()`.
381
+ *
382
+ * If you do not wish to have `HELD` reservations in your flow, you can create a reservation with all required details using `createReservation()`.
383
+ *
384
+ * @param reservationDetails - Held reservation information to update.
385
+ * @public
386
+ * @documentationMaturity preview
387
+ * @requiredField reservationDetails
388
+ * @requiredField reservationDetails.partySize
389
+ * @requiredField reservationDetails.reservationLocationId
390
+ * @requiredField reservationDetails.startDate
391
+ * @permissionId TABLE_RESERVATIONS.RESERVATION_CREATE_HELD
392
+ * @permissionScope Manage Reservations (Medium)
393
+ * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-MEDIUM
394
+ * @permissionScope Manage Reservations (Full)
395
+ * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-FULL
396
+ * @permissionScope Manage Restaurants - all permissions
397
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
398
+ * @permissionScope Manage Reservations (Basic)
399
+ * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-BASIC
400
+ * @applicableIdentity APP
401
+ * @applicableIdentity VISITOR
402
+ * @fqn wix.table_reservations.reservation.v1.ReservationsService.CreateHeldReservation
403
+ */
404
+ export async function createHeldReservation(reservationDetails) {
405
+ // @ts-ignore
406
+ const { httpClient, sideEffects } = arguments[1];
407
+ const payload = renameKeysFromSDKRequestToRESTRequest({
408
+ reservationDetails: reservationDetails,
409
+ });
410
+ const reqOpts = ambassadorWixTableReservationsV1Reservation.createHeldReservation(payload);
411
+ sideEffects?.onSiteCall?.();
412
+ try {
413
+ const result = await httpClient.request(reqOpts);
414
+ sideEffects?.onSuccess?.(result);
415
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
416
+ }
417
+ catch (err) {
418
+ const transformedError = sdkTransformError(err, {
419
+ spreadPathsToArguments: {},
420
+ explicitPathsToArguments: { reservationDetails: '$[0]' },
421
+ singleArgumentUnchanged: false,
422
+ }, ['reservationDetails']);
423
+ sideEffects?.onError?.(err);
424
+ throw transformedError;
425
+ }
426
+ }
427
+ /**
428
+ * Reserves or requests a held reservation.
429
+ *
430
+ * Held reservations are temporary reservations with the `HELD` status created by `createHeldReservation()`.
431
+ *
432
+ * They are intended to reserve seats and tables for a party in a selected time slot while they enter further reservation details, such as names and contact information. Reservations with the `HELD` status are only valid for 10 minutes. Trying to call `Reserve Reservation` with a held reservation older than 10 minutes returns an error.
433
+ *
434
+ * `Reserve Reservation` changes a reservation's `HELD` status to:
435
+ * * `RESERVED` if the reservation's reservation location does not require manual approval.
436
+ * * `REQUESTED` if the reservation's reservation location requires manual approval.
437
+ * @param reservationId - Reservation ID.
438
+ * @param reservee - Reservee details.
439
+ * @param revision - Revision number.
440
+ *
441
+ * Specify the existing `revision` to prevent conflicting updates to reservations.
442
+ * @public
443
+ * @documentationMaturity preview
444
+ * @requiredField reservationId
445
+ * @requiredField reservee
446
+ * @requiredField reservee.firstName
447
+ * @requiredField reservee.phone
448
+ * @requiredField revision
449
+ * @permissionId TABLE_RESERVATIONS.RESERVATION_RESERVE
450
+ * @permissionScope Manage Reservations (Medium)
451
+ * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-MEDIUM
452
+ * @permissionScope Manage Reservations (Full)
453
+ * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-FULL
454
+ * @permissionScope Manage Restaurants - all permissions
455
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
456
+ * @permissionScope Manage Reservations (Basic)
457
+ * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-BASIC
458
+ * @applicableIdentity APP
459
+ * @applicableIdentity VISITOR
460
+ * @fqn wix.table_reservations.reservation.v1.ReservationsService.ReserveReservation
461
+ */
462
+ export async function reserveReservation(reservationId, reservee, revision) {
463
+ // @ts-ignore
464
+ const { httpClient, sideEffects } = arguments[3];
465
+ const payload = renameKeysFromSDKRequestToRESTRequest({
466
+ reservationId: reservationId,
467
+ reservee: reservee,
468
+ revision: revision,
469
+ });
470
+ const reqOpts = ambassadorWixTableReservationsV1Reservation.reserveReservation(payload);
471
+ sideEffects?.onSiteCall?.();
472
+ try {
473
+ const result = await httpClient.request(reqOpts);
474
+ sideEffects?.onSuccess?.(result);
475
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
476
+ }
477
+ catch (err) {
478
+ const transformedError = sdkTransformError(err, {
479
+ spreadPathsToArguments: {},
480
+ explicitPathsToArguments: {
481
+ reservationId: '$[0]',
482
+ reservee: '$[1]',
483
+ revision: '$[2]',
484
+ },
485
+ singleArgumentUnchanged: false,
486
+ }, ['reservationId', 'reservee', 'revision']);
487
+ sideEffects?.onError?.(err);
488
+ throw transformedError;
489
+ }
490
+ }
491
+ /**
492
+ * Cancels a reservation.
493
+ *
494
+ * Sets the reservation status to `CANCELED`.
495
+ * @param reservationId - Reservation ID.
496
+ * @param revision - Revision number.
497
+ *
498
+ * Specify the existing `revision` to prevent conflicting updates to reservations.
499
+ * @public
500
+ * @documentationMaturity preview
501
+ * @requiredField reservationId
502
+ * @requiredField revision
503
+ * @param options - Options for canceling the reservation.
504
+ * @permissionId TABLE_RESERVATIONS.RESERVATION_CANCEL
505
+ * @permissionScope Manage Reservations (Medium)
506
+ * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-MEDIUM
507
+ * @permissionScope Manage Reservations (Full)
508
+ * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-FULL
509
+ * @permissionScope Manage Restaurants - all permissions
510
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
511
+ * @permissionScope Manage Reservations (Basic)
512
+ * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-BASIC
513
+ * @applicableIdentity APP
514
+ * @applicableIdentity VISITOR
515
+ * @fqn wix.table_reservations.reservation.v1.ReservationsService.CancelReservation
516
+ */
517
+ export async function cancelReservation(reservationId, revision, options) {
518
+ // @ts-ignore
519
+ const { httpClient, sideEffects } = arguments[3];
520
+ const payload = renameKeysFromSDKRequestToRESTRequest({
521
+ reservationId: reservationId,
522
+ revision: revision,
523
+ phone: options?.phone,
524
+ });
525
+ const reqOpts = ambassadorWixTableReservationsV1Reservation.cancelReservation(payload);
526
+ sideEffects?.onSiteCall?.();
527
+ try {
528
+ const result = await httpClient.request(reqOpts);
529
+ sideEffects?.onSuccess?.(result);
530
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
531
+ }
532
+ catch (err) {
533
+ const transformedError = sdkTransformError(err, {
534
+ spreadPathsToArguments: {},
535
+ explicitPathsToArguments: {
536
+ reservationId: '$[0]',
537
+ revision: '$[1]',
538
+ phone: '$[2].phone',
539
+ },
540
+ singleArgumentUnchanged: false,
541
+ }, ['reservationId', 'revision', 'options']);
542
+ sideEffects?.onError?.(err);
543
+ throw transformedError;
544
+ }
545
+ }
546
+ /**
547
+ * Deletes a reservation. Only reservations with the `HELD` status can be deleted.
548
+ * @param reservationId - Reservation ID.
549
+ * @public
550
+ * @documentationMaturity preview
551
+ * @requiredField reservationId
552
+ * @permissionId TABLE_RESERVATIONS.RESERVATION_DELETE
553
+ * @permissionScope Manage Restaurants - all permissions
554
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
555
+ * @applicableIdentity APP
556
+ * @applicableIdentity VISITOR
557
+ * @fqn wix.table_reservations.reservation.v1.ReservationsService.DeleteReservation
558
+ */
559
+ export async function deleteReservation(reservationId) {
560
+ // @ts-ignore
561
+ const { httpClient, sideEffects } = arguments[1];
562
+ const payload = renameKeysFromSDKRequestToRESTRequest({
563
+ reservationId: reservationId,
564
+ });
565
+ const reqOpts = ambassadorWixTableReservationsV1Reservation.deleteReservation(payload);
566
+ sideEffects?.onSiteCall?.();
567
+ try {
568
+ const result = await httpClient.request(reqOpts);
569
+ sideEffects?.onSuccess?.(result);
570
+ }
571
+ catch (err) {
572
+ const transformedError = sdkTransformError(err, {
573
+ spreadPathsToArguments: {},
574
+ explicitPathsToArguments: { reservationId: '$[0]' },
575
+ singleArgumentUnchanged: false,
576
+ }, ['reservationId']);
577
+ sideEffects?.onError?.(err);
578
+ throw transformedError;
579
+ }
580
+ }
581
+ /**
582
+ * Retrieves a list of up to 100 reservations.
583
+ * @public
584
+ * @documentationMaturity preview
585
+ * @param options - Options for listing the reservations.
586
+ * @permissionId TABLE_RESERVATIONS.RESERVATION_READ_FULL
587
+ * @permissionScope Manage Reservations (Medium)
588
+ * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-MEDIUM
589
+ * @permissionScope Manage Reservations (Full)
590
+ * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-FULL
591
+ * @permissionScope Manage Restaurants - all permissions
592
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
593
+ * @applicableIdentity APP
594
+ * @fqn wix.table_reservations.reservation.v1.ReservationsService.ListReservations
595
+ */
596
+ export async function listReservations(options) {
597
+ // @ts-ignore
598
+ const { httpClient, sideEffects } = arguments[1];
599
+ const payload = renameKeysFromSDKRequestToRESTRequest({
600
+ paging: options?.paging,
601
+ sort: options?.sort,
602
+ startDateFrom: options?.startDateFrom,
603
+ startDateTo: options?.startDateTo,
604
+ status: options?.status,
605
+ });
606
+ const reqOpts = ambassadorWixTableReservationsV1Reservation.listReservations(payload);
607
+ sideEffects?.onSiteCall?.();
608
+ try {
609
+ const result = await httpClient.request(reqOpts);
610
+ sideEffects?.onSuccess?.(result);
611
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
612
+ }
613
+ catch (err) {
614
+ const transformedError = sdkTransformError(err, {
615
+ spreadPathsToArguments: {},
616
+ explicitPathsToArguments: {
617
+ paging: '$[0].paging',
618
+ sort: '$[0].sort',
619
+ startDateFrom: '$[0].startDateFrom',
620
+ startDateTo: '$[0].startDateTo',
621
+ status: '$[0].status',
622
+ },
623
+ singleArgumentUnchanged: false,
624
+ }, ['options']);
625
+ sideEffects?.onError?.(err);
626
+ throw transformedError;
627
+ }
628
+ }
629
+ /**
630
+ * Creates a query to retrieve a list of reservations.
631
+ *
632
+ * The `queryReservations()` function builds a query to retrieve a list of reservations and returns a [`ReservationsQueryBuilder`](/reservations/reservations-query-builder) object.
633
+ *
634
+ * The returned object contains the query definition, which is used to run the query using the [find()](/reservations/reservations-query-builder/find) function.
635
+ *
636
+ * You can refine the query by chaining `ReservationsQueryBuilder` functions onto the query. `ReservationsQueryBuilder` functions enable you to filter, sort, and control the results that `queryReservations()` returns.
637
+ *
638
+ * `queryReservations()` runs with the following `ReservationsQueryBuilder` defaults, which you can override:
639
+ *
640
+ * * [`limit(50)`](/reservations/reservations-query-builder/limit)
641
+ * * [`descending('_createdDate')`](/reservations/reservations-query-builder/descending)
642
+ *
643
+ * The following `ReservationsQueryBuilder` functions are supported for `queryReservations()`. For a full description of the reservation object, see the object returned for the [`items`](/reservations/reservations-query-builder/items) property in [`ReservationsQueryResult`](/reservations/reservations-query-result).
644
+ * @public
645
+ * @documentationMaturity preview
646
+ * @permissionScope Manage Reservations (Medium)
647
+ * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-MEDIUM
648
+ * @permissionScope Manage Reservations (Full)
649
+ * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-FULL
650
+ * @permissionScope Manage Restaurants - all permissions
651
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
652
+ * @permissionId TABLE_RESERVATIONS.RESERVATION_READ_FULL
653
+ * @applicableIdentity APP
654
+ * @fqn wix.table_reservations.reservation.v1.ReservationsService.QueryReservations
655
+ */
656
+ export function queryReservations() {
657
+ // @ts-ignore
658
+ const { httpClient, sideEffects } = arguments[0];
659
+ return queryBuilder({
660
+ func: async (payload) => {
661
+ const reqOpts = ambassadorWixTableReservationsV1Reservation.queryReservations(payload);
662
+ sideEffects?.onSiteCall?.();
663
+ try {
664
+ const result = await httpClient.request(reqOpts);
665
+ sideEffects?.onSuccess?.(result);
666
+ return result;
667
+ }
668
+ catch (err) {
669
+ sideEffects?.onError?.(err);
670
+ throw err;
671
+ }
672
+ },
673
+ requestTransformer: (query) => {
674
+ const args = [query, {}];
675
+ return renameKeysFromSDKRequestToRESTRequest({
676
+ ...args?.[1],
677
+ query: args?.[0],
678
+ });
679
+ },
680
+ responseTransformer: ({ data, }) => {
681
+ const transformedData = renameKeysFromRESTResponseToSDKResponse(data);
682
+ return {
683
+ items: transformedData?.reservations,
684
+ pagingMetadata: transformedData?.pagingMetadata,
685
+ };
686
+ },
687
+ errorTransformer: (err) => {
688
+ const transformedError = sdkTransformError(err, {
689
+ spreadPathsToArguments: {},
690
+ explicitPathsToArguments: { query: '$[0]' },
691
+ singleArgumentUnchanged: false,
692
+ });
693
+ throw transformedError;
694
+ },
695
+ pagingMethod: 'CURSOR',
696
+ transformationPaths: {},
697
+ });
698
+ }
699
+ /**
700
+ * Use this method to search the fields of the table reservations on a site for a given expression.
701
+ *
702
+ * You can also use this method to perform data aggregations on a site's table reservation fields.
703
+ * For a detailed list of supported operations, see the [Sorting, Filtering, and Search](https://dev.wix.com/docs/rest/api-reference/wix-restaurants/reservations/reservations/sorting-filtering-and-search) article.
704
+ * @param search - Search query.
705
+ * @public
706
+ * @documentationMaturity preview
707
+ * @requiredField search
708
+ * @permissionId TABLE_RESERVATIONS.RESERVATION_READ_FULL
709
+ * @permissionScope Manage Reservations (Medium)
710
+ * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-MEDIUM
711
+ * @permissionScope Manage Reservations (Full)
712
+ * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-FULL
713
+ * @permissionScope Manage Restaurants - all permissions
714
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
715
+ * @applicableIdentity APP
716
+ * @fqn wix.table_reservations.reservation.v1.ReservationsService.SearchReservations
717
+ */
718
+ export async function searchReservations(search) {
719
+ // @ts-ignore
720
+ const { httpClient, sideEffects } = arguments[1];
721
+ const payload = renameKeysFromSDKRequestToRESTRequest({ search: search });
722
+ const reqOpts = ambassadorWixTableReservationsV1Reservation.searchReservations(payload);
723
+ sideEffects?.onSiteCall?.();
724
+ try {
725
+ const result = await httpClient.request(reqOpts);
726
+ sideEffects?.onSuccess?.(result);
727
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
728
+ }
729
+ catch (err) {
730
+ const transformedError = sdkTransformError(err, {
731
+ spreadPathsToArguments: {},
732
+ explicitPathsToArguments: { search: '$[0]' },
733
+ singleArgumentUnchanged: false,
734
+ }, ['search']);
735
+ sideEffects?.onError?.(err);
736
+ throw transformedError;
737
+ }
738
+ }
739
+ //# sourceMappingURL=table-reservations-v1-reservation-reservations.universal.js.map