
com.twilio.sdk.resource.instance.Account Maven / Gradle / Ivy
package com.twilio.sdk.resource.instance;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import com.twilio.sdk.TwilioRestClient;
import com.twilio.sdk.TwilioRestException;
import com.twilio.sdk.TwilioRestResponse;
import com.twilio.sdk.resource.InstanceResource;
import com.twilio.sdk.resource.factory.AddressFactory;
import com.twilio.sdk.resource.factory.ApplicationFactory;
import com.twilio.sdk.resource.factory.CallFactory;
import com.twilio.sdk.resource.factory.IncomingPhoneNumberFactory;
import com.twilio.sdk.resource.factory.MessageFactory;
import com.twilio.sdk.resource.factory.OutgoingCallerIdFactory;
import com.twilio.sdk.resource.factory.QueueFactory;
import com.twilio.sdk.resource.factory.SigningKeyFactory;
import com.twilio.sdk.resource.factory.SmsFactory;
import com.twilio.sdk.resource.factory.UsageTriggerFactory;
import com.twilio.sdk.resource.factory.sip.CredentialListFactory;
import com.twilio.sdk.resource.factory.sip.DomainFactory;
import com.twilio.sdk.resource.factory.sip.IpAccessControlListFactory;
import com.twilio.sdk.resource.instance.sip.CredentialListInstance;
import com.twilio.sdk.resource.instance.sip.Domain;
import com.twilio.sdk.resource.instance.sip.IpAccessControlList;
import com.twilio.sdk.resource.list.AddressList;
import com.twilio.sdk.resource.list.ApplicationList;
import com.twilio.sdk.resource.list.AuthorizedConnectAppList;
import com.twilio.sdk.resource.list.AvailablePhoneNumberList;
import com.twilio.sdk.resource.list.CallList;
import com.twilio.sdk.resource.list.ConferenceList;
import com.twilio.sdk.resource.list.ConnectAppList;
import com.twilio.sdk.resource.list.IncomingPhoneNumberList;
import com.twilio.sdk.resource.list.KeyList;
import com.twilio.sdk.resource.list.MediaList;
import com.twilio.sdk.resource.list.MessageList;
import com.twilio.sdk.resource.list.NotificationList;
import com.twilio.sdk.resource.list.OutgoingCallerIdList;
import com.twilio.sdk.resource.list.QueueList;
import com.twilio.sdk.resource.list.RecordingList;
import com.twilio.sdk.resource.list.ShortCodeList;
import com.twilio.sdk.resource.list.SigningKeyList;
import com.twilio.sdk.resource.list.SmsList;
import com.twilio.sdk.resource.list.TokenList;
import com.twilio.sdk.resource.list.TranscriptionList;
import com.twilio.sdk.resource.list.UsageRecordList;
import com.twilio.sdk.resource.list.UsageRecordList.Type;
import com.twilio.sdk.resource.list.UsageTriggerList;
import com.twilio.sdk.resource.list.sip.CredentialListList;
import com.twilio.sdk.resource.list.sip.DomainList;
import com.twilio.sdk.resource.list.sip.IpAccessControlListList;
// TODO: Auto-generated Javadoc
/**
* The Class Account.
*
* For more information see https://www.twilio.com/docs/api/rest/account
*/
public class Account extends InstanceResource {
/** The Constant STATUS_PROPERTY. */
private static final String STATUS_PROPERTY = "status";
/** The Constant TYPE_PROPERTY. */
private static final String TYPE_PROPERTY = "type";
/** The Constant FRIENDLY_NAME_PROPERTY. */
private static final String FRIENDLY_NAME_PROPERTY = "friendly_name";
/** The Constant AUTH_TOKEN_PROPERTY. */
private static final String AUTH_TOKEN_PROPERTY = "auth_token";
/**
* Instantiates a new account.
*
* @param client the client
*/
public Account(TwilioRestClient client) {
super(client);
}
/**
* Instantiates a new account.
*
* @param client the client
* @param properties the properties
*/
public Account(TwilioRestClient client, Map properties) {
super(client, properties);
Object ac = properties.get(SID_PROPERTY);
if (ac != null && ac instanceof String) {
String accountSid = (String) ac;
this.setRequestAccountSid(accountSid);
}
}
/*
* Account Methods
*/
/**
* Gets the sid.
*
* @return the sid
*/
public String getSid() {
return this.getProperty(SID_PROPERTY);
}
/**
* Sets the sid.
*
* @param accountSid the new sid
*/
public void setSid(String accountSid) {
this.setRequestAccountSid(accountSid);
this.setProperty(SID_PROPERTY, accountSid);
}
/**
* Gets the auth token.
*
* @return the auth token
*/
public String getAuthToken() {
return this.getProperty(AUTH_TOKEN_PROPERTY);
}
/**
* Sets the auth token.
*
* @param authToken the new auth token
*/
public void setAuthToken(String authToken) {
this.setProperty(AUTH_TOKEN_PROPERTY, authToken);
}
/**
* Gets the friendly name.
*
* @return the friendly name
*/
public String getFriendlyName() {
return this.getProperty(FRIENDLY_NAME_PROPERTY);
}
/**
* Gets the status.
*
* @return the status
*/
public String getStatus() {
return this.getProperty(STATUS_PROPERTY);
}
/**
* Gets the account type
*
* @return the account type
*/
public String getType() {
return this.getProperty(TYPE_PROPERTY);
}
/**
* Gets the date created.
*
* @return the date created
*/
public Date getDateCreated() {
return getDateProperty(DATE_CREATED_PROPERTY);
}
/**
* Gets the date updated.
*
* @return the date updated
*/
public Date getDateUpdated() {
return getDateProperty(DATE_UPDATED_PROPERTY);
}
/*
* (non-Javadoc)
*
* @see com.twilio.sdk.resource.Resource#getResourceLocation()
*/
@Override
protected String getResourceLocation() {
return getResourceLocation(".json");
}
private String getResourceLocation(String extension) {
return "/" + TwilioRestClient.DEFAULT_VERSION + "/Accounts/" + this.getRequestAccountSid() + extension;
}
/*
* Subresource methods
*/
/**
* Gets the calls list resource without any filters.
*
* https://www.twilio.com/docs/api/rest/call
*
* @return the calls
*/
public CallList getCalls() {
return this.getCalls(new HashMap());
}
/**
* Gets the calls list resource with the given filters.
*
* https://www.twilio.com/docs/api/rest/call
*
* @param filters the filters
* @return the calls
*/
public CallList getCalls(Map filters) {
CallList calls = new CallList(this.getClient(), filters);
calls.setRequestAccountSid(this.getRequestAccountSid());
return calls;
}
/**
* Get a given call instance by sid
*
* @param sid The 34 character sid starting with CA
*/
public Call getCall(String sid) {
Call call = new Call(this.getClient(), sid);
call.setRequestAccountSid(this.getRequestAccountSid());
return call;
}
/**
* Gets the call factory, which lets you make outgoing calls.
*
* https://www.twilio.com/docs/api/rest/making_calls
*
* @return the call factory
*/
public CallFactory getCallFactory() {
return this.getCalls();
}
/**
* Gets the sms message list.
*
* https://www.twilio.com/docs/api/rest/sms
*
* @return the sms messages
*/
public SmsList getSmsMessages() {
return this.getSmsMessages(new HashMap());
}
/**
* Gets the sms messages list with the given filters
*
* https://www.twilio.com/docs/api/rest/sms
*
* @param filters the filters
* @return the sms messages
*/
public SmsList getSmsMessages(Map filters) {
SmsList sms = new SmsList(this.getClient(), filters);
sms.setRequestAccountSid(this.getRequestAccountSid());
return sms;
}
/**
* Get a given sms instance by sid
*
* @param sid The 34 character sid starting with SM
*/
public Sms getSms(String sid) {
Sms sms = new Sms(this.getClient(), sid);
sms.setRequestAccountSid(this.getRequestAccountSid());
return sms;
}
/**
* Gets the sms factory which lets you send sms messages
*
* https://www.twilio.com/docs/api/rest/sending-sms
*
* @return the sms factory
*/
public SmsFactory getSmsFactory() {
return this.getSmsMessages();
}
/**
* Gets the message list.
*
* https://www.twilio.com/docs/api/rest/messages
*
* @return the messages
*/
public MessageList getMessages() {
return this.getMessages(new HashMap());
}
/**
* Gets the messages list with the given filters
*
* https://www.twilio.com/docs/api/rest/messages
*
* @param filters the filters
* @return the messages
*/
public MessageList getMessages(Map filters) {
MessageList messages = new MessageList(this.getClient(), filters);
messages.setRequestAccountSid(this.getRequestAccountSid());
return messages;
}
/**
* Gets the message factory which lets you send messages
*
* https://www.twilio.com/docs/api/rest/sending-messages
*
* @return the message factory
*/
public MessageFactory getMessageFactory() {
return this.getMessages();
}
/**
* Get a given message instance by sid
*
* @param sid The 34 character sid starting with MM or SM
*/
public Message getMessage(String sid) {
Message message = new Message(this.getClient(), sid);
message.setRequestAccountSid(this.getRequestAccountSid());
return message;
}
/**
* Gets the media list.
*
* @return the media list
*/
public MediaList getMedia() {
return this.getMedia(new HashMap());
}
/**
* Gets the media list with the given filters.
*
* @return the media list
*/
public MediaList getMedia(Map filters) {
MediaList mediaList = new MediaList(this.getClient(), filters);
mediaList.setRequestAccountSid(this.getRequestAccountSid());
return mediaList;
}
/**
* Gets the media instance for this sid.
*
* @return the media
*/
public Media getMedia(String sid) {
Media media = new Media(this.getClient(), sid);
media.setRequestAccountSid(this.getRequestAccountSid());
return media;
}
/**
* Gets the application list
*
* https://www.twilio.com/docs/api/rest/applications
*
* @return the applications
*/
public ApplicationList getApplications() {
return this.getApplications(new HashMap());
}
/**
* Gets the application list with the given filters
*
* https://www.twilio.com/docs/api/rest/applications
*
* @param filters the filters
* @return the applications
*/
public ApplicationList getApplications(Map filters) {
ApplicationList list = new ApplicationList(this.getClient(), filters);
list.setRequestAccountSid(this.getRequestAccountSid());
return list;
}
/**
* Get a given application instance by sid
*
* @param sid The 34 character sid starting with AP
*/
public Application getApplication(String sid) {
Application app = new Application(this.getClient(), sid);
app.setRequestAccountSid(this.getRequestAccountSid());
return app;
}
/**
* Gets the application factory which lets you create new applications
*
* https://www.twilio.com/docs/api/rest/applications#list-post
*
* @return the application factory
*/
public ApplicationFactory getApplicationFactory() {
return this.getApplications();
}
/**
* Gets the available phone numbers. Defaults to US/Local
*
* See: https://www.twilio.com/docs/api/rest/available-phone-numbers
*
* @return the available phone numbers
*/
public AvailablePhoneNumberList getAvailablePhoneNumbers() {
return this.getAvailablePhoneNumbers(new HashMap());
}
/**
* Gets the available phone numbers. With the given search filters. Defaults to US/Local numbers
*
* See: https://www.twilio.com/docs/api/rest/available-phone-numbers
*
* @param filters the filters
* @return the available phone numbers
*/
public AvailablePhoneNumberList getAvailablePhoneNumbers(Map filters) {
AvailablePhoneNumberList list = new AvailablePhoneNumberList(this.getClient(), filters);
list.setRequestAccountSid(this.getRequestAccountSid());
return list;
}
/**
* Gets the available phone numbers with the given iso country and type
*
* See: https://www.twilio.com/docs/api/rest/available-phone-numbers
*
* @param filters the filters
* @param isoCountry the Iso Country code you are searching in
* @param type the type of phone number. Possible values are AvailablePhoneNumber.TYPE_LOCAL or
* AvailablePhoneNumber.TYPE_TOLLFREE
* @return the available phone numbers
*/
public AvailablePhoneNumberList getAvailablePhoneNumbers(Map filters, String isoCountry,
String type) {
AvailablePhoneNumberList list = new AvailablePhoneNumberList(this.getClient(), filters, isoCountry, type);
list.setRequestAccountSid(this.getRequestAccountSid());
return list;
}
/**
* Gets the conference list
*
* See: https://www.twilio.com/docs/api/rest/conference
*
* @return the conferences
*/
public ConferenceList getConferences() {
return this.getConferences(new HashMap());
}
/**
* Gets the conferences list with the given filters
*
* See: https://www.twilio.com/docs/api/rest/conference
*
* @param filters the filters
* @return the conferences
*/
public ConferenceList getConferences(Map filters) {
ConferenceList list = new ConferenceList(this.getClient(), filters);
list.setRequestAccountSid(this.getRequestAccountSid());
return list;
}
/**
* Get a given conference instance by sid
*
* @param sid The 34 character sid starting with CF
*/
public Conference getConference(String sid) {
Conference conf = new Conference(this.getClient(), sid);
conf.setRequestAccountSid(this.getRequestAccountSid());
return conf;
}
/**
* Gets the queue list
*
* See: https://www.twilio.com/docs/api/rest/queue
*
* @return the {@link QueueList}
*/
public QueueList getQueues() {
QueueList list = new QueueList(this.getClient(), filters);
list.setRequestAccountSid(this.getRequestAccountSid());
return list;
}
/**
* Get a given queue by sid
*
* @param sid The Sid starting with QU
* @return the queue object
*/
public Queue getQueue(String sid) {
Queue queue = new Queue(this.getClient(), sid);
queue.setRequestAccountSid(this.getRequestAccountSid());
return queue;
}
/**
* Get the queue factory
*/
public QueueFactory getQueueFactory() {
return this.getQueues();
}
/**
* Gets the incoming phone numbers list
*
* See: https://www.twilio.com/docs/api/rest/incoming-phone-numbers
*
* @return the incoming phone numbers
*/
public IncomingPhoneNumberList getIncomingPhoneNumbers() {
return this.getIncomingPhoneNumbers(new HashMap());
}
/**
* Gets the incoming phone numbers list with the given filters
*
* See: https://www.twilio.com/docs/api/rest/incoming-phone-numbers
*
* @param filters the filters
* @return the incoming phone numbers
*/
public IncomingPhoneNumberList getIncomingPhoneNumbers(Map filters) {
IncomingPhoneNumberList list = new IncomingPhoneNumberList(this.getClient(), filters);
list.setRequestAccountSid(this.getRequestAccountSid());
return list;
}
/**
* Get a given incoming phone number instance by sid
*
* @param sid The 34 character sid starting with PN
*/
public IncomingPhoneNumber getIncomingPhoneNumber(String sid) {
IncomingPhoneNumber pn = new IncomingPhoneNumber(this.getClient(), sid);
pn.setRequestAccountSid(this.getRequestAccountSid());
return pn;
}
/**
* Gets the incoming phone number factory.
*
* See: https://www.twilio.com/docs/api/rest/incoming-phone-numbers#list-post
*
* @return the incoming phone number factory
*/
public IncomingPhoneNumberFactory getIncomingPhoneNumberFactory() {
return this.getIncomingPhoneNumbers();
}
public AddressList getAddresses(Map filters) {
AddressList list = new AddressList(this.getClient(), filters);
list.setRequestAccountSid(this.getRequestAccountSid());
return list;
}
public AddressList getAddresses() {
return this.getAddresses(new HashMap());
}
public AddressFactory getAddressFactory() {
return this.getAddresses();
}
public Address getAddress(String sid) {
Address address = new Address(this.getClient(), sid);
address.setRequestAccountSid(this.getRequestAccountSid());
return address;
}
/**
* Gets the shortcode list.
*
* @return the short code list
*/
public ShortCodeList getShortCodes() {
return this.getShortCodes(new HashMap());
}
/**
* Gets the short code list with filters
*
* @param filters the filters
* @return the short code list
*/
public ShortCodeList getShortCodes(Map filters) {
ShortCodeList list = new ShortCodeList(this.getClient(), filters);
list.setRequestAccountSid(this.getRequestAccountSid());
return list;
}
/**
* Get a given short code instance by sid
*
* @param sid The 34 character sid starting with SC
*/
public ShortCode getShortCode(String sid) {
ShortCode sc = new ShortCode(this.getClient(), sid);
sc.setRequestAccountSid(this.getRequestAccountSid());
return sc;
}
/**
* Get a signing key instance by sid.
*
* @param sid
* @return the signing key
*/
public SigningKey getSigningKey(final String sid) {
SigningKey signingKey = new SigningKey(getClient(), sid);
signingKey.setRequestAccountSid(getRequestAccountSid());
return signingKey;
}
/**
* Gets a Signing key factory.
*
* @return a Signing key factory
*/
public SigningKeyFactory getSigningKeyFactory() {
SigningKeyList list = new SigningKeyList(getClient());
list.setRequestAccountSid(getRequestAccountSid());
return list;
}
/**
* Get a auth key instance by sid
*
* @param sid sid of auth key
* @return the auth key
*/
public Key getKey(final String sid) {
Key key = new Key(getClient(), sid);
key.setRequestAccountSid(getRequestAccountSid());
return key;
}
/**
* Get a auth key factory
*
* @return a auth key factory
*/
public KeyList getKeys() {
return this.getKeys(null);
}
/**
* Get a auth key factory
*
* @param filters the set of filters
* @return a auth key factory
*/
public KeyList getKeys(Map filters) {
KeyList list = new KeyList(getClient(), filters);
list.setRequestAccountSid(getRequestAccountSid());
return list;
}
/**
* Gets the notifications.
*
* @return the notifications
*/
public NotificationList getNotifications() {
return this.getNotifications(new HashMap());
}
/**
* Gets the notifications.
*
* @param filters the filters
* @return the notifications
*/
public NotificationList getNotifications(Map filters) {
NotificationList list = new NotificationList(this.getClient(), filters);
list.setRequestAccountSid(this.getRequestAccountSid());
return list;
}
/**
* Get a given notification instance by sid
*
* @param sid The 34 character sid starting with NO
*/
public Notification getNotification(String sid) {
Notification n = new Notification(this.getClient(), sid);
n.setRequestAccountSid(this.getRequestAccountSid());
return n;
}
/**
* Gets the outgoing caller ids.
*
* https://www.twilio.com/docs/api/rest/outgoing-caller-ids
*
* @return the outgoing caller ids
*/
public OutgoingCallerIdList getOutgoingCallerIds() {
return this.getOutgoingCallerIds(new HashMap());
}
/**
* Gets the outgoing caller ids.
*
* https://www.twilio.com/docs/api/rest/outgoing-caller-ids
*
* @param filters the filters
* @return the outgoing caller ids
*/
public OutgoingCallerIdList getOutgoingCallerIds(Map filters) {
OutgoingCallerIdList list = new OutgoingCallerIdList(this.getClient(), filters);
list.setRequestAccountSid(this.getRequestAccountSid());
return list;
}
/**
* Get a given outgoing caller id instance by sid
*
* @param sid The 34 character sid starting with PN
*/
public OutgoingCallerId getOutgoingCallerId(String sid) {
OutgoingCallerId number = new OutgoingCallerId(this.getClient(), sid);
number.setRequestAccountSid(this.getRequestAccountSid());
return number;
}
/**
* Gets the outgoing caller id factory which lets you create outgoing caller ids
*
* https://www.twilio.com/docs/api/rest/outgoing-caller-ids
*
* @return the outgoing caller id factory
*/
public OutgoingCallerIdFactory getOutgoingCallerIdFactory() {
return this.getOutgoingCallerIds();
}
/**
* Gets the recordings list
*
* https://www.twilio.com/docs/api/rest/recording
*
* @return the recordings
*/
public RecordingList getRecordings() {
return this.getRecordings(new HashMap());
}
/**
* Gets the recordings list
*
* https://www.twilio.com/docs/api/rest/recording
*
* @param filters the filters
* @return the recordings
*/
public RecordingList getRecordings(Map filters) {
RecordingList list = new RecordingList(this.getClient(), filters);
list.setRequestAccountSid(this.getRequestAccountSid());
return list;
}
/**
* Get a given recording instance by sid
*
* @param sid The 34 character sid starting with RE
*/
public Recording getRecording(String sid) {
Recording r = new Recording(this.getClient(), sid);
r.setRequestAccountSid(this.getRequestAccountSid());
return r;
}
/**
* Gets the transcriptions list
*
* https://www.twilio.com/docs/api/rest/transcription
*
* @return the transcriptions
*/
public TranscriptionList getTranscriptions() {
return this.getTranscriptions(new HashMap());
}
/**
* Gets the transcriptions list with the given filters
*
* https://www.twilio.com/docs/api/rest/transcription
*
* @param filters the filters
* @return the transcriptions
*/
public TranscriptionList getTranscriptions(Map filters) {
TranscriptionList list = new TranscriptionList(this.getClient(), filters);
list.setRequestAccountSid(this.getRequestAccountSid());
return list;
}
/**
* Get a given transcription instance by sid
*
* @param sid The 34 character sid starting with TR
*/
public Transcription getTranscription(String sid) {
Transcription tr = new Transcription(this.getClient(), sid);
tr.setRequestAccountSid(this.getRequestAccountSid());
return tr;
}
/**
* Gets the Usage Record list with the given filters
*
* https://www.twilio.com/docs/api/rest/usage-records
*
* @param filters the filters
* @return the usage records
*/
public UsageRecordList getUsageRecords(Map filters) {
UsageRecordList list = new UsageRecordList(this.getClient(), filters);
list.setRequestAccountSid(this.getRequestAccountSid());
return list;
}
/**
* Gets the Usage Record list
*
* https://www.twilio.com/docs/api/rest/usage-records
*
* @return the usage records
*/
public UsageRecordList getUsageRecords() {
return this.getUsageRecords(new HashMap());
}
/**
* Returns Usage Records for each usage category for a specified interval
* type. Possible types are:
*
* - Daily - Multiple usage record per category over a daily time-interval
*
- Monthly - Multiple usage record per category over a monthly
* time-interval
*
- Yearly - Multiple usage record per category over a yearly
* time-interval
*
- AllTime - Single usage record per category
*
- Today - Single usage record per category for today's usage only
*
- Yesterday - Single usage record per category for yesterday's usage
* only
*
- ThisMonth - Single usage record per category for this month's usage
* only
*
- LastMonth - Single usage record per category for last month's usage
* only
*
*
* @param type
* the interval enum type
* @return list of Usage Records over an interval type
*/
public UsageRecordList getUsageRecords(Type type) {
return getUsageRecords(new HashMap(), type);
}
/**
* Returns filtered Usage Records for each usage category for a specified
* interval type. Possible types are:
*
* - Daily - Multiple usage record per category over a daily time-interval
*
- Monthly - Multiple usage record per category over a monthly
* time-interval
*
- Yearly - Multiple usage record per category over a yearly
* time-interval
*
- AllTime - Single usage record per category
*
- Today - Single usage record per category for today's usage only
*
- Yesterday - Single usage record per category for yesterday's usage
* only
*
- ThisMonth - Single usage record per category for this month's usage
* only
*
- LastMonth - Single usage record per category for last month's usage
* only
*
*
* @param filters
* One or more combination of Category, StartDate or EndDate
* filtering parameters
* @param type
* the interval enum type
* @return list of Usage Records over a daily time-interval
*/
public UsageRecordList getUsageRecords(Map filters, Type type) {
UsageRecordList list = new UsageRecordList(this.getClient(), filters, type);
list.setRequestAccountSid(this.getRequestAccountSid());
return list;
}
/**
* Get a specific Usage Trigger
*/
public UsageTrigger getUsageTrigger(String sid) {
UsageTrigger trigger = new UsageTrigger(this.getClient(), sid);
trigger.setRequestAccountSid(this.getRequestAccountSid());
return trigger;
}
/**
* Gets the Usage Trigger factory which lets you create usage triggers
*
* @return the usage trigger factory
*/
public UsageTriggerFactory getUsageTriggerFactory() {
return this.getUsageTriggers();
}
/**
* Gets the Usage Triggers list with the given filters
*
* https://www.twilio.com/docs/api/rest/usage-triggers
*
* @param filters the filters
* @return the usage records
*/
public UsageTriggerList getUsageTriggers(Map filters) {
UsageTriggerList list = new UsageTriggerList(this.getClient(), filters);
list.setRequestAccountSid(this.getRequestAccountSid());
return list;
}
/**
* Gets the Usage Triggers list
*
* https://www.twilio.com/docs/api/rest/usage-triggers
*
* @return the usage triggers
*/
public UsageTriggerList getUsageTriggers() {
return this.getUsageTriggers(new HashMap());
}
/**
* Gets the connect app list
*
* https://www.twilio.com/docs/api/rest/connect-apps
*
* @return the connect app list
*/
public ConnectAppList getConnectApps() {
return this.getConnectApps(new HashMap());
}
/**
* Gets the connect app list with the given filters
*
* https://www.twilio.com/docs/api/rest/connect-apps
*
* @param filters the filters
* @return the connect app list
*/
public ConnectAppList getConnectApps(Map filters) {
ConnectAppList list = new ConnectAppList(this.getClient(), filters);
list.setRequestAccountSid(this.getRequestAccountSid());
return list;
}
/**
* Get a given connect app instance by sid
*
* @param sid The 34 character sid starting with CN
* @return the connect app
*/
public ConnectApp getConnectApp(String sid) {
ConnectApp cn = new ConnectApp(this.getClient(), sid);
cn.setRequestAccountSid(this.getRequestAccountSid());
return cn;
}
/**
* Gets the authorized connect app list
*
* https://www.twilio.com/docs/api/rest/authorized-connect-apps
*
* @return the connect app list
*/
public AuthorizedConnectAppList getAuthorizedConnectApps() {
return this.getAuthorizedConnectApps(new HashMap());
}
/**
* Gets the authorized connect app list with the given filters
*
* https://www.twilio.com/docs/api/rest/authorized-connect-apps
*
* @param filters the filters
* @return the connect app list
*/
public AuthorizedConnectAppList getAuthorizedConnectApps(Map filters) {
AuthorizedConnectAppList list = new AuthorizedConnectAppList(this.getClient(), filters);
list.setRequestAccountSid(this.getRequestAccountSid());
return list;
}
/**
* Get a given connect app instance by sid
*
* @param sid The 34 character sid starting with CN
* @return the connect app
*/
public AuthorizedConnectApp getAuthorizedConnectApp(String sid) {
AuthorizedConnectApp cn = new AuthorizedConnectApp(this.getClient(), sid);
cn.setRequestAccountSid(this.getRequestAccountSid());
return cn;
}
/**
* Gets the sip domains list.
*
* https://www.twilio.com/docs/api/rest/sip-domains
*
* @return the sip domain
*/
public DomainList getDomains() {
return this.getDomains(new HashMap());
}
/**
* Gets the domain list with the given filters
*
* https://www.twilio.com/docs/api/rest/sip-domains
*
* @param filters the filters
* @return the sip domain list
*/
public DomainList getDomains(Map filters) {
DomainList list = new DomainList(this.getClient(), filters);
list.setRequestAccountSid(this.getRequestAccountSid());
return list;
}
/**
* Get a given sip domain instance by sid
*
* @param sid The 34 character sid starting with SD
* @return the sip domain
*/
public Domain getDomain(String sid) {
Domain domain = new Domain(this.getClient(), sid);
domain.setRequestAccountSid(this.getRequestAccountSid());
return domain;
}
/**
* Gets a DomainFactory
*
* @return a DomainFactory that lets you create new Domains
*/
public DomainFactory getDomainFactory() {
return this.getDomains();
}
/**
* Gets the sip IpAccessControlLists list.
*
* https://www.twilio.com/docs/api/rest/sip-ip-access-control-lists
*
* @return the sip IpAccessControlList
*/
public IpAccessControlListList getIpAccessControlLists() {
return this.getIpAccessControlLists(new HashMap());
}
/**
* Gets the IpAccessControlList list with the given filters
*
* https://www.twilio.com/docs/api/rest/sip-ip-access-control-lists
*
* @param filters the filters
* @return the sip IpAccessControlList list
*/
public IpAccessControlListList getIpAccessControlLists(Map filters) {
IpAccessControlListList list = new IpAccessControlListList(this.getClient(), filters);
list.setRequestAccountSid(this.getRequestAccountSid());
return list;
}
/**
* Get a given IpAccessControlList instance by sid
*
* @param sid The 34 character sid starting with AL
* @return the sip IpAccessControlList
*/
public IpAccessControlList getIpAccessControlList(String sid) {
IpAccessControlList ipAccessControlList = new IpAccessControlList(this.getClient(), sid);
ipAccessControlList.setRequestAccountSid(this.getRequestAccountSid());
return ipAccessControlList;
}
/**
* Gets an IpAccessControlListFactory
*
* @return an IpAccessControlListFactory that lets you create new IpAccessControlLists
*/
public IpAccessControlListFactory getIpAccessControlListFactory() {
return this.getIpAccessControlLists();
}
/**
* Gets the sip CredentialLists list.
*
* https://www.twilio.com/docs/api/rest/sip-credential-lists
*
* @return the sip CredentialList
*/
public CredentialListList getCredentialLists() {
return this.getCredentialLists(new HashMap());
}
/**
* Gets the CredentialList list with the given filters
*
* https://www.twilio.com/docs/api/rest/sip-credential-lists
*
* @param filters the filters
* @return the sip CredentialList list
*/
public CredentialListList getCredentialLists(Map filters) {
CredentialListList list = new CredentialListList(this.getClient(), filters);
list.setRequestAccountSid(this.getRequestAccountSid());
return list;
}
/**
* Get a given CredentialList instance by sid
*
* @param sid The 34 character sid starting with AL
* @return the sip CredentialList
*/
public CredentialListInstance getCredentialList(String sid) {
CredentialListInstance credentialList = new CredentialListInstance(this.getClient(), sid);
credentialList.setRequestAccountSid(this.getRequestAccountSid());
return credentialList;
}
/**
* Gets a CredentialListFactory
*
* @return the CredentialListFactory that lets you make new CredentialLists
*/
public CredentialListFactory getCredentialListFactory() {
return this.getCredentialLists();
}
/**
* Get the developer sandbox
*
* https://www.twilio.com/docs/api/rest/sandbox
*
* @return the sandbox
*/
public Sandbox getSandbox() {
Sandbox sb = new Sandbox(this.getClient());
sb.setRequestAccountSid(this.getRequestAccountSid());
return sb;
}
/**
* Close this subaccount. This will release all phone numbers assigned to it and shut it down completely. You will
* still have access to historical data for that subaccount, but you cannot reopen a closed account.
*
* @return true, if successful
* @throws TwilioRestException if there is an error in the request
*/
public boolean close() throws TwilioRestException {
Map vars = new HashMap();
vars.put("Status", "closed");
TwilioRestResponse response = this.getClient().safeRequest(this.getResourceLocation(), "POST", vars);
return !response.isError();
}
/**
* Creates a call feedback summary for this account's calls.
*
* @param filters the filters
* @return the call feedback summary
* @throws TwilioRestException the twilio rest exception
*/
public FeedbackSummary createFeedbackSummary(final Map filters) throws TwilioRestException {
TwilioRestResponse response = getClient()
.safeRequest(getResourceLocation("") + "/Calls/FeedbackSummary.json", "POST", filters);
return new FeedbackSummary(getClient(), response.toMap());
}
/**
* Deletes a call feedback summary for this account's calls.
*
* @param sid the summary sid
* @throws TwilioRestException the twilio rest exception
*/
public void deleteFeedbackSummary(final String sid) throws TwilioRestException {
getClient()
.safeRequest(getResourceLocation("") + "/Calls/FeedbackSummary/" + sid + ".json", "DELETE", (Map) null);
}
/**
* Gets a call feedback summary for this account's calls.
*
* @param sid the summary sid
* @return the call feedback summary
* @throws TwilioRestException the twilio rest exception
*/
public FeedbackSummary getFeedbackSummary(final String sid) throws TwilioRestException {
TwilioRestResponse response = getClient()
.safeRequest(getResourceLocation("") + "/Calls/FeedbackSummary/" + sid + ".json", "GET", (Map) null);
return new FeedbackSummary(getClient(), response.toMap());
}
/**
* Gets the factory for creating new tokens.
*
* https://www.twilio.com/docs/api/rest/tokens
*
* @return the token factory
*/
public TokenList getTokenFactory() {
TokenList tokens = new TokenList(this.getClient());
tokens.setRequestAccountSid(this.getRequestAccountSid());
return tokens;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy