-
Notifications
You must be signed in to change notification settings - Fork 449
fix: Reuse twiliorestclient for orgs api #896
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR migrates the Orgs API from using a dedicated BearerTokenTwilioRestClient to reusing the standard TwilioRestClient, eliminating duplicate HTTP client infrastructure and standardizing authentication across all APIs. This change introduces breaking changes for Orgs API initialization.
Key Changes:
- Removed all bearer token-specific HTTP client classes and replaced with standard TwilioRestClient usage
- Updated Orgs API classes to use standard base classes (Reader, Fetcher, etc.) instead of bearer token variants
- Added OrgsClientCredentialProvider for simplified authentication initialization
Reviewed Changes
Copilot reviewed 34 out of 34 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| BearerTokenNetworkHttpClientTest.java | Deleted test file for removed bearer token HTTP client |
| ClusterTest.java | Updated to use new TokenAuthStrategy with TwilioRestClient instead of deprecated authentication |
| Various Orgs API files | Migrated from bearer token-specific base classes to standard ones |
| Bearer token HTTP classes | Removed dedicated HTTP client infrastructure |
| OrgsClientCredentialProvider.java | Added new credential provider for simplified Orgs API authentication |
| Bearer token base classes | Removed duplicate base classes in favor of standard ones |
| Page.java | Added null safety checks for meta object handling |
| TwilioOrgsTokenAuth.java | Removed deprecated authentication class |
| Documentation files | Updated examples to reflect new authentication approach |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
examples/OrgsAPICall.md
Outdated
|
|
||
| //Getting access token - Method #1 | ||
| Twilio.init(new OrgsClientCredentialProvider(CLIENT_ID, CLIENT_SECRET)); | ||
| storingCredentialsFetchAccountDetails(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
storingCredentialsFetchAccountDetails() is not defined in this file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should it be fetchAccountDetails() ?
examples/OrgsAPICall.md
Outdated
| private static final String ORGANISATION_ID = "id_of_the_organization"; | ||
|
|
||
| //Getting access token - Method #1 | ||
| Twilio.init(new OrgsClientCredentialProvider(CLIENT_ID, CLIENT_SECRET)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be CLIENT_SID as declared above
|
Add example for public oauth as well |
…com/twilio/twilio-java into reuse-twiliorestclient-for-orgs-api
Fixes
This PR contains Breaking Change only for Orgs API on how to initialise credentials.
Previously Orgs uses BearerTokenTwilioRestClient, We have removed this client and now onwards all the APIs including Orgs API will use TwilioRestClient.
Checklist
If you have questions, please file a support ticket, or create a GitHub Issue in this repository.