twilio 3.75.1 → 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 (64) 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/Supersim.d.ts +0 -2
  8. package/lib/rest/Supersim.js +0 -8
  9. package/lib/rest/api/v2010/account/call/payment.d.ts +1 -1
  10. package/lib/rest/api/v2010/account/call/payment.js +1 -1
  11. package/lib/rest/api/v2010/account/call/stream.d.ts +2 -8
  12. package/lib/rest/api/v2010/account/call/stream.js +8 -7
  13. package/lib/rest/api/v2010/account/usage/record/allTime.d.ts +1 -1
  14. package/lib/rest/api/v2010/account/usage/record/daily.d.ts +1 -1
  15. package/lib/rest/api/v2010/account/usage/record/lastMonth.d.ts +1 -1
  16. package/lib/rest/api/v2010/account/usage/record/monthly.d.ts +1 -1
  17. package/lib/rest/api/v2010/account/usage/record/thisMonth.d.ts +1 -1
  18. package/lib/rest/api/v2010/account/usage/record/today.d.ts +1 -1
  19. package/lib/rest/api/v2010/account/usage/record/yearly.d.ts +1 -1
  20. package/lib/rest/api/v2010/account/usage/record/yesterday.d.ts +1 -1
  21. package/lib/rest/api/v2010/account/usage/record.d.ts +1 -1
  22. package/lib/rest/api/v2010/account/usage/trigger.d.ts +1 -1
  23. package/lib/rest/chat/V3.d.ts +25 -0
  24. package/lib/rest/chat/V3.js +46 -0
  25. package/lib/rest/chat/v3/channel.d.ts +177 -0
  26. package/lib/rest/chat/v3/channel.js +373 -0
  27. package/lib/rest/flexApi/V1.d.ts +3 -0
  28. package/lib/rest/flexApi/V1.js +11 -0
  29. package/lib/rest/flexApi/v1/configuration.d.ts +2 -0
  30. package/lib/rest/flexApi/v1/configuration.js +3 -0
  31. package/lib/rest/flexApi/v1/interaction/interactionChannel/interactionChannelInvite.d.ts +266 -0
  32. package/lib/rest/flexApi/v1/interaction/interactionChannel/interactionChannelInvite.js +505 -0
  33. package/lib/rest/flexApi/v1/interaction/interactionChannel/interactionChannelParticipant.d.ts +323 -0
  34. package/lib/rest/flexApi/v1/interaction/interactionChannel/interactionChannelParticipant.js +674 -0
  35. package/lib/rest/flexApi/v1/interaction/interactionChannel.d.ts +327 -0
  36. package/lib/rest/flexApi/v1/interaction/interactionChannel.js +718 -0
  37. package/lib/rest/flexApi/v1/interaction.d.ts +152 -0
  38. package/lib/rest/flexApi/v1/interaction.js +395 -0
  39. package/lib/rest/insights/V1.d.ts +3 -0
  40. package/lib/rest/insights/V1.js +11 -0
  41. package/lib/rest/insights/v1/annotation.d.ts +188 -0
  42. package/lib/rest/insights/v1/annotation.js +406 -0
  43. package/lib/rest/media/v1/mediaProcessor.js +1 -1
  44. package/lib/rest/media/v1/mediaRecording.d.ts +12 -0
  45. package/lib/rest/media/v1/mediaRecording.js +8 -0
  46. package/lib/rest/media/v1/playerStreamer.d.ts +4 -0
  47. package/lib/rest/media/v1/playerStreamer.js +5 -1
  48. package/lib/rest/supersim/V1.d.ts +0 -3
  49. package/lib/rest/supersim/V1.js +0 -11
  50. package/lib/rest/supersim/v1/fleet.d.ts +0 -16
  51. package/lib/rest/supersim/v1/fleet.js +0 -18
  52. package/lib/rest/taskrouter/v1/workspace/taskQueue/taskQueueCumulativeStatistics.d.ts +1 -1
  53. package/lib/rest/taskrouter/v1/workspace/taskQueue/taskQueueCumulativeStatistics.js +2 -2
  54. package/lib/rest/taskrouter/v1/workspace/workflow/workflowCumulativeStatistics.d.ts +1 -1
  55. package/lib/rest/taskrouter/v1/workspace/workflow/workflowCumulativeStatistics.js +2 -2
  56. package/lib/rest/taskrouter/v1/workspace/workspaceCumulativeStatistics.d.ts +1 -1
  57. package/lib/rest/taskrouter/v1/workspace/workspaceCumulativeStatistics.js +2 -2
  58. package/lib/rest/video/v1/composition.d.ts +4 -0
  59. package/lib/rest/video/v1/composition.js +6 -0
  60. package/lib/rest/video/v1/recording.d.ts +4 -0
  61. package/lib/rest/video/v1/recording.js +6 -0
  62. package/package.json +3 -3
  63. package/lib/rest/supersim/v1/command.d.ts +0 -342
  64. package/lib/rest/supersim/v1/command.js +0 -652
@@ -1,652 +0,0 @@
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 deserialize = require(
17
- '../../../base/deserialize'); /* jshint ignore:line */
18
- var values = require('../../../base/values'); /* jshint ignore:line */
19
-
20
- var CommandList;
21
- var CommandPage;
22
- var CommandInstance;
23
- var CommandContext;
24
-
25
- /* jshint ignore:start */
26
- /**
27
- * Initialize the CommandList
28
- *
29
- * PLEASE NOTE that this class contains beta products that are subject to change.
30
- * Use them with caution.
31
- *
32
- * @constructor Twilio.Supersim.V1.CommandList
33
- *
34
- * @param {Twilio.Supersim.V1} version - Version of the resource
35
- */
36
- /* jshint ignore:end */
37
- CommandList = function CommandList(version) {
38
- /* jshint ignore:start */
39
- /**
40
- * @function commands
41
- * @memberof Twilio.Supersim.V1#
42
- *
43
- * @param {string} sid - sid of instance
44
- *
45
- * @returns {Twilio.Supersim.V1.CommandContext}
46
- */
47
- /* jshint ignore:end */
48
- function CommandListInstance(sid) {
49
- return CommandListInstance.get(sid);
50
- }
51
-
52
- CommandListInstance._version = version;
53
- // Path Solution
54
- CommandListInstance._solution = {};
55
- CommandListInstance._uri = `/Commands`;
56
- /* jshint ignore:start */
57
- /**
58
- * create a CommandInstance
59
- *
60
- * @function create
61
- * @memberof Twilio.Supersim.V1.CommandList#
62
- *
63
- * @param {object} opts - Options for request
64
- * @param {string} opts.sim -
65
- * The sid or unique_name of the SIM to send the Command to
66
- * @param {string} opts.command - The message body of the command
67
- * @param {string} [opts.callbackMethod] -
68
- * The HTTP method we should use to call callback_url
69
- * @param {string} [opts.callbackUrl] -
70
- * The URL we should call after we have sent the command
71
- * @param {function} [callback] - Callback to handle processed record
72
- *
73
- * @returns {Promise} Resolves to processed CommandInstance
74
- */
75
- /* jshint ignore:end */
76
- CommandListInstance.create = function create(opts, callback) {
77
- if (_.isUndefined(opts)) {
78
- throw new Error('Required parameter "opts" missing.');
79
- }
80
- if (_.isUndefined(opts['sim'])) {
81
- throw new Error('Required parameter "opts[\'sim\']" missing.');
82
- }
83
- if (_.isUndefined(opts['command'])) {
84
- throw new Error('Required parameter "opts[\'command\']" missing.');
85
- }
86
-
87
- var deferred = Q.defer();
88
- var data = values.of({
89
- 'Sim': _.get(opts, 'sim'),
90
- 'Command': _.get(opts, 'command'),
91
- 'CallbackMethod': _.get(opts, 'callbackMethod'),
92
- 'CallbackUrl': _.get(opts, 'callbackUrl')
93
- });
94
-
95
- var promise = this._version.create({uri: this._uri, method: 'POST', data: data});
96
-
97
- promise = promise.then(function(payload) {
98
- deferred.resolve(new CommandInstance(this._version, payload, this._solution.sid));
99
- }.bind(this));
100
-
101
- promise.catch(function(error) {
102
- deferred.reject(error);
103
- });
104
-
105
- if (_.isFunction(callback)) {
106
- deferred.promise.nodeify(callback);
107
- }
108
-
109
- return deferred.promise;
110
- };
111
-
112
- /* jshint ignore:start */
113
- /**
114
- * Streams CommandInstance records from the API.
115
- *
116
- * This operation lazily loads records as efficiently as possible until the limit
117
- * is reached.
118
- *
119
- * The results are passed into the callback function, so this operation is memory
120
- * efficient.
121
- *
122
- * If a function is passed as the first argument, it will be used as the callback
123
- * function.
124
- *
125
- * @function each
126
- * @memberof Twilio.Supersim.V1.CommandList#
127
- *
128
- * @param {object} [opts] - Options for request
129
- * @param {string} [opts.sim] -
130
- * The SID or unique name of the Sim that Command was sent to or from.
131
- * @param {command.status} [opts.status] - The status of the Command
132
- * @param {command.direction} [opts.direction] - The direction of the Command
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
- CommandListInstance.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 CommandInstance 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.Supersim.V1.CommandList#
220
- *
221
- * @param {object} [opts] - Options for request
222
- * @param {string} [opts.sim] -
223
- * The SID or unique name of the Sim that Command was sent to or from.
224
- * @param {command.status} [opts.status] - The status of the Command
225
- * @param {command.direction} [opts.direction] - The direction of the Command
226
- * @param {number} [opts.limit] -
227
- * Upper limit for the number of records to return.
228
- * list() guarantees never to return more than limit.
229
- * Default is no limit
230
- * @param {number} [opts.pageSize] -
231
- * Number of records to fetch per request,
232
- * when not set will use the default value of 50 records.
233
- * If no page_size is defined but a limit is defined,
234
- * list() will attempt to read the limit with the most
235
- * efficient page size, i.e. min(limit, 1000)
236
- * @param {function} [callback] - Callback to handle list of records
237
- *
238
- * @returns {Promise} Resolves to a list of records
239
- */
240
- /* jshint ignore:end */
241
- CommandListInstance.list = function list(opts, callback) {
242
- if (_.isFunction(opts)) {
243
- callback = opts;
244
- opts = {};
245
- }
246
- opts = opts || {};
247
- var deferred = Q.defer();
248
- var allResources = [];
249
- opts.callback = function(resource, done) {
250
- allResources.push(resource);
251
-
252
- if (!_.isUndefined(opts.limit) && allResources.length === opts.limit) {
253
- done();
254
- }
255
- };
256
-
257
- opts.done = function(error) {
258
- if (_.isUndefined(error)) {
259
- deferred.resolve(allResources);
260
- } else {
261
- deferred.reject(error);
262
- }
263
- };
264
-
265
- if (_.isFunction(callback)) {
266
- deferred.promise.nodeify(callback);
267
- }
268
-
269
- this.each(opts);
270
- return deferred.promise;
271
- };
272
-
273
- /* jshint ignore:start */
274
- /**
275
- * Retrieve a single page of CommandInstance records from the API.
276
- *
277
- * The request is executed immediately.
278
- *
279
- * If a function is passed as the first argument, it will be used as the callback
280
- * function.
281
- *
282
- * @function page
283
- * @memberof Twilio.Supersim.V1.CommandList#
284
- *
285
- * @param {object} [opts] - Options for request
286
- * @param {string} [opts.sim] -
287
- * The SID or unique name of the Sim that Command was sent to or from.
288
- * @param {command.status} [opts.status] - The status of the Command
289
- * @param {command.direction} [opts.direction] - The direction of the Command
290
- * @param {string} [opts.pageToken] - PageToken provided by the API
291
- * @param {number} [opts.pageNumber] -
292
- * Page Number, this value is simply for client state
293
- * @param {number} [opts.pageSize] - Number of records to return, defaults to 50
294
- * @param {function} [callback] - Callback to handle list of records
295
- *
296
- * @returns {Promise} Resolves to a list of records
297
- */
298
- /* jshint ignore:end */
299
- CommandListInstance.page = function page(opts, callback) {
300
- if (_.isFunction(opts)) {
301
- callback = opts;
302
- opts = {};
303
- }
304
- opts = opts || {};
305
-
306
- var deferred = Q.defer();
307
- var data = values.of({
308
- 'Sim': _.get(opts, 'sim'),
309
- 'Status': _.get(opts, 'status'),
310
- 'Direction': _.get(opts, 'direction'),
311
- 'PageToken': opts.pageToken,
312
- 'Page': opts.pageNumber,
313
- 'PageSize': opts.pageSize
314
- });
315
-
316
- var promise = this._version.page({uri: this._uri, method: 'GET', params: data});
317
-
318
- promise = promise.then(function(payload) {
319
- deferred.resolve(new CommandPage(this._version, payload, this._solution));
320
- }.bind(this));
321
-
322
- promise.catch(function(error) {
323
- deferred.reject(error);
324
- });
325
-
326
- if (_.isFunction(callback)) {
327
- deferred.promise.nodeify(callback);
328
- }
329
-
330
- return deferred.promise;
331
- };
332
-
333
- /* jshint ignore:start */
334
- /**
335
- * Retrieve a single target page of CommandInstance records from the API.
336
- *
337
- * The request is executed immediately.
338
- *
339
- * If a function is passed as the first argument, it will be used as the callback
340
- * function.
341
- *
342
- * @function getPage
343
- * @memberof Twilio.Supersim.V1.CommandList#
344
- *
345
- * @param {string} [targetUrl] - API-generated URL for the requested results page
346
- * @param {function} [callback] - Callback to handle list of records
347
- *
348
- * @returns {Promise} Resolves to a list of records
349
- */
350
- /* jshint ignore:end */
351
- CommandListInstance.getPage = function getPage(targetUrl, callback) {
352
- var deferred = Q.defer();
353
-
354
- var promise = this._version._domain.twilio.request({method: 'GET', uri: targetUrl});
355
-
356
- promise = promise.then(function(payload) {
357
- deferred.resolve(new CommandPage(this._version, payload, this._solution));
358
- }.bind(this));
359
-
360
- promise.catch(function(error) {
361
- deferred.reject(error);
362
- });
363
-
364
- if (_.isFunction(callback)) {
365
- deferred.promise.nodeify(callback);
366
- }
367
-
368
- return deferred.promise;
369
- };
370
-
371
- /* jshint ignore:start */
372
- /**
373
- * Constructs a command
374
- *
375
- * @function get
376
- * @memberof Twilio.Supersim.V1.CommandList#
377
- *
378
- * @param {string} sid - The SID that identifies the resource to fetch
379
- *
380
- * @returns {Twilio.Supersim.V1.CommandContext}
381
- */
382
- /* jshint ignore:end */
383
- CommandListInstance.get = function get(sid) {
384
- return new CommandContext(this._version, sid);
385
- };
386
-
387
- /* jshint ignore:start */
388
- /**
389
- * Provide a user-friendly representation
390
- *
391
- * @function toJSON
392
- * @memberof Twilio.Supersim.V1.CommandList#
393
- *
394
- * @returns Object
395
- */
396
- /* jshint ignore:end */
397
- CommandListInstance.toJSON = function toJSON() {
398
- return this._solution;
399
- };
400
-
401
- CommandListInstance[util.inspect.custom] = function inspect(depth, options) {
402
- return util.inspect(this.toJSON(), options);
403
- };
404
-
405
- return CommandListInstance;
406
- };
407
-
408
-
409
- /* jshint ignore:start */
410
- /**
411
- * Initialize the CommandPage
412
- *
413
- * PLEASE NOTE that this class contains beta products that are subject to change.
414
- * Use them with caution.
415
- *
416
- * @constructor Twilio.Supersim.V1.CommandPage
417
- *
418
- * @param {V1} version - Version of the resource
419
- * @param {Response<string>} response - Response from the API
420
- * @param {CommandSolution} solution - Path solution
421
- *
422
- * @returns CommandPage
423
- */
424
- /* jshint ignore:end */
425
- CommandPage = function CommandPage(version, response, solution) {
426
- // Path Solution
427
- this._solution = solution;
428
-
429
- Page.prototype.constructor.call(this, version, response, this._solution);
430
- };
431
-
432
- _.extend(CommandPage.prototype, Page.prototype);
433
- CommandPage.prototype.constructor = CommandPage;
434
-
435
- /* jshint ignore:start */
436
- /**
437
- * Build an instance of CommandInstance
438
- *
439
- * @function getInstance
440
- * @memberof Twilio.Supersim.V1.CommandPage#
441
- *
442
- * @param {CommandPayload} payload - Payload response from the API
443
- *
444
- * @returns CommandInstance
445
- */
446
- /* jshint ignore:end */
447
- CommandPage.prototype.getInstance = function getInstance(payload) {
448
- return new CommandInstance(this._version, payload);
449
- };
450
-
451
- /* jshint ignore:start */
452
- /**
453
- * Provide a user-friendly representation
454
- *
455
- * @function toJSON
456
- * @memberof Twilio.Supersim.V1.CommandPage#
457
- *
458
- * @returns Object
459
- */
460
- /* jshint ignore:end */
461
- CommandPage.prototype.toJSON = function toJSON() {
462
- let clone = {};
463
- _.forOwn(this, function(value, key) {
464
- if (!_.startsWith(key, '_') && ! _.isFunction(value)) {
465
- clone[key] = value;
466
- }
467
- });
468
- return clone;
469
- };
470
-
471
- CommandPage.prototype[util.inspect.custom] = function inspect(depth, options) {
472
- return util.inspect(this.toJSON(), options);
473
- };
474
-
475
-
476
- /* jshint ignore:start */
477
- /**
478
- * Initialize the CommandContext
479
- *
480
- * PLEASE NOTE that this class contains beta products that are subject to change.
481
- * Use them with caution.
482
- *
483
- * @constructor Twilio.Supersim.V1.CommandInstance
484
- *
485
- * @property {string} sid - The unique string that identifies the resource
486
- * @property {string} accountSid - The SID of the Account that created the resource
487
- * @property {string} simSid -
488
- * The SID of the SIM that this Command was sent to or from
489
- * @property {string} command -
490
- * The message body of the command sent to or from the SIM
491
- * @property {command.status} status - The status of the Command
492
- * @property {command.direction} direction - The direction of the Command
493
- * @property {Date} dateCreated -
494
- * The ISO 8601 date and time in GMT when the resource was created
495
- * @property {Date} dateUpdated -
496
- * The ISO 8601 date and time in GMT when the resource was last updated
497
- * @property {string} url - The absolute URL of the Command resource
498
- *
499
- * @param {V1} version - Version of the resource
500
- * @param {CommandPayload} payload - The instance payload
501
- * @param {sid} sid - The SID that identifies the resource to fetch
502
- */
503
- /* jshint ignore:end */
504
- CommandInstance = function CommandInstance(version, payload, sid) {
505
- this._version = version;
506
-
507
- // Marshaled Properties
508
- this.sid = payload.sid; // jshint ignore:line
509
- this.accountSid = payload.account_sid; // jshint ignore:line
510
- this.simSid = payload.sim_sid; // jshint ignore:line
511
- this.command = payload.command; // jshint ignore:line
512
- this.status = payload.status; // jshint ignore:line
513
- this.direction = payload.direction; // jshint ignore:line
514
- this.dateCreated = deserialize.iso8601DateTime(payload.date_created); // jshint ignore:line
515
- this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); // jshint ignore:line
516
- this.url = payload.url; // jshint ignore:line
517
-
518
- // Context
519
- this._context = undefined;
520
- this._solution = {sid: sid || this.sid, };
521
- };
522
-
523
- Object.defineProperty(CommandInstance.prototype,
524
- '_proxy', {
525
- get: function() {
526
- if (!this._context) {
527
- this._context = new CommandContext(this._version, this._solution.sid);
528
- }
529
-
530
- return this._context;
531
- }
532
- });
533
-
534
- /* jshint ignore:start */
535
- /**
536
- * fetch a CommandInstance
537
- *
538
- * @function fetch
539
- * @memberof Twilio.Supersim.V1.CommandInstance#
540
- *
541
- * @param {function} [callback] - Callback to handle processed record
542
- *
543
- * @returns {Promise} Resolves to processed CommandInstance
544
- */
545
- /* jshint ignore:end */
546
- CommandInstance.prototype.fetch = function fetch(callback) {
547
- return this._proxy.fetch(callback);
548
- };
549
-
550
- /* jshint ignore:start */
551
- /**
552
- * Provide a user-friendly representation
553
- *
554
- * @function toJSON
555
- * @memberof Twilio.Supersim.V1.CommandInstance#
556
- *
557
- * @returns Object
558
- */
559
- /* jshint ignore:end */
560
- CommandInstance.prototype.toJSON = function toJSON() {
561
- let clone = {};
562
- _.forOwn(this, function(value, key) {
563
- if (!_.startsWith(key, '_') && ! _.isFunction(value)) {
564
- clone[key] = value;
565
- }
566
- });
567
- return clone;
568
- };
569
-
570
- CommandInstance.prototype[util.inspect.custom] = function inspect(depth,
571
- options) {
572
- return util.inspect(this.toJSON(), options);
573
- };
574
-
575
-
576
- /* jshint ignore:start */
577
- /**
578
- * Initialize the CommandContext
579
- *
580
- * PLEASE NOTE that this class contains beta products that are subject to change.
581
- * Use them with caution.
582
- *
583
- * @constructor Twilio.Supersim.V1.CommandContext
584
- *
585
- * @param {V1} version - Version of the resource
586
- * @param {sid} sid - The SID that identifies the resource to fetch
587
- */
588
- /* jshint ignore:end */
589
- CommandContext = function CommandContext(version, sid) {
590
- this._version = version;
591
-
592
- // Path Solution
593
- this._solution = {sid: sid, };
594
- this._uri = `/Commands/${sid}`;
595
- };
596
-
597
- /* jshint ignore:start */
598
- /**
599
- * fetch a CommandInstance
600
- *
601
- * @function fetch
602
- * @memberof Twilio.Supersim.V1.CommandContext#
603
- *
604
- * @param {function} [callback] - Callback to handle processed record
605
- *
606
- * @returns {Promise} Resolves to processed CommandInstance
607
- */
608
- /* jshint ignore:end */
609
- CommandContext.prototype.fetch = function fetch(callback) {
610
- var deferred = Q.defer();
611
- var promise = this._version.fetch({uri: this._uri, method: 'GET'});
612
-
613
- promise = promise.then(function(payload) {
614
- deferred.resolve(new CommandInstance(this._version, payload, this._solution.sid));
615
- }.bind(this));
616
-
617
- promise.catch(function(error) {
618
- deferred.reject(error);
619
- });
620
-
621
- if (_.isFunction(callback)) {
622
- deferred.promise.nodeify(callback);
623
- }
624
-
625
- return deferred.promise;
626
- };
627
-
628
- /* jshint ignore:start */
629
- /**
630
- * Provide a user-friendly representation
631
- *
632
- * @function toJSON
633
- * @memberof Twilio.Supersim.V1.CommandContext#
634
- *
635
- * @returns Object
636
- */
637
- /* jshint ignore:end */
638
- CommandContext.prototype.toJSON = function toJSON() {
639
- return this._solution;
640
- };
641
-
642
- CommandContext.prototype[util.inspect.custom] = function inspect(depth, options)
643
- {
644
- return util.inspect(this.toJSON(), options);
645
- };
646
-
647
- module.exports = {
648
- CommandList: CommandList,
649
- CommandPage: CommandPage,
650
- CommandInstance: CommandInstance,
651
- CommandContext: CommandContext
652
- };