diff --git a/CHANGES.md b/CHANGES.md index ec9d3c334..2cdea9f21 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,32 @@ twilio-java changelog ===================== +[2025-01-31] Version 10.7.0 +--------------------------- +**Library - Fix** +- [PR #809](https://github.com/twilio/twilio-java/pull/809): Fix for 1 vulnerabilities. Thanks to [@twilio-product-security](https://github.com/twilio-product-security)! +- [PR #830](https://github.com/twilio/twilio-java/pull/830): Voice v2 fix. Thanks to [@manisha1997](https://github.com/manisha1997)! + +**Library - Chore** +- [PR #831](https://github.com/twilio/twilio-java/pull/831): added bug report issue template. Thanks to [@sbansla](https://github.com/sbansla)! +- [PR #829](https://github.com/twilio/twilio-java/pull/829): add variant class. Thanks to [@manisha1997](https://github.com/manisha1997)! + +**Api** +- Add open-api file tag to `conference/call recordings` and `recording_transcriptions`. + +**Events** +- Add support for subaccount subscriptions (beta) + +**Insights** +- add new region to conference APIs + +**Lookups** +- Add new `parnter_sub_id` query parameter to the lookup request + +**Twiml** +- Convert Twiml Attribute `speechModel` of type enum to string **(breaking change)** + + [2025-01-28] Version 10.6.8 --------------------------- **Library - Fix** diff --git a/src/main/java/com/twilio/rest/content/v1/Content.java b/src/main/java/com/twilio/rest/content/v1/Content.java index 3c34f28ae..d00bc0ee2 100644 --- a/src/main/java/com/twilio/rest/content/v1/Content.java +++ b/src/main/java/com/twilio/rest/content/v1/Content.java @@ -674,35 +674,6 @@ public static TwilioFlows fromJson( } } - @ToString - public static class TwilioSchedule { - - @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("id") - @Getter - @Setter - private String id; - - @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("title") - @Getter - @Setter - private String title; - - @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("timeSlots") - @Getter - @Setter - private String timeSlots; - - public static TwilioSchedule fromJson( - String jsonString, - ObjectMapper mapper - ) throws IOException { - return mapper.readValue(jsonString, TwilioSchedule.class); - } - } - @ToString public static class WhatsappCard { @@ -859,12 +830,6 @@ public static class Types { @Setter private TwilioFlows twilioFlows; - @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("twilio/schedule") - @Getter - @Setter - private TwilioSchedule twilioSchedule; - @JsonInclude(JsonInclude.Include.NON_EMPTY) @JsonProperty("whatsapp/card") @Getter diff --git a/src/main/java/com/twilio/rest/conversations/v1/AddressConfiguration.java b/src/main/java/com/twilio/rest/conversations/v1/AddressConfiguration.java index 9c482264d..4e70578d8 100644 --- a/src/main/java/com/twilio/rest/conversations/v1/AddressConfiguration.java +++ b/src/main/java/com/twilio/rest/conversations/v1/AddressConfiguration.java @@ -231,8 +231,7 @@ public enum Type { MESSENGER("messenger"), GBM("gbm"), EMAIL("email"), - RCS("rcs"), - APPLE("apple"); + RCS("rcs"); private final String value; diff --git a/src/main/java/com/twilio/rest/events/v1/Subscription.java b/src/main/java/com/twilio/rest/events/v1/Subscription.java index ce86db6e5..0a37de2b4 100644 --- a/src/main/java/com/twilio/rest/events/v1/Subscription.java +++ b/src/main/java/com/twilio/rest/events/v1/Subscription.java @@ -39,7 +39,7 @@ @ToString public class Subscription extends Resource { - private static final long serialVersionUID = 97790115204936L; + private static final long serialVersionUID = 198248500185102L; public static SubscriptionCreator creator( final String description, @@ -116,7 +116,6 @@ public static Subscription fromJson( private final String sinkSid; private final URI url; private final Map links; - private final Boolean receiveEventsFromSubaccounts; @JsonCreator private Subscription( @@ -127,10 +126,7 @@ private Subscription( @JsonProperty("description") final String description, @JsonProperty("sink_sid") final String sinkSid, @JsonProperty("url") final URI url, - @JsonProperty("links") final Map links, - @JsonProperty( - "receive_events_from_subaccounts" - ) final Boolean receiveEventsFromSubaccounts + @JsonProperty("links") final Map links ) { this.accountSid = accountSid; this.sid = sid; @@ -140,7 +136,6 @@ private Subscription( this.sinkSid = sinkSid; this.url = url; this.links = links; - this.receiveEventsFromSubaccounts = receiveEventsFromSubaccounts; } public final String getAccountSid() { @@ -175,10 +170,6 @@ public final Map getLinks() { return this.links; } - public final Boolean getReceiveEventsFromSubaccounts() { - return this.receiveEventsFromSubaccounts; - } - @Override public boolean equals(final Object o) { if (this == o) { @@ -199,11 +190,7 @@ public boolean equals(final Object o) { Objects.equals(description, other.description) && Objects.equals(sinkSid, other.sinkSid) && Objects.equals(url, other.url) && - Objects.equals(links, other.links) && - Objects.equals( - receiveEventsFromSubaccounts, - other.receiveEventsFromSubaccounts - ) + Objects.equals(links, other.links) ); } @@ -217,8 +204,7 @@ public int hashCode() { description, sinkSid, url, - links, - receiveEventsFromSubaccounts + links ); } } diff --git a/src/main/java/com/twilio/rest/events/v1/SubscriptionCreator.java b/src/main/java/com/twilio/rest/events/v1/SubscriptionCreator.java index 32b0fa95a..449e4aa7c 100644 --- a/src/main/java/com/twilio/rest/events/v1/SubscriptionCreator.java +++ b/src/main/java/com/twilio/rest/events/v1/SubscriptionCreator.java @@ -37,7 +37,6 @@ public class SubscriptionCreator extends Creator { private String description; private String sinkSid; private List> types; - private Boolean receiveEventsFromSubaccounts; public SubscriptionCreator( final String description, @@ -68,13 +67,6 @@ public SubscriptionCreator setTypes(final Map types) { return setTypes(Promoter.listOfOne(types)); } - public SubscriptionCreator setReceiveEventsFromSubaccounts( - final Boolean receiveEventsFromSubaccounts - ) { - this.receiveEventsFromSubaccounts = receiveEventsFromSubaccounts; - return this; - } - @Override public Subscription create(final TwilioRestClient client) { String path = "/v1/Subscriptions"; @@ -131,11 +123,5 @@ private void addPostParams(final Request request) { request.addPostParam("Types", Converter.mapToJson(prop)); } } - if (receiveEventsFromSubaccounts != null) { - request.addPostParam( - "ReceiveEventsFromSubaccounts", - receiveEventsFromSubaccounts.toString() - ); - } } } diff --git a/src/main/java/com/twilio/rest/events/v1/SubscriptionUpdater.java b/src/main/java/com/twilio/rest/events/v1/SubscriptionUpdater.java index ddd4867f2..adefd8eab 100644 --- a/src/main/java/com/twilio/rest/events/v1/SubscriptionUpdater.java +++ b/src/main/java/com/twilio/rest/events/v1/SubscriptionUpdater.java @@ -30,7 +30,6 @@ public class SubscriptionUpdater extends Updater { private String pathSid; private String description; private String sinkSid; - private Boolean receiveEventsFromSubaccounts; public SubscriptionUpdater(final String pathSid) { this.pathSid = pathSid; @@ -46,13 +45,6 @@ public SubscriptionUpdater setSinkSid(final String sinkSid) { return this; } - public SubscriptionUpdater setReceiveEventsFromSubaccounts( - final Boolean receiveEventsFromSubaccounts - ) { - this.receiveEventsFromSubaccounts = receiveEventsFromSubaccounts; - return this; - } - @Override public Subscription update(final TwilioRestClient client) { String path = "/v1/Subscriptions/{Sid}"; @@ -98,11 +90,5 @@ private void addPostParams(final Request request) { if (sinkSid != null) { request.addPostParam("SinkSid", sinkSid); } - if (receiveEventsFromSubaccounts != null) { - request.addPostParam( - "ReceiveEventsFromSubaccounts", - receiveEventsFromSubaccounts.toString() - ); - } } } diff --git a/src/main/java/com/twilio/rest/insights/v1/Conference.java b/src/main/java/com/twilio/rest/insights/v1/Conference.java index 18587dac1..4201ee7db 100644 --- a/src/main/java/com/twilio/rest/insights/v1/Conference.java +++ b/src/main/java/com/twilio/rest/insights/v1/Conference.java @@ -404,14 +404,18 @@ public static Tag forValue(final String value) { } } - public enum ProcessingState { - COMPLETE("complete"), - IN_PROGRESS("in_progress"), - TIMEOUT("timeout"); + public enum Region { + US1("us1"), + AU1("au1"), + BR1("br1"), + IE1("ie1"), + JP1("jp1"), + SG1("sg1"), + DE1("de1"); private final String value; - private ProcessingState(final String value) { + private Region(final String value) { this.value = value; } @@ -420,24 +424,19 @@ public String toString() { } @JsonCreator - public static ProcessingState forValue(final String value) { - return Promoter.enumFromString(value, ProcessingState.values()); + public static Region forValue(final String value) { + return Promoter.enumFromString(value, Region.values()); } } - public enum Region { - US1("us1"), - US2("us2"), - AU1("au1"), - BR1("br1"), - IE1("ie1"), - JP1("jp1"), - SG1("sg1"), - DE1("de1"); + public enum ProcessingState { + COMPLETE("complete"), + IN_PROGRESS("in_progress"), + TIMEOUT("timeout"); private final String value; - private Region(final String value) { + private ProcessingState(final String value) { this.value = value; } @@ -446,8 +445,8 @@ public String toString() { } @JsonCreator - public static Region forValue(final String value) { - return Promoter.enumFromString(value, Region.values()); + public static ProcessingState forValue(final String value) { + return Promoter.enumFromString(value, ProcessingState.values()); } } diff --git a/src/main/java/com/twilio/rest/lookups/v2/PhoneNumberFetcher.java b/src/main/java/com/twilio/rest/lookups/v2/PhoneNumberFetcher.java index b5060fa7a..0ecd5b3d2 100644 --- a/src/main/java/com/twilio/rest/lookups/v2/PhoneNumberFetcher.java +++ b/src/main/java/com/twilio/rest/lookups/v2/PhoneNumberFetcher.java @@ -42,7 +42,6 @@ public class PhoneNumberFetcher extends Fetcher { private String dateOfBirth; private String lastVerifiedDate; private String verificationSid; - private String partnerSubId; public PhoneNumberFetcher(final String pathPhoneNumber) { this.pathPhoneNumber = pathPhoneNumber; @@ -122,11 +121,6 @@ public PhoneNumberFetcher setVerificationSid(final String verificationSid) { return this; } - public PhoneNumberFetcher setPartnerSubId(final String partnerSubId) { - this.partnerSubId = partnerSubId; - return this; - } - @Override public PhoneNumber fetch(final TwilioRestClient client) { String path = "/v2/PhoneNumbers/{PhoneNumber}"; @@ -213,8 +207,5 @@ private void addQueryParams(final Request request) { if (verificationSid != null) { request.addQueryParam("VerificationSid", verificationSid); } - if (partnerSubId != null) { - request.addQueryParam("PartnerSubId", partnerSubId); - } } } diff --git a/src/main/java/com/twilio/twiml/voice/Gather.java b/src/main/java/com/twilio/twiml/voice/Gather.java index 2b4da80cf..5b4156b4b 100644 --- a/src/main/java/com/twilio/twiml/voice/Gather.java +++ b/src/main/java/com/twilio/twiml/voice/Gather.java @@ -185,25 +185,7 @@ public String toString() { } } - public enum SpeechModel { - DEFAULT("default"), - NUMBERS_AND_COMMANDS("numbers_and_commands"), - PHONE_CALL("phone_call"), - EXPERIMENTAL_CONVERSATIONS("experimental_conversations"), - EXPERIMENTAL_UTTERANCES("experimental_utterances"); - - private final String value; - - private SpeechModel(final String value) { - this.value = value; - } - - public String toString() { - return value; - } - } - - private final List input; + private final List input; private final URI action; private final HttpMethod method; private final Integer timeout; @@ -214,12 +196,12 @@ public String toString() { private final Integer numDigits; private final URI partialResultCallback; private final HttpMethod partialResultCallbackMethod; - private final Gather.Language language; + private final Language language; private final String hints; private final Boolean bargeIn; private final Boolean debug; private final Boolean actionOnEmptyResult; - private final Gather.SpeechModel speechModel; + private final String speechModel; private final Boolean enhanced; /** @@ -312,7 +294,7 @@ protected Map getElementAttributes() { attrs.put("actionOnEmptyResult", this.isActionOnEmptyResult().toString()); } if (this.getSpeechModel() != null) { - attrs.put("speechModel", this.getSpeechModel().toString()); + attrs.put("speechModel", this.getSpeechModel()); } if (this.isEnhanced() != null) { attrs.put("enhanced", this.isEnhanced().toString()); @@ -326,13 +308,13 @@ protected Map getElementAttributes() { * * @return Input type Twilio should accept */ - public List getInputs() { + public List getInputs() { return input; } protected String getInputsAsString() { StringBuilder sb = new StringBuilder(); - Iterator iter = this.getInputs().iterator(); + Iterator iter = this.getInputs().iterator(); while (iter.hasNext()) { sb.append(iter.next().toString()); if (iter.hasNext()) { @@ -439,7 +421,7 @@ public HttpMethod getPartialResultCallbackMethod() { * * @return Language to use */ - public Gather.Language getLanguage() { + public Language getLanguage() { return language; } @@ -484,7 +466,7 @@ public Boolean isActionOnEmptyResult() { * * @return Specify the model that is best suited for your use case */ - public Gather.SpeechModel getSpeechModel() { + public String getSpeechModel() { return speechModel; } @@ -516,7 +498,7 @@ public static Builder fromXml(final String xml) throws TwiMLException { } } - private List input; + private List input; private URI action; private HttpMethod method; private Integer timeout; @@ -527,19 +509,19 @@ public static Builder fromXml(final String xml) throws TwiMLException { private Integer numDigits; private URI partialResultCallback; private HttpMethod partialResultCallbackMethod; - private Gather.Language language; + private Language language; private String hints; private Boolean bargeIn; private Boolean debug; private Boolean actionOnEmptyResult; - private Gather.SpeechModel speechModel; + private String speechModel; private Boolean enhanced; /** * Input type Twilio should accept */ @JacksonXmlProperty(isAttribute = true, localName = "input") - public Builder inputs(List input) { + public Builder inputs(List input) { this.input = input; return this; } @@ -547,7 +529,7 @@ public Builder inputs(List input) { /** * Input type Twilio should accept */ - public Builder inputs(Gather.Input input) { + public Builder inputs(Input input) { this.input = Promoter.listOfOne(input); return this; } @@ -663,7 +645,7 @@ public Builder partialResultCallbackMethod(HttpMethod partialResultCallbackMetho * Language to use */ @JacksonXmlProperty(isAttribute = true, localName = "language") - public Builder language(Gather.Language language) { + public Builder language(Language language) { this.language = language; return this; } @@ -708,7 +690,7 @@ public Builder actionOnEmptyResult(Boolean actionOnEmptyResult) { * Specify the model that is best suited for your use case */ @JacksonXmlProperty(isAttribute = true, localName = "speechModel") - public Builder speechModel(Gather.SpeechModel speechModel) { + public Builder speechModel(String speechModel) { this.speechModel = speechModel; return this; } @@ -756,4 +738,4 @@ public Gather build() { return new Gather(this); } } -} \ No newline at end of file +} diff --git a/src/test/java/com/twilio/twiml/VoiceResponseTest.java b/src/test/java/com/twilio/twiml/VoiceResponseTest.java index 53c821013..8daf7076d 100644 --- a/src/test/java/com/twilio/twiml/VoiceResponseTest.java +++ b/src/test/java/com/twilio/twiml/VoiceResponseTest.java @@ -9,31 +9,12 @@ import com.twilio.converter.Promoter; import com.twilio.http.HttpMethod; -import com.twilio.twiml.voice.Connect; -import com.twilio.twiml.voice.Dial; -import com.twilio.twiml.voice.Echo; -import com.twilio.twiml.voice.Enqueue; -import com.twilio.twiml.voice.Gather; -import com.twilio.twiml.voice.Hangup; -import com.twilio.twiml.voice.Leave; -import com.twilio.twiml.voice.Pause; -import com.twilio.twiml.voice.Pay; -import com.twilio.twiml.voice.Play; -import com.twilio.twiml.voice.Prompt; -import com.twilio.twiml.voice.Queue; import com.twilio.twiml.voice.Record; -import com.twilio.twiml.voice.Redirect; -import com.twilio.twiml.voice.Refer; -import com.twilio.twiml.voice.Reject; -import com.twilio.twiml.voice.Say; -import com.twilio.twiml.voice.Sms; -import com.twilio.twiml.voice.Start; -import com.twilio.twiml.voice.Stop; +import com.twilio.twiml.voice.*; import org.junit.Assert; import org.junit.Test; import java.net.URI; -import java.util.List; /** * Test class for {@link VoiceResponse} @@ -123,7 +104,7 @@ public void testElementWithChildren() { .bargeIn(true) .debug(true) .actionOnEmptyResult(true) - .speechModel(Gather.SpeechModel.DEFAULT) + .speechModel("speech_model") .enhanced(true) .build()); @@ -215,7 +196,7 @@ public void testElementWithChildren() { "number" + "" + "name" + - "" + + "" + "" + "" + "" + @@ -379,7 +360,7 @@ public void testXmlChildrenDeserialization() { .bargeIn(true) .debug(true) .actionOnEmptyResult(true) - .speechModel(Gather.SpeechModel.DEFAULT) + .speechModel("speech_model") .enhanced(true) .build()); @@ -470,7 +451,7 @@ public void testXmlChildrenDeserialization() { "number" + "" + "name" + - "" + + "" + "" + "" + "" + @@ -551,4 +532,4 @@ public void testXmlEmptyChildrenDeserialization() { elem.toXml() ); } -} \ No newline at end of file +} diff --git a/src/test/java/com/twilio/twiml/voice/GatherTest.java b/src/test/java/com/twilio/twiml/voice/GatherTest.java index 18d27fe06..9d06ae02a 100644 --- a/src/test/java/com/twilio/twiml/voice/GatherTest.java +++ b/src/test/java/com/twilio/twiml/voice/GatherTest.java @@ -14,7 +14,6 @@ import org.junit.Test; import java.net.URI; -import java.util.List; /** * Test class for {@link Gather} @@ -57,13 +56,13 @@ public void testElementWithParams() { .bargeIn(true) .debug(true) .actionOnEmptyResult(true) - .speechModel(Gather.SpeechModel.DEFAULT) + .speechModel("speech_model") .enhanced(true) .build(); Assert.assertEquals( "" + - "", + "", elem.toXml() ); } @@ -199,12 +198,12 @@ public void testXmlAttributesDeserialization() { .bargeIn(true) .debug(true) .actionOnEmptyResult(true) - .speechModel(Gather.SpeechModel.DEFAULT) + .speechModel("speech_model") .enhanced(true) .build(); Assert.assertEquals( - Gather.Builder.fromXml("").build().toXml(), + Gather.Builder.fromXml("").build().toXml(), elem.toXml() ); } @@ -249,4 +248,4 @@ public void testXmlEmptyChildrenDeserialization() { elem.toXml() ); } -} \ No newline at end of file +}