Class: Workspace

Workspace

Create a Workspace client representing a TaskRouter Workspace


new Twilio.TaskRouter.Workspace(jwt [, options], workspaceSid)

Parameters:
Name Type Argument Description
jwt string

The string token

options Workspace.Options <optional>
workspaceSid string

Sid of this Workspace, has to be provided if JWE token is passed

Throws:

Exception if workspaceSid is not passed with JWE token

Methods


fetchTaskQueue(queueSid)

Fetch task queue of this Workspace by given sid

Parameters:
Name Type Description
queueSid string

the sid of the task queue to fetch

Returns:
  • A task queue with given sid
Type
Promise.<TaskQueue>

fetchTaskQueues( [options])

Fetch task queues of this Workspace

Parameters:
Name Type Argument Description
options Workspace.FetchTaskQueuesParams <optional>
Returns:
  • A map with the task queues
Type
Promise.<Map.<string, TaskQueue>>

fetchWorker(workerSid)

Fetch worker of this Workspace by given sid

Parameters:
Name Type Description
workerSid string

the sid of the worker to fetch

Returns:
  • A worker with given sid
Type
Promise.<Worker>

fetchWorkers( [options])

Fetch workers of this Workspace

Parameters:
Name Type Argument Description
options Workspace.FetchWorkersParams <optional>
Returns:
  • A map with the workers
Type
Promise.<Map.<string, Worker>>

updateToken(newToken)

Update token

Parameters:
Name Type Description
newToken string

The new token that should be used for authentication

Returns:
  • throws error if unable to update token
Type
void

Type Definitions


FetchTaskQueuesParams

Type:
  • Object
Properties:
Name Type Argument Default Description
AfterSid string <optional>
null
FriendlyName string <optional>
null
Ordering string <optional>
null

FetchWorkersParams

Type:
  • Object
Properties:
Name Type Argument Default Description
AfterSid string <optional>
null
FriendlyName string <optional>
null
ActivitySid string <optional>
null
ActivityName string <optional>
null
Ordering string <optional>
null
TargetWorkersExpression string <optional>
null
maxWorkers number <optional>
null

Options

Type:
  • Object
Properties:
Name Type Argument Default Description
region string

the realm for connections (ex. "stage-us1")

edge string

the ingress for connections (ex. "sydney")

pageSize string

The number of items returned in each request

logLevel string <optional>
'error'

The level of logging to enable ['error', 'warn', 'info', 'debug', 'trace', 'silent']