twilio / twilio-java

A Java library for communicating with the Twilio REST API and generating TwiML.
MIT License
484 stars 425 forks source link

feat!: make Twilio not singleton #675

Closed SimonOsnes closed 1 year ago

SimonOsnes commented 2 years ago

Fixes #650

Major version update. Twilio class is no longer static singleton. Make it possible to have multiple instances of Twilio within the same program. Implement new TwilioApi. Also update tests and example code.

Add few testcases to RequestValidatorTest.java as per issue #645

Checklist

Earth-Turtle commented 5 months ago

Is there a reason this pull request was closed? Allowing the Twilio client to be an object instead of static singleton makes it easier to mock and manage initialization.

In particular, trying to create a reusable object by using the TwilioRestClient.Builder, you have to supply the username and password immediately on creating the builder, where it can no longer be changed once the rest client is built. This clashes with the ability to call Twilio.setUsername() on the static instance whenever needed.

SimonOsnes commented 5 months ago

@Earth-Turtle

This PR was made as a school project and when after we submitted it, we did not receive any feedback or anything for like 8 months before I closed it. If you want to re-open it and continue the work that we started you are more than welcome to do it. We won't be doing anything more to this