|
| 1 | +{ |
| 2 | + "name": "SessionsQueryResult", |
| 3 | + "memberOf": "wix-bookings-v2.Sessions", |
| 4 | + "mixes": [], |
| 5 | + "callbacks": [], |
| 6 | + "extra": {}, |
| 7 | + "clientId": "wix-bookings.v2-session.sessions.sessions-query-result", |
| 8 | + "docs": {}, |
| 9 | + "relatedGuides": [], |
| 10 | + "properties": [ |
| 11 | + { |
| 12 | + "name": "items", |
| 13 | + "type": [ |
| 14 | + { |
| 15 | + "complexType": { |
| 16 | + "nativeType": "Array", |
| 17 | + "typeParams": [ |
| 18 | + { |
| 19 | + "referenceType": "wix-bookings-v2.Sessions.Session" |
| 20 | + } |
| 21 | + ] |
| 22 | + } |
| 23 | + } |
| 24 | + ], |
| 25 | + "docs": { |
| 26 | + "summary": "Returns an array of `sessions` items that match the query.", |
| 27 | + "description": [ |
| 28 | + "`items` contains the current page of results retrieved by the query.", |
| 29 | + "If no results match the query, `items` is an empty array.", |
| 30 | + "The page size is defined by the [`limit()`](#limit) function and can be retrieved using the [`pageSize`](#pagesize) property. You can use the [`next()`](#next) and [`prev()`](#prev) functions returned by `sessions` to navigate the pages of a query result." |
| 31 | + ], |
| 32 | + "examples": [ |
| 33 | + { |
| 34 | + "title": "Get `items` from a query result", |
| 35 | + "body": [ |
| 36 | + "const returnedItems = results.items;", |
| 37 | + "" |
| 38 | + ] |
| 39 | + }, |
| 40 | + { |
| 41 | + "title": "Perform a query and get `items` from the result", |
| 42 | + "body": [ |
| 43 | + "import { sessions } from 'wix-bookings.v2';", |
| 44 | + "", |
| 45 | + "export async function myQueryFunction() {", |
| 46 | + " const results = await sessions.querySessions().find();", |
| 47 | + "", |
| 48 | + " const returnedItems = results.items;", |
| 49 | + "", |
| 50 | + " if (returnedItems.length > 0) {", |
| 51 | + " return items;", |
| 52 | + " } else {", |
| 53 | + " // Handle if no matching items found", |
| 54 | + " }", |
| 55 | + "}", |
| 56 | + "" |
| 57 | + ] |
| 58 | + } |
| 59 | + ] |
| 60 | + } |
| 61 | + }, |
| 62 | + { |
| 63 | + "name": "length", |
| 64 | + "type": [ |
| 65 | + { |
| 66 | + "nativeType": "number" |
| 67 | + } |
| 68 | + ], |
| 69 | + "docs": { |
| 70 | + "summary": "Returns the number of items in the current page of results.", |
| 71 | + "description": [ |
| 72 | + "`length` returns just the number of items in the current page, not the total number of items that match the query. For the total number of items that match the query, see [`totalCount`](#totalcount).", |
| 73 | + "The page size is defined by the [`limit()`](#limit) function and can be retrieved using the [`pageSize`](#pagesize) property. You can use the [`next()`](#next) and [`prev()`](#prev) functions returned by `sessions` to navigate the pages of a query result." |
| 74 | + ], |
| 75 | + "examples": [ |
| 76 | + { |
| 77 | + "title": "Get `length` from a query result", |
| 78 | + "body": [ |
| 79 | + "const resultLength = results.length;", |
| 80 | + "" |
| 81 | + ] |
| 82 | + }, |
| 83 | + { |
| 84 | + "title": "Perform a query and get `length` from the result", |
| 85 | + "body": [ |
| 86 | + "import { sessions } from 'wix-bookings.v2';", |
| 87 | + "", |
| 88 | + "export async function myQueryFunction() {", |
| 89 | + " const results = await sessions.querySessions().find();", |
| 90 | + "", |
| 91 | + " return results.length;", |
| 92 | + "}", |
| 93 | + "" |
| 94 | + ] |
| 95 | + } |
| 96 | + ] |
| 97 | + } |
| 98 | + }, |
| 99 | + { |
| 100 | + "name": "pageSize", |
| 101 | + "type": [ |
| 102 | + { |
| 103 | + "nativeType": "number" |
| 104 | + } |
| 105 | + ], |
| 106 | + "docs": { |
| 107 | + "summary": "Returns the requested page size.", |
| 108 | + "description": [ |
| 109 | + "`pageSize` returns the page size set in [`limit()`](#limit) in `SessionsQueryBuilder`." |
| 110 | + ], |
| 111 | + "examples": [ |
| 112 | + { |
| 113 | + "title": "Get the query's page size", |
| 114 | + "body": [ |
| 115 | + "const requestedPageSize = results.pageSize;", |
| 116 | + "" |
| 117 | + ] |
| 118 | + }, |
| 119 | + { |
| 120 | + "title": "Perform a query and get `pageSize` from the result", |
| 121 | + "body": [ |
| 122 | + "import { sessions } from 'wix-bookings.v2';", |
| 123 | + "", |
| 124 | + "export async function myQueryFunction() {", |
| 125 | + " const results = await sessions.querySessions().find();", |
| 126 | + "", |
| 127 | + " return results.pageSize;", |
| 128 | + "}", |
| 129 | + "" |
| 130 | + ] |
| 131 | + } |
| 132 | + ] |
| 133 | + } |
| 134 | + }, |
| 135 | + { |
| 136 | + "name": "query", |
| 137 | + "type": [ |
| 138 | + { |
| 139 | + "referenceType": "wix-bookings-v2.Sessions.SessionsQueryBuilder" |
| 140 | + } |
| 141 | + ], |
| 142 | + "docs": { |
| 143 | + "summary": "Returns the `SessionsQueryBuilder` object used to get the current results.", |
| 144 | + "description": [ |
| 145 | + "Use `query` to create and run a new query by chaining additional `SessionsQueryBuilder` functions to it. You can filter only on properties that haven't already been used in the previous `SessionsQueryBuilder`." |
| 146 | + ], |
| 147 | + "examples": [ |
| 148 | + { |
| 149 | + "title": "Get `query` that produced the current result", |
| 150 | + "body": [ |
| 151 | + "const originalQuery = results.query;", |
| 152 | + "" |
| 153 | + ] |
| 154 | + }, |
| 155 | + { |
| 156 | + "title": "Perform a query and get `query` from the result", |
| 157 | + "body": [ |
| 158 | + "import { sessions } from 'wix-bookings.v2';", |
| 159 | + "", |
| 160 | + "export async function myQueryFunction() {", |
| 161 | + " const results = await sessions.querySessions().find();", |
| 162 | + "", |
| 163 | + " return results.query;", |
| 164 | + "}", |
| 165 | + "" |
| 166 | + ] |
| 167 | + } |
| 168 | + ] |
| 169 | + } |
| 170 | + } |
| 171 | + ], |
| 172 | + "operations": [ |
| 173 | + { |
| 174 | + "name": "hasNext", |
| 175 | + "params": [], |
| 176 | + "requiredFields": [], |
| 177 | + "ret": { |
| 178 | + "type": [ |
| 179 | + { |
| 180 | + "nativeType": "boolean" |
| 181 | + } |
| 182 | + ], |
| 183 | + "doc": null |
| 184 | + }, |
| 185 | + "docs": { |
| 186 | + "summary": "Indicates whether the query has more results.", |
| 187 | + "description": [ |
| 188 | + "You can use the [`next()`](#next) and [`prev()`](#prev) functions returned by `sessions` to navigate the pages of a query result." |
| 189 | + ], |
| 190 | + "examples": [ |
| 191 | + { |
| 192 | + "title": "Get whether the query has more results", |
| 193 | + "body": [ |
| 194 | + "const hasNext = results.hasNext();", |
| 195 | + "" |
| 196 | + ] |
| 197 | + }, |
| 198 | + { |
| 199 | + "title": "Perform a query and get `hasNext` from the result", |
| 200 | + "body": [ |
| 201 | + "import { sessions } from 'wix-bookings.v2';", |
| 202 | + "", |
| 203 | + "export async function myQueryFunction() {", |
| 204 | + " const results = await sessions.querySessions().find();", |
| 205 | + "", |
| 206 | + " return results.hasNext();", |
| 207 | + "}", |
| 208 | + "" |
| 209 | + ] |
| 210 | + } |
| 211 | + ] |
| 212 | + }, |
| 213 | + "isVeloEvent": false |
| 214 | + }, |
| 215 | + { |
| 216 | + "name": "hasPrev", |
| 217 | + "params": [], |
| 218 | + "requiredFields": [], |
| 219 | + "ret": { |
| 220 | + "type": [ |
| 221 | + { |
| 222 | + "nativeType": "boolean" |
| 223 | + } |
| 224 | + ], |
| 225 | + "doc": null |
| 226 | + }, |
| 227 | + "docs": { |
| 228 | + "summary": "Indicates whether the query has previous results.", |
| 229 | + "description": [ |
| 230 | + "You can use the [`next()`](#next) and [`prev()`](#prev) functions returned by `sessions` to navigate the pages of a query result." |
| 231 | + ], |
| 232 | + "examples": [ |
| 233 | + { |
| 234 | + "title": "Get whether the query has previous results", |
| 235 | + "body": [ |
| 236 | + "const hasPrev = results.hasPrev();", |
| 237 | + "" |
| 238 | + ] |
| 239 | + }, |
| 240 | + { |
| 241 | + "title": "Perform a query and get `hasPrev` from the result", |
| 242 | + "body": [ |
| 243 | + "import { sessions } from 'wix-bookings.v2';", |
| 244 | + "", |
| 245 | + "export async function myQueryFunction() {", |
| 246 | + " const results = await sessions.querySessions().find();", |
| 247 | + "", |
| 248 | + " return results.hasPrev();", |
| 249 | + "}", |
| 250 | + "" |
| 251 | + ] |
| 252 | + } |
| 253 | + ] |
| 254 | + }, |
| 255 | + "isVeloEvent": false |
| 256 | + }, |
| 257 | + { |
| 258 | + "name": "next", |
| 259 | + "params": [], |
| 260 | + "requiredFields": [], |
| 261 | + "ret": { |
| 262 | + "type": [ |
| 263 | + { |
| 264 | + "complexType": { |
| 265 | + "nativeType": "Promise", |
| 266 | + "typeParams": [ |
| 267 | + { |
| 268 | + "referenceType": "wix-bookings-v2.Sessions.SessionsQueryResult" |
| 269 | + } |
| 270 | + ] |
| 271 | + } |
| 272 | + } |
| 273 | + ], |
| 274 | + "doc": null |
| 275 | + }, |
| 276 | + "docs": { |
| 277 | + "summary": "Retrieves the next page of query results.", |
| 278 | + "description": [ |
| 279 | + "The `next()` function retrieves the next page of query results.", |
| 280 | + "The page size is defined by the [`limit()`](#limit) function and can be retrieved using the [`pageSize`](#pagesize) property. You can use the [`next()`](#next) and [`prev()`](#prev) functions returned by `sessions` to navigate the pages of a query result.", |
| 281 | + "If items are added or removed between calls to `next()`, the values returned by `SessionsQueryBuilder` may change." |
| 282 | + ], |
| 283 | + "examples": [ |
| 284 | + { |
| 285 | + "title": "Get `next` from a query result", |
| 286 | + "body": [ |
| 287 | + "const nextPage = results.next();", |
| 288 | + "" |
| 289 | + ] |
| 290 | + }, |
| 291 | + { |
| 292 | + "title": "Perform a query and get `next` from the result", |
| 293 | + "body": [ |
| 294 | + "import { sessions } from 'wix-bookings.v2';", |
| 295 | + "", |
| 296 | + "export async function myQueryFunction() {", |
| 297 | + " const results = await sessions.querySessions().find();", |
| 298 | + "", |
| 299 | + " return results.next();", |
| 300 | + "}", |
| 301 | + "" |
| 302 | + ] |
| 303 | + }, |
| 304 | + { |
| 305 | + "title": "Iterate through all pages of query results", |
| 306 | + "body": [ |
| 307 | + "import { sessions } from 'wix-bookings.v2';", |
| 308 | + "", |
| 309 | + "export async function myQueryFunction() {", |
| 310 | + " let allItems = [];", |
| 311 | + "", |
| 312 | + " const results = await sessions.querySessions().limit(1000).find();", |
| 313 | + " allItems.push(results.items);", |
| 314 | + "", |
| 315 | + " while (results.hasNext()) {", |
| 316 | + " results = await results.next();", |
| 317 | + " allItems.push(results.items);", |
| 318 | + " }", |
| 319 | + "", |
| 320 | + " return allItems;", |
| 321 | + "}", |
| 322 | + "" |
| 323 | + ] |
| 324 | + } |
| 325 | + ] |
| 326 | + }, |
| 327 | + "isVeloEvent": false |
| 328 | + }, |
| 329 | + { |
| 330 | + "name": "prev", |
| 331 | + "params": [], |
| 332 | + "requiredFields": [], |
| 333 | + "ret": { |
| 334 | + "type": [ |
| 335 | + { |
| 336 | + "complexType": { |
| 337 | + "nativeType": "Promise", |
| 338 | + "typeParams": [ |
| 339 | + { |
| 340 | + "referenceType": "wix-bookings-v2.Sessions.SessionsQueryResult" |
| 341 | + } |
| 342 | + ] |
| 343 | + } |
| 344 | + } |
| 345 | + ], |
| 346 | + "doc": null |
| 347 | + }, |
| 348 | + "docs": { |
| 349 | + "summary": "Retrieves the previous page of query results.", |
| 350 | + "description": [ |
| 351 | + "The `prev()` function retrieves the previous page of query results.", |
| 352 | + "The page size is defined by the [`limit()`](#limit) function and can be retrieved using the [`pageSize`](#pagesize) property. You can use the [`next()`](#next) and [`prev()`](#prev) functions returned by `sessions` to navigate the pages of a query result.", |
| 353 | + "If items are added or removed between calls to `prev()`, the values returned may change." |
| 354 | + ], |
| 355 | + "examples": [ |
| 356 | + { |
| 357 | + "title": "Get `prev` from a query result", |
| 358 | + "body": [ |
| 359 | + "const previousPage = results.prev();", |
| 360 | + "" |
| 361 | + ] |
| 362 | + }, |
| 363 | + { |
| 364 | + "title": "Perform a query and get `prev` from the result", |
| 365 | + "body": [ |
| 366 | + "import { sessions } from 'wix-bookings.v2';", |
| 367 | + "", |
| 368 | + "export async function myQueryFunction() {", |
| 369 | + " const results = await sessions.querySessions().find();", |
| 370 | + "", |
| 371 | + " return results.prev();", |
| 372 | + "}", |
| 373 | + "" |
| 374 | + ] |
| 375 | + } |
| 376 | + ] |
| 377 | + }, |
| 378 | + "isVeloEvent": false |
| 379 | + } |
| 380 | + ], |
| 381 | + "messages": [] |
| 382 | +} |
0 commit comments