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. #1251

Merged
merged 1 commit into from
Mar 11, 2022
Merged

Add support for SearchResult objects. #1251

merged 1 commit into from
Mar 11, 2022

Conversation

dcr-stripe
Copy link
Contributor

Notify

r? @pakrym-stripe
cc @richardm-stripe

Summary

Adds support for search_result objects returned by the Stripe API, including adding a templated 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

This was revived from #1134 with the following API changes:

  • page is used in the request
  • next_page is always returned, just null when there's no more page.

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
Copy link
Contributor Author

r? @yejia-stripe

@dcr-stripe dcr-stripe requested a review from yejia-stripe March 11, 2022 20:16
@dcr-stripe dcr-stripe merged commit 9c7e27a into master Mar 11, 2022
@dcr-stripe dcr-stripe deleted the dcr-php-search branch March 11, 2022 20:55
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