-
Notifications
You must be signed in to change notification settings - Fork 506
[Breaking] Update List and Search methods with stripe.Client to return a struct
#2179
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
Open
mbroshi-stripe
wants to merge
18
commits into
master
Choose a base branch
from
mbroshi/RUN_DEVSDK-1972/add-list-with-page
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[Breaking] Update List and Search methods with stripe.Client to return a struct
#2179
mbroshi-stripe
wants to merge
18
commits into
master
from
mbroshi/RUN_DEVSDK-1972/add-list-with-page
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
accde7d to
8554d74
Compare
stripe.Client servicesList and Search methods with stripe.Client to return a struct
9963edf to
2279c2b
Compare
95021ce to
5e13068
Compare
Contributor
|
Is it possible to do a diff like statement in the changelog: That would be easier to understand for people going through the changelog to understand the required change. -for c, err := range sc.V1Customers.List(ctx, nil) {
+for c, err := range sc.V1Customers.List(ctx, nil).All(ctx) { |
prathmesh-stripe
approved these changes
Oct 22, 2025
List and Search methods with stripe.Client to return a structList and Search methods with stripe.Client to return a struct
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Why?
This PR address issues like #2168 where users want to manually paginate instead of auto-paginate after a
Listcall usingstripe.Client. Although there are possible workarounds with the current design, they are quite hacky (e.g. requesting an additional item from the API to determine ifHasMoreis true).After much internal debate, we decided the best path forward to support both the manual and automatic pagination use cases is to introduce a breaking change where
Listreturns astructinstead of afunc. You can access the underlying data on thestructwithData()andMeta()methods, or call.All(ctx)to get back to the auto-pagination behavior. This is in line with how our other language SDKs handleList.So, automated pagination will look like this:
and manual pagination will look like:
What?
ListandSearchmethods usingstripe.Clientnow return astructinstead ofSeq2.iter.goandsearch_iter.go, where the new types and methods are introduced, and internal pagination logic depends onpage()instead ofnext().v1List-->V1Listwith av1Pagestruct that represents the response from the API.NewV2Listfunction andFetchtype which were really meant to be used only internally, and not exported.Changelog
ListandSearchmethods usingstripe.Clientnow return astructinstead ofSeq2. This is a backwards incompatible change, and you will need to add an additional call to.All(ctx)in yourforloop. E.g.For manual pagination use cases, you can access the API call's
errorby callinglist.Err(), a page's data usinglist.Data(), and its metadata by callinglist.Meta().