twilio 3.75.0 → 3.76.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -2
- package/lib/rest/Chat.d.ts +4 -0
- package/lib/rest/Chat.js +19 -0
- package/lib/rest/FlexApi.d.ts +2 -0
- package/lib/rest/FlexApi.js +8 -0
- package/lib/rest/Insights.d.ts +2 -0
- package/lib/rest/Insights.js +8 -0
- package/lib/rest/Media.d.ts +2 -0
- package/lib/rest/Media.js +9 -0
- package/lib/rest/Supersim.d.ts +0 -2
- package/lib/rest/Supersim.js +0 -8
- package/lib/rest/Verify.d.ts +2 -0
- package/lib/rest/Verify.js +9 -0
- package/lib/rest/api/v2010/account/call/payment.d.ts +1 -1
- package/lib/rest/api/v2010/account/call/payment.js +1 -1
- package/lib/rest/api/v2010/account/call/stream.d.ts +2 -8
- package/lib/rest/api/v2010/account/call/stream.js +8 -7
- package/lib/rest/api/v2010/account/call.d.ts +0 -2
- package/lib/rest/api/v2010/account/call.js +0 -2
- package/lib/rest/api/v2010/account/recording.d.ts +31 -2
- package/lib/rest/api/v2010/account/recording.js +25 -4
- package/lib/rest/api/v2010/account/usage/record/allTime.d.ts +1 -1
- package/lib/rest/api/v2010/account/usage/record/daily.d.ts +1 -1
- package/lib/rest/api/v2010/account/usage/record/lastMonth.d.ts +1 -1
- package/lib/rest/api/v2010/account/usage/record/monthly.d.ts +1 -1
- package/lib/rest/api/v2010/account/usage/record/thisMonth.d.ts +1 -1
- package/lib/rest/api/v2010/account/usage/record/today.d.ts +1 -1
- package/lib/rest/api/v2010/account/usage/record/yearly.d.ts +1 -1
- package/lib/rest/api/v2010/account/usage/record/yesterday.d.ts +1 -1
- package/lib/rest/api/v2010/account/usage/record.d.ts +1 -1
- package/lib/rest/api/v2010/account/usage/trigger.d.ts +1 -1
- package/lib/rest/chat/V3.d.ts +25 -0
- package/lib/rest/chat/V3.js +46 -0
- package/lib/rest/chat/v2/service/user/userChannel.d.ts +26 -1
- package/lib/rest/chat/v2/service/user/userChannel.js +18 -4
- package/lib/rest/chat/v3/channel.d.ts +177 -0
- package/lib/rest/chat/v3/channel.js +373 -0
- package/lib/rest/flexApi/V1.d.ts +3 -0
- package/lib/rest/flexApi/V1.js +11 -0
- package/lib/rest/flexApi/v1/configuration.d.ts +2 -0
- package/lib/rest/flexApi/v1/configuration.js +3 -0
- package/lib/rest/flexApi/v1/interaction/interactionChannel/interactionChannelInvite.d.ts +266 -0
- package/lib/rest/flexApi/v1/interaction/interactionChannel/interactionChannelInvite.js +505 -0
- package/lib/rest/flexApi/v1/interaction/interactionChannel/interactionChannelParticipant.d.ts +323 -0
- package/lib/rest/flexApi/v1/interaction/interactionChannel/interactionChannelParticipant.js +674 -0
- package/lib/rest/flexApi/v1/interaction/interactionChannel.d.ts +327 -0
- package/lib/rest/flexApi/v1/interaction/interactionChannel.js +718 -0
- package/lib/rest/flexApi/v1/interaction.d.ts +152 -0
- package/lib/rest/flexApi/v1/interaction.js +395 -0
- package/lib/rest/insights/V1.d.ts +3 -0
- package/lib/rest/insights/V1.js +11 -0
- package/lib/rest/insights/v1/annotation.d.ts +188 -0
- package/lib/rest/insights/v1/annotation.js +406 -0
- package/lib/rest/media/V1.d.ts +3 -0
- package/lib/rest/media/V1.js +12 -0
- package/lib/rest/media/v1/mediaProcessor.js +1 -1
- package/lib/rest/media/v1/mediaRecording.d.ts +358 -0
- package/lib/rest/{supersim/v1/command.js → media/v1/mediaRecording.js} +190 -176
- package/lib/rest/media/v1/playerStreamer.d.ts +4 -0
- package/lib/rest/media/v1/playerStreamer.js +5 -1
- package/lib/rest/numbers/v2/regulatoryCompliance/supportingDocument.d.ts +2 -0
- package/lib/rest/numbers/v2/regulatoryCompliance/supportingDocument.js +3 -0
- package/lib/rest/supersim/V1.d.ts +0 -3
- package/lib/rest/supersim/V1.js +0 -11
- package/lib/rest/supersim/v1/fleet.d.ts +0 -16
- package/lib/rest/supersim/v1/fleet.js +0 -18
- package/lib/rest/taskrouter/v1/workspace/taskQueue/taskQueueCumulativeStatistics.d.ts +1 -1
- package/lib/rest/taskrouter/v1/workspace/taskQueue/taskQueueCumulativeStatistics.js +2 -2
- package/lib/rest/taskrouter/v1/workspace/workflow/workflowCumulativeStatistics.d.ts +1 -1
- package/lib/rest/taskrouter/v1/workspace/workflow/workflowCumulativeStatistics.js +2 -2
- package/lib/rest/taskrouter/v1/workspace/workspaceCumulativeStatistics.d.ts +1 -1
- package/lib/rest/taskrouter/v1/workspace/workspaceCumulativeStatistics.js +2 -2
- package/lib/rest/verify/V2.d.ts +3 -0
- package/lib/rest/verify/V2.js +13 -0
- package/lib/rest/verify/v2/service/accessToken.d.ts +6 -0
- package/lib/rest/verify/v2/service/accessToken.js +9 -1
- package/lib/rest/verify/v2/service/entity/challenge.d.ts +4 -0
- package/lib/rest/verify/v2/service/entity/challenge.js +8 -1
- package/lib/rest/verify/v2/verificationAttemptsSummary.d.ts +156 -0
- package/lib/rest/verify/v2/verificationAttemptsSummary.js +362 -0
- package/lib/rest/video/v1/composition.d.ts +4 -0
- package/lib/rest/video/v1/composition.js +6 -0
- package/lib/rest/video/v1/recording.d.ts +4 -0
- package/lib/rest/video/v1/recording.js +6 -0
- package/package.json +3 -3
- package/lib/rest/supersim/v1/command.d.ts +0 -342
|
@@ -0,0 +1,674 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/* jshint ignore:start */
|
|
4
|
+
/**
|
|
5
|
+
* This code was generated by
|
|
6
|
+
* \ / _ _ _| _ _
|
|
7
|
+
* | (_)\/(_)(_|\/| |(/_ v1.0.0
|
|
8
|
+
* / /
|
|
9
|
+
*/
|
|
10
|
+
/* jshint ignore:end */
|
|
11
|
+
|
|
12
|
+
var Q = require('q'); /* jshint ignore:line */
|
|
13
|
+
var _ = require('lodash'); /* jshint ignore:line */
|
|
14
|
+
var util = require('util'); /* jshint ignore:line */
|
|
15
|
+
var Page = require('../../../../../base/Page'); /* jshint ignore:line */
|
|
16
|
+
var serialize = require(
|
|
17
|
+
'../../../../../base/serialize'); /* jshint ignore:line */
|
|
18
|
+
var values = require('../../../../../base/values'); /* jshint ignore:line */
|
|
19
|
+
|
|
20
|
+
var InteractionChannelParticipantList;
|
|
21
|
+
var InteractionChannelParticipantPage;
|
|
22
|
+
var InteractionChannelParticipantInstance;
|
|
23
|
+
var InteractionChannelParticipantContext;
|
|
24
|
+
|
|
25
|
+
/* jshint ignore:start */
|
|
26
|
+
/**
|
|
27
|
+
* Initialize the InteractionChannelParticipantList
|
|
28
|
+
*
|
|
29
|
+
* @constructor Twilio.FlexApi.V1.InteractionContext.InteractionChannelContext.InteractionChannelParticipantList
|
|
30
|
+
*
|
|
31
|
+
* @param {Twilio.FlexApi.V1} version - Version of the resource
|
|
32
|
+
* @param {string} interactionSid - The Interaction Sid for this channel.
|
|
33
|
+
* @param {string} channelSid - The Channel Sid for this Participant.
|
|
34
|
+
*/
|
|
35
|
+
/* jshint ignore:end */
|
|
36
|
+
InteractionChannelParticipantList = function
|
|
37
|
+
InteractionChannelParticipantList(version, interactionSid, channelSid) {
|
|
38
|
+
/* jshint ignore:start */
|
|
39
|
+
/**
|
|
40
|
+
* @function participants
|
|
41
|
+
* @memberof Twilio.FlexApi.V1.InteractionContext.InteractionChannelContext#
|
|
42
|
+
*
|
|
43
|
+
* @param {string} sid - sid of instance
|
|
44
|
+
*
|
|
45
|
+
* @returns {Twilio.FlexApi.V1.InteractionContext.InteractionChannelContext.InteractionChannelParticipantContext}
|
|
46
|
+
*/
|
|
47
|
+
/* jshint ignore:end */
|
|
48
|
+
function InteractionChannelParticipantListInstance(sid) {
|
|
49
|
+
return InteractionChannelParticipantListInstance.get(sid);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
InteractionChannelParticipantListInstance._version = version;
|
|
53
|
+
// Path Solution
|
|
54
|
+
InteractionChannelParticipantListInstance._solution = {
|
|
55
|
+
interactionSid: interactionSid,
|
|
56
|
+
channelSid: channelSid
|
|
57
|
+
};
|
|
58
|
+
InteractionChannelParticipantListInstance._uri = `/Interactions/${interactionSid}/Channels/${channelSid}/Participants`;
|
|
59
|
+
/* jshint ignore:start */
|
|
60
|
+
/**
|
|
61
|
+
* create a InteractionChannelParticipantInstance
|
|
62
|
+
*
|
|
63
|
+
* @function create
|
|
64
|
+
* @memberof Twilio.FlexApi.V1.InteractionContext.InteractionChannelContext.InteractionChannelParticipantList#
|
|
65
|
+
*
|
|
66
|
+
* @param {object} opts - Options for request
|
|
67
|
+
* @param {interaction_channel_participant.type} opts.type - Participant type.
|
|
68
|
+
* @param {object} opts.mediaProperties -
|
|
69
|
+
* JSON representing the Media Properties for the new Participant.
|
|
70
|
+
* @param {function} [callback] - Callback to handle processed record
|
|
71
|
+
*
|
|
72
|
+
* @returns {Promise} Resolves to processed InteractionChannelParticipantInstance
|
|
73
|
+
*/
|
|
74
|
+
/* jshint ignore:end */
|
|
75
|
+
InteractionChannelParticipantListInstance.create = function create(opts,
|
|
76
|
+
callback) {
|
|
77
|
+
if (_.isUndefined(opts)) {
|
|
78
|
+
throw new Error('Required parameter "opts" missing.');
|
|
79
|
+
}
|
|
80
|
+
if (_.isUndefined(opts['type'])) {
|
|
81
|
+
throw new Error('Required parameter "opts[\'type\']" missing.');
|
|
82
|
+
}
|
|
83
|
+
if (_.isUndefined(opts['mediaProperties'])) {
|
|
84
|
+
throw new Error('Required parameter "opts[\'mediaProperties\']" missing.');
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
var deferred = Q.defer();
|
|
88
|
+
var data = values.of({
|
|
89
|
+
'Type': _.get(opts, 'type'),
|
|
90
|
+
'MediaProperties': serialize.object(_.get(opts, 'mediaProperties'))
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
var promise = this._version.create({uri: this._uri, method: 'POST', data: data});
|
|
94
|
+
|
|
95
|
+
promise = promise.then(function(payload) {
|
|
96
|
+
deferred.resolve(new InteractionChannelParticipantInstance(
|
|
97
|
+
this._version,
|
|
98
|
+
payload,
|
|
99
|
+
this._solution.interactionSid,
|
|
100
|
+
this._solution.channelSid,
|
|
101
|
+
this._solution.sid
|
|
102
|
+
));
|
|
103
|
+
}.bind(this));
|
|
104
|
+
|
|
105
|
+
promise.catch(function(error) {
|
|
106
|
+
deferred.reject(error);
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
if (_.isFunction(callback)) {
|
|
110
|
+
deferred.promise.nodeify(callback);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return deferred.promise;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
/* jshint ignore:start */
|
|
117
|
+
/**
|
|
118
|
+
* Streams InteractionChannelParticipantInstance records from the API.
|
|
119
|
+
*
|
|
120
|
+
* This operation lazily loads records as efficiently as possible until the limit
|
|
121
|
+
* is reached.
|
|
122
|
+
*
|
|
123
|
+
* The results are passed into the callback function, so this operation is memory
|
|
124
|
+
* efficient.
|
|
125
|
+
*
|
|
126
|
+
* If a function is passed as the first argument, it will be used as the callback
|
|
127
|
+
* function.
|
|
128
|
+
*
|
|
129
|
+
* @function each
|
|
130
|
+
* @memberof Twilio.FlexApi.V1.InteractionContext.InteractionChannelContext.InteractionChannelParticipantList#
|
|
131
|
+
*
|
|
132
|
+
* @param {object} [opts] - Options for request
|
|
133
|
+
* @param {number} [opts.limit] -
|
|
134
|
+
* Upper limit for the number of records to return.
|
|
135
|
+
* each() guarantees never to return more than limit.
|
|
136
|
+
* Default is no limit
|
|
137
|
+
* @param {number} [opts.pageSize] -
|
|
138
|
+
* Number of records to fetch per request,
|
|
139
|
+
* when not set will use the default value of 50 records.
|
|
140
|
+
* If no pageSize is defined but a limit is defined,
|
|
141
|
+
* each() will attempt to read the limit with the most efficient
|
|
142
|
+
* page size, i.e. min(limit, 1000)
|
|
143
|
+
* @param {Function} [opts.callback] -
|
|
144
|
+
* Function to process each record. If this and a positional
|
|
145
|
+
* callback are passed, this one will be used
|
|
146
|
+
* @param {Function} [opts.done] -
|
|
147
|
+
* Function to be called upon completion of streaming
|
|
148
|
+
* @param {Function} [callback] - Function to process each record
|
|
149
|
+
*/
|
|
150
|
+
/* jshint ignore:end */
|
|
151
|
+
InteractionChannelParticipantListInstance.each = function each(opts, callback) {
|
|
152
|
+
if (_.isFunction(opts)) {
|
|
153
|
+
callback = opts;
|
|
154
|
+
opts = {};
|
|
155
|
+
}
|
|
156
|
+
opts = opts || {};
|
|
157
|
+
if (opts.callback) {
|
|
158
|
+
callback = opts.callback;
|
|
159
|
+
}
|
|
160
|
+
if (_.isUndefined(callback)) {
|
|
161
|
+
throw new Error('Callback function must be provided');
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
var done = false;
|
|
165
|
+
var currentPage = 1;
|
|
166
|
+
var currentResource = 0;
|
|
167
|
+
var limits = this._version.readLimits({
|
|
168
|
+
limit: opts.limit,
|
|
169
|
+
pageSize: opts.pageSize
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
function onComplete(error) {
|
|
173
|
+
done = true;
|
|
174
|
+
if (_.isFunction(opts.done)) {
|
|
175
|
+
opts.done(error);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function fetchNextPage(fn) {
|
|
180
|
+
var promise = fn();
|
|
181
|
+
if (_.isUndefined(promise)) {
|
|
182
|
+
onComplete();
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
promise.then(function(page) {
|
|
187
|
+
_.each(page.instances, function(instance) {
|
|
188
|
+
if (done || (!_.isUndefined(opts.limit) && currentResource >= opts.limit)) {
|
|
189
|
+
done = true;
|
|
190
|
+
return false;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
currentResource++;
|
|
194
|
+
callback(instance, onComplete);
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
if (!done) {
|
|
198
|
+
currentPage++;
|
|
199
|
+
fetchNextPage(_.bind(page.nextPage, page));
|
|
200
|
+
} else {
|
|
201
|
+
onComplete();
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
promise.catch(onComplete);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
fetchNextPage(_.bind(this.page, this, _.merge(opts, limits)));
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
/* jshint ignore:start */
|
|
212
|
+
/**
|
|
213
|
+
* Lists InteractionChannelParticipantInstance records from the API as a list.
|
|
214
|
+
*
|
|
215
|
+
* If a function is passed as the first argument, it will be used as the callback
|
|
216
|
+
* function.
|
|
217
|
+
*
|
|
218
|
+
* @function list
|
|
219
|
+
* @memberof Twilio.FlexApi.V1.InteractionContext.InteractionChannelContext.InteractionChannelParticipantList#
|
|
220
|
+
*
|
|
221
|
+
* @param {object} [opts] - Options for request
|
|
222
|
+
* @param {number} [opts.limit] -
|
|
223
|
+
* Upper limit for the number of records to return.
|
|
224
|
+
* list() guarantees never to return more than limit.
|
|
225
|
+
* Default is no limit
|
|
226
|
+
* @param {number} [opts.pageSize] -
|
|
227
|
+
* Number of records to fetch per request,
|
|
228
|
+
* when not set will use the default value of 50 records.
|
|
229
|
+
* If no page_size is defined but a limit is defined,
|
|
230
|
+
* list() will attempt to read the limit with the most
|
|
231
|
+
* efficient page size, i.e. min(limit, 1000)
|
|
232
|
+
* @param {function} [callback] - Callback to handle list of records
|
|
233
|
+
*
|
|
234
|
+
* @returns {Promise} Resolves to a list of records
|
|
235
|
+
*/
|
|
236
|
+
/* jshint ignore:end */
|
|
237
|
+
InteractionChannelParticipantListInstance.list = function list(opts, callback) {
|
|
238
|
+
if (_.isFunction(opts)) {
|
|
239
|
+
callback = opts;
|
|
240
|
+
opts = {};
|
|
241
|
+
}
|
|
242
|
+
opts = opts || {};
|
|
243
|
+
var deferred = Q.defer();
|
|
244
|
+
var allResources = [];
|
|
245
|
+
opts.callback = function(resource, done) {
|
|
246
|
+
allResources.push(resource);
|
|
247
|
+
|
|
248
|
+
if (!_.isUndefined(opts.limit) && allResources.length === opts.limit) {
|
|
249
|
+
done();
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
opts.done = function(error) {
|
|
254
|
+
if (_.isUndefined(error)) {
|
|
255
|
+
deferred.resolve(allResources);
|
|
256
|
+
} else {
|
|
257
|
+
deferred.reject(error);
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
if (_.isFunction(callback)) {
|
|
262
|
+
deferred.promise.nodeify(callback);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
this.each(opts);
|
|
266
|
+
return deferred.promise;
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
/* jshint ignore:start */
|
|
270
|
+
/**
|
|
271
|
+
* Retrieve a single page of InteractionChannelParticipantInstance records from the
|
|
272
|
+
* API.
|
|
273
|
+
*
|
|
274
|
+
* The request is executed immediately.
|
|
275
|
+
*
|
|
276
|
+
* If a function is passed as the first argument, it will be used as the callback
|
|
277
|
+
* function.
|
|
278
|
+
*
|
|
279
|
+
* @function page
|
|
280
|
+
* @memberof Twilio.FlexApi.V1.InteractionContext.InteractionChannelContext.InteractionChannelParticipantList#
|
|
281
|
+
*
|
|
282
|
+
* @param {object} [opts] - Options for request
|
|
283
|
+
* @param {string} [opts.pageToken] - PageToken provided by the API
|
|
284
|
+
* @param {number} [opts.pageNumber] -
|
|
285
|
+
* Page Number, this value is simply for client state
|
|
286
|
+
* @param {number} [opts.pageSize] - Number of records to return, defaults to 50
|
|
287
|
+
* @param {function} [callback] - Callback to handle list of records
|
|
288
|
+
*
|
|
289
|
+
* @returns {Promise} Resolves to a list of records
|
|
290
|
+
*/
|
|
291
|
+
/* jshint ignore:end */
|
|
292
|
+
InteractionChannelParticipantListInstance.page = function page(opts, callback) {
|
|
293
|
+
if (_.isFunction(opts)) {
|
|
294
|
+
callback = opts;
|
|
295
|
+
opts = {};
|
|
296
|
+
}
|
|
297
|
+
opts = opts || {};
|
|
298
|
+
|
|
299
|
+
var deferred = Q.defer();
|
|
300
|
+
var data = values.of({
|
|
301
|
+
'PageToken': opts.pageToken,
|
|
302
|
+
'Page': opts.pageNumber,
|
|
303
|
+
'PageSize': opts.pageSize
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
var promise = this._version.page({uri: this._uri, method: 'GET', params: data});
|
|
307
|
+
|
|
308
|
+
promise = promise.then(function(payload) {
|
|
309
|
+
deferred.resolve(new InteractionChannelParticipantPage(this._version, payload, this._solution));
|
|
310
|
+
}.bind(this));
|
|
311
|
+
|
|
312
|
+
promise.catch(function(error) {
|
|
313
|
+
deferred.reject(error);
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
if (_.isFunction(callback)) {
|
|
317
|
+
deferred.promise.nodeify(callback);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
return deferred.promise;
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
/* jshint ignore:start */
|
|
324
|
+
/**
|
|
325
|
+
* Retrieve a single target page of InteractionChannelParticipantInstance records
|
|
326
|
+
* from the API.
|
|
327
|
+
*
|
|
328
|
+
* The request is executed immediately.
|
|
329
|
+
*
|
|
330
|
+
* If a function is passed as the first argument, it will be used as the callback
|
|
331
|
+
* function.
|
|
332
|
+
*
|
|
333
|
+
* @function getPage
|
|
334
|
+
* @memberof Twilio.FlexApi.V1.InteractionContext.InteractionChannelContext.InteractionChannelParticipantList#
|
|
335
|
+
*
|
|
336
|
+
* @param {string} [targetUrl] - API-generated URL for the requested results page
|
|
337
|
+
* @param {function} [callback] - Callback to handle list of records
|
|
338
|
+
*
|
|
339
|
+
* @returns {Promise} Resolves to a list of records
|
|
340
|
+
*/
|
|
341
|
+
/* jshint ignore:end */
|
|
342
|
+
InteractionChannelParticipantListInstance.getPage = function getPage(targetUrl,
|
|
343
|
+
callback) {
|
|
344
|
+
var deferred = Q.defer();
|
|
345
|
+
|
|
346
|
+
var promise = this._version._domain.twilio.request({method: 'GET', uri: targetUrl});
|
|
347
|
+
|
|
348
|
+
promise = promise.then(function(payload) {
|
|
349
|
+
deferred.resolve(new InteractionChannelParticipantPage(this._version, payload, this._solution));
|
|
350
|
+
}.bind(this));
|
|
351
|
+
|
|
352
|
+
promise.catch(function(error) {
|
|
353
|
+
deferred.reject(error);
|
|
354
|
+
});
|
|
355
|
+
|
|
356
|
+
if (_.isFunction(callback)) {
|
|
357
|
+
deferred.promise.nodeify(callback);
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
return deferred.promise;
|
|
361
|
+
};
|
|
362
|
+
|
|
363
|
+
/* jshint ignore:start */
|
|
364
|
+
/**
|
|
365
|
+
* Constructs a interaction_channel_participant
|
|
366
|
+
*
|
|
367
|
+
* @function get
|
|
368
|
+
* @memberof Twilio.FlexApi.V1.InteractionContext.InteractionChannelContext.InteractionChannelParticipantList#
|
|
369
|
+
*
|
|
370
|
+
* @param {string} sid - The unique string that identifies the resource
|
|
371
|
+
*
|
|
372
|
+
* @returns {Twilio.FlexApi.V1.InteractionContext.InteractionChannelContext.InteractionChannelParticipantContext}
|
|
373
|
+
*/
|
|
374
|
+
/* jshint ignore:end */
|
|
375
|
+
InteractionChannelParticipantListInstance.get = function get(sid) {
|
|
376
|
+
return new InteractionChannelParticipantContext(
|
|
377
|
+
this._version,
|
|
378
|
+
this._solution.interactionSid,
|
|
379
|
+
this._solution.channelSid,
|
|
380
|
+
sid
|
|
381
|
+
);
|
|
382
|
+
};
|
|
383
|
+
|
|
384
|
+
/* jshint ignore:start */
|
|
385
|
+
/**
|
|
386
|
+
* Provide a user-friendly representation
|
|
387
|
+
*
|
|
388
|
+
* @function toJSON
|
|
389
|
+
* @memberof Twilio.FlexApi.V1.InteractionContext.InteractionChannelContext.InteractionChannelParticipantList#
|
|
390
|
+
*
|
|
391
|
+
* @returns Object
|
|
392
|
+
*/
|
|
393
|
+
/* jshint ignore:end */
|
|
394
|
+
InteractionChannelParticipantListInstance.toJSON = function toJSON() {
|
|
395
|
+
return this._solution;
|
|
396
|
+
};
|
|
397
|
+
|
|
398
|
+
InteractionChannelParticipantListInstance[util.inspect.custom] = function
|
|
399
|
+
inspect(depth, options) {
|
|
400
|
+
return util.inspect(this.toJSON(), options);
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
return InteractionChannelParticipantListInstance;
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
/* jshint ignore:start */
|
|
408
|
+
/**
|
|
409
|
+
* Initialize the InteractionChannelParticipantPage
|
|
410
|
+
*
|
|
411
|
+
* @constructor Twilio.FlexApi.V1.InteractionContext.InteractionChannelContext.InteractionChannelParticipantPage
|
|
412
|
+
*
|
|
413
|
+
* @param {V1} version - Version of the resource
|
|
414
|
+
* @param {Response<string>} response - Response from the API
|
|
415
|
+
* @param {InteractionChannelParticipantSolution} solution - Path solution
|
|
416
|
+
*
|
|
417
|
+
* @returns InteractionChannelParticipantPage
|
|
418
|
+
*/
|
|
419
|
+
/* jshint ignore:end */
|
|
420
|
+
InteractionChannelParticipantPage = function
|
|
421
|
+
InteractionChannelParticipantPage(version, response, solution) {
|
|
422
|
+
// Path Solution
|
|
423
|
+
this._solution = solution;
|
|
424
|
+
|
|
425
|
+
Page.prototype.constructor.call(this, version, response, this._solution);
|
|
426
|
+
};
|
|
427
|
+
|
|
428
|
+
_.extend(InteractionChannelParticipantPage.prototype, Page.prototype);
|
|
429
|
+
InteractionChannelParticipantPage.prototype.constructor = InteractionChannelParticipantPage;
|
|
430
|
+
|
|
431
|
+
/* jshint ignore:start */
|
|
432
|
+
/**
|
|
433
|
+
* Build an instance of InteractionChannelParticipantInstance
|
|
434
|
+
*
|
|
435
|
+
* @function getInstance
|
|
436
|
+
* @memberof Twilio.FlexApi.V1.InteractionContext.InteractionChannelContext.InteractionChannelParticipantPage#
|
|
437
|
+
*
|
|
438
|
+
* @param {InteractionChannelParticipantPayload} payload -
|
|
439
|
+
* Payload response from the API
|
|
440
|
+
*
|
|
441
|
+
* @returns InteractionChannelParticipantInstance
|
|
442
|
+
*/
|
|
443
|
+
/* jshint ignore:end */
|
|
444
|
+
InteractionChannelParticipantPage.prototype.getInstance = function
|
|
445
|
+
getInstance(payload) {
|
|
446
|
+
return new InteractionChannelParticipantInstance(
|
|
447
|
+
this._version,
|
|
448
|
+
payload,
|
|
449
|
+
this._solution.interactionSid,
|
|
450
|
+
this._solution.channelSid
|
|
451
|
+
);
|
|
452
|
+
};
|
|
453
|
+
|
|
454
|
+
/* jshint ignore:start */
|
|
455
|
+
/**
|
|
456
|
+
* Provide a user-friendly representation
|
|
457
|
+
*
|
|
458
|
+
* @function toJSON
|
|
459
|
+
* @memberof Twilio.FlexApi.V1.InteractionContext.InteractionChannelContext.InteractionChannelParticipantPage#
|
|
460
|
+
*
|
|
461
|
+
* @returns Object
|
|
462
|
+
*/
|
|
463
|
+
/* jshint ignore:end */
|
|
464
|
+
InteractionChannelParticipantPage.prototype.toJSON = function toJSON() {
|
|
465
|
+
let clone = {};
|
|
466
|
+
_.forOwn(this, function(value, key) {
|
|
467
|
+
if (!_.startsWith(key, '_') && ! _.isFunction(value)) {
|
|
468
|
+
clone[key] = value;
|
|
469
|
+
}
|
|
470
|
+
});
|
|
471
|
+
return clone;
|
|
472
|
+
};
|
|
473
|
+
|
|
474
|
+
InteractionChannelParticipantPage.prototype[util.inspect.custom] = function
|
|
475
|
+
inspect(depth, options) {
|
|
476
|
+
return util.inspect(this.toJSON(), options);
|
|
477
|
+
};
|
|
478
|
+
|
|
479
|
+
|
|
480
|
+
/* jshint ignore:start */
|
|
481
|
+
/**
|
|
482
|
+
* Initialize the InteractionChannelParticipantContext
|
|
483
|
+
*
|
|
484
|
+
* @constructor Twilio.FlexApi.V1.InteractionContext.InteractionChannelContext.InteractionChannelParticipantInstance
|
|
485
|
+
*
|
|
486
|
+
* @property {string} sid - The unique string that identifies the resource
|
|
487
|
+
* @property {interaction_channel_participant.type} type - Participant type.
|
|
488
|
+
* @property {string} interactionSid - The Interaction Sid for this channel.
|
|
489
|
+
* @property {string} channelSid - The Channel Sid for this Participant.
|
|
490
|
+
* @property {string} url - The url
|
|
491
|
+
*
|
|
492
|
+
* @param {V1} version - Version of the resource
|
|
493
|
+
* @param {InteractionChannelParticipantPayload} payload - The instance payload
|
|
494
|
+
* @param {sid} interactionSid - The Interaction Sid for this channel.
|
|
495
|
+
* @param {sid} channelSid - The Channel Sid for this Participant.
|
|
496
|
+
* @param {sid} sid - The unique string that identifies the resource
|
|
497
|
+
*/
|
|
498
|
+
/* jshint ignore:end */
|
|
499
|
+
InteractionChannelParticipantInstance = function
|
|
500
|
+
InteractionChannelParticipantInstance(version, payload, interactionSid,
|
|
501
|
+
channelSid, sid) {
|
|
502
|
+
this._version = version;
|
|
503
|
+
|
|
504
|
+
// Marshaled Properties
|
|
505
|
+
this.sid = payload.sid; // jshint ignore:line
|
|
506
|
+
this.type = payload.type; // jshint ignore:line
|
|
507
|
+
this.interactionSid = payload.interaction_sid; // jshint ignore:line
|
|
508
|
+
this.channelSid = payload.channel_sid; // jshint ignore:line
|
|
509
|
+
this.url = payload.url; // jshint ignore:line
|
|
510
|
+
|
|
511
|
+
// Context
|
|
512
|
+
this._context = undefined;
|
|
513
|
+
this._solution = {interactionSid: interactionSid, channelSid: channelSid, sid: sid || this.sid, };
|
|
514
|
+
};
|
|
515
|
+
|
|
516
|
+
Object.defineProperty(InteractionChannelParticipantInstance.prototype,
|
|
517
|
+
'_proxy', {
|
|
518
|
+
get: function() {
|
|
519
|
+
if (!this._context) {
|
|
520
|
+
this._context = new InteractionChannelParticipantContext(
|
|
521
|
+
this._version,
|
|
522
|
+
this._solution.interactionSid,
|
|
523
|
+
this._solution.channelSid,
|
|
524
|
+
this._solution.sid
|
|
525
|
+
);
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
return this._context;
|
|
529
|
+
}
|
|
530
|
+
});
|
|
531
|
+
|
|
532
|
+
/* jshint ignore:start */
|
|
533
|
+
/**
|
|
534
|
+
* update a InteractionChannelParticipantInstance
|
|
535
|
+
*
|
|
536
|
+
* @function update
|
|
537
|
+
* @memberof Twilio.FlexApi.V1.InteractionContext.InteractionChannelContext.InteractionChannelParticipantInstance#
|
|
538
|
+
*
|
|
539
|
+
* @param {object} opts - Options for request
|
|
540
|
+
* @param {interaction_channel_participant.status} opts.status -
|
|
541
|
+
* The Participant's status.
|
|
542
|
+
* @param {function} [callback] - Callback to handle processed record
|
|
543
|
+
*
|
|
544
|
+
* @returns {Promise} Resolves to processed InteractionChannelParticipantInstance
|
|
545
|
+
*/
|
|
546
|
+
/* jshint ignore:end */
|
|
547
|
+
InteractionChannelParticipantInstance.prototype.update = function update(opts,
|
|
548
|
+
callback) {
|
|
549
|
+
return this._proxy.update(opts, callback);
|
|
550
|
+
};
|
|
551
|
+
|
|
552
|
+
/* jshint ignore:start */
|
|
553
|
+
/**
|
|
554
|
+
* Provide a user-friendly representation
|
|
555
|
+
*
|
|
556
|
+
* @function toJSON
|
|
557
|
+
* @memberof Twilio.FlexApi.V1.InteractionContext.InteractionChannelContext.InteractionChannelParticipantInstance#
|
|
558
|
+
*
|
|
559
|
+
* @returns Object
|
|
560
|
+
*/
|
|
561
|
+
/* jshint ignore:end */
|
|
562
|
+
InteractionChannelParticipantInstance.prototype.toJSON = function toJSON() {
|
|
563
|
+
let clone = {};
|
|
564
|
+
_.forOwn(this, function(value, key) {
|
|
565
|
+
if (!_.startsWith(key, '_') && ! _.isFunction(value)) {
|
|
566
|
+
clone[key] = value;
|
|
567
|
+
}
|
|
568
|
+
});
|
|
569
|
+
return clone;
|
|
570
|
+
};
|
|
571
|
+
|
|
572
|
+
InteractionChannelParticipantInstance.prototype[util.inspect.custom] = function
|
|
573
|
+
inspect(depth, options) {
|
|
574
|
+
return util.inspect(this.toJSON(), options);
|
|
575
|
+
};
|
|
576
|
+
|
|
577
|
+
|
|
578
|
+
/* jshint ignore:start */
|
|
579
|
+
/**
|
|
580
|
+
* Initialize the InteractionChannelParticipantContext
|
|
581
|
+
*
|
|
582
|
+
* @constructor Twilio.FlexApi.V1.InteractionContext.InteractionChannelContext.InteractionChannelParticipantContext
|
|
583
|
+
*
|
|
584
|
+
* @param {V1} version - Version of the resource
|
|
585
|
+
* @param {sid} interactionSid - The Interaction Sid for this channel.
|
|
586
|
+
* @param {sid} channelSid - The Channel Sid for this Participant.
|
|
587
|
+
* @param {sid} sid - The unique string that identifies the resource
|
|
588
|
+
*/
|
|
589
|
+
/* jshint ignore:end */
|
|
590
|
+
InteractionChannelParticipantContext = function
|
|
591
|
+
InteractionChannelParticipantContext(version, interactionSid, channelSid,
|
|
592
|
+
sid) {
|
|
593
|
+
this._version = version;
|
|
594
|
+
|
|
595
|
+
// Path Solution
|
|
596
|
+
this._solution = {interactionSid: interactionSid, channelSid: channelSid, sid: sid, };
|
|
597
|
+
this._uri = `/Interactions/${interactionSid}/Channels/${channelSid}/Participants/${sid}`;
|
|
598
|
+
};
|
|
599
|
+
|
|
600
|
+
/* jshint ignore:start */
|
|
601
|
+
/**
|
|
602
|
+
* update a InteractionChannelParticipantInstance
|
|
603
|
+
*
|
|
604
|
+
* @function update
|
|
605
|
+
* @memberof Twilio.FlexApi.V1.InteractionContext.InteractionChannelContext.InteractionChannelParticipantContext#
|
|
606
|
+
*
|
|
607
|
+
* @param {object} opts - Options for request
|
|
608
|
+
* @param {interaction_channel_participant.status} opts.status -
|
|
609
|
+
* The Participant's status.
|
|
610
|
+
* @param {function} [callback] - Callback to handle processed record
|
|
611
|
+
*
|
|
612
|
+
* @returns {Promise} Resolves to processed InteractionChannelParticipantInstance
|
|
613
|
+
*/
|
|
614
|
+
/* jshint ignore:end */
|
|
615
|
+
InteractionChannelParticipantContext.prototype.update = function update(opts,
|
|
616
|
+
callback) {
|
|
617
|
+
if (_.isUndefined(opts)) {
|
|
618
|
+
throw new Error('Required parameter "opts" missing.');
|
|
619
|
+
}
|
|
620
|
+
if (_.isUndefined(opts['status'])) {
|
|
621
|
+
throw new Error('Required parameter "opts[\'status\']" missing.');
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
var deferred = Q.defer();
|
|
625
|
+
var data = values.of({'Status': _.get(opts, 'status')});
|
|
626
|
+
|
|
627
|
+
var promise = this._version.update({uri: this._uri, method: 'POST', data: data});
|
|
628
|
+
|
|
629
|
+
promise = promise.then(function(payload) {
|
|
630
|
+
deferred.resolve(new InteractionChannelParticipantInstance(
|
|
631
|
+
this._version,
|
|
632
|
+
payload,
|
|
633
|
+
this._solution.interactionSid,
|
|
634
|
+
this._solution.channelSid,
|
|
635
|
+
this._solution.sid
|
|
636
|
+
));
|
|
637
|
+
}.bind(this));
|
|
638
|
+
|
|
639
|
+
promise.catch(function(error) {
|
|
640
|
+
deferred.reject(error);
|
|
641
|
+
});
|
|
642
|
+
|
|
643
|
+
if (_.isFunction(callback)) {
|
|
644
|
+
deferred.promise.nodeify(callback);
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
return deferred.promise;
|
|
648
|
+
};
|
|
649
|
+
|
|
650
|
+
/* jshint ignore:start */
|
|
651
|
+
/**
|
|
652
|
+
* Provide a user-friendly representation
|
|
653
|
+
*
|
|
654
|
+
* @function toJSON
|
|
655
|
+
* @memberof Twilio.FlexApi.V1.InteractionContext.InteractionChannelContext.InteractionChannelParticipantContext#
|
|
656
|
+
*
|
|
657
|
+
* @returns Object
|
|
658
|
+
*/
|
|
659
|
+
/* jshint ignore:end */
|
|
660
|
+
InteractionChannelParticipantContext.prototype.toJSON = function toJSON() {
|
|
661
|
+
return this._solution;
|
|
662
|
+
};
|
|
663
|
+
|
|
664
|
+
InteractionChannelParticipantContext.prototype[util.inspect.custom] = function
|
|
665
|
+
inspect(depth, options) {
|
|
666
|
+
return util.inspect(this.toJSON(), options);
|
|
667
|
+
};
|
|
668
|
+
|
|
669
|
+
module.exports = {
|
|
670
|
+
InteractionChannelParticipantList: InteractionChannelParticipantList,
|
|
671
|
+
InteractionChannelParticipantPage: InteractionChannelParticipantPage,
|
|
672
|
+
InteractionChannelParticipantInstance: InteractionChannelParticipantInstance,
|
|
673
|
+
InteractionChannelParticipantContext: InteractionChannelParticipantContext
|
|
674
|
+
};
|