com.twilio.sdk.taskrouter
Class TaskRouterCapability

java.lang.Object
  extended by com.twilio.sdk.CapabilityToken
      extended by com.twilio.sdk.taskrouter.TaskRouterCapability

public class TaskRouterCapability
extends CapabilityToken


Nested Class Summary
 class TaskRouterCapability.Policy
           
 
Nested classes/interfaces inherited from class com.twilio.sdk.CapabilityToken
CapabilityToken.DomainException
 
Constructor Summary
TaskRouterCapability(String accountSid, String authToken, String workspaceSid, String workerSid)
          Create a new Capability object to authorize worker clients to interact with the TaskRouter service.
 
Method Summary
 TaskRouterCapability addPolicy(TaskRouterCapability.Policy policy)
          Add a new Policy allowing or denying specific resource actions to this Capability set.
 TaskRouterCapability allowTaskReservationUpdates()
          Allow a worker to update task reservation status
 TaskRouterCapability allowWorkerActivityUpdates()
          Allow a worker to update its own activity status
 TaskRouterCapability allowWorkerFetchAttributes()
          Allow a worker to read its own attributes.
 String generateToken()
           
 String generateToken(long ttl)
          Generate a capability token with the currently-configured policies on this object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TaskRouterCapability

public TaskRouterCapability(String accountSid,
                            String authToken,
                            String workspaceSid,
                            String workerSid)
Create a new Capability object to authorize worker clients to interact with the TaskRouter service.

Parameters:
accountSid - Account to authorize actions for
authToken - Auth token for the account. Used to sign tokens and will not be included in the generated tokens.
workspaceSid - Workspace to authorize tokens for.
workerSid - Worker to create tokens for.
Method Detail

allowWorkerActivityUpdates

public TaskRouterCapability allowWorkerActivityUpdates()
Allow a worker to update its own activity status

Returns:
The updated Capability representation

allowWorkerFetchAttributes

public TaskRouterCapability allowWorkerFetchAttributes()
Allow a worker to read its own attributes.

Returns:
The updated Capability representation

allowTaskReservationUpdates

public TaskRouterCapability allowTaskReservationUpdates()
Allow a worker to update task reservation status

Returns:
The updated Capability representation

addPolicy

public TaskRouterCapability addPolicy(TaskRouterCapability.Policy policy)
Add a new Policy allowing or denying specific resource actions to this Capability set.

Parameters:
policy - Configured Policy object
Returns:
The updated Capability representation

generateToken

public String generateToken()
                     throws CapabilityToken.DomainException
Throws:
CapabilityToken.DomainException

generateToken

public String generateToken(long ttl)
                     throws CapabilityToken.DomainException
Generate a capability token with the currently-configured policies on this object.

Parameters:
ttl - Expiration time in seconds
Returns:
JSON Web Token representing authorized capabilities
Throws:
DomainException
CapabilityToken.DomainException


Copyright © 2011 Twilio, Inc. All Rights Reserved.