Skip to content

Add support for paginated results in list methods #189

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

Merged
merged 8 commits into from
Nov 7, 2023
Merged

Conversation

mattt
Copy link
Contributor

@mattt mattt commented Nov 7, 2023

This PR defines a new generic Page type, which represents a page of results returned from methods like replicate.models.list. This PR also updates those list methods to take a cursor argument. When page.next or page.previous is not None, you can pass it to a list method to get the next or previous page of results.

mattt added 8 commits November 7, 2023 05:56
Signed-off-by: Mattt Zmuda <mattt@replicate.com>
Signed-off-by: Mattt Zmuda <mattt@replicate.com>
Signed-off-by: Mattt Zmuda <mattt@replicate.com>
Signed-off-by: Mattt Zmuda <mattt@replicate.com>
Signed-off-by: Mattt Zmuda <mattt@replicate.com>
Signed-off-by: Mattt Zmuda <mattt@replicate.com>
Signed-off-by: Mattt Zmuda <mattt@replicate.com>
Raise ValueError if cursor is None

Signed-off-by: Mattt Zmuda <mattt@replicate.com>
@mattt mattt merged commit 2f84638 into main Nov 7, 2023
@mattt mattt deleted the mattt/pagination branch November 7, 2023 14:04
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.

1 participant