twilio 3.75.0 → 3.75.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/Media.d.ts +2 -0
- package/lib/rest/Media.js +9 -0
- package/lib/rest/api/v2010/account/recording.d.ts +31 -2
- package/lib/rest/api/v2010/account/recording.js +25 -4
- 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/media/V1.d.ts +3 -0
- package/lib/rest/media/V1.js +12 -0
- package/lib/rest/media/v1/mediaRecording.d.ts +346 -0
- package/lib/rest/media/v1/mediaRecording.js +658 -0
- package/lib/rest/numbers/v2/regulatoryCompliance/supportingDocument.d.ts +2 -0
- package/lib/rest/numbers/v2/regulatoryCompliance/supportingDocument.js +3 -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/package.json +1 -1
|
@@ -0,0 +1,658 @@
|
|
|
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 MediaRecordingList;
|
|
21
|
+
var MediaRecordingPage;
|
|
22
|
+
var MediaRecordingInstance;
|
|
23
|
+
var MediaRecordingContext;
|
|
24
|
+
|
|
25
|
+
/* jshint ignore:start */
|
|
26
|
+
/**
|
|
27
|
+
* Initialize the MediaRecordingList
|
|
28
|
+
*
|
|
29
|
+
* PLEASE NOTE that this class contains preview products that are subject to
|
|
30
|
+
* change. Use them with caution. If you currently do not have developer preview
|
|
31
|
+
* access, please contact help@twilio.com.
|
|
32
|
+
*
|
|
33
|
+
* @constructor Twilio.Media.V1.MediaRecordingList
|
|
34
|
+
*
|
|
35
|
+
* @param {Twilio.Media.V1} version - Version of the resource
|
|
36
|
+
*/
|
|
37
|
+
/* jshint ignore:end */
|
|
38
|
+
MediaRecordingList = function MediaRecordingList(version) {
|
|
39
|
+
/* jshint ignore:start */
|
|
40
|
+
/**
|
|
41
|
+
* @function mediaRecording
|
|
42
|
+
* @memberof Twilio.Media.V1#
|
|
43
|
+
*
|
|
44
|
+
* @param {string} sid - sid of instance
|
|
45
|
+
*
|
|
46
|
+
* @returns {Twilio.Media.V1.MediaRecordingContext}
|
|
47
|
+
*/
|
|
48
|
+
/* jshint ignore:end */
|
|
49
|
+
function MediaRecordingListInstance(sid) {
|
|
50
|
+
return MediaRecordingListInstance.get(sid);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
MediaRecordingListInstance._version = version;
|
|
54
|
+
// Path Solution
|
|
55
|
+
MediaRecordingListInstance._solution = {};
|
|
56
|
+
MediaRecordingListInstance._uri = `/MediaRecordings`;
|
|
57
|
+
/* jshint ignore:start */
|
|
58
|
+
/**
|
|
59
|
+
* Streams MediaRecordingInstance records from the API.
|
|
60
|
+
*
|
|
61
|
+
* This operation lazily loads records as efficiently as possible until the limit
|
|
62
|
+
* is reached.
|
|
63
|
+
*
|
|
64
|
+
* The results are passed into the callback function, so this operation is memory
|
|
65
|
+
* efficient.
|
|
66
|
+
*
|
|
67
|
+
* If a function is passed as the first argument, it will be used as the callback
|
|
68
|
+
* function.
|
|
69
|
+
*
|
|
70
|
+
* @function each
|
|
71
|
+
* @memberof Twilio.Media.V1.MediaRecordingList#
|
|
72
|
+
*
|
|
73
|
+
* @param {object} [opts] - Options for request
|
|
74
|
+
* @param {media_recording.order} [opts.order] - The sort order of the list
|
|
75
|
+
* @param {media_recording.status} [opts.status] - Status to filter by
|
|
76
|
+
* @param {number} [opts.limit] -
|
|
77
|
+
* Upper limit for the number of records to return.
|
|
78
|
+
* each() guarantees never to return more than limit.
|
|
79
|
+
* Default is no limit
|
|
80
|
+
* @param {number} [opts.pageSize] -
|
|
81
|
+
* Number of records to fetch per request,
|
|
82
|
+
* when not set will use the default value of 50 records.
|
|
83
|
+
* If no pageSize is defined but a limit is defined,
|
|
84
|
+
* each() will attempt to read the limit with the most efficient
|
|
85
|
+
* page size, i.e. min(limit, 1000)
|
|
86
|
+
* @param {Function} [opts.callback] -
|
|
87
|
+
* Function to process each record. If this and a positional
|
|
88
|
+
* callback are passed, this one will be used
|
|
89
|
+
* @param {Function} [opts.done] -
|
|
90
|
+
* Function to be called upon completion of streaming
|
|
91
|
+
* @param {Function} [callback] - Function to process each record
|
|
92
|
+
*/
|
|
93
|
+
/* jshint ignore:end */
|
|
94
|
+
MediaRecordingListInstance.each = function each(opts, callback) {
|
|
95
|
+
if (_.isFunction(opts)) {
|
|
96
|
+
callback = opts;
|
|
97
|
+
opts = {};
|
|
98
|
+
}
|
|
99
|
+
opts = opts || {};
|
|
100
|
+
if (opts.callback) {
|
|
101
|
+
callback = opts.callback;
|
|
102
|
+
}
|
|
103
|
+
if (_.isUndefined(callback)) {
|
|
104
|
+
throw new Error('Callback function must be provided');
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
var done = false;
|
|
108
|
+
var currentPage = 1;
|
|
109
|
+
var currentResource = 0;
|
|
110
|
+
var limits = this._version.readLimits({
|
|
111
|
+
limit: opts.limit,
|
|
112
|
+
pageSize: opts.pageSize
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
function onComplete(error) {
|
|
116
|
+
done = true;
|
|
117
|
+
if (_.isFunction(opts.done)) {
|
|
118
|
+
opts.done(error);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function fetchNextPage(fn) {
|
|
123
|
+
var promise = fn();
|
|
124
|
+
if (_.isUndefined(promise)) {
|
|
125
|
+
onComplete();
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
promise.then(function(page) {
|
|
130
|
+
_.each(page.instances, function(instance) {
|
|
131
|
+
if (done || (!_.isUndefined(opts.limit) && currentResource >= opts.limit)) {
|
|
132
|
+
done = true;
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
currentResource++;
|
|
137
|
+
callback(instance, onComplete);
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
if (!done) {
|
|
141
|
+
currentPage++;
|
|
142
|
+
fetchNextPage(_.bind(page.nextPage, page));
|
|
143
|
+
} else {
|
|
144
|
+
onComplete();
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
promise.catch(onComplete);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
fetchNextPage(_.bind(this.page, this, _.merge(opts, limits)));
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
/* jshint ignore:start */
|
|
155
|
+
/**
|
|
156
|
+
* Lists MediaRecordingInstance records from the API as a list.
|
|
157
|
+
*
|
|
158
|
+
* If a function is passed as the first argument, it will be used as the callback
|
|
159
|
+
* function.
|
|
160
|
+
*
|
|
161
|
+
* @function list
|
|
162
|
+
* @memberof Twilio.Media.V1.MediaRecordingList#
|
|
163
|
+
*
|
|
164
|
+
* @param {object} [opts] - Options for request
|
|
165
|
+
* @param {media_recording.order} [opts.order] - The sort order of the list
|
|
166
|
+
* @param {media_recording.status} [opts.status] - Status to filter by
|
|
167
|
+
* @param {number} [opts.limit] -
|
|
168
|
+
* Upper limit for the number of records to return.
|
|
169
|
+
* list() guarantees never to return more than limit.
|
|
170
|
+
* Default is no limit
|
|
171
|
+
* @param {number} [opts.pageSize] -
|
|
172
|
+
* Number of records to fetch per request,
|
|
173
|
+
* when not set will use the default value of 50 records.
|
|
174
|
+
* If no page_size is defined but a limit is defined,
|
|
175
|
+
* list() will attempt to read the limit with the most
|
|
176
|
+
* efficient page size, i.e. min(limit, 1000)
|
|
177
|
+
* @param {function} [callback] - Callback to handle list of records
|
|
178
|
+
*
|
|
179
|
+
* @returns {Promise} Resolves to a list of records
|
|
180
|
+
*/
|
|
181
|
+
/* jshint ignore:end */
|
|
182
|
+
MediaRecordingListInstance.list = function list(opts, callback) {
|
|
183
|
+
if (_.isFunction(opts)) {
|
|
184
|
+
callback = opts;
|
|
185
|
+
opts = {};
|
|
186
|
+
}
|
|
187
|
+
opts = opts || {};
|
|
188
|
+
var deferred = Q.defer();
|
|
189
|
+
var allResources = [];
|
|
190
|
+
opts.callback = function(resource, done) {
|
|
191
|
+
allResources.push(resource);
|
|
192
|
+
|
|
193
|
+
if (!_.isUndefined(opts.limit) && allResources.length === opts.limit) {
|
|
194
|
+
done();
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
opts.done = function(error) {
|
|
199
|
+
if (_.isUndefined(error)) {
|
|
200
|
+
deferred.resolve(allResources);
|
|
201
|
+
} else {
|
|
202
|
+
deferred.reject(error);
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
if (_.isFunction(callback)) {
|
|
207
|
+
deferred.promise.nodeify(callback);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
this.each(opts);
|
|
211
|
+
return deferred.promise;
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
/* jshint ignore:start */
|
|
215
|
+
/**
|
|
216
|
+
* Retrieve a single page of MediaRecordingInstance records from the API.
|
|
217
|
+
*
|
|
218
|
+
* The request is executed immediately.
|
|
219
|
+
*
|
|
220
|
+
* If a function is passed as the first argument, it will be used as the callback
|
|
221
|
+
* function.
|
|
222
|
+
*
|
|
223
|
+
* @function page
|
|
224
|
+
* @memberof Twilio.Media.V1.MediaRecordingList#
|
|
225
|
+
*
|
|
226
|
+
* @param {object} [opts] - Options for request
|
|
227
|
+
* @param {media_recording.order} [opts.order] - The sort order of the list
|
|
228
|
+
* @param {media_recording.status} [opts.status] - Status to filter by
|
|
229
|
+
* @param {string} [opts.pageToken] - PageToken provided by the API
|
|
230
|
+
* @param {number} [opts.pageNumber] -
|
|
231
|
+
* Page Number, this value is simply for client state
|
|
232
|
+
* @param {number} [opts.pageSize] - Number of records to return, defaults to 50
|
|
233
|
+
* @param {function} [callback] - Callback to handle list of records
|
|
234
|
+
*
|
|
235
|
+
* @returns {Promise} Resolves to a list of records
|
|
236
|
+
*/
|
|
237
|
+
/* jshint ignore:end */
|
|
238
|
+
MediaRecordingListInstance.page = function page(opts, callback) {
|
|
239
|
+
if (_.isFunction(opts)) {
|
|
240
|
+
callback = opts;
|
|
241
|
+
opts = {};
|
|
242
|
+
}
|
|
243
|
+
opts = opts || {};
|
|
244
|
+
|
|
245
|
+
var deferred = Q.defer();
|
|
246
|
+
var data = values.of({
|
|
247
|
+
'Order': _.get(opts, 'order'),
|
|
248
|
+
'Status': _.get(opts, 'status'),
|
|
249
|
+
'PageToken': opts.pageToken,
|
|
250
|
+
'Page': opts.pageNumber,
|
|
251
|
+
'PageSize': opts.pageSize
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
var promise = this._version.page({uri: this._uri, method: 'GET', params: data});
|
|
255
|
+
|
|
256
|
+
promise = promise.then(function(payload) {
|
|
257
|
+
deferred.resolve(new MediaRecordingPage(this._version, payload, this._solution));
|
|
258
|
+
}.bind(this));
|
|
259
|
+
|
|
260
|
+
promise.catch(function(error) {
|
|
261
|
+
deferred.reject(error);
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
if (_.isFunction(callback)) {
|
|
265
|
+
deferred.promise.nodeify(callback);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
return deferred.promise;
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
/* jshint ignore:start */
|
|
272
|
+
/**
|
|
273
|
+
* Retrieve a single target page of MediaRecordingInstance records from the API.
|
|
274
|
+
*
|
|
275
|
+
* The request is executed immediately.
|
|
276
|
+
*
|
|
277
|
+
* If a function is passed as the first argument, it will be used as the callback
|
|
278
|
+
* function.
|
|
279
|
+
*
|
|
280
|
+
* @function getPage
|
|
281
|
+
* @memberof Twilio.Media.V1.MediaRecordingList#
|
|
282
|
+
*
|
|
283
|
+
* @param {string} [targetUrl] - API-generated URL for the requested results page
|
|
284
|
+
* @param {function} [callback] - Callback to handle list of records
|
|
285
|
+
*
|
|
286
|
+
* @returns {Promise} Resolves to a list of records
|
|
287
|
+
*/
|
|
288
|
+
/* jshint ignore:end */
|
|
289
|
+
MediaRecordingListInstance.getPage = function getPage(targetUrl, callback) {
|
|
290
|
+
var deferred = Q.defer();
|
|
291
|
+
|
|
292
|
+
var promise = this._version._domain.twilio.request({method: 'GET', uri: targetUrl});
|
|
293
|
+
|
|
294
|
+
promise = promise.then(function(payload) {
|
|
295
|
+
deferred.resolve(new MediaRecordingPage(this._version, payload, this._solution));
|
|
296
|
+
}.bind(this));
|
|
297
|
+
|
|
298
|
+
promise.catch(function(error) {
|
|
299
|
+
deferred.reject(error);
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
if (_.isFunction(callback)) {
|
|
303
|
+
deferred.promise.nodeify(callback);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
return deferred.promise;
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
/* jshint ignore:start */
|
|
310
|
+
/**
|
|
311
|
+
* Constructs a media_recording
|
|
312
|
+
*
|
|
313
|
+
* @function get
|
|
314
|
+
* @memberof Twilio.Media.V1.MediaRecordingList#
|
|
315
|
+
*
|
|
316
|
+
* @param {string} sid - The SID that identifies the resource to fetch
|
|
317
|
+
*
|
|
318
|
+
* @returns {Twilio.Media.V1.MediaRecordingContext}
|
|
319
|
+
*/
|
|
320
|
+
/* jshint ignore:end */
|
|
321
|
+
MediaRecordingListInstance.get = function get(sid) {
|
|
322
|
+
return new MediaRecordingContext(this._version, sid);
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
/* jshint ignore:start */
|
|
326
|
+
/**
|
|
327
|
+
* Provide a user-friendly representation
|
|
328
|
+
*
|
|
329
|
+
* @function toJSON
|
|
330
|
+
* @memberof Twilio.Media.V1.MediaRecordingList#
|
|
331
|
+
*
|
|
332
|
+
* @returns Object
|
|
333
|
+
*/
|
|
334
|
+
/* jshint ignore:end */
|
|
335
|
+
MediaRecordingListInstance.toJSON = function toJSON() {
|
|
336
|
+
return this._solution;
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
MediaRecordingListInstance[util.inspect.custom] = function inspect(depth,
|
|
340
|
+
options) {
|
|
341
|
+
return util.inspect(this.toJSON(), options);
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
return MediaRecordingListInstance;
|
|
345
|
+
};
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
/* jshint ignore:start */
|
|
349
|
+
/**
|
|
350
|
+
* Initialize the MediaRecordingPage
|
|
351
|
+
*
|
|
352
|
+
* PLEASE NOTE that this class contains preview products that are subject to
|
|
353
|
+
* change. Use them with caution. If you currently do not have developer preview
|
|
354
|
+
* access, please contact help@twilio.com.
|
|
355
|
+
*
|
|
356
|
+
* @constructor Twilio.Media.V1.MediaRecordingPage
|
|
357
|
+
*
|
|
358
|
+
* @param {V1} version - Version of the resource
|
|
359
|
+
* @param {Response<string>} response - Response from the API
|
|
360
|
+
* @param {MediaRecordingSolution} solution - Path solution
|
|
361
|
+
*
|
|
362
|
+
* @returns MediaRecordingPage
|
|
363
|
+
*/
|
|
364
|
+
/* jshint ignore:end */
|
|
365
|
+
MediaRecordingPage = function MediaRecordingPage(version, response, solution) {
|
|
366
|
+
// Path Solution
|
|
367
|
+
this._solution = solution;
|
|
368
|
+
|
|
369
|
+
Page.prototype.constructor.call(this, version, response, this._solution);
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
_.extend(MediaRecordingPage.prototype, Page.prototype);
|
|
373
|
+
MediaRecordingPage.prototype.constructor = MediaRecordingPage;
|
|
374
|
+
|
|
375
|
+
/* jshint ignore:start */
|
|
376
|
+
/**
|
|
377
|
+
* Build an instance of MediaRecordingInstance
|
|
378
|
+
*
|
|
379
|
+
* @function getInstance
|
|
380
|
+
* @memberof Twilio.Media.V1.MediaRecordingPage#
|
|
381
|
+
*
|
|
382
|
+
* @param {MediaRecordingPayload} payload - Payload response from the API
|
|
383
|
+
*
|
|
384
|
+
* @returns MediaRecordingInstance
|
|
385
|
+
*/
|
|
386
|
+
/* jshint ignore:end */
|
|
387
|
+
MediaRecordingPage.prototype.getInstance = function getInstance(payload) {
|
|
388
|
+
return new MediaRecordingInstance(this._version, payload);
|
|
389
|
+
};
|
|
390
|
+
|
|
391
|
+
/* jshint ignore:start */
|
|
392
|
+
/**
|
|
393
|
+
* Provide a user-friendly representation
|
|
394
|
+
*
|
|
395
|
+
* @function toJSON
|
|
396
|
+
* @memberof Twilio.Media.V1.MediaRecordingPage#
|
|
397
|
+
*
|
|
398
|
+
* @returns Object
|
|
399
|
+
*/
|
|
400
|
+
/* jshint ignore:end */
|
|
401
|
+
MediaRecordingPage.prototype.toJSON = function toJSON() {
|
|
402
|
+
let clone = {};
|
|
403
|
+
_.forOwn(this, function(value, key) {
|
|
404
|
+
if (!_.startsWith(key, '_') && ! _.isFunction(value)) {
|
|
405
|
+
clone[key] = value;
|
|
406
|
+
}
|
|
407
|
+
});
|
|
408
|
+
return clone;
|
|
409
|
+
};
|
|
410
|
+
|
|
411
|
+
MediaRecordingPage.prototype[util.inspect.custom] = function inspect(depth,
|
|
412
|
+
options) {
|
|
413
|
+
return util.inspect(this.toJSON(), options);
|
|
414
|
+
};
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
/* jshint ignore:start */
|
|
418
|
+
/**
|
|
419
|
+
* Initialize the MediaRecordingContext
|
|
420
|
+
*
|
|
421
|
+
* PLEASE NOTE that this class contains preview products that are subject to
|
|
422
|
+
* change. Use them with caution. If you currently do not have developer preview
|
|
423
|
+
* access, please contact help@twilio.com.
|
|
424
|
+
*
|
|
425
|
+
* @constructor Twilio.Media.V1.MediaRecordingInstance
|
|
426
|
+
*
|
|
427
|
+
* @property {string} accountSid - The SID of the Account that created the resource
|
|
428
|
+
* @property {number} bitrate - The bitrate of the media
|
|
429
|
+
* @property {Date} dateCreated -
|
|
430
|
+
* The ISO 8601 date and time in GMT when the resource was created
|
|
431
|
+
* @property {Date} dateUpdated -
|
|
432
|
+
* The ISO 8601 date and time in GMT when the resource was last updated
|
|
433
|
+
* @property {number} duration - The duration of the MediaRecording
|
|
434
|
+
* @property {media_recording.format} format - The format of the MediaRecording
|
|
435
|
+
* @property {string} links - The URLs of related resources
|
|
436
|
+
* @property {string} processorSid - The SID of the MediaProcessor
|
|
437
|
+
* @property {string} resolution - The dimensions of the video image in pixels
|
|
438
|
+
* @property {string} sourceSid -
|
|
439
|
+
* The SID of the resource that generated the original media
|
|
440
|
+
* @property {string} sid - The unique string that identifies the resource
|
|
441
|
+
* @property {number} size - The size of the recording
|
|
442
|
+
* @property {media_recording.status} status - The status of the MediaRecording
|
|
443
|
+
* @property {string} statusCallback -
|
|
444
|
+
* The URL to which Twilio will send MediaRecording event updates
|
|
445
|
+
* @property {string} statusCallbackMethod -
|
|
446
|
+
* The HTTP method Twilio should use to call the `status_callback` URL
|
|
447
|
+
* @property {string} url - The absolute URL of the resource
|
|
448
|
+
*
|
|
449
|
+
* @param {V1} version - Version of the resource
|
|
450
|
+
* @param {MediaRecordingPayload} payload - The instance payload
|
|
451
|
+
* @param {sid} sid - The SID that identifies the resource to fetch
|
|
452
|
+
*/
|
|
453
|
+
/* jshint ignore:end */
|
|
454
|
+
MediaRecordingInstance = function MediaRecordingInstance(version, payload, sid)
|
|
455
|
+
{
|
|
456
|
+
this._version = version;
|
|
457
|
+
|
|
458
|
+
// Marshaled Properties
|
|
459
|
+
this.accountSid = payload.account_sid; // jshint ignore:line
|
|
460
|
+
this.bitrate = deserialize.integer(payload.bitrate); // jshint ignore:line
|
|
461
|
+
this.dateCreated = deserialize.iso8601DateTime(payload.date_created); // jshint ignore:line
|
|
462
|
+
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); // jshint ignore:line
|
|
463
|
+
this.duration = deserialize.integer(payload.duration); // jshint ignore:line
|
|
464
|
+
this.format = payload.format; // jshint ignore:line
|
|
465
|
+
this.links = payload.links; // jshint ignore:line
|
|
466
|
+
this.processorSid = payload.processor_sid; // jshint ignore:line
|
|
467
|
+
this.resolution = payload.resolution; // jshint ignore:line
|
|
468
|
+
this.sourceSid = payload.source_sid; // jshint ignore:line
|
|
469
|
+
this.sid = payload.sid; // jshint ignore:line
|
|
470
|
+
this.size = deserialize.integer(payload.size); // jshint ignore:line
|
|
471
|
+
this.status = payload.status; // jshint ignore:line
|
|
472
|
+
this.statusCallback = payload.status_callback; // jshint ignore:line
|
|
473
|
+
this.statusCallbackMethod = payload.status_callback_method; // jshint ignore:line
|
|
474
|
+
this.url = payload.url; // jshint ignore:line
|
|
475
|
+
|
|
476
|
+
// Context
|
|
477
|
+
this._context = undefined;
|
|
478
|
+
this._solution = {sid: sid || this.sid, };
|
|
479
|
+
};
|
|
480
|
+
|
|
481
|
+
Object.defineProperty(MediaRecordingInstance.prototype,
|
|
482
|
+
'_proxy', {
|
|
483
|
+
get: function() {
|
|
484
|
+
if (!this._context) {
|
|
485
|
+
this._context = new MediaRecordingContext(this._version, this._solution.sid);
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
return this._context;
|
|
489
|
+
}
|
|
490
|
+
});
|
|
491
|
+
|
|
492
|
+
/* jshint ignore:start */
|
|
493
|
+
/**
|
|
494
|
+
* remove a MediaRecordingInstance
|
|
495
|
+
*
|
|
496
|
+
* @function remove
|
|
497
|
+
* @memberof Twilio.Media.V1.MediaRecordingInstance#
|
|
498
|
+
*
|
|
499
|
+
* @param {function} [callback] - Callback to handle processed record
|
|
500
|
+
*
|
|
501
|
+
* @returns {Promise} Resolves to processed MediaRecordingInstance
|
|
502
|
+
*/
|
|
503
|
+
/* jshint ignore:end */
|
|
504
|
+
MediaRecordingInstance.prototype.remove = function remove(callback) {
|
|
505
|
+
return this._proxy.remove(callback);
|
|
506
|
+
};
|
|
507
|
+
|
|
508
|
+
/* jshint ignore:start */
|
|
509
|
+
/**
|
|
510
|
+
* fetch a MediaRecordingInstance
|
|
511
|
+
*
|
|
512
|
+
* @function fetch
|
|
513
|
+
* @memberof Twilio.Media.V1.MediaRecordingInstance#
|
|
514
|
+
*
|
|
515
|
+
* @param {function} [callback] - Callback to handle processed record
|
|
516
|
+
*
|
|
517
|
+
* @returns {Promise} Resolves to processed MediaRecordingInstance
|
|
518
|
+
*/
|
|
519
|
+
/* jshint ignore:end */
|
|
520
|
+
MediaRecordingInstance.prototype.fetch = function fetch(callback) {
|
|
521
|
+
return this._proxy.fetch(callback);
|
|
522
|
+
};
|
|
523
|
+
|
|
524
|
+
/* jshint ignore:start */
|
|
525
|
+
/**
|
|
526
|
+
* Provide a user-friendly representation
|
|
527
|
+
*
|
|
528
|
+
* @function toJSON
|
|
529
|
+
* @memberof Twilio.Media.V1.MediaRecordingInstance#
|
|
530
|
+
*
|
|
531
|
+
* @returns Object
|
|
532
|
+
*/
|
|
533
|
+
/* jshint ignore:end */
|
|
534
|
+
MediaRecordingInstance.prototype.toJSON = function toJSON() {
|
|
535
|
+
let clone = {};
|
|
536
|
+
_.forOwn(this, function(value, key) {
|
|
537
|
+
if (!_.startsWith(key, '_') && ! _.isFunction(value)) {
|
|
538
|
+
clone[key] = value;
|
|
539
|
+
}
|
|
540
|
+
});
|
|
541
|
+
return clone;
|
|
542
|
+
};
|
|
543
|
+
|
|
544
|
+
MediaRecordingInstance.prototype[util.inspect.custom] = function inspect(depth,
|
|
545
|
+
options) {
|
|
546
|
+
return util.inspect(this.toJSON(), options);
|
|
547
|
+
};
|
|
548
|
+
|
|
549
|
+
|
|
550
|
+
/* jshint ignore:start */
|
|
551
|
+
/**
|
|
552
|
+
* Initialize the MediaRecordingContext
|
|
553
|
+
*
|
|
554
|
+
* PLEASE NOTE that this class contains preview products that are subject to
|
|
555
|
+
* change. Use them with caution. If you currently do not have developer preview
|
|
556
|
+
* access, please contact help@twilio.com.
|
|
557
|
+
*
|
|
558
|
+
* @constructor Twilio.Media.V1.MediaRecordingContext
|
|
559
|
+
*
|
|
560
|
+
* @param {V1} version - Version of the resource
|
|
561
|
+
* @param {sid} sid - The SID that identifies the resource to fetch
|
|
562
|
+
*/
|
|
563
|
+
/* jshint ignore:end */
|
|
564
|
+
MediaRecordingContext = function MediaRecordingContext(version, sid) {
|
|
565
|
+
this._version = version;
|
|
566
|
+
|
|
567
|
+
// Path Solution
|
|
568
|
+
this._solution = {sid: sid, };
|
|
569
|
+
this._uri = `/MediaRecordings/${sid}`;
|
|
570
|
+
};
|
|
571
|
+
|
|
572
|
+
/* jshint ignore:start */
|
|
573
|
+
/**
|
|
574
|
+
* remove a MediaRecordingInstance
|
|
575
|
+
*
|
|
576
|
+
* @function remove
|
|
577
|
+
* @memberof Twilio.Media.V1.MediaRecordingContext#
|
|
578
|
+
*
|
|
579
|
+
* @param {function} [callback] - Callback to handle processed record
|
|
580
|
+
*
|
|
581
|
+
* @returns {Promise} Resolves to processed MediaRecordingInstance
|
|
582
|
+
*/
|
|
583
|
+
/* jshint ignore:end */
|
|
584
|
+
MediaRecordingContext.prototype.remove = function remove(callback) {
|
|
585
|
+
var deferred = Q.defer();
|
|
586
|
+
var promise = this._version.remove({uri: this._uri, method: 'DELETE'});
|
|
587
|
+
|
|
588
|
+
promise = promise.then(function(payload) {
|
|
589
|
+
deferred.resolve(payload);
|
|
590
|
+
}.bind(this));
|
|
591
|
+
|
|
592
|
+
promise.catch(function(error) {
|
|
593
|
+
deferred.reject(error);
|
|
594
|
+
});
|
|
595
|
+
|
|
596
|
+
if (_.isFunction(callback)) {
|
|
597
|
+
deferred.promise.nodeify(callback);
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
return deferred.promise;
|
|
601
|
+
};
|
|
602
|
+
|
|
603
|
+
/* jshint ignore:start */
|
|
604
|
+
/**
|
|
605
|
+
* fetch a MediaRecordingInstance
|
|
606
|
+
*
|
|
607
|
+
* @function fetch
|
|
608
|
+
* @memberof Twilio.Media.V1.MediaRecordingContext#
|
|
609
|
+
*
|
|
610
|
+
* @param {function} [callback] - Callback to handle processed record
|
|
611
|
+
*
|
|
612
|
+
* @returns {Promise} Resolves to processed MediaRecordingInstance
|
|
613
|
+
*/
|
|
614
|
+
/* jshint ignore:end */
|
|
615
|
+
MediaRecordingContext.prototype.fetch = function fetch(callback) {
|
|
616
|
+
var deferred = Q.defer();
|
|
617
|
+
var promise = this._version.fetch({uri: this._uri, method: 'GET'});
|
|
618
|
+
|
|
619
|
+
promise = promise.then(function(payload) {
|
|
620
|
+
deferred.resolve(new MediaRecordingInstance(this._version, payload, this._solution.sid));
|
|
621
|
+
}.bind(this));
|
|
622
|
+
|
|
623
|
+
promise.catch(function(error) {
|
|
624
|
+
deferred.reject(error);
|
|
625
|
+
});
|
|
626
|
+
|
|
627
|
+
if (_.isFunction(callback)) {
|
|
628
|
+
deferred.promise.nodeify(callback);
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
return deferred.promise;
|
|
632
|
+
};
|
|
633
|
+
|
|
634
|
+
/* jshint ignore:start */
|
|
635
|
+
/**
|
|
636
|
+
* Provide a user-friendly representation
|
|
637
|
+
*
|
|
638
|
+
* @function toJSON
|
|
639
|
+
* @memberof Twilio.Media.V1.MediaRecordingContext#
|
|
640
|
+
*
|
|
641
|
+
* @returns Object
|
|
642
|
+
*/
|
|
643
|
+
/* jshint ignore:end */
|
|
644
|
+
MediaRecordingContext.prototype.toJSON = function toJSON() {
|
|
645
|
+
return this._solution;
|
|
646
|
+
};
|
|
647
|
+
|
|
648
|
+
MediaRecordingContext.prototype[util.inspect.custom] = function inspect(depth,
|
|
649
|
+
options) {
|
|
650
|
+
return util.inspect(this.toJSON(), options);
|
|
651
|
+
};
|
|
652
|
+
|
|
653
|
+
module.exports = {
|
|
654
|
+
MediaRecordingList: MediaRecordingList,
|
|
655
|
+
MediaRecordingPage: MediaRecordingPage,
|
|
656
|
+
MediaRecordingInstance: MediaRecordingInstance,
|
|
657
|
+
MediaRecordingContext: MediaRecordingContext
|
|
658
|
+
};
|
|
@@ -230,6 +230,7 @@ interface SupportingDocumentResource {
|
|
|
230
230
|
attributes: object;
|
|
231
231
|
date_created: Date;
|
|
232
232
|
date_updated: Date;
|
|
233
|
+
failure_reason: string;
|
|
233
234
|
friendly_name: string;
|
|
234
235
|
mime_type: string;
|
|
235
236
|
sid: string;
|
|
@@ -298,6 +299,7 @@ declare class SupportingDocumentInstance extends SerializableClass {
|
|
|
298
299
|
attributes: any;
|
|
299
300
|
dateCreated: Date;
|
|
300
301
|
dateUpdated: Date;
|
|
302
|
+
failureReason: string;
|
|
301
303
|
/**
|
|
302
304
|
* fetch a SupportingDocumentInstance
|
|
303
305
|
*
|
|
@@ -467,6 +467,8 @@ SupportingDocumentPage.prototype[util.inspect.custom] = function inspect(depth,
|
|
|
467
467
|
* @property {string} mimeType - The image type of the file
|
|
468
468
|
* @property {supporting_document.status} status -
|
|
469
469
|
* The verification status of the Supporting Document resource
|
|
470
|
+
* @property {string} failureReason -
|
|
471
|
+
* The failure reason of the Supporting Document Resource.
|
|
470
472
|
* @property {string} type - The type of the Supporting Document
|
|
471
473
|
* @property {object} attributes -
|
|
472
474
|
* The set of parameters that compose the Supporting Documents resource
|
|
@@ -491,6 +493,7 @@ SupportingDocumentInstance = function SupportingDocumentInstance(version,
|
|
|
491
493
|
this.friendlyName = payload.friendly_name; // jshint ignore:line
|
|
492
494
|
this.mimeType = payload.mime_type; // jshint ignore:line
|
|
493
495
|
this.status = payload.status; // jshint ignore:line
|
|
496
|
+
this.failureReason = payload.failure_reason; // jshint ignore:line
|
|
494
497
|
this.type = payload.type; // jshint ignore:line
|
|
495
498
|
this.attributes = payload.attributes; // jshint ignore:line
|
|
496
499
|
this.dateCreated = deserialize.iso8601DateTime(payload.date_created); // jshint ignore:line
|