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