-
Notifications
You must be signed in to change notification settings - Fork 8
/
Queues.gs
39 lines (30 loc) · 1.22 KB
/
Queues.gs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/**
@module resources/Queues
The Twilio "Queues" Resource.
*/
//var generate = require('./generate'),
// ListInstanceResource = require('./ListInstanceResource');
var Queues_ = function (client, accountSid) {
var baseResourceUrl = '/Accounts/' + accountSid + '/Queues';
//Instance requests
function Queues(sid) {
var resourceApi = {};
//Add standard instance resource functions
generate_.restFunctions(resourceApi,client,['GET', 'POST', 'DELETE', {update:'POST'}], baseResourceUrl + '/' + sid);
//Add special call queue sub resources
resourceApi.members = ListInstanceResource_(client, accountSid, 'Queues/' + sid + '/Members',
['GET', 'POST', {update:'POST'}],
['GET']
);
//There's also a special resource for a call at the front of the queue, not specified by SID
resourceApi.members.front = {
get: resourceApi.members('Front').get,
post: resourceApi.members('Front').post,
update: resourceApi.members('Front').post
};
return resourceApi;
}
//List requests
generate_.restFunctions(Queues, client, ['GET', 'POST', {create:'POST'}], baseResourceUrl);
return Queues;
};