feat: Add support for passing a Go Context when making an API request#301
feat: Add support for passing a Go Context when making an API request#301lightster wants to merge 1 commit into
Conversation
| } else { | ||
| defaultClient.SetAccountSid(username) | ||
| } | ||
| requestHandler = client.NewRequestHandler(defaultClient) |
There was a problem hiding this comment.
@manisha1997 Do you know if this twilio.go file is actually generated by twilio-oai-generator as documented in the file header? If so, could you provide guidance on where in twilio-oai-generator the twilio.go file is generated and how I can run the generation?
I have not been able to figure this out on my own as of yet.
| // If the base client supports context, add it to the request handler. | ||
| // Otherwise we leave it nil and the base client will be used. | ||
| clientWithContext, _ := client.(BaseClientWithContext) |
There was a problem hiding this comment.
Admittedly this is less than ideal, but it allows us to add Context support without breaking backwards compatibility.
ba65a82 to
d7e8c7d
Compare
|
Hi @manisha1997 @tiwarishubham635 or anyone else on the Twilio team: Is there anything we can do to move these changes forward? Obviously there are now conflicts in both of my pull requests. I am open to resolving those and pushing updated changes to be reviewed, but before I do that I want to see if you all will be willing to review and move forward with this change. I think Go Context support is important to the Go community, and my workplace is considering forking the SDK so we have internal Go Context support in the Twilio SDK. I'd love to avoid that and make sure we can get the community access as well. Thanks so much, Matt Light |
|
Hi! I am no more working with Twilio. Someone from the team will help you. Thanks! |
Fixes
This PR adds support for passing a Go Context when making an API request. All API methods will now have a matching function for passing a Go Context when make the API request. For example, the Taskrouter Workspaces
CreateTaskfunction will now have a correspondingCreateTaskWithContextmethod that accepts a Gocontext.Contextas its first parameter.Closes #255. Supersedes #287. Supersedes #290.
Checklist