Add support for auto-paginatable SearchResult
type
#1252
Merged
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.
Notify
r? @ramon-stripe
cc @stripe/api-libraries
Summary
Adds support for autopaginatable
SearchResult
API response types. Implementation strategy: mostly I copiedCollection
classes/interfaces, but changed the pagination logic to usenextPage
instead oflastId
.Analogous to PRs in stripe-node and stripe-go
See example commit for how this would work in the context of a
/v1/search/charges
endpoint.Release Plan
Even though this functionality is not public, without a future PR adding a search method to a resource (like my charges example, none of these classes/interfaces are accessible, so in effect this addition does not affect the public interface of
stripe-java
and can be safely removed or changed. I intend to merge it right away. This is similar to the release pattern we followed for streaming requests.Testing
Test strategy: took https://github.com/stripe/stripe-java/compare/richardm-search-charges?expand=1, made a .jar, added it to the
pom.xml
in my sample app, and successfully executed:and confirmed the pagination appeared to be happening correctly (it actually wasn't, at first and I fixed a bug).