-
-
Notifications
You must be signed in to change notification settings - Fork 935
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
Experimental pagination feature #833
Conversation
We need an option for |
b26d9bb
to
4172cdb
Compare
Instead of an const results = await got.paginate.all({
pagination: {
shouldContinue: allItems => allItems.length !== 3
}
}); because people may want have custom conditions. |
549d62d
to
2b7dcc7
Compare
I need to make more tests here |
@szmarczak one day I would like to see pagination with a |
A side note for me: There's a missing test for @rarkins You can do something like this: const results = await got.paginate.all({
pagination: {
...,
shouldContinue: items => items.length < 1000
}
}); That will give you max 1000 items. But if it's a common use case, then I can make |
I'm pretty sure it would be commonly used |
So you have a new |
aa2c16c
to
f98b94e
Compare
I'm gonna write the docs tomorrow. |
How about we prefix the option with an underscore and document that the option is experimental and that users should lock the Got dependency as it might change in minor releases? This will give users a chance to try it out, but also gives us a chance to improve it without having to do lots of major releases? |
Sure, will finish this today. |
###### \_pagination.paginate | ||
|
||
Type: `Function`\ | ||
Default: [`Link` header logic](source/index.ts) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should explain the Link header logic in English prose, not just link to the source.
This is looking great! Nice work, @szmarczak 👌 |
Fixes #722
Checklist
IssueHunt Summary
Referenced issues
This pull request has been submitted to:
IssueHunt has been backed by the following sponsors. Become a sponsor