Skip to content

Conversation

@sbansla
Copy link
Contributor

@sbansla sbansla commented Sep 16, 2025

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.

  1. Removed bearer token related resource files which are used for Orgs API.
  2. Added example and mentioned how a user can pass custom rest client without modifying stored credentials.
  3. Modified the existing Orgs APIs to re-use TwilioRestClient, Request and NetworkHttpClient object.

Checklist

  • I acknowledge that all my contributions will be made under the project's license
  • I have made a material change to the repo (functionality, testing, spelling, grammar)
  • I have read the Contribution Guidelines and my PR follows them
  • I have titled the PR appropriately
  • I have updated my branch with the main branch
  • I have added tests that prove my fix is effective or that my feature works
  • I have added the necessary documentation about the functionality in the appropriate .md file
  • I have added inline documentation to the code I modified

If you have questions, please file a support ticket, or create a GitHub Issue in this repository.

@sbansla sbansla changed the base branch from main to 11.0.0-rc September 16, 2025 11:05
Copy link
Contributor

Copilot AI left a 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>

//Getting access token - Method #1
Twilio.init(new OrgsClientCredentialProvider(CLIENT_ID, CLIENT_SECRET));
storingCredentialsFetchAccountDetails();
Copy link
Contributor

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

Copy link
Contributor

Choose a reason for hiding this comment

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

should it be fetchAccountDetails() ?

private static final String ORGANISATION_ID = "id_of_the_organization";

//Getting access token - Method #1
Twilio.init(new OrgsClientCredentialProvider(CLIENT_ID, CLIENT_SECRET));
Copy link
Contributor

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

@tiwarishubham635
Copy link
Contributor

Add example for public oauth as well

@sbansla sbansla merged commit f0aa2cb into 11.0.0-rc Sep 16, 2025
7 of 8 checks passed
@sbansla sbansla deleted the reuse-twiliorestclient-for-orgs-api branch September 16, 2025 15:29
@sbansla sbansla restored the reuse-twiliorestclient-for-orgs-api branch September 18, 2025 06:52
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.

3 participants