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