com.twilio.sdk.resource.list.KeyList 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.resource.ListResource;
import com.twilio.sdk.resource.factory.ResourceFactory;
import com.twilio.sdk.resource.instance.Key;
import org.apache.http.NameValuePair;
import java.util.List;
import java.util.Map;
/**
* List resource representation for a Auth Key
*/
public class KeyList extends ListResource implements ResourceFactory {
/**
* Instantiates a new key list.
*
* @param client Twilio client
*/
public KeyList(final TwilioRestClient client) {
this(client, null);
}
/**
* Instantiates a new key list.
*
* @param client Twilio client
* @param filters request filters
*/
public KeyList(final TwilioRestClient client, final Map filters) {
super(client, filters);
}
@Override
protected Key makeNew(TwilioRestClient client, Map params) {
return new Key(client, params);
}
@Override
protected String getListKey() {
return "keys";
}
@Override
protected String getResourceLocation() {
return "/" + TwilioRestClient.DEFAULT_VERSION + "/Accounts/" + getRequestAccountSid() + "/Keys.json";
}
@Override
public Key create(Map params) throws TwilioRestException {
return makeNew(getClient(), getClient().safeRequest(getResourceLocation(), "POST", params).toMap());
}
@Override
public Key create(List params) throws TwilioRestException {
return makeNew(getClient(), getClient().safeRequest(getResourceLocation(), "POST", params).toMap());
}
}