twilio 3.74.0 → 3.76.0

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