API generation
This commit is contained in:
@ -13,15 +13,21 @@ function buildIndicesClose (opts) {
|
||||
* @param {boolean} allow_no_indices - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
|
||||
* @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both.
|
||||
*/
|
||||
return function indicesClose (params, callback) {
|
||||
return function indicesClose (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) => {
|
||||
indicesClose(params, (err, body) => {
|
||||
indicesClose(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
@ -95,7 +101,7 @@ function buildIndicesClose (opts) {
|
||||
)
|
||||
}
|
||||
|
||||
var ignore = params.ignore || null
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
@ -107,12 +113,17 @@ function buildIndicesClose (opts) {
|
||||
path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'),
|
||||
querystring,
|
||||
body: '',
|
||||
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