Skip to content

Commit c35d66b

Browse files
author
Doug Black
committed
add support for number types to IncomingPhoneNumbers
1 parent dcc0257 commit c35d66b

File tree

2 files changed

+40
-4
lines changed

2 files changed

+40
-4
lines changed

src/main/java/com/twilio/sdk/resource/list/AvailablePhoneNumberList.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,14 @@ public AvailablePhoneNumberList(TwilioRestClient client,
6666
this.type = type;
6767
}
6868

69-
7069
/* (non-Javadoc)
7170
* @see com.twilio.sdk.resource.Resource#getResourceLocation()
7271
*/
7372
@Override
7473
protected String getResourceLocation() {
7574
return "/" + TwilioRestClient.DEFAULT_VERSION + "/Accounts/"
76-
+ this.getRequestAccountSid() + "/AvailablePhoneNumbers/"
77-
+ this.isoCountry + "/" + this.type + ".json";
75+
+ this.getRequestAccountSid() + "/AvailablePhoneNumbers/"
76+
+ this.isoCountry + "/" + this.type + ".json";
7877
}
7978

8079
/* (non-Javadoc)

src/main/java/com/twilio/sdk/resource/list/IncomingPhoneNumberList.java

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@
2020
public class IncomingPhoneNumberList extends ListResource<IncomingPhoneNumber>
2121
implements IncomingPhoneNumberFactory {
2222

23+
public static final String TYPE_LOCAL = "Local";
24+
public static final String TYPE_TOLLFREE = "TollFree";
25+
public static final String TYPE_MOBILE = "Mobile";
26+
27+
28+
/** The type. */
29+
public String type = null;
2330
/**
2431
* Instantiates a new incoming phone number list.
2532
*
@@ -40,13 +47,43 @@ public IncomingPhoneNumberList(TwilioRestClient client,
4047
super(client, filters);
4148
}
4249

50+
/**
51+
* Instantiates a new incoming phone number list.
52+
*
53+
* @param client the client
54+
* @param type the type
55+
* @param filter the filters
56+
*/
57+
public IncomingPhoneNumberList(TwilioRestClient client,
58+
String type, Map<String, String> filters) {
59+
super(client, filters);
60+
this.type = type;
61+
}
62+
63+
/**
64+
* Instantiates a new incoming phone number list.
65+
*
66+
* @param client the client
67+
* @param type the type
68+
*/
69+
public IncomingPhoneNumberList(TwilioRestClient client, String type) {
70+
super(client);
71+
this.type = type;
72+
}
73+
4374
/* (non-Javadoc)
4475
* @see com.twilio.sdk.resource.Resource#getResourceLocation()
4576
*/
4677
@Override
4778
protected String getResourceLocation() {
48-
return "/" + TwilioRestClient.DEFAULT_VERSION + "/Accounts/"
79+
if (type != null) {
80+
return "/" + TwilioRestClient.DEFAULT_VERSION + "/Accounts/"
81+
+ this.getRequestAccountSid() + "/IncomingPhoneNumbers/" + type
82+
+ ".json";
83+
} else {
84+
return "/" + TwilioRestClient.DEFAULT_VERSION + "/Accounts/"
4985
+ this.getRequestAccountSid() + "/IncomingPhoneNumbers.json";
86+
}
5087
}
5188

5289
/* (non-Javadoc)

0 commit comments

Comments
 (0)