Skip to content

Add API v2 Search support - #1989

Open
jar-stripe wants to merge 9 commits into
masterfrom
jar/v2-search-runtime
Open

jar-stripe wants to merge 9 commits into
masterfrom
jar/v2-search-runtime

Conversation

@jar-stripe

@jar-stripe jar-stripe commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Why?

API v2 Search returns v2.search_result pages and paginates by sending the original request body with POST requests to next_page_url. stripe-ruby needs a registered enumerable result object so generated v2 Search methods support normal object conversion and automatic iteration.

What?

  • Adds and registers Stripe::V2::SearchResultObject.
  • Exposes v2 Search results through Enumerable.
  • Adds POST auto-pagination that preserves filters and request options, handles empty pages, and supports early termination.
  • Adds focused conversion and v2 Search result coverage.

For the reviewer

v2 search requests look a lot like v1 search requests, except we use a POST instead of a GET and limit is lifted out of the body into the query params.

v2 search responses look a lot like v2 list responses except we have to remove limit from the POST request body.

See Also

https://go/j/DEVSDK-3316

Configuration

  • skip-changefile: This PR is not a user-facing change, so there's no changefile.

Committed-By-Agent: goose
Orbit-Session-Id: ac7fd08a-e385-4498-800e-21f51d3e4ad6
@jar-stripe jar-stripe changed the title Add API v2 search pagination support Add API v2 Search support Oct 7, 2026
Committed-By-Agent: goose
Orbit-Session-Id: ac7fd08a-e385-4498-800e-21f51d3e4ad6
Committed-By-Agent: goose
Orbit-Session-Id: ac7fd08a-e385-4498-800e-21f51d3e4ad6
Committed-By-Agent: goose
Orbit-Session-Id: ac7fd08a-e385-4498-800e-21f51d3e4ad6
Committed-By-Agent: goose
Orbit-Session-Id: ac7fd08a-e385-4498-800e-21f51d3e4ad6
Committed-By-Agent: goose
Orbit-Session-Id: ac7fd08a-e385-4498-800e-21f51d3e4ad6
Committed-By-Agent: goose
Orbit-Session-Id: ac7fd08a-e385-4498-800e-21f51d3e4ad6
@jar-stripe
jar-stripe marked this pull request as ready for review October 8, 2026 02:52
@jar-stripe
jar-stripe requested a review from a team as a code owner October 8, 2026 02:52
@jar-stripe
jar-stripe requested review from zacchua-stripe and a balanced review from Copilot and removed request for a team and Copilot October 8, 2026 02:52
Committed-By-Agent: goose
Orbit-Session-Id: ac7fd08a-e385-4498-800e-21f51d3e4ad6
Copilot AI balanced review requested due to automatic review settings October 8, 2026 04:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Typed request parameters currently fail, and pagination can use the wrong API requestor.

2 open findings
What changed in this PR

Adds API v2 Search result conversion and POST-based automatic pagination.

Changes:

  • Registers Stripe::V2::SearchResultObject.
  • Adds enumerable pagination preserving search filters.
  • Moves Search limit parameters into the query string.
File Description
.hark/​changes/​2026-10-08_jar_v2-search-support.change.md Records the feature change.
lib/​stripe.rb Loads the new result class.
lib/​stripe/​object_types.rb Registers its object type.
lib/​stripe/​stripe_service.rb Handles v2 Search limits.
lib/​stripe/​util.rb Converts and initializes search results.
lib/​stripe/​v2_search_result_object.rb Implements pagination and enumeration.
test/​stripe/​v2_search_result_object_test.rb Tests POST pagination across empty pages.

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

params.delete(:limit)
params.delete("limit")

request_stripe_object(
end

def request(method:, path:, base_address:, params: {}, opts: {})
if method == :post &&
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.

2 participants