@wix/bookings 1.0.71 → 1.0.73
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.
- package/build/cjs/index.d.ts +1 -0
- package/build/cjs/index.js +2 -1
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/src/bookings-calendar-v2-external-calendar.http.d.ts +121 -0
- package/build/cjs/src/bookings-calendar-v2-external-calendar.http.js +347 -0
- package/build/cjs/src/bookings-calendar-v2-external-calendar.http.js.map +1 -0
- package/build/cjs/src/bookings-calendar-v2-external-calendar.public.d.ts +13 -0
- package/build/cjs/src/bookings-calendar-v2-external-calendar.public.js +79 -0
- package/build/cjs/src/bookings-calendar-v2-external-calendar.public.js.map +1 -0
- package/build/cjs/src/bookings-calendar-v2-external-calendar.types.d.ts +1444 -0
- package/build/cjs/src/bookings-calendar-v2-external-calendar.types.js +209 -0
- package/build/cjs/src/bookings-calendar-v2-external-calendar.types.js.map +1 -0
- package/build/cjs/src/bookings-calendar-v2-external-calendar.universal.d.ts +1678 -0
- package/build/cjs/src/bookings-calendar-v2-external-calendar.universal.js +858 -0
- package/build/cjs/src/bookings-calendar-v2-external-calendar.universal.js.map +1 -0
- package/build/cjs/src/bookings-v2-booking.http.d.ts +3 -3
- package/build/cjs/src/bookings-v2-booking.http.js +3 -3
- package/build/cjs/src/bookings-v2-booking.universal.d.ts +3 -3
- package/build/cjs/src/bookings-v2-booking.universal.js +3 -3
- package/build/es/index.d.ts +1 -0
- package/build/es/index.js +1 -0
- package/build/es/index.js.map +1 -1
- package/build/es/src/bookings-calendar-v2-external-calendar.http.d.ts +121 -0
- package/build/es/src/bookings-calendar-v2-external-calendar.http.js +335 -0
- package/build/es/src/bookings-calendar-v2-external-calendar.http.js.map +1 -0
- package/build/es/src/bookings-calendar-v2-external-calendar.public.d.ts +13 -0
- package/build/es/src/bookings-calendar-v2-external-calendar.public.js +48 -0
- package/build/es/src/bookings-calendar-v2-external-calendar.public.js.map +1 -0
- package/build/es/src/bookings-calendar-v2-external-calendar.types.d.ts +1444 -0
- package/build/es/src/bookings-calendar-v2-external-calendar.types.js +206 -0
- package/build/es/src/bookings-calendar-v2-external-calendar.types.js.map +1 -0
- package/build/es/src/bookings-calendar-v2-external-calendar.universal.d.ts +1678 -0
- package/build/es/src/bookings-calendar-v2-external-calendar.universal.js +827 -0
- package/build/es/src/bookings-calendar-v2-external-calendar.universal.js.map +1 -0
- package/build/es/src/bookings-v2-booking.http.d.ts +3 -3
- package/build/es/src/bookings-v2-booking.http.js +3 -3
- package/build/es/src/bookings-v2-booking.universal.d.ts +3 -3
- package/build/es/src/bookings-v2-booking.universal.js +3 -3
- package/package.json +2 -2
|
@@ -0,0 +1,858 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
22
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
23
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
24
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
25
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
26
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
27
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
+
exports.listEvents = exports.disconnect = exports.updateSyncConfig = exports.listCalendars = exports.connectByCredentials = exports.connectByOAuth = exports.listConnections = exports.getConnection = exports.listProviders = exports.SessionType = exports.SessionStatus = exports.ConferenceType = exports.ScheduleStatus = exports.ApprovalStatus = exports.DayOfWeek = exports.LocationsLocationType = exports.LocationStatus = exports.LocationType = exports.RecurringIntervalType = exports.Transparency = exports.Day = exports.SyncToErrorReason = exports.ErrorReason = exports.Status = exports.SyncToCalendar = exports.ListEventFromCalendars = exports.ConnectMethod = exports.CalendarType = exports.__debug = void 0;
|
|
32
|
+
const velo_1 = require("@wix/metro-runtime/velo");
|
|
33
|
+
const ambassadorWixBookingsCalendarV2ExternalCalendar = __importStar(require("./bookings-calendar-v2-external-calendar.http"));
|
|
34
|
+
let __verbose = false;
|
|
35
|
+
function __log(...args) {
|
|
36
|
+
__verbose && console.log(...args);
|
|
37
|
+
}
|
|
38
|
+
function __inspect(obj) {
|
|
39
|
+
return obj;
|
|
40
|
+
}
|
|
41
|
+
exports.__debug = {
|
|
42
|
+
verboseLogging: {
|
|
43
|
+
on: () => (__verbose = true),
|
|
44
|
+
off: () => (__verbose = false),
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
const _toVeloEntity = '$';
|
|
48
|
+
const _fromVeloEntity = '$';
|
|
49
|
+
var CalendarType;
|
|
50
|
+
(function (CalendarType) {
|
|
51
|
+
CalendarType["UNDEFINED"] = "UNDEFINED";
|
|
52
|
+
CalendarType["GOOGLE"] = "GOOGLE";
|
|
53
|
+
CalendarType["I_CAL"] = "I_CAL";
|
|
54
|
+
/** Use `MICROSOFT` instead. */
|
|
55
|
+
CalendarType["OUTLOOK"] = "OUTLOOK";
|
|
56
|
+
/** Use `MICROSOFT` instead. */
|
|
57
|
+
CalendarType["OFFICE_365"] = "OFFICE_365";
|
|
58
|
+
CalendarType["MICROSOFT"] = "MICROSOFT";
|
|
59
|
+
CalendarType["OTHER"] = "OTHER";
|
|
60
|
+
})(CalendarType = exports.CalendarType || (exports.CalendarType = {}));
|
|
61
|
+
var ConnectMethod;
|
|
62
|
+
(function (ConnectMethod) {
|
|
63
|
+
ConnectMethod["UNDEFINED"] = "UNDEFINED";
|
|
64
|
+
ConnectMethod["OAUTH"] = "OAUTH";
|
|
65
|
+
ConnectMethod["CREDENTIALS"] = "CREDENTIALS";
|
|
66
|
+
})(ConnectMethod = exports.ConnectMethod || (exports.ConnectMethod = {}));
|
|
67
|
+
var ListEventFromCalendars;
|
|
68
|
+
(function (ListEventFromCalendars) {
|
|
69
|
+
/** Dont use. */
|
|
70
|
+
ListEventFromCalendars["UNDEFINED"] = "UNDEFINED";
|
|
71
|
+
/** Listing events from the external calendar is not supported. */
|
|
72
|
+
ListEventFromCalendars["NOT_SUPPORTED"] = "NOT_SUPPORTED";
|
|
73
|
+
/** Listing events from the primary external calendar only. */
|
|
74
|
+
ListEventFromCalendars["PRIMARY_CALENDAR_ONLY"] = "PRIMARY_CALENDAR_ONLY";
|
|
75
|
+
/**
|
|
76
|
+
* Listing events from specific external calendars.
|
|
77
|
+
* The external calendars can be listed using the `ExternalCalendarService.ListCalendars` API.
|
|
78
|
+
*/
|
|
79
|
+
ListEventFromCalendars["SPECIFIC_CALENDARS"] = "SPECIFIC_CALENDARS";
|
|
80
|
+
})(ListEventFromCalendars = exports.ListEventFromCalendars || (exports.ListEventFromCalendars = {}));
|
|
81
|
+
var SyncToCalendar;
|
|
82
|
+
(function (SyncToCalendar) {
|
|
83
|
+
/** Dont use. */
|
|
84
|
+
SyncToCalendar["UNDEFINED"] = "UNDEFINED";
|
|
85
|
+
/** Syncing Wix calendar sessions to the external calendar is not supported. */
|
|
86
|
+
SyncToCalendar["NOT_SUPPORTED"] = "NOT_SUPPORTED";
|
|
87
|
+
/** Syncing Wix calendar sessions to the primary external calendar only. */
|
|
88
|
+
SyncToCalendar["PRIMARY_CALENDAR_ONLY"] = "PRIMARY_CALENDAR_ONLY";
|
|
89
|
+
/** Syncing Wix calendar sessions to a specific external calendar. */
|
|
90
|
+
SyncToCalendar["SPECIFIC_CALENDAR"] = "SPECIFIC_CALENDAR";
|
|
91
|
+
/** Syncing Wix calendar sessions to a new external calendar. */
|
|
92
|
+
SyncToCalendar["DEDICATED_CALENDAR"] = "DEDICATED_CALENDAR";
|
|
93
|
+
})(SyncToCalendar = exports.SyncToCalendar || (exports.SyncToCalendar = {}));
|
|
94
|
+
var Status;
|
|
95
|
+
(function (Status) {
|
|
96
|
+
/** Dont use. */
|
|
97
|
+
Status["UNDEFINED"] = "UNDEFINED";
|
|
98
|
+
/** External calendar is connected to the corresponding schedule id. */
|
|
99
|
+
Status["CONNECTED"] = "CONNECTED";
|
|
100
|
+
/** Sync in progress. */
|
|
101
|
+
Status["SYNC_IN_PROGRESS"] = "SYNC_IN_PROGRESS";
|
|
102
|
+
/** Calendars are in-sync. */
|
|
103
|
+
Status["SYNCED"] = "SYNCED";
|
|
104
|
+
/** External calender is disconnected. */
|
|
105
|
+
Status["DISCONNECTED"] = "DISCONNECTED";
|
|
106
|
+
/** The calendars sync is in error state. */
|
|
107
|
+
Status["ERROR"] = "ERROR";
|
|
108
|
+
})(Status = exports.Status || (exports.Status = {}));
|
|
109
|
+
var ErrorReason;
|
|
110
|
+
(function (ErrorReason) {
|
|
111
|
+
/** Empty or error reason is unknown. */
|
|
112
|
+
ErrorReason["UNDEFINED"] = "UNDEFINED";
|
|
113
|
+
/** External calendar access token revoked. */
|
|
114
|
+
ErrorReason["TOKEN_REVOKED"] = "TOKEN_REVOKED";
|
|
115
|
+
/** External calendar creation failed. */
|
|
116
|
+
ErrorReason["EXTERNAL_CALENDAR_CREATION_FAILED"] = "EXTERNAL_CALENDAR_CREATION_FAILED";
|
|
117
|
+
/** External Calendar was deleted. */
|
|
118
|
+
ErrorReason["EXTERNAL_CALENDAR_DELETED"] = "EXTERNAL_CALENDAR_DELETED";
|
|
119
|
+
})(ErrorReason = exports.ErrorReason || (exports.ErrorReason = {}));
|
|
120
|
+
var SyncToErrorReason;
|
|
121
|
+
(function (SyncToErrorReason) {
|
|
122
|
+
/** No sync error. */
|
|
123
|
+
SyncToErrorReason["UNDEFINED"] = "UNDEFINED";
|
|
124
|
+
/** Could not create calendar to sync sessions to. */
|
|
125
|
+
SyncToErrorReason["CALENDAR_CREATION_FAILURE"] = "CALENDAR_CREATION_FAILURE";
|
|
126
|
+
/** Calendar was deleted while sync was in progress. */
|
|
127
|
+
SyncToErrorReason["CALENDAR_DELETED"] = "CALENDAR_DELETED";
|
|
128
|
+
})(SyncToErrorReason = exports.SyncToErrorReason || (exports.SyncToErrorReason = {}));
|
|
129
|
+
var Day;
|
|
130
|
+
(function (Day) {
|
|
131
|
+
/** Undefined. */
|
|
132
|
+
Day["UNDEFINED"] = "UNDEFINED";
|
|
133
|
+
/** Monday. */
|
|
134
|
+
Day["MON"] = "MON";
|
|
135
|
+
/** Tuesday. */
|
|
136
|
+
Day["TUE"] = "TUE";
|
|
137
|
+
/** Wednesday. */
|
|
138
|
+
Day["WED"] = "WED";
|
|
139
|
+
/** Thursday. */
|
|
140
|
+
Day["THU"] = "THU";
|
|
141
|
+
/** Friday. */
|
|
142
|
+
Day["FRI"] = "FRI";
|
|
143
|
+
/** Saturday. */
|
|
144
|
+
Day["SAT"] = "SAT";
|
|
145
|
+
/** Sunday. */
|
|
146
|
+
Day["SUN"] = "SUN";
|
|
147
|
+
})(Day = exports.Day || (exports.Day = {}));
|
|
148
|
+
var Transparency;
|
|
149
|
+
(function (Transparency) {
|
|
150
|
+
Transparency["UNDEFINED"] = "UNDEFINED";
|
|
151
|
+
/** The schedule can have available slots during the session. */
|
|
152
|
+
Transparency["FREE"] = "FREE";
|
|
153
|
+
/** The schedule cannot have available slots during the session. Default value. */
|
|
154
|
+
Transparency["BUSY"] = "BUSY";
|
|
155
|
+
})(Transparency = exports.Transparency || (exports.Transparency = {}));
|
|
156
|
+
var RecurringIntervalType;
|
|
157
|
+
(function (RecurringIntervalType) {
|
|
158
|
+
/** The default value. Sessions for this interval will be of type EVENT. */
|
|
159
|
+
RecurringIntervalType["UNDEFINED"] = "UNDEFINED";
|
|
160
|
+
/** A recurring interval of events */
|
|
161
|
+
RecurringIntervalType["EVENT"] = "EVENT";
|
|
162
|
+
/** Deprecated */
|
|
163
|
+
RecurringIntervalType["TIME_AVAILABILITY"] = "TIME_AVAILABILITY";
|
|
164
|
+
/** A recurring interval for availability */
|
|
165
|
+
RecurringIntervalType["AVAILABILITY"] = "AVAILABILITY";
|
|
166
|
+
})(RecurringIntervalType = exports.RecurringIntervalType || (exports.RecurringIntervalType = {}));
|
|
167
|
+
var LocationType;
|
|
168
|
+
(function (LocationType) {
|
|
169
|
+
LocationType["UNDEFINED"] = "UNDEFINED";
|
|
170
|
+
LocationType["OWNER_BUSINESS"] = "OWNER_BUSINESS";
|
|
171
|
+
LocationType["OWNER_CUSTOM"] = "OWNER_CUSTOM";
|
|
172
|
+
LocationType["CUSTOM"] = "CUSTOM";
|
|
173
|
+
})(LocationType = exports.LocationType || (exports.LocationType = {}));
|
|
174
|
+
/** For future use */
|
|
175
|
+
var LocationStatus;
|
|
176
|
+
(function (LocationStatus) {
|
|
177
|
+
LocationStatus["ACTIVE"] = "ACTIVE";
|
|
178
|
+
LocationStatus["INACTIVE"] = "INACTIVE";
|
|
179
|
+
})(LocationStatus = exports.LocationStatus || (exports.LocationStatus = {}));
|
|
180
|
+
/** For future use */
|
|
181
|
+
var LocationsLocationType;
|
|
182
|
+
(function (LocationsLocationType) {
|
|
183
|
+
LocationsLocationType["UNKNOWN"] = "UNKNOWN";
|
|
184
|
+
LocationsLocationType["BRANCH"] = "BRANCH";
|
|
185
|
+
LocationsLocationType["OFFICES"] = "OFFICES";
|
|
186
|
+
LocationsLocationType["RECEPTION"] = "RECEPTION";
|
|
187
|
+
LocationsLocationType["HEADQUARTERS"] = "HEADQUARTERS";
|
|
188
|
+
})(LocationsLocationType = exports.LocationsLocationType || (exports.LocationsLocationType = {}));
|
|
189
|
+
/** Enumerates the days of the week. */
|
|
190
|
+
var DayOfWeek;
|
|
191
|
+
(function (DayOfWeek) {
|
|
192
|
+
DayOfWeek["MONDAY"] = "MONDAY";
|
|
193
|
+
DayOfWeek["TUESDAY"] = "TUESDAY";
|
|
194
|
+
DayOfWeek["WEDNESDAY"] = "WEDNESDAY";
|
|
195
|
+
DayOfWeek["THURSDAY"] = "THURSDAY";
|
|
196
|
+
DayOfWeek["FRIDAY"] = "FRIDAY";
|
|
197
|
+
DayOfWeek["SATURDAY"] = "SATURDAY";
|
|
198
|
+
DayOfWeek["SUNDAY"] = "SUNDAY";
|
|
199
|
+
})(DayOfWeek = exports.DayOfWeek || (exports.DayOfWeek = {}));
|
|
200
|
+
var ApprovalStatus;
|
|
201
|
+
(function (ApprovalStatus) {
|
|
202
|
+
/** Default. */
|
|
203
|
+
ApprovalStatus["UNDEFINED"] = "UNDEFINED";
|
|
204
|
+
/** Pending business approval. */
|
|
205
|
+
ApprovalStatus["PENDING"] = "PENDING";
|
|
206
|
+
/** Approved by the business. */
|
|
207
|
+
ApprovalStatus["APPROVED"] = "APPROVED";
|
|
208
|
+
/** Declined by the business. */
|
|
209
|
+
ApprovalStatus["DECLINED"] = "DECLINED";
|
|
210
|
+
})(ApprovalStatus = exports.ApprovalStatus || (exports.ApprovalStatus = {}));
|
|
211
|
+
var ScheduleStatus;
|
|
212
|
+
(function (ScheduleStatus) {
|
|
213
|
+
ScheduleStatus["UNDEFINED"] = "UNDEFINED";
|
|
214
|
+
/** The default value when the schedule is created. */
|
|
215
|
+
ScheduleStatus["CREATED"] = "CREATED";
|
|
216
|
+
/** The schedule has been canceled. */
|
|
217
|
+
ScheduleStatus["CANCELLED"] = "CANCELLED";
|
|
218
|
+
})(ScheduleStatus = exports.ScheduleStatus || (exports.ScheduleStatus = {}));
|
|
219
|
+
var ConferenceType;
|
|
220
|
+
(function (ConferenceType) {
|
|
221
|
+
ConferenceType["UNDEFINED"] = "UNDEFINED";
|
|
222
|
+
/** API-generated online meeting. */
|
|
223
|
+
ConferenceType["ONLINE_MEETING_PROVIDER"] = "ONLINE_MEETING_PROVIDER";
|
|
224
|
+
/** User-defined meeting. */
|
|
225
|
+
ConferenceType["CUSTOM"] = "CUSTOM";
|
|
226
|
+
})(ConferenceType = exports.ConferenceType || (exports.ConferenceType = {}));
|
|
227
|
+
var SessionStatus;
|
|
228
|
+
(function (SessionStatus) {
|
|
229
|
+
SessionStatus["UNDEFINED"] = "UNDEFINED";
|
|
230
|
+
/** The session is confirmed. Default status. */
|
|
231
|
+
SessionStatus["CONFIRMED"] = "CONFIRMED";
|
|
232
|
+
/**
|
|
233
|
+
* The session is cancelled.
|
|
234
|
+
* A cancelled session can be the cancellation of a recurring session that should no longer be displayed or a deleted single session.
|
|
235
|
+
* The ListSessions returns cancelled sessions only if 'includeDelete' flag is set to true.
|
|
236
|
+
*/
|
|
237
|
+
SessionStatus["CANCELLED"] = "CANCELLED";
|
|
238
|
+
})(SessionStatus = exports.SessionStatus || (exports.SessionStatus = {}));
|
|
239
|
+
var SessionType;
|
|
240
|
+
(function (SessionType) {
|
|
241
|
+
SessionType["UNDEFINED"] = "UNDEFINED";
|
|
242
|
+
/**
|
|
243
|
+
* The session creates an event on the calendar for the owner of the schedule that the session belongs to.
|
|
244
|
+
* Default type.
|
|
245
|
+
*/
|
|
246
|
+
SessionType["EVENT"] = "EVENT";
|
|
247
|
+
/** The session represents a resource's available working hours. */
|
|
248
|
+
SessionType["WORKING_HOURS"] = "WORKING_HOURS";
|
|
249
|
+
/** Deprecated. please use WORKING_HOURS */
|
|
250
|
+
SessionType["TIME_AVAILABILITY"] = "TIME_AVAILABILITY";
|
|
251
|
+
/** Deprecated. The session represents a resource's available hours. please use WORKING_HOURS */
|
|
252
|
+
SessionType["AVAILABILITY"] = "AVAILABILITY";
|
|
253
|
+
})(SessionType = exports.SessionType || (exports.SessionType = {}));
|
|
254
|
+
const _connectByCredentialsRequest = {};
|
|
255
|
+
const _connectByCredentialsResponse = {};
|
|
256
|
+
const _connectByOAuthRequest = {};
|
|
257
|
+
const _connectByOAuthResponse = {};
|
|
258
|
+
const _disconnectRequest = {};
|
|
259
|
+
const _disconnectResponse = {};
|
|
260
|
+
const _getConnectionRequest = {};
|
|
261
|
+
const _getConnectionResponse = {};
|
|
262
|
+
const _listCalendarsRequest = {};
|
|
263
|
+
const _listCalendarsResponse = {};
|
|
264
|
+
const _listConnectionsRequest = {};
|
|
265
|
+
const _listConnectionsResponse = {};
|
|
266
|
+
const _listEventsRequest = {};
|
|
267
|
+
const _listEventsResponse = {};
|
|
268
|
+
const _listProvidersRequest = {};
|
|
269
|
+
const _listProvidersResponse = {};
|
|
270
|
+
const _updateSyncConfigRequest = {};
|
|
271
|
+
const _updateSyncConfigResponse = {};
|
|
272
|
+
/**
|
|
273
|
+
* Retrieves a list of the external calendar providers for which the site supports integration.
|
|
274
|
+
*
|
|
275
|
+
*
|
|
276
|
+
* The list of external calendar providers includes:
|
|
277
|
+
*
|
|
278
|
+
* + External calendar providers that are supported by default, such as Google, Apple, and Microsoft.
|
|
279
|
+
* + External calenders for which the site owner has enabled integration by installing an app.
|
|
280
|
+
*
|
|
281
|
+
* For each external calendar provider, the list contains information about supported connection methods and features.
|
|
282
|
+
* For each provider, check `features.connectMethods` to find out whether to use [Connect By Credentials](#connect-by-credentials) or [Connect By OAuth](#connect-by-o-auth) to establish a connection.
|
|
283
|
+
* @public
|
|
284
|
+
* @documentationMaturity preview
|
|
285
|
+
*/
|
|
286
|
+
function listProviders() {
|
|
287
|
+
var _a, _b, _c;
|
|
288
|
+
return __awaiter(this, arguments, void 0, function* () {
|
|
289
|
+
const requestTransformation = {};
|
|
290
|
+
const responseTransformation = '$';
|
|
291
|
+
// @ts-ignore
|
|
292
|
+
const { httpClient, sideEffects } = arguments[0];
|
|
293
|
+
const { toAmbassadorRequest } = (0, velo_1.serializer)({
|
|
294
|
+
rootSchema: _listProvidersRequest,
|
|
295
|
+
depSchemas: {},
|
|
296
|
+
fqdnTransformation: {
|
|
297
|
+
paths: [],
|
|
298
|
+
transformation: _fromVeloEntity,
|
|
299
|
+
},
|
|
300
|
+
customTransformation: requestTransformation,
|
|
301
|
+
});
|
|
302
|
+
const { fromJSON } = (0, velo_1.serializer)({
|
|
303
|
+
rootSchema: _listProvidersResponse,
|
|
304
|
+
depSchemas: {},
|
|
305
|
+
fqdnTransformation: {
|
|
306
|
+
paths: [],
|
|
307
|
+
transformation: _toVeloEntity,
|
|
308
|
+
},
|
|
309
|
+
customTransformation: responseTransformation,
|
|
310
|
+
});
|
|
311
|
+
const payload = toAmbassadorRequest([]);
|
|
312
|
+
const reqOpts = ambassadorWixBookingsCalendarV2ExternalCalendar.listProviders(payload);
|
|
313
|
+
__log(`"ListProviders" sending request with: ${__inspect(reqOpts)}`);
|
|
314
|
+
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
315
|
+
try {
|
|
316
|
+
const result = yield httpClient.request(reqOpts);
|
|
317
|
+
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
|
|
318
|
+
return fromJSON(result.data);
|
|
319
|
+
}
|
|
320
|
+
catch (err) {
|
|
321
|
+
const transformedError = (0, velo_1.transformError)(err, requestTransformation, []);
|
|
322
|
+
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
323
|
+
throw transformedError;
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
exports.listProviders = listProviders;
|
|
328
|
+
/**
|
|
329
|
+
* Retrieves an external calendar connection by ID.
|
|
330
|
+
*
|
|
331
|
+
*
|
|
332
|
+
* The external calendar connection contains details of the connection between a Wix site's calendar and calendars hosted by an external provider.
|
|
333
|
+
*
|
|
334
|
+
* The `syncConfig` property contains configuration details for importing events from an external calendar, exporting events to an external calendar, or both.
|
|
335
|
+
* @param connectionId - ID of the connection to retrieve.
|
|
336
|
+
* @public
|
|
337
|
+
* @documentationMaturity preview
|
|
338
|
+
* @requiredField connectionId
|
|
339
|
+
*/
|
|
340
|
+
function getConnection(connectionId) {
|
|
341
|
+
var _a, _b, _c;
|
|
342
|
+
return __awaiter(this, arguments, void 0, function* () {
|
|
343
|
+
const requestTransformation = { connectionId: '$[0]' };
|
|
344
|
+
const responseTransformation = '$';
|
|
345
|
+
// @ts-ignore
|
|
346
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
347
|
+
const { toAmbassadorRequest } = (0, velo_1.serializer)({
|
|
348
|
+
rootSchema: _getConnectionRequest,
|
|
349
|
+
depSchemas: {},
|
|
350
|
+
fqdnTransformation: {
|
|
351
|
+
paths: [],
|
|
352
|
+
transformation: _fromVeloEntity,
|
|
353
|
+
},
|
|
354
|
+
customTransformation: requestTransformation,
|
|
355
|
+
});
|
|
356
|
+
const { fromJSON } = (0, velo_1.serializer)({
|
|
357
|
+
rootSchema: _getConnectionResponse,
|
|
358
|
+
depSchemas: {},
|
|
359
|
+
fqdnTransformation: {
|
|
360
|
+
paths: [],
|
|
361
|
+
transformation: _toVeloEntity,
|
|
362
|
+
},
|
|
363
|
+
customTransformation: responseTransformation,
|
|
364
|
+
});
|
|
365
|
+
const payload = toAmbassadorRequest([connectionId]);
|
|
366
|
+
const reqOpts = ambassadorWixBookingsCalendarV2ExternalCalendar.getConnection(payload);
|
|
367
|
+
__log(`"GetConnection" sending request with: ${__inspect(reqOpts)}`);
|
|
368
|
+
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
369
|
+
try {
|
|
370
|
+
const result = yield httpClient.request(reqOpts);
|
|
371
|
+
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
|
|
372
|
+
return fromJSON(result.data);
|
|
373
|
+
}
|
|
374
|
+
catch (err) {
|
|
375
|
+
const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
|
|
376
|
+
'connectionId',
|
|
377
|
+
]);
|
|
378
|
+
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
379
|
+
throw transformedError;
|
|
380
|
+
}
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
exports.getConnection = getConnection;
|
|
384
|
+
/**
|
|
385
|
+
* Retrieves a list of external calendar connections.
|
|
386
|
+
*
|
|
387
|
+
*
|
|
388
|
+
* Each external calendar connections contains details of a connection between a Wix site's calendar and calendars hosted by an external provider.
|
|
389
|
+
*
|
|
390
|
+
* The `syncConfig` property of each connection contains configuration details for importing events from an external calendar, exporting events to an external calendar, or both.
|
|
391
|
+
* @public
|
|
392
|
+
* @documentationMaturity preview
|
|
393
|
+
*/
|
|
394
|
+
function listConnections(options) {
|
|
395
|
+
var _a, _b, _c;
|
|
396
|
+
return __awaiter(this, arguments, void 0, function* () {
|
|
397
|
+
const requestTransformation = {
|
|
398
|
+
scheduleIds: '$[0].scheduleIds',
|
|
399
|
+
partialFailure: '$[0].partialFailure',
|
|
400
|
+
};
|
|
401
|
+
const responseTransformation = '$';
|
|
402
|
+
// @ts-ignore
|
|
403
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
404
|
+
const { toAmbassadorRequest } = (0, velo_1.serializer)({
|
|
405
|
+
rootSchema: _listConnectionsRequest,
|
|
406
|
+
depSchemas: {},
|
|
407
|
+
fqdnTransformation: {
|
|
408
|
+
paths: [],
|
|
409
|
+
transformation: _fromVeloEntity,
|
|
410
|
+
},
|
|
411
|
+
customTransformation: requestTransformation,
|
|
412
|
+
});
|
|
413
|
+
const { fromJSON } = (0, velo_1.serializer)({
|
|
414
|
+
rootSchema: _listConnectionsResponse,
|
|
415
|
+
depSchemas: {},
|
|
416
|
+
fqdnTransformation: {
|
|
417
|
+
paths: [],
|
|
418
|
+
transformation: _toVeloEntity,
|
|
419
|
+
},
|
|
420
|
+
customTransformation: responseTransformation,
|
|
421
|
+
});
|
|
422
|
+
const payload = toAmbassadorRequest([options]);
|
|
423
|
+
const reqOpts = ambassadorWixBookingsCalendarV2ExternalCalendar.listConnections(payload);
|
|
424
|
+
__log(`"ListConnections" sending request with: ${__inspect(reqOpts)}`);
|
|
425
|
+
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
426
|
+
try {
|
|
427
|
+
const result = yield httpClient.request(reqOpts);
|
|
428
|
+
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
|
|
429
|
+
return fromJSON(result.data);
|
|
430
|
+
}
|
|
431
|
+
catch (err) {
|
|
432
|
+
const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
|
|
433
|
+
'options',
|
|
434
|
+
]);
|
|
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.listConnections = listConnections;
|
|
441
|
+
/**
|
|
442
|
+
* Connects to an external calendar using the OAuth authorization protocol.
|
|
443
|
+
*
|
|
444
|
+
*
|
|
445
|
+
* The authorization flow should take place as follows:
|
|
446
|
+
*
|
|
447
|
+
* 1. Send a request to the endpoint with the appropriate parameters.
|
|
448
|
+
* 2. Redirect the user to the URL received in the response.
|
|
449
|
+
* 3. The user authorizes access.
|
|
450
|
+
* 4. The user is redirected to the URL you provide in the `redirectUrl` body parameter, with a query parameter `connectionId` containing the new connection ID.
|
|
451
|
+
*
|
|
452
|
+
* If the attempt to connect fails, the user is still redirected to the URL you provide in the `redirectUrl` body parameter,
|
|
453
|
+
* but with a query parameter `error` containing one of the following values:
|
|
454
|
+
*
|
|
455
|
+
* - `reject`: The user rejected the authorization request.
|
|
456
|
+
* - `unsupported`: Connecting to the user's external account type is not supported by the provider.
|
|
457
|
+
* - `internal`: An error unrelated to the client or the request that prevents the server from fulfilling the request.
|
|
458
|
+
*
|
|
459
|
+
* Once a connection is successfully created, use [List Events](#list-events) to obtain an up-to-date list of events in the connected external calendars.
|
|
460
|
+
*
|
|
461
|
+
* This endpoint validates that the specified schedule is owned by the Wix user connecting the calendar,
|
|
462
|
+
* or that the caller has the Manage External Calendars or Manage Business Calendar permission scope.
|
|
463
|
+
*
|
|
464
|
+
* If the schedule's ownership changes, the connection to the external calendar is automatically disconnected.
|
|
465
|
+
*
|
|
466
|
+
* > **Note:**
|
|
467
|
+
* > Use [List Providers](#list-providers) to find out whether to connect to a particular provider using this endpoint or [Connect by Credentials](#connect-by-credentials).
|
|
468
|
+
* @param providerId - ID of the external calendar provider. Find this with the [List Providers](#list-providers) endpoint.
|
|
469
|
+
* @param scheduleId - ID of the schedule to connect with the external calendar account.
|
|
470
|
+
* @param redirectUrl - URL to redirect the user to after they authorize access to the external calendar account.
|
|
471
|
+
*
|
|
472
|
+
* If the connection is successfully established, the user is redirected to this URL with a query parameter `connectionId` containing the new connection ID.
|
|
473
|
+
* If the attempt to connect fails, the user is redirected to this URL with a query parameter `error` containing the error type.
|
|
474
|
+
* @public
|
|
475
|
+
* @documentationMaturity preview
|
|
476
|
+
* @requiredField providerId
|
|
477
|
+
* @requiredField redirectUrl
|
|
478
|
+
* @requiredField scheduleId
|
|
479
|
+
*/
|
|
480
|
+
function connectByOAuth(providerId, scheduleId, redirectUrl) {
|
|
481
|
+
var _a, _b, _c;
|
|
482
|
+
return __awaiter(this, arguments, void 0, function* () {
|
|
483
|
+
const requestTransformation = {
|
|
484
|
+
providerId: '$[0]',
|
|
485
|
+
scheduleId: '$[1]',
|
|
486
|
+
redirectUrl: '$[2]',
|
|
487
|
+
};
|
|
488
|
+
const responseTransformation = '$';
|
|
489
|
+
// @ts-ignore
|
|
490
|
+
const { httpClient, sideEffects } = arguments[3];
|
|
491
|
+
const { toAmbassadorRequest } = (0, velo_1.serializer)({
|
|
492
|
+
rootSchema: _connectByOAuthRequest,
|
|
493
|
+
depSchemas: {},
|
|
494
|
+
fqdnTransformation: {
|
|
495
|
+
paths: [],
|
|
496
|
+
transformation: _fromVeloEntity,
|
|
497
|
+
},
|
|
498
|
+
customTransformation: requestTransformation,
|
|
499
|
+
});
|
|
500
|
+
const { fromJSON } = (0, velo_1.serializer)({
|
|
501
|
+
rootSchema: _connectByOAuthResponse,
|
|
502
|
+
depSchemas: {},
|
|
503
|
+
fqdnTransformation: {
|
|
504
|
+
paths: [],
|
|
505
|
+
transformation: _toVeloEntity,
|
|
506
|
+
},
|
|
507
|
+
customTransformation: responseTransformation,
|
|
508
|
+
});
|
|
509
|
+
const payload = toAmbassadorRequest([providerId, scheduleId, redirectUrl]);
|
|
510
|
+
const reqOpts = ambassadorWixBookingsCalendarV2ExternalCalendar.connectByOAuth(payload);
|
|
511
|
+
__log(`"ConnectByOAuth" sending request with: ${__inspect(reqOpts)}`);
|
|
512
|
+
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
513
|
+
try {
|
|
514
|
+
const result = yield httpClient.request(reqOpts);
|
|
515
|
+
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
|
|
516
|
+
return fromJSON(result.data);
|
|
517
|
+
}
|
|
518
|
+
catch (err) {
|
|
519
|
+
const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
|
|
520
|
+
'providerId',
|
|
521
|
+
'scheduleId',
|
|
522
|
+
'redirectUrl',
|
|
523
|
+
]);
|
|
524
|
+
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
525
|
+
throw transformedError;
|
|
526
|
+
}
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
exports.connectByOAuth = connectByOAuth;
|
|
530
|
+
/**
|
|
531
|
+
* Connects to an external calendar by directly providing the external calendar account credentials.
|
|
532
|
+
*
|
|
533
|
+
*
|
|
534
|
+
* Once a connection is successfully created, use [List Events](#list-events) to obtain an up-to-date list of events in the connected external calendars.
|
|
535
|
+
*
|
|
536
|
+
* This endpoint validates that the specified schedule is owned by the Wix user connecting the calendar,
|
|
537
|
+
* or that the caller has the Manage External Calendars or Manage Business Calendar permission scope.
|
|
538
|
+
*
|
|
539
|
+
* If the schedule's ownership changes, the connection to the external calendar is automatically disconnected.
|
|
540
|
+
*
|
|
541
|
+
* > **Note:**
|
|
542
|
+
* > Use [List Providers](#list-providers) to find out whether to connect to a particular provider using this endpoint or [Connect by OAuth](#connect-by-o-auth).
|
|
543
|
+
* @param providerId - ID of the external calendar provider. Find this with the [List Providers](#list-providers) endpoint.
|
|
544
|
+
* @param scheduleId - ID of the schedule to connect with the external calendar account.
|
|
545
|
+
* @param email - Email address for the external calendar account.
|
|
546
|
+
* @param password - Password for the external calendar account.
|
|
547
|
+
* @public
|
|
548
|
+
* @documentationMaturity preview
|
|
549
|
+
* @requiredField email
|
|
550
|
+
* @requiredField password
|
|
551
|
+
* @requiredField providerId
|
|
552
|
+
* @requiredField scheduleId
|
|
553
|
+
*/
|
|
554
|
+
function connectByCredentials(providerId, scheduleId, email, password) {
|
|
555
|
+
var _a, _b, _c;
|
|
556
|
+
return __awaiter(this, arguments, void 0, function* () {
|
|
557
|
+
const requestTransformation = {
|
|
558
|
+
providerId: '$[0]',
|
|
559
|
+
scheduleId: '$[1]',
|
|
560
|
+
email: '$[2]',
|
|
561
|
+
password: '$[3]',
|
|
562
|
+
};
|
|
563
|
+
const responseTransformation = '$';
|
|
564
|
+
// @ts-ignore
|
|
565
|
+
const { httpClient, sideEffects } = arguments[4];
|
|
566
|
+
const { toAmbassadorRequest } = (0, velo_1.serializer)({
|
|
567
|
+
rootSchema: _connectByCredentialsRequest,
|
|
568
|
+
depSchemas: {},
|
|
569
|
+
fqdnTransformation: {
|
|
570
|
+
paths: [],
|
|
571
|
+
transformation: _fromVeloEntity,
|
|
572
|
+
},
|
|
573
|
+
customTransformation: requestTransformation,
|
|
574
|
+
});
|
|
575
|
+
const { fromJSON } = (0, velo_1.serializer)({
|
|
576
|
+
rootSchema: _connectByCredentialsResponse,
|
|
577
|
+
depSchemas: {},
|
|
578
|
+
fqdnTransformation: {
|
|
579
|
+
paths: [],
|
|
580
|
+
transformation: _toVeloEntity,
|
|
581
|
+
},
|
|
582
|
+
customTransformation: responseTransformation,
|
|
583
|
+
});
|
|
584
|
+
const payload = toAmbassadorRequest([
|
|
585
|
+
providerId,
|
|
586
|
+
scheduleId,
|
|
587
|
+
email,
|
|
588
|
+
password,
|
|
589
|
+
]);
|
|
590
|
+
const reqOpts = ambassadorWixBookingsCalendarV2ExternalCalendar.connectByCredentials(payload);
|
|
591
|
+
__log(`"ConnectByCredentials" sending request with: ${__inspect(reqOpts)}`);
|
|
592
|
+
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
593
|
+
try {
|
|
594
|
+
const result = yield httpClient.request(reqOpts);
|
|
595
|
+
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
|
|
596
|
+
return fromJSON(result.data);
|
|
597
|
+
}
|
|
598
|
+
catch (err) {
|
|
599
|
+
const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
|
|
600
|
+
'providerId',
|
|
601
|
+
'scheduleId',
|
|
602
|
+
'email',
|
|
603
|
+
'password',
|
|
604
|
+
]);
|
|
605
|
+
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
606
|
+
throw transformedError;
|
|
607
|
+
}
|
|
608
|
+
});
|
|
609
|
+
}
|
|
610
|
+
exports.connectByCredentials = connectByCredentials;
|
|
611
|
+
/**
|
|
612
|
+
* Retrieves a list of calendars belonging to the connected external calendar account.
|
|
613
|
+
*
|
|
614
|
+
*
|
|
615
|
+
* > **Note:**
|
|
616
|
+
* > Before using this endpoint, establish a connection with an external calendar using [Connect By Credentials](#connect-by-credentials) or [Connect By OAuth](#connect-by-o-auth).
|
|
617
|
+
* @param connectionId - ID of the external calendar connection to list calendars for.
|
|
618
|
+
* @public
|
|
619
|
+
* @documentationMaturity preview
|
|
620
|
+
* @requiredField connectionId
|
|
621
|
+
*/
|
|
622
|
+
function listCalendars(connectionId) {
|
|
623
|
+
var _a, _b, _c;
|
|
624
|
+
return __awaiter(this, arguments, void 0, function* () {
|
|
625
|
+
const requestTransformation = { connectionId: '$[0]' };
|
|
626
|
+
const responseTransformation = '$';
|
|
627
|
+
// @ts-ignore
|
|
628
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
629
|
+
const { toAmbassadorRequest } = (0, velo_1.serializer)({
|
|
630
|
+
rootSchema: _listCalendarsRequest,
|
|
631
|
+
depSchemas: {},
|
|
632
|
+
fqdnTransformation: {
|
|
633
|
+
paths: [],
|
|
634
|
+
transformation: _fromVeloEntity,
|
|
635
|
+
},
|
|
636
|
+
customTransformation: requestTransformation,
|
|
637
|
+
});
|
|
638
|
+
const { fromJSON } = (0, velo_1.serializer)({
|
|
639
|
+
rootSchema: _listCalendarsResponse,
|
|
640
|
+
depSchemas: {},
|
|
641
|
+
fqdnTransformation: {
|
|
642
|
+
paths: [],
|
|
643
|
+
transformation: _toVeloEntity,
|
|
644
|
+
},
|
|
645
|
+
customTransformation: responseTransformation,
|
|
646
|
+
});
|
|
647
|
+
const payload = toAmbassadorRequest([connectionId]);
|
|
648
|
+
const reqOpts = ambassadorWixBookingsCalendarV2ExternalCalendar.listCalendars(payload);
|
|
649
|
+
__log(`"ListCalendars" sending request with: ${__inspect(reqOpts)}`);
|
|
650
|
+
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
651
|
+
try {
|
|
652
|
+
const result = yield httpClient.request(reqOpts);
|
|
653
|
+
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
|
|
654
|
+
return fromJSON(result.data);
|
|
655
|
+
}
|
|
656
|
+
catch (err) {
|
|
657
|
+
const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
|
|
658
|
+
'connectionId',
|
|
659
|
+
]);
|
|
660
|
+
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
661
|
+
throw transformedError;
|
|
662
|
+
}
|
|
663
|
+
});
|
|
664
|
+
}
|
|
665
|
+
exports.listCalendars = listCalendars;
|
|
666
|
+
/**
|
|
667
|
+
* Updates the specified external calendar connection's sync configuration.
|
|
668
|
+
*
|
|
669
|
+
*
|
|
670
|
+
* Use Update Sync Config to update a connection's `syncConfig` property.
|
|
671
|
+
* The `syncConfig` property contains settings for enabling, configuring, or disabling functionality, including:
|
|
672
|
+
*
|
|
673
|
+
* + Importing events from one or more specified calendars in the connected external calendar account. If this is enabled, use [List Events](#list-events) to retrieve a list of events from the external calendar.
|
|
674
|
+
* + Exporting events from the Wix site's calendar to an external calendar.
|
|
675
|
+
*
|
|
676
|
+
* To see an external calendar connection's existing sync configuration, use [Get Connection](#get-connection) or [List Connections](#list-connections) and see the `syncConfig` property.
|
|
677
|
+
*
|
|
678
|
+
* > **Note:**
|
|
679
|
+
* > Supported functionality depends on the provider. Use [List Providers](#list-providers) to see details about providers' supported features.
|
|
680
|
+
* @param connectionId - ID of the external calendar connection to update.
|
|
681
|
+
* @param syncConfig - Updated sync configuration details.
|
|
682
|
+
* @public
|
|
683
|
+
* @documentationMaturity preview
|
|
684
|
+
* @requiredField connectionId
|
|
685
|
+
* @requiredField syncConfig
|
|
686
|
+
*/
|
|
687
|
+
function updateSyncConfig(connectionId, syncConfig, options) {
|
|
688
|
+
var _a, _b, _c;
|
|
689
|
+
return __awaiter(this, arguments, void 0, function* () {
|
|
690
|
+
const requestTransformation = {
|
|
691
|
+
connectionId: '$[0]',
|
|
692
|
+
syncConfig: '$[1]',
|
|
693
|
+
fieldMask: '$[2].fieldMask',
|
|
694
|
+
};
|
|
695
|
+
const responseTransformation = '$';
|
|
696
|
+
// @ts-ignore
|
|
697
|
+
const { httpClient, sideEffects } = arguments[3];
|
|
698
|
+
const { toAmbassadorRequest } = (0, velo_1.serializer)({
|
|
699
|
+
rootSchema: _updateSyncConfigRequest,
|
|
700
|
+
depSchemas: {},
|
|
701
|
+
fqdnTransformation: {
|
|
702
|
+
paths: [],
|
|
703
|
+
transformation: _fromVeloEntity,
|
|
704
|
+
},
|
|
705
|
+
customTransformation: requestTransformation,
|
|
706
|
+
});
|
|
707
|
+
const { fromJSON } = (0, velo_1.serializer)({
|
|
708
|
+
rootSchema: _updateSyncConfigResponse,
|
|
709
|
+
depSchemas: {},
|
|
710
|
+
fqdnTransformation: {
|
|
711
|
+
paths: [],
|
|
712
|
+
transformation: _toVeloEntity,
|
|
713
|
+
},
|
|
714
|
+
customTransformation: responseTransformation,
|
|
715
|
+
});
|
|
716
|
+
const payload = toAmbassadorRequest([connectionId, syncConfig, options]);
|
|
717
|
+
const reqOpts = ambassadorWixBookingsCalendarV2ExternalCalendar.updateSyncConfig(payload);
|
|
718
|
+
__log(`"UpdateSyncConfig" sending request with: ${__inspect(reqOpts)}`);
|
|
719
|
+
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
720
|
+
try {
|
|
721
|
+
const result = yield httpClient.request(reqOpts);
|
|
722
|
+
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
|
|
723
|
+
return fromJSON(result.data);
|
|
724
|
+
}
|
|
725
|
+
catch (err) {
|
|
726
|
+
const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
|
|
727
|
+
'connectionId',
|
|
728
|
+
'syncConfig',
|
|
729
|
+
'options',
|
|
730
|
+
]);
|
|
731
|
+
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
732
|
+
throw transformedError;
|
|
733
|
+
}
|
|
734
|
+
});
|
|
735
|
+
}
|
|
736
|
+
exports.updateSyncConfig = updateSyncConfig;
|
|
737
|
+
/**
|
|
738
|
+
* Disconnects from an external calendar.
|
|
739
|
+
*
|
|
740
|
+
*
|
|
741
|
+
* When an external calendar is disconnected, the external calendar connection's `status` is changed to `DISCONNECTED`.
|
|
742
|
+
*
|
|
743
|
+
* After disconnecting, [List Events](#list-events) no longer returns events from the disconnected external calendar.
|
|
744
|
+
* Exported Wix calendar sessions are deleted from the external calendar.
|
|
745
|
+
* @param connectionId - ID of the external calendar connection to disconnect.
|
|
746
|
+
* @public
|
|
747
|
+
* @documentationMaturity preview
|
|
748
|
+
* @requiredField connectionId
|
|
749
|
+
*/
|
|
750
|
+
function disconnect(connectionId) {
|
|
751
|
+
var _a, _b, _c;
|
|
752
|
+
return __awaiter(this, arguments, void 0, function* () {
|
|
753
|
+
const requestTransformation = { connectionId: '$[0]' };
|
|
754
|
+
const responseTransformation = '$';
|
|
755
|
+
// @ts-ignore
|
|
756
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
757
|
+
const { toAmbassadorRequest } = (0, velo_1.serializer)({
|
|
758
|
+
rootSchema: _disconnectRequest,
|
|
759
|
+
depSchemas: {},
|
|
760
|
+
fqdnTransformation: {
|
|
761
|
+
paths: [],
|
|
762
|
+
transformation: _fromVeloEntity,
|
|
763
|
+
},
|
|
764
|
+
customTransformation: requestTransformation,
|
|
765
|
+
});
|
|
766
|
+
const { fromJSON } = (0, velo_1.serializer)({
|
|
767
|
+
rootSchema: _disconnectResponse,
|
|
768
|
+
depSchemas: {},
|
|
769
|
+
fqdnTransformation: {
|
|
770
|
+
paths: [],
|
|
771
|
+
transformation: _toVeloEntity,
|
|
772
|
+
},
|
|
773
|
+
customTransformation: responseTransformation,
|
|
774
|
+
});
|
|
775
|
+
const payload = toAmbassadorRequest([connectionId]);
|
|
776
|
+
const reqOpts = ambassadorWixBookingsCalendarV2ExternalCalendar.disconnect(payload);
|
|
777
|
+
__log(`"Disconnect" sending request with: ${__inspect(reqOpts)}`);
|
|
778
|
+
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
779
|
+
try {
|
|
780
|
+
const result = yield httpClient.request(reqOpts);
|
|
781
|
+
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
|
|
782
|
+
return fromJSON(result.data);
|
|
783
|
+
}
|
|
784
|
+
catch (err) {
|
|
785
|
+
const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
|
|
786
|
+
'connectionId',
|
|
787
|
+
]);
|
|
788
|
+
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
789
|
+
throw transformedError;
|
|
790
|
+
}
|
|
791
|
+
});
|
|
792
|
+
}
|
|
793
|
+
exports.disconnect = disconnect;
|
|
794
|
+
/**
|
|
795
|
+
* Retrieves a list of events from all connected external calendars, based on the provided filtering and paging.
|
|
796
|
+
*
|
|
797
|
+
*
|
|
798
|
+
* Use List Events to retrieve an aggregated list of events in the connected external calendars for a specified time range, sorted by start date.
|
|
799
|
+
*
|
|
800
|
+
* > **Note:**
|
|
801
|
+
* > Before using this endpoint, establish a connection with an external calendar using [Connect By Credentials](#connect-by-credentials) or [Connect By OAuth](#connect-by-o-auth).
|
|
802
|
+
* @public
|
|
803
|
+
* @documentationMaturity preview
|
|
804
|
+
*/
|
|
805
|
+
function listEvents(options) {
|
|
806
|
+
var _a, _b, _c;
|
|
807
|
+
return __awaiter(this, arguments, void 0, function* () {
|
|
808
|
+
const requestTransformation = {
|
|
809
|
+
from: '$[0].from',
|
|
810
|
+
to: '$[0].to',
|
|
811
|
+
scheduleIds: '$[0].scheduleIds',
|
|
812
|
+
userIds: '$[0].userIds',
|
|
813
|
+
allDay: '$[0].allDay',
|
|
814
|
+
fieldsets: '$[0].fieldsets',
|
|
815
|
+
cursorPaging: '$[0].cursorPaging',
|
|
816
|
+
partialFailure: '$[0].partialFailure',
|
|
817
|
+
};
|
|
818
|
+
const responseTransformation = '$';
|
|
819
|
+
// @ts-ignore
|
|
820
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
821
|
+
const { toAmbassadorRequest } = (0, velo_1.serializer)({
|
|
822
|
+
rootSchema: _listEventsRequest,
|
|
823
|
+
depSchemas: {},
|
|
824
|
+
fqdnTransformation: {
|
|
825
|
+
paths: [],
|
|
826
|
+
transformation: _fromVeloEntity,
|
|
827
|
+
},
|
|
828
|
+
customTransformation: requestTransformation,
|
|
829
|
+
});
|
|
830
|
+
const { fromJSON } = (0, velo_1.serializer)({
|
|
831
|
+
rootSchema: _listEventsResponse,
|
|
832
|
+
depSchemas: {},
|
|
833
|
+
fqdnTransformation: {
|
|
834
|
+
paths: [],
|
|
835
|
+
transformation: _toVeloEntity,
|
|
836
|
+
},
|
|
837
|
+
customTransformation: responseTransformation,
|
|
838
|
+
});
|
|
839
|
+
const payload = toAmbassadorRequest([options]);
|
|
840
|
+
const reqOpts = ambassadorWixBookingsCalendarV2ExternalCalendar.listEvents(payload);
|
|
841
|
+
__log(`"ListEvents" sending request with: ${__inspect(reqOpts)}`);
|
|
842
|
+
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
843
|
+
try {
|
|
844
|
+
const result = yield httpClient.request(reqOpts);
|
|
845
|
+
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
|
|
846
|
+
return fromJSON(result.data);
|
|
847
|
+
}
|
|
848
|
+
catch (err) {
|
|
849
|
+
const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
|
|
850
|
+
'options',
|
|
851
|
+
]);
|
|
852
|
+
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
853
|
+
throw transformedError;
|
|
854
|
+
}
|
|
855
|
+
});
|
|
856
|
+
}
|
|
857
|
+
exports.listEvents = listEvents;
|
|
858
|
+
//# sourceMappingURL=bookings-calendar-v2-external-calendar.universal.js.map
|