Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New functionality to paginate #53

Merged
merged 1 commit into from Oct 26, 2022
Merged

New functionality to paginate #53

merged 1 commit into from Oct 26, 2022

Conversation

otsch
Copy link
Member

@otsch otsch commented Oct 26, 2022

There is the new Paginate child class of the Http step class (easy access via Http::get()->paginate()). It takes an instance of the PaginatorInterface and uses it to iterate through pagination links. There is one implementation of that interface, the SimpleWebsitePaginator. The Http::get()->paginate() method uses it by default, when called just with a CSS selector to get pagination links. Paginators receive all loaded pages and implement the logic to find pagination links. The paginator class is also called before sending a request, with the request object that is about to be sent as an argument (prepareRequest()). This way, it should even be doable to implement more complex pagination functionality. For example when pagination is built using POST request with query strings in the request body.

There is the new `Paginate` child class of the `Http` step class (easy
access via `Http::get()->paginate()`). It takes an instance of the
`PaginatorInterface` and uses it to iterate through pagination links.
There is one implementation of that interface, the
`SimpleWebsitePaginator`. The `Http::get()->paginate()` method uses it
by default, when called just with a CSS selector to get pagination
links. Paginators receive all loaded pages and implement the logic to
find pagination links. The paginator class is also called before sending
a request, with the request object that is about to be sent as an
argument (`prepareRequest()`). This way, it should even be doable to
implement more complex pagination functionality. For example when
pagination is built using POST request with query strings in the request
body.
@otsch otsch merged commit 88d45db into main Oct 26, 2022
@otsch otsch deleted the feature/paginators branch October 26, 2022 22:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant