com.twilio.sdk.resource.list.taskrouter.TaskQueueList 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.taskrouter;
import com.twilio.sdk.TwilioRestException;
import com.twilio.sdk.TwilioRestResponse;
import com.twilio.sdk.TwilioTaskRouterClient;
import com.twilio.sdk.resource.NextGenListResource;
import com.twilio.sdk.resource.factory.taskrouter.TaskQueueFactory;
import com.twilio.sdk.resource.instance.taskrouter.TaskQueue;
import org.apache.http.NameValuePair;
import java.util.List;
import java.util.Map;
/**
* TaskQueueList to work with {@link com.twilio.sdk.resource.instance.taskrouter.TaskQueue}.
*/
public class TaskQueueList extends NextGenListResource implements TaskQueueFactory {
private String workspaceSid;
/**
* Instantiates a queue list.
*
* @param client the client
* @param workspaceSid the workspace sid
*/
public TaskQueueList(final TwilioTaskRouterClient client, final String workspaceSid) {
super(client);
this.workspaceSid = workspaceSid;
}
/**
* Instantiates a queue list.
*
* @param client the client
* @param filters the filters
* @param workspaceSid the workspace sid
*/
public TaskQueueList(final TwilioTaskRouterClient client, final String workspaceSid,
final Map filters) {
super(client, filters);
this.workspaceSid = workspaceSid;
}
@Override
public TaskQueue create(final Map params) throws TwilioRestException {
TwilioRestResponse response = getClient().safeRequest(getResourceLocation(), "POST", params);
return makeNew(getClient(), response.toMap());
}
@Override
public TaskQueue create(final List params) throws TwilioRestException {
TwilioRestResponse response = getClient().safeRequest(getResourceLocation(), "POST", params);
return makeNew(getClient(), response.toMap());
}
@Override
protected TaskQueue makeNew(final TwilioTaskRouterClient client, final Map params) {
return new TaskQueue(client, params);
}
@Override
protected String getResourceLocation() {
return "/" + TwilioTaskRouterClient.DEFAULT_VERSION + "/Workspaces/" + workspaceSid + "/TaskQueues";
}
}