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