@wix/bookings 1.0.0 → 1.0.2
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 +5 -0
- package/build/cjs/index.js +6 -1
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/src/bookings-availability-v1-slot-availability.http.d.ts +6 -6
- package/build/cjs/src/bookings-availability-v1-slot-availability.http.js +6 -6
- package/build/cjs/src/bookings-availability-v1-slot-availability.universal.d.ts +14 -29
- package/build/cjs/src/bookings-availability-v1-slot-availability.universal.js +7 -6
- package/build/cjs/src/bookings-availability-v1-slot-availability.universal.js.map +1 -1
- package/build/cjs/src/bookings-calendar-v1-session.http.d.ts +75 -0
- package/build/cjs/src/bookings-calendar-v1-session.http.js +355 -0
- package/build/cjs/src/bookings-calendar-v1-session.http.js.map +1 -0
- package/build/cjs/src/bookings-calendar-v1-session.public.d.ts +8 -0
- package/build/cjs/src/bookings-calendar-v1-session.public.js +41 -0
- package/build/cjs/src/bookings-calendar-v1-session.public.js.map +1 -0
- package/build/cjs/src/bookings-calendar-v1-session.types.d.ts +1011 -0
- package/build/cjs/src/bookings-calendar-v1-session.types.js +110 -0
- package/build/cjs/src/bookings-calendar-v1-session.types.js.map +1 -0
- package/build/cjs/src/bookings-calendar-v1-session.universal.d.ts +1178 -0
- package/build/cjs/src/bookings-calendar-v1-session.universal.js +437 -0
- package/build/cjs/src/bookings-calendar-v1-session.universal.js.map +1 -0
- package/build/cjs/src/bookings-catalog-v1-resource.http.d.ts +195 -0
- package/build/cjs/src/bookings-catalog-v1-resource.http.js +564 -0
- package/build/cjs/src/bookings-catalog-v1-resource.http.js.map +1 -0
- package/build/cjs/src/bookings-catalog-v1-resource.public.d.ts +10 -0
- package/build/cjs/src/bookings-catalog-v1-resource.public.js +55 -0
- package/build/cjs/src/bookings-catalog-v1-resource.public.js.map +1 -0
- package/build/cjs/src/bookings-catalog-v1-resource.types.d.ts +931 -0
- package/build/cjs/src/bookings-catalog-v1-resource.types.js +125 -0
- package/build/cjs/src/bookings-catalog-v1-resource.types.js.map +1 -0
- package/build/cjs/src/bookings-catalog-v1-resource.universal.d.ts +1201 -0
- package/build/cjs/src/bookings-catalog-v1-resource.universal.js +740 -0
- package/build/cjs/src/bookings-catalog-v1-resource.universal.js.map +1 -0
- package/build/cjs/src/bookings-reader-v2-extended-booking.http.d.ts +38 -0
- package/build/cjs/src/bookings-reader-v2-extended-booking.http.js +117 -0
- package/build/cjs/src/bookings-reader-v2-extended-booking.http.js.map +1 -0
- package/build/cjs/src/bookings-reader-v2-extended-booking.public.d.ts +5 -0
- package/build/cjs/src/bookings-reader-v2-extended-booking.public.js +22 -0
- package/build/cjs/src/bookings-reader-v2-extended-booking.public.js.map +1 -0
- package/build/cjs/src/bookings-reader-v2-extended-booking.types.d.ts +730 -0
- package/build/cjs/src/bookings-reader-v2-extended-booking.types.js +90 -0
- package/build/cjs/src/bookings-reader-v2-extended-booking.types.js.map +1 -0
- package/build/cjs/src/bookings-reader-v2-extended-booking.universal.d.ts +786 -0
- package/build/cjs/src/bookings-reader-v2-extended-booking.universal.js +226 -0
- package/build/cjs/src/bookings-reader-v2-extended-booking.universal.js.map +1 -0
- package/build/cjs/src/bookings-v2-booking.http.d.ts +123 -0
- package/build/cjs/src/bookings-v2-booking.http.js +305 -0
- package/build/cjs/src/bookings-v2-booking.http.js.map +1 -0
- package/build/cjs/src/bookings-v2-booking.public.d.ts +9 -0
- package/build/cjs/src/bookings-v2-booking.public.js +47 -0
- package/build/cjs/src/bookings-v2-booking.public.js.map +1 -0
- package/build/cjs/src/bookings-v2-booking.types.d.ts +1594 -0
- package/build/cjs/src/bookings-v2-booking.types.js +99 -0
- package/build/cjs/src/bookings-v2-booking.types.js.map +1 -0
- package/build/cjs/src/bookings-v2-booking.universal.d.ts +1840 -0
- package/build/cjs/src/bookings-v2-booking.universal.js +561 -0
- package/build/cjs/src/bookings-v2-booking.universal.js.map +1 -0
- package/build/cjs/src/bookings-v2-price-info.http.d.ts +56 -0
- package/build/cjs/src/bookings-v2-price-info.http.js +164 -0
- package/build/cjs/src/bookings-v2-price-info.http.js.map +1 -0
- package/build/cjs/src/bookings-v2-price-info.public.d.ts +6 -0
- package/build/cjs/src/bookings-v2-price-info.public.js +26 -0
- package/build/cjs/src/bookings-v2-price-info.public.js.map +1 -0
- package/build/cjs/src/bookings-v2-price-info.types.d.ts +594 -0
- package/build/cjs/src/bookings-v2-price-info.types.js +79 -0
- package/build/cjs/src/bookings-v2-price-info.types.js.map +1 -0
- package/build/cjs/src/bookings-v2-price-info.universal.d.ts +664 -0
- package/build/cjs/src/bookings-v2-price-info.universal.js +274 -0
- package/build/cjs/src/bookings-v2-price-info.universal.js.map +1 -0
- package/build/es/index.d.ts +5 -0
- package/build/es/index.js +5 -0
- package/build/es/index.js.map +1 -1
- package/build/es/src/bookings-availability-v1-slot-availability.http.d.ts +6 -6
- package/build/es/src/bookings-availability-v1-slot-availability.http.js +6 -6
- package/build/es/src/bookings-availability-v1-slot-availability.universal.d.ts +14 -29
- package/build/es/src/bookings-availability-v1-slot-availability.universal.js +7 -6
- package/build/es/src/bookings-availability-v1-slot-availability.universal.js.map +1 -1
- package/build/es/src/bookings-calendar-v1-session.http.d.ts +75 -0
- package/build/es/src/bookings-calendar-v1-session.http.js +348 -0
- package/build/es/src/bookings-calendar-v1-session.http.js.map +1 -0
- package/build/es/src/bookings-calendar-v1-session.public.d.ts +8 -0
- package/build/es/src/bookings-calendar-v1-session.public.js +23 -0
- package/build/es/src/bookings-calendar-v1-session.public.js.map +1 -0
- package/build/es/src/bookings-calendar-v1-session.types.d.ts +1011 -0
- package/build/es/src/bookings-calendar-v1-session.types.js +107 -0
- package/build/es/src/bookings-calendar-v1-session.types.js.map +1 -0
- package/build/es/src/bookings-calendar-v1-session.universal.d.ts +1178 -0
- package/build/es/src/bookings-calendar-v1-session.universal.js +411 -0
- package/build/es/src/bookings-calendar-v1-session.universal.js.map +1 -0
- package/build/es/src/bookings-catalog-v1-resource.http.d.ts +195 -0
- package/build/es/src/bookings-catalog-v1-resource.http.js +555 -0
- package/build/es/src/bookings-catalog-v1-resource.http.js.map +1 -0
- package/build/es/src/bookings-catalog-v1-resource.public.d.ts +10 -0
- package/build/es/src/bookings-catalog-v1-resource.public.js +33 -0
- package/build/es/src/bookings-catalog-v1-resource.public.js.map +1 -0
- package/build/es/src/bookings-catalog-v1-resource.types.d.ts +931 -0
- package/build/es/src/bookings-catalog-v1-resource.types.js +122 -0
- package/build/es/src/bookings-catalog-v1-resource.types.js.map +1 -0
- package/build/es/src/bookings-catalog-v1-resource.universal.d.ts +1201 -0
- package/build/es/src/bookings-catalog-v1-resource.universal.js +712 -0
- package/build/es/src/bookings-catalog-v1-resource.universal.js.map +1 -0
- package/build/es/src/bookings-reader-v2-extended-booking.http.d.ts +38 -0
- package/build/es/src/bookings-reader-v2-extended-booking.http.js +113 -0
- package/build/es/src/bookings-reader-v2-extended-booking.http.js.map +1 -0
- package/build/es/src/bookings-reader-v2-extended-booking.public.d.ts +5 -0
- package/build/es/src/bookings-reader-v2-extended-booking.public.js +8 -0
- package/build/es/src/bookings-reader-v2-extended-booking.public.js.map +1 -0
- package/build/es/src/bookings-reader-v2-extended-booking.types.d.ts +730 -0
- package/build/es/src/bookings-reader-v2-extended-booking.types.js +87 -0
- package/build/es/src/bookings-reader-v2-extended-booking.types.js.map +1 -0
- package/build/es/src/bookings-reader-v2-extended-booking.universal.d.ts +786 -0
- package/build/es/src/bookings-reader-v2-extended-booking.universal.js +203 -0
- package/build/es/src/bookings-reader-v2-extended-booking.universal.js.map +1 -0
- package/build/es/src/bookings-v2-booking.http.d.ts +123 -0
- package/build/es/src/bookings-v2-booking.http.js +297 -0
- package/build/es/src/bookings-v2-booking.http.js.map +1 -0
- package/build/es/src/bookings-v2-booking.public.d.ts +9 -0
- package/build/es/src/bookings-v2-booking.public.js +28 -0
- package/build/es/src/bookings-v2-booking.public.js.map +1 -0
- package/build/es/src/bookings-v2-booking.types.d.ts +1594 -0
- package/build/es/src/bookings-v2-booking.types.js +96 -0
- package/build/es/src/bookings-v2-booking.types.js.map +1 -0
- package/build/es/src/bookings-v2-booking.universal.d.ts +1840 -0
- package/build/es/src/bookings-v2-booking.universal.js +534 -0
- package/build/es/src/bookings-v2-booking.universal.js.map +1 -0
- package/build/es/src/bookings-v2-price-info.http.d.ts +56 -0
- package/build/es/src/bookings-v2-price-info.http.js +159 -0
- package/build/es/src/bookings-v2-price-info.http.js.map +1 -0
- package/build/es/src/bookings-v2-price-info.public.d.ts +6 -0
- package/build/es/src/bookings-v2-price-info.public.js +13 -0
- package/build/es/src/bookings-v2-price-info.public.js.map +1 -0
- package/build/es/src/bookings-v2-price-info.types.d.ts +594 -0
- package/build/es/src/bookings-v2-price-info.types.js +76 -0
- package/build/es/src/bookings-v2-price-info.types.js.map +1 -0
- package/build/es/src/bookings-v2-price-info.universal.d.ts +664 -0
- package/build/es/src/bookings-v2-price-info.universal.js +250 -0
- package/build/es/src/bookings-v2-price-info.universal.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,712 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { serializer, transformError } from '@wix/metro-runtime/velo';
|
|
11
|
+
import * as ambassadorWixBookingsCatalogV1Resource from './bookings-catalog-v1-resource.http';
|
|
12
|
+
let __verbose = false;
|
|
13
|
+
function __log(...args) {
|
|
14
|
+
__verbose && console.log(...args);
|
|
15
|
+
}
|
|
16
|
+
function __inspect(obj) {
|
|
17
|
+
return obj;
|
|
18
|
+
}
|
|
19
|
+
export const __debug = {
|
|
20
|
+
verboseLogging: {
|
|
21
|
+
on: () => (__verbose = true),
|
|
22
|
+
off: () => (__verbose = false),
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
const _toVeloEntity = '$';
|
|
26
|
+
const _fromVeloEntity = '$';
|
|
27
|
+
export var Day;
|
|
28
|
+
(function (Day) {
|
|
29
|
+
/** Undefined. */
|
|
30
|
+
Day["UNDEFINED"] = "UNDEFINED";
|
|
31
|
+
/** Monday. */
|
|
32
|
+
Day["MON"] = "MON";
|
|
33
|
+
/** Tuesday. */
|
|
34
|
+
Day["TUE"] = "TUE";
|
|
35
|
+
/** Wednesday. */
|
|
36
|
+
Day["WED"] = "WED";
|
|
37
|
+
/** Thursday. */
|
|
38
|
+
Day["THU"] = "THU";
|
|
39
|
+
/** Friday. */
|
|
40
|
+
Day["FRI"] = "FRI";
|
|
41
|
+
/** Saturday. */
|
|
42
|
+
Day["SAT"] = "SAT";
|
|
43
|
+
/** Sunday. */
|
|
44
|
+
Day["SUN"] = "SUN";
|
|
45
|
+
})(Day || (Day = {}));
|
|
46
|
+
export var Transparency;
|
|
47
|
+
(function (Transparency) {
|
|
48
|
+
Transparency["UNDEFINED"] = "UNDEFINED";
|
|
49
|
+
/** The schedule can have available slots during the session. */
|
|
50
|
+
Transparency["FREE"] = "FREE";
|
|
51
|
+
/** The schedule cannot have available slots during the session. Default value. */
|
|
52
|
+
Transparency["BUSY"] = "BUSY";
|
|
53
|
+
})(Transparency || (Transparency = {}));
|
|
54
|
+
export var RecurringIntervalType;
|
|
55
|
+
(function (RecurringIntervalType) {
|
|
56
|
+
/** The default value. Sessions for this interval will be of type EVENT. */
|
|
57
|
+
RecurringIntervalType["UNDEFINED"] = "UNDEFINED";
|
|
58
|
+
/** A recurring interval of events */
|
|
59
|
+
RecurringIntervalType["EVENT"] = "EVENT";
|
|
60
|
+
/** Deprecated */
|
|
61
|
+
RecurringIntervalType["TIME_AVAILABILITY"] = "TIME_AVAILABILITY";
|
|
62
|
+
/** A recurring interval for availability */
|
|
63
|
+
RecurringIntervalType["AVAILABILITY"] = "AVAILABILITY";
|
|
64
|
+
})(RecurringIntervalType || (RecurringIntervalType = {}));
|
|
65
|
+
export var LocationType;
|
|
66
|
+
(function (LocationType) {
|
|
67
|
+
LocationType["UNDEFINED"] = "UNDEFINED";
|
|
68
|
+
LocationType["OWNER_BUSINESS"] = "OWNER_BUSINESS";
|
|
69
|
+
LocationType["OWNER_CUSTOM"] = "OWNER_CUSTOM";
|
|
70
|
+
LocationType["CUSTOM"] = "CUSTOM";
|
|
71
|
+
})(LocationType || (LocationType = {}));
|
|
72
|
+
/** For future use */
|
|
73
|
+
export var LocationStatus;
|
|
74
|
+
(function (LocationStatus) {
|
|
75
|
+
LocationStatus["ACTIVE"] = "ACTIVE";
|
|
76
|
+
LocationStatus["INACTIVE"] = "INACTIVE";
|
|
77
|
+
})(LocationStatus || (LocationStatus = {}));
|
|
78
|
+
/** For future use */
|
|
79
|
+
export var LocationsLocationType;
|
|
80
|
+
(function (LocationsLocationType) {
|
|
81
|
+
LocationsLocationType["UNKNOWN"] = "UNKNOWN";
|
|
82
|
+
LocationsLocationType["BRANCH"] = "BRANCH";
|
|
83
|
+
LocationsLocationType["OFFICES"] = "OFFICES";
|
|
84
|
+
LocationsLocationType["RECEPTION"] = "RECEPTION";
|
|
85
|
+
LocationsLocationType["HEADQUARTERS"] = "HEADQUARTERS";
|
|
86
|
+
})(LocationsLocationType || (LocationsLocationType = {}));
|
|
87
|
+
/** Enumerates the days of the week. */
|
|
88
|
+
export var DayOfWeek;
|
|
89
|
+
(function (DayOfWeek) {
|
|
90
|
+
DayOfWeek["MONDAY"] = "MONDAY";
|
|
91
|
+
DayOfWeek["TUESDAY"] = "TUESDAY";
|
|
92
|
+
DayOfWeek["WEDNESDAY"] = "WEDNESDAY";
|
|
93
|
+
DayOfWeek["THURSDAY"] = "THURSDAY";
|
|
94
|
+
DayOfWeek["FRIDAY"] = "FRIDAY";
|
|
95
|
+
DayOfWeek["SATURDAY"] = "SATURDAY";
|
|
96
|
+
DayOfWeek["SUNDAY"] = "SUNDAY";
|
|
97
|
+
})(DayOfWeek || (DayOfWeek = {}));
|
|
98
|
+
export var ApprovalStatus;
|
|
99
|
+
(function (ApprovalStatus) {
|
|
100
|
+
/** Default. */
|
|
101
|
+
ApprovalStatus["UNDEFINED"] = "UNDEFINED";
|
|
102
|
+
/** Pending business approval. */
|
|
103
|
+
ApprovalStatus["PENDING"] = "PENDING";
|
|
104
|
+
/** Approved by the business. */
|
|
105
|
+
ApprovalStatus["APPROVED"] = "APPROVED";
|
|
106
|
+
/** Declined by the business. */
|
|
107
|
+
ApprovalStatus["DECLINED"] = "DECLINED";
|
|
108
|
+
})(ApprovalStatus || (ApprovalStatus = {}));
|
|
109
|
+
export var ScheduleStatus;
|
|
110
|
+
(function (ScheduleStatus) {
|
|
111
|
+
ScheduleStatus["UNDEFINED"] = "UNDEFINED";
|
|
112
|
+
/** The default value when the schedule is created. */
|
|
113
|
+
ScheduleStatus["CREATED"] = "CREATED";
|
|
114
|
+
/** The schedule has been canceled. */
|
|
115
|
+
ScheduleStatus["CANCELLED"] = "CANCELLED";
|
|
116
|
+
})(ScheduleStatus || (ScheduleStatus = {}));
|
|
117
|
+
export var ConferenceType;
|
|
118
|
+
(function (ConferenceType) {
|
|
119
|
+
ConferenceType["UNDEFINED"] = "UNDEFINED";
|
|
120
|
+
/** API-generated online meeting. */
|
|
121
|
+
ConferenceType["ONLINE_MEETING_PROVIDER"] = "ONLINE_MEETING_PROVIDER";
|
|
122
|
+
/** User-defined meeting. */
|
|
123
|
+
ConferenceType["CUSTOM"] = "CUSTOM";
|
|
124
|
+
})(ConferenceType || (ConferenceType = {}));
|
|
125
|
+
export var ResourceStatus;
|
|
126
|
+
(function (ResourceStatus) {
|
|
127
|
+
ResourceStatus["UNDEFINED"] = "UNDEFINED";
|
|
128
|
+
/** Default status. */
|
|
129
|
+
ResourceStatus["CREATED"] = "CREATED";
|
|
130
|
+
/** The resource was deleted. */
|
|
131
|
+
ResourceStatus["DELETED"] = "DELETED";
|
|
132
|
+
/** The resource was updated. */
|
|
133
|
+
ResourceStatus["UPDATED"] = "UPDATED";
|
|
134
|
+
})(ResourceStatus || (ResourceStatus = {}));
|
|
135
|
+
export var SortOrder;
|
|
136
|
+
(function (SortOrder) {
|
|
137
|
+
SortOrder["ASC"] = "ASC";
|
|
138
|
+
SortOrder["DESC"] = "DESC";
|
|
139
|
+
})(SortOrder || (SortOrder = {}));
|
|
140
|
+
export var Event;
|
|
141
|
+
(function (Event) {
|
|
142
|
+
Event["UNDEFINED"] = "UNDEFINED";
|
|
143
|
+
Event["Updated"] = "Updated";
|
|
144
|
+
Event["Deleted"] = "Deleted";
|
|
145
|
+
Event["Created"] = "Created";
|
|
146
|
+
Event["Schedule_Updated"] = "Schedule_Updated";
|
|
147
|
+
})(Event || (Event = {}));
|
|
148
|
+
const _availability = { locations: '_location' };
|
|
149
|
+
const _batchRequest = {
|
|
150
|
+
createRequests: '_createScheduleRequest',
|
|
151
|
+
updateRequests: '_updateScheduleRequest',
|
|
152
|
+
};
|
|
153
|
+
const _batchResponse = {
|
|
154
|
+
created: '_schedule',
|
|
155
|
+
updated: '_schedule',
|
|
156
|
+
cancelled: '_schedule',
|
|
157
|
+
};
|
|
158
|
+
const _createResourceRequest = {
|
|
159
|
+
resource: '_resource',
|
|
160
|
+
schedules: '_schedule',
|
|
161
|
+
};
|
|
162
|
+
const _createResourceResponse = { resource: '_resource' };
|
|
163
|
+
const _createScheduleRequest = { schedule: '_schedule' };
|
|
164
|
+
const _deleteResourceRequest = {};
|
|
165
|
+
const _deleteResourceResponse = {};
|
|
166
|
+
const _listResourcesRequest = {};
|
|
167
|
+
const _listResourcesResponse = { resources: '_resource' };
|
|
168
|
+
const _location = { businessLocation: '_locationsLocation' };
|
|
169
|
+
const _locationsLocation = { address: 'wix.common.Address' };
|
|
170
|
+
const _queryResourcesRequest = {};
|
|
171
|
+
const _queryResourcesResponse = { resources: '_resource' };
|
|
172
|
+
const _resource = { images: 'wix.common.Image', schedules: '_schedule' };
|
|
173
|
+
const _resourceUpdateScheduleRequest = { schedule: '_schedule' };
|
|
174
|
+
const _schedule = { location: '_location', availability: '_availability' };
|
|
175
|
+
const _updateResourceRequest = {
|
|
176
|
+
resource: '_resource',
|
|
177
|
+
scheduleActions: '_batchRequest',
|
|
178
|
+
};
|
|
179
|
+
const _updateResourceResponse = {
|
|
180
|
+
resource: '_resource',
|
|
181
|
+
schedules: '_batchResponse',
|
|
182
|
+
};
|
|
183
|
+
const _updateScheduleRequest = { schedule: '_schedule' };
|
|
184
|
+
const _updateScheduleResponse = { schedule: '_schedule' };
|
|
185
|
+
/**
|
|
186
|
+
* > **Deprecation Notice**
|
|
187
|
+
* >
|
|
188
|
+
* > **This endpoint has been replaced with [Query Resource](https://dev.wix.com/api/rest/wix-bookings/resources/list-resources/query-resource) and will be removed on March 31, 2022.**
|
|
189
|
+
* > **If your app uses this endpoint, we recommend updating your code as soon as possible.**
|
|
190
|
+
*
|
|
191
|
+
* Retrieves a list of the resources according to the provided filters and paging.
|
|
192
|
+
* <!--ONLY:REST-->
|
|
193
|
+
* This query is optional. If no query is provided than all non-deleted resources are returned.
|
|
194
|
+
*
|
|
195
|
+
* |Property|Is supported|
|
|
196
|
+
* |--|--|
|
|
197
|
+
* |filter | supports `resource.id`, `resource.tag`, `resource.status`|
|
|
198
|
+
* |paging | supported |
|
|
199
|
+
* |fields | supported |
|
|
200
|
+
* |fieldsets | **not supported** |
|
|
201
|
+
* |sort| **not supported** |
|
|
202
|
+
*
|
|
203
|
+
* > **Permissions**
|
|
204
|
+
* > This endpoint requires the Read Bookings Calendar, Read Bookings - Public Data, Read Bookings - Including Participants or Manage Bookings permission scope.
|
|
205
|
+
* <!--END:ONLY:REST-->
|
|
206
|
+
* @public
|
|
207
|
+
* @documentationMaturity preview
|
|
208
|
+
*/
|
|
209
|
+
export function list(options) {
|
|
210
|
+
var _a, _b, _c;
|
|
211
|
+
return __awaiter(this, arguments, void 0, function* () {
|
|
212
|
+
const requestTransformation = { query: '$[0].query' };
|
|
213
|
+
const responseTransformation = '$';
|
|
214
|
+
// @ts-ignore
|
|
215
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
216
|
+
const { toAmbassadorRequest } = serializer({
|
|
217
|
+
rootSchema: _listResourcesRequest,
|
|
218
|
+
depSchemas: {},
|
|
219
|
+
fqdnTransformation: {
|
|
220
|
+
paths: [],
|
|
221
|
+
transformation: _fromVeloEntity,
|
|
222
|
+
},
|
|
223
|
+
customTransformation: requestTransformation,
|
|
224
|
+
});
|
|
225
|
+
const { fromJSON } = serializer({
|
|
226
|
+
rootSchema: _listResourcesResponse,
|
|
227
|
+
depSchemas: {
|
|
228
|
+
_availability,
|
|
229
|
+
_location,
|
|
230
|
+
_locationsLocation,
|
|
231
|
+
_resource,
|
|
232
|
+
_schedule,
|
|
233
|
+
},
|
|
234
|
+
fqdnTransformation: {
|
|
235
|
+
paths: [...['Array#resources']],
|
|
236
|
+
transformation: _toVeloEntity,
|
|
237
|
+
},
|
|
238
|
+
customTransformation: responseTransformation,
|
|
239
|
+
});
|
|
240
|
+
const payload = toAmbassadorRequest([options]);
|
|
241
|
+
const reqOpts = ambassadorWixBookingsCatalogV1Resource.list(payload);
|
|
242
|
+
__log(`"List" sending request with: ${__inspect(reqOpts)}`);
|
|
243
|
+
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
244
|
+
try {
|
|
245
|
+
const result = yield httpClient.request(reqOpts);
|
|
246
|
+
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
|
|
247
|
+
return fromJSON(result.data);
|
|
248
|
+
}
|
|
249
|
+
catch (err) {
|
|
250
|
+
const transformedError = transformError(err, requestTransformation, [
|
|
251
|
+
'options',
|
|
252
|
+
]);
|
|
253
|
+
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
254
|
+
throw transformedError;
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Retrieves a list of the resources according to the specified filters and paging.
|
|
260
|
+
*
|
|
261
|
+
* The query parameter is optional. If no query is provided than all non-deleted resources are returned.
|
|
262
|
+
*
|
|
263
|
+
* |Property|Is supported|
|
|
264
|
+
* |--|--|
|
|
265
|
+
* |filter | supported fields: `resource.id`, `resource.tags`, `resource.status`|
|
|
266
|
+
* |paging | supported |
|
|
267
|
+
* |fields | supported |
|
|
268
|
+
* |fieldsets | **not supported** |
|
|
269
|
+
* |sort | **not supported** |
|
|
270
|
+
*
|
|
271
|
+
*
|
|
272
|
+
* >**Notes:**
|
|
273
|
+
* > + The following objects in the `query` parameter are not supported for this query:
|
|
274
|
+
* > - `sort`
|
|
275
|
+
* > - `fieldsets`
|
|
276
|
+
*
|
|
277
|
+
* > **Permissions**
|
|
278
|
+
* > This endpoint requires the Read Bookings Calendar, Read Bookings - Public Data, Read Bookings - Including Participants or Manage Bookings permission scope.
|
|
279
|
+
* @public
|
|
280
|
+
* @documentationMaturity preview
|
|
281
|
+
*/
|
|
282
|
+
export function query(options) {
|
|
283
|
+
var _a, _b, _c;
|
|
284
|
+
return __awaiter(this, arguments, void 0, function* () {
|
|
285
|
+
const requestTransformation = { query: '$[0].query' };
|
|
286
|
+
const responseTransformation = '$';
|
|
287
|
+
// @ts-ignore
|
|
288
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
289
|
+
const { toAmbassadorRequest } = serializer({
|
|
290
|
+
rootSchema: _queryResourcesRequest,
|
|
291
|
+
depSchemas: {},
|
|
292
|
+
fqdnTransformation: {
|
|
293
|
+
paths: [],
|
|
294
|
+
transformation: _fromVeloEntity,
|
|
295
|
+
},
|
|
296
|
+
customTransformation: requestTransformation,
|
|
297
|
+
});
|
|
298
|
+
const { fromJSON } = serializer({
|
|
299
|
+
rootSchema: _queryResourcesResponse,
|
|
300
|
+
depSchemas: {
|
|
301
|
+
_availability,
|
|
302
|
+
_location,
|
|
303
|
+
_locationsLocation,
|
|
304
|
+
_resource,
|
|
305
|
+
_schedule,
|
|
306
|
+
},
|
|
307
|
+
fqdnTransformation: {
|
|
308
|
+
paths: [...['Array#resources']],
|
|
309
|
+
transformation: _toVeloEntity,
|
|
310
|
+
},
|
|
311
|
+
customTransformation: responseTransformation,
|
|
312
|
+
});
|
|
313
|
+
const payload = toAmbassadorRequest([options]);
|
|
314
|
+
const reqOpts = ambassadorWixBookingsCatalogV1Resource.query(payload);
|
|
315
|
+
__log(`"Query" sending request with: ${__inspect(reqOpts)}`);
|
|
316
|
+
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
317
|
+
try {
|
|
318
|
+
const result = yield httpClient.request(reqOpts);
|
|
319
|
+
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
|
|
320
|
+
return fromJSON(result.data);
|
|
321
|
+
}
|
|
322
|
+
catch (err) {
|
|
323
|
+
const transformedError = transformError(err, requestTransformation, [
|
|
324
|
+
'options',
|
|
325
|
+
]);
|
|
326
|
+
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
327
|
+
throw transformedError;
|
|
328
|
+
}
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Creates a resource.
|
|
333
|
+
* <!--ONLY:VELO
|
|
334
|
+
* The `createResource()` function returns a Promise that resolves to the created resource.
|
|
335
|
+
* <!--END:ONLY:VELO-->
|
|
336
|
+
*
|
|
337
|
+
* Bookings resources are created with a schedule. The schedule and its sessions determine the resource's availability. Note that the schedule must contain a start date in the `availability.start` property.
|
|
338
|
+
* For resources that are available during the business's default hours, add the business's schedule as a linked schedule in the resource's schedule. For resources that have their own hours, create sessions with type `"WORKING_HOURS"` using the resource's schedule.
|
|
339
|
+
* You can use both individual and recurring sessions to define resource availability. You cannot use availability constraints for resource schedules.
|
|
340
|
+
*
|
|
341
|
+
* <!--ONLY:VELO
|
|
342
|
+
* When creating a resource using `createResource()`, include the resource's schedule information. Set the schedule information as follows:
|
|
343
|
+
* + If the resource uses the default business hours, get the business resource's schedule ID and include it in the `scheduleInfo.availability.linkedSchedules` array in the `scheduleInfo` parameter. The default hours can bee found in the Dashboard under **Settings** in the **Bookings** section, on the **Appointment hours** page.
|
|
344
|
+
* + If the resource has its own custom working hours, create the resource, then create sessions of type `"WORKING_HOURS"` using the [`createSession()`](wix-bookings-backend.Sessions/createsession) function. Use the `scheduleId` returned from `createResource()` when creating the sessions. These session can be single sessions or recurring sessions.
|
|
345
|
+
* + You can have both default business hours and custom hours for the same resource schedule by combining the steps above.
|
|
346
|
+
*
|
|
347
|
+
* > **Notes:**
|
|
348
|
+
* > + The Wix Bookings app does not show both default business hours and custom hours on the **Staff** page in the dashboard. If you've set up both custom and default business hours, only the default business hours will appear in the app, although both are working.
|
|
349
|
+
* > + The Wix Bookings app does not show non-recurring `WORKING_HOURS` sessions in the resource calendar.
|
|
350
|
+
* > + You can only add the business resource's schedule as a linked schedule for a resource.
|
|
351
|
+
* > + A resource can have one schedule only.
|
|
352
|
+
* > + You can have up to 135 active resources and an additional 135 deleted resources.
|
|
353
|
+
* > + Only users with the **Bookings Admin** [role](https://support.wix.com/en/article/roles-permissions-overview#bookings-admin) can create a resource. You can override the role permissions by setting the `options.suppressAuth` parameter to `true`.
|
|
354
|
+
* <!--END:ONLY:VELO-->
|
|
355
|
+
*
|
|
356
|
+
* <!--ONLY:REST-->
|
|
357
|
+
* Use the following steps to create resources:
|
|
358
|
+
* - Create the resource using including schedule information.
|
|
359
|
+
* - If the resource uses the default business hours, get the business resource's schedule ID and include it in the `scheduleInfo.availability.linkedSchedules` array in the in the schedule parameters.
|
|
360
|
+
* - If the resource has its own custom working hours, create sessions of type `"WORKING_HOURS"`. Use the `scheduleId` of the new resource when creating the sessions. These session can be single sessions or recurring sessions. You can have both business hours and custom hours for the same resource schedule.
|
|
361
|
+
*
|
|
362
|
+
* >**Notes:**
|
|
363
|
+
* > + A resource can have one schedule only.
|
|
364
|
+
* > + You can have up to 135 active resources and an additional 135 deleted resources.
|
|
365
|
+
* > + The `businessLocation.businessSchedule` object in the `schedule.location` object is not supported.
|
|
366
|
+
*
|
|
367
|
+
*
|
|
368
|
+
*
|
|
369
|
+
* >**Permissions:**
|
|
370
|
+
* > This endpoint requires the Manage Bookings [permission scope](https://devforum.wix.com/kb/en/article/available-permissions).
|
|
371
|
+
* <!--END:ONLY:REST-->
|
|
372
|
+
* @param resource - Resource details.
|
|
373
|
+
* @public
|
|
374
|
+
* @documentationMaturity preview
|
|
375
|
+
* @requiredField options.schedules.availability.start
|
|
376
|
+
* @requiredField options.schedules.intervals.start
|
|
377
|
+
* @requiredField resource
|
|
378
|
+
* @requiredField resource.name
|
|
379
|
+
*/
|
|
380
|
+
export function create(resource, options) {
|
|
381
|
+
var _a, _b, _c;
|
|
382
|
+
return __awaiter(this, arguments, void 0, function* () {
|
|
383
|
+
const requestTransformation = {
|
|
384
|
+
resource: '$[0]',
|
|
385
|
+
schedules: '$[1].schedules',
|
|
386
|
+
};
|
|
387
|
+
const responseTransformation = '$';
|
|
388
|
+
// @ts-ignore
|
|
389
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
390
|
+
const { toAmbassadorRequest } = serializer({
|
|
391
|
+
rootSchema: _createResourceRequest,
|
|
392
|
+
depSchemas: {
|
|
393
|
+
_availability,
|
|
394
|
+
_location,
|
|
395
|
+
_locationsLocation,
|
|
396
|
+
_resource,
|
|
397
|
+
_schedule,
|
|
398
|
+
},
|
|
399
|
+
fqdnTransformation: {
|
|
400
|
+
paths: [...['resource']],
|
|
401
|
+
transformation: _fromVeloEntity,
|
|
402
|
+
},
|
|
403
|
+
customTransformation: requestTransformation,
|
|
404
|
+
});
|
|
405
|
+
const { fromJSON } = serializer({
|
|
406
|
+
rootSchema: _createResourceResponse,
|
|
407
|
+
depSchemas: {
|
|
408
|
+
_availability,
|
|
409
|
+
_location,
|
|
410
|
+
_locationsLocation,
|
|
411
|
+
_resource,
|
|
412
|
+
_schedule,
|
|
413
|
+
},
|
|
414
|
+
fqdnTransformation: {
|
|
415
|
+
paths: [...['resource']],
|
|
416
|
+
transformation: _toVeloEntity,
|
|
417
|
+
},
|
|
418
|
+
customTransformation: responseTransformation,
|
|
419
|
+
});
|
|
420
|
+
const payload = toAmbassadorRequest([resource, options]);
|
|
421
|
+
const reqOpts = ambassadorWixBookingsCatalogV1Resource.create(payload);
|
|
422
|
+
__log(`"Create" sending request with: ${__inspect(reqOpts)}`);
|
|
423
|
+
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
424
|
+
try {
|
|
425
|
+
const result = yield httpClient.request(reqOpts);
|
|
426
|
+
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
|
|
427
|
+
return fromJSON(result.data);
|
|
428
|
+
}
|
|
429
|
+
catch (err) {
|
|
430
|
+
const transformedError = transformError(err, requestTransformation, [
|
|
431
|
+
'resource',
|
|
432
|
+
'options',
|
|
433
|
+
]);
|
|
434
|
+
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
435
|
+
throw transformedError;
|
|
436
|
+
}
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* Updates a resource.
|
|
441
|
+
* <!--ONLY:VELO
|
|
442
|
+
* The `updateResource()` function returns a Promise that resolves when a resource is updated.
|
|
443
|
+
* Use this function to update all bookings resource information except for the resource's schedule. To update a resource's schedule use [`updateResourceSchedule()`](wix-bookings-backend/resource/updateresourceschedule).
|
|
444
|
+
*
|
|
445
|
+
* >**Notes:**
|
|
446
|
+
* > + When updating a resource you cannot change the system tags used by the Wix Bookings app. Tags used by the app have the values `"business"` and `"staff"`.
|
|
447
|
+
* > + Only users with the **Bookings Admin** [role](https://support.wix.com/en/article/roles-permissions-overview#bookings-admin) can update a resource. You can override the role permissions by setting the `options.suppressAuth` parameter to `true`.
|
|
448
|
+
* <!--END:ONLY:VELO-->
|
|
449
|
+
* <!--ONLY:REST-->
|
|
450
|
+
* Use this endpoint to update all resource information except for the resource's schedule. To update a resource's schedule use
|
|
451
|
+
* the [Update Schedule](https://dev.wix.com/api/rest/wix-bookings/resources/update-schedule) endpoint.
|
|
452
|
+
*
|
|
453
|
+
* >**Notes:**
|
|
454
|
+
* > + When updating a resource you cannot change the system tags used by the Wix Bookings app. Tags used by the app have the values `"business"` and `"staff"`.
|
|
455
|
+
* > + When updating a resource's schedule you cannot change the resource tag used by the Wix Bookings app. Tags used by the app have the values `"INDIVIDUAL"`, `"GROUP"`, and `"COURSE”`.
|
|
456
|
+
* > + The `businessLocation.businessSchedule` object in the `schedule.location` object is not supported.
|
|
457
|
+
*
|
|
458
|
+
* >**Permissions:**
|
|
459
|
+
* > This endpoint requires the Manage Bookings [permission scope](https://devforum.wix.com/kb/en/article/available-permissions).
|
|
460
|
+
* <!--END:ONLY:REST-->
|
|
461
|
+
* @param _id - Resource ID.
|
|
462
|
+
* @public
|
|
463
|
+
* @documentationMaturity preview
|
|
464
|
+
* @requiredField _id
|
|
465
|
+
* @requiredField scheduleActions.cancelRequests.scheduleId
|
|
466
|
+
* @requiredField scheduleActions.createRequests.schedule.availability.start
|
|
467
|
+
* @requiredField scheduleActions.createRequests.schedule.intervals.start
|
|
468
|
+
* @requiredField scheduleActions.createRequests.schedule.scheduleOwnerId
|
|
469
|
+
* @requiredField scheduleActions.updateRequests.schedule._id
|
|
470
|
+
*/
|
|
471
|
+
export function update(_id, options) {
|
|
472
|
+
var _a, _b, _c;
|
|
473
|
+
return __awaiter(this, arguments, void 0, function* () {
|
|
474
|
+
const requestTransformation = {
|
|
475
|
+
resource: { '*': '$[1].resource', id: '$[0]' },
|
|
476
|
+
fieldMask: '$[1].fieldMask',
|
|
477
|
+
};
|
|
478
|
+
const responseTransformation = '$';
|
|
479
|
+
// @ts-ignore
|
|
480
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
481
|
+
const { toAmbassadorRequest } = serializer({
|
|
482
|
+
rootSchema: _updateResourceRequest,
|
|
483
|
+
depSchemas: {
|
|
484
|
+
_availability,
|
|
485
|
+
_batchRequest,
|
|
486
|
+
_createScheduleRequest,
|
|
487
|
+
_location,
|
|
488
|
+
_locationsLocation,
|
|
489
|
+
_resource,
|
|
490
|
+
_schedule,
|
|
491
|
+
_updateScheduleRequest,
|
|
492
|
+
},
|
|
493
|
+
fqdnTransformation: {
|
|
494
|
+
paths: [...['resource']],
|
|
495
|
+
transformation: _fromVeloEntity,
|
|
496
|
+
},
|
|
497
|
+
customTransformation: requestTransformation,
|
|
498
|
+
});
|
|
499
|
+
const { fromJSON } = serializer({
|
|
500
|
+
rootSchema: _updateResourceResponse,
|
|
501
|
+
depSchemas: {
|
|
502
|
+
_availability,
|
|
503
|
+
_batchResponse,
|
|
504
|
+
_location,
|
|
505
|
+
_locationsLocation,
|
|
506
|
+
_resource,
|
|
507
|
+
_schedule,
|
|
508
|
+
},
|
|
509
|
+
fqdnTransformation: {
|
|
510
|
+
paths: [...['resource']],
|
|
511
|
+
transformation: _toVeloEntity,
|
|
512
|
+
},
|
|
513
|
+
customTransformation: responseTransformation,
|
|
514
|
+
});
|
|
515
|
+
const payload = toAmbassadorRequest([_id, options]);
|
|
516
|
+
const reqOpts = ambassadorWixBookingsCatalogV1Resource.update(payload);
|
|
517
|
+
__log(`"Update" sending request with: ${__inspect(reqOpts)}`);
|
|
518
|
+
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
519
|
+
try {
|
|
520
|
+
const result = yield httpClient.request(reqOpts);
|
|
521
|
+
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
|
|
522
|
+
return fromJSON(result.data);
|
|
523
|
+
}
|
|
524
|
+
catch (err) {
|
|
525
|
+
const transformedError = transformError(err, requestTransformation, [
|
|
526
|
+
'_id',
|
|
527
|
+
'options',
|
|
528
|
+
]);
|
|
529
|
+
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
530
|
+
throw transformedError;
|
|
531
|
+
}
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
/**
|
|
535
|
+
* Updates a resource's schedule
|
|
536
|
+
* <!--ONLY:VELO
|
|
537
|
+
* The `updateResourceSchedule()` function returns a Promise that resolves when a resource's schedule has been updated.
|
|
538
|
+
* Use this function to update the bookings resource's schedule. To update other resource details use [`updateResource()`] (wix-bookings-backend/resources/updateresource).
|
|
539
|
+
* The following schedule properties can be updated:
|
|
540
|
+
* + `availability.start`
|
|
541
|
+
* + `availability.linkedSchedules`
|
|
542
|
+
* <!--END:ONLY:VELO-->
|
|
543
|
+
*
|
|
544
|
+
* To update a resource's schedule to remove business hours and add custom hours:
|
|
545
|
+
* <!--ONLY:REST-->
|
|
546
|
+
* + Update the resource's schedule to remove the business's `scheduleId` from the `availability.linkedSchedules` array.
|
|
547
|
+
* + Create a set of recurring sessions of type `"WORKING_HOURS"` to define the resource's new hours.
|
|
548
|
+
* <!--END:ONLY:REST-->
|
|
549
|
+
* <!--ONLY:VELO
|
|
550
|
+
* + Use [`updateResourceSchedule()`](wix-bookings-backend.Resources/updateresourcesession) to remove the business's scheduleId from the `availability.linkedSchedules` array.
|
|
551
|
+
* + Use [`createSession()`](wix-bookings-backend.Sessions/createsession) to create a set of recurring sessions of type `"WORKING_HOURS"` to define the resource's new hours.
|
|
552
|
+
* <!--END:ONLY:VELO-->
|
|
553
|
+
*
|
|
554
|
+
* To update a resource's schedule to add default business hours, and keep or remove custom hours:
|
|
555
|
+
* <!--ONLY:REST-->
|
|
556
|
+
* + Update the resource's schedule to add the business resource's `scheduleId` to the `availability.linkedSchedules` array.
|
|
557
|
+
* + If you want to remove the custom sessions, delete the resource's sessions of type `"WORKING_HOURS"`.
|
|
558
|
+
* You do not have to delete exiting custom sessions. Custom session that are not deleted will continue to be included in availability calculations and can still be booked.
|
|
559
|
+
* <!--END:ONLY:REST-->
|
|
560
|
+
* <!--ONLY:VELO
|
|
561
|
+
* + Use [`updateResourceSchedule()`](wix-bookings-backend.Resources/updateresourcesession) to add the business resource's `scheduleId` to the `availability.linkedSchedules` array.
|
|
562
|
+
* + If you want to remove the custom sessions, use [`deleteSession()`](wix-bookings-backend.Sessions/deletesession) to delete the resource's sessions of type `"WORKING_HOURS"`. You do not have to delete exiting custom sessions. You can have both default working hours and custom hours for the same schedule. Custom sessions that are not deleted will continue to be included in availability calculations and can still be booked.
|
|
563
|
+
*
|
|
564
|
+
* > **Notes:**
|
|
565
|
+
* > + The Wix Bookings app does not show both default business hours and custom hours on the **Staff** page in the dashboard. If you've set up both custom and default business hours, only the default business hours will appear in the app, although both are working.
|
|
566
|
+
* > + A resource can have one schedule only.
|
|
567
|
+
* > + A resource can have both default business hours and custom hours in its schedule.
|
|
568
|
+
* > + When updating a resource's schedule you cannot change the system tags used by the Wix Bookings app. Tags used by the app have the values `"INDIVIDUAL"`, `"GROUP"`, and `"COURSE”`.
|
|
569
|
+
* > + Only users with the **Bookings Admin** [role](https://support.wix.com/en/article/roles-permissions-overview#bookings-admin) can update a resource schedule. You can override the role permissions by setting the `options.suppressAuth` parameter to `true`.
|
|
570
|
+
* @snippet [updateResourceScheduleDefaultToCustom.es6=Update a resource's schedule from business to custom hours]
|
|
571
|
+
* Update a resource's schedule from the business's default working hours to 2 custom days per week.
|
|
572
|
+
* @snippet [updateResourceScheduleCustomToDefault.es6=Update a resource's schedule from custom to business hours]
|
|
573
|
+
* <!--END:ONLY:VELO-->
|
|
574
|
+
* <!--ONLY:REST-->
|
|
575
|
+
* >**Notes:**
|
|
576
|
+
* > + A resource can have one schedule only.
|
|
577
|
+
* > + A resource can have both default business hours and custom hours in its schedule.
|
|
578
|
+
* > + When updating a resource's schedule you cannot change the system tags used by the Wix Bookings app. Tags used by the app have the values `"INDIVIDUAL"`, `"GROUP"`, and `"COURSE”`.
|
|
579
|
+
* > + The `businessLocation.businessSchedule` object in the `schedule.location` object is not supported.
|
|
580
|
+
*
|
|
581
|
+
*
|
|
582
|
+
*
|
|
583
|
+
* >**Permissions:**
|
|
584
|
+
* > This endpoint requires the Manage Bookings [permission scope](https://devforum.wix.com/kb/en/article/available-permissions).
|
|
585
|
+
* <!--END:ONLY:REST-->
|
|
586
|
+
* @param resourceId - Resource id to update.
|
|
587
|
+
* @public
|
|
588
|
+
* @documentationMaturity preview
|
|
589
|
+
* @requiredField options.schedule._id
|
|
590
|
+
* @requiredField resourceId
|
|
591
|
+
*/
|
|
592
|
+
export function updateSchedule(resourceId, options) {
|
|
593
|
+
var _a, _b, _c;
|
|
594
|
+
return __awaiter(this, arguments, void 0, function* () {
|
|
595
|
+
const requestTransformation = {
|
|
596
|
+
resourceId: '$[0]',
|
|
597
|
+
fieldmask: '$[1].fieldmask',
|
|
598
|
+
schedule: '$[1].schedule',
|
|
599
|
+
};
|
|
600
|
+
const responseTransformation = '$';
|
|
601
|
+
// @ts-ignore
|
|
602
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
603
|
+
const { toAmbassadorRequest } = serializer({
|
|
604
|
+
rootSchema: _resourceUpdateScheduleRequest,
|
|
605
|
+
depSchemas: { _availability, _location, _locationsLocation, _schedule },
|
|
606
|
+
fqdnTransformation: {
|
|
607
|
+
paths: [],
|
|
608
|
+
transformation: _fromVeloEntity,
|
|
609
|
+
},
|
|
610
|
+
customTransformation: requestTransformation,
|
|
611
|
+
});
|
|
612
|
+
const { fromJSON } = serializer({
|
|
613
|
+
rootSchema: _updateScheduleResponse,
|
|
614
|
+
depSchemas: { _availability, _location, _locationsLocation, _schedule },
|
|
615
|
+
fqdnTransformation: {
|
|
616
|
+
paths: [],
|
|
617
|
+
transformation: _toVeloEntity,
|
|
618
|
+
},
|
|
619
|
+
customTransformation: responseTransformation,
|
|
620
|
+
});
|
|
621
|
+
const payload = toAmbassadorRequest([resourceId, options]);
|
|
622
|
+
const reqOpts = ambassadorWixBookingsCatalogV1Resource.updateSchedule(payload);
|
|
623
|
+
__log(`"UpdateSchedule" sending request with: ${__inspect(reqOpts)}`);
|
|
624
|
+
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
625
|
+
try {
|
|
626
|
+
const result = yield httpClient.request(reqOpts);
|
|
627
|
+
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
|
|
628
|
+
return fromJSON(result.data);
|
|
629
|
+
}
|
|
630
|
+
catch (err) {
|
|
631
|
+
const transformedError = transformError(err, requestTransformation, [
|
|
632
|
+
'resourceId',
|
|
633
|
+
'options',
|
|
634
|
+
]);
|
|
635
|
+
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
636
|
+
throw transformedError;
|
|
637
|
+
}
|
|
638
|
+
});
|
|
639
|
+
}
|
|
640
|
+
/**
|
|
641
|
+
* Deletes a resource.
|
|
642
|
+
* <!--ONLY:VELO
|
|
643
|
+
* The `deleteResource()` function returns a Promise that is resolved when a resource is deleted.
|
|
644
|
+
* <!--END:ONLY:VELO-->
|
|
645
|
+
* Deleting a resource updates its `status` to `"DELETED"`.
|
|
646
|
+
*
|
|
647
|
+
* You cannot delete a resource if it has booked sessions.
|
|
648
|
+
*
|
|
649
|
+
* <!--ONLY:VELO
|
|
650
|
+
* >**Notes:**
|
|
651
|
+
* > + The Bookings app automatically creates a resource with a name and tag of value `"business"``. This resource is used for the business's schedule and working hours and cannot be deleted.
|
|
652
|
+
* > + You can have up to 135 active resources and an additional 135 deleted resources.
|
|
653
|
+
* > + Only users with the **Bookings Admin** [role](https://support.wix.com/en/article/roles-permissions-overview#bookings-admin) can delete a resource. You can override the role permissions by setting the `options.suppressAuth` parameter to `true`.
|
|
654
|
+
* <!--END:ONLY:VELO-->
|
|
655
|
+
*
|
|
656
|
+
* <!--ONLY:REST-->
|
|
657
|
+
* >**Notes:**
|
|
658
|
+
* > + The Bookings app creates a resource with `"business"` in name and tag values. This resource is used for the business's schedule and working hours and cannot be deleted.
|
|
659
|
+
* > + You can have up to 135 active resources and an additional 135 deleted resources.
|
|
660
|
+
*
|
|
661
|
+
* >**Permissions:**
|
|
662
|
+
* > This endpoint requires the Manage Bookings [permission scope](https://devforum.wix.com/kb/en/article/available-permissions).
|
|
663
|
+
* <!--END:ONLY:REST-->
|
|
664
|
+
* @param _id - ID of the resource to delete.
|
|
665
|
+
* @public
|
|
666
|
+
* @documentationMaturity preview
|
|
667
|
+
* @requiredField _id
|
|
668
|
+
*/
|
|
669
|
+
export function _delete(_id) {
|
|
670
|
+
var _a, _b, _c;
|
|
671
|
+
return __awaiter(this, arguments, void 0, function* () {
|
|
672
|
+
const requestTransformation = { id: '$[0]' };
|
|
673
|
+
const responseTransformation = '$';
|
|
674
|
+
// @ts-ignore
|
|
675
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
676
|
+
const { toAmbassadorRequest } = serializer({
|
|
677
|
+
rootSchema: _deleteResourceRequest,
|
|
678
|
+
depSchemas: {},
|
|
679
|
+
fqdnTransformation: {
|
|
680
|
+
paths: [],
|
|
681
|
+
transformation: _fromVeloEntity,
|
|
682
|
+
},
|
|
683
|
+
customTransformation: requestTransformation,
|
|
684
|
+
});
|
|
685
|
+
const { fromJSON } = serializer({
|
|
686
|
+
rootSchema: _deleteResourceResponse,
|
|
687
|
+
depSchemas: {},
|
|
688
|
+
fqdnTransformation: {
|
|
689
|
+
paths: [],
|
|
690
|
+
transformation: _toVeloEntity,
|
|
691
|
+
},
|
|
692
|
+
customTransformation: responseTransformation,
|
|
693
|
+
});
|
|
694
|
+
const payload = toAmbassadorRequest([_id]);
|
|
695
|
+
const reqOpts = ambassadorWixBookingsCatalogV1Resource._delete(payload);
|
|
696
|
+
__log(`"_delete" sending request with: ${__inspect(reqOpts)}`);
|
|
697
|
+
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
698
|
+
try {
|
|
699
|
+
const result = yield httpClient.request(reqOpts);
|
|
700
|
+
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
|
|
701
|
+
return fromJSON(result.data);
|
|
702
|
+
}
|
|
703
|
+
catch (err) {
|
|
704
|
+
const transformedError = transformError(err, requestTransformation, [
|
|
705
|
+
'_id',
|
|
706
|
+
]);
|
|
707
|
+
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
708
|
+
throw transformedError;
|
|
709
|
+
}
|
|
710
|
+
});
|
|
711
|
+
}
|
|
712
|
+
//# sourceMappingURL=bookings-catalog-v1-resource.universal.js.map
|