Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves #1722
Before the change?
Octokit-provided paginated API requests is only available via the auto paginate functionality, which queries for all pages internally and provides no user control for things like lazy page requests or mapping of page values to reduce memory usage.
After the change?
Note I wanted to feel out whether this approach was worth pursuing before adding full test coverage and commenting all the new logic. I'm happy to do all of that if y'all would consider taking this change.
I've added a new
paginate
configurable option to the octokit client that, when set, returns an enumerable pager. Either the newpaginate
value or the existingauto_paginate
value can also be specified using custom pagination options provided directly on the client call likeclient.list_app_installations(..., pagination: { auto_paginate: true })
The pager provides additional custom functionality over a strict enumerator:
max_pages
value to limit the number of pages retrieved from the serverlast
header linkwith_response
, similar to enumerable'swith_index
methodPull request checklist
Does this introduce a breaking change?
Please see our docs on breaking changes to help!
I've made the logic non-breaking, and have the full test suite passing in my local environment (hopefully in CI as well 😅 ). TBH though I think having an enumerable makes the
auto_paginate
option unnecessary. Maybe it should be marked deprecated and removed in the next major version bump?