-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
- Loading branch information
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,317 @@ | ||
<!DOCTYPE html><html lang="en"><head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width"> | ||
<title>Documentation Index</title> | ||
|
||
<!--[if lt IE 9]> | ||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> | ||
<![endif]--> | ||
<link type="text/css" rel="stylesheet" href="styles/sunlight.default.css"> | ||
|
||
<link type="text/css" rel="stylesheet" href="styles/site.simplex.css"> | ||
|
||
</head> | ||
|
||
<body> | ||
|
||
<div class="navbar navbar-default navbar-fixed-top "> | ||
<div class="container"> | ||
<div class="navbar-header"> | ||
<a class="navbar-brand" href="index.html">Documentation</a> | ||
<button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#topNavigation"> | ||
<span class="icon-bar"></span> | ||
<span class="icon-bar"></span> | ||
<span class="icon-bar"></span> | ||
</button> | ||
</div> | ||
<div class="navbar-collapse collapse" id="topNavigation"> | ||
<ul class="nav navbar-nav"> | ||
|
||
<li class="dropdown"> | ||
<a href="classes.list.html" class="dropdown-toggle" data-toggle="dropdown">Classes<b class="caret"></b></a> | ||
<ul class="dropdown-menu "> | ||
<li><a href="Activity.html">Activity</a></li><li><a href="Channel.html">Channel</a></li><li><a href="IncomingTransfer.html">IncomingTransfer</a></li><li><a href="OutgoingTransfer.html">OutgoingTransfer</a></li><li><a href="Reservation.html">Reservation</a></li><li><a href="Task.html">Task</a></li><li><a href="TaskQueue.html">TaskQueue</a></li><li><a href="Transfers.html">Transfers</a></li><li><a href="Worker.html">Worker</a></li><li><a href="Workspace.html">Workspace</a></li> | ||
</ul> | ||
</li> | ||
|
||
<li class="dropdown"> | ||
<a href="events.list.html" class="dropdown-toggle" data-toggle="dropdown">Events<b class="caret"></b></a> | ||
<ul class="dropdown-menu "> | ||
<li><a href="Channel.html#event:availabilityUpdated">Channel#event:availabilityUpdated</a></li><li><a href="Channel.html#event:capacityUpdated">Channel#event:capacityUpdated</a></li><li><a href="OutgoingTransfer.html#event:attemptFailed">OutgoingTransfer#event:attemptFailed</a></li><li><a href="OutgoingTransfer.html#event:canceled">OutgoingTransfer#event:canceled</a></li><li><a href="OutgoingTransfer.html#event:completed">OutgoingTransfer#event:completed</a></li><li><a href="OutgoingTransfer.html#event:failed">OutgoingTransfer#event:failed</a></li><li><a href="Reservation.html#event:accepted">Reservation#event:accepted</a></li><li><a href="Reservation.html#event:canceled">Reservation#event:canceled</a></li><li><a href="Reservation.html#event:completed">Reservation#event:completed</a></li><li><a href="Reservation.html#event:rejected">Reservation#event:rejected</a></li><li><a href="Reservation.html#event:rescinded">Reservation#event:rescinded</a></li><li><a href="Reservation.html#event:timeout">Reservation#event:timeout</a></li><li><a href="Reservation.html#event:wrapup">Reservation#event:wrapup</a></li><li><a href="Task.html#event:canceled">Task#event:canceled</a></li><li><a href="Task.html#event:completed">Task#event:completed</a></li><li><a href="Task.html#event:transferInitiated">Task#event:transferInitiated</a></li><li><a href="Task.html#event:updated">Task#event:updated</a></li><li><a href="Task.html#event:wrapup">Task#event:wrapup</a></li><li><a href="Worker.html#event:activityUpdated">Worker#event:activityUpdated</a></li><li><a href="Worker.html#event:attributesUpdated">Worker#event:attributesUpdated</a></li><li><a href="Worker.html#event:disconnected">Worker#event:disconnected</a></li><li><a href="Worker.html#event:error">Worker#event:error</a></li><li><a href="Worker.html#event:ready">Worker#event:ready</a></li><li><a href="Worker.html#event:reservationCreated">Worker#event:reservationCreated</a></li><li><a href="Worker.html#event:reservationFailed">Worker#event:reservationFailed</a></li><li><a href="Worker.html#event:tokenExpired">Worker#event:tokenExpired</a></li><li><a href="Worker.html#event:tokenUpdated">Worker#event:tokenUpdated</a></li> | ||
</ul> | ||
</li> | ||
|
||
</ul> | ||
|
||
<div class="col-sm-3 col-md-3"> | ||
<form class="navbar-form" role="search"> | ||
<div class="input-group"> | ||
<input type="text" class="form-control" placeholder="Search" name="q" id="search-input"> | ||
<div class="input-group-btn"> | ||
<button class="btn btn-default" id="search-submit"><i class="glyphicon glyphicon-search"></i></button> | ||
</div> | ||
</div> | ||
</form> | ||
</div> | ||
|
||
</div> | ||
|
||
</div> | ||
</div> | ||
|
||
|
||
<div class="container" id="toc-content"> | ||
<div class="row"> | ||
|
||
|
||
<div class="col-md-8"> | ||
|
||
<div id="main"> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<section class="readme-section"> | ||
<article><p><a href="https://travis-ci.org/twilio/twilio-taskrouter.js"><img src="https://travis-ci.org/twilio/twilio-taskrouter.js.svg?branch=master" alt="Build Status"></a> | ||
<a href="https://badge.fury.io/js/twilio-taskrouter"><img src="https://badge.fury.io/js/twilio-taskrouter.svg" alt="npm version"></a></p> | ||
<h1>twilio-taskrouter.js</h1> | ||
<p>TaskRouter is Twilio's skills based routing system. With this library, you can manage your Workers in the browser or view the state of your Workspace.</p> | ||
<p><strong>NOTE: This SDK is in a Developer Preview Release</strong>. This version of TaskRouter is intended for Twilio Flex. If you are using it outside of Twilio Flex, you may encounter bugs and instability, and | ||
the underlying APIs available in this release may change in subsequent releases.</p> | ||
<h2>Installation</h2> | ||
<h3>NPM</h3> | ||
<pre class="prettyprint source"><code>npm install twilio-taskrouter | ||
</code></pre> | ||
<h2>Usage</h2> | ||
<p>The following is a simple example showing a Worker waiting for Reservations. | ||
For more information, refer to the | ||
<a href="//twilio.github.io/twilio-taskrouter.js/index.html">API Docs</a>.</p> | ||
<pre class="prettyprint source lang-js"><code>const TaskRouter = require('twilio-taskrouter'); | ||
const Twilio = require('twilio'); | ||
const AccessToken = Twilio.jwt.AccessToken; | ||
const TaskRouterGrant = AccessToken.TaskRouterGrant; | ||
|
||
const accountSid = ''; | ||
const signingKeySid = ''; | ||
const signingKeySecret = ''; | ||
const workspaceSid = ''; | ||
const workerSid = ''; | ||
|
||
const token = createAccessToken(accountSid, signingKeySid, signingKeySecret, workspaceSid, workerSid); | ||
const alice = new TaskRouter.Worker(token); | ||
|
||
alice.on('ready', readyAlice => { | ||
console.log(`Worker ${readyAlice.sid} is now ready for work`); | ||
}); | ||
|
||
alice.on('reservationCreated', reservation => { | ||
console.log(`Reservation ${reservation.sid} has been created for ${alice.sid}`); | ||
console.log(`Task attributes are: ${reservation.task.attributes}`); | ||
|
||
reservation.on('accepted', acceptedReservation => { | ||
console.log(`Reservation ${acceptedReservation.sid} was accepted.`); | ||
}); | ||
|
||
reservation.accept().then(acceptedReservation => { | ||
console.log(`Reservation status is ${acceptedReservation.status}`); | ||
}).catch((err) => { | ||
console.log(`Error: ${err}`); | ||
}); | ||
}); | ||
|
||
function createAccessToken(accountSid, signingKeySid, signingKeySecret, workspaceSid, workerSid) { | ||
const taskRouterGrant = new TaskRouterGrant({ | ||
workerSid: workerSid, | ||
workspaceSid: workspaceSid, | ||
role: 'worker' | ||
}); | ||
|
||
const accessToken = new AccessToken(accountSid, signingKeySid, signingKeySecret); | ||
accessToken.addGrant(taskRouterGrant); | ||
accessToken.identity = 'alice'; | ||
|
||
return accessToken.toJwt(); | ||
} | ||
|
||
</code></pre> | ||
<h2>Changelog</h2> | ||
<p>See <a href="https://github.com/twilio/twilio-taskrouter.js/blob/master/CHANGELOG.md">CHANGELOG.md</a>.</p> | ||
<h2>License</h2> | ||
<p>See <a href="https://github.com/twilio/twilio-taskrouter.js/blob/master/LICENSE.md">LICENSE.md</a>.</p> | ||
<h2>Building</h2> | ||
<p>Fork and clone the repository. Use npm to install node 8 (other versions may run into problems).</p> | ||
<p>Then, install dependencies with:</p> | ||
<pre class="prettyprint source"><code>yarn install | ||
</code></pre> | ||
<p>Then run the <code>build</code> script:</p> | ||
<pre class="prettyprint source"><code>yarn build | ||
</code></pre> | ||
<p>The builds and docs will be placed in the <code>dist/</code> directory.</p> | ||
<p>Before commits, be sure to validate by running:</p> | ||
<pre class="prettyprint source"><code>make lint | ||
</code></pre> | ||
<h2>Testing</h2> | ||
<ul> | ||
<li>Create a twilio account</li> | ||
<li>copy ./test/integration_test_setup/.env.example to ./test/integration_test_setup/.env</li> | ||
<li>set ACCOUNT_SID, AUTH_TOKEN, SIGNING_KEY_SID, SIGNING_KEY_SECRET</li> | ||
<li>Run ./test/integration_test_setup/RunIntegrationTestLocal.sh this will create everything needed for running E2E tests and run the tests</li> | ||
</ul> | ||
<h2>Contributing</h2> | ||
<p>Bug fixes welcome! If you're not familiar with the GitHub pull | ||
request/contribution process, <a href="https://gun.io/blog/how-to-github-fork-branch-and-pull-request/">this is a nice tutorial</a>.</p></article> | ||
</section> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
</div> | ||
</div> | ||
|
||
<div class="clearfix"></div> | ||
|
||
|
||
<div class="col-md-3"> | ||
<div id="toc" class="col-md-3 hidden-xs hidden-sm hidden-md"></div> | ||
</div> | ||
|
||
|
||
</div> | ||
</div> | ||
|
||
|
||
<div class="modal fade" id="searchResults"> | ||
<div class="modal-dialog"> | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | ||
<h4 class="modal-title">Search results</h4> | ||
</div> | ||
<div class="modal-body"></div> | ||
<div class="modal-footer"> | ||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button> | ||
</div> | ||
</div><!-- /.modal-content --> | ||
</div><!-- /.modal-dialog --> | ||
</div> | ||
|
||
|
||
<footer> | ||
|
||
|
||
<span class="jsdoc-message"> | ||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.7</a> | ||
|
||
on 2023-03-29T06:54:49+00:00 | ||
|
||
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>. | ||
</span> | ||
</footer> | ||
|
||
<script src="scripts/docstrap.lib.js"></script> | ||
<script src="scripts/toc.js"></script> | ||
|
||
<script type="text/javascript" src="scripts/fulltext-search-ui.js"></script> | ||
|
||
|
||
<script> | ||
$( function () { | ||
$( "[id*='$']" ).each( function () { | ||
var $this = $( this ); | ||
|
||
$this.attr( "id", $this.attr( "id" ).replace( "$", "__" ) ); | ||
} ); | ||
|
||
$( ".tutorial-section pre, .readme-section pre, pre.prettyprint.source" ).each( function () { | ||
var $this = $( this ); | ||
|
||
var example = $this.find( "code" ); | ||
exampleText = example.html(); | ||
var lang = /{@lang (.*?)}/.exec( exampleText ); | ||
if ( lang && lang[1] ) { | ||
exampleText = exampleText.replace( lang[0], "" ); | ||
example.html( exampleText ); | ||
lang = lang[1]; | ||
} else { | ||
var langClassMatch = example.parent()[0].className.match(/lang\-(\S+)/); | ||
lang = langClassMatch ? langClassMatch[1] : "javascript"; | ||
} | ||
|
||
if ( lang ) { | ||
|
||
$this | ||
.addClass( "sunlight-highlight-" + lang ) | ||
.addClass( "linenums" ) | ||
.html( example.html() ); | ||
|
||
} | ||
} ); | ||
|
||
Sunlight.highlightAll( { | ||
lineNumbers : false, | ||
showMenu : true, | ||
enableDoclinks : true | ||
} ); | ||
|
||
$.catchAnchorLinks( { | ||
navbarOffset: 10 | ||
} ); | ||
$( "#toc" ).toc( { | ||
anchorName : function ( i, heading, prefix ) { | ||
return $( heading ).attr( "id" ) || ( prefix + i ); | ||
}, | ||
selectors : "#toc-content h1,#toc-content h2,#toc-content h3,#toc-content h4", | ||
showAndHide : false, | ||
smoothScrolling: true | ||
} ); | ||
|
||
$( "#main span[id^='toc']" ).addClass( "toc-shim" ); | ||
$( '.dropdown-toggle' ).dropdown(); | ||
|
||
$( "table" ).each( function () { | ||
var $this = $( this ); | ||
$this.addClass('table'); | ||
} ); | ||
|
||
} ); | ||
</script> | ||
|
||
|
||
|
||
<!--Navigation and Symbol Display--> | ||
|
||
|
||
<!--Google Analytics--> | ||
|
||
|
||
|
||
<script type="text/javascript"> | ||
$(document).ready(function() { | ||
SearcherDisplay.init(); | ||
}); | ||
</script> | ||
|
||
|
||
|
||
</body></html> |
Large diffs are not rendered by default.
Large diffs are not rendered by default.