com.twilio.sdk.resource.list.ApplicationList Maven / Gradle / Ivy
package com.twilio.sdk.resource.list;
import com.twilio.sdk.TwilioRestClient;
import com.twilio.sdk.TwilioRestException;
import com.twilio.sdk.TwilioRestResponse;
import com.twilio.sdk.resource.ListResource;
import com.twilio.sdk.resource.factory.ApplicationFactory;
import com.twilio.sdk.resource.instance.Application;
import org.apache.http.NameValuePair;
import java.util.List;
import java.util.Map;
// TODO: Auto-generated Javadoc
/**
* The Class ApplicationList.
*
* For more information see https://www.twilio.com/docs/api/rest/applications
*/
public class ApplicationList extends ListResource implements
ApplicationFactory {
/**
* Instantiates a new application list.
*
* @param client the client
*/
public ApplicationList(TwilioRestClient client) {
super(client);
}
/**
* Instantiates a new application list.
*
* @param client the client
* @param filters the filters
*/
public ApplicationList(TwilioRestClient client, Map filters) {
super(client, filters);
}
/* (non-Javadoc)
* @see com.twilio.sdk.resource.Resource#getResourceLocation()
*/
@Override
protected String getResourceLocation() {
return "/" + TwilioRestClient.DEFAULT_VERSION + "/Accounts/"
+ this.getRequestAccountSid() + "/Applications.json";
}
/* (non-Javadoc)
* @see com.twilio.sdk.resource.ListResource#makeNew(com.twilio.sdk.TwilioRestClient, java.util.Map)
*/
@Override
protected Application makeNew(TwilioRestClient client,
Map params) {
return new Application(client, params);
}
/* (non-Javadoc)
* @see com.twilio.sdk.resource.ListResource#getListKey()
*/
@Override
protected String getListKey() {
return "applications";
}
/* (non-Javadoc)
* @see com.twilio.sdk.resource.factory.ApplicationFactory#create(java.util.Map)
*/
public Application create(Map params) throws TwilioRestException {
TwilioRestResponse response = this.getClient().safeRequest(
this.getResourceLocation(), "POST", params);
return makeNew(this.getClient(), response.toMap());
}
/* (non-Javadoc)
* @see com.twilio.sdk.resource.factory.ApplicationFactory#create(java.util.Map)
*/
public Application create(List params) throws TwilioRestException {
TwilioRestResponse response = this.getClient().safeRequest(
this.getResourceLocation(), "POST", params);
return makeNew(this.getClient(), response.toMap());
}
}