@wix/table-reservations 1.0.77 → 1.0.79

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 (133) hide show
  1. package/build/cjs/context.d.ts +3 -3
  2. package/build/cjs/context.js +3 -3
  3. package/build/cjs/context.js.map +1 -1
  4. package/build/cjs/index.d.ts +3 -3
  5. package/build/cjs/index.js +3 -3
  6. package/build/cjs/index.js.map +1 -1
  7. package/build/cjs/meta.d.ts +3 -3
  8. package/build/cjs/meta.js +3 -3
  9. package/build/cjs/meta.js.map +1 -1
  10. package/build/es/context.d.ts +3 -3
  11. package/build/es/context.js +3 -3
  12. package/build/es/context.js.map +1 -1
  13. package/build/es/index.d.ts +3 -3
  14. package/build/es/index.js +3 -3
  15. package/build/es/index.js.map +1 -1
  16. package/build/es/meta.d.ts +3 -3
  17. package/build/es/meta.js +3 -3
  18. package/build/es/meta.js.map +1 -1
  19. package/package.json +13 -9
  20. package/build/cjs/index.typings.d.ts +0 -3
  21. package/build/cjs/index.typings.js +0 -30
  22. package/build/cjs/index.typings.js.map +0 -1
  23. package/build/cjs/src/table-reservations-v1-reservation-location.context.d.ts +0 -6
  24. package/build/cjs/src/table-reservations-v1-reservation-location.context.js +0 -73
  25. package/build/cjs/src/table-reservations-v1-reservation-location.context.js.map +0 -1
  26. package/build/cjs/src/table-reservations-v1-reservation-location.http.d.ts +0 -40
  27. package/build/cjs/src/table-reservations-v1-reservation-location.http.js +0 -266
  28. package/build/cjs/src/table-reservations-v1-reservation-location.http.js.map +0 -1
  29. package/build/cjs/src/table-reservations-v1-reservation-location.meta.d.ts +0 -20
  30. package/build/cjs/src/table-reservations-v1-reservation-location.meta.js +0 -106
  31. package/build/cjs/src/table-reservations-v1-reservation-location.meta.js.map +0 -1
  32. package/build/cjs/src/table-reservations-v1-reservation-location.public.d.ts +0 -178
  33. package/build/cjs/src/table-reservations-v1-reservation-location.public.js +0 -48
  34. package/build/cjs/src/table-reservations-v1-reservation-location.public.js.map +0 -1
  35. package/build/cjs/src/table-reservations-v1-reservation-location.types.d.ts +0 -2260
  36. package/build/cjs/src/table-reservations-v1-reservation-location.types.js +0 -187
  37. package/build/cjs/src/table-reservations-v1-reservation-location.types.js.map +0 -1
  38. package/build/cjs/src/table-reservations-v1-reservation-location.universal.d.ts +0 -2333
  39. package/build/cjs/src/table-reservations-v1-reservation-location.universal.js +0 -613
  40. package/build/cjs/src/table-reservations-v1-reservation-location.universal.js.map +0 -1
  41. package/build/cjs/src/table-reservations-v1-reservation.context.d.ts +0 -11
  42. package/build/cjs/src/table-reservations-v1-reservation.context.js +0 -158
  43. package/build/cjs/src/table-reservations-v1-reservation.context.js.map +0 -1
  44. package/build/cjs/src/table-reservations-v1-reservation.http.d.ts +0 -89
  45. package/build/cjs/src/table-reservations-v1-reservation.http.js +0 -508
  46. package/build/cjs/src/table-reservations-v1-reservation.http.js.map +0 -1
  47. package/build/cjs/src/table-reservations-v1-reservation.meta.d.ts +0 -29
  48. package/build/cjs/src/table-reservations-v1-reservation.meta.js +0 -199
  49. package/build/cjs/src/table-reservations-v1-reservation.meta.js.map +0 -1
  50. package/build/cjs/src/table-reservations-v1-reservation.public.d.ts +0 -26
  51. package/build/cjs/src/table-reservations-v1-reservation.public.js +0 -78
  52. package/build/cjs/src/table-reservations-v1-reservation.public.js.map +0 -1
  53. package/build/cjs/src/table-reservations-v1-reservation.types.d.ts +0 -976
  54. package/build/cjs/src/table-reservations-v1-reservation.types.js +0 -119
  55. package/build/cjs/src/table-reservations-v1-reservation.types.js.map +0 -1
  56. package/build/cjs/src/table-reservations-v1-reservation.universal.d.ts +0 -1382
  57. package/build/cjs/src/table-reservations-v1-reservation.universal.js +0 -872
  58. package/build/cjs/src/table-reservations-v1-reservation.universal.js.map +0 -1
  59. package/build/cjs/src/table-reservations-v1-time-slot.context.d.ts +0 -3
  60. package/build/cjs/src/table-reservations-v1-time-slot.context.js +0 -22
  61. package/build/cjs/src/table-reservations-v1-time-slot.context.js.map +0 -1
  62. package/build/cjs/src/table-reservations-v1-time-slot.http.d.ts +0 -13
  63. package/build/cjs/src/table-reservations-v1-time-slot.http.js +0 -126
  64. package/build/cjs/src/table-reservations-v1-time-slot.http.js.map +0 -1
  65. package/build/cjs/src/table-reservations-v1-time-slot.meta.d.ts +0 -13
  66. package/build/cjs/src/table-reservations-v1-time-slot.meta.js +0 -47
  67. package/build/cjs/src/table-reservations-v1-time-slot.meta.js.map +0 -1
  68. package/build/cjs/src/table-reservations-v1-time-slot.public.d.ts +0 -8
  69. package/build/cjs/src/table-reservations-v1-time-slot.public.js +0 -17
  70. package/build/cjs/src/table-reservations-v1-time-slot.public.js.map +0 -1
  71. package/build/cjs/src/table-reservations-v1-time-slot.types.d.ts +0 -137
  72. package/build/cjs/src/table-reservations-v1-time-slot.types.js +0 -32
  73. package/build/cjs/src/table-reservations-v1-time-slot.types.js.map +0 -1
  74. package/build/cjs/src/table-reservations-v1-time-slot.universal.d.ts +0 -178
  75. package/build/cjs/src/table-reservations-v1-time-slot.universal.js +0 -166
  76. package/build/cjs/src/table-reservations-v1-time-slot.universal.js.map +0 -1
  77. package/build/es/index.typings.d.ts +0 -3
  78. package/build/es/index.typings.js +0 -4
  79. package/build/es/index.typings.js.map +0 -1
  80. package/build/es/src/table-reservations-v1-reservation-location.context.d.ts +0 -6
  81. package/build/es/src/table-reservations-v1-reservation-location.context.js +0 -66
  82. package/build/es/src/table-reservations-v1-reservation-location.context.js.map +0 -1
  83. package/build/es/src/table-reservations-v1-reservation-location.http.d.ts +0 -40
  84. package/build/es/src/table-reservations-v1-reservation-location.http.js +0 -259
  85. package/build/es/src/table-reservations-v1-reservation-location.http.js.map +0 -1
  86. package/build/es/src/table-reservations-v1-reservation-location.meta.d.ts +0 -20
  87. package/build/es/src/table-reservations-v1-reservation-location.meta.js +0 -76
  88. package/build/es/src/table-reservations-v1-reservation-location.meta.js.map +0 -1
  89. package/build/es/src/table-reservations-v1-reservation-location.public.d.ts +0 -178
  90. package/build/es/src/table-reservations-v1-reservation-location.public.js +0 -25
  91. package/build/es/src/table-reservations-v1-reservation-location.public.js.map +0 -1
  92. package/build/es/src/table-reservations-v1-reservation-location.types.d.ts +0 -2260
  93. package/build/es/src/table-reservations-v1-reservation-location.types.js +0 -184
  94. package/build/es/src/table-reservations-v1-reservation-location.types.js.map +0 -1
  95. package/build/es/src/table-reservations-v1-reservation-location.universal.d.ts +0 -2333
  96. package/build/es/src/table-reservations-v1-reservation-location.universal.js +0 -583
  97. package/build/es/src/table-reservations-v1-reservation-location.universal.js.map +0 -1
  98. package/build/es/src/table-reservations-v1-reservation.context.d.ts +0 -11
  99. package/build/es/src/table-reservations-v1-reservation.context.js +0 -146
  100. package/build/es/src/table-reservations-v1-reservation.context.js.map +0 -1
  101. package/build/es/src/table-reservations-v1-reservation.http.d.ts +0 -89
  102. package/build/es/src/table-reservations-v1-reservation.http.js +0 -496
  103. package/build/es/src/table-reservations-v1-reservation.http.js.map +0 -1
  104. package/build/es/src/table-reservations-v1-reservation.meta.d.ts +0 -29
  105. package/build/es/src/table-reservations-v1-reservation.meta.js +0 -164
  106. package/build/es/src/table-reservations-v1-reservation.meta.js.map +0 -1
  107. package/build/es/src/table-reservations-v1-reservation.public.d.ts +0 -26
  108. package/build/es/src/table-reservations-v1-reservation.public.js +0 -50
  109. package/build/es/src/table-reservations-v1-reservation.public.js.map +0 -1
  110. package/build/es/src/table-reservations-v1-reservation.types.d.ts +0 -976
  111. package/build/es/src/table-reservations-v1-reservation.types.js +0 -116
  112. package/build/es/src/table-reservations-v1-reservation.types.js.map +0 -1
  113. package/build/es/src/table-reservations-v1-reservation.universal.d.ts +0 -1382
  114. package/build/es/src/table-reservations-v1-reservation.universal.js +0 -837
  115. package/build/es/src/table-reservations-v1-reservation.universal.js.map +0 -1
  116. package/build/es/src/table-reservations-v1-time-slot.context.d.ts +0 -3
  117. package/build/es/src/table-reservations-v1-time-slot.context.js +0 -18
  118. package/build/es/src/table-reservations-v1-time-slot.context.js.map +0 -1
  119. package/build/es/src/table-reservations-v1-time-slot.http.d.ts +0 -13
  120. package/build/es/src/table-reservations-v1-time-slot.http.js +0 -122
  121. package/build/es/src/table-reservations-v1-time-slot.http.js.map +0 -1
  122. package/build/es/src/table-reservations-v1-time-slot.meta.d.ts +0 -13
  123. package/build/es/src/table-reservations-v1-time-slot.meta.js +0 -20
  124. package/build/es/src/table-reservations-v1-time-slot.meta.js.map +0 -1
  125. package/build/es/src/table-reservations-v1-time-slot.public.d.ts +0 -8
  126. package/build/es/src/table-reservations-v1-time-slot.public.js +0 -9
  127. package/build/es/src/table-reservations-v1-time-slot.public.js.map +0 -1
  128. package/build/es/src/table-reservations-v1-time-slot.types.d.ts +0 -137
  129. package/build/es/src/table-reservations-v1-time-slot.types.js +0 -29
  130. package/build/es/src/table-reservations-v1-time-slot.types.js.map +0 -1
  131. package/build/es/src/table-reservations-v1-time-slot.universal.d.ts +0 -178
  132. package/build/es/src/table-reservations-v1-time-slot.universal.js +0 -139
  133. package/build/es/src/table-reservations-v1-time-slot.universal.js.map +0 -1
@@ -1,872 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
- return new (P || (P = Promise))(function (resolve, reject) {
28
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
- step((generator = generator.apply(thisArg, _arguments || [])).next());
32
- });
33
- };
34
- Object.defineProperty(exports, "__esModule", { value: true });
35
- exports.searchReservations = exports.queryReservations = exports.listReservations = exports.cancelReservation = exports.reserveReservation = exports.createHeldReservation = exports.updateReservation = exports.getReservation = exports.createReservation = exports.onReservationUpdated = exports.onReservationCreated = exports.Mode = exports.AggregationType = exports.Interval = exports.NestedAggregationType = exports.ScalarType = exports.MissingValues = exports.SortDirection = exports.SortType = exports.SortOrder = exports.Set = exports.Type = exports.TableCombinationConflictType = exports.Source = exports.Status = void 0;
36
- const velo_1 = require("@wix/metro-runtime/velo");
37
- const transform_error_1 = require("@wix/sdk-runtime/transform-error");
38
- const sdk_types_1 = require("@wix/sdk-types");
39
- const ambassadorWixTableReservationsV1Reservation = __importStar(require("./table-reservations-v1-reservation.http"));
40
- // @ts-ignore
41
- const motion_edm_autogen_query_wrapper_1 = require("@wix/motion-edm-autogen-query-wrapper");
42
- const _toVeloEntity = '$';
43
- const _fromVeloEntity = '$';
44
- var Status;
45
- (function (Status) {
46
- Status["UNKNOWN"] = "UNKNOWN";
47
- /** The reservation is held for 10 minutes, during which time the reservee should fill in their details. */
48
- Status["HELD"] = "HELD";
49
- /** The reservation has been reserved. */
50
- Status["RESERVED"] = "RESERVED";
51
- /** The reservation has been canceled. */
52
- Status["CANCELED"] = "CANCELED";
53
- /** The reservation has finished successfully. */
54
- Status["FINISHED"] = "FINISHED";
55
- /** The reservee didn't arrive. */
56
- Status["NO_SHOW"] = "NO_SHOW";
57
- /** The reservee occupied the table. */
58
- Status["SEATED"] = "SEATED";
59
- /** The reservee requested a reservation and is waiting for manual approval. */
60
- Status["REQUESTED"] = "REQUESTED";
61
- /** The owner declined a reservee's request. */
62
- Status["DECLINED"] = "DECLINED";
63
- /** The reservation is held for 10 minutes from the created time, during which time the reservee should pay. After payment is completed status will be changed automatically to RESERVED. */
64
- Status["PAYMENT_PENDING"] = "PAYMENT_PENDING";
65
- })(Status || (exports.Status = Status = {}));
66
- var Source;
67
- (function (Source) {
68
- Source["UNKNOWN"] = "UNKNOWN";
69
- /** The reservation is created by a User. */
70
- Source["OFFLINE"] = "OFFLINE";
71
- /** The reservation is created by UoU. */
72
- Source["ONLINE"] = "ONLINE";
73
- /** The reservation is created by a User. It can be created without reservee data. */
74
- Source["WALK_IN"] = "WALK_IN";
75
- })(Source || (exports.Source = Source = {}));
76
- var TableCombinationConflictType;
77
- (function (TableCombinationConflictType) {
78
- TableCombinationConflictType["UNKNOWN"] = "UNKNOWN";
79
- TableCombinationConflictType["RESERVED"] = "RESERVED";
80
- TableCombinationConflictType["TOO_BIG"] = "TOO_BIG";
81
- TableCombinationConflictType["TOO_SMALL"] = "TOO_SMALL";
82
- TableCombinationConflictType["OFFLINE_ONLY"] = "OFFLINE_ONLY";
83
- })(TableCombinationConflictType || (exports.TableCombinationConflictType = TableCombinationConflictType = {}));
84
- var Type;
85
- (function (Type) {
86
- Type["UNKNOWN"] = "UNKNOWN";
87
- Type["PARTY_PACING"] = "PARTY_PACING";
88
- Type["SEAT_PACING"] = "SEAT_PACING";
89
- })(Type || (exports.Type = Type = {}));
90
- var Set;
91
- (function (Set) {
92
- Set["PUBLIC"] = "PUBLIC";
93
- Set["FULL"] = "FULL";
94
- })(Set || (exports.Set = Set = {}));
95
- var SortOrder;
96
- (function (SortOrder) {
97
- SortOrder["ASC"] = "ASC";
98
- SortOrder["DESC"] = "DESC";
99
- })(SortOrder || (exports.SortOrder = SortOrder = {}));
100
- var SortType;
101
- (function (SortType) {
102
- SortType["COUNT"] = "COUNT";
103
- SortType["VALUE"] = "VALUE";
104
- })(SortType || (exports.SortType = SortType = {}));
105
- var SortDirection;
106
- (function (SortDirection) {
107
- SortDirection["DESC"] = "DESC";
108
- SortDirection["ASC"] = "ASC";
109
- })(SortDirection || (exports.SortDirection = SortDirection = {}));
110
- var MissingValues;
111
- (function (MissingValues) {
112
- MissingValues["EXCLUDE"] = "EXCLUDE";
113
- MissingValues["INCLUDE"] = "INCLUDE";
114
- })(MissingValues || (exports.MissingValues = MissingValues = {}));
115
- var ScalarType;
116
- (function (ScalarType) {
117
- ScalarType["UNKNOWN_SCALAR_TYPE"] = "UNKNOWN_SCALAR_TYPE";
118
- ScalarType["COUNT_DISTINCT"] = "COUNT_DISTINCT";
119
- ScalarType["MIN"] = "MIN";
120
- ScalarType["MAX"] = "MAX";
121
- ScalarType["SUM"] = "SUM";
122
- ScalarType["AVG"] = "AVG";
123
- })(ScalarType || (exports.ScalarType = ScalarType = {}));
124
- var NestedAggregationType;
125
- (function (NestedAggregationType) {
126
- NestedAggregationType["UNKNOWN_AGGREGATION_TYPE"] = "UNKNOWN_AGGREGATION_TYPE";
127
- NestedAggregationType["VALUE"] = "VALUE";
128
- NestedAggregationType["RANGE"] = "RANGE";
129
- NestedAggregationType["SCALAR"] = "SCALAR";
130
- NestedAggregationType["DATE_HISTOGRAM"] = "DATE_HISTOGRAM";
131
- })(NestedAggregationType || (exports.NestedAggregationType = NestedAggregationType = {}));
132
- var Interval;
133
- (function (Interval) {
134
- Interval["UNKNOWN_INTERVAL"] = "UNKNOWN_INTERVAL";
135
- Interval["YEAR"] = "YEAR";
136
- Interval["MONTH"] = "MONTH";
137
- Interval["WEEK"] = "WEEK";
138
- Interval["DAY"] = "DAY";
139
- Interval["HOUR"] = "HOUR";
140
- Interval["MINUTE"] = "MINUTE";
141
- Interval["SECOND"] = "SECOND";
142
- })(Interval || (exports.Interval = Interval = {}));
143
- var AggregationType;
144
- (function (AggregationType) {
145
- AggregationType["UNKNOWN_AGGREGATION_TYPE"] = "UNKNOWN_AGGREGATION_TYPE";
146
- AggregationType["VALUE"] = "VALUE";
147
- AggregationType["RANGE"] = "RANGE";
148
- AggregationType["SCALAR"] = "SCALAR";
149
- AggregationType["DATE_HISTOGRAM"] = "DATE_HISTOGRAM";
150
- AggregationType["NESTED"] = "NESTED";
151
- })(AggregationType || (exports.AggregationType = AggregationType = {}));
152
- var Mode;
153
- (function (Mode) {
154
- /** any */
155
- Mode["OR"] = "OR";
156
- /** all */
157
- Mode["AND"] = "AND";
158
- })(Mode || (exports.Mode = Mode = {}));
159
- const _cancelReservationRequest = {};
160
- const _cancelReservationResponse = {};
161
- const _createHeldReservationRequest = {};
162
- const _createHeldReservationResponse = {};
163
- const _createReservationRequest = {};
164
- const _createReservationResponse = {};
165
- const _getReservationRequest = {};
166
- const _getReservationResponse = {};
167
- const _listReservationsRequest = {};
168
- const _listReservationsResponse = {};
169
- const _queryReservationsRequest = {};
170
- const _queryReservationsResponse = {};
171
- const _reserveReservationRequest = {};
172
- const _reserveReservationResponse = {};
173
- const _searchReservationsRequest = {};
174
- const _searchReservationsResponse = {};
175
- const _updateReservationRequest = {};
176
- const _updateReservationResponse = {};
177
- const _details = {
178
- startDate: 'google.protobuf.Timestamp',
179
- endDate: 'google.protobuf.Timestamp',
180
- };
181
- const _reservation = {
182
- createdDate: 'google.protobuf.Timestamp',
183
- updatedDate: 'google.protobuf.Timestamp',
184
- details: '_details',
185
- };
186
- exports.onReservationCreated = (0, sdk_types_1.EventDefinition)('wix.table_reservations.v1.reservation_created', true, {
187
- rootSchema: _reservation,
188
- depSchemas: { _details },
189
- })();
190
- exports.onReservationUpdated = (0, sdk_types_1.EventDefinition)('wix.table_reservations.v1.reservation_updated', true, {
191
- rootSchema: _reservation,
192
- depSchemas: { _details },
193
- })();
194
- /**
195
- * Creates a new reservation.
196
- *
197
- * `createReservation()` accepts and requires different fields depending on the `status` provided and your permissions.
198
- *
199
- * **Status and source**
200
- *
201
- * If a `status` is not provided, it will be set to:
202
- * * `RESERVED` if manual approval is not required for confirmation
203
- * * `REQUESTED` if manual approval is required for confirmation.
204
- *
205
- * A reservation created with any `source` other than `WALK_IN` requires the `reservation.reservee.phone` and `reservation.reservee.firstName` fields.
206
- * Attempting to create a reservation without these fields will result in an error.
207
- *
208
- * **Permissions**
209
- *
210
- * 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.
211
- *
212
- * 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.
213
- *
214
- *
215
- * > **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()`.
216
- * @param reservation - Reservation details.
217
- * @public
218
- * @documentationMaturity preview
219
- * @requiredField reservation
220
- * @requiredField reservation.details
221
- * @requiredField reservation.details.partySize
222
- * @requiredField reservation.details.reservationLocationId
223
- * @requiredField reservation.details.startDate
224
- * @param options - Options for creating the reservation.
225
- * @permissionScope Manage Reservations (Medium)
226
- * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-MEDIUM
227
- * @permissionScope Manage Reservations (Full)
228
- * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-FULL
229
- * @permissionScope Manage Reservations (Basic)
230
- * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-BASIC
231
- * @permissionScope Manage Reservations (Full)
232
- * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-FULL
233
- * @applicableIdentity APP
234
- * @applicableIdentity MEMBER
235
- * @applicableIdentity VISITOR
236
- * @returns Reservation.
237
- */
238
- function createReservation(reservation, options) {
239
- var _a, _b, _c;
240
- return __awaiter(this, arguments, void 0, function* () {
241
- const requestTransformation = {
242
- reservation: '$[0]',
243
- ignoreTableCombinationConflicts: '$[1].ignoreTableCombinationConflicts',
244
- ignoreReservationLocationConflicts: '$[1].ignoreReservationLocationConflicts',
245
- };
246
- const responseTransformation = '$.reservation';
247
- // @ts-ignore
248
- const { httpClient, sideEffects } = arguments[2];
249
- const { toAmbassadorRequest } = (0, velo_1.serializer)({
250
- rootSchema: _createReservationRequest,
251
- depSchemas: {},
252
- fqdnTransformation: {
253
- paths: [...['reservation']],
254
- transformation: _fromVeloEntity,
255
- },
256
- customTransformation: requestTransformation,
257
- });
258
- const { fromJSON } = (0, velo_1.serializer)({
259
- rootSchema: _createReservationResponse,
260
- depSchemas: {},
261
- fqdnTransformation: {
262
- paths: [...['reservation']],
263
- transformation: _toVeloEntity,
264
- },
265
- customTransformation: responseTransformation,
266
- });
267
- const payload = toAmbassadorRequest([reservation, options]);
268
- const reqOpts = ambassadorWixTableReservationsV1Reservation.createReservation(payload);
269
- (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
270
- try {
271
- const result = yield httpClient.request(reqOpts);
272
- (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
273
- return fromJSON(result.data);
274
- }
275
- catch (err) {
276
- const transformedError = (0, transform_error_1.transformError)(err, {
277
- spreadPathsToArguments: {},
278
- explicitPathsToArguments: {
279
- reservation: '$[0]',
280
- ignoreTableCombinationConflicts: '$[1].ignoreTableCombinationConflicts',
281
- ignoreReservationLocationConflicts: '$[1].ignoreReservationLocationConflicts',
282
- },
283
- singleArgumentUnchanged: false,
284
- }, ['reservation', 'options']);
285
- (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
286
- throw transformedError;
287
- }
288
- });
289
- }
290
- exports.createReservation = createReservation;
291
- /**
292
- * Retrieves a reservation.
293
- *
294
- * Calling this method with `fieldsets` set to `FULL` requires additional permissions. See this API's Introduction article for more information.
295
- * @param reservationId - Reservation ID.
296
- * @public
297
- * @documentationMaturity preview
298
- * @requiredField reservationId
299
- * @permissionScope Manage Reservations (Medium)
300
- * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-MEDIUM
301
- * @permissionScope Manage Reservations (Full)
302
- * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-FULL
303
- * @permissionScope Manage Reservations (Basic)
304
- * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-BASIC
305
- * @permissionScope Manage Reservations (Medium)
306
- * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-MEDIUM
307
- * @permissionScope Manage Reservations (Full)
308
- * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-FULL
309
- * @applicableIdentity APP
310
- * @applicableIdentity MEMBER
311
- * @applicableIdentity VISITOR
312
- * @returns Reservation.
313
- */
314
- function getReservation(reservationId, options) {
315
- var _a, _b, _c;
316
- return __awaiter(this, arguments, void 0, function* () {
317
- const requestTransformation = {
318
- reservationId: '$[0]',
319
- fieldsets: '$[1].fieldsets',
320
- };
321
- const responseTransformation = '$.reservation';
322
- // @ts-ignore
323
- const { httpClient, sideEffects } = arguments[2];
324
- const { toAmbassadorRequest } = (0, velo_1.serializer)({
325
- rootSchema: _getReservationRequest,
326
- depSchemas: {},
327
- fqdnTransformation: {
328
- paths: [],
329
- transformation: _fromVeloEntity,
330
- },
331
- customTransformation: requestTransformation,
332
- });
333
- const { fromJSON } = (0, velo_1.serializer)({
334
- rootSchema: _getReservationResponse,
335
- depSchemas: {},
336
- fqdnTransformation: {
337
- paths: [...['reservation']],
338
- transformation: _toVeloEntity,
339
- },
340
- customTransformation: responseTransformation,
341
- });
342
- const payload = toAmbassadorRequest([reservationId, options]);
343
- const reqOpts = ambassadorWixTableReservationsV1Reservation.getReservation(payload);
344
- (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
345
- try {
346
- const result = yield httpClient.request(reqOpts);
347
- (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
348
- return fromJSON(result.data);
349
- }
350
- catch (err) {
351
- const transformedError = (0, transform_error_1.transformError)(err, {
352
- spreadPathsToArguments: {},
353
- explicitPathsToArguments: {
354
- reservationId: '$[0]',
355
- fieldsets: '$[1].fieldsets',
356
- },
357
- singleArgumentUnchanged: false,
358
- }, ['reservationId', 'options']);
359
- (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
360
- throw transformedError;
361
- }
362
- });
363
- }
364
- exports.getReservation = getReservation;
365
- /**
366
- * Updates a reservation.
367
- *
368
- * 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.
369
- *
370
- * 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.
371
- * @param _id - Reservation ID.
372
- * @public
373
- * @documentationMaturity preview
374
- * @requiredField _id
375
- * @requiredField reservation
376
- * @requiredField reservation.revision
377
- * @param options - Options for updating the reservation.
378
- * @param reservation - Reservation information to update.
379
- * @permissionScope Manage Reservations (Medium)
380
- * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-MEDIUM
381
- * @permissionScope Manage Reservations (Full)
382
- * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-FULL
383
- * @permissionScope Manage Reservations (Full)
384
- * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-FULL
385
- * @applicableIdentity APP
386
- * @returns Reservation.
387
- */
388
- function updateReservation(_id, reservation, options) {
389
- var _a, _b, _c;
390
- return __awaiter(this, arguments, void 0, function* () {
391
- const requestTransformation = {
392
- reservation: { '*': '$[1]', id: '$[0]' },
393
- ignoreTableCombinationConflicts: '$[2].ignoreTableCombinationConflicts',
394
- ignoreReservationLocationConflicts: '$[2].ignoreReservationLocationConflicts',
395
- };
396
- const responseTransformation = '$.reservation';
397
- // @ts-ignore
398
- const { httpClient, sideEffects } = arguments[3];
399
- const { toAmbassadorRequest } = (0, velo_1.serializer)({
400
- rootSchema: _updateReservationRequest,
401
- depSchemas: {},
402
- fqdnTransformation: {
403
- paths: [...['reservation']],
404
- transformation: _fromVeloEntity,
405
- },
406
- customTransformation: requestTransformation,
407
- });
408
- const { fromJSON } = (0, velo_1.serializer)({
409
- rootSchema: _updateReservationResponse,
410
- depSchemas: {},
411
- fqdnTransformation: {
412
- paths: [...['reservation']],
413
- transformation: _toVeloEntity,
414
- },
415
- customTransformation: responseTransformation,
416
- });
417
- const payload = toAmbassadorRequest([_id, reservation, options]);
418
- const reqOpts = ambassadorWixTableReservationsV1Reservation.updateReservation(payload);
419
- (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
420
- try {
421
- const result = yield httpClient.request(reqOpts);
422
- (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
423
- return fromJSON(result.data);
424
- }
425
- catch (err) {
426
- const transformedError = (0, transform_error_1.transformError)(err, {
427
- spreadPathsToArguments: { reservation: '$[1]' },
428
- explicitPathsToArguments: {
429
- 'reservation.id': '$[0]',
430
- ignoreTableCombinationConflicts: '$[2].ignoreTableCombinationConflicts',
431
- ignoreReservationLocationConflicts: '$[2].ignoreReservationLocationConflicts',
432
- },
433
- singleArgumentUnchanged: false,
434
- }, ['_id', 'reservation', 'options']);
435
- (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
436
- throw transformedError;
437
- }
438
- });
439
- }
440
- exports.updateReservation = updateReservation;
441
- /**
442
- * Creates a new temporary reservation and holds it for the customer for 10 minutes.
443
- *
444
- * 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.
445
- *
446
- * You cannot call `updateReservation()` to change a reservation’s status from `HELD`. Trying to do so returns an error. Instead, you should use `reserveReservation()`.
447
- *
448
- * If you do not wish to have `HELD` reservations in your flow, you can create a reservation with all required details using `createReservation()`.
449
- *
450
- * @param reservationDetails - Held reservation information to update.
451
- * @public
452
- * @documentationMaturity preview
453
- * @requiredField reservationDetails
454
- * @requiredField reservationDetails.partySize
455
- * @requiredField reservationDetails.reservationLocationId
456
- * @requiredField reservationDetails.startDate
457
- * @permissionScope Manage Reservations (Medium)
458
- * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-MEDIUM
459
- * @permissionScope Manage Reservations (Full)
460
- * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-FULL
461
- * @permissionScope Manage Reservations (Basic)
462
- * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-BASIC
463
- * @applicableIdentity APP
464
- * @applicableIdentity MEMBER
465
- * @applicableIdentity VISITOR
466
- */
467
- function createHeldReservation(reservationDetails) {
468
- var _a, _b, _c;
469
- return __awaiter(this, arguments, void 0, function* () {
470
- const requestTransformation = { reservationDetails: '$[0]' };
471
- const responseTransformation = '$';
472
- // @ts-ignore
473
- const { httpClient, sideEffects } = arguments[1];
474
- const { toAmbassadorRequest } = (0, velo_1.serializer)({
475
- rootSchema: _createHeldReservationRequest,
476
- depSchemas: {},
477
- fqdnTransformation: {
478
- paths: [],
479
- transformation: _fromVeloEntity,
480
- },
481
- customTransformation: requestTransformation,
482
- });
483
- const { fromJSON } = (0, velo_1.serializer)({
484
- rootSchema: _createHeldReservationResponse,
485
- depSchemas: {},
486
- fqdnTransformation: {
487
- paths: [...['reservation']],
488
- transformation: _toVeloEntity,
489
- },
490
- customTransformation: responseTransformation,
491
- });
492
- const payload = toAmbassadorRequest([reservationDetails]);
493
- const reqOpts = ambassadorWixTableReservationsV1Reservation.createHeldReservation(payload);
494
- (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
495
- try {
496
- const result = yield httpClient.request(reqOpts);
497
- (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
498
- return fromJSON(result.data);
499
- }
500
- catch (err) {
501
- const transformedError = (0, transform_error_1.transformError)(err, {
502
- spreadPathsToArguments: {},
503
- explicitPathsToArguments: { reservationDetails: '$[0]' },
504
- singleArgumentUnchanged: false,
505
- }, ['reservationDetails']);
506
- (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
507
- throw transformedError;
508
- }
509
- });
510
- }
511
- exports.createHeldReservation = createHeldReservation;
512
- /**
513
- * Reserves or requests a held reservation.
514
- *
515
- * Held reservations are temporary reservations with the `HELD` status created by `createHeldReservation()`.
516
- *
517
- * 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.
518
- *
519
- * `Reserve Reservation` changes a reservation's `HELD` status to:
520
- * * `RESERVED` if the reservation's reservation location does not require manual approval.
521
- * * `REQUESTED` if the reservation's reservation location requires manual approval.
522
- * @param reservationId - Reservation ID.
523
- * @param reservee - Reservee details.
524
- * @param revision - Revision number.
525
- *
526
- * Include the existing `revision` to prevent conflicting updates to reservations.
527
- * @public
528
- * @documentationMaturity preview
529
- * @requiredField reservationId
530
- * @requiredField reservee
531
- * @requiredField reservee.firstName
532
- * @requiredField reservee.phone
533
- * @requiredField revision
534
- * @permissionScope Manage Reservations (Medium)
535
- * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-MEDIUM
536
- * @permissionScope Manage Reservations (Full)
537
- * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-FULL
538
- * @permissionScope Manage Reservations (Basic)
539
- * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-BASIC
540
- * @applicableIdentity APP
541
- * @applicableIdentity MEMBER
542
- * @applicableIdentity VISITOR
543
- */
544
- function reserveReservation(reservationId, reservee, revision) {
545
- var _a, _b, _c;
546
- return __awaiter(this, arguments, void 0, function* () {
547
- const requestTransformation = {
548
- reservationId: '$[0]',
549
- reservee: '$[1]',
550
- revision: '$[2]',
551
- };
552
- const responseTransformation = '$';
553
- // @ts-ignore
554
- const { httpClient, sideEffects } = arguments[3];
555
- const { toAmbassadorRequest } = (0, velo_1.serializer)({
556
- rootSchema: _reserveReservationRequest,
557
- depSchemas: {},
558
- fqdnTransformation: {
559
- paths: [],
560
- transformation: _fromVeloEntity,
561
- },
562
- customTransformation: requestTransformation,
563
- });
564
- const { fromJSON } = (0, velo_1.serializer)({
565
- rootSchema: _reserveReservationResponse,
566
- depSchemas: {},
567
- fqdnTransformation: {
568
- paths: [...['reservation']],
569
- transformation: _toVeloEntity,
570
- },
571
- customTransformation: responseTransformation,
572
- });
573
- const payload = toAmbassadorRequest([reservationId, reservee, revision]);
574
- const reqOpts = ambassadorWixTableReservationsV1Reservation.reserveReservation(payload);
575
- (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
576
- try {
577
- const result = yield httpClient.request(reqOpts);
578
- (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
579
- return fromJSON(result.data);
580
- }
581
- catch (err) {
582
- const transformedError = (0, transform_error_1.transformError)(err, {
583
- spreadPathsToArguments: {},
584
- explicitPathsToArguments: {
585
- reservationId: '$[0]',
586
- reservee: '$[1]',
587
- revision: '$[2]',
588
- },
589
- singleArgumentUnchanged: false,
590
- }, ['reservationId', 'reservee', 'revision']);
591
- (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
592
- throw transformedError;
593
- }
594
- });
595
- }
596
- exports.reserveReservation = reserveReservation;
597
- /**
598
- * Cancels a reservation.
599
- *
600
- * Sets the reservation status to `CANCELED`.
601
- * @param reservationId - Reservation ID.
602
- * @param revision - Revision number.
603
- *
604
- * Include the existing `revision` to prevent conflicting updates to reservations.
605
- * @public
606
- * @documentationMaturity preview
607
- * @requiredField reservationId
608
- * @requiredField revision
609
- * @param options - Options for canceling the reservation.
610
- * @permissionScope Manage Reservations (Medium)
611
- * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-MEDIUM
612
- * @permissionScope Manage Reservations (Full)
613
- * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-FULL
614
- * @permissionScope Manage Reservations (Basic)
615
- * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-BASIC
616
- * @applicableIdentity APP
617
- * @applicableIdentity MEMBER
618
- * @applicableIdentity VISITOR
619
- */
620
- function cancelReservation(reservationId, revision, options) {
621
- var _a, _b, _c;
622
- return __awaiter(this, arguments, void 0, function* () {
623
- const requestTransformation = {
624
- reservationId: '$[0]',
625
- revision: '$[1]',
626
- phone: '$[2].phone',
627
- };
628
- const responseTransformation = '$';
629
- // @ts-ignore
630
- const { httpClient, sideEffects } = arguments[3];
631
- const { toAmbassadorRequest } = (0, velo_1.serializer)({
632
- rootSchema: _cancelReservationRequest,
633
- depSchemas: {},
634
- fqdnTransformation: {
635
- paths: [],
636
- transformation: _fromVeloEntity,
637
- },
638
- customTransformation: requestTransformation,
639
- });
640
- const { fromJSON } = (0, velo_1.serializer)({
641
- rootSchema: _cancelReservationResponse,
642
- depSchemas: {},
643
- fqdnTransformation: {
644
- paths: [...['reservation']],
645
- transformation: _toVeloEntity,
646
- },
647
- customTransformation: responseTransformation,
648
- });
649
- const payload = toAmbassadorRequest([reservationId, revision, options]);
650
- const reqOpts = ambassadorWixTableReservationsV1Reservation.cancelReservation(payload);
651
- (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
652
- try {
653
- const result = yield httpClient.request(reqOpts);
654
- (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
655
- return fromJSON(result.data);
656
- }
657
- catch (err) {
658
- const transformedError = (0, transform_error_1.transformError)(err, {
659
- spreadPathsToArguments: {},
660
- explicitPathsToArguments: {
661
- reservationId: '$[0]',
662
- revision: '$[1]',
663
- phone: '$[2].phone',
664
- },
665
- singleArgumentUnchanged: false,
666
- }, ['reservationId', 'revision', 'options']);
667
- (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
668
- throw transformedError;
669
- }
670
- });
671
- }
672
- exports.cancelReservation = cancelReservation;
673
- /**
674
- * Retrieves a list of up to 100 reservations.
675
- * @public
676
- * @documentationMaturity preview
677
- * @param options - Options for listing the reservations.
678
- * @permissionScope Manage Reservations (Medium)
679
- * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-MEDIUM
680
- * @permissionScope Manage Reservations (Full)
681
- * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-FULL
682
- * @applicableIdentity APP
683
- */
684
- function listReservations(options) {
685
- var _a, _b, _c;
686
- return __awaiter(this, arguments, void 0, function* () {
687
- const requestTransformation = {
688
- paging: '$[0].paging',
689
- sort: '$[0].sort',
690
- startDateFrom: '$[0].startDateFrom',
691
- startDateTo: '$[0].startDateTo',
692
- status: '$[0].status',
693
- };
694
- const responseTransformation = '$';
695
- // @ts-ignore
696
- const { httpClient, sideEffects } = arguments[1];
697
- const { toAmbassadorRequest } = (0, velo_1.serializer)({
698
- rootSchema: _listReservationsRequest,
699
- depSchemas: {},
700
- fqdnTransformation: {
701
- paths: [],
702
- transformation: _fromVeloEntity,
703
- },
704
- customTransformation: requestTransformation,
705
- });
706
- const { fromJSON } = (0, velo_1.serializer)({
707
- rootSchema: _listReservationsResponse,
708
- depSchemas: {},
709
- fqdnTransformation: {
710
- paths: [...['Array#reservations']],
711
- transformation: _toVeloEntity,
712
- },
713
- customTransformation: responseTransformation,
714
- });
715
- const payload = toAmbassadorRequest([options]);
716
- const reqOpts = ambassadorWixTableReservationsV1Reservation.listReservations(payload);
717
- (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
718
- try {
719
- const result = yield httpClient.request(reqOpts);
720
- (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
721
- return fromJSON(result.data);
722
- }
723
- catch (err) {
724
- const transformedError = (0, transform_error_1.transformError)(err, {
725
- spreadPathsToArguments: {},
726
- explicitPathsToArguments: {
727
- paging: '$[0].paging',
728
- sort: '$[0].sort',
729
- startDateFrom: '$[0].startDateFrom',
730
- startDateTo: '$[0].startDateTo',
731
- status: '$[0].status',
732
- },
733
- singleArgumentUnchanged: false,
734
- }, ['options']);
735
- (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
736
- throw transformedError;
737
- }
738
- });
739
- }
740
- exports.listReservations = listReservations;
741
- /**
742
- * Creates a query to retrieve a list of reservations.
743
- *
744
- * The `queryReservations()` function builds a query to retrieve a list of reservations and returns a [`ReservationsQueryBuilder`](#ReservationsQueryBuilder) object.
745
- *
746
- * The returned object contains the query definition, which is used to run the query using the [find()](#ReservationsQueryBuilder/find) function.
747
- *
748
- * 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.
749
- *
750
- * `queryReservations()` runs with the following `ReservationsQueryBuilder` defaults, which you can override:
751
- *
752
- * * [`skip(0)`](#ReservationsQueryBuilder/skip)
753
- * * [`limit(50)`](#ReservationsQueryBuilder/limit)
754
- * * [`descending('_createdDate')`](#ReservationsQueryBuilder/descending)
755
- *
756
- * The following `ReservationsQueryBuilder` functions are supported for `queryReservations()`. For a full description of the reservation object, see the object returned for the [`items`](#ReservationsQueryResult/items) property in [`ReservationsQueryResult`](#ReservationsQueryResult).
757
- * @public
758
- * @documentationMaturity preview
759
- * @permissionScope Manage Reservations (Medium)
760
- * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-MEDIUM
761
- * @permissionScope Manage Reservations (Full)
762
- * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-FULL
763
- * @applicableIdentity APP
764
- */
765
- function queryReservations() {
766
- const requestTransformation = { '*': '$[1]', query: '$[0]' };
767
- const responseTransformation = {
768
- items: '$.reservations',
769
- pagingMetadata: '$.pagingMetadata',
770
- };
771
- // @ts-ignore
772
- const { httpClient, sideEffects } = arguments[0];
773
- const { toAmbassadorRequest } = (0, velo_1.serializer)({
774
- rootSchema: _queryReservationsRequest,
775
- depSchemas: {},
776
- fqdnTransformation: {
777
- paths: [],
778
- transformation: _fromVeloEntity,
779
- },
780
- customTransformation: requestTransformation,
781
- });
782
- const { fromJSON } = (0, velo_1.serializer)({
783
- rootSchema: _queryReservationsResponse,
784
- depSchemas: {},
785
- fqdnTransformation: {
786
- paths: [...['Array#reservations']],
787
- transformation: _toVeloEntity,
788
- },
789
- customTransformation: responseTransformation,
790
- });
791
- return (0, motion_edm_autogen_query_wrapper_1.wrapWithQueryBuilder)({
792
- func: (payload) => __awaiter(this, void 0, void 0, function* () {
793
- var _a, _b, _c;
794
- const reqOpts = ambassadorWixTableReservationsV1Reservation.queryReservations(payload);
795
- (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
796
- try {
797
- const result = yield httpClient.request(reqOpts);
798
- (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
799
- return result;
800
- }
801
- catch (err) {
802
- (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
803
- throw err;
804
- }
805
- }),
806
- requestTransformer: (...args) => toAmbassadorRequest(args),
807
- responseTransformer: ({ data }) => fromJSON(data),
808
- errorTransformer: (err) => {
809
- const transformedError = (0, velo_1.transformError)(err, requestTransformation);
810
- throw transformedError;
811
- },
812
- pagingMethod: 'CURSOR',
813
- transformationPaths: (0, velo_1.resolveQueryFieldsTransformationPaths)(_toVeloEntity),
814
- })({ cursorWithEmptyFilterAndSort: true });
815
- }
816
- exports.queryReservations = queryReservations;
817
- /** @param search - Search query.
818
- * @public
819
- * @documentationMaturity preview
820
- * @requiredField search
821
- * @permissionScope Manage Reservations (Medium)
822
- * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-MEDIUM
823
- * @permissionScope Manage Reservations (Full)
824
- * @permissionScopeId SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-FULL
825
- * @applicableIdentity APP
826
- */
827
- function searchReservations(search) {
828
- var _a, _b, _c;
829
- return __awaiter(this, arguments, void 0, function* () {
830
- const requestTransformation = { search: '$[0]' };
831
- const responseTransformation = '$';
832
- // @ts-ignore
833
- const { httpClient, sideEffects } = arguments[1];
834
- const { toAmbassadorRequest } = (0, velo_1.serializer)({
835
- rootSchema: _searchReservationsRequest,
836
- depSchemas: {},
837
- fqdnTransformation: {
838
- paths: [],
839
- transformation: _fromVeloEntity,
840
- },
841
- customTransformation: requestTransformation,
842
- });
843
- const { fromJSON } = (0, velo_1.serializer)({
844
- rootSchema: _searchReservationsResponse,
845
- depSchemas: {},
846
- fqdnTransformation: {
847
- paths: [...['Array#reservations']],
848
- transformation: _toVeloEntity,
849
- },
850
- customTransformation: responseTransformation,
851
- });
852
- const payload = toAmbassadorRequest([search]);
853
- const reqOpts = ambassadorWixTableReservationsV1Reservation.searchReservations(payload);
854
- (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
855
- try {
856
- const result = yield httpClient.request(reqOpts);
857
- (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
858
- return fromJSON(result.data);
859
- }
860
- catch (err) {
861
- const transformedError = (0, transform_error_1.transformError)(err, {
862
- spreadPathsToArguments: {},
863
- explicitPathsToArguments: { search: '$[0]' },
864
- singleArgumentUnchanged: false,
865
- }, ['search']);
866
- (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
867
- throw transformedError;
868
- }
869
- });
870
- }
871
- exports.searchReservations = searchReservations;
872
- //# sourceMappingURL=table-reservations-v1-reservation.universal.js.map