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 streaming methods to Service infra #1155

Merged
merged 5 commits into from
Jul 9, 2021

Conversation

richardm-stripe
Copy link
Contributor

@richardm-stripe richardm-stripe commented Jul 9, 2021

r? @dcr-stripe

#1143 was sufficient for adding Streaming support to CurlClient
This PR adds analogous methods onto AbstractStripeService, BaseStripeClient and such.

Adding requestStream onto HttpClient\ClientInterface directly would technically be a breaking change, so I am now exposing separate interfaces for requestStream and request, and I store two separate references on ApiRequestor.

Changelog

  • Add support for streaming requests on the Services interfaces
    • Add support for setStreamingHttpClient and streamingHttpClient to ApiRequestor
    • Add support for getStreamingClient and requestStream to AbstractService
    • Add support for requestStream to BaseStripeClient
  • \Stripe\RequestOptions::parse now clones its input if it is already a RequestOptions object, to prevent accidental mutation.

lib/BaseStripeClient.php Outdated Show resolved Hide resolved
* Defaults to false.
* @param null|string $base base URL (e.g. 'https://api.stripe.com')
*/
protected function expectsRequestStream(
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we add a test that uses this? Maybe on Quotes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I will rebase latest-codegen after this is merged, and that PR contains such a test.

Wanted to separate out the infra stuff in this PR vs. the actual quotes-related functionality.

init.php Outdated Show resolved Hide resolved
@richardm-stripe richardm-stripe force-pushed the richardm-extend-streaming-to-services branch 2 times, most recently from 7f14244 to 0ab0d03 Compare July 9, 2021 14:22
@richardm-stripe richardm-stripe force-pushed the richardm-extend-streaming-to-services branch from dffe20a to 95093c4 Compare July 9, 2021 14:57
@richardm-stripe
Copy link
Contributor Author

richardm-stripe commented Jul 9, 2021

r? @dcr

  • Added the clone we discussed to RequestOptions::parse()
  • Addressed code review comments
    • Removed redundant "removeNonPersistentHeaders"
    • Fixed ordering in init.php
  • Removed trailing commas that were breaking old versions of PHP.

Copy link
Contributor

@dcr-stripe dcr-stripe left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks Richard!

@richardm-stripe richardm-stripe merged commit 33317c9 into master Jul 9, 2021
@richardm-stripe richardm-stripe deleted the richardm-extend-streaming-to-services branch July 9, 2021 15:21
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.

None yet

2 participants