You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Endpoints like `site`, `location`, and `user` don't support the `site_id` parameter. They will always return the same result regardless of what site ID is passed.
88
93
89
94
### `all` and `search` operations
90
-
When querying one of the `all` or `search` endpoints, the client will return a Generator that you can iterate through. These endpoints are paged and return 50 results per page. The client will check the `total_pages` property in the first response and make sure every page gets loaded. The next page will only get loaded once the iterator gets to that point.
95
+
When querying one of the `all` or `search` endpoints, the client will return a PaginatedResponse. These endpoints are paged and return 50 results per page.
91
96
92
-
Call [`iterator_to_array` (?)](https://www.php.net/manual/en/function.iterator-to-array.php) to convert the Generator to an array and load all pages immediately.
97
+
The PaginatedResponse class is iterable (over the results loaded in that page). It also features the following helpers:
98
+
-`currentPage(): int` - gets the current page number
99
+
-`totalPages(): int` - gets the total number of pages
100
+
-`hasMore(): bool` - checks if the page number is below the total number of pages
101
+
-`next(): ?PaginatedResponse` - get the next page (if applicable)
102
+
-`results(): array` - get an array of this page's results
103
+
-`all(): array` - load results from all pages into an array
104
+
-`untilPage(int $page): array` - load results from current until given page into an array
93
105
94
-
Additionally, you may provide a `$firstPage` or `$untilPage` on these operations to change from which page on and/or until which page the data should be loaded (provided it's less than the total number of pages).
95
-
96
-
Note: The `site` and `location` services are not paged and do not feature the `$firstPage` or `$untilPage` arguments.
106
+
Note: The `site` and `location` services are not paged.
0 commit comments