Skip to content
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

Add support for SearchResult objects #1134

Closed
wants to merge 3 commits into from
Closed

Conversation

dcr-stripe
Copy link
Contributor

@dcr-stripe dcr-stripe commented Jun 3, 2021

Notify

r? @richardm-stripe

Summary

Adds support for search_result objects returned by the Stripe API, including adding a SearchResult class and a Search trait which can be added to resources to support invoking search APIs.

This behaves similarly to Collection in that they both wrap around a list of objects and provide pagination. However the SearchResult object paginates by relying on a next_page token included in the response rather than using object IDs + starting_before/ending_after. Thus, only forward pagination is supported

Test plan

Added unit tests. We'll want to add some more rigorous tests once stripe-mock has been updated to include at least one API that returns this resource.

Post-merge

The generation for init.php and lib/Util/ObjectTypes.php should be updated to include these new classes going forward.

@dcr-stripe dcr-stripe force-pushed the dcr-php-search-impl branch 4 times, most recently from 72a1fb1 to e9e9492 Compare June 3, 2021 14:41
@richardm-stripe
Copy link
Contributor

Reviewed via diff lib/Collection.php lib/SearchResult.php -- this looks great!

One suggestion: would you be willing to copy your Github PR "summary" into the docstring for SearchResult.php?

@dcr-stripe
Copy link
Contributor Author

dcr-stripe commented Jun 3, 2021

Reviewed via diff lib/Collection.php lib/SearchResult.php -- this looks great!

One suggestion: would you be willing to copy your Github PR "summary" into the docstring for SearchResult.php?

Thanks @richardm-stripe - great idea! Done. PTAL?

@richardm-stripe richardm-stripe changed the title Add support for SearchResult objects. [WIP] Add support for SearchResult objects Jun 3, 2021
@richardm-stripe richardm-stripe marked this pull request as draft June 3, 2021 16:57
@richardm-stripe
Copy link
Contributor

(I think we can merge this at any time, by the way)

@remi-stripe
Copy link
Contributor

@richardm-stripe We shouldn't merge since it's a private beta and could change at any time.

@dcr-stripe dcr-stripe force-pushed the dcr-php-search-impl branch from a19e3fa to 8a1842e Compare July 20, 2021 14:34
@dcr-stripe dcr-stripe changed the title [WIP] Add support for SearchResult objects Add support for SearchResult objects Jul 20, 2021
@dcr-stripe dcr-stripe marked this pull request as ready for review August 9, 2021 15:10
@dcr-stripe dcr-stripe closed this Oct 8, 2021
@remi-stripe remi-stripe deleted the dcr-php-search-impl branch July 25, 2022 19:44
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.

3 participants