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