com.twilio.sdk.resource.list.AccountList Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of twilio-java-sdk Show documentation
Show all versions of twilio-java-sdk Show documentation
Release Candidate for Next-Gen Twilio Java Helper Library
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.AccountFactory;
import com.twilio.sdk.resource.instance.Account;
import org.apache.http.NameValuePair;
import java.util.List;
import java.util.Map;
// TODO: Auto-generated Javadoc
/**
* The Class AccountList.
*
* For more information see https://www.twilio.com/docs/api/rest/account
*/
public class AccountList extends ListResource implements AccountFactory {
/**
* Instantiate a new AccountList
*/
public AccountList(TwilioRestClient client) {
super(client);
}
/**
* Instantiates a new account list with the given filters.
*
* @param client the client
* @param filters the filters
*/
public AccountList(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.json";
}
/* (non-Javadoc)
* @see com.twilio.sdk.resource.ListResource#makeNew(com.twilio.sdk.TwilioRestClient, java.util.Map)
*/
@Override
protected Account makeNew(TwilioRestClient client,
Map params) {
return new Account(client, params);
}
/* (non-Javadoc)
* @see com.twilio.sdk.resource.ListResource#getListKey()
*/
@Override
protected String getListKey() {
return "accounts";
}
/* (non-Javadoc)
* @see com.twilio.sdk.resource.factory.AccountFactory#create(java.util.Map)
*/
public Account 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.AccountFactory#create(java.util.Map)
*/
public Account create(List params) throws TwilioRestException {
TwilioRestResponse response = this.getClient().safeRequest(
this.getResourceLocation(), "POST", params);
return makeNew(this.getClient(), response.toMap());
}
}