helpscout / helpscout-api-php

PHP Wrapper for the Help Scout API
MIT License
98 stars 62 forks source link

Allow setting Guzzle options such as timeout #271

Closed matt-allan closed 7 months ago

matt-allan commented 3 years ago

Current behavior

It's not possible to set options for the Guzzle client used by the SDK.

Expected behavior

It would be really helpful if we could set options for the Guzzle client so we could set timeouts, logging, etc.

Steps to reproduce N/A

Hi, it would be really helpful if we could set options for the Guzzle client used by RestClient, Authenticator, etc. Right now the only way to do that is to overwrite 3 methods on the RestClientBuilder and copy a lot of code.

It would be great if we could add a constructor parameter or add a method that allows retrieving the underlying Guzzle client so we could update the options on it.

Our use case is setting Guzzle's timeout option. It defaults to 0, which means any issues with HelpScout will cause the script to hang for > 30 seconds. We would like to be able to set a reasonable timeout of ~10 seconds.

bkuhl commented 3 years ago

Hey Matt,

This makes a lot of sense, I can see how currently this is more difficult than it needs to be. I'll make sure this is in our radar, but in the meantime, we'd welcome a PR for a cleaner approach to doing this.

A quick thought on this might be, perhaps RestClientBuilder::__construct(array $config) could accept Guzzle runtime parameters in a guzzle key to be passed to the client.

We'll update this thread when there's something in place to make this easier.

miguelrs commented 7 months ago

We're closing this issue due to inactivity. We've moved your request to our backlog of tickets, although we can't tell when we will be able to act on it. Please feel free to reopen if needed. Thank you!