@@ -66,34 +66,35 @@ PublicKeyList = function PublicKeyList(version) {
66
66
* @memberof Twilio.Accounts.V1.CredentialContext.PublicKeyList
67
67
* @instance
68
68
*
69
- * @param {object|function } opts - ...
69
+ * @param {object } [ opts] - ...
70
70
* @param {number } [opts.limit] -
71
71
* Upper limit for the number of records to return.
72
72
* each() guarantees never to return more than limit.
73
73
* Default is no limit
74
- * @param {number } [opts.pageSize=50 ] -
74
+ * @param {number } [opts.pageSize] -
75
75
* Number of records to fetch per request,
76
76
* when not set will use the default value of 50 records.
77
77
* If no pageSize is defined but a limit is defined,
78
78
* each() will attempt to read the limit with the most efficient
79
79
* page size, i.e. min(limit, 1000)
80
80
* @param {Function } [opts.callback] -
81
81
* Function to process each record. If this and a positional
82
- * callback are passed, this one will be used
82
+ * callback are passed, this one will be used
83
83
* @param {Function } [opts.done] -
84
84
* Function to be called upon completion of streaming
85
85
* @param {Function } [callback] - Function to process each record
86
86
*/
87
87
/* jshint ignore:end */
88
88
PublicKeyListInstance . each = function each ( opts , callback ) {
89
- opts = opts || { } ;
90
89
if ( _ . isFunction ( opts ) ) {
91
- opts = { callback : opts } ;
92
- } else if ( _ . isFunction ( callback ) && ! _ . isFunction ( opts . callback ) ) {
93
- opts . callback = callback ;
90
+ callback = opts ;
91
+ opts = { } ;
94
92
}
95
-
96
- if ( _ . isUndefined ( opts . callback ) ) {
93
+ opts = opts || { } ;
94
+ if ( opts . callback ) {
95
+ callback = opts . callback ;
96
+ }
97
+ if ( _ . isUndefined ( callback ) ) {
97
98
throw new Error ( 'Callback function must be provided' ) ;
98
99
}
99
100
@@ -127,7 +128,7 @@ PublicKeyList = function PublicKeyList(version) {
127
128
}
128
129
129
130
currentResource ++ ;
130
- opts . callback ( instance , onComplete ) ;
131
+ callback ( instance , onComplete ) ;
131
132
} ) ;
132
133
133
134
if ( ( limits . pageLimit && limits . pageLimit <= currentPage ) ) {
@@ -154,7 +155,7 @@ PublicKeyList = function PublicKeyList(version) {
154
155
* @memberof Twilio.Accounts.V1.CredentialContext.PublicKeyList
155
156
* @instance
156
157
*
157
- * @param {object|function } opts - ...
158
+ * @param {object } [ opts] - ...
158
159
* @param {number } [opts.limit] -
159
160
* Upper limit for the number of records to return.
160
161
* list() guarantees never to return more than limit.
@@ -213,7 +214,7 @@ PublicKeyList = function PublicKeyList(version) {
213
214
* @memberof Twilio.Accounts.V1.CredentialContext.PublicKeyList
214
215
* @instance
215
216
*
216
- * @param {object|function } opts - ...
217
+ * @param {object } [ opts] - ...
217
218
* @param {string } [opts.pageToken] - PageToken provided by the API
218
219
* @param {number } [opts.pageNumber] -
219
220
* Page Number, this value is simply for client state
@@ -224,6 +225,10 @@ PublicKeyList = function PublicKeyList(version) {
224
225
*/
225
226
/* jshint ignore:end */
226
227
PublicKeyListInstance . page = function page ( opts , callback ) {
228
+ if ( _ . isFunction ( opts ) ) {
229
+ callback = opts ;
230
+ opts = { } ;
231
+ }
227
232
opts = opts || { } ;
228
233
229
234
var deferred = Q . defer ( ) ;
@@ -471,7 +476,7 @@ PublicKeyInstance.prototype.fetch = function fetch(callback) {
471
476
* @memberof Twilio.Accounts.V1.CredentialContext.PublicKeyInstance
472
477
* @instance
473
478
*
474
- * @param {object|function } opts - ...
479
+ * @param {object } [ opts] - ...
475
480
* @param {string } [opts.friendlyName] -
476
481
* A human readable description of this resource
477
482
* @param {function } [callback] - Callback to handle processed record
@@ -582,7 +587,7 @@ PublicKeyContext.prototype.fetch = function fetch(callback) {
582
587
* @memberof Twilio.Accounts.V1.CredentialContext.PublicKeyContext
583
588
* @instance
584
589
*
585
- * @param {object|function } opts - ...
590
+ * @param {object } [ opts] - ...
586
591
* @param {string } [opts.friendlyName] -
587
592
* A human readable description of this resource
588
593
* @param {function } [callback] - Callback to handle processed record
0 commit comments