API generation
This commit is contained in:
@ -8,15 +8,21 @@ function buildCcrGetAutoFollowPattern (opts) {
|
||||
*
|
||||
* @param {string} name - The name of the auto follow pattern.
|
||||
*/
|
||||
return function ccrGetAutoFollowPattern (params, callback) {
|
||||
return function ccrGetAutoFollowPattern (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
ccrGetAutoFollowPattern(params, (err, body) => {
|
||||
ccrGetAutoFollowPattern(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
@ -58,7 +64,7 @@ function buildCcrGetAutoFollowPattern (opts) {
|
||||
)
|
||||
}
|
||||
|
||||
var ignore = params.ignore || null
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
@ -70,12 +76,17 @@ function buildCcrGetAutoFollowPattern (opts) {
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
querystring,
|
||||
body: null,
|
||||
headers: params.headers || null,
|
||||
ignore,
|
||||
requestTimeout: params.requestTimeout || null
|
||||
headers: params.headers || null
|
||||
}
|
||||
|
||||
return makeRequest(request, callback)
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user