@wix/bookings 1.0.174 → 1.0.176
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/src/bookings-availability-v1-slot-availability.types.d.ts +0 -1
- package/build/cjs/src/bookings-availability-v1-slot-availability.types.js.map +1 -1
- package/build/cjs/src/bookings-availability-v1-slot-availability.universal.d.ts +0 -2
- package/build/cjs/src/bookings-availability-v1-slot-availability.universal.js +0 -1
- package/build/cjs/src/bookings-availability-v1-slot-availability.universal.js.map +1 -1
- package/build/cjs/src/bookings-catalog-v1-resource.http.d.ts +125 -44
- package/build/cjs/src/bookings-catalog-v1-resource.http.js +125 -44
- package/build/cjs/src/bookings-catalog-v1-resource.http.js.map +1 -1
- package/build/cjs/src/bookings-catalog-v1-resource.public.d.ts +6 -6
- package/build/cjs/src/bookings-catalog-v1-resource.public.js +13 -13
- package/build/cjs/src/bookings-catalog-v1-resource.public.js.map +1 -1
- package/build/cjs/src/bookings-catalog-v1-resource.universal.d.ts +140 -57
- package/build/cjs/src/bookings-catalog-v1-resource.universal.js +135 -56
- package/build/cjs/src/bookings-catalog-v1-resource.universal.js.map +1 -1
- package/build/es/src/bookings-availability-v1-slot-availability.types.d.ts +0 -1
- package/build/es/src/bookings-availability-v1-slot-availability.types.js.map +1 -1
- package/build/es/src/bookings-availability-v1-slot-availability.universal.d.ts +0 -2
- package/build/es/src/bookings-availability-v1-slot-availability.universal.js +0 -1
- package/build/es/src/bookings-availability-v1-slot-availability.universal.js.map +1 -1
- package/build/es/src/bookings-catalog-v1-resource.http.d.ts +125 -44
- package/build/es/src/bookings-catalog-v1-resource.http.js +125 -44
- package/build/es/src/bookings-catalog-v1-resource.http.js.map +1 -1
- package/build/es/src/bookings-catalog-v1-resource.public.d.ts +6 -6
- package/build/es/src/bookings-catalog-v1-resource.public.js +9 -9
- package/build/es/src/bookings-catalog-v1-resource.public.js.map +1 -1
- package/build/es/src/bookings-catalog-v1-resource.universal.d.ts +140 -57
- package/build/es/src/bookings-catalog-v1-resource.universal.js +130 -51
- package/build/es/src/bookings-catalog-v1-resource.universal.js.map +1 -1
- package/package.json +2 -2
|
@@ -929,14 +929,26 @@ export interface ListOptions {
|
|
|
929
929
|
/**
|
|
930
930
|
* Retrieves a list of the resources according to the specified filters and paging.
|
|
931
931
|
*
|
|
932
|
+
* The query parameter is optional. If no query is provided than all non-deleted resources are returned.
|
|
932
933
|
*
|
|
933
|
-
*
|
|
934
|
+
* |Property|Is supported|
|
|
935
|
+
* |--|--|
|
|
936
|
+
* |filter | supported fields: `resource.id`, `resource.tags`, `resource.status`|
|
|
937
|
+
* |paging | supported |
|
|
938
|
+
* |fields | supported |
|
|
939
|
+
* |fieldsets | **not supported** |
|
|
940
|
+
* |sort | **not supported** |
|
|
934
941
|
*
|
|
935
|
-
* > **Notes:** The following objects in the query parameter are not supported for this query:
|
|
936
|
-
* > - sort
|
|
937
|
-
* > - fieldsets
|
|
938
942
|
*
|
|
943
|
+
* >**Notes:**
|
|
944
|
+
* > + The following objects in the `query` parameter are not supported for this query:
|
|
945
|
+
* > - `sort`
|
|
946
|
+
* > - `fieldsets`
|
|
947
|
+
*
|
|
948
|
+
* > **Permissions**
|
|
949
|
+
* > This endpoint requires the Read Bookings Calendar, Read Bookings - Public Data, Read Bookings - Including Participants or Manage Bookings permission scope.
|
|
939
950
|
* @public
|
|
951
|
+
* @documentationMaturity preview
|
|
940
952
|
* @permissionScope Read Bookings - Public Data
|
|
941
953
|
* @permissionScope Read bookings calendar - including participants
|
|
942
954
|
* @permissionScope Read Bookings Calendar
|
|
@@ -944,35 +956,54 @@ export interface ListOptions {
|
|
|
944
956
|
* @applicableIdentity MEMBER
|
|
945
957
|
* @applicableIdentity VISITOR
|
|
946
958
|
*/
|
|
947
|
-
export declare function
|
|
948
|
-
export interface
|
|
959
|
+
export declare function query(options?: QueryOptions): Promise<QueryResourcesResponse>;
|
|
960
|
+
export interface QueryOptions {
|
|
949
961
|
query?: QueryV2;
|
|
950
962
|
}
|
|
951
963
|
/**
|
|
952
964
|
* Creates a resource.
|
|
953
|
-
*
|
|
954
|
-
*
|
|
965
|
+
* <!--ONLY:VELO
|
|
955
966
|
* The `createResource()` function returns a Promise that resolves to the created resource.
|
|
956
|
-
*
|
|
967
|
+
* <!--END:ONLY:VELO-->
|
|
957
968
|
*
|
|
969
|
+
* 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.
|
|
970
|
+
* 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.
|
|
971
|
+
* You can use both individual and recurring sessions to define resource availability. You cannot use availability constraints for resource schedules.
|
|
958
972
|
*
|
|
973
|
+
* <!--ONLY:VELO
|
|
959
974
|
* When creating a resource using `createResource()`, include the resource's schedule information. Set the schedule information as follows:
|
|
960
|
-
*
|
|
961
|
-
*
|
|
962
|
-
*
|
|
963
|
-
*
|
|
975
|
+
* + 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.
|
|
976
|
+
* + 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.
|
|
977
|
+
* + You can have both default business hours and custom hours for the same resource schedule by combining the steps above.
|
|
964
978
|
*
|
|
965
979
|
* > **Notes:**
|
|
966
|
-
*
|
|
967
|
-
*
|
|
968
|
-
*
|
|
969
|
-
*
|
|
970
|
-
*
|
|
971
|
-
*
|
|
980
|
+
* > + 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.
|
|
981
|
+
* > + The Wix Bookings app does not show non-recurring `WORKING_HOURS` sessions in the resource calendar.
|
|
982
|
+
* > + You can only add the business resource's schedule as a linked schedule for a resource.
|
|
983
|
+
* > + A resource can have one schedule only.
|
|
984
|
+
* > + You can have up to 135 active resources and an additional 135 deleted resources.
|
|
985
|
+
* > + 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`.
|
|
986
|
+
* <!--END:ONLY:VELO-->
|
|
987
|
+
*
|
|
988
|
+
* <!--ONLY:REST-->
|
|
989
|
+
* Use the following steps to create resources:
|
|
990
|
+
* - Create the resource using including schedule information.
|
|
991
|
+
* - 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.
|
|
992
|
+
* - 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.
|
|
993
|
+
*
|
|
994
|
+
* >**Notes:**
|
|
995
|
+
* > + A resource can have one schedule only.
|
|
996
|
+
* > + You can have up to 135 active resources and an additional 135 deleted resources.
|
|
997
|
+
* > + The `businessLocation.businessSchedule` object in the `schedule.location` object is not supported.
|
|
998
|
+
*
|
|
972
999
|
*
|
|
973
|
-
*
|
|
1000
|
+
*
|
|
1001
|
+
* >**Permissions:**
|
|
1002
|
+
* > This endpoint requires the Manage Bookings [permission scope](https://devforum.wix.com/kb/en/article/available-permissions).
|
|
1003
|
+
* <!--END:ONLY:REST-->
|
|
974
1004
|
* @param resource - Resource details.
|
|
975
1005
|
* @public
|
|
1006
|
+
* @documentationMaturity preview
|
|
976
1007
|
* @requiredField options.schedules.availability.start
|
|
977
1008
|
* @requiredField options.schedules.intervals.start
|
|
978
1009
|
* @requiredField resource
|
|
@@ -980,8 +1011,8 @@ export interface QueryResourceCatalogOptions {
|
|
|
980
1011
|
* @permissionScope Manage Bookings
|
|
981
1012
|
* @applicableIdentity APP
|
|
982
1013
|
*/
|
|
983
|
-
export declare function
|
|
984
|
-
export interface
|
|
1014
|
+
export declare function create(resource: Resource, options?: CreateOptions): Promise<CreateResourceResponse>;
|
|
1015
|
+
export interface CreateOptions {
|
|
985
1016
|
/**
|
|
986
1017
|
* List of schedules to be assigned for the created resource. Currently only a single schedule is allowed.
|
|
987
1018
|
* If provided, any schedules in the resource entity will be ignored.
|
|
@@ -990,18 +1021,29 @@ export interface CreateResourceOptions {
|
|
|
990
1021
|
}
|
|
991
1022
|
/**
|
|
992
1023
|
* Updates a resource.
|
|
1024
|
+
* <!--ONLY:VELO
|
|
1025
|
+
* The `updateResource()` function returns a Promise that resolves when a resource is updated.
|
|
1026
|
+
* 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).
|
|
993
1027
|
*
|
|
994
|
-
*
|
|
995
|
-
*
|
|
996
|
-
*
|
|
1028
|
+
* >**Notes:**
|
|
1029
|
+
* > + 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"`.
|
|
1030
|
+
* > + 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`.
|
|
1031
|
+
* <!--END:ONLY:VELO-->
|
|
1032
|
+
* <!--ONLY:REST-->
|
|
1033
|
+
* Use this endpoint to update all resource information except for the resource's schedule. To update a resource's schedule use
|
|
1034
|
+
* the [Update Schedule](https://dev.wix.com/api/rest/wix-bookings/resources/update-schedule) endpoint.
|
|
997
1035
|
*
|
|
998
1036
|
* >**Notes:**
|
|
999
|
-
*
|
|
1000
|
-
*
|
|
1037
|
+
* > + 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"`.
|
|
1038
|
+
* > + 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”`.
|
|
1039
|
+
* > + The `businessLocation.businessSchedule` object in the `schedule.location` object is not supported.
|
|
1001
1040
|
*
|
|
1002
|
-
*
|
|
1041
|
+
* >**Permissions:**
|
|
1042
|
+
* > This endpoint requires the Manage Bookings [permission scope](https://devforum.wix.com/kb/en/article/available-permissions).
|
|
1043
|
+
* <!--END:ONLY:REST-->
|
|
1003
1044
|
* @param _id - Resource ID.
|
|
1004
1045
|
* @public
|
|
1046
|
+
* @documentationMaturity preview
|
|
1005
1047
|
* @requiredField _id
|
|
1006
1048
|
* @requiredField scheduleActions.cancelRequests.scheduleId
|
|
1007
1049
|
* @requiredField scheduleActions.createRequests.schedule.availability.start
|
|
@@ -1011,8 +1053,8 @@ export interface CreateResourceOptions {
|
|
|
1011
1053
|
* @permissionScope Manage Bookings
|
|
1012
1054
|
* @applicableIdentity APP
|
|
1013
1055
|
*/
|
|
1014
|
-
export declare function
|
|
1015
|
-
export interface
|
|
1056
|
+
export declare function update(_id: string | null, options?: UpdateOptions): Promise<UpdateResourceResponse>;
|
|
1057
|
+
export interface UpdateOptions {
|
|
1016
1058
|
resource: {
|
|
1017
1059
|
/**
|
|
1018
1060
|
* Resource ID.
|
|
@@ -1027,13 +1069,17 @@ export interface UpdateResourceOptions {
|
|
|
1027
1069
|
phone?: string | null;
|
|
1028
1070
|
/** Resource description. */
|
|
1029
1071
|
description?: string | null;
|
|
1030
|
-
/**
|
|
1072
|
+
/**
|
|
1073
|
+
* @internal
|
|
1074
|
+
* @internal */
|
|
1031
1075
|
tag?: string | null;
|
|
1032
1076
|
/** Resource tags. Tags are used to identify, group, and filter the different types of resources. For example, 'staff' or 'room'. */
|
|
1033
1077
|
tags?: string[] | null;
|
|
1034
1078
|
/** Resource images. */
|
|
1035
1079
|
images?: string[];
|
|
1036
|
-
/**
|
|
1080
|
+
/**
|
|
1081
|
+
* @internal
|
|
1082
|
+
* @internal */
|
|
1037
1083
|
schedules?: Schedule[];
|
|
1038
1084
|
/**
|
|
1039
1085
|
* List of IDs of schedules owned by this resource.
|
|
@@ -1065,39 +1111,67 @@ export interface UpdateResourceOptions {
|
|
|
1065
1111
|
fieldMask?: string[];
|
|
1066
1112
|
}
|
|
1067
1113
|
/**
|
|
1068
|
-
* Updates a resource's schedule
|
|
1069
|
-
*
|
|
1070
|
-
*
|
|
1071
|
-
*
|
|
1072
|
-
*
|
|
1073
|
-
*
|
|
1074
|
-
*
|
|
1075
|
-
*
|
|
1076
|
-
*
|
|
1114
|
+
* Updates a resource's schedule
|
|
1115
|
+
* <!--ONLY:VELO
|
|
1116
|
+
* The `updateResourceSchedule()` function returns a Promise that resolves when a resource's schedule has been updated.
|
|
1117
|
+
* Use this function to update the bookings resource's schedule. To update other resource details use [`updateResource()`] (wix-bookings-backend/resources/updateresource).
|
|
1118
|
+
* The following schedule properties can be updated:
|
|
1119
|
+
* + `availability.start`
|
|
1120
|
+
* + `availability.linkedSchedules`
|
|
1121
|
+
* <!--END:ONLY:VELO-->
|
|
1077
1122
|
*
|
|
1078
1123
|
* To update a resource's schedule to remove business hours and add custom hours:
|
|
1079
|
-
*
|
|
1080
|
-
*
|
|
1081
|
-
*
|
|
1124
|
+
* <!--ONLY:REST-->
|
|
1125
|
+
* + Update the resource's schedule to remove the business's `scheduleId` from the `availability.linkedSchedules` array.
|
|
1126
|
+
* + Create a set of recurring sessions of type `"WORKING_HOURS"` to define the resource's new hours.
|
|
1127
|
+
* <!--END:ONLY:REST-->
|
|
1128
|
+
* <!--ONLY:VELO
|
|
1129
|
+
* + Use [`updateResourceSchedule()`](wix-bookings-backend.Resources/updateresourcesession) to remove the business's scheduleId from the `availability.linkedSchedules` array.
|
|
1130
|
+
* + 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.
|
|
1131
|
+
* <!--END:ONLY:VELO-->
|
|
1082
1132
|
*
|
|
1083
1133
|
* To update a resource's schedule to add default business hours, and keep or remove custom hours:
|
|
1134
|
+
* <!--ONLY:REST-->
|
|
1135
|
+
* + Update the resource's schedule to add the business resource's `scheduleId` to the `availability.linkedSchedules` array.
|
|
1136
|
+
* + If you want to remove the custom sessions, delete the resource's sessions of type `"WORKING_HOURS"`.
|
|
1137
|
+
* 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.
|
|
1138
|
+
* <!--END:ONLY:REST-->
|
|
1139
|
+
* <!--ONLY:VELO
|
|
1140
|
+
* + Use [`updateResourceSchedule()`](wix-bookings-backend.Resources/updateresourcesession) to add the business resource's `scheduleId` to the `availability.linkedSchedules` array.
|
|
1141
|
+
* + 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.
|
|
1084
1142
|
*
|
|
1085
|
-
*
|
|
1086
|
-
*
|
|
1143
|
+
* > **Notes:**
|
|
1144
|
+
* > + 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.
|
|
1145
|
+
* > + A resource can have one schedule only.
|
|
1146
|
+
* > + A resource can have both default business hours and custom hours in its schedule.
|
|
1147
|
+
* > + 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”`.
|
|
1148
|
+
* > + 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`.
|
|
1149
|
+
* @snippet [updateResourceScheduleDefaultToCustom.es6=Update a resource's schedule from business to custom hours]
|
|
1150
|
+
* Update a resource's schedule from the business's default working hours to 2 custom days per week.
|
|
1151
|
+
* @snippet [updateResourceScheduleCustomToDefault.es6=Update a resource's schedule from custom to business hours]
|
|
1152
|
+
* <!--END:ONLY:VELO-->
|
|
1153
|
+
* <!--ONLY:REST-->
|
|
1154
|
+
* >**Notes:**
|
|
1155
|
+
* > + A resource can have one schedule only.
|
|
1156
|
+
* > + A resource can have both default business hours and custom hours in its schedule.
|
|
1157
|
+
* > + 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”`.
|
|
1158
|
+
* > + The `businessLocation.businessSchedule` object in the `schedule.location` object is not supported.
|
|
1087
1159
|
*
|
|
1088
1160
|
*
|
|
1089
|
-
* > **Notes:** 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. A resource can have one schedule only. A resource can have both default business hours and custom hours in its schedule. 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`. Only users with the **Bookings Admin** [role](https://support.wix.com/en/article/roles-permissions-overview#bookings-admin) can update a resource schedule.
|
|
1090
1161
|
*
|
|
1091
|
-
*
|
|
1162
|
+
* >**Permissions:**
|
|
1163
|
+
* > This endpoint requires the Manage Bookings [permission scope](https://devforum.wix.com/kb/en/article/available-permissions).
|
|
1164
|
+
* <!--END:ONLY:REST-->
|
|
1092
1165
|
* @param resourceId - Resource id to update.
|
|
1093
1166
|
* @public
|
|
1167
|
+
* @documentationMaturity preview
|
|
1094
1168
|
* @requiredField options.schedule._id
|
|
1095
1169
|
* @requiredField resourceId
|
|
1096
1170
|
* @permissionScope Manage Bookings
|
|
1097
1171
|
* @applicableIdentity APP
|
|
1098
1172
|
*/
|
|
1099
|
-
export declare function
|
|
1100
|
-
export interface
|
|
1173
|
+
export declare function updateSchedule(resourceId: string | null, options?: UpdateScheduleOptions): Promise<UpdateScheduleResponse>;
|
|
1174
|
+
export interface UpdateScheduleOptions {
|
|
1101
1175
|
/** Fieldmask for schedule */
|
|
1102
1176
|
fieldmask?: string[];
|
|
1103
1177
|
/** The schedule to update */
|
|
@@ -1105,19 +1179,28 @@ export interface UpdateResourceScheduleOptions {
|
|
|
1105
1179
|
}
|
|
1106
1180
|
/**
|
|
1107
1181
|
* Deletes a resource.
|
|
1108
|
-
*
|
|
1182
|
+
* <!--ONLY:VELO
|
|
1109
1183
|
* The `deleteResource()` function returns a Promise that is resolved when a resource is deleted.
|
|
1110
|
-
*
|
|
1111
|
-
*
|
|
1112
|
-
* Deleting a resource updates its status to `DELETED`.
|
|
1184
|
+
* <!--END:ONLY:VELO-->
|
|
1185
|
+
* Deleting a resource updates its `status` to `"DELETED"`.
|
|
1113
1186
|
*
|
|
1114
1187
|
* You cannot delete a resource if it has booked sessions.
|
|
1115
1188
|
*
|
|
1189
|
+
* <!--ONLY:VELO
|
|
1190
|
+
* >**Notes:**
|
|
1191
|
+
* > + 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.
|
|
1192
|
+
* > + You can have up to 135 active resources and an additional 135 deleted resources.
|
|
1193
|
+
* > + 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`.
|
|
1194
|
+
* <!--END:ONLY:VELO-->
|
|
1116
1195
|
*
|
|
1196
|
+
* <!--ONLY:REST-->
|
|
1117
1197
|
* >**Notes:**
|
|
1118
|
-
*
|
|
1119
|
-
*
|
|
1120
|
-
*
|
|
1198
|
+
* > + 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.
|
|
1199
|
+
* > + You can have up to 135 active resources and an additional 135 deleted resources.
|
|
1200
|
+
*
|
|
1201
|
+
* >**Permissions:**
|
|
1202
|
+
* > This endpoint requires the Manage Bookings [permission scope](https://devforum.wix.com/kb/en/article/available-permissions).
|
|
1203
|
+
* <!--END:ONLY:REST-->
|
|
1121
1204
|
* @param _id - ID of the resource to delete.
|
|
1122
1205
|
* @public
|
|
1123
1206
|
* @documentationMaturity preview
|
|
@@ -244,14 +244,26 @@ export function list(options) {
|
|
|
244
244
|
/**
|
|
245
245
|
* Retrieves a list of the resources according to the specified filters and paging.
|
|
246
246
|
*
|
|
247
|
+
* The query parameter is optional. If no query is provided than all non-deleted resources are returned.
|
|
247
248
|
*
|
|
248
|
-
*
|
|
249
|
+
* |Property|Is supported|
|
|
250
|
+
* |--|--|
|
|
251
|
+
* |filter | supported fields: `resource.id`, `resource.tags`, `resource.status`|
|
|
252
|
+
* |paging | supported |
|
|
253
|
+
* |fields | supported |
|
|
254
|
+
* |fieldsets | **not supported** |
|
|
255
|
+
* |sort | **not supported** |
|
|
249
256
|
*
|
|
250
|
-
* > **Notes:** The following objects in the query parameter are not supported for this query:
|
|
251
|
-
* > - sort
|
|
252
|
-
* > - fieldsets
|
|
253
257
|
*
|
|
258
|
+
* >**Notes:**
|
|
259
|
+
* > + The following objects in the `query` parameter are not supported for this query:
|
|
260
|
+
* > - `sort`
|
|
261
|
+
* > - `fieldsets`
|
|
262
|
+
*
|
|
263
|
+
* > **Permissions**
|
|
264
|
+
* > This endpoint requires the Read Bookings Calendar, Read Bookings - Public Data, Read Bookings - Including Participants or Manage Bookings permission scope.
|
|
254
265
|
* @public
|
|
266
|
+
* @documentationMaturity preview
|
|
255
267
|
* @permissionScope Read Bookings - Public Data
|
|
256
268
|
* @permissionScope Read bookings calendar - including participants
|
|
257
269
|
* @permissionScope Read Bookings Calendar
|
|
@@ -259,7 +271,7 @@ export function list(options) {
|
|
|
259
271
|
* @applicableIdentity MEMBER
|
|
260
272
|
* @applicableIdentity VISITOR
|
|
261
273
|
*/
|
|
262
|
-
export function
|
|
274
|
+
export function query(options) {
|
|
263
275
|
var _a, _b, _c;
|
|
264
276
|
return __awaiter(this, arguments, void 0, function* () {
|
|
265
277
|
const requestTransformation = { query: '$[0].query' };
|
|
@@ -310,29 +322,48 @@ export function queryResourceCatalog(options) {
|
|
|
310
322
|
}
|
|
311
323
|
/**
|
|
312
324
|
* Creates a resource.
|
|
313
|
-
*
|
|
314
|
-
*
|
|
325
|
+
* <!--ONLY:VELO
|
|
315
326
|
* The `createResource()` function returns a Promise that resolves to the created resource.
|
|
316
|
-
*
|
|
327
|
+
* <!--END:ONLY:VELO-->
|
|
317
328
|
*
|
|
329
|
+
* 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.
|
|
330
|
+
* 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.
|
|
331
|
+
* You can use both individual and recurring sessions to define resource availability. You cannot use availability constraints for resource schedules.
|
|
318
332
|
*
|
|
333
|
+
* <!--ONLY:VELO
|
|
319
334
|
* When creating a resource using `createResource()`, include the resource's schedule information. Set the schedule information as follows:
|
|
320
|
-
*
|
|
321
|
-
*
|
|
322
|
-
*
|
|
323
|
-
*
|
|
335
|
+
* + 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.
|
|
336
|
+
* + 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.
|
|
337
|
+
* + You can have both default business hours and custom hours for the same resource schedule by combining the steps above.
|
|
324
338
|
*
|
|
325
339
|
* > **Notes:**
|
|
326
|
-
*
|
|
327
|
-
*
|
|
328
|
-
*
|
|
329
|
-
*
|
|
330
|
-
*
|
|
331
|
-
*
|
|
340
|
+
* > + 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.
|
|
341
|
+
* > + The Wix Bookings app does not show non-recurring `WORKING_HOURS` sessions in the resource calendar.
|
|
342
|
+
* > + You can only add the business resource's schedule as a linked schedule for a resource.
|
|
343
|
+
* > + A resource can have one schedule only.
|
|
344
|
+
* > + You can have up to 135 active resources and an additional 135 deleted resources.
|
|
345
|
+
* > + 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`.
|
|
346
|
+
* <!--END:ONLY:VELO-->
|
|
347
|
+
*
|
|
348
|
+
* <!--ONLY:REST-->
|
|
349
|
+
* Use the following steps to create resources:
|
|
350
|
+
* - Create the resource using including schedule information.
|
|
351
|
+
* - 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.
|
|
352
|
+
* - 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.
|
|
353
|
+
*
|
|
354
|
+
* >**Notes:**
|
|
355
|
+
* > + A resource can have one schedule only.
|
|
356
|
+
* > + You can have up to 135 active resources and an additional 135 deleted resources.
|
|
357
|
+
* > + The `businessLocation.businessSchedule` object in the `schedule.location` object is not supported.
|
|
332
358
|
*
|
|
333
|
-
*
|
|
359
|
+
*
|
|
360
|
+
*
|
|
361
|
+
* >**Permissions:**
|
|
362
|
+
* > This endpoint requires the Manage Bookings [permission scope](https://devforum.wix.com/kb/en/article/available-permissions).
|
|
363
|
+
* <!--END:ONLY:REST-->
|
|
334
364
|
* @param resource - Resource details.
|
|
335
365
|
* @public
|
|
366
|
+
* @documentationMaturity preview
|
|
336
367
|
* @requiredField options.schedules.availability.start
|
|
337
368
|
* @requiredField options.schedules.intervals.start
|
|
338
369
|
* @requiredField resource
|
|
@@ -340,7 +371,7 @@ export function queryResourceCatalog(options) {
|
|
|
340
371
|
* @permissionScope Manage Bookings
|
|
341
372
|
* @applicableIdentity APP
|
|
342
373
|
*/
|
|
343
|
-
export function
|
|
374
|
+
export function create(resource, options) {
|
|
344
375
|
var _a, _b, _c;
|
|
345
376
|
return __awaiter(this, arguments, void 0, function* () {
|
|
346
377
|
const requestTransformation = {
|
|
@@ -401,18 +432,29 @@ export function createResource(resource, options) {
|
|
|
401
432
|
}
|
|
402
433
|
/**
|
|
403
434
|
* Updates a resource.
|
|
435
|
+
* <!--ONLY:VELO
|
|
436
|
+
* The `updateResource()` function returns a Promise that resolves when a resource is updated.
|
|
437
|
+
* 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).
|
|
404
438
|
*
|
|
405
|
-
*
|
|
406
|
-
*
|
|
407
|
-
*
|
|
439
|
+
* >**Notes:**
|
|
440
|
+
* > + 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"`.
|
|
441
|
+
* > + 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`.
|
|
442
|
+
* <!--END:ONLY:VELO-->
|
|
443
|
+
* <!--ONLY:REST-->
|
|
444
|
+
* Use this endpoint to update all resource information except for the resource's schedule. To update a resource's schedule use
|
|
445
|
+
* the [Update Schedule](https://dev.wix.com/api/rest/wix-bookings/resources/update-schedule) endpoint.
|
|
408
446
|
*
|
|
409
447
|
* >**Notes:**
|
|
410
|
-
*
|
|
411
|
-
*
|
|
448
|
+
* > + 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"`.
|
|
449
|
+
* > + 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”`.
|
|
450
|
+
* > + The `businessLocation.businessSchedule` object in the `schedule.location` object is not supported.
|
|
412
451
|
*
|
|
413
|
-
*
|
|
452
|
+
* >**Permissions:**
|
|
453
|
+
* > This endpoint requires the Manage Bookings [permission scope](https://devforum.wix.com/kb/en/article/available-permissions).
|
|
454
|
+
* <!--END:ONLY:REST-->
|
|
414
455
|
* @param _id - Resource ID.
|
|
415
456
|
* @public
|
|
457
|
+
* @documentationMaturity preview
|
|
416
458
|
* @requiredField _id
|
|
417
459
|
* @requiredField scheduleActions.cancelRequests.scheduleId
|
|
418
460
|
* @requiredField scheduleActions.createRequests.schedule.availability.start
|
|
@@ -422,7 +464,7 @@ export function createResource(resource, options) {
|
|
|
422
464
|
* @permissionScope Manage Bookings
|
|
423
465
|
* @applicableIdentity APP
|
|
424
466
|
*/
|
|
425
|
-
export function
|
|
467
|
+
export function update(_id, options) {
|
|
426
468
|
var _a, _b, _c;
|
|
427
469
|
return __awaiter(this, arguments, void 0, function* () {
|
|
428
470
|
const requestTransformation = {
|
|
@@ -486,38 +528,66 @@ export function updateResource(_id, options) {
|
|
|
486
528
|
});
|
|
487
529
|
}
|
|
488
530
|
/**
|
|
489
|
-
* Updates a resource's schedule
|
|
490
|
-
*
|
|
491
|
-
*
|
|
492
|
-
*
|
|
493
|
-
*
|
|
494
|
-
*
|
|
495
|
-
*
|
|
496
|
-
*
|
|
497
|
-
*
|
|
531
|
+
* Updates a resource's schedule
|
|
532
|
+
* <!--ONLY:VELO
|
|
533
|
+
* The `updateResourceSchedule()` function returns a Promise that resolves when a resource's schedule has been updated.
|
|
534
|
+
* Use this function to update the bookings resource's schedule. To update other resource details use [`updateResource()`] (wix-bookings-backend/resources/updateresource).
|
|
535
|
+
* The following schedule properties can be updated:
|
|
536
|
+
* + `availability.start`
|
|
537
|
+
* + `availability.linkedSchedules`
|
|
538
|
+
* <!--END:ONLY:VELO-->
|
|
498
539
|
*
|
|
499
540
|
* To update a resource's schedule to remove business hours and add custom hours:
|
|
500
|
-
*
|
|
501
|
-
*
|
|
502
|
-
*
|
|
541
|
+
* <!--ONLY:REST-->
|
|
542
|
+
* + Update the resource's schedule to remove the business's `scheduleId` from the `availability.linkedSchedules` array.
|
|
543
|
+
* + Create a set of recurring sessions of type `"WORKING_HOURS"` to define the resource's new hours.
|
|
544
|
+
* <!--END:ONLY:REST-->
|
|
545
|
+
* <!--ONLY:VELO
|
|
546
|
+
* + Use [`updateResourceSchedule()`](wix-bookings-backend.Resources/updateresourcesession) to remove the business's scheduleId from the `availability.linkedSchedules` array.
|
|
547
|
+
* + 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.
|
|
548
|
+
* <!--END:ONLY:VELO-->
|
|
503
549
|
*
|
|
504
550
|
* To update a resource's schedule to add default business hours, and keep or remove custom hours:
|
|
551
|
+
* <!--ONLY:REST-->
|
|
552
|
+
* + Update the resource's schedule to add the business resource's `scheduleId` to the `availability.linkedSchedules` array.
|
|
553
|
+
* + If you want to remove the custom sessions, delete the resource's sessions of type `"WORKING_HOURS"`.
|
|
554
|
+
* 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.
|
|
555
|
+
* <!--END:ONLY:REST-->
|
|
556
|
+
* <!--ONLY:VELO
|
|
557
|
+
* + Use [`updateResourceSchedule()`](wix-bookings-backend.Resources/updateresourcesession) to add the business resource's `scheduleId` to the `availability.linkedSchedules` array.
|
|
558
|
+
* + 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.
|
|
505
559
|
*
|
|
506
|
-
*
|
|
507
|
-
*
|
|
560
|
+
* > **Notes:**
|
|
561
|
+
* > + 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.
|
|
562
|
+
* > + A resource can have one schedule only.
|
|
563
|
+
* > + A resource can have both default business hours and custom hours in its schedule.
|
|
564
|
+
* > + 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”`.
|
|
565
|
+
* > + 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`.
|
|
566
|
+
* @snippet [updateResourceScheduleDefaultToCustom.es6=Update a resource's schedule from business to custom hours]
|
|
567
|
+
* Update a resource's schedule from the business's default working hours to 2 custom days per week.
|
|
568
|
+
* @snippet [updateResourceScheduleCustomToDefault.es6=Update a resource's schedule from custom to business hours]
|
|
569
|
+
* <!--END:ONLY:VELO-->
|
|
570
|
+
* <!--ONLY:REST-->
|
|
571
|
+
* >**Notes:**
|
|
572
|
+
* > + A resource can have one schedule only.
|
|
573
|
+
* > + A resource can have both default business hours and custom hours in its schedule.
|
|
574
|
+
* > + 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”`.
|
|
575
|
+
* > + The `businessLocation.businessSchedule` object in the `schedule.location` object is not supported.
|
|
508
576
|
*
|
|
509
577
|
*
|
|
510
|
-
* > **Notes:** 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. A resource can have one schedule only. A resource can have both default business hours and custom hours in its schedule. 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`. Only users with the **Bookings Admin** [role](https://support.wix.com/en/article/roles-permissions-overview#bookings-admin) can update a resource schedule.
|
|
511
578
|
*
|
|
512
|
-
*
|
|
579
|
+
* >**Permissions:**
|
|
580
|
+
* > This endpoint requires the Manage Bookings [permission scope](https://devforum.wix.com/kb/en/article/available-permissions).
|
|
581
|
+
* <!--END:ONLY:REST-->
|
|
513
582
|
* @param resourceId - Resource id to update.
|
|
514
583
|
* @public
|
|
584
|
+
* @documentationMaturity preview
|
|
515
585
|
* @requiredField options.schedule._id
|
|
516
586
|
* @requiredField resourceId
|
|
517
587
|
* @permissionScope Manage Bookings
|
|
518
588
|
* @applicableIdentity APP
|
|
519
589
|
*/
|
|
520
|
-
export function
|
|
590
|
+
export function updateSchedule(resourceId, options) {
|
|
521
591
|
var _a, _b, _c;
|
|
522
592
|
return __awaiter(this, arguments, void 0, function* () {
|
|
523
593
|
const requestTransformation = {
|
|
@@ -567,19 +637,28 @@ export function updateResourceSchedule(resourceId, options) {
|
|
|
567
637
|
}
|
|
568
638
|
/**
|
|
569
639
|
* Deletes a resource.
|
|
570
|
-
*
|
|
640
|
+
* <!--ONLY:VELO
|
|
571
641
|
* The `deleteResource()` function returns a Promise that is resolved when a resource is deleted.
|
|
572
|
-
*
|
|
573
|
-
*
|
|
574
|
-
* Deleting a resource updates its status to `DELETED`.
|
|
642
|
+
* <!--END:ONLY:VELO-->
|
|
643
|
+
* Deleting a resource updates its `status` to `"DELETED"`.
|
|
575
644
|
*
|
|
576
645
|
* You cannot delete a resource if it has booked sessions.
|
|
577
646
|
*
|
|
647
|
+
* <!--ONLY:VELO
|
|
648
|
+
* >**Notes:**
|
|
649
|
+
* > + 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.
|
|
650
|
+
* > + You can have up to 135 active resources and an additional 135 deleted resources.
|
|
651
|
+
* > + 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`.
|
|
652
|
+
* <!--END:ONLY:VELO-->
|
|
578
653
|
*
|
|
654
|
+
* <!--ONLY:REST-->
|
|
579
655
|
* >**Notes:**
|
|
580
|
-
*
|
|
581
|
-
*
|
|
582
|
-
*
|
|
656
|
+
* > + 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.
|
|
657
|
+
* > + You can have up to 135 active resources and an additional 135 deleted resources.
|
|
658
|
+
*
|
|
659
|
+
* >**Permissions:**
|
|
660
|
+
* > This endpoint requires the Manage Bookings [permission scope](https://devforum.wix.com/kb/en/article/available-permissions).
|
|
661
|
+
* <!--END:ONLY:REST-->
|
|
583
662
|
* @param _id - ID of the resource to delete.
|
|
584
663
|
* @public
|
|
585
664
|
* @documentationMaturity preview
|