@wix/bookings 1.0.178 → 1.0.179
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-catalog-v1-resource.http.d.ts +44 -125
- package/build/cjs/src/bookings-catalog-v1-resource.http.js +44 -125
- 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 +57 -140
- package/build/cjs/src/bookings-catalog-v1-resource.universal.js +56 -135
- package/build/cjs/src/bookings-catalog-v1-resource.universal.js.map +1 -1
- package/build/es/src/bookings-catalog-v1-resource.http.d.ts +44 -125
- package/build/es/src/bookings-catalog-v1-resource.http.js +44 -125
- 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 +57 -140
- package/build/es/src/bookings-catalog-v1-resource.universal.js +51 -130
- package/build/es/src/bookings-catalog-v1-resource.universal.js.map +1 -1
- package/package.json +2 -2
|
@@ -929,26 +929,14 @@ 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.
|
|
933
932
|
*
|
|
934
|
-
*
|
|
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** |
|
|
933
|
+
* The query parameter is optional. If no query is provided, all non-deleted resources are returned.
|
|
941
934
|
*
|
|
935
|
+
* > **Notes:** The following objects in the query parameter are not supported for this query:
|
|
936
|
+
* > - sort
|
|
937
|
+
* > - fieldsets
|
|
942
938
|
*
|
|
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.
|
|
950
939
|
* @public
|
|
951
|
-
* @documentationMaturity preview
|
|
952
940
|
* @permissionScope Read Bookings - Public Data
|
|
953
941
|
* @permissionScope Read bookings calendar - including participants
|
|
954
942
|
* @permissionScope Read Bookings Calendar
|
|
@@ -956,54 +944,35 @@ export interface ListOptions {
|
|
|
956
944
|
* @applicableIdentity MEMBER
|
|
957
945
|
* @applicableIdentity VISITOR
|
|
958
946
|
*/
|
|
959
|
-
export declare function
|
|
960
|
-
export interface
|
|
947
|
+
export declare function queryResourceCatalog(options?: QueryResourceCatalogOptions): Promise<QueryResourcesResponse>;
|
|
948
|
+
export interface QueryResourceCatalogOptions {
|
|
961
949
|
query?: QueryV2;
|
|
962
950
|
}
|
|
963
951
|
/**
|
|
964
952
|
* Creates a resource.
|
|
965
|
-
* <!--ONLY:VELO
|
|
966
|
-
* The `createResource()` function returns a Promise that resolves to the created resource.
|
|
967
|
-
* <!--END:ONLY:VELO-->
|
|
968
953
|
*
|
|
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.
|
|
972
954
|
*
|
|
973
|
-
*
|
|
974
|
-
*
|
|
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.
|
|
978
|
-
*
|
|
979
|
-
* > **Notes:**
|
|
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-->
|
|
955
|
+
* The `createResource()` function returns a Promise that resolves to the created resource.
|
|
956
|
+
* 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. 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. You can use both individual and recurring sessions to define resource availability. You cannot use availability constraints for resource schedules.
|
|
987
957
|
*
|
|
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
958
|
*
|
|
994
|
-
*
|
|
995
|
-
*
|
|
996
|
-
*
|
|
997
|
-
*
|
|
959
|
+
* When creating a resource using `createResource()`, include the resource's schedule information. Set the schedule information as follows:
|
|
960
|
+
* - 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.
|
|
961
|
+
* - If the resource has its own custom working hours, create the resource, then create sessions of type `WORKING_HOURS` using the [`createSession()`](wix-bookings-v2/sessions/createsession) function. Use the `scheduleId` returned from `createResource()` when creating the sessions. These session can be single sessions or recurring sessions.
|
|
962
|
+
* - You can have both default business hours and custom hours for the same resource schedule by combining the steps above.
|
|
998
963
|
*
|
|
999
964
|
*
|
|
965
|
+
* > **Notes:**
|
|
966
|
+
* - 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.
|
|
967
|
+
* - The Wix Bookings app does not show non-recurring `WORKING_HOURS` sessions in the resource calendar.
|
|
968
|
+
* - You can only add the business resource's schedule as a linked schedule for a resource.
|
|
969
|
+
* - A resource can have one schedule only.
|
|
970
|
+
* - You can have up to 135 active resources and an additional 135 deleted resources.
|
|
971
|
+
* - Only users with the **Bookings Admin** [role](https://support.wix.com/en/article/roles-permissions-overview#bookings-admin) can create a resource.
|
|
1000
972
|
*
|
|
1001
|
-
*
|
|
1002
|
-
* > This endpoint requires the Manage Bookings [permission scope](https://devforum.wix.com/kb/en/article/available-permissions).
|
|
1003
|
-
* <!--END:ONLY:REST-->
|
|
973
|
+
* This function is not a universal function and runs only on the backend.
|
|
1004
974
|
* @param resource - Resource details.
|
|
1005
975
|
* @public
|
|
1006
|
-
* @documentationMaturity preview
|
|
1007
976
|
* @requiredField options.schedules.availability.start
|
|
1008
977
|
* @requiredField options.schedules.intervals.start
|
|
1009
978
|
* @requiredField resource
|
|
@@ -1011,8 +980,8 @@ export interface QueryOptions {
|
|
|
1011
980
|
* @permissionScope Manage Bookings
|
|
1012
981
|
* @applicableIdentity APP
|
|
1013
982
|
*/
|
|
1014
|
-
export declare function
|
|
1015
|
-
export interface
|
|
983
|
+
export declare function createResource(resource: Resource, options?: CreateResourceOptions): Promise<CreateResourceResponse>;
|
|
984
|
+
export interface CreateResourceOptions {
|
|
1016
985
|
/**
|
|
1017
986
|
* List of schedules to be assigned for the created resource. Currently only a single schedule is allowed.
|
|
1018
987
|
* If provided, any schedules in the resource entity will be ignored.
|
|
@@ -1021,29 +990,18 @@ export interface CreateOptions {
|
|
|
1021
990
|
}
|
|
1022
991
|
/**
|
|
1023
992
|
* 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).
|
|
1027
993
|
*
|
|
1028
|
-
*
|
|
1029
|
-
*
|
|
1030
|
-
*
|
|
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.
|
|
994
|
+
*
|
|
995
|
+
* The `updateResource()` function returns a Promise that resolves when a resource is updated. Use this function to update all bookings resource information except for the resource's schedule. To update a resource's schedule use [`updateResourceSchedule()`](#updateresourceschedule).
|
|
996
|
+
*
|
|
1035
997
|
*
|
|
1036
998
|
* >**Notes:**
|
|
1037
|
-
*
|
|
1038
|
-
*
|
|
1039
|
-
* > + The `businessLocation.businessSchedule` object in the `schedule.location` object is not supported.
|
|
999
|
+
* - 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"`.
|
|
1000
|
+
* - Only users with the **Bookings Admin** [role](https://support.wix.com/en/article/roles-permissions-overview#bookings-admin) can update a resource.
|
|
1040
1001
|
*
|
|
1041
|
-
*
|
|
1042
|
-
* > This endpoint requires the Manage Bookings [permission scope](https://devforum.wix.com/kb/en/article/available-permissions).
|
|
1043
|
-
* <!--END:ONLY:REST-->
|
|
1002
|
+
* This function is not a universal function and runs only on the backend.
|
|
1044
1003
|
* @param _id - Resource ID.
|
|
1045
1004
|
* @public
|
|
1046
|
-
* @documentationMaturity preview
|
|
1047
1005
|
* @requiredField _id
|
|
1048
1006
|
* @requiredField scheduleActions.cancelRequests.scheduleId
|
|
1049
1007
|
* @requiredField scheduleActions.createRequests.schedule.availability.start
|
|
@@ -1053,8 +1011,8 @@ export interface CreateOptions {
|
|
|
1053
1011
|
* @permissionScope Manage Bookings
|
|
1054
1012
|
* @applicableIdentity APP
|
|
1055
1013
|
*/
|
|
1056
|
-
export declare function
|
|
1057
|
-
export interface
|
|
1014
|
+
export declare function updateResource(_id: string | null, options?: UpdateResourceOptions): Promise<UpdateResourceResponse>;
|
|
1015
|
+
export interface UpdateResourceOptions {
|
|
1058
1016
|
resource: {
|
|
1059
1017
|
/**
|
|
1060
1018
|
* Resource ID.
|
|
@@ -1069,17 +1027,13 @@ export interface UpdateOptions {
|
|
|
1069
1027
|
phone?: string | null;
|
|
1070
1028
|
/** Resource description. */
|
|
1071
1029
|
description?: string | null;
|
|
1072
|
-
/**
|
|
1073
|
-
* @internal
|
|
1074
|
-
* @internal */
|
|
1030
|
+
/** @internal */
|
|
1075
1031
|
tag?: string | null;
|
|
1076
1032
|
/** Resource tags. Tags are used to identify, group, and filter the different types of resources. For example, 'staff' or 'room'. */
|
|
1077
1033
|
tags?: string[] | null;
|
|
1078
1034
|
/** Resource images. */
|
|
1079
1035
|
images?: string[];
|
|
1080
|
-
/**
|
|
1081
|
-
* @internal
|
|
1082
|
-
* @internal */
|
|
1036
|
+
/** @internal */
|
|
1083
1037
|
schedules?: Schedule[];
|
|
1084
1038
|
/**
|
|
1085
1039
|
* List of IDs of schedules owned by this resource.
|
|
@@ -1111,67 +1065,39 @@ export interface UpdateOptions {
|
|
|
1111
1065
|
fieldMask?: string[];
|
|
1112
1066
|
}
|
|
1113
1067
|
/**
|
|
1114
|
-
* Updates a resource's schedule
|
|
1115
|
-
*
|
|
1116
|
-
*
|
|
1117
|
-
* Use this function to update the bookings resource's schedule. To update other resource details
|
|
1118
|
-
*
|
|
1119
|
-
*
|
|
1120
|
-
*
|
|
1121
|
-
*
|
|
1068
|
+
* Updates a resource's schedule.
|
|
1069
|
+
*
|
|
1070
|
+
*
|
|
1071
|
+
* The `updateResourceSchedule()` function returns a Promise that resolves when a resource's schedule has been updated. Use this function to update the bookings resource's schedule. To update other resource details use [`updateResource()`](#updateresource). The following schedule properties can be updated:
|
|
1072
|
+
*
|
|
1073
|
+
* - `availability.start`
|
|
1074
|
+
*
|
|
1075
|
+
* - `availability.linkedSchedules`
|
|
1076
|
+
*
|
|
1122
1077
|
*
|
|
1123
1078
|
* To update a resource's schedule to remove business hours and add custom hours:
|
|
1124
|
-
*
|
|
1125
|
-
*
|
|
1126
|
-
*
|
|
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-->
|
|
1079
|
+
* - Use [`updateResourceSchedule()`](#updateresourceschedule) to remove the business's scheduleId from the `availability.linkedSchedules` array.
|
|
1080
|
+
* - Use [`createSession()`](wix-bookings-v2/sessions/createsession) to create a set of recurring sessions of type `WORKING_HOURS` to define the resource's new hours.
|
|
1081
|
+
*
|
|
1132
1082
|
*
|
|
1133
1083
|
* 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.
|
|
1142
1084
|
*
|
|
1143
|
-
*
|
|
1144
|
-
*
|
|
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.
|
|
1085
|
+
* - Use [`updateResourceSchedule()`](#updateresourceschedule) to add the business resource's `scheduleId` to the `availability.linkedSchedules` array.
|
|
1086
|
+
* - If you want to remove the custom sessions, use [`deleteSession()`](wix-bookings-v2/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.
|
|
1159
1087
|
*
|
|
1160
1088
|
*
|
|
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.
|
|
1161
1090
|
*
|
|
1162
|
-
*
|
|
1163
|
-
* > This endpoint requires the Manage Bookings [permission scope](https://devforum.wix.com/kb/en/article/available-permissions).
|
|
1164
|
-
* <!--END:ONLY:REST-->
|
|
1091
|
+
* This function is not a universal function and runs only on the backend.
|
|
1165
1092
|
* @param resourceId - Resource id to update.
|
|
1166
1093
|
* @public
|
|
1167
|
-
* @documentationMaturity preview
|
|
1168
1094
|
* @requiredField options.schedule._id
|
|
1169
1095
|
* @requiredField resourceId
|
|
1170
1096
|
* @permissionScope Manage Bookings
|
|
1171
1097
|
* @applicableIdentity APP
|
|
1172
1098
|
*/
|
|
1173
|
-
export declare function
|
|
1174
|
-
export interface
|
|
1099
|
+
export declare function updateResourceSchedule(resourceId: string | null, options?: UpdateResourceScheduleOptions): Promise<UpdateScheduleResponse>;
|
|
1100
|
+
export interface UpdateResourceScheduleOptions {
|
|
1175
1101
|
/** Fieldmask for schedule */
|
|
1176
1102
|
fieldmask?: string[];
|
|
1177
1103
|
/** The schedule to update */
|
|
@@ -1179,28 +1105,19 @@ export interface UpdateScheduleOptions {
|
|
|
1179
1105
|
}
|
|
1180
1106
|
/**
|
|
1181
1107
|
* Deletes a resource.
|
|
1182
|
-
*
|
|
1108
|
+
*
|
|
1183
1109
|
* The `deleteResource()` function returns a Promise that is resolved when a resource is deleted.
|
|
1184
|
-
*
|
|
1185
|
-
*
|
|
1110
|
+
*
|
|
1111
|
+
*
|
|
1112
|
+
* Deleting a resource updates its status to `DELETED`.
|
|
1186
1113
|
*
|
|
1187
1114
|
* You cannot delete a resource if it has booked sessions.
|
|
1188
1115
|
*
|
|
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-->
|
|
1195
1116
|
*
|
|
1196
|
-
* <!--ONLY:REST-->
|
|
1197
1117
|
* >**Notes:**
|
|
1198
|
-
*
|
|
1199
|
-
*
|
|
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-->
|
|
1118
|
+
* - 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.
|
|
1119
|
+
* - You can have up to 135 active resources and an additional 135 deleted resources.
|
|
1120
|
+
* - Only users with the **Bookings Admin** [role](https://support.wix.com/en/article/roles-permissions-overview#bookings-admin) can delete a resource.
|
|
1204
1121
|
* @param _id - ID of the resource to delete.
|
|
1205
1122
|
* @public
|
|
1206
1123
|
* @documentationMaturity preview
|
|
@@ -28,7 +28,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
28
28
|
});
|
|
29
29
|
};
|
|
30
30
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
-
exports._delete = exports.
|
|
31
|
+
exports._delete = exports.updateResourceSchedule = exports.updateResource = exports.createResource = exports.queryResourceCatalog = exports.list = exports.Event = exports.SortOrder = exports.ResourceStatus = exports.ConferenceType = exports.ScheduleStatus = exports.ApprovalStatus = exports.DayOfWeek = exports.LocationsLocationType = exports.LocationStatus = exports.LocationType = exports.RecurringIntervalType = exports.Transparency = exports.Day = exports.__debug = void 0;
|
|
32
32
|
const velo_1 = require("@wix/metro-runtime/velo");
|
|
33
33
|
const ambassadorWixBookingsCatalogV1Resource = __importStar(require("./bookings-catalog-v1-resource.http"));
|
|
34
34
|
let __verbose = false;
|
|
@@ -267,26 +267,14 @@ exports.list = list;
|
|
|
267
267
|
/**
|
|
268
268
|
* Retrieves a list of the resources according to the specified filters and paging.
|
|
269
269
|
*
|
|
270
|
-
* The query parameter is optional. If no query is provided than all non-deleted resources are returned.
|
|
271
270
|
*
|
|
272
|
-
*
|
|
273
|
-
* |--|--|
|
|
274
|
-
* |filter | supported fields: `resource.id`, `resource.tags`, `resource.status`|
|
|
275
|
-
* |paging | supported |
|
|
276
|
-
* |fields | supported |
|
|
277
|
-
* |fieldsets | **not supported** |
|
|
278
|
-
* |sort | **not supported** |
|
|
271
|
+
* The query parameter is optional. If no query is provided, all non-deleted resources are returned.
|
|
279
272
|
*
|
|
273
|
+
* > **Notes:** The following objects in the query parameter are not supported for this query:
|
|
274
|
+
* > - sort
|
|
275
|
+
* > - fieldsets
|
|
280
276
|
*
|
|
281
|
-
* >**Notes:**
|
|
282
|
-
* > + The following objects in the `query` parameter are not supported for this query:
|
|
283
|
-
* > - `sort`
|
|
284
|
-
* > - `fieldsets`
|
|
285
|
-
*
|
|
286
|
-
* > **Permissions**
|
|
287
|
-
* > This endpoint requires the Read Bookings Calendar, Read Bookings - Public Data, Read Bookings - Including Participants or Manage Bookings permission scope.
|
|
288
277
|
* @public
|
|
289
|
-
* @documentationMaturity preview
|
|
290
278
|
* @permissionScope Read Bookings - Public Data
|
|
291
279
|
* @permissionScope Read bookings calendar - including participants
|
|
292
280
|
* @permissionScope Read Bookings Calendar
|
|
@@ -294,7 +282,7 @@ exports.list = list;
|
|
|
294
282
|
* @applicableIdentity MEMBER
|
|
295
283
|
* @applicableIdentity VISITOR
|
|
296
284
|
*/
|
|
297
|
-
function
|
|
285
|
+
function queryResourceCatalog(options) {
|
|
298
286
|
var _a, _b, _c;
|
|
299
287
|
return __awaiter(this, arguments, void 0, function* () {
|
|
300
288
|
const requestTransformation = { query: '$[0].query' };
|
|
@@ -343,51 +331,32 @@ function query(options) {
|
|
|
343
331
|
}
|
|
344
332
|
});
|
|
345
333
|
}
|
|
346
|
-
exports.
|
|
334
|
+
exports.queryResourceCatalog = queryResourceCatalog;
|
|
347
335
|
/**
|
|
348
336
|
* Creates a resource.
|
|
349
|
-
* <!--ONLY:VELO
|
|
350
|
-
* The `createResource()` function returns a Promise that resolves to the created resource.
|
|
351
|
-
* <!--END:ONLY:VELO-->
|
|
352
337
|
*
|
|
353
|
-
* 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.
|
|
354
|
-
* 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.
|
|
355
|
-
* You can use both individual and recurring sessions to define resource availability. You cannot use availability constraints for resource schedules.
|
|
356
338
|
*
|
|
357
|
-
*
|
|
358
|
-
*
|
|
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 `scheduleInfo` parameter. The default hours can bee found in the Dashboard under **Settings** in the **Bookings** section, on the **Appointment hours** page.
|
|
360
|
-
* + 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.
|
|
361
|
-
* + You can have both default business hours and custom hours for the same resource schedule by combining the steps above.
|
|
339
|
+
* The `createResource()` function returns a Promise that resolves to the created resource.
|
|
340
|
+
* 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. 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. You can use both individual and recurring sessions to define resource availability. You cannot use availability constraints for resource schedules.
|
|
362
341
|
*
|
|
363
|
-
* > **Notes:**
|
|
364
|
-
* > + 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.
|
|
365
|
-
* > + The Wix Bookings app does not show non-recurring `WORKING_HOURS` sessions in the resource calendar.
|
|
366
|
-
* > + You can only add the business resource's schedule as a linked schedule for a resource.
|
|
367
|
-
* > + A resource can have one schedule only.
|
|
368
|
-
* > + You can have up to 135 active resources and an additional 135 deleted resources.
|
|
369
|
-
* > + 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`.
|
|
370
|
-
* <!--END:ONLY:VELO-->
|
|
371
|
-
*
|
|
372
|
-
* <!--ONLY:REST-->
|
|
373
|
-
* Use the following steps to create resources:
|
|
374
|
-
* - Create the resource using including schedule information.
|
|
375
|
-
* - 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.
|
|
376
|
-
* - 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.
|
|
377
342
|
*
|
|
378
|
-
*
|
|
379
|
-
*
|
|
380
|
-
*
|
|
381
|
-
*
|
|
343
|
+
* When creating a resource using `createResource()`, include the resource's schedule information. Set the schedule information as follows:
|
|
344
|
+
* - 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.
|
|
345
|
+
* - If the resource has its own custom working hours, create the resource, then create sessions of type `WORKING_HOURS` using the [`createSession()`](wix-bookings-v2/sessions/createsession) function. Use the `scheduleId` returned from `createResource()` when creating the sessions. These session can be single sessions or recurring sessions.
|
|
346
|
+
* - You can have both default business hours and custom hours for the same resource schedule by combining the steps above.
|
|
382
347
|
*
|
|
383
348
|
*
|
|
349
|
+
* > **Notes:**
|
|
350
|
+
* - 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.
|
|
351
|
+
* - The Wix Bookings app does not show non-recurring `WORKING_HOURS` sessions in the resource calendar.
|
|
352
|
+
* - You can only add the business resource's schedule as a linked schedule for a resource.
|
|
353
|
+
* - A resource can have one schedule only.
|
|
354
|
+
* - You can have up to 135 active resources and an additional 135 deleted resources.
|
|
355
|
+
* - Only users with the **Bookings Admin** [role](https://support.wix.com/en/article/roles-permissions-overview#bookings-admin) can create a resource.
|
|
384
356
|
*
|
|
385
|
-
*
|
|
386
|
-
* > This endpoint requires the Manage Bookings [permission scope](https://devforum.wix.com/kb/en/article/available-permissions).
|
|
387
|
-
* <!--END:ONLY:REST-->
|
|
357
|
+
* This function is not a universal function and runs only on the backend.
|
|
388
358
|
* @param resource - Resource details.
|
|
389
359
|
* @public
|
|
390
|
-
* @documentationMaturity preview
|
|
391
360
|
* @requiredField options.schedules.availability.start
|
|
392
361
|
* @requiredField options.schedules.intervals.start
|
|
393
362
|
* @requiredField resource
|
|
@@ -395,7 +364,7 @@ exports.query = query;
|
|
|
395
364
|
* @permissionScope Manage Bookings
|
|
396
365
|
* @applicableIdentity APP
|
|
397
366
|
*/
|
|
398
|
-
function
|
|
367
|
+
function createResource(resource, options) {
|
|
399
368
|
var _a, _b, _c;
|
|
400
369
|
return __awaiter(this, arguments, void 0, function* () {
|
|
401
370
|
const requestTransformation = {
|
|
@@ -454,32 +423,21 @@ function create(resource, options) {
|
|
|
454
423
|
}
|
|
455
424
|
});
|
|
456
425
|
}
|
|
457
|
-
exports.
|
|
426
|
+
exports.createResource = createResource;
|
|
458
427
|
/**
|
|
459
428
|
* Updates a resource.
|
|
460
|
-
* <!--ONLY:VELO
|
|
461
|
-
* The `updateResource()` function returns a Promise that resolves when a resource is updated.
|
|
462
|
-
* 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).
|
|
463
429
|
*
|
|
464
|
-
*
|
|
465
|
-
*
|
|
466
|
-
*
|
|
467
|
-
* <!--END:ONLY:VELO-->
|
|
468
|
-
* <!--ONLY:REST-->
|
|
469
|
-
* Use this endpoint to update all resource information except for the resource's schedule. To update a resource's schedule use
|
|
470
|
-
* the [Update Schedule](https://dev.wix.com/api/rest/wix-bookings/resources/update-schedule) endpoint.
|
|
430
|
+
*
|
|
431
|
+
* The `updateResource()` function returns a Promise that resolves when a resource is updated. Use this function to update all bookings resource information except for the resource's schedule. To update a resource's schedule use [`updateResourceSchedule()`](#updateresourceschedule).
|
|
432
|
+
*
|
|
471
433
|
*
|
|
472
434
|
* >**Notes:**
|
|
473
|
-
*
|
|
474
|
-
*
|
|
475
|
-
* > + The `businessLocation.businessSchedule` object in the `schedule.location` object is not supported.
|
|
435
|
+
* - 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"`.
|
|
436
|
+
* - Only users with the **Bookings Admin** [role](https://support.wix.com/en/article/roles-permissions-overview#bookings-admin) can update a resource.
|
|
476
437
|
*
|
|
477
|
-
*
|
|
478
|
-
* > This endpoint requires the Manage Bookings [permission scope](https://devforum.wix.com/kb/en/article/available-permissions).
|
|
479
|
-
* <!--END:ONLY:REST-->
|
|
438
|
+
* This function is not a universal function and runs only on the backend.
|
|
480
439
|
* @param _id - Resource ID.
|
|
481
440
|
* @public
|
|
482
|
-
* @documentationMaturity preview
|
|
483
441
|
* @requiredField _id
|
|
484
442
|
* @requiredField scheduleActions.cancelRequests.scheduleId
|
|
485
443
|
* @requiredField scheduleActions.createRequests.schedule.availability.start
|
|
@@ -489,7 +447,7 @@ exports.create = create;
|
|
|
489
447
|
* @permissionScope Manage Bookings
|
|
490
448
|
* @applicableIdentity APP
|
|
491
449
|
*/
|
|
492
|
-
function
|
|
450
|
+
function updateResource(_id, options) {
|
|
493
451
|
var _a, _b, _c;
|
|
494
452
|
return __awaiter(this, arguments, void 0, function* () {
|
|
495
453
|
const requestTransformation = {
|
|
@@ -552,68 +510,40 @@ function update(_id, options) {
|
|
|
552
510
|
}
|
|
553
511
|
});
|
|
554
512
|
}
|
|
555
|
-
exports.
|
|
513
|
+
exports.updateResource = updateResource;
|
|
556
514
|
/**
|
|
557
|
-
* Updates a resource's schedule
|
|
558
|
-
*
|
|
559
|
-
*
|
|
560
|
-
* Use this function to update the bookings resource's schedule. To update other resource details
|
|
561
|
-
*
|
|
562
|
-
*
|
|
563
|
-
*
|
|
564
|
-
*
|
|
515
|
+
* Updates a resource's schedule.
|
|
516
|
+
*
|
|
517
|
+
*
|
|
518
|
+
* The `updateResourceSchedule()` function returns a Promise that resolves when a resource's schedule has been updated. Use this function to update the bookings resource's schedule. To update other resource details use [`updateResource()`](#updateresource). The following schedule properties can be updated:
|
|
519
|
+
*
|
|
520
|
+
* - `availability.start`
|
|
521
|
+
*
|
|
522
|
+
* - `availability.linkedSchedules`
|
|
523
|
+
*
|
|
565
524
|
*
|
|
566
525
|
* To update a resource's schedule to remove business hours and add custom hours:
|
|
567
|
-
*
|
|
568
|
-
*
|
|
569
|
-
*
|
|
570
|
-
* <!--END:ONLY:REST-->
|
|
571
|
-
* <!--ONLY:VELO
|
|
572
|
-
* + Use [`updateResourceSchedule()`](wix-bookings-backend.Resources/updateresourcesession) to remove the business's scheduleId from the `availability.linkedSchedules` array.
|
|
573
|
-
* + 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.
|
|
574
|
-
* <!--END:ONLY:VELO-->
|
|
526
|
+
* - Use [`updateResourceSchedule()`](#updateresourceschedule) to remove the business's scheduleId from the `availability.linkedSchedules` array.
|
|
527
|
+
* - Use [`createSession()`](wix-bookings-v2/sessions/createsession) to create a set of recurring sessions of type `WORKING_HOURS` to define the resource's new hours.
|
|
528
|
+
*
|
|
575
529
|
*
|
|
576
530
|
* To update a resource's schedule to add default business hours, and keep or remove custom hours:
|
|
577
|
-
* <!--ONLY:REST-->
|
|
578
|
-
* + Update the resource's schedule to add the business resource's `scheduleId` to the `availability.linkedSchedules` array.
|
|
579
|
-
* + If you want to remove the custom sessions, delete the resource's sessions of type `"WORKING_HOURS"`.
|
|
580
|
-
* 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.
|
|
581
|
-
* <!--END:ONLY:REST-->
|
|
582
|
-
* <!--ONLY:VELO
|
|
583
|
-
* + Use [`updateResourceSchedule()`](wix-bookings-backend.Resources/updateresourcesession) to add the business resource's `scheduleId` to the `availability.linkedSchedules` array.
|
|
584
|
-
* + 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.
|
|
585
531
|
*
|
|
586
|
-
*
|
|
587
|
-
*
|
|
588
|
-
* > + A resource can have one schedule only.
|
|
589
|
-
* > + A resource can have both default business hours and custom hours in its schedule.
|
|
590
|
-
* > + 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”`.
|
|
591
|
-
* > + 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`.
|
|
592
|
-
* @snippet [updateResourceScheduleDefaultToCustom.es6=Update a resource's schedule from business to custom hours]
|
|
593
|
-
* Update a resource's schedule from the business's default working hours to 2 custom days per week.
|
|
594
|
-
* @snippet [updateResourceScheduleCustomToDefault.es6=Update a resource's schedule from custom to business hours]
|
|
595
|
-
* <!--END:ONLY:VELO-->
|
|
596
|
-
* <!--ONLY:REST-->
|
|
597
|
-
* >**Notes:**
|
|
598
|
-
* > + A resource can have one schedule only.
|
|
599
|
-
* > + A resource can have both default business hours and custom hours in its schedule.
|
|
600
|
-
* > + 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”`.
|
|
601
|
-
* > + The `businessLocation.businessSchedule` object in the `schedule.location` object is not supported.
|
|
532
|
+
* - Use [`updateResourceSchedule()`](#updateresourceschedule) to add the business resource's `scheduleId` to the `availability.linkedSchedules` array.
|
|
533
|
+
* - If you want to remove the custom sessions, use [`deleteSession()`](wix-bookings-v2/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.
|
|
602
534
|
*
|
|
603
535
|
*
|
|
536
|
+
* > **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.
|
|
604
537
|
*
|
|
605
|
-
*
|
|
606
|
-
* > This endpoint requires the Manage Bookings [permission scope](https://devforum.wix.com/kb/en/article/available-permissions).
|
|
607
|
-
* <!--END:ONLY:REST-->
|
|
538
|
+
* This function is not a universal function and runs only on the backend.
|
|
608
539
|
* @param resourceId - Resource id to update.
|
|
609
540
|
* @public
|
|
610
|
-
* @documentationMaturity preview
|
|
611
541
|
* @requiredField options.schedule._id
|
|
612
542
|
* @requiredField resourceId
|
|
613
543
|
* @permissionScope Manage Bookings
|
|
614
544
|
* @applicableIdentity APP
|
|
615
545
|
*/
|
|
616
|
-
function
|
|
546
|
+
function updateResourceSchedule(resourceId, options) {
|
|
617
547
|
var _a, _b, _c;
|
|
618
548
|
return __awaiter(this, arguments, void 0, function* () {
|
|
619
549
|
const requestTransformation = {
|
|
@@ -661,31 +591,22 @@ function updateSchedule(resourceId, options) {
|
|
|
661
591
|
}
|
|
662
592
|
});
|
|
663
593
|
}
|
|
664
|
-
exports.
|
|
594
|
+
exports.updateResourceSchedule = updateResourceSchedule;
|
|
665
595
|
/**
|
|
666
596
|
* Deletes a resource.
|
|
667
|
-
*
|
|
597
|
+
*
|
|
668
598
|
* The `deleteResource()` function returns a Promise that is resolved when a resource is deleted.
|
|
669
|
-
*
|
|
670
|
-
*
|
|
599
|
+
*
|
|
600
|
+
*
|
|
601
|
+
* Deleting a resource updates its status to `DELETED`.
|
|
671
602
|
*
|
|
672
603
|
* You cannot delete a resource if it has booked sessions.
|
|
673
604
|
*
|
|
674
|
-
* <!--ONLY:VELO
|
|
675
|
-
* >**Notes:**
|
|
676
|
-
* > + 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.
|
|
677
|
-
* > + You can have up to 135 active resources and an additional 135 deleted resources.
|
|
678
|
-
* > + 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`.
|
|
679
|
-
* <!--END:ONLY:VELO-->
|
|
680
605
|
*
|
|
681
|
-
* <!--ONLY:REST-->
|
|
682
606
|
* >**Notes:**
|
|
683
|
-
*
|
|
684
|
-
*
|
|
685
|
-
*
|
|
686
|
-
* >**Permissions:**
|
|
687
|
-
* > This endpoint requires the Manage Bookings [permission scope](https://devforum.wix.com/kb/en/article/available-permissions).
|
|
688
|
-
* <!--END:ONLY:REST-->
|
|
607
|
+
* - 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.
|
|
608
|
+
* - You can have up to 135 active resources and an additional 135 deleted resources.
|
|
609
|
+
* - Only users with the **Bookings Admin** [role](https://support.wix.com/en/article/roles-permissions-overview#bookings-admin) can delete a resource.
|
|
689
610
|
* @param _id - ID of the resource to delete.
|
|
690
611
|
* @public
|
|
691
612
|
* @documentationMaturity preview
|