feat: Add support for passing a Go Context when making an API request#301
Open
lightster wants to merge 1 commit intotwilio:mainfrom
Open
feat: Add support for passing a Go Context when making an API request#301lightster wants to merge 1 commit intotwilio:mainfrom
lightster wants to merge 1 commit intotwilio:mainfrom
Conversation
lightster
commented
Sep 22, 2025
| } else { | ||
| defaultClient.SetAccountSid(username) | ||
| } | ||
| requestHandler = client.NewRequestHandler(defaultClient) |
Author
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.
14 tasks
lightster
commented
Sep 22, 2025
Comment on lines
+20
to
+22
| // 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) |
Author
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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