twilio 3.77.2 → 3.79.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 (42) hide show
  1. package/README.md +1 -1
  2. package/lib/rest/Insights.d.ts +0 -2
  3. package/lib/rest/Insights.js +0 -8
  4. package/lib/rest/Lookups.d.ts +2 -0
  5. package/lib/rest/Lookups.js +11 -0
  6. package/lib/rest/api/v2010/account/call/payment.d.ts +1 -1
  7. package/lib/rest/api/v2010/account/call/payment.js +1 -1
  8. package/lib/rest/api/v2010/account/usage/record/allTime.d.ts +1 -1
  9. package/lib/rest/api/v2010/account/usage/record/daily.d.ts +1 -1
  10. package/lib/rest/api/v2010/account/usage/record/lastMonth.d.ts +1 -1
  11. package/lib/rest/api/v2010/account/usage/record/monthly.d.ts +1 -1
  12. package/lib/rest/api/v2010/account/usage/record/thisMonth.d.ts +1 -1
  13. package/lib/rest/api/v2010/account/usage/record/today.d.ts +1 -1
  14. package/lib/rest/api/v2010/account/usage/record/yearly.d.ts +1 -1
  15. package/lib/rest/api/v2010/account/usage/record/yesterday.d.ts +1 -1
  16. package/lib/rest/api/v2010/account/usage/record.d.ts +1 -1
  17. package/lib/rest/api/v2010/account/usage/trigger.d.ts +1 -1
  18. package/lib/rest/conversations/v1/conversation/participant.js +4 -2
  19. package/lib/rest/conversations/v1/service/conversation/participant.js +4 -2
  20. package/lib/rest/insights/V1.d.ts +0 -3
  21. package/lib/rest/insights/V1.js +0 -11
  22. package/lib/rest/insights/v1/{annotation.d.ts → call/annotation.d.ts} +29 -17
  23. package/lib/rest/insights/v1/{annotation.js → call/annotation.js} +72 -55
  24. package/lib/rest/insights/v1/call/summary.d.ts +2 -0
  25. package/lib/rest/insights/v1/call/summary.js +2 -0
  26. package/lib/rest/insights/v1/call.d.ts +7 -16
  27. package/lib/rest/insights/v1/call.js +28 -16
  28. package/lib/rest/lookups/V2.d.ts +25 -0
  29. package/lib/rest/lookups/V2.js +47 -0
  30. package/lib/rest/lookups/v2/phoneNumber.d.ts +180 -0
  31. package/lib/rest/lookups/v2/phoneNumber.js +359 -0
  32. package/lib/rest/media/v1/mediaRecording.d.ts +2 -4
  33. package/lib/rest/media/v1/mediaRecording.js +2 -4
  34. package/lib/rest/supersim/v1/sim/simIpAddress.d.ts +246 -0
  35. package/lib/rest/supersim/v1/sim/simIpAddress.js +448 -0
  36. package/lib/rest/supersim/v1/sim.d.ts +7 -0
  37. package/lib/rest/supersim/v1/sim.js +28 -0
  38. package/lib/rest/verify/v2/service/verificationCheck.d.ts +8 -2
  39. package/lib/rest/verify/v2/service/verificationCheck.js +8 -9
  40. package/lib/twiml/VoiceResponse.d.ts +81 -4
  41. package/lib/twiml/VoiceResponse.js +111 -3
  42. package/package.json +1 -1
@@ -0,0 +1,448 @@
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 values = require('../../../../base/values'); /* jshint ignore:line */
17
+
18
+ var SimIpAddressList;
19
+ var SimIpAddressPage;
20
+ var SimIpAddressInstance;
21
+
22
+ /* jshint ignore:start */
23
+ /**
24
+ * Initialize the SimIpAddressList
25
+ *
26
+ * PLEASE NOTE that this class contains beta products that are subject to change.
27
+ * Use them with caution.
28
+ *
29
+ * @constructor Twilio.Supersim.V1.SimContext.SimIpAddressList
30
+ *
31
+ * @param {Twilio.Supersim.V1} version - Version of the resource
32
+ * @param {string} simSid - The unique string that identifies the resource
33
+ */
34
+ /* jshint ignore:end */
35
+ SimIpAddressList = function SimIpAddressList(version, simSid) {
36
+ /* jshint ignore:start */
37
+ /**
38
+ * @function simIpAddresses
39
+ * @memberof Twilio.Supersim.V1.SimContext#
40
+ *
41
+ * @param {string} sid - sid of instance
42
+ *
43
+ * @returns {Twilio.Supersim.V1.SimContext.SimIpAddressContext}
44
+ */
45
+ /* jshint ignore:end */
46
+ function SimIpAddressListInstance(sid) {
47
+ return SimIpAddressListInstance.get(sid);
48
+ }
49
+
50
+ SimIpAddressListInstance._version = version;
51
+ // Path Solution
52
+ SimIpAddressListInstance._solution = {simSid: simSid};
53
+ SimIpAddressListInstance._uri = `/Sims/${simSid}/IpAddresses`;
54
+ /* jshint ignore:start */
55
+ /**
56
+ * Streams SimIpAddressInstance records from the API.
57
+ *
58
+ * This operation lazily loads records as efficiently as possible until the limit
59
+ * is reached.
60
+ *
61
+ * The results are passed into the callback function, so this operation is memory
62
+ * efficient.
63
+ *
64
+ * If a function is passed as the first argument, it will be used as the callback
65
+ * function.
66
+ *
67
+ * @function each
68
+ * @memberof Twilio.Supersim.V1.SimContext.SimIpAddressList#
69
+ *
70
+ * @param {object} [opts] - Options for request
71
+ * @param {number} [opts.limit] -
72
+ * Upper limit for the number of records to return.
73
+ * each() guarantees never to return more than limit.
74
+ * Default is no limit
75
+ * @param {number} [opts.pageSize] -
76
+ * Number of records to fetch per request,
77
+ * when not set will use the default value of 50 records.
78
+ * If no pageSize is defined but a limit is defined,
79
+ * each() will attempt to read the limit with the most efficient
80
+ * page size, i.e. min(limit, 1000)
81
+ * @param {Function} [opts.callback] -
82
+ * Function to process each record. If this and a positional
83
+ * callback are passed, this one will be used
84
+ * @param {Function} [opts.done] -
85
+ * Function to be called upon completion of streaming
86
+ * @param {Function} [callback] - Function to process each record
87
+ */
88
+ /* jshint ignore:end */
89
+ SimIpAddressListInstance.each = function each(opts, callback) {
90
+ if (_.isFunction(opts)) {
91
+ callback = opts;
92
+ opts = {};
93
+ }
94
+ opts = opts || {};
95
+ if (opts.callback) {
96
+ callback = opts.callback;
97
+ }
98
+ if (_.isUndefined(callback)) {
99
+ throw new Error('Callback function must be provided');
100
+ }
101
+
102
+ var done = false;
103
+ var currentPage = 1;
104
+ var currentResource = 0;
105
+ var limits = this._version.readLimits({
106
+ limit: opts.limit,
107
+ pageSize: opts.pageSize
108
+ });
109
+
110
+ function onComplete(error) {
111
+ done = true;
112
+ if (_.isFunction(opts.done)) {
113
+ opts.done(error);
114
+ }
115
+ }
116
+
117
+ function fetchNextPage(fn) {
118
+ var promise = fn();
119
+ if (_.isUndefined(promise)) {
120
+ onComplete();
121
+ return;
122
+ }
123
+
124
+ promise.then(function(page) {
125
+ _.each(page.instances, function(instance) {
126
+ if (done || (!_.isUndefined(opts.limit) && currentResource >= opts.limit)) {
127
+ done = true;
128
+ return false;
129
+ }
130
+
131
+ currentResource++;
132
+ callback(instance, onComplete);
133
+ });
134
+
135
+ if (!done) {
136
+ currentPage++;
137
+ fetchNextPage(_.bind(page.nextPage, page));
138
+ } else {
139
+ onComplete();
140
+ }
141
+ });
142
+
143
+ promise.catch(onComplete);
144
+ }
145
+
146
+ fetchNextPage(_.bind(this.page, this, _.merge(opts, limits)));
147
+ };
148
+
149
+ /* jshint ignore:start */
150
+ /**
151
+ * Lists SimIpAddressInstance records from the API as a list.
152
+ *
153
+ * If a function is passed as the first argument, it will be used as the callback
154
+ * function.
155
+ *
156
+ * @function list
157
+ * @memberof Twilio.Supersim.V1.SimContext.SimIpAddressList#
158
+ *
159
+ * @param {object} [opts] - Options for request
160
+ * @param {number} [opts.limit] -
161
+ * Upper limit for the number of records to return.
162
+ * list() guarantees never to return more than limit.
163
+ * Default is no limit
164
+ * @param {number} [opts.pageSize] -
165
+ * Number of records to fetch per request,
166
+ * when not set will use the default value of 50 records.
167
+ * If no page_size is defined but a limit is defined,
168
+ * list() will attempt to read the limit with the most
169
+ * efficient page size, i.e. min(limit, 1000)
170
+ * @param {function} [callback] - Callback to handle list of records
171
+ *
172
+ * @returns {Promise} Resolves to a list of records
173
+ */
174
+ /* jshint ignore:end */
175
+ SimIpAddressListInstance.list = function list(opts, callback) {
176
+ if (_.isFunction(opts)) {
177
+ callback = opts;
178
+ opts = {};
179
+ }
180
+ opts = opts || {};
181
+ var deferred = Q.defer();
182
+ var allResources = [];
183
+ opts.callback = function(resource, done) {
184
+ allResources.push(resource);
185
+
186
+ if (!_.isUndefined(opts.limit) && allResources.length === opts.limit) {
187
+ done();
188
+ }
189
+ };
190
+
191
+ opts.done = function(error) {
192
+ if (_.isUndefined(error)) {
193
+ deferred.resolve(allResources);
194
+ } else {
195
+ deferred.reject(error);
196
+ }
197
+ };
198
+
199
+ if (_.isFunction(callback)) {
200
+ deferred.promise.nodeify(callback);
201
+ }
202
+
203
+ this.each(opts);
204
+ return deferred.promise;
205
+ };
206
+
207
+ /* jshint ignore:start */
208
+ /**
209
+ * Retrieve a single page of SimIpAddressInstance records from the API.
210
+ *
211
+ * The request is executed immediately.
212
+ *
213
+ * If a function is passed as the first argument, it will be used as the callback
214
+ * function.
215
+ *
216
+ * @function page
217
+ * @memberof Twilio.Supersim.V1.SimContext.SimIpAddressList#
218
+ *
219
+ * @param {object} [opts] - Options for request
220
+ * @param {string} [opts.pageToken] - PageToken provided by the API
221
+ * @param {number} [opts.pageNumber] -
222
+ * Page Number, this value is simply for client state
223
+ * @param {number} [opts.pageSize] - Number of records to return, defaults to 50
224
+ * @param {function} [callback] - Callback to handle list of records
225
+ *
226
+ * @returns {Promise} Resolves to a list of records
227
+ */
228
+ /* jshint ignore:end */
229
+ SimIpAddressListInstance.page = function page(opts, callback) {
230
+ if (_.isFunction(opts)) {
231
+ callback = opts;
232
+ opts = {};
233
+ }
234
+ opts = opts || {};
235
+
236
+ var deferred = Q.defer();
237
+ var data = values.of({
238
+ 'PageToken': opts.pageToken,
239
+ 'Page': opts.pageNumber,
240
+ 'PageSize': opts.pageSize
241
+ });
242
+
243
+ var promise = this._version.page({uri: this._uri, method: 'GET', params: data});
244
+
245
+ promise = promise.then(function(payload) {
246
+ deferred.resolve(new SimIpAddressPage(this._version, payload, this._solution));
247
+ }.bind(this));
248
+
249
+ promise.catch(function(error) {
250
+ deferred.reject(error);
251
+ });
252
+
253
+ if (_.isFunction(callback)) {
254
+ deferred.promise.nodeify(callback);
255
+ }
256
+
257
+ return deferred.promise;
258
+ };
259
+
260
+ /* jshint ignore:start */
261
+ /**
262
+ * Retrieve a single target page of SimIpAddressInstance records from the API.
263
+ *
264
+ * The request is executed immediately.
265
+ *
266
+ * If a function is passed as the first argument, it will be used as the callback
267
+ * function.
268
+ *
269
+ * @function getPage
270
+ * @memberof Twilio.Supersim.V1.SimContext.SimIpAddressList#
271
+ *
272
+ * @param {string} [targetUrl] - API-generated URL for the requested results page
273
+ * @param {function} [callback] - Callback to handle list of records
274
+ *
275
+ * @returns {Promise} Resolves to a list of records
276
+ */
277
+ /* jshint ignore:end */
278
+ SimIpAddressListInstance.getPage = function getPage(targetUrl, callback) {
279
+ var deferred = Q.defer();
280
+
281
+ var promise = this._version._domain.twilio.request({method: 'GET', uri: targetUrl});
282
+
283
+ promise = promise.then(function(payload) {
284
+ deferred.resolve(new SimIpAddressPage(this._version, payload, this._solution));
285
+ }.bind(this));
286
+
287
+ promise.catch(function(error) {
288
+ deferred.reject(error);
289
+ });
290
+
291
+ if (_.isFunction(callback)) {
292
+ deferred.promise.nodeify(callback);
293
+ }
294
+
295
+ return deferred.promise;
296
+ };
297
+
298
+ /* jshint ignore:start */
299
+ /**
300
+ * Provide a user-friendly representation
301
+ *
302
+ * @function toJSON
303
+ * @memberof Twilio.Supersim.V1.SimContext.SimIpAddressList#
304
+ *
305
+ * @returns Object
306
+ */
307
+ /* jshint ignore:end */
308
+ SimIpAddressListInstance.toJSON = function toJSON() {
309
+ return this._solution;
310
+ };
311
+
312
+ SimIpAddressListInstance[util.inspect.custom] = function inspect(depth, options)
313
+ {
314
+ return util.inspect(this.toJSON(), options);
315
+ };
316
+
317
+ return SimIpAddressListInstance;
318
+ };
319
+
320
+
321
+ /* jshint ignore:start */
322
+ /**
323
+ * Initialize the SimIpAddressPage
324
+ *
325
+ * PLEASE NOTE that this class contains beta products that are subject to change.
326
+ * Use them with caution.
327
+ *
328
+ * @constructor Twilio.Supersim.V1.SimContext.SimIpAddressPage
329
+ *
330
+ * @param {V1} version - Version of the resource
331
+ * @param {Response<string>} response - Response from the API
332
+ * @param {SimIpAddressSolution} solution - Path solution
333
+ *
334
+ * @returns SimIpAddressPage
335
+ */
336
+ /* jshint ignore:end */
337
+ SimIpAddressPage = function SimIpAddressPage(version, response, solution) {
338
+ // Path Solution
339
+ this._solution = solution;
340
+
341
+ Page.prototype.constructor.call(this, version, response, this._solution);
342
+ };
343
+
344
+ _.extend(SimIpAddressPage.prototype, Page.prototype);
345
+ SimIpAddressPage.prototype.constructor = SimIpAddressPage;
346
+
347
+ /* jshint ignore:start */
348
+ /**
349
+ * Build an instance of SimIpAddressInstance
350
+ *
351
+ * @function getInstance
352
+ * @memberof Twilio.Supersim.V1.SimContext.SimIpAddressPage#
353
+ *
354
+ * @param {SimIpAddressPayload} payload - Payload response from the API
355
+ *
356
+ * @returns SimIpAddressInstance
357
+ */
358
+ /* jshint ignore:end */
359
+ SimIpAddressPage.prototype.getInstance = function getInstance(payload) {
360
+ return new SimIpAddressInstance(this._version, payload, this._solution.simSid);
361
+ };
362
+
363
+ /* jshint ignore:start */
364
+ /**
365
+ * Provide a user-friendly representation
366
+ *
367
+ * @function toJSON
368
+ * @memberof Twilio.Supersim.V1.SimContext.SimIpAddressPage#
369
+ *
370
+ * @returns Object
371
+ */
372
+ /* jshint ignore:end */
373
+ SimIpAddressPage.prototype.toJSON = function toJSON() {
374
+ let clone = {};
375
+ _.forOwn(this, function(value, key) {
376
+ if (!_.startsWith(key, '_') && ! _.isFunction(value)) {
377
+ clone[key] = value;
378
+ }
379
+ });
380
+ return clone;
381
+ };
382
+
383
+ SimIpAddressPage.prototype[util.inspect.custom] = function inspect(depth,
384
+ options) {
385
+ return util.inspect(this.toJSON(), options);
386
+ };
387
+
388
+
389
+ /* jshint ignore:start */
390
+ /**
391
+ * Initialize the SimIpAddressContext
392
+ *
393
+ * PLEASE NOTE that this class contains beta products that are subject to change.
394
+ * Use them with caution.
395
+ *
396
+ * @constructor Twilio.Supersim.V1.SimContext.SimIpAddressInstance
397
+ *
398
+ * @property {string} ipAddress - IP address assigned to the given Super SIM
399
+ * @property {sim_ip_address.ip_address_version} ipAddressVersion -
400
+ * IP address version
401
+ *
402
+ * @param {V1} version - Version of the resource
403
+ * @param {SimIpAddressPayload} payload - The instance payload
404
+ * @param {sid} simSid - The unique string that identifies the resource
405
+ */
406
+ /* jshint ignore:end */
407
+ SimIpAddressInstance = function SimIpAddressInstance(version, payload, simSid) {
408
+ this._version = version;
409
+
410
+ // Marshaled Properties
411
+ this.ipAddress = payload.ip_address; // jshint ignore:line
412
+ this.ipAddressVersion = payload.ip_address_version; // jshint ignore:line
413
+
414
+ // Context
415
+ this._context = undefined;
416
+ this._solution = {simSid: simSid, };
417
+ };
418
+
419
+ /* jshint ignore:start */
420
+ /**
421
+ * Provide a user-friendly representation
422
+ *
423
+ * @function toJSON
424
+ * @memberof Twilio.Supersim.V1.SimContext.SimIpAddressInstance#
425
+ *
426
+ * @returns Object
427
+ */
428
+ /* jshint ignore:end */
429
+ SimIpAddressInstance.prototype.toJSON = function toJSON() {
430
+ let clone = {};
431
+ _.forOwn(this, function(value, key) {
432
+ if (!_.startsWith(key, '_') && ! _.isFunction(value)) {
433
+ clone[key] = value;
434
+ }
435
+ });
436
+ return clone;
437
+ };
438
+
439
+ SimIpAddressInstance.prototype[util.inspect.custom] = function inspect(depth,
440
+ options) {
441
+ return util.inspect(this.toJSON(), options);
442
+ };
443
+
444
+ module.exports = {
445
+ SimIpAddressList: SimIpAddressList,
446
+ SimIpAddressPage: SimIpAddressPage,
447
+ SimIpAddressInstance: SimIpAddressInstance
448
+ };
@@ -11,6 +11,8 @@ import V1 = require('../V1');
11
11
  import { BillingPeriodList } from './sim/billingPeriod';
12
12
  import { BillingPeriodListInstance } from './sim/billingPeriod';
13
13
  import { SerializableClass } from '../../../interfaces';
14
+ import { SimIpAddressList } from './sim/simIpAddress';
15
+ import { SimIpAddressListInstance } from './sim/simIpAddress';
14
16
 
15
17
  type SimStatus = 'new'|'ready'|'active'|'inactive'|'scheduled';
16
18
 
@@ -290,6 +292,7 @@ declare class SimContext {
290
292
  * @param callback - Callback to handle processed record
291
293
  */
292
294
  fetch(callback?: (error: Error | null, items: SimInstance) => any): Promise<SimInstance>;
295
+ simIpAddresses: SimIpAddressListInstance;
293
296
  /**
294
297
  * Provide a user-friendly representation
295
298
  */
@@ -341,6 +344,10 @@ declare class SimInstance extends SerializableClass {
341
344
  iccid: string;
342
345
  links: string;
343
346
  sid: string;
347
+ /**
348
+ * Access the simIpAddresses
349
+ */
350
+ simIpAddresses(): SimIpAddressListInstance;
344
351
  status: SimStatus;
345
352
  /**
346
353
  * Provide a user-friendly representation
@@ -14,6 +14,7 @@ var _ = require('lodash'); /* jshint ignore:line */
14
14
  var util = require('util'); /* jshint ignore:line */
15
15
  var BillingPeriodList = require('./sim/billingPeriod').BillingPeriodList;
16
16
  var Page = require('../../../base/Page'); /* jshint ignore:line */
17
+ var SimIpAddressList = require('./sim/simIpAddress').SimIpAddressList;
17
18
  var deserialize = require(
18
19
  '../../../base/deserialize'); /* jshint ignore:line */
19
20
  var values = require('../../../base/values'); /* jshint ignore:line */
@@ -590,6 +591,20 @@ SimInstance.prototype.billingPeriods = function billingPeriods() {
590
591
  return this._proxy.billingPeriods;
591
592
  };
592
593
 
594
+ /* jshint ignore:start */
595
+ /**
596
+ * Access the simIpAddresses
597
+ *
598
+ * @function simIpAddresses
599
+ * @memberof Twilio.Supersim.V1.SimInstance#
600
+ *
601
+ * @returns {Twilio.Supersim.V1.SimContext.SimIpAddressList}
602
+ */
603
+ /* jshint ignore:end */
604
+ SimInstance.prototype.simIpAddresses = function simIpAddresses() {
605
+ return this._proxy.simIpAddresses;
606
+ };
607
+
593
608
  /* jshint ignore:start */
594
609
  /**
595
610
  * Provide a user-friendly representation
@@ -626,6 +641,8 @@ SimInstance.prototype[util.inspect.custom] = function inspect(depth, options) {
626
641
  *
627
642
  * @property {Twilio.Supersim.V1.SimContext.BillingPeriodList} billingPeriods -
628
643
  * billingPeriods resource
644
+ * @property {Twilio.Supersim.V1.SimContext.SimIpAddressList} simIpAddresses -
645
+ * simIpAddresses resource
629
646
  *
630
647
  * @param {V1} version - Version of the resource
631
648
  * @param {sid_like} sid - The SID that identifies the resource to fetch
@@ -640,6 +657,7 @@ SimContext = function SimContext(version, sid) {
640
657
 
641
658
  // Dependents
642
659
  this._billingPeriods = undefined;
660
+ this._simIpAddresses = undefined;
643
661
  };
644
662
 
645
663
  /* jshint ignore:start */
@@ -741,6 +759,16 @@ Object.defineProperty(SimContext.prototype,
741
759
  }
742
760
  });
743
761
 
762
+ Object.defineProperty(SimContext.prototype,
763
+ 'simIpAddresses', {
764
+ get: function() {
765
+ if (!this._simIpAddresses) {
766
+ this._simIpAddresses = new SimIpAddressList(this._version, this._solution.sid);
767
+ }
768
+ return this._simIpAddresses;
769
+ }
770
+ });
771
+
744
772
  /* jshint ignore:start */
745
773
  /**
746
774
  * Provide a user-friendly representation
@@ -21,13 +21,19 @@ type VerificationCheckChannel = 'sms'|'call'|'email'|'whatsapp'|'sna';
21
21
  declare function VerificationCheckList(version: V2, serviceSid: string): VerificationCheckListInstance;
22
22
 
23
23
  interface VerificationCheckListInstance {
24
+ /**
25
+ * create a VerificationCheckInstance
26
+ *
27
+ * @param callback - Callback to handle processed record
28
+ */
29
+ create(callback?: (error: Error | null, item: VerificationCheckInstance) => any): Promise<VerificationCheckInstance>;
24
30
  /**
25
31
  * create a VerificationCheckInstance
26
32
  *
27
33
  * @param opts - Options for request
28
34
  * @param callback - Callback to handle processed record
29
35
  */
30
- create(opts: VerificationCheckListInstanceCreateOptions, callback?: (error: Error | null, item: VerificationCheckInstance) => any): Promise<VerificationCheckInstance>;
36
+ create(opts?: VerificationCheckListInstanceCreateOptions, callback?: (error: Error | null, item: VerificationCheckInstance) => any): Promise<VerificationCheckInstance>;
31
37
  /**
32
38
  * Provide a user-friendly representation
33
39
  */
@@ -45,7 +51,7 @@ interface VerificationCheckListInstance {
45
51
  */
46
52
  interface VerificationCheckListInstanceCreateOptions {
47
53
  amount?: string;
48
- code: string;
54
+ code?: string;
49
55
  payee?: string;
50
56
  to?: string;
51
57
  verificationSid?: string;
@@ -58,8 +58,7 @@ VerificationCheckList = function VerificationCheckList(version, serviceSid) {
58
58
  * @function create
59
59
  * @memberof Twilio.Verify.V2.ServiceContext.VerificationCheckList#
60
60
  *
61
- * @param {object} opts - Options for request
62
- * @param {string} opts.code - The verification string
61
+ * @param {object} [opts] - Options for request
63
62
  * @param {string} [opts.to] - The phone number or email to verify
64
63
  * @param {string} [opts.verificationSid] -
65
64
  * A SID that uniquely identifies the Verification Check
@@ -67,26 +66,26 @@ VerificationCheckList = function VerificationCheckList(version, serviceSid) {
67
66
  * The amount of the associated PSD2 compliant transaction.
68
67
  * @param {string} [opts.payee] -
69
68
  * The payee of the associated PSD2 compliant transaction
69
+ * @param {string} [opts.code] - The verification string
70
70
  * @param {function} [callback] - Callback to handle processed record
71
71
  *
72
72
  * @returns {Promise} Resolves to processed VerificationCheckInstance
73
73
  */
74
74
  /* jshint ignore:end */
75
75
  VerificationCheckListInstance.create = function create(opts, callback) {
76
- if (_.isUndefined(opts)) {
77
- throw new Error('Required parameter "opts" missing.');
78
- }
79
- if (_.isUndefined(opts['code'])) {
80
- throw new Error('Required parameter "opts[\'code\']" missing.');
76
+ if (_.isFunction(opts)) {
77
+ callback = opts;
78
+ opts = {};
81
79
  }
80
+ opts = opts || {};
82
81
 
83
82
  var deferred = Q.defer();
84
83
  var data = values.of({
85
- 'Code': _.get(opts, 'code'),
86
84
  'To': _.get(opts, 'to'),
87
85
  'VerificationSid': _.get(opts, 'verificationSid'),
88
86
  'Amount': _.get(opts, 'amount'),
89
- 'Payee': _.get(opts, 'payee')
87
+ 'Payee': _.get(opts, 'payee'),
88
+ 'Code': _.get(opts, 'code')
90
89
  });
91
90
 
92
91
  var promise = this._version.create({uri: this._uri, method: 'POST', data: data});