After 7.4.0
all MINOR
and MAJOR
version bumps will have upgrade notes
posted here.
Version 7.17.x
is the first version containing our new auto-generated twiml classes. As such a fair amount of backwards incompatible changes were made to the twiml module to standardize it with the other twilio helper libraries as well as improve the experience of using TwiML. Some changes that affect all resources:
- Java types are now used when possible.
- Ie url parameters now take java's
URI
type, phone number parameters now takePhoneNumber
types - This applies to both method parameters as well as fields on TwiML resources.
- We have provided "upgrade" methods where possible to preserve backwards compatibility, for instance a method which takes a string url and upgrades it to a
URI
for the user.
- Ie url parameters now take java's
Previously all TwiML objects lived in a single package. In 7.17.x
we've reorganized each TwiML resource into sub-packages such as voice
, messaging
, fax
to reflect in which contexts they can be used. This is necessary as we add more and more TwiML objects.
- com.twilio.twiml.Body -> com.twilio.twiml.messaging.Body
- com.twilio.twiml.Media -> com.twilio.twiml.messaging.Media
- com.twilio.twiml.Message -> com.twilio.twiml.messaging.Message
- com.twilio.twiml.Redirect -> com.twilio.twiml.messaging.Redirect
- com.twilio.twiml.Client -> com.twilio.twiml.voice.Client
- com.twilio.twiml.Conference -> com.twilio.twiml.voice.Conference
- com.twilio.twiml.Dial -> com.twilio.twiml.voice.Dial
- com.twilio.twiml.Echo -> com.twilio.twiml.voice.Echo
- com.twilio.twiml.Enqueue -> com.twilio.twiml.voice.Enqueue
- com.twilio.twiml.Gather -> com.twilio.twiml.voice.Gather
- com.twilio.twiml.Hangup -> com.twilio.twiml.voice.Hangup
- com.twilio.twiml.Leave -> com.twilio.twiml.voice.Leave
- com.twilio.twiml.Number -> com.twilio.twiml.voice.Number
- com.twilio.twiml.Pause -> com.twilio.twiml.voice.Pause
- com.twilio.twiml.Play -> com.twilio.twiml.voice.Play
- com.twilio.twiml.Queue -> com.twilio.twiml.voice.Queue
- com.twilio.twiml.Record -> com.twilio.twiml.voice.Record
- com.twilio.twiml.Redirect -> com.twilio.twiml.voice.Redirect
- com.twilio.twiml.Reject -> com.twilio.twiml.voice.Reject
- com.twilio.twiml.Say -> com.twilio.twiml.voice.Say
- com.twilio.twiml.Sim -> com.twilio.twiml.voice.Sim
- com.twilio.twiml.Sip -> com.twilio.twiml.voice.Sip
- com.twilio.twiml.Sms -> com.twilio.twiml.voice.Sms
- com.twilio.twiml.Task -> com.twilio.twiml.voice.Task
- com.twilio.twiml.messaging.Redirect
- com.twilio.twiml.voice.Redirect
// 7.16.x
Redirect redirect = new Redirect.Builder().url("http://example.com").build();
// 7.17.x
Redirect redirect = new Redirect.Builder("https://example.com").build();
- com.twilio.twiml.voice.Conference
// 7.16.x
Conference conference = new Conference.Builder("my conference")
.statusCallbackEvents(Lists.newArrayList(Conference.ConferenceEvent.END, Conference.ConferenceEvent.JOIN))
.build();
// 7.17.x
Conference conference = new Conference.Builder("my conference")
.statusCallbackEvents(Lists.newArrayList(Conference.Event.END, Conference.Event.JOIN))
.build();
This standardizes the type we use for Http methods with the rest of the library.
// 7.16.x
import com.twilio.twiml.Method;
Conference conference = new Conference.Builder("my conference")
.statusCallbackMethod(Method.GET)
.build();
// 7.17.x
import com.twilio.http.HttpMethod;
Conference conference = new Conference.Builder("my conference")
.statusCallbackMethod(HttpMethod.GET)
.build();
This is a side effect of moving to generating the code, placing enums directly within resource that requires them is the pattern used throughout the library.
// 7.16.x
import com.twilio.twiml.Trim;
Conference conference = new Conference.Builder("my conference")
.trim(Trim.DO_NOT_TRIM)
.build();
// 7.17.x
Conference conference = new Conference.Builder("my conference")
.trim(Conference.Trim.DO_NOT_TRIM)
.build();
// 7.16.x
Task t = new Task.Builder().data("body").build();
// 7.17.x
new Task.Builder("body").build()
// 7.16.x
Enqueue e = new Enqueue.Builder()
.queueName("queue")
.build();
System.out.println(e.queueName);
// 7.17.x
Enqueue e = new Enqueue.Builder()
.name("queue")
.build();
System.out.println(e.name);
EnqueueTask
was a special case of the Enqueue
TwiML resource to be able to nest a Task
TwiML resource within an Enqueue
, we've merged this functionality into Enqueue
// 7.16.x
EnqueueTask enqueue = new EnqueueTask.Builder(new Task.Builder().build()).build()
// 7.17.x
Enqueue enqueue = new Enqueue.Builder()
.task(new Task.Builder().build())
.build()
Some TwiML classes allowed direct construction of the resource in addition to using a Builder to build the resource. For consistency purposes we've standardized all resource construction through the Builder pattern.
// 7.16.x
Hangup hangup = new Hangup();
Body body = new Body("This body!");
// 7.17.x
Hangup hangup = new Hangup.Builder().build();
Body body = new Body.Builder("This body!").build();
// 7.16.x
import com.twilio.twiml.Event;
Number number = new Number.Builder("number")
.statusCallbackEvents(Lists.newArrayList(Event.INITIATED))
.build();
// 7.17.x
Number number = new Number.Builder("number")
.statusCallbackEvents(Lists.newArrayList(Number.Event.INITIATED))
.build();
- Pause
- Dial
- Conference
// 7.16.x
Pause pause = new Pause.Builder()
.options("foo", "bar")
.build();
// 7.17.x
Pause pause = new Pause.Builder()
.option("foo", "bar")
.build();
// 7.16.x
Say say = new Say.Builder("I <3 Twilio")
.language(Language.GB)
.voice(Say.Voice.MAN)
.build();
// 7.17.x
Say say = new Say.Builder("I <3 Twilio")
.language(Say.Language.EN_GB)
.voice(Say.Voice.MAN)
.build();
This was a rare instance where a parameter which had a small set of possible values did not have a proper Enum in 7.16.x
.
// 7.16.x
Gather gather = new Gather.Builder()
.input("dtmf")
.build();
// 7.17.x
Gather gather = new Gather.Builder()
.input(Gather.Input.DTMF)
.build();
SpeechTimeout accept either an integer or the string "auto". We didn't have a good way to model this in our code generator so had to leave the type as String
.
// 7.16.x
Gather gather = new Gather.Builder()
.speechTimeout(5)
.speechTimeout("auto")
.build();
// 7.17.x
Gather gather = new Gather.Builder()
.input(Gather.Input.DTMF)
.speechTimeout("5")
.speechTimeout("auto")
.build();
// 7.15.x
Document.updater("IS123", "ET123", data).update();
SyncListItem.updater("IS123", "ES123", 1, data).update();
SyncMapItem.updater("IS123", "MP123", "myKey", data).update();
// 7.16.x
Document.updater("IS123", "ET123").setData(data).update();
SyncListItem.updater("IS123", "ES123", 1).setData(data).update();
SyncMapItem.updater("IS123", "MP123", "myKey").setData(data).update();
// 7.14.x
Message.creator("IS123", "CH123", "this is the body");
// 7.15.x
MessageCreator creator = Message.creator("IS123", "CH123");
CHANGED - data
, apn
, gcm
, fcm
, sms
parameters in Notifications
create resource are maps instead of strings.
// 7.14.x
NotificationCreator notificationCreator = Notification.creator("IS123");
notificationCreator.setData("{\"key\": \"value\"}");
notificationCreator.setApn("{\"key\": \"value\"}");
// 7.15.x
Map<String, Object> data = new HashMap<~>();
data.put("key", "value);
NotificationCreator notificationCreator = Notification.creator("IS123");
notificationCreator.setData(data);
notificationCreator.setApn(data);
- `src/main/java/com/twilio/rest/video/v1/room/Recording.java`
- `src/main/java/com/twilio/rest/video/v1/room/RecordingFetcher.java`
- `src/main/java/com/twilio/rest/video/v1/room/RecordingReader.java`
- `src/test/java/com/twilio/rest/video/v1/room/RecordingTest.java`
// 7.10.x
Recording.fetcher();
Recording.reader();
// 7.11.x
RoomRecording.fetcher();
RoomRecording.reader();
There already exists a getter for the resource
src/main/java/com/twilio/rest/lookups/v1/PhoneNumber.java
// 7.9.x
resource.getSid();
// 7.10.x
resource.getPhoneNumber().toString();
src/main/java/com/twilio/rest/pricing/v1/messaging/Country.java
src/main/java/com/twilio/rest/pricing/v1/phonenumber/Country.java
src/main/java/com/twilio/rest/pricing/v1/voice/Country.java
// 7.9.x
resource.getSid();
// 7.10.x
resource.getIsoCountry();
src/main/java/com/twilio/rest/pricing/v1/voice/Number.java
// 7.9.x
resource.getSid();
// 7.10.x
resource.getNumber().toString();
- Updating
friendlyName
is now done through a setter instead of the constructor
The friendlyName
parameter is optional when updating TaskRouter Activities
- TaskRouter Activities
Activity.updater("WS123", "AC123", "friendlyName").update();
Activity.updater("WS123", "AC123").setFriendlyName("friendlyName").update();
Filtering by Tasks exposes the ability to filter by multiple status. The library is being updated to support this feature
Task.reader("WS123").setAssignmentStatus(Task.Status.ASSIGNED).read();
Task.reader("WS123").setAssignmentStatus(Lists.newArrayList(
Task.Status.ASSIGNED.toString(),
Task.Status.CANCELED.toString()
)).read();