com.twilio.sdk.resource.instance
Class Queue

java.lang.Object
  extended by com.twilio.sdk.resource.Resource
      extended by com.twilio.sdk.resource.InstanceResource
          extended by com.twilio.sdk.resource.instance.Queue

public class Queue
extends InstanceResource

The Queue represents a queue resource.

Author:
Christer Fahlgren

Constructor Summary
Queue(TwilioRestClient client, Map<String,Object> params)
          Creates a Queue instance.
Queue(TwilioRestClient client, String sid)
          Creates a Queue instance.
 
Method Summary
 Member dequeueHeadOfQueue(String url, String method)
          Dequeue the head of the Queue, returning the Member or null if the Queue is empty.
 int getAverageWaitTime()
          Returns the average wait time in the Queue
 int getCurrentSize()
          Retrieves the current size of the Queue
 String getFriendlyName()
          Retrieves the friendly name of this Queue.
 int getMaxSize()
          Returns the max size of the Queue
 Member getMember(String callSid)
          Return a single Member instance
 MemberList getMembers()
          Retrieves the MemberList for this Queue
 String getSid()
          Retrieves the queue sid of this Queue
 void setFriendlyName(String friendlyName)
          Sets the friendly name of this Queue.
 void setMaxSize(int maxSize)
          Sets the max size of this Queue.
 
Methods inherited from class com.twilio.sdk.resource.InstanceResource
getObject, getProperty, update, update
 
Methods inherited from class com.twilio.sdk.resource.Resource
setRequestAccountSid
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Queue

public Queue(TwilioRestClient client,
             String sid)
Creates a Queue instance.

Parameters:
client - the TwilioRestClient to use
sid - the queue sid

Queue

public Queue(TwilioRestClient client,
             Map<String,Object> params)
Creates a Queue instance.

Parameters:
client - the TwilioRestClient to use
params - the map of properties to read from
Method Detail

getSid

public String getSid()
Retrieves the queue sid of this Queue

Returns:
the queue sid

getFriendlyName

public String getFriendlyName()
Retrieves the friendly name of this Queue.

Returns:
the friendly name

getCurrentSize

public int getCurrentSize()
Retrieves the current size of the Queue

Returns:
the current size
Throws:
IllegalStateException - if the current size is not set

getMaxSize

public int getMaxSize()
Returns the max size of the Queue

Returns:
the max size of the Queue

getAverageWaitTime

public int getAverageWaitTime()
Returns the average wait time in the Queue

Returns:
the average wait time

getMembers

public MemberList getMembers()
Retrieves the MemberList for this Queue

Returns:
the MemberList

getMember

public Member getMember(String callSid)
Return a single Member instance


dequeueHeadOfQueue

public Member dequeueHeadOfQueue(String url,
                                 String method)
                          throws TwilioRestException
Dequeue the head of the Queue, returning the Member or null if the Queue is empty. Control is transferred to the url and method passed in.

Parameters:
url - the url to transfer control to
method - the method to use.
Returns:
the queue member
Throws:
TwilioRestException

setFriendlyName

public void setFriendlyName(String friendlyName)
                     throws TwilioRestException
Sets the friendly name of this Queue.

Parameters:
friendlyName - the new friendly name
Throws:
TwilioRestException - if setting the friendly name fails

setMaxSize

public void setMaxSize(int maxSize)
                throws TwilioRestException
Sets the max size of this Queue.

Parameters:
maxSize - the new max size of the queue
Throws:
TwilioRestException - if setting the max size fails


Copyright © 2011 Twilio, Inc. All Rights Reserved.