Skip to content

Commit dfe6cea

Browse files
committed
Add trunk sid field/parameter to IncomingPhoneNumber
1 parent 9b5bd1d commit dfe6cea

File tree

3 files changed

+57
-1
lines changed

3 files changed

+57
-1
lines changed

src/main/java/com/twilio/rest/api/v2010/account/IncomingPhoneNumber.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535

3636
@JsonIgnoreProperties(ignoreUnknown = true)
3737
public class IncomingPhoneNumber extends Resource {
38-
private static final long serialVersionUID = 40781203062485L;
38+
private static final long serialVersionUID = 145405771566124L;
3939

4040
public enum AddressRequirement {
4141
NONE("none"),
@@ -255,6 +255,7 @@ public static IncomingPhoneNumber fromJson(final InputStream json, final ObjectM
255255
private final URI smsUrl;
256256
private final URI statusCallback;
257257
private final HttpMethod statusCallbackMethod;
258+
private final String trunkSid;
258259
private final String uri;
259260
private final String voiceApplicationSid;
260261
private final Boolean voiceCallerIdLookup;
@@ -298,6 +299,8 @@ private IncomingPhoneNumber(@JsonProperty("account_sid")
298299
final URI statusCallback,
299300
@JsonProperty("status_callback_method")
300301
final HttpMethod statusCallbackMethod,
302+
@JsonProperty("trunk_sid")
303+
final String trunkSid,
301304
@JsonProperty("uri")
302305
final String uri,
303306
@JsonProperty("voice_application_sid")
@@ -329,6 +332,7 @@ private IncomingPhoneNumber(@JsonProperty("account_sid")
329332
this.smsUrl = smsUrl;
330333
this.statusCallback = statusCallback;
331334
this.statusCallbackMethod = statusCallbackMethod;
335+
this.trunkSid = trunkSid;
332336
this.uri = uri;
333337
this.voiceApplicationSid = voiceApplicationSid;
334338
this.voiceCallerIdLookup = voiceCallerIdLookup;
@@ -491,6 +495,15 @@ public final HttpMethod getStatusCallbackMethod() {
491495
return this.statusCallbackMethod;
492496
}
493497

498+
/**
499+
* Returns The Unique string to identify the trunk.
500+
*
501+
* @return Unique string to identify the trunk
502+
*/
503+
public final String getTrunkSid() {
504+
return this.trunkSid;
505+
}
506+
494507
/**
495508
* Returns The The URI for this resource.
496509
*
@@ -583,6 +596,7 @@ public boolean equals(final Object o) {
583596
Objects.equals(smsUrl, other.smsUrl) &&
584597
Objects.equals(statusCallback, other.statusCallback) &&
585598
Objects.equals(statusCallbackMethod, other.statusCallbackMethod) &&
599+
Objects.equals(trunkSid, other.trunkSid) &&
586600
Objects.equals(uri, other.uri) &&
587601
Objects.equals(voiceApplicationSid, other.voiceApplicationSid) &&
588602
Objects.equals(voiceCallerIdLookup, other.voiceCallerIdLookup) &&
@@ -611,6 +625,7 @@ public int hashCode() {
611625
smsUrl,
612626
statusCallback,
613627
statusCallbackMethod,
628+
trunkSid,
614629
uri,
615630
voiceApplicationSid,
616631
voiceCallerIdLookup,
@@ -640,6 +655,7 @@ public String toString() {
640655
.add("smsUrl", smsUrl)
641656
.add("statusCallback", statusCallback)
642657
.add("statusCallbackMethod", statusCallbackMethod)
658+
.add("trunkSid", trunkSid)
643659
.add("uri", uri)
644660
.add("voiceApplicationSid", voiceApplicationSid)
645661
.add("voiceCallerIdLookup", voiceCallerIdLookup)

src/main/java/com/twilio/rest/api/v2010/account/IncomingPhoneNumberCreator.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public class IncomingPhoneNumberCreator extends Creator<IncomingPhoneNumber> {
3333
private URI smsUrl;
3434
private URI statusCallback;
3535
private HttpMethod statusCallbackMethod;
36+
private String trunkSid;
3637
private String voiceApplicationSid;
3738
private Boolean voiceCallerIdLookup;
3839
private HttpMethod voiceFallbackMethod;
@@ -227,6 +228,21 @@ public IncomingPhoneNumberCreator setStatusCallbackMethod(final HttpMethod statu
227228
return this;
228229
}
229230

231+
/**
232+
* The 34 character sid of the Trunk Twilio should use to handle phone calls to
233+
* this number. If a `TrunkSid` is present, Twilio will ignore all of the voice
234+
* urls and voice applications above and use those set on the Trunk. Setting a
235+
* `TrunkSid` will automatically delete your `VoiceApplicationSid` and vice
236+
* versa..
237+
*
238+
* @param trunkSid Unique string to identify the trunk
239+
* @return this
240+
*/
241+
public IncomingPhoneNumberCreator setTrunkSid(final String trunkSid) {
242+
this.trunkSid = trunkSid;
243+
return this;
244+
}
245+
230246
/**
231247
* The 34 character sid of the application Twilio should use to handle phone
232248
* calls to this number. If a `VoiceApplicationSid` is present, Twilio will
@@ -440,6 +456,10 @@ private void addPostParams(final Request request) {
440456
request.addPostParam("StatusCallbackMethod", statusCallbackMethod.toString());
441457
}
442458

459+
if (trunkSid != null) {
460+
request.addPostParam("TrunkSid", trunkSid);
461+
}
462+
443463
if (voiceApplicationSid != null) {
444464
request.addPostParam("VoiceApplicationSid", voiceApplicationSid);
445465
}

src/main/java/com/twilio/rest/api/v2010/account/IncomingPhoneNumberUpdater.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public class IncomingPhoneNumberUpdater extends Updater<IncomingPhoneNumber> {
3333
private URI smsUrl;
3434
private URI statusCallback;
3535
private HttpMethod statusCallbackMethod;
36+
private String trunkSid;
3637
private String voiceApplicationSid;
3738
private Boolean voiceCallerIdLookup;
3839
private HttpMethod voiceFallbackMethod;
@@ -217,6 +218,21 @@ public IncomingPhoneNumberUpdater setStatusCallbackMethod(final HttpMethod statu
217218
return this;
218219
}
219220

221+
/**
222+
* The 34 character sid of the Trunk Twilio should use to handle phone calls to
223+
* this number. If a `TrunkSid` is present, Twilio will ignore all of the voice
224+
* urls and voice applications above and use those set on the Trunk. Setting a
225+
* `TrunkSid` will automatically delete your `VoiceApplicationSid` and vice
226+
* versa..
227+
*
228+
* @param trunkSid Unique string to identify the trunk
229+
* @return this
230+
*/
231+
public IncomingPhoneNumberUpdater setTrunkSid(final String trunkSid) {
232+
this.trunkSid = trunkSid;
233+
return this;
234+
}
235+
220236
/**
221237
* The 34 character sid of the application Twilio should use to handle phone
222238
* calls to this number. If a `VoiceApplicationSid` is present, Twilio will
@@ -403,6 +419,10 @@ private void addPostParams(final Request request) {
403419
request.addPostParam("StatusCallbackMethod", statusCallbackMethod.toString());
404420
}
405421

422+
if (trunkSid != null) {
423+
request.addPostParam("TrunkSid", trunkSid);
424+
}
425+
406426
if (voiceApplicationSid != null) {
407427
request.addPostParam("VoiceApplicationSid", voiceApplicationSid);
408428
}

0 commit comments

Comments
 (0)