twilio 3.80.0 → 3.82.0

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.
Files changed (63) hide show
  1. package/lib/base/RequestClient.d.ts +26 -2
  2. package/lib/base/RequestClient.js +14 -2
  3. package/lib/rest/Messaging.d.ts +2 -0
  4. package/lib/rest/Messaging.js +9 -0
  5. package/lib/rest/Microvisor.d.ts +28 -0
  6. package/lib/rest/Microvisor.js +62 -0
  7. package/lib/rest/Preview.d.ts +0 -6
  8. package/lib/rest/Preview.js +0 -28
  9. package/lib/rest/Routes.d.ts +30 -0
  10. package/lib/rest/Routes.js +71 -0
  11. package/lib/rest/Twilio.d.ts +4 -0
  12. package/lib/rest/Twilio.js +28 -0
  13. package/lib/rest/Verify.d.ts +2 -0
  14. package/lib/rest/Verify.js +8 -0
  15. package/lib/rest/api/v2010/account/sip/ipAccessControlList/ipAddress.d.ts +2 -2
  16. package/lib/rest/api/v2010/account/sip/ipAccessControlList/ipAddress.js +4 -4
  17. package/lib/rest/flexApi/v1/configuration.d.ts +4 -0
  18. package/lib/rest/flexApi/v1/configuration.js +6 -0
  19. package/lib/rest/flexApi/v1/interaction/interactionChannel/interactionChannelParticipant.d.ts +1 -1
  20. package/lib/rest/flexApi/v1/interaction/interactionChannel.d.ts +1 -1
  21. package/lib/rest/flexApi/v1/interaction.d.ts +1 -3
  22. package/lib/rest/messaging/V1.d.ts +3 -0
  23. package/lib/rest/messaging/V1.js +13 -0
  24. package/lib/rest/messaging/v1/tollfreeVerification.d.ts +418 -0
  25. package/lib/rest/messaging/v1/tollfreeVerification.js +802 -0
  26. package/lib/rest/microvisor/V1.d.ts +28 -0
  27. package/lib/rest/microvisor/V1.js +57 -0
  28. package/lib/rest/{preview/bulk_exports/export/day.d.ts → microvisor/v1/app.d.ts} +79 -69
  29. package/lib/rest/{preview/bulk_exports/export/day.js → microvisor/v1/app.js} +160 -122
  30. package/lib/rest/{preview/bulk_exports/export/exportCustomJob.d.ts → microvisor/v1/device.d.ts} +136 -84
  31. package/lib/rest/microvisor/v1/device.js +652 -0
  32. package/lib/rest/routes/V2.d.ts +31 -0
  33. package/lib/rest/routes/V2.js +69 -0
  34. package/lib/rest/routes/v2/phoneNumber.d.ts +168 -0
  35. package/lib/rest/routes/v2/phoneNumber.js +394 -0
  36. package/lib/rest/routes/v2/sipDomain.d.ts +168 -0
  37. package/lib/rest/routes/v2/sipDomain.js +383 -0
  38. package/lib/rest/routes/v2/trunk.d.ts +168 -0
  39. package/lib/rest/routes/v2/trunk.js +390 -0
  40. package/lib/rest/supersim/v1/fleet.d.ts +3 -1
  41. package/lib/rest/supersim/v1/fleet.js +8 -3
  42. package/lib/rest/verify/V2.d.ts +3 -0
  43. package/lib/rest/verify/V2.js +11 -0
  44. package/lib/rest/verify/v2/safelist.d.ts +161 -0
  45. package/lib/rest/verify/v2/safelist.js +408 -0
  46. package/lib/rest/verify/v2/service/verification.d.ts +1 -1
  47. package/lib/rest/verify/v2/service/verification.js +1 -1
  48. package/lib/rest/video/v1/room/roomParticipant/roomParticipantAnonymize.d.ts +143 -0
  49. package/lib/rest/video/v1/room/roomParticipant/roomParticipantAnonymize.js +337 -0
  50. package/lib/rest/video/v1/room/roomParticipant.d.ts +7 -0
  51. package/lib/rest/video/v1/room/roomParticipant.js +29 -0
  52. package/lib/twiml/VoiceResponse.d.ts +3 -3
  53. package/lib/webhooks/webhooks.js +1 -0
  54. package/package.json +1 -1
  55. package/lib/rest/preview/BulkExports.d.ts +0 -28
  56. package/lib/rest/preview/BulkExports.js +0 -59
  57. package/lib/rest/preview/bulk_exports/export/exportCustomJob.js +0 -540
  58. package/lib/rest/preview/bulk_exports/export/job.d.ts +0 -163
  59. package/lib/rest/preview/bulk_exports/export/job.js +0 -390
  60. package/lib/rest/preview/bulk_exports/export.d.ts +0 -153
  61. package/lib/rest/preview/bulk_exports/export.js +0 -402
  62. package/lib/rest/preview/bulk_exports/exportConfiguration.d.ts +0 -180
  63. package/lib/rest/preview/bulk_exports/exportConfiguration.js +0 -411
@@ -0,0 +1,802 @@
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 serialize = require('../../../base/serialize'); /* jshint ignore:line */
19
+ var values = require('../../../base/values'); /* jshint ignore:line */
20
+
21
+ var TollfreeVerificationList;
22
+ var TollfreeVerificationPage;
23
+ var TollfreeVerificationInstance;
24
+ var TollfreeVerificationContext;
25
+
26
+ /* jshint ignore:start */
27
+ /**
28
+ * Initialize the TollfreeVerificationList
29
+ *
30
+ * PLEASE NOTE that this class contains beta products that are subject to change.
31
+ * Use them with caution.
32
+ *
33
+ * @constructor Twilio.Messaging.V1.TollfreeVerificationList
34
+ *
35
+ * @param {Twilio.Messaging.V1} version - Version of the resource
36
+ */
37
+ /* jshint ignore:end */
38
+ TollfreeVerificationList = function TollfreeVerificationList(version) {
39
+ /* jshint ignore:start */
40
+ /**
41
+ * @function tollfreeVerifications
42
+ * @memberof Twilio.Messaging.V1#
43
+ *
44
+ * @param {string} sid - sid of instance
45
+ *
46
+ * @returns {Twilio.Messaging.V1.TollfreeVerificationContext}
47
+ */
48
+ /* jshint ignore:end */
49
+ function TollfreeVerificationListInstance(sid) {
50
+ return TollfreeVerificationListInstance.get(sid);
51
+ }
52
+
53
+ TollfreeVerificationListInstance._version = version;
54
+ // Path Solution
55
+ TollfreeVerificationListInstance._solution = {};
56
+ TollfreeVerificationListInstance._uri = `/Tollfree/Verifications`;
57
+ /* jshint ignore:start */
58
+ /**
59
+ * Streams TollfreeVerificationInstance 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.Messaging.V1.TollfreeVerificationList#
72
+ *
73
+ * @param {object} [opts] - Options for request
74
+ * @param {string} [opts.tollfreePhoneNumberSid] -
75
+ * The SID of the Phone Number associated with the Tollfree Verification
76
+ * @param {tollfree_verification.status} [opts.status] -
77
+ * The compliance status of the Tollfree Verification record.
78
+ * @param {number} [opts.limit] -
79
+ * Upper limit for the number of records to return.
80
+ * each() guarantees never to return more than limit.
81
+ * Default is no limit
82
+ * @param {number} [opts.pageSize] -
83
+ * Number of records to fetch per request,
84
+ * when not set will use the default value of 50 records.
85
+ * If no pageSize is defined but a limit is defined,
86
+ * each() will attempt to read the limit with the most efficient
87
+ * page size, i.e. min(limit, 1000)
88
+ * @param {Function} [opts.callback] -
89
+ * Function to process each record. If this and a positional
90
+ * callback are passed, this one will be used
91
+ * @param {Function} [opts.done] -
92
+ * Function to be called upon completion of streaming
93
+ * @param {Function} [callback] - Function to process each record
94
+ */
95
+ /* jshint ignore:end */
96
+ TollfreeVerificationListInstance.each = function each(opts, callback) {
97
+ if (_.isFunction(opts)) {
98
+ callback = opts;
99
+ opts = {};
100
+ }
101
+ opts = opts || {};
102
+ if (opts.callback) {
103
+ callback = opts.callback;
104
+ }
105
+ if (_.isUndefined(callback)) {
106
+ throw new Error('Callback function must be provided');
107
+ }
108
+
109
+ var done = false;
110
+ var currentPage = 1;
111
+ var currentResource = 0;
112
+ var limits = this._version.readLimits({
113
+ limit: opts.limit,
114
+ pageSize: opts.pageSize
115
+ });
116
+
117
+ function onComplete(error) {
118
+ done = true;
119
+ if (_.isFunction(opts.done)) {
120
+ opts.done(error);
121
+ }
122
+ }
123
+
124
+ function fetchNextPage(fn) {
125
+ var promise = fn();
126
+ if (_.isUndefined(promise)) {
127
+ onComplete();
128
+ return;
129
+ }
130
+
131
+ promise.then(function(page) {
132
+ _.each(page.instances, function(instance) {
133
+ if (done || (!_.isUndefined(opts.limit) && currentResource >= opts.limit)) {
134
+ done = true;
135
+ return false;
136
+ }
137
+
138
+ currentResource++;
139
+ callback(instance, onComplete);
140
+ });
141
+
142
+ if (!done) {
143
+ currentPage++;
144
+ fetchNextPage(_.bind(page.nextPage, page));
145
+ } else {
146
+ onComplete();
147
+ }
148
+ });
149
+
150
+ promise.catch(onComplete);
151
+ }
152
+
153
+ fetchNextPage(_.bind(this.page, this, _.merge(opts, limits)));
154
+ };
155
+
156
+ /* jshint ignore:start */
157
+ /**
158
+ * Lists TollfreeVerificationInstance records from the API as a list.
159
+ *
160
+ * If a function is passed as the first argument, it will be used as the callback
161
+ * function.
162
+ *
163
+ * @function list
164
+ * @memberof Twilio.Messaging.V1.TollfreeVerificationList#
165
+ *
166
+ * @param {object} [opts] - Options for request
167
+ * @param {string} [opts.tollfreePhoneNumberSid] -
168
+ * The SID of the Phone Number associated with the Tollfree Verification
169
+ * @param {tollfree_verification.status} [opts.status] -
170
+ * The compliance status of the Tollfree Verification record.
171
+ * @param {number} [opts.limit] -
172
+ * Upper limit for the number of records to return.
173
+ * list() guarantees never to return more than limit.
174
+ * Default is no limit
175
+ * @param {number} [opts.pageSize] -
176
+ * Number of records to fetch per request,
177
+ * when not set will use the default value of 50 records.
178
+ * If no page_size is defined but a limit is defined,
179
+ * list() will attempt to read the limit with the most
180
+ * efficient page size, i.e. min(limit, 1000)
181
+ * @param {function} [callback] - Callback to handle list of records
182
+ *
183
+ * @returns {Promise} Resolves to a list of records
184
+ */
185
+ /* jshint ignore:end */
186
+ TollfreeVerificationListInstance.list = function list(opts, callback) {
187
+ if (_.isFunction(opts)) {
188
+ callback = opts;
189
+ opts = {};
190
+ }
191
+ opts = opts || {};
192
+ var deferred = Q.defer();
193
+ var allResources = [];
194
+ opts.callback = function(resource, done) {
195
+ allResources.push(resource);
196
+
197
+ if (!_.isUndefined(opts.limit) && allResources.length === opts.limit) {
198
+ done();
199
+ }
200
+ };
201
+
202
+ opts.done = function(error) {
203
+ if (_.isUndefined(error)) {
204
+ deferred.resolve(allResources);
205
+ } else {
206
+ deferred.reject(error);
207
+ }
208
+ };
209
+
210
+ if (_.isFunction(callback)) {
211
+ deferred.promise.nodeify(callback);
212
+ }
213
+
214
+ this.each(opts);
215
+ return deferred.promise;
216
+ };
217
+
218
+ /* jshint ignore:start */
219
+ /**
220
+ * Retrieve a single page of TollfreeVerificationInstance records from the API.
221
+ *
222
+ * The request is executed immediately.
223
+ *
224
+ * If a function is passed as the first argument, it will be used as the callback
225
+ * function.
226
+ *
227
+ * @function page
228
+ * @memberof Twilio.Messaging.V1.TollfreeVerificationList#
229
+ *
230
+ * @param {object} [opts] - Options for request
231
+ * @param {string} [opts.tollfreePhoneNumberSid] -
232
+ * The SID of the Phone Number associated with the Tollfree Verification
233
+ * @param {tollfree_verification.status} [opts.status] -
234
+ * The compliance status of the Tollfree Verification record.
235
+ * @param {string} [opts.pageToken] - PageToken provided by the API
236
+ * @param {number} [opts.pageNumber] -
237
+ * Page Number, this value is simply for client state
238
+ * @param {number} [opts.pageSize] - Number of records to return, defaults to 50
239
+ * @param {function} [callback] - Callback to handle list of records
240
+ *
241
+ * @returns {Promise} Resolves to a list of records
242
+ */
243
+ /* jshint ignore:end */
244
+ TollfreeVerificationListInstance.page = function page(opts, callback) {
245
+ if (_.isFunction(opts)) {
246
+ callback = opts;
247
+ opts = {};
248
+ }
249
+ opts = opts || {};
250
+
251
+ var deferred = Q.defer();
252
+ var data = values.of({
253
+ 'TollfreePhoneNumberSid': _.get(opts, 'tollfreePhoneNumberSid'),
254
+ 'Status': _.get(opts, 'status'),
255
+ 'PageToken': opts.pageToken,
256
+ 'Page': opts.pageNumber,
257
+ 'PageSize': opts.pageSize
258
+ });
259
+
260
+ var promise = this._version.page({uri: this._uri, method: 'GET', params: data});
261
+
262
+ promise = promise.then(function(payload) {
263
+ deferred.resolve(new TollfreeVerificationPage(this._version, payload, this._solution));
264
+ }.bind(this));
265
+
266
+ promise.catch(function(error) {
267
+ deferred.reject(error);
268
+ });
269
+
270
+ if (_.isFunction(callback)) {
271
+ deferred.promise.nodeify(callback);
272
+ }
273
+
274
+ return deferred.promise;
275
+ };
276
+
277
+ /* jshint ignore:start */
278
+ /**
279
+ * Retrieve a single target page of TollfreeVerificationInstance records from the
280
+ * API.
281
+ *
282
+ * The request is executed immediately.
283
+ *
284
+ * If a function is passed as the first argument, it will be used as the callback
285
+ * function.
286
+ *
287
+ * @function getPage
288
+ * @memberof Twilio.Messaging.V1.TollfreeVerificationList#
289
+ *
290
+ * @param {string} [targetUrl] - API-generated URL for the requested results page
291
+ * @param {function} [callback] - Callback to handle list of records
292
+ *
293
+ * @returns {Promise} Resolves to a list of records
294
+ */
295
+ /* jshint ignore:end */
296
+ TollfreeVerificationListInstance.getPage = function getPage(targetUrl, callback)
297
+ {
298
+ var deferred = Q.defer();
299
+
300
+ var promise = this._version._domain.twilio.request({method: 'GET', uri: targetUrl});
301
+
302
+ promise = promise.then(function(payload) {
303
+ deferred.resolve(new TollfreeVerificationPage(this._version, payload, this._solution));
304
+ }.bind(this));
305
+
306
+ promise.catch(function(error) {
307
+ deferred.reject(error);
308
+ });
309
+
310
+ if (_.isFunction(callback)) {
311
+ deferred.promise.nodeify(callback);
312
+ }
313
+
314
+ return deferred.promise;
315
+ };
316
+
317
+ /* jshint ignore:start */
318
+ /**
319
+ * create a TollfreeVerificationInstance
320
+ *
321
+ * @function create
322
+ * @memberof Twilio.Messaging.V1.TollfreeVerificationList#
323
+ *
324
+ * @param {object} opts - Options for request
325
+ * @param {string} opts.businessName -
326
+ * The name of the business or organization using the Tollfree number
327
+ * @param {string} opts.businessWebsite -
328
+ * The website of the business or organization using the Tollfree number
329
+ * @param {string} opts.notificationEmail -
330
+ * The email address to receive the notification about the verification result.
331
+ * @param {string|list} opts.useCaseCategories -
332
+ * The category of the use case for the Tollfree Number. List as many are applicable.
333
+ * @param {string} opts.useCaseSummary -
334
+ * Further explaination on how messaging is used by the business or organization
335
+ * @param {string} opts.productionMessageSample -
336
+ * An example of message content, i.e. a sample message
337
+ * @param {string|list} opts.optInImageUrls -
338
+ * Link to an image that shows the opt-in workflow. Multiple images allowed and must be a publicly hosted URL
339
+ * @param {tollfree_verification.opt_in_type} opts.optInType -
340
+ * Describe how a user opts-in to text messages
341
+ * @param {string} opts.messageVolume -
342
+ * Estimate monthly volume of messages from the Tollfree Number
343
+ * @param {string} opts.tollfreePhoneNumberSid -
344
+ * The SID of the Phone Number associated with the Tollfree Verification
345
+ * @param {string} [opts.customerProfileSid] - Customer's Profile Bundle BundleSid
346
+ * @param {string} [opts.businessStreetAddress] -
347
+ * The address of the business or organization using the Tollfree number
348
+ * @param {string} [opts.businessStreetAddress2] -
349
+ * The address of the business or organization using the Tollfree number
350
+ * @param {string} [opts.businessCity] -
351
+ * The city of the business or organization using the Tollfree number
352
+ * @param {string} [opts.businessStateProvinceRegion] -
353
+ * The state/province/region of the business or organization using the Tollfree number
354
+ * @param {string} [opts.businessPostalCode] -
355
+ * The postal code of the business or organization using the Tollfree number
356
+ * @param {string} [opts.businessCountry] -
357
+ * The country of the business or organization using the Tollfree number
358
+ * @param {string} [opts.additionalInformation] -
359
+ * Additional information to be provided for verification
360
+ * @param {string} [opts.businessContactFirstName] -
361
+ * The first name of the contact for the business or organization using the Tollfree number
362
+ * @param {string} [opts.businessContactLastName] -
363
+ * The last name of the contact for the business or organization using the Tollfree number
364
+ * @param {string} [opts.businessContactEmail] -
365
+ * The email address of the contact for the business or organization using the Tollfree number
366
+ * @param {string} [opts.businessContactPhone] -
367
+ * The phone number of the contact for the business or organization using the Tollfree number
368
+ * @param {function} [callback] - Callback to handle processed record
369
+ *
370
+ * @returns {Promise} Resolves to processed TollfreeVerificationInstance
371
+ */
372
+ /* jshint ignore:end */
373
+ TollfreeVerificationListInstance.create = function create(opts, callback) {
374
+ if (_.isUndefined(opts)) {
375
+ throw new Error('Required parameter "opts" missing.');
376
+ }
377
+ if (_.isUndefined(opts['businessName'])) {
378
+ throw new Error('Required parameter "opts[\'businessName\']" missing.');
379
+ }
380
+ if (_.isUndefined(opts['businessWebsite'])) {
381
+ throw new Error('Required parameter "opts[\'businessWebsite\']" missing.');
382
+ }
383
+ if (_.isUndefined(opts['notificationEmail'])) {
384
+ throw new Error('Required parameter "opts[\'notificationEmail\']" missing.');
385
+ }
386
+ if (_.isUndefined(opts['useCaseCategories'])) {
387
+ throw new Error('Required parameter "opts[\'useCaseCategories\']" missing.');
388
+ }
389
+ if (_.isUndefined(opts['useCaseSummary'])) {
390
+ throw new Error('Required parameter "opts[\'useCaseSummary\']" missing.');
391
+ }
392
+ if (_.isUndefined(opts['productionMessageSample'])) {
393
+ throw new Error('Required parameter "opts[\'productionMessageSample\']" missing.');
394
+ }
395
+ if (_.isUndefined(opts['optInImageUrls'])) {
396
+ throw new Error('Required parameter "opts[\'optInImageUrls\']" missing.');
397
+ }
398
+ if (_.isUndefined(opts['optInType'])) {
399
+ throw new Error('Required parameter "opts[\'optInType\']" missing.');
400
+ }
401
+ if (_.isUndefined(opts['messageVolume'])) {
402
+ throw new Error('Required parameter "opts[\'messageVolume\']" missing.');
403
+ }
404
+ if (_.isUndefined(opts['tollfreePhoneNumberSid'])) {
405
+ throw new Error('Required parameter "opts[\'tollfreePhoneNumberSid\']" missing.');
406
+ }
407
+
408
+ var deferred = Q.defer();
409
+ var data = values.of({
410
+ 'BusinessName': _.get(opts, 'businessName'),
411
+ 'BusinessWebsite': _.get(opts, 'businessWebsite'),
412
+ 'NotificationEmail': _.get(opts, 'notificationEmail'),
413
+ 'UseCaseCategories': serialize.map(_.get(opts, 'useCaseCategories'), function(e) { return e; }),
414
+ 'UseCaseSummary': _.get(opts, 'useCaseSummary'),
415
+ 'ProductionMessageSample': _.get(opts, 'productionMessageSample'),
416
+ 'OptInImageUrls': serialize.map(_.get(opts, 'optInImageUrls'), function(e) { return e; }),
417
+ 'OptInType': _.get(opts, 'optInType'),
418
+ 'MessageVolume': _.get(opts, 'messageVolume'),
419
+ 'TollfreePhoneNumberSid': _.get(opts, 'tollfreePhoneNumberSid'),
420
+ 'CustomerProfileSid': _.get(opts, 'customerProfileSid'),
421
+ 'BusinessStreetAddress': _.get(opts, 'businessStreetAddress'),
422
+ 'BusinessStreetAddress2': _.get(opts, 'businessStreetAddress2'),
423
+ 'BusinessCity': _.get(opts, 'businessCity'),
424
+ 'BusinessStateProvinceRegion': _.get(opts, 'businessStateProvinceRegion'),
425
+ 'BusinessPostalCode': _.get(opts, 'businessPostalCode'),
426
+ 'BusinessCountry': _.get(opts, 'businessCountry'),
427
+ 'AdditionalInformation': _.get(opts, 'additionalInformation'),
428
+ 'BusinessContactFirstName': _.get(opts, 'businessContactFirstName'),
429
+ 'BusinessContactLastName': _.get(opts, 'businessContactLastName'),
430
+ 'BusinessContactEmail': _.get(opts, 'businessContactEmail'),
431
+ 'BusinessContactPhone': _.get(opts, 'businessContactPhone')
432
+ });
433
+
434
+ var promise = this._version.create({uri: this._uri, method: 'POST', data: data});
435
+
436
+ promise = promise.then(function(payload) {
437
+ deferred.resolve(new TollfreeVerificationInstance(this._version, payload, this._solution.sid));
438
+ }.bind(this));
439
+
440
+ promise.catch(function(error) {
441
+ deferred.reject(error);
442
+ });
443
+
444
+ if (_.isFunction(callback)) {
445
+ deferred.promise.nodeify(callback);
446
+ }
447
+
448
+ return deferred.promise;
449
+ };
450
+
451
+ /* jshint ignore:start */
452
+ /**
453
+ * Constructs a tollfree_verification
454
+ *
455
+ * @function get
456
+ * @memberof Twilio.Messaging.V1.TollfreeVerificationList#
457
+ *
458
+ * @param {string} sid - Tollfree Verification Sid
459
+ *
460
+ * @returns {Twilio.Messaging.V1.TollfreeVerificationContext}
461
+ */
462
+ /* jshint ignore:end */
463
+ TollfreeVerificationListInstance.get = function get(sid) {
464
+ return new TollfreeVerificationContext(this._version, sid);
465
+ };
466
+
467
+ /* jshint ignore:start */
468
+ /**
469
+ * Provide a user-friendly representation
470
+ *
471
+ * @function toJSON
472
+ * @memberof Twilio.Messaging.V1.TollfreeVerificationList#
473
+ *
474
+ * @returns Object
475
+ */
476
+ /* jshint ignore:end */
477
+ TollfreeVerificationListInstance.toJSON = function toJSON() {
478
+ return this._solution;
479
+ };
480
+
481
+ TollfreeVerificationListInstance[util.inspect.custom] = function inspect(depth,
482
+ options) {
483
+ return util.inspect(this.toJSON(), options);
484
+ };
485
+
486
+ return TollfreeVerificationListInstance;
487
+ };
488
+
489
+
490
+ /* jshint ignore:start */
491
+ /**
492
+ * Initialize the TollfreeVerificationPage
493
+ *
494
+ * PLEASE NOTE that this class contains beta products that are subject to change.
495
+ * Use them with caution.
496
+ *
497
+ * @constructor Twilio.Messaging.V1.TollfreeVerificationPage
498
+ *
499
+ * @param {V1} version - Version of the resource
500
+ * @param {Response<string>} response - Response from the API
501
+ * @param {TollfreeVerificationSolution} solution - Path solution
502
+ *
503
+ * @returns TollfreeVerificationPage
504
+ */
505
+ /* jshint ignore:end */
506
+ TollfreeVerificationPage = function TollfreeVerificationPage(version, response,
507
+ solution) {
508
+ // Path Solution
509
+ this._solution = solution;
510
+
511
+ Page.prototype.constructor.call(this, version, response, this._solution);
512
+ };
513
+
514
+ _.extend(TollfreeVerificationPage.prototype, Page.prototype);
515
+ TollfreeVerificationPage.prototype.constructor = TollfreeVerificationPage;
516
+
517
+ /* jshint ignore:start */
518
+ /**
519
+ * Build an instance of TollfreeVerificationInstance
520
+ *
521
+ * @function getInstance
522
+ * @memberof Twilio.Messaging.V1.TollfreeVerificationPage#
523
+ *
524
+ * @param {TollfreeVerificationPayload} payload - Payload response from the API
525
+ *
526
+ * @returns TollfreeVerificationInstance
527
+ */
528
+ /* jshint ignore:end */
529
+ TollfreeVerificationPage.prototype.getInstance = function getInstance(payload) {
530
+ return new TollfreeVerificationInstance(this._version, payload);
531
+ };
532
+
533
+ /* jshint ignore:start */
534
+ /**
535
+ * Provide a user-friendly representation
536
+ *
537
+ * @function toJSON
538
+ * @memberof Twilio.Messaging.V1.TollfreeVerificationPage#
539
+ *
540
+ * @returns Object
541
+ */
542
+ /* jshint ignore:end */
543
+ TollfreeVerificationPage.prototype.toJSON = function toJSON() {
544
+ let clone = {};
545
+ _.forOwn(this, function(value, key) {
546
+ if (!_.startsWith(key, '_') && ! _.isFunction(value)) {
547
+ clone[key] = value;
548
+ }
549
+ });
550
+ return clone;
551
+ };
552
+
553
+ TollfreeVerificationPage.prototype[util.inspect.custom] = function
554
+ inspect(depth, options) {
555
+ return util.inspect(this.toJSON(), options);
556
+ };
557
+
558
+
559
+ /* jshint ignore:start */
560
+ /**
561
+ * Initialize the TollfreeVerificationContext
562
+ *
563
+ * PLEASE NOTE that this class contains beta products that are subject to change.
564
+ * Use them with caution.
565
+ *
566
+ * @constructor Twilio.Messaging.V1.TollfreeVerificationInstance
567
+ *
568
+ * @property {string} sid - Tollfree Verification Sid
569
+ * @property {string} accountSid - The SID of the Account that created the resource
570
+ * @property {string} customerProfileSid - Customer's Profile Bundle BundleSid
571
+ * @property {string} trustProductSid - Tollfree TrustProduct Bundle BundleSid
572
+ * @property {Date} dateCreated -
573
+ * The ISO 8601 date and time in GMT when the resource was created
574
+ * @property {Date} dateUpdated -
575
+ * The ISO 8601 date and time in GMT when the resource was last updated
576
+ * @property {string} regulatedItemSid - The SID of the Regulated Item
577
+ * @property {string} businessName -
578
+ * The name of the business or organization using the Tollfree number
579
+ * @property {string} businessStreetAddress -
580
+ * The address of the business or organization using the Tollfree number
581
+ * @property {string} businessStreetAddress2 -
582
+ * The address of the business or organization using the Tollfree number
583
+ * @property {string} businessCity -
584
+ * The city of the business or organization using the Tollfree number
585
+ * @property {string} businessStateProvinceRegion -
586
+ * The state/province/region of the business or organization using the Tollfree number
587
+ * @property {string} businessPostalCode -
588
+ * The postal code of the business or organization using the Tollfree number
589
+ * @property {string} businessCountry -
590
+ * The country of the business or organization using the Tollfree number
591
+ * @property {string} businessWebsite -
592
+ * The website of the business or organization using the Tollfree number
593
+ * @property {string} businessContactFirstName -
594
+ * The first name of the contact for the business or organization using the Tollfree number
595
+ * @property {string} businessContactLastName -
596
+ * The last name of the contact for the business or organization using the Tollfree number
597
+ * @property {string} businessContactEmail -
598
+ * The email address of the contact for the business or organization using the Tollfree number
599
+ * @property {string} businessContactPhone -
600
+ * The phone number of the contact for the business or organization using the Tollfree number
601
+ * @property {string} notificationEmail -
602
+ * The email address to receive the notification about the verification result.
603
+ * @property {string} useCaseCategories -
604
+ * The category of the use case for the Tollfree Number. List as many are applicable.
605
+ * @property {string} useCaseSummary -
606
+ * Further explaination on how messaging is used by the business or organization
607
+ * @property {string} productionMessageSample -
608
+ * An example of message content, i.e. a sample message
609
+ * @property {string} optInImageUrls -
610
+ * Link to an image that shows the opt-in workflow. Multiple images allowed and must be a publicly hosted URL
611
+ * @property {tollfree_verification.opt_in_type} optInType -
612
+ * Describe how a user opts-in to text messages
613
+ * @property {string} messageVolume -
614
+ * Estimate monthly volume of messages from the Tollfree Number
615
+ * @property {string} additionalInformation -
616
+ * Additional information to be provided for verification
617
+ * @property {string} tollfreePhoneNumberSid -
618
+ * The SID of the Phone Number associated with the Tollfree Verification
619
+ * @property {tollfree_verification.status} status -
620
+ * The compliance status of the Tollfree Verification record.
621
+ * @property {string} url - The absolute URL of the Tollfree Verification
622
+ * @property {object} resourceLinks -
623
+ * The URLs of the documents associated with the Tollfree Verification resource
624
+ *
625
+ * @param {V1} version - Version of the resource
626
+ * @param {TollfreeVerificationPayload} payload - The instance payload
627
+ * @param {sid} sid - Tollfree Verification Sid
628
+ */
629
+ /* jshint ignore:end */
630
+ TollfreeVerificationInstance = function TollfreeVerificationInstance(version,
631
+ payload, sid) {
632
+ this._version = version;
633
+
634
+ // Marshaled Properties
635
+ this.sid = payload.sid; // jshint ignore:line
636
+ this.accountSid = payload.account_sid; // jshint ignore:line
637
+ this.customerProfileSid = payload.customer_profile_sid; // jshint ignore:line
638
+ this.trustProductSid = payload.trust_product_sid; // jshint ignore:line
639
+ this.dateCreated = deserialize.iso8601DateTime(payload.date_created); // jshint ignore:line
640
+ this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); // jshint ignore:line
641
+ this.regulatedItemSid = payload.regulated_item_sid; // jshint ignore:line
642
+ this.businessName = payload.business_name; // jshint ignore:line
643
+ this.businessStreetAddress = payload.business_street_address; // jshint ignore:line
644
+ this.businessStreetAddress2 = payload.business_street_address2; // jshint ignore:line
645
+ this.businessCity = payload.business_city; // jshint ignore:line
646
+ this.businessStateProvinceRegion = payload.business_state_province_region; // jshint ignore:line
647
+ this.businessPostalCode = payload.business_postal_code; // jshint ignore:line
648
+ this.businessCountry = payload.business_country; // jshint ignore:line
649
+ this.businessWebsite = payload.business_website; // jshint ignore:line
650
+ this.businessContactFirstName = payload.business_contact_first_name; // jshint ignore:line
651
+ this.businessContactLastName = payload.business_contact_last_name; // jshint ignore:line
652
+ this.businessContactEmail = payload.business_contact_email; // jshint ignore:line
653
+ this.businessContactPhone = payload.business_contact_phone; // jshint ignore:line
654
+ this.notificationEmail = payload.notification_email; // jshint ignore:line
655
+ this.useCaseCategories = payload.use_case_categories; // jshint ignore:line
656
+ this.useCaseSummary = payload.use_case_summary; // jshint ignore:line
657
+ this.productionMessageSample = payload.production_message_sample; // jshint ignore:line
658
+ this.optInImageUrls = payload.opt_in_image_urls; // jshint ignore:line
659
+ this.optInType = payload.opt_in_type; // jshint ignore:line
660
+ this.messageVolume = payload.message_volume; // jshint ignore:line
661
+ this.additionalInformation = payload.additional_information; // jshint ignore:line
662
+ this.tollfreePhoneNumberSid = payload.tollfree_phone_number_sid; // jshint ignore:line
663
+ this.status = payload.status; // jshint ignore:line
664
+ this.url = payload.url; // jshint ignore:line
665
+ this.resourceLinks = payload.resource_links; // jshint ignore:line
666
+
667
+ // Context
668
+ this._context = undefined;
669
+ this._solution = {sid: sid || this.sid, };
670
+ };
671
+
672
+ Object.defineProperty(TollfreeVerificationInstance.prototype,
673
+ '_proxy', {
674
+ get: function() {
675
+ if (!this._context) {
676
+ this._context = new TollfreeVerificationContext(this._version, this._solution.sid);
677
+ }
678
+
679
+ return this._context;
680
+ }
681
+ });
682
+
683
+ /* jshint ignore:start */
684
+ /**
685
+ * fetch a TollfreeVerificationInstance
686
+ *
687
+ * @function fetch
688
+ * @memberof Twilio.Messaging.V1.TollfreeVerificationInstance#
689
+ *
690
+ * @param {function} [callback] - Callback to handle processed record
691
+ *
692
+ * @returns {Promise} Resolves to processed TollfreeVerificationInstance
693
+ */
694
+ /* jshint ignore:end */
695
+ TollfreeVerificationInstance.prototype.fetch = function fetch(callback) {
696
+ return this._proxy.fetch(callback);
697
+ };
698
+
699
+ /* jshint ignore:start */
700
+ /**
701
+ * Provide a user-friendly representation
702
+ *
703
+ * @function toJSON
704
+ * @memberof Twilio.Messaging.V1.TollfreeVerificationInstance#
705
+ *
706
+ * @returns Object
707
+ */
708
+ /* jshint ignore:end */
709
+ TollfreeVerificationInstance.prototype.toJSON = function toJSON() {
710
+ let clone = {};
711
+ _.forOwn(this, function(value, key) {
712
+ if (!_.startsWith(key, '_') && ! _.isFunction(value)) {
713
+ clone[key] = value;
714
+ }
715
+ });
716
+ return clone;
717
+ };
718
+
719
+ TollfreeVerificationInstance.prototype[util.inspect.custom] = function
720
+ inspect(depth, options) {
721
+ return util.inspect(this.toJSON(), options);
722
+ };
723
+
724
+
725
+ /* jshint ignore:start */
726
+ /**
727
+ * Initialize the TollfreeVerificationContext
728
+ *
729
+ * PLEASE NOTE that this class contains beta products that are subject to change.
730
+ * Use them with caution.
731
+ *
732
+ * @constructor Twilio.Messaging.V1.TollfreeVerificationContext
733
+ *
734
+ * @param {V1} version - Version of the resource
735
+ * @param {sid} sid - Tollfree Verification Sid
736
+ */
737
+ /* jshint ignore:end */
738
+ TollfreeVerificationContext = function TollfreeVerificationContext(version, sid)
739
+ {
740
+ this._version = version;
741
+
742
+ // Path Solution
743
+ this._solution = {sid: sid, };
744
+ this._uri = `/Tollfree/Verifications/${sid}`;
745
+ };
746
+
747
+ /* jshint ignore:start */
748
+ /**
749
+ * fetch a TollfreeVerificationInstance
750
+ *
751
+ * @function fetch
752
+ * @memberof Twilio.Messaging.V1.TollfreeVerificationContext#
753
+ *
754
+ * @param {function} [callback] - Callback to handle processed record
755
+ *
756
+ * @returns {Promise} Resolves to processed TollfreeVerificationInstance
757
+ */
758
+ /* jshint ignore:end */
759
+ TollfreeVerificationContext.prototype.fetch = function fetch(callback) {
760
+ var deferred = Q.defer();
761
+ var promise = this._version.fetch({uri: this._uri, method: 'GET'});
762
+
763
+ promise = promise.then(function(payload) {
764
+ deferred.resolve(new TollfreeVerificationInstance(this._version, payload, this._solution.sid));
765
+ }.bind(this));
766
+
767
+ promise.catch(function(error) {
768
+ deferred.reject(error);
769
+ });
770
+
771
+ if (_.isFunction(callback)) {
772
+ deferred.promise.nodeify(callback);
773
+ }
774
+
775
+ return deferred.promise;
776
+ };
777
+
778
+ /* jshint ignore:start */
779
+ /**
780
+ * Provide a user-friendly representation
781
+ *
782
+ * @function toJSON
783
+ * @memberof Twilio.Messaging.V1.TollfreeVerificationContext#
784
+ *
785
+ * @returns Object
786
+ */
787
+ /* jshint ignore:end */
788
+ TollfreeVerificationContext.prototype.toJSON = function toJSON() {
789
+ return this._solution;
790
+ };
791
+
792
+ TollfreeVerificationContext.prototype[util.inspect.custom] = function
793
+ inspect(depth, options) {
794
+ return util.inspect(this.toJSON(), options);
795
+ };
796
+
797
+ module.exports = {
798
+ TollfreeVerificationList: TollfreeVerificationList,
799
+ TollfreeVerificationPage: TollfreeVerificationPage,
800
+ TollfreeVerificationInstance: TollfreeVerificationInstance,
801
+ TollfreeVerificationContext: TollfreeVerificationContext
802
+ };