Search.../

items

Returns an array of resources, slugs, and schedules that match the query.

Description

The current page of resources, slugs, and schedules retrieved by the query.

The page size is defined by the limit() function, can be retrieved using the pageSize property, and navigating through pages is done with the prev() and next() functions.

When no items match the query, the array is empty.

Type:

Array<ResourceQueryResults>Read Only
NAME
TYPE
DESCRIPTION
resource
Resource

Resource.

schedules
Array<ResourceSchedule>

Resource's schedules.

slugs
Array<Slug>

History of slugified resource names.

Was this helpful?

Perform a query and get the resource catalog items from the result

Copy Code
1import { resources } from "wix-bookings-backend";
2
3// ...
4resources.queryResourceCatalog()
5 .find()
6 .then((results) => {
7 if (results.items.length > 0) {
8 let items = results.items; // see below
9 } else {
10 // handle case where no matching items found
11 }
12 })
13 .catch((error) => {
14 console.error(error);
15 });
16
17 /* items:
18 *
19 * [
20 * {
21 * "resource": {
22 * "_id": "2015d816-4ae1-4eb3-8f93-3c97441b5832",
23 * "name": "John Doe",
24 * "email": "john@doe.com",
25 * "phone": "555 4567",
26 * "description": "Fitness Instructor",
27 * "tags": [
28 * "staff"
29 * ],
30 * "scheduleIds": [
31 * "3ade521f-ba4e-4782-977c-0efe84e7c797"
32 * ],
33 * "status": "UPDATED"
34 * },
35 * "schedules": [
36 * {
37 * "availability": {
38 * "linkedSchedules": [],
39 * "start": "2021-01-01T06:00:00Z"
40 * },
41 * "_id": "3ade521f-ba4e-4782-977c-0efe84e7c797",
42 * "scheduleOwnerId": "2015d816-4ae1-4eb3-8f93-3c97441b5832"
43 * }
44 * ],
45 * "slugs": [
46 * {
47 * "_createdDate": "2021-04-12T11:49:50.416Z",
48 * "name": "john-doe-6"
49 * }
50 * ]
51 * },
52 * {
53 * "resource": {
54 * "_id": "290113d8-e525-4619-a154-b0c45110348f",
55 * "name": "Jack Brown",
56 * "email": "jbrown@test.com",
57 * "phone": "555 4321",
58 * "description": "Instructor",
59 * "tags": [
60 * "staff"
61 * ],
62 * "scheduleIds": [
63 * "95d8769e-ce74-4fe2-ab79-ab24e5c14e0e"
64 * ],
65 * "status": "UPDATED"
66 * },
67 * "schedules": [
68 * {
69 * "availability": {
70 * "linkedSchedules": [
71 * {
72 * "scheduleId": "9299760d-8a4a-4f89-b348-1fc611f4be17"
73 * }
74 * ],
75 * "start": "2021-04-18T07:22:42.274Z"
76 * },
77 * "_id": "95d8769e-ce74-4fe2-ab79-ab24e5c14e0e",
78 * "scheduleOwnerId": "290113d8-e525-4619-a154-b0c45110348f"
79 * }
80 * ],
81 * "slugs": [
82 * {
83 * "_createdDate": "2021-04-18T07:22:43.392Z",
84 * "name": "jack-brown"
85 * }
86 * ]
87 * },
88 * {
89 * "resource": {
90 * "_id": "4c17a7cc-c1d8-4fd1-aacd-0768df100b6d",
91 * "name": "Joe Blue",
92 * "email": "jb@gmail.com",
93 * "description": "Joe is a good guy",
94 * "tags": [
95 * "staff"
96 * ],
97 * "scheduleIds": [
98 * "d165e99c-bae4-4e6f-a064-7d4108902be0"
99 * ],
100 * "status": "UPDATED"
101 * },
102 * "schedules": [
103 * {
104 * "availability": {
105 * "linkedSchedules": [
106 * {
107 * "scheduleId": "9299760d-8a4a-4f89-b348-1fc611f4be17"
108 * }
109 * ],
110 * "start": "2021-03-24T16:08:16.832Z"
111 * },
112 * "_id": "d165e99c-bae4-4e6f-a064-7d4108902be0",
113 * "scheduleOwnerId": "4c17a7cc-c1d8-4fd1-aacd-0768df100b6d"
114 * }
115 * ],
116 * "slugs": [
117 * {
118 * "_createdDate": "2021-01-18T10:41:31.652Z",
119 * "name": "joe-blue"
120 * }
121 * ]
122 * },
123 * {
124 * "resource": {
125 * "_id": "b5147aad-f117-4f8e-90fe-d61043112c94",
126 * "name": "Joe Smith",
127 * "email": "js@s.com",
128 * "phone": "8888",
129 * "description": "",
130 * "tags": [
131 * "staff"
132 * ],
133 * "scheduleIds": [
134 * "892714a8-01f6-491c-b07c-89ae4f416dc0"
135 * ],
136 * "status": "UPDATED"
137 * },
138 * "schedules": [
139 * {
140 * "availability": {
141 * "linkedSchedules": [
142 * {
143 * "scheduleId": "9299760d-8a4a-4f89-b348-1fc611f4be17"
144 * }
145 * ],
146 * "start": "2021-01-01T06:00:00Z"
147 * },
148 * "_id": "892714a8-01f6-491c-b07c-89ae4f416dc0",
149 * "scheduleOwnerId": "b5147aad-f117-4f8e-90fe-d61043112c94"
150 * }
151 * ],
152 * "slugs": [
153 * {
154 * "_createdDate": "2021-01-25T18:10:42.682Z",
155 * "name": "joe-smith"
156 * }
157 * ]
158 * }
159 * ]
160 */