twilio 3.80.0 → 3.80.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/lib/rest/Microvisor.d.ts +28 -0
- package/lib/rest/Microvisor.js +62 -0
- package/lib/rest/Preview.d.ts +0 -6
- package/lib/rest/Preview.js +0 -28
- package/lib/rest/Routes.d.ts +30 -0
- package/lib/rest/Routes.js +71 -0
- package/lib/rest/Twilio.d.ts +4 -0
- package/lib/rest/Twilio.js +28 -0
- package/lib/rest/api/v2010/account/sip/ipAccessControlList/ipAddress.d.ts +2 -2
- package/lib/rest/api/v2010/account/sip/ipAccessControlList/ipAddress.js +4 -4
- package/lib/rest/microvisor/V1.d.ts +28 -0
- package/lib/rest/microvisor/V1.js +57 -0
- package/lib/rest/{preview/bulk_exports/export/day.d.ts → microvisor/v1/app.d.ts} +79 -69
- package/lib/rest/{preview/bulk_exports/export/day.js → microvisor/v1/app.js} +160 -122
- package/lib/rest/{preview/bulk_exports/export/exportCustomJob.d.ts → microvisor/v1/device.d.ts} +136 -84
- package/lib/rest/microvisor/v1/device.js +652 -0
- package/lib/rest/routes/V2.d.ts +31 -0
- package/lib/rest/routes/V2.js +69 -0
- package/lib/rest/routes/v2/phoneNumber.d.ts +193 -0
- package/lib/rest/routes/v2/phoneNumber.js +466 -0
- package/lib/rest/routes/v2/sipDomain.d.ts +205 -0
- package/lib/rest/routes/v2/sipDomain.js +447 -0
- package/lib/rest/routes/v2/trunk.d.ts +205 -0
- package/lib/rest/routes/v2/trunk.js +458 -0
- package/lib/rest/supersim/v1/fleet.d.ts +3 -1
- package/lib/rest/supersim/v1/fleet.js +8 -3
- package/package.json +1 -1
- package/lib/rest/preview/BulkExports.d.ts +0 -28
- package/lib/rest/preview/BulkExports.js +0 -59
- package/lib/rest/preview/bulk_exports/export/exportCustomJob.js +0 -540
- package/lib/rest/preview/bulk_exports/export/job.d.ts +0 -163
- package/lib/rest/preview/bulk_exports/export/job.js +0 -390
- package/lib/rest/preview/bulk_exports/export.d.ts +0 -153
- package/lib/rest/preview/bulk_exports/export.js +0 -402
- package/lib/rest/preview/bulk_exports/exportConfiguration.d.ts +0 -180
- package/lib/rest/preview/bulk_exports/exportConfiguration.js +0 -411
|
@@ -12,53 +12,51 @@
|
|
|
12
12
|
var Q = require('q'); /* jshint ignore:line */
|
|
13
13
|
var _ = require('lodash'); /* jshint ignore:line */
|
|
14
14
|
var util = require('util'); /* jshint ignore:line */
|
|
15
|
-
var Page = require('
|
|
15
|
+
var Page = require('../../../base/Page'); /* jshint ignore:line */
|
|
16
16
|
var deserialize = require(
|
|
17
|
-
'
|
|
18
|
-
var values = require('
|
|
17
|
+
'../../../base/deserialize'); /* jshint ignore:line */
|
|
18
|
+
var values = require('../../../base/values'); /* jshint ignore:line */
|
|
19
19
|
|
|
20
|
-
var
|
|
21
|
-
var
|
|
22
|
-
var
|
|
23
|
-
var
|
|
20
|
+
var AppList;
|
|
21
|
+
var AppPage;
|
|
22
|
+
var AppInstance;
|
|
23
|
+
var AppContext;
|
|
24
24
|
|
|
25
25
|
/* jshint ignore:start */
|
|
26
26
|
/**
|
|
27
|
-
* Initialize the
|
|
27
|
+
* Initialize the AppList
|
|
28
28
|
*
|
|
29
29
|
* PLEASE NOTE that this class contains preview products that are subject to
|
|
30
30
|
* change. Use them with caution. If you currently do not have developer preview
|
|
31
31
|
* access, please contact help@twilio.com.
|
|
32
32
|
*
|
|
33
|
-
* @constructor Twilio.
|
|
33
|
+
* @constructor Twilio.Microvisor.V1.AppList
|
|
34
34
|
*
|
|
35
|
-
* @param {Twilio.
|
|
36
|
-
* @param {string} resourceType -
|
|
37
|
-
* The type of communication – Messages, Calls, Conferences, and Participants
|
|
35
|
+
* @param {Twilio.Microvisor.V1} version - Version of the resource
|
|
38
36
|
*/
|
|
39
37
|
/* jshint ignore:end */
|
|
40
|
-
|
|
38
|
+
AppList = function AppList(version) {
|
|
41
39
|
/* jshint ignore:start */
|
|
42
40
|
/**
|
|
43
|
-
* @function
|
|
44
|
-
* @memberof Twilio.
|
|
41
|
+
* @function apps
|
|
42
|
+
* @memberof Twilio.Microvisor.V1#
|
|
45
43
|
*
|
|
46
44
|
* @param {string} sid - sid of instance
|
|
47
45
|
*
|
|
48
|
-
* @returns {Twilio.
|
|
46
|
+
* @returns {Twilio.Microvisor.V1.AppContext}
|
|
49
47
|
*/
|
|
50
48
|
/* jshint ignore:end */
|
|
51
|
-
function
|
|
52
|
-
return
|
|
49
|
+
function AppListInstance(sid) {
|
|
50
|
+
return AppListInstance.get(sid);
|
|
53
51
|
}
|
|
54
52
|
|
|
55
|
-
|
|
53
|
+
AppListInstance._version = version;
|
|
56
54
|
// Path Solution
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
AppListInstance._solution = {};
|
|
56
|
+
AppListInstance._uri = `/Apps`;
|
|
59
57
|
/* jshint ignore:start */
|
|
60
58
|
/**
|
|
61
|
-
* Streams
|
|
59
|
+
* Streams AppInstance records from the API.
|
|
62
60
|
*
|
|
63
61
|
* This operation lazily loads records as efficiently as possible until the limit
|
|
64
62
|
* is reached.
|
|
@@ -70,7 +68,7 @@ DayList = function DayList(version, resourceType) {
|
|
|
70
68
|
* function.
|
|
71
69
|
*
|
|
72
70
|
* @function each
|
|
73
|
-
* @memberof Twilio.
|
|
71
|
+
* @memberof Twilio.Microvisor.V1.AppList#
|
|
74
72
|
*
|
|
75
73
|
* @param {object} [opts] - Options for request
|
|
76
74
|
* @param {number} [opts.limit] -
|
|
@@ -91,7 +89,7 @@ DayList = function DayList(version, resourceType) {
|
|
|
91
89
|
* @param {Function} [callback] - Function to process each record
|
|
92
90
|
*/
|
|
93
91
|
/* jshint ignore:end */
|
|
94
|
-
|
|
92
|
+
AppListInstance.each = function each(opts, callback) {
|
|
95
93
|
if (_.isFunction(opts)) {
|
|
96
94
|
callback = opts;
|
|
97
95
|
opts = {};
|
|
@@ -153,13 +151,13 @@ DayList = function DayList(version, resourceType) {
|
|
|
153
151
|
|
|
154
152
|
/* jshint ignore:start */
|
|
155
153
|
/**
|
|
156
|
-
* Lists
|
|
154
|
+
* Lists AppInstance records from the API as a list.
|
|
157
155
|
*
|
|
158
156
|
* If a function is passed as the first argument, it will be used as the callback
|
|
159
157
|
* function.
|
|
160
158
|
*
|
|
161
159
|
* @function list
|
|
162
|
-
* @memberof Twilio.
|
|
160
|
+
* @memberof Twilio.Microvisor.V1.AppList#
|
|
163
161
|
*
|
|
164
162
|
* @param {object} [opts] - Options for request
|
|
165
163
|
* @param {number} [opts.limit] -
|
|
@@ -177,7 +175,7 @@ DayList = function DayList(version, resourceType) {
|
|
|
177
175
|
* @returns {Promise} Resolves to a list of records
|
|
178
176
|
*/
|
|
179
177
|
/* jshint ignore:end */
|
|
180
|
-
|
|
178
|
+
AppListInstance.list = function list(opts, callback) {
|
|
181
179
|
if (_.isFunction(opts)) {
|
|
182
180
|
callback = opts;
|
|
183
181
|
opts = {};
|
|
@@ -211,7 +209,7 @@ DayList = function DayList(version, resourceType) {
|
|
|
211
209
|
|
|
212
210
|
/* jshint ignore:start */
|
|
213
211
|
/**
|
|
214
|
-
* Retrieve a single page of
|
|
212
|
+
* Retrieve a single page of AppInstance records from the API.
|
|
215
213
|
*
|
|
216
214
|
* The request is executed immediately.
|
|
217
215
|
*
|
|
@@ -219,7 +217,7 @@ DayList = function DayList(version, resourceType) {
|
|
|
219
217
|
* function.
|
|
220
218
|
*
|
|
221
219
|
* @function page
|
|
222
|
-
* @memberof Twilio.
|
|
220
|
+
* @memberof Twilio.Microvisor.V1.AppList#
|
|
223
221
|
*
|
|
224
222
|
* @param {object} [opts] - Options for request
|
|
225
223
|
* @param {string} [opts.pageToken] - PageToken provided by the API
|
|
@@ -231,7 +229,7 @@ DayList = function DayList(version, resourceType) {
|
|
|
231
229
|
* @returns {Promise} Resolves to a list of records
|
|
232
230
|
*/
|
|
233
231
|
/* jshint ignore:end */
|
|
234
|
-
|
|
232
|
+
AppListInstance.page = function page(opts, callback) {
|
|
235
233
|
if (_.isFunction(opts)) {
|
|
236
234
|
callback = opts;
|
|
237
235
|
opts = {};
|
|
@@ -248,7 +246,7 @@ DayList = function DayList(version, resourceType) {
|
|
|
248
246
|
var promise = this._version.page({uri: this._uri, method: 'GET', params: data});
|
|
249
247
|
|
|
250
248
|
promise = promise.then(function(payload) {
|
|
251
|
-
deferred.resolve(new
|
|
249
|
+
deferred.resolve(new AppPage(this._version, payload, this._solution));
|
|
252
250
|
}.bind(this));
|
|
253
251
|
|
|
254
252
|
promise.catch(function(error) {
|
|
@@ -264,7 +262,7 @@ DayList = function DayList(version, resourceType) {
|
|
|
264
262
|
|
|
265
263
|
/* jshint ignore:start */
|
|
266
264
|
/**
|
|
267
|
-
* Retrieve a single target page of
|
|
265
|
+
* Retrieve a single target page of AppInstance records from the API.
|
|
268
266
|
*
|
|
269
267
|
* The request is executed immediately.
|
|
270
268
|
*
|
|
@@ -272,7 +270,7 @@ DayList = function DayList(version, resourceType) {
|
|
|
272
270
|
* function.
|
|
273
271
|
*
|
|
274
272
|
* @function getPage
|
|
275
|
-
* @memberof Twilio.
|
|
273
|
+
* @memberof Twilio.Microvisor.V1.AppList#
|
|
276
274
|
*
|
|
277
275
|
* @param {string} [targetUrl] - API-generated URL for the requested results page
|
|
278
276
|
* @param {function} [callback] - Callback to handle list of records
|
|
@@ -280,13 +278,13 @@ DayList = function DayList(version, resourceType) {
|
|
|
280
278
|
* @returns {Promise} Resolves to a list of records
|
|
281
279
|
*/
|
|
282
280
|
/* jshint ignore:end */
|
|
283
|
-
|
|
281
|
+
AppListInstance.getPage = function getPage(targetUrl, callback) {
|
|
284
282
|
var deferred = Q.defer();
|
|
285
283
|
|
|
286
284
|
var promise = this._version._domain.twilio.request({method: 'GET', uri: targetUrl});
|
|
287
285
|
|
|
288
286
|
promise = promise.then(function(payload) {
|
|
289
|
-
deferred.resolve(new
|
|
287
|
+
deferred.resolve(new AppPage(this._version, payload, this._solution));
|
|
290
288
|
}.bind(this));
|
|
291
289
|
|
|
292
290
|
promise.catch(function(error) {
|
|
@@ -302,18 +300,18 @@ DayList = function DayList(version, resourceType) {
|
|
|
302
300
|
|
|
303
301
|
/* jshint ignore:start */
|
|
304
302
|
/**
|
|
305
|
-
* Constructs a
|
|
303
|
+
* Constructs a app
|
|
306
304
|
*
|
|
307
305
|
* @function get
|
|
308
|
-
* @memberof Twilio.
|
|
306
|
+
* @memberof Twilio.Microvisor.V1.AppList#
|
|
309
307
|
*
|
|
310
|
-
* @param {string}
|
|
308
|
+
* @param {string} sid - A string that uniquely identifies this App.
|
|
311
309
|
*
|
|
312
|
-
* @returns {Twilio.
|
|
310
|
+
* @returns {Twilio.Microvisor.V1.AppContext}
|
|
313
311
|
*/
|
|
314
312
|
/* jshint ignore:end */
|
|
315
|
-
|
|
316
|
-
return new
|
|
313
|
+
AppListInstance.get = function get(sid) {
|
|
314
|
+
return new AppContext(this._version, sid);
|
|
317
315
|
};
|
|
318
316
|
|
|
319
317
|
/* jshint ignore:start */
|
|
@@ -321,64 +319,64 @@ DayList = function DayList(version, resourceType) {
|
|
|
321
319
|
* Provide a user-friendly representation
|
|
322
320
|
*
|
|
323
321
|
* @function toJSON
|
|
324
|
-
* @memberof Twilio.
|
|
322
|
+
* @memberof Twilio.Microvisor.V1.AppList#
|
|
325
323
|
*
|
|
326
324
|
* @returns Object
|
|
327
325
|
*/
|
|
328
326
|
/* jshint ignore:end */
|
|
329
|
-
|
|
327
|
+
AppListInstance.toJSON = function toJSON() {
|
|
330
328
|
return this._solution;
|
|
331
329
|
};
|
|
332
330
|
|
|
333
|
-
|
|
331
|
+
AppListInstance[util.inspect.custom] = function inspect(depth, options) {
|
|
334
332
|
return util.inspect(this.toJSON(), options);
|
|
335
333
|
};
|
|
336
334
|
|
|
337
|
-
return
|
|
335
|
+
return AppListInstance;
|
|
338
336
|
};
|
|
339
337
|
|
|
340
338
|
|
|
341
339
|
/* jshint ignore:start */
|
|
342
340
|
/**
|
|
343
|
-
* Initialize the
|
|
341
|
+
* Initialize the AppPage
|
|
344
342
|
*
|
|
345
343
|
* PLEASE NOTE that this class contains preview products that are subject to
|
|
346
344
|
* change. Use them with caution. If you currently do not have developer preview
|
|
347
345
|
* access, please contact help@twilio.com.
|
|
348
346
|
*
|
|
349
|
-
* @constructor Twilio.
|
|
347
|
+
* @constructor Twilio.Microvisor.V1.AppPage
|
|
350
348
|
*
|
|
351
|
-
* @param {
|
|
349
|
+
* @param {V1} version - Version of the resource
|
|
352
350
|
* @param {Response<string>} response - Response from the API
|
|
353
|
-
* @param {
|
|
351
|
+
* @param {AppSolution} solution - Path solution
|
|
354
352
|
*
|
|
355
|
-
* @returns
|
|
353
|
+
* @returns AppPage
|
|
356
354
|
*/
|
|
357
355
|
/* jshint ignore:end */
|
|
358
|
-
|
|
356
|
+
AppPage = function AppPage(version, response, solution) {
|
|
359
357
|
// Path Solution
|
|
360
358
|
this._solution = solution;
|
|
361
359
|
|
|
362
360
|
Page.prototype.constructor.call(this, version, response, this._solution);
|
|
363
361
|
};
|
|
364
362
|
|
|
365
|
-
_.extend(
|
|
366
|
-
|
|
363
|
+
_.extend(AppPage.prototype, Page.prototype);
|
|
364
|
+
AppPage.prototype.constructor = AppPage;
|
|
367
365
|
|
|
368
366
|
/* jshint ignore:start */
|
|
369
367
|
/**
|
|
370
|
-
* Build an instance of
|
|
368
|
+
* Build an instance of AppInstance
|
|
371
369
|
*
|
|
372
370
|
* @function getInstance
|
|
373
|
-
* @memberof Twilio.
|
|
371
|
+
* @memberof Twilio.Microvisor.V1.AppPage#
|
|
374
372
|
*
|
|
375
|
-
* @param {
|
|
373
|
+
* @param {AppPayload} payload - Payload response from the API
|
|
376
374
|
*
|
|
377
|
-
* @returns
|
|
375
|
+
* @returns AppInstance
|
|
378
376
|
*/
|
|
379
377
|
/* jshint ignore:end */
|
|
380
|
-
|
|
381
|
-
return new
|
|
378
|
+
AppPage.prototype.getInstance = function getInstance(payload) {
|
|
379
|
+
return new AppInstance(this._version, payload);
|
|
382
380
|
};
|
|
383
381
|
|
|
384
382
|
/* jshint ignore:start */
|
|
@@ -386,12 +384,12 @@ DayPage.prototype.getInstance = function getInstance(payload) {
|
|
|
386
384
|
* Provide a user-friendly representation
|
|
387
385
|
*
|
|
388
386
|
* @function toJSON
|
|
389
|
-
* @memberof Twilio.
|
|
387
|
+
* @memberof Twilio.Microvisor.V1.AppPage#
|
|
390
388
|
*
|
|
391
389
|
* @returns Object
|
|
392
390
|
*/
|
|
393
391
|
/* jshint ignore:end */
|
|
394
|
-
|
|
392
|
+
AppPage.prototype.toJSON = function toJSON() {
|
|
395
393
|
let clone = {};
|
|
396
394
|
_.forOwn(this, function(value, key) {
|
|
397
395
|
if (!_.startsWith(key, '_') && ! _.isFunction(value)) {
|
|
@@ -401,58 +399,58 @@ DayPage.prototype.toJSON = function toJSON() {
|
|
|
401
399
|
return clone;
|
|
402
400
|
};
|
|
403
401
|
|
|
404
|
-
|
|
402
|
+
AppPage.prototype[util.inspect.custom] = function inspect(depth, options) {
|
|
405
403
|
return util.inspect(this.toJSON(), options);
|
|
406
404
|
};
|
|
407
405
|
|
|
408
406
|
|
|
409
407
|
/* jshint ignore:start */
|
|
410
408
|
/**
|
|
411
|
-
* Initialize the
|
|
409
|
+
* Initialize the AppContext
|
|
412
410
|
*
|
|
413
411
|
* PLEASE NOTE that this class contains preview products that are subject to
|
|
414
412
|
* change. Use them with caution. If you currently do not have developer preview
|
|
415
413
|
* access, please contact help@twilio.com.
|
|
416
414
|
*
|
|
417
|
-
* @constructor Twilio.
|
|
418
|
-
*
|
|
419
|
-
* @property {string}
|
|
420
|
-
* @property {string}
|
|
421
|
-
* @property {
|
|
422
|
-
*
|
|
423
|
-
* @property {string}
|
|
424
|
-
*
|
|
425
|
-
* @property {
|
|
426
|
-
*
|
|
427
|
-
*
|
|
428
|
-
*
|
|
429
|
-
* @param {
|
|
430
|
-
* @param {
|
|
431
|
-
*
|
|
432
|
-
* @param {string} day - The date of the data in the file
|
|
415
|
+
* @constructor Twilio.Microvisor.V1.AppInstance
|
|
416
|
+
*
|
|
417
|
+
* @property {string} sid - A string that uniquely identifies this App.
|
|
418
|
+
* @property {string} accountSid - The Account SID.
|
|
419
|
+
* @property {string} hash -
|
|
420
|
+
* App manifest hash represented as hash_algorithm:hash_value.
|
|
421
|
+
* @property {string} uniqueName -
|
|
422
|
+
* An developer-defined string that uniquely identifies the App.
|
|
423
|
+
* @property {Date} dateCreated - The date that this App was created.
|
|
424
|
+
* @property {Date} dateUpdated - The date that this App was last updated.
|
|
425
|
+
* @property {string} url - The URL of this resource.
|
|
426
|
+
*
|
|
427
|
+
* @param {V1} version - Version of the resource
|
|
428
|
+
* @param {AppPayload} payload - The instance payload
|
|
429
|
+
* @param {sid_like} sid - A string that uniquely identifies this App.
|
|
433
430
|
*/
|
|
434
431
|
/* jshint ignore:end */
|
|
435
|
-
|
|
432
|
+
AppInstance = function AppInstance(version, payload, sid) {
|
|
436
433
|
this._version = version;
|
|
437
434
|
|
|
438
435
|
// Marshaled Properties
|
|
439
|
-
this.
|
|
440
|
-
this.
|
|
441
|
-
this.
|
|
442
|
-
this.
|
|
443
|
-
this.
|
|
444
|
-
this.
|
|
436
|
+
this.sid = payload.sid; // jshint ignore:line
|
|
437
|
+
this.accountSid = payload.account_sid; // jshint ignore:line
|
|
438
|
+
this.hash = payload.hash; // jshint ignore:line
|
|
439
|
+
this.uniqueName = payload.unique_name; // jshint ignore:line
|
|
440
|
+
this.dateCreated = deserialize.iso8601DateTime(payload.date_created); // jshint ignore:line
|
|
441
|
+
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); // jshint ignore:line
|
|
442
|
+
this.url = payload.url; // jshint ignore:line
|
|
445
443
|
|
|
446
444
|
// Context
|
|
447
445
|
this._context = undefined;
|
|
448
|
-
this._solution = {
|
|
446
|
+
this._solution = {sid: sid || this.sid, };
|
|
449
447
|
};
|
|
450
448
|
|
|
451
|
-
Object.defineProperty(
|
|
449
|
+
Object.defineProperty(AppInstance.prototype,
|
|
452
450
|
'_proxy', {
|
|
453
451
|
get: function() {
|
|
454
452
|
if (!this._context) {
|
|
455
|
-
this._context = new
|
|
453
|
+
this._context = new AppContext(this._version, this._solution.sid);
|
|
456
454
|
}
|
|
457
455
|
|
|
458
456
|
return this._context;
|
|
@@ -461,31 +459,47 @@ Object.defineProperty(DayInstance.prototype,
|
|
|
461
459
|
|
|
462
460
|
/* jshint ignore:start */
|
|
463
461
|
/**
|
|
464
|
-
* fetch a
|
|
462
|
+
* fetch a AppInstance
|
|
465
463
|
*
|
|
466
464
|
* @function fetch
|
|
467
|
-
* @memberof Twilio.
|
|
465
|
+
* @memberof Twilio.Microvisor.V1.AppInstance#
|
|
468
466
|
*
|
|
469
467
|
* @param {function} [callback] - Callback to handle processed record
|
|
470
468
|
*
|
|
471
|
-
* @returns {Promise} Resolves to processed
|
|
469
|
+
* @returns {Promise} Resolves to processed AppInstance
|
|
472
470
|
*/
|
|
473
471
|
/* jshint ignore:end */
|
|
474
|
-
|
|
472
|
+
AppInstance.prototype.fetch = function fetch(callback) {
|
|
475
473
|
return this._proxy.fetch(callback);
|
|
476
474
|
};
|
|
477
475
|
|
|
476
|
+
/* jshint ignore:start */
|
|
477
|
+
/**
|
|
478
|
+
* remove a AppInstance
|
|
479
|
+
*
|
|
480
|
+
* @function remove
|
|
481
|
+
* @memberof Twilio.Microvisor.V1.AppInstance#
|
|
482
|
+
*
|
|
483
|
+
* @param {function} [callback] - Callback to handle processed record
|
|
484
|
+
*
|
|
485
|
+
* @returns {Promise} Resolves to processed AppInstance
|
|
486
|
+
*/
|
|
487
|
+
/* jshint ignore:end */
|
|
488
|
+
AppInstance.prototype.remove = function remove(callback) {
|
|
489
|
+
return this._proxy.remove(callback);
|
|
490
|
+
};
|
|
491
|
+
|
|
478
492
|
/* jshint ignore:start */
|
|
479
493
|
/**
|
|
480
494
|
* Provide a user-friendly representation
|
|
481
495
|
*
|
|
482
496
|
* @function toJSON
|
|
483
|
-
* @memberof Twilio.
|
|
497
|
+
* @memberof Twilio.Microvisor.V1.AppInstance#
|
|
484
498
|
*
|
|
485
499
|
* @returns Object
|
|
486
500
|
*/
|
|
487
501
|
/* jshint ignore:end */
|
|
488
|
-
|
|
502
|
+
AppInstance.prototype.toJSON = function toJSON() {
|
|
489
503
|
let clone = {};
|
|
490
504
|
_.forOwn(this, function(value, key) {
|
|
491
505
|
if (!_.startsWith(key, '_') && ! _.isFunction(value)) {
|
|
@@ -495,58 +509,82 @@ DayInstance.prototype.toJSON = function toJSON() {
|
|
|
495
509
|
return clone;
|
|
496
510
|
};
|
|
497
511
|
|
|
498
|
-
|
|
512
|
+
AppInstance.prototype[util.inspect.custom] = function inspect(depth, options) {
|
|
499
513
|
return util.inspect(this.toJSON(), options);
|
|
500
514
|
};
|
|
501
515
|
|
|
502
516
|
|
|
503
517
|
/* jshint ignore:start */
|
|
504
518
|
/**
|
|
505
|
-
* Initialize the
|
|
519
|
+
* Initialize the AppContext
|
|
506
520
|
*
|
|
507
521
|
* PLEASE NOTE that this class contains preview products that are subject to
|
|
508
522
|
* change. Use them with caution. If you currently do not have developer preview
|
|
509
523
|
* access, please contact help@twilio.com.
|
|
510
524
|
*
|
|
511
|
-
* @constructor Twilio.
|
|
525
|
+
* @constructor Twilio.Microvisor.V1.AppContext
|
|
512
526
|
*
|
|
513
|
-
* @param {
|
|
514
|
-
* @param {
|
|
515
|
-
* The type of communication – Messages, Calls, Conferences, and Participants
|
|
516
|
-
* @param {string} day - The date of the data in the file
|
|
527
|
+
* @param {V1} version - Version of the resource
|
|
528
|
+
* @param {sid_like} sid - A string that uniquely identifies this App.
|
|
517
529
|
*/
|
|
518
530
|
/* jshint ignore:end */
|
|
519
|
-
|
|
531
|
+
AppContext = function AppContext(version, sid) {
|
|
520
532
|
this._version = version;
|
|
521
533
|
|
|
522
534
|
// Path Solution
|
|
523
|
-
this._solution = {
|
|
524
|
-
this._uri = `/
|
|
535
|
+
this._solution = {sid: sid, };
|
|
536
|
+
this._uri = `/Apps/${sid}`;
|
|
525
537
|
};
|
|
526
538
|
|
|
527
539
|
/* jshint ignore:start */
|
|
528
540
|
/**
|
|
529
|
-
* fetch a
|
|
541
|
+
* fetch a AppInstance
|
|
530
542
|
*
|
|
531
543
|
* @function fetch
|
|
532
|
-
* @memberof Twilio.
|
|
544
|
+
* @memberof Twilio.Microvisor.V1.AppContext#
|
|
533
545
|
*
|
|
534
546
|
* @param {function} [callback] - Callback to handle processed record
|
|
535
547
|
*
|
|
536
|
-
* @returns {Promise} Resolves to processed
|
|
548
|
+
* @returns {Promise} Resolves to processed AppInstance
|
|
537
549
|
*/
|
|
538
550
|
/* jshint ignore:end */
|
|
539
|
-
|
|
551
|
+
AppContext.prototype.fetch = function fetch(callback) {
|
|
540
552
|
var deferred = Q.defer();
|
|
541
553
|
var promise = this._version.fetch({uri: this._uri, method: 'GET'});
|
|
542
554
|
|
|
543
555
|
promise = promise.then(function(payload) {
|
|
544
|
-
deferred.resolve(new
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
556
|
+
deferred.resolve(new AppInstance(this._version, payload, this._solution.sid));
|
|
557
|
+
}.bind(this));
|
|
558
|
+
|
|
559
|
+
promise.catch(function(error) {
|
|
560
|
+
deferred.reject(error);
|
|
561
|
+
});
|
|
562
|
+
|
|
563
|
+
if (_.isFunction(callback)) {
|
|
564
|
+
deferred.promise.nodeify(callback);
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
return deferred.promise;
|
|
568
|
+
};
|
|
569
|
+
|
|
570
|
+
/* jshint ignore:start */
|
|
571
|
+
/**
|
|
572
|
+
* remove a AppInstance
|
|
573
|
+
*
|
|
574
|
+
* @function remove
|
|
575
|
+
* @memberof Twilio.Microvisor.V1.AppContext#
|
|
576
|
+
*
|
|
577
|
+
* @param {function} [callback] - Callback to handle processed record
|
|
578
|
+
*
|
|
579
|
+
* @returns {Promise} Resolves to processed AppInstance
|
|
580
|
+
*/
|
|
581
|
+
/* jshint ignore:end */
|
|
582
|
+
AppContext.prototype.remove = function remove(callback) {
|
|
583
|
+
var deferred = Q.defer();
|
|
584
|
+
var promise = this._version.remove({uri: this._uri, method: 'DELETE'});
|
|
585
|
+
|
|
586
|
+
promise = promise.then(function(payload) {
|
|
587
|
+
deferred.resolve(payload);
|
|
550
588
|
}.bind(this));
|
|
551
589
|
|
|
552
590
|
promise.catch(function(error) {
|
|
@@ -565,22 +603,22 @@ DayContext.prototype.fetch = function fetch(callback) {
|
|
|
565
603
|
* Provide a user-friendly representation
|
|
566
604
|
*
|
|
567
605
|
* @function toJSON
|
|
568
|
-
* @memberof Twilio.
|
|
606
|
+
* @memberof Twilio.Microvisor.V1.AppContext#
|
|
569
607
|
*
|
|
570
608
|
* @returns Object
|
|
571
609
|
*/
|
|
572
610
|
/* jshint ignore:end */
|
|
573
|
-
|
|
611
|
+
AppContext.prototype.toJSON = function toJSON() {
|
|
574
612
|
return this._solution;
|
|
575
613
|
};
|
|
576
614
|
|
|
577
|
-
|
|
615
|
+
AppContext.prototype[util.inspect.custom] = function inspect(depth, options) {
|
|
578
616
|
return util.inspect(this.toJSON(), options);
|
|
579
617
|
};
|
|
580
618
|
|
|
581
619
|
module.exports = {
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
620
|
+
AppList: AppList,
|
|
621
|
+
AppPage: AppPage,
|
|
622
|
+
AppInstance: AppInstance,
|
|
623
|
+
AppContext: AppContext
|
|
586
624
|
};
|