From 50e3de60f0fa6b25d71a9f3723f07b441d509d22 Mon Sep 17 00:00:00 2001 From: delvedor Date: Fri, 3 May 2019 17:58:14 +0200 Subject: [PATCH 1/6] Updated code generation --- scripts/utils/generateApis.js | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/scripts/utils/generateApis.js b/scripts/utils/generateApis.js index f00d49dc8..61746bb8e 100644 --- a/scripts/utils/generateApis.js +++ b/scripts/utils/generateApis.js @@ -138,7 +138,7 @@ function generate (spec, common) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } @@ -153,20 +153,8 @@ function generate (spec, common) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} From a153675633c9e547f8db2e331d6dba33f227edce Mon Sep 17 00:00:00 2001 From: delvedor Date: Fri, 3 May 2019 17:58:20 +0200 Subject: [PATCH 2/6] API generation --- api/api/bulk.js | 18 +++--------------- api/api/cat.aliases.js | 18 +++--------------- api/api/cat.allocation.js | 18 +++--------------- api/api/cat.count.js | 18 +++--------------- api/api/cat.fielddata.js | 18 +++--------------- api/api/cat.health.js | 18 +++--------------- api/api/cat.help.js | 18 +++--------------- api/api/cat.indices.js | 18 +++--------------- api/api/cat.master.js | 18 +++--------------- api/api/cat.nodeattrs.js | 18 +++--------------- api/api/cat.nodes.js | 18 +++--------------- api/api/cat.pending_tasks.js | 18 +++--------------- api/api/cat.plugins.js | 18 +++--------------- api/api/cat.recovery.js | 18 +++--------------- api/api/cat.repositories.js | 18 +++--------------- api/api/cat.segments.js | 18 +++--------------- api/api/cat.shards.js | 18 +++--------------- api/api/cat.snapshots.js | 18 +++--------------- api/api/cat.tasks.js | 18 +++--------------- api/api/cat.templates.js | 18 +++--------------- api/api/cat.thread_pool.js | 18 +++--------------- api/api/ccr.delete_auto_follow_pattern.js | 18 +++--------------- api/api/ccr.follow.js | 18 +++--------------- api/api/ccr.follow_info.js | 18 +++--------------- api/api/ccr.follow_stats.js | 18 +++--------------- api/api/ccr.forget_follower.js | 18 +++--------------- api/api/ccr.get_auto_follow_pattern.js | 18 +++--------------- api/api/ccr.pause_follow.js | 18 +++--------------- api/api/ccr.put_auto_follow_pattern.js | 18 +++--------------- api/api/ccr.resume_follow.js | 18 +++--------------- api/api/ccr.stats.js | 18 +++--------------- api/api/ccr.unfollow.js | 18 +++--------------- api/api/clear_scroll.js | 18 +++--------------- api/api/cluster.allocation_explain.js | 18 +++--------------- api/api/cluster.get_settings.js | 18 +++--------------- api/api/cluster.health.js | 18 +++--------------- api/api/cluster.pending_tasks.js | 18 +++--------------- api/api/cluster.put_settings.js | 18 +++--------------- api/api/cluster.remote_info.js | 18 +++--------------- api/api/cluster.reroute.js | 18 +++--------------- api/api/cluster.state.js | 18 +++--------------- api/api/cluster.stats.js | 18 +++--------------- api/api/count.js | 18 +++--------------- api/api/create.js | 18 +++--------------- .../data_frame.delete_data_frame_transform.js | 18 +++--------------- api/api/data_frame.get_data_frame_transform.js | 18 +++--------------- ...ata_frame.get_data_frame_transform_stats.js | 18 +++--------------- .../data_frame.preview_data_frame_transform.js | 18 +++--------------- api/api/data_frame.put_data_frame_transform.js | 18 +++--------------- .../data_frame.start_data_frame_transform.js | 18 +++--------------- .../data_frame.stop_data_frame_transform.js | 18 +++--------------- api/api/delete.js | 18 +++--------------- api/api/delete_by_query.js | 18 +++--------------- api/api/delete_by_query_rethrottle.js | 18 +++--------------- api/api/delete_script.js | 18 +++--------------- api/api/exists.js | 18 +++--------------- api/api/exists_source.js | 18 +++--------------- api/api/explain.js | 18 +++--------------- api/api/field_caps.js | 18 +++--------------- api/api/get.js | 18 +++--------------- api/api/get_script.js | 18 +++--------------- api/api/get_source.js | 18 +++--------------- api/api/graph.explore.js | 18 +++--------------- api/api/ilm.delete_lifecycle.js | 18 +++--------------- api/api/ilm.explain_lifecycle.js | 18 +++--------------- api/api/ilm.get_lifecycle.js | 18 +++--------------- api/api/ilm.get_status.js | 18 +++--------------- api/api/ilm.move_to_step.js | 18 +++--------------- api/api/ilm.put_lifecycle.js | 18 +++--------------- api/api/ilm.remove_policy.js | 18 +++--------------- api/api/ilm.retry.js | 18 +++--------------- api/api/ilm.start.js | 18 +++--------------- api/api/ilm.stop.js | 18 +++--------------- api/api/index.js | 18 +++--------------- api/api/indices.analyze.js | 18 +++--------------- api/api/indices.clear_cache.js | 18 +++--------------- api/api/indices.close.js | 18 +++--------------- api/api/indices.create.js | 18 +++--------------- api/api/indices.delete.js | 18 +++--------------- api/api/indices.delete_alias.js | 18 +++--------------- api/api/indices.delete_template.js | 18 +++--------------- api/api/indices.exists.js | 18 +++--------------- api/api/indices.exists_alias.js | 18 +++--------------- api/api/indices.exists_template.js | 18 +++--------------- api/api/indices.exists_type.js | 18 +++--------------- api/api/indices.flush.js | 18 +++--------------- api/api/indices.flush_synced.js | 18 +++--------------- api/api/indices.forcemerge.js | 18 +++--------------- api/api/indices.freeze.js | 18 +++--------------- api/api/indices.get.js | 18 +++--------------- api/api/indices.get_alias.js | 18 +++--------------- api/api/indices.get_field_mapping.js | 18 +++--------------- api/api/indices.get_mapping.js | 18 +++--------------- api/api/indices.get_settings.js | 18 +++--------------- api/api/indices.get_template.js | 18 +++--------------- api/api/indices.get_upgrade.js | 18 +++--------------- api/api/indices.open.js | 18 +++--------------- api/api/indices.put_alias.js | 18 +++--------------- api/api/indices.put_mapping.js | 18 +++--------------- api/api/indices.put_settings.js | 18 +++--------------- api/api/indices.put_template.js | 18 +++--------------- api/api/indices.recovery.js | 18 +++--------------- api/api/indices.refresh.js | 18 +++--------------- api/api/indices.rollover.js | 18 +++--------------- api/api/indices.segments.js | 18 +++--------------- api/api/indices.shard_stores.js | 18 +++--------------- api/api/indices.shrink.js | 18 +++--------------- api/api/indices.split.js | 18 +++--------------- api/api/indices.stats.js | 18 +++--------------- api/api/indices.unfreeze.js | 18 +++--------------- api/api/indices.update_aliases.js | 18 +++--------------- api/api/indices.upgrade.js | 18 +++--------------- api/api/indices.validate_query.js | 18 +++--------------- api/api/info.js | 18 +++--------------- api/api/ingest.delete_pipeline.js | 18 +++--------------- api/api/ingest.get_pipeline.js | 18 +++--------------- api/api/ingest.processor_grok.js | 18 +++--------------- api/api/ingest.put_pipeline.js | 18 +++--------------- api/api/ingest.simulate.js | 18 +++--------------- api/api/license.delete.js | 18 +++--------------- api/api/license.get.js | 18 +++--------------- api/api/license.get_basic_status.js | 18 +++--------------- api/api/license.get_trial_status.js | 18 +++--------------- api/api/license.post.js | 18 +++--------------- api/api/license.post_start_basic.js | 18 +++--------------- api/api/license.post_start_trial.js | 18 +++--------------- api/api/mget.js | 18 +++--------------- api/api/migration.deprecations.js | 18 +++--------------- api/api/ml.close_job.js | 18 +++--------------- api/api/ml.delete_calendar.js | 18 +++--------------- api/api/ml.delete_calendar_event.js | 18 +++--------------- api/api/ml.delete_calendar_job.js | 18 +++--------------- api/api/ml.delete_datafeed.js | 18 +++--------------- api/api/ml.delete_expired_data.js | 18 +++--------------- api/api/ml.delete_filter.js | 18 +++--------------- api/api/ml.delete_forecast.js | 18 +++--------------- api/api/ml.delete_job.js | 18 +++--------------- api/api/ml.delete_model_snapshot.js | 18 +++--------------- api/api/ml.find_file_structure.js | 18 +++--------------- api/api/ml.flush_job.js | 18 +++--------------- api/api/ml.forecast.js | 18 +++--------------- api/api/ml.get_buckets.js | 18 +++--------------- api/api/ml.get_calendar_events.js | 18 +++--------------- api/api/ml.get_calendars.js | 18 +++--------------- api/api/ml.get_categories.js | 18 +++--------------- api/api/ml.get_datafeed_stats.js | 18 +++--------------- api/api/ml.get_datafeeds.js | 18 +++--------------- api/api/ml.get_filters.js | 18 +++--------------- api/api/ml.get_influencers.js | 18 +++--------------- api/api/ml.get_job_stats.js | 18 +++--------------- api/api/ml.get_jobs.js | 18 +++--------------- api/api/ml.get_model_snapshots.js | 18 +++--------------- api/api/ml.get_overall_buckets.js | 18 +++--------------- api/api/ml.get_records.js | 18 +++--------------- api/api/ml.info.js | 18 +++--------------- api/api/ml.open_job.js | 18 +++--------------- api/api/ml.post_calendar_events.js | 18 +++--------------- api/api/ml.post_data.js | 18 +++--------------- api/api/ml.preview_datafeed.js | 18 +++--------------- api/api/ml.put_calendar.js | 18 +++--------------- api/api/ml.put_calendar_job.js | 18 +++--------------- api/api/ml.put_datafeed.js | 18 +++--------------- api/api/ml.put_filter.js | 18 +++--------------- api/api/ml.put_job.js | 18 +++--------------- api/api/ml.revert_model_snapshot.js | 18 +++--------------- api/api/ml.set_upgrade_mode.js | 18 +++--------------- api/api/ml.start_datafeed.js | 18 +++--------------- api/api/ml.stop_datafeed.js | 18 +++--------------- api/api/ml.update_datafeed.js | 18 +++--------------- api/api/ml.update_filter.js | 18 +++--------------- api/api/ml.update_job.js | 18 +++--------------- api/api/ml.update_model_snapshot.js | 18 +++--------------- api/api/ml.validate.js | 18 +++--------------- api/api/ml.validate_detector.js | 18 +++--------------- api/api/monitoring.bulk.js | 18 +++--------------- api/api/msearch.js | 18 +++--------------- api/api/msearch_template.js | 18 +++--------------- api/api/mtermvectors.js | 18 +++--------------- api/api/nodes.hot_threads.js | 18 +++--------------- api/api/nodes.info.js | 18 +++--------------- api/api/nodes.reload_secure_settings.js | 18 +++--------------- api/api/nodes.stats.js | 18 +++--------------- api/api/nodes.usage.js | 18 +++--------------- api/api/ping.js | 18 +++--------------- api/api/put_script.js | 18 +++--------------- api/api/rank_eval.js | 18 +++--------------- api/api/reindex.js | 18 +++--------------- api/api/reindex_rethrottle.js | 18 +++--------------- api/api/render_search_template.js | 18 +++--------------- api/api/rollup.delete_job.js | 18 +++--------------- api/api/rollup.get_jobs.js | 18 +++--------------- api/api/rollup.get_rollup_caps.js | 18 +++--------------- api/api/rollup.get_rollup_index_caps.js | 18 +++--------------- api/api/rollup.put_job.js | 18 +++--------------- api/api/rollup.rollup_search.js | 18 +++--------------- api/api/rollup.start_job.js | 18 +++--------------- api/api/rollup.stop_job.js | 18 +++--------------- api/api/scripts_painless_context.js | 18 +++--------------- api/api/scripts_painless_execute.js | 18 +++--------------- api/api/scroll.js | 18 +++--------------- api/api/search.js | 18 +++--------------- api/api/search_shards.js | 18 +++--------------- api/api/search_template.js | 18 +++--------------- api/api/security.authenticate.js | 18 +++--------------- api/api/security.change_password.js | 18 +++--------------- api/api/security.clear_cached_realms.js | 18 +++--------------- api/api/security.clear_cached_roles.js | 18 +++--------------- api/api/security.create_api_key.js | 18 +++--------------- api/api/security.delete_privileges.js | 18 +++--------------- api/api/security.delete_role.js | 18 +++--------------- api/api/security.delete_role_mapping.js | 18 +++--------------- api/api/security.delete_user.js | 18 +++--------------- api/api/security.disable_user.js | 18 +++--------------- api/api/security.enable_user.js | 18 +++--------------- api/api/security.get_api_key.js | 18 +++--------------- api/api/security.get_privileges.js | 18 +++--------------- api/api/security.get_role.js | 18 +++--------------- api/api/security.get_role_mapping.js | 18 +++--------------- api/api/security.get_token.js | 18 +++--------------- api/api/security.get_user.js | 18 +++--------------- api/api/security.get_user_privileges.js | 18 +++--------------- api/api/security.has_privileges.js | 18 +++--------------- api/api/security.invalidate_api_key.js | 18 +++--------------- api/api/security.invalidate_token.js | 18 +++--------------- api/api/security.put_privileges.js | 18 +++--------------- api/api/security.put_role.js | 18 +++--------------- api/api/security.put_role_mapping.js | 18 +++--------------- api/api/security.put_user.js | 18 +++--------------- api/api/snapshot.create.js | 18 +++--------------- api/api/snapshot.create_repository.js | 18 +++--------------- api/api/snapshot.delete.js | 18 +++--------------- api/api/snapshot.delete_repository.js | 18 +++--------------- api/api/snapshot.get.js | 18 +++--------------- api/api/snapshot.get_repository.js | 18 +++--------------- api/api/snapshot.restore.js | 18 +++--------------- api/api/snapshot.status.js | 18 +++--------------- api/api/snapshot.verify_repository.js | 18 +++--------------- api/api/sql.clear_cursor.js | 18 +++--------------- api/api/sql.query.js | 18 +++--------------- api/api/sql.translate.js | 18 +++--------------- api/api/ssl.certificates.js | 18 +++--------------- api/api/tasks.cancel.js | 18 +++--------------- api/api/tasks.get.js | 18 +++--------------- api/api/tasks.list.js | 18 +++--------------- api/api/termvectors.js | 18 +++--------------- api/api/update.js | 18 +++--------------- api/api/update_by_query.js | 18 +++--------------- api/api/update_by_query_rethrottle.js | 18 +++--------------- api/api/watcher.ack_watch.js | 18 +++--------------- api/api/watcher.activate_watch.js | 18 +++--------------- api/api/watcher.deactivate_watch.js | 18 +++--------------- api/api/watcher.delete_watch.js | 18 +++--------------- api/api/watcher.execute_watch.js | 18 +++--------------- api/api/watcher.get_watch.js | 18 +++--------------- api/api/watcher.put_watch.js | 18 +++--------------- api/api/watcher.start.js | 18 +++--------------- api/api/watcher.stats.js | 18 +++--------------- api/api/watcher.stop.js | 18 +++--------------- api/api/xpack.info.js | 18 +++--------------- api/api/xpack.usage.js | 18 +++--------------- 260 files changed, 780 insertions(+), 3900 deletions(-) diff --git a/api/api/bulk.js b/api/api/bulk.js index 15b660683..e916fcbd7 100644 --- a/api/api/bulk.js +++ b/api/api/bulk.js @@ -107,7 +107,7 @@ function buildBulk (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -128,20 +128,8 @@ function buildBulk (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/cat.aliases.js b/api/api/cat.aliases.js index 2b7ef3bc3..f834853af 100644 --- a/api/api/cat.aliases.js +++ b/api/api/cat.aliases.js @@ -93,7 +93,7 @@ function buildCatAliases (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -112,20 +112,8 @@ function buildCatAliases (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/cat.allocation.js b/api/api/cat.allocation.js index f7118efea..6d305e256 100644 --- a/api/api/cat.allocation.js +++ b/api/api/cat.allocation.js @@ -95,7 +95,7 @@ function buildCatAllocation (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -114,20 +114,8 @@ function buildCatAllocation (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/cat.count.js b/api/api/cat.count.js index cdb1c2ccd..8c727fc48 100644 --- a/api/api/cat.count.js +++ b/api/api/cat.count.js @@ -93,7 +93,7 @@ function buildCatCount (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -112,20 +112,8 @@ function buildCatCount (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/cat.fielddata.js b/api/api/cat.fielddata.js index d1e22cf0a..be5b16786 100644 --- a/api/api/cat.fielddata.js +++ b/api/api/cat.fielddata.js @@ -97,7 +97,7 @@ function buildCatFielddata (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -116,20 +116,8 @@ function buildCatFielddata (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/cat.health.js b/api/api/cat.health.js index 827ebd276..c591c5e74 100644 --- a/api/api/cat.health.js +++ b/api/api/cat.health.js @@ -94,7 +94,7 @@ function buildCatHealth (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -109,20 +109,8 @@ function buildCatHealth (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/cat.help.js b/api/api/cat.help.js index 2f744f49d..8c7a46818 100644 --- a/api/api/cat.help.js +++ b/api/api/cat.help.js @@ -81,7 +81,7 @@ function buildCatHelp (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -96,20 +96,8 @@ function buildCatHelp (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/cat.indices.js b/api/api/cat.indices.js index d731c372a..7fe98dc03 100644 --- a/api/api/cat.indices.js +++ b/api/api/cat.indices.js @@ -102,7 +102,7 @@ function buildCatIndices (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -121,20 +121,8 @@ function buildCatIndices (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/cat.master.js b/api/api/cat.master.js index 6ea1ef531..6620d0578 100644 --- a/api/api/cat.master.js +++ b/api/api/cat.master.js @@ -92,7 +92,7 @@ function buildCatMaster (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -107,20 +107,8 @@ function buildCatMaster (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/cat.nodeattrs.js b/api/api/cat.nodeattrs.js index 66995d45c..13ea0f1cc 100644 --- a/api/api/cat.nodeattrs.js +++ b/api/api/cat.nodeattrs.js @@ -92,7 +92,7 @@ function buildCatNodeattrs (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -107,20 +107,8 @@ function buildCatNodeattrs (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/cat.nodes.js b/api/api/cat.nodes.js index 21f27a517..19aec3f39 100644 --- a/api/api/cat.nodes.js +++ b/api/api/cat.nodes.js @@ -95,7 +95,7 @@ function buildCatNodes (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -110,20 +110,8 @@ function buildCatNodes (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/cat.pending_tasks.js b/api/api/cat.pending_tasks.js index 920a77e47..884cb0243 100644 --- a/api/api/cat.pending_tasks.js +++ b/api/api/cat.pending_tasks.js @@ -92,7 +92,7 @@ function buildCatPendingTasks (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -107,20 +107,8 @@ function buildCatPendingTasks (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/cat.plugins.js b/api/api/cat.plugins.js index e254ddb3b..84d8f068b 100644 --- a/api/api/cat.plugins.js +++ b/api/api/cat.plugins.js @@ -92,7 +92,7 @@ function buildCatPlugins (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -107,20 +107,8 @@ function buildCatPlugins (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/cat.recovery.js b/api/api/cat.recovery.js index 27938674a..c55178acd 100644 --- a/api/api/cat.recovery.js +++ b/api/api/cat.recovery.js @@ -93,7 +93,7 @@ function buildCatRecovery (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -112,20 +112,8 @@ function buildCatRecovery (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/cat.repositories.js b/api/api/cat.repositories.js index d4801efc9..68f1e60f2 100644 --- a/api/api/cat.repositories.js +++ b/api/api/cat.repositories.js @@ -92,7 +92,7 @@ function buildCatRepositories (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -107,20 +107,8 @@ function buildCatRepositories (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/cat.segments.js b/api/api/cat.segments.js index 9e2415c34..16ef904a7 100644 --- a/api/api/cat.segments.js +++ b/api/api/cat.segments.js @@ -90,7 +90,7 @@ function buildCatSegments (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -109,20 +109,8 @@ function buildCatSegments (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/cat.shards.js b/api/api/cat.shards.js index 15031236f..feabfc64c 100644 --- a/api/api/cat.shards.js +++ b/api/api/cat.shards.js @@ -95,7 +95,7 @@ function buildCatShards (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -114,20 +114,8 @@ function buildCatShards (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/cat.snapshots.js b/api/api/cat.snapshots.js index 94ead6ac4..ac05968c8 100644 --- a/api/api/cat.snapshots.js +++ b/api/api/cat.snapshots.js @@ -94,7 +94,7 @@ function buildCatSnapshots (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -113,20 +113,8 @@ function buildCatSnapshots (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/cat.tasks.js b/api/api/cat.tasks.js index e478ccc7e..a264a9791 100644 --- a/api/api/cat.tasks.js +++ b/api/api/cat.tasks.js @@ -97,7 +97,7 @@ function buildCatTasks (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -112,20 +112,8 @@ function buildCatTasks (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/cat.templates.js b/api/api/cat.templates.js index 432e1d28d..cd7252e87 100644 --- a/api/api/cat.templates.js +++ b/api/api/cat.templates.js @@ -93,7 +93,7 @@ function buildCatTemplates (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -112,20 +112,8 @@ function buildCatTemplates (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/cat.thread_pool.js b/api/api/cat.thread_pool.js index 49d7078f8..f1216a9d8 100644 --- a/api/api/cat.thread_pool.js +++ b/api/api/cat.thread_pool.js @@ -95,7 +95,7 @@ function buildCatThreadPool (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -114,20 +114,8 @@ function buildCatThreadPool (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ccr.delete_auto_follow_pattern.js b/api/api/ccr.delete_auto_follow_pattern.js index f5241c473..af7d02e8a 100644 --- a/api/api/ccr.delete_auto_follow_pattern.js +++ b/api/api/ccr.delete_auto_follow_pattern.js @@ -73,7 +73,7 @@ function buildCcrDeleteAutoFollowPattern (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -88,20 +88,8 @@ function buildCcrDeleteAutoFollowPattern (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ccr.follow.js b/api/api/ccr.follow.js index 9ee3158c6..0fb602361 100644 --- a/api/api/ccr.follow.js +++ b/api/api/ccr.follow.js @@ -79,7 +79,7 @@ function buildCcrFollow (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -94,20 +94,8 @@ function buildCcrFollow (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ccr.follow_info.js b/api/api/ccr.follow_info.js index 1e8040461..d75e517c4 100644 --- a/api/api/ccr.follow_info.js +++ b/api/api/ccr.follow_info.js @@ -67,7 +67,7 @@ function buildCcrFollowInfo (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -82,20 +82,8 @@ function buildCcrFollowInfo (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ccr.follow_stats.js b/api/api/ccr.follow_stats.js index 52373f123..8fae9f916 100644 --- a/api/api/ccr.follow_stats.js +++ b/api/api/ccr.follow_stats.js @@ -73,7 +73,7 @@ function buildCcrFollowStats (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -88,20 +88,8 @@ function buildCcrFollowStats (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ccr.forget_follower.js b/api/api/ccr.forget_follower.js index db17668a5..ab2fba318 100644 --- a/api/api/ccr.forget_follower.js +++ b/api/api/ccr.forget_follower.js @@ -78,7 +78,7 @@ function buildCcrForgetFollower (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -93,20 +93,8 @@ function buildCcrForgetFollower (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ccr.get_auto_follow_pattern.js b/api/api/ccr.get_auto_follow_pattern.js index 577e229ac..1ae2372a3 100644 --- a/api/api/ccr.get_auto_follow_pattern.js +++ b/api/api/ccr.get_auto_follow_pattern.js @@ -67,7 +67,7 @@ function buildCcrGetAutoFollowPattern (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -86,20 +86,8 @@ function buildCcrGetAutoFollowPattern (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ccr.pause_follow.js b/api/api/ccr.pause_follow.js index 462e30be4..46619f641 100644 --- a/api/api/ccr.pause_follow.js +++ b/api/api/ccr.pause_follow.js @@ -73,7 +73,7 @@ function buildCcrPauseFollow (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -88,20 +88,8 @@ function buildCcrPauseFollow (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ccr.put_auto_follow_pattern.js b/api/api/ccr.put_auto_follow_pattern.js index 0f2691714..6c86180dd 100644 --- a/api/api/ccr.put_auto_follow_pattern.js +++ b/api/api/ccr.put_auto_follow_pattern.js @@ -78,7 +78,7 @@ function buildCcrPutAutoFollowPattern (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -93,20 +93,8 @@ function buildCcrPutAutoFollowPattern (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ccr.resume_follow.js b/api/api/ccr.resume_follow.js index 36c666531..5f757bc98 100644 --- a/api/api/ccr.resume_follow.js +++ b/api/api/ccr.resume_follow.js @@ -74,7 +74,7 @@ function buildCcrResumeFollow (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -89,20 +89,8 @@ function buildCcrResumeFollow (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ccr.stats.js b/api/api/ccr.stats.js index 3f1d9bc39..305f21bff 100644 --- a/api/api/ccr.stats.js +++ b/api/api/ccr.stats.js @@ -66,7 +66,7 @@ function buildCcrStats (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -81,20 +81,8 @@ function buildCcrStats (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ccr.unfollow.js b/api/api/ccr.unfollow.js index 43c1ba4b1..d142f2a4e 100644 --- a/api/api/ccr.unfollow.js +++ b/api/api/ccr.unfollow.js @@ -73,7 +73,7 @@ function buildCcrUnfollow (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -88,20 +88,8 @@ function buildCcrUnfollow (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/clear_scroll.js b/api/api/clear_scroll.js index 8f17c4dc3..7181f0b0e 100644 --- a/api/api/clear_scroll.js +++ b/api/api/clear_scroll.js @@ -73,7 +73,7 @@ function buildClearScroll (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -92,20 +92,8 @@ function buildClearScroll (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/cluster.allocation_explain.js b/api/api/cluster.allocation_explain.js index 4e7155e30..d5f834562 100644 --- a/api/api/cluster.allocation_explain.js +++ b/api/api/cluster.allocation_explain.js @@ -78,7 +78,7 @@ function buildClusterAllocationExplain (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -93,20 +93,8 @@ function buildClusterAllocationExplain (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/cluster.get_settings.js b/api/api/cluster.get_settings.js index f9722e0b9..4032e501b 100644 --- a/api/api/cluster.get_settings.js +++ b/api/api/cluster.get_settings.js @@ -88,7 +88,7 @@ function buildClusterGetSettings (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -103,20 +103,8 @@ function buildClusterGetSettings (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/cluster.health.js b/api/api/cluster.health.js index 9c764b9fe..c67bbc629 100644 --- a/api/api/cluster.health.js +++ b/api/api/cluster.health.js @@ -108,7 +108,7 @@ function buildClusterHealth (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -127,20 +127,8 @@ function buildClusterHealth (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/cluster.pending_tasks.js b/api/api/cluster.pending_tasks.js index 32802c975..593e23dca 100644 --- a/api/api/cluster.pending_tasks.js +++ b/api/api/cluster.pending_tasks.js @@ -82,7 +82,7 @@ function buildClusterPendingTasks (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -97,20 +97,8 @@ function buildClusterPendingTasks (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/cluster.put_settings.js b/api/api/cluster.put_settings.js index 230714ce7..c355e51a5 100644 --- a/api/api/cluster.put_settings.js +++ b/api/api/cluster.put_settings.js @@ -86,7 +86,7 @@ function buildClusterPutSettings (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -101,20 +101,8 @@ function buildClusterPutSettings (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/cluster.remote_info.js b/api/api/cluster.remote_info.js index 62122e6ac..677af6093 100644 --- a/api/api/cluster.remote_info.js +++ b/api/api/cluster.remote_info.js @@ -77,7 +77,7 @@ function buildClusterRemoteInfo (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -92,20 +92,8 @@ function buildClusterRemoteInfo (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/cluster.reroute.js b/api/api/cluster.reroute.js index 9173b8b36..980e7fc1c 100644 --- a/api/api/cluster.reroute.js +++ b/api/api/cluster.reroute.js @@ -87,7 +87,7 @@ function buildClusterReroute (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -102,20 +102,8 @@ function buildClusterReroute (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/cluster.state.js b/api/api/cluster.state.js index 002097761..108fb84cc 100644 --- a/api/api/cluster.state.js +++ b/api/api/cluster.state.js @@ -108,7 +108,7 @@ function buildClusterState (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -129,20 +129,8 @@ function buildClusterState (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/cluster.stats.js b/api/api/cluster.stats.js index b57e67c56..188d9a9df 100644 --- a/api/api/cluster.stats.js +++ b/api/api/cluster.stats.js @@ -83,7 +83,7 @@ function buildClusterStats (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -102,20 +102,8 @@ function buildClusterStats (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/count.js b/api/api/count.js index ac504f2e5..723e6f262 100644 --- a/api/api/count.js +++ b/api/api/count.js @@ -116,7 +116,7 @@ function buildCount (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -137,20 +137,8 @@ function buildCount (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/create.js b/api/api/create.js index 3e14db497..ce6ec2b19 100644 --- a/api/api/create.js +++ b/api/api/create.js @@ -107,7 +107,7 @@ function buildCreate (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -126,20 +126,8 @@ function buildCreate (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/data_frame.delete_data_frame_transform.js b/api/api/data_frame.delete_data_frame_transform.js index 469f2c6d9..811033d76 100644 --- a/api/api/data_frame.delete_data_frame_transform.js +++ b/api/api/data_frame.delete_data_frame_transform.js @@ -77,7 +77,7 @@ function buildDataFrameDeleteDataFrameTransform (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -92,20 +92,8 @@ function buildDataFrameDeleteDataFrameTransform (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/data_frame.get_data_frame_transform.js b/api/api/data_frame.get_data_frame_transform.js index 7c58b2a92..eac731c16 100644 --- a/api/api/data_frame.get_data_frame_transform.js +++ b/api/api/data_frame.get_data_frame_transform.js @@ -76,7 +76,7 @@ function buildDataFrameGetDataFrameTransform (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -95,20 +95,8 @@ function buildDataFrameGetDataFrameTransform (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/data_frame.get_data_frame_transform_stats.js b/api/api/data_frame.get_data_frame_transform_stats.js index 40264ccd5..4c4f8cf91 100644 --- a/api/api/data_frame.get_data_frame_transform_stats.js +++ b/api/api/data_frame.get_data_frame_transform_stats.js @@ -76,7 +76,7 @@ function buildDataFrameGetDataFrameTransformStats (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -91,20 +91,8 @@ function buildDataFrameGetDataFrameTransformStats (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/data_frame.preview_data_frame_transform.js b/api/api/data_frame.preview_data_frame_transform.js index 85bd668a0..64ca95ae8 100644 --- a/api/api/data_frame.preview_data_frame_transform.js +++ b/api/api/data_frame.preview_data_frame_transform.js @@ -73,7 +73,7 @@ function buildDataFramePreviewDataFrameTransform (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -88,20 +88,8 @@ function buildDataFramePreviewDataFrameTransform (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/data_frame.put_data_frame_transform.js b/api/api/data_frame.put_data_frame_transform.js index 9514f7895..f02f8e1db 100644 --- a/api/api/data_frame.put_data_frame_transform.js +++ b/api/api/data_frame.put_data_frame_transform.js @@ -78,7 +78,7 @@ function buildDataFramePutDataFrameTransform (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -93,20 +93,8 @@ function buildDataFramePutDataFrameTransform (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/data_frame.start_data_frame_transform.js b/api/api/data_frame.start_data_frame_transform.js index 6f2218cca..7bca597f4 100644 --- a/api/api/data_frame.start_data_frame_transform.js +++ b/api/api/data_frame.start_data_frame_transform.js @@ -78,7 +78,7 @@ function buildDataFrameStartDataFrameTransform (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -93,20 +93,8 @@ function buildDataFrameStartDataFrameTransform (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/data_frame.stop_data_frame_transform.js b/api/api/data_frame.stop_data_frame_transform.js index be3919984..254f2ba47 100644 --- a/api/api/data_frame.stop_data_frame_transform.js +++ b/api/api/data_frame.stop_data_frame_transform.js @@ -81,7 +81,7 @@ function buildDataFrameStopDataFrameTransform (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -96,20 +96,8 @@ function buildDataFrameStopDataFrameTransform (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/delete.js b/api/api/delete.js index 727747be5..c33f9b459 100644 --- a/api/api/delete.js +++ b/api/api/delete.js @@ -110,7 +110,7 @@ function buildDelete (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -129,20 +129,8 @@ function buildDelete (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/delete_by_query.js b/api/api/delete_by_query.js index 2b95a02e6..57996e85c 100644 --- a/api/api/delete_by_query.js +++ b/api/api/delete_by_query.js @@ -169,7 +169,7 @@ function buildDeleteByQuery (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -188,20 +188,8 @@ function buildDeleteByQuery (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/delete_by_query_rethrottle.js b/api/api/delete_by_query_rethrottle.js index 8cc90e6ab..62b5cf37f 100644 --- a/api/api/delete_by_query_rethrottle.js +++ b/api/api/delete_by_query_rethrottle.js @@ -89,7 +89,7 @@ function buildDeleteByQueryRethrottle (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -104,20 +104,8 @@ function buildDeleteByQueryRethrottle (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/delete_script.js b/api/api/delete_script.js index 9ab6c4460..f5d146229 100644 --- a/api/api/delete_script.js +++ b/api/api/delete_script.js @@ -87,7 +87,7 @@ function buildDeleteScript (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -102,20 +102,8 @@ function buildDeleteScript (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/exists.js b/api/api/exists.js index 0bc2eead2..cb88ddaf3 100644 --- a/api/api/exists.js +++ b/api/api/exists.js @@ -114,7 +114,7 @@ function buildExists (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -133,20 +133,8 @@ function buildExists (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/exists_source.js b/api/api/exists_source.js index 7309e7a9d..a02acaf4b 100644 --- a/api/api/exists_source.js +++ b/api/api/exists_source.js @@ -120,7 +120,7 @@ function buildExistsSource (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -139,20 +139,8 @@ function buildExistsSource (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/explain.js b/api/api/explain.js index 26482fa00..7d46448b8 100644 --- a/api/api/explain.js +++ b/api/api/explain.js @@ -116,7 +116,7 @@ function buildExplain (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -135,20 +135,8 @@ function buildExplain (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/field_caps.js b/api/api/field_caps.js index 1771404cd..b4094734d 100644 --- a/api/api/field_caps.js +++ b/api/api/field_caps.js @@ -92,7 +92,7 @@ function buildFieldCaps (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -111,20 +111,8 @@ function buildFieldCaps (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/get.js b/api/api/get.js index 923732178..037142c1c 100644 --- a/api/api/get.js +++ b/api/api/get.js @@ -114,7 +114,7 @@ function buildGet (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -133,20 +133,8 @@ function buildGet (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/get_script.js b/api/api/get_script.js index aae577d34..a51628a4b 100644 --- a/api/api/get_script.js +++ b/api/api/get_script.js @@ -85,7 +85,7 @@ function buildGetScript (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -100,20 +100,8 @@ function buildGetScript (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/get_source.js b/api/api/get_source.js index 88bab3b77..81cd2dd43 100644 --- a/api/api/get_source.js +++ b/api/api/get_source.js @@ -111,7 +111,7 @@ function buildGetSource (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -130,20 +130,8 @@ function buildGetSource (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/graph.explore.js b/api/api/graph.explore.js index 44da987fb..a3b856666 100644 --- a/api/api/graph.explore.js +++ b/api/api/graph.explore.js @@ -78,7 +78,7 @@ function buildGraphExplore (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -97,20 +97,8 @@ function buildGraphExplore (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ilm.delete_lifecycle.js b/api/api/ilm.delete_lifecycle.js index 57ced77cc..f1cb697be 100644 --- a/api/api/ilm.delete_lifecycle.js +++ b/api/api/ilm.delete_lifecycle.js @@ -73,7 +73,7 @@ function buildIlmDeleteLifecycle (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -88,20 +88,8 @@ function buildIlmDeleteLifecycle (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ilm.explain_lifecycle.js b/api/api/ilm.explain_lifecycle.js index 62362c7ec..50f09678d 100644 --- a/api/api/ilm.explain_lifecycle.js +++ b/api/api/ilm.explain_lifecycle.js @@ -73,7 +73,7 @@ function buildIlmExplainLifecycle (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -88,20 +88,8 @@ function buildIlmExplainLifecycle (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ilm.get_lifecycle.js b/api/api/ilm.get_lifecycle.js index 1145c399a..7c9fcdc96 100644 --- a/api/api/ilm.get_lifecycle.js +++ b/api/api/ilm.get_lifecycle.js @@ -73,7 +73,7 @@ function buildIlmGetLifecycle (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -92,20 +92,8 @@ function buildIlmGetLifecycle (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ilm.get_status.js b/api/api/ilm.get_status.js index f27b964e3..c9e63ed19 100644 --- a/api/api/ilm.get_status.js +++ b/api/api/ilm.get_status.js @@ -72,7 +72,7 @@ function buildIlmGetStatus (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -87,20 +87,8 @@ function buildIlmGetStatus (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ilm.move_to_step.js b/api/api/ilm.move_to_step.js index c450a083a..382badd95 100644 --- a/api/api/ilm.move_to_step.js +++ b/api/api/ilm.move_to_step.js @@ -68,7 +68,7 @@ function buildIlmMoveToStep (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -83,20 +83,8 @@ function buildIlmMoveToStep (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ilm.put_lifecycle.js b/api/api/ilm.put_lifecycle.js index b8d58d5f3..def795c63 100644 --- a/api/api/ilm.put_lifecycle.js +++ b/api/api/ilm.put_lifecycle.js @@ -68,7 +68,7 @@ function buildIlmPutLifecycle (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -83,20 +83,8 @@ function buildIlmPutLifecycle (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ilm.remove_policy.js b/api/api/ilm.remove_policy.js index ca37399d2..ef4e4963c 100644 --- a/api/api/ilm.remove_policy.js +++ b/api/api/ilm.remove_policy.js @@ -73,7 +73,7 @@ function buildIlmRemovePolicy (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -88,20 +88,8 @@ function buildIlmRemovePolicy (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ilm.retry.js b/api/api/ilm.retry.js index 1fbcdd1da..57c44fda5 100644 --- a/api/api/ilm.retry.js +++ b/api/api/ilm.retry.js @@ -73,7 +73,7 @@ function buildIlmRetry (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -88,20 +88,8 @@ function buildIlmRetry (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ilm.start.js b/api/api/ilm.start.js index 8c907d91d..3752cc584 100644 --- a/api/api/ilm.start.js +++ b/api/api/ilm.start.js @@ -72,7 +72,7 @@ function buildIlmStart (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -87,20 +87,8 @@ function buildIlmStart (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ilm.stop.js b/api/api/ilm.stop.js index b056fa599..8a3e94d68 100644 --- a/api/api/ilm.stop.js +++ b/api/api/ilm.stop.js @@ -72,7 +72,7 @@ function buildIlmStop (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -87,20 +87,8 @@ function buildIlmStop (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/index.js b/api/api/index.js index 508e1f6cf..687991d55 100644 --- a/api/api/index.js +++ b/api/api/index.js @@ -112,7 +112,7 @@ function buildIndex (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -135,20 +135,8 @@ function buildIndex (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/indices.analyze.js b/api/api/indices.analyze.js index a9d6e886f..ec5330855 100644 --- a/api/api/indices.analyze.js +++ b/api/api/indices.analyze.js @@ -75,7 +75,7 @@ function buildIndicesAnalyze (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -94,20 +94,8 @@ function buildIndicesAnalyze (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/indices.clear_cache.js b/api/api/indices.clear_cache.js index 629b97f2b..bee56bea3 100644 --- a/api/api/indices.clear_cache.js +++ b/api/api/indices.clear_cache.js @@ -97,7 +97,7 @@ function buildIndicesClearCache (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -116,20 +116,8 @@ function buildIndicesClearCache (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/indices.close.js b/api/api/indices.close.js index cdfefec47..824d7e60a 100644 --- a/api/api/indices.close.js +++ b/api/api/indices.close.js @@ -99,7 +99,7 @@ function buildIndicesClose (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -114,20 +114,8 @@ function buildIndicesClose (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/indices.create.js b/api/api/indices.create.js index 61933d059..f7186b67c 100644 --- a/api/api/indices.create.js +++ b/api/api/indices.create.js @@ -90,7 +90,7 @@ function buildIndicesCreate (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -105,20 +105,8 @@ function buildIndicesCreate (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/indices.delete.js b/api/api/indices.delete.js index ced4e48e2..d4da1c450 100644 --- a/api/api/indices.delete.js +++ b/api/api/indices.delete.js @@ -96,7 +96,7 @@ function buildIndicesDelete (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -111,20 +111,8 @@ function buildIndicesDelete (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/indices.delete_alias.js b/api/api/indices.delete_alias.js index f7f37523d..65ced4f4b 100644 --- a/api/api/indices.delete_alias.js +++ b/api/api/indices.delete_alias.js @@ -98,7 +98,7 @@ function buildIndicesDeleteAlias (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -117,20 +117,8 @@ function buildIndicesDeleteAlias (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/indices.delete_template.js b/api/api/indices.delete_template.js index 4f969efe0..1e771247d 100644 --- a/api/api/indices.delete_template.js +++ b/api/api/indices.delete_template.js @@ -87,7 +87,7 @@ function buildIndicesDeleteTemplate (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -102,20 +102,8 @@ function buildIndicesDeleteTemplate (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/indices.exists.js b/api/api/indices.exists.js index 629725623..d9084504d 100644 --- a/api/api/indices.exists.js +++ b/api/api/indices.exists.js @@ -99,7 +99,7 @@ function buildIndicesExists (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -114,20 +114,8 @@ function buildIndicesExists (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/indices.exists_alias.js b/api/api/indices.exists_alias.js index 7531e6fb0..790764bf9 100644 --- a/api/api/indices.exists_alias.js +++ b/api/api/indices.exists_alias.js @@ -94,7 +94,7 @@ function buildIndicesExistsAlias (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -113,20 +113,8 @@ function buildIndicesExistsAlias (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/indices.exists_template.js b/api/api/indices.exists_template.js index 83273b91d..a433a2b1b 100644 --- a/api/api/indices.exists_template.js +++ b/api/api/indices.exists_template.js @@ -90,7 +90,7 @@ function buildIndicesExistsTemplate (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -105,20 +105,8 @@ function buildIndicesExistsTemplate (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/indices.exists_type.js b/api/api/indices.exists_type.js index 585c2d325..36dfdd109 100644 --- a/api/api/indices.exists_type.js +++ b/api/api/indices.exists_type.js @@ -104,7 +104,7 @@ function buildIndicesExistsType (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -119,20 +119,8 @@ function buildIndicesExistsType (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/indices.flush.js b/api/api/indices.flush.js index 94d64e23e..ef39494e5 100644 --- a/api/api/indices.flush.js +++ b/api/api/indices.flush.js @@ -92,7 +92,7 @@ function buildIndicesFlush (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -111,20 +111,8 @@ function buildIndicesFlush (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/indices.flush_synced.js b/api/api/indices.flush_synced.js index f4c69b758..9105cd7e4 100644 --- a/api/api/indices.flush_synced.js +++ b/api/api/indices.flush_synced.js @@ -87,7 +87,7 @@ function buildIndicesFlushSynced (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -106,20 +106,8 @@ function buildIndicesFlushSynced (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/indices.forcemerge.js b/api/api/indices.forcemerge.js index b5249ecfc..0f68c466e 100644 --- a/api/api/indices.forcemerge.js +++ b/api/api/indices.forcemerge.js @@ -95,7 +95,7 @@ function buildIndicesForcemerge (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -114,20 +114,8 @@ function buildIndicesForcemerge (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/indices.freeze.js b/api/api/indices.freeze.js index 0400b00d5..6e0cc2bdc 100644 --- a/api/api/indices.freeze.js +++ b/api/api/indices.freeze.js @@ -92,7 +92,7 @@ function buildIndicesFreeze (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -107,20 +107,8 @@ function buildIndicesFreeze (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/indices.get.js b/api/api/indices.get.js index 3e909ecc4..069d7f23e 100644 --- a/api/api/indices.get.js +++ b/api/api/indices.get.js @@ -105,7 +105,7 @@ function buildIndicesGet (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -120,20 +120,8 @@ function buildIndicesGet (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/indices.get_alias.js b/api/api/indices.get_alias.js index d016d5741..913b3d22d 100644 --- a/api/api/indices.get_alias.js +++ b/api/api/indices.get_alias.js @@ -90,7 +90,7 @@ function buildIndicesGetAlias (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -113,20 +113,8 @@ function buildIndicesGetAlias (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/indices.get_field_mapping.js b/api/api/indices.get_field_mapping.js index 70a9efaa0..968124774 100644 --- a/api/api/indices.get_field_mapping.js +++ b/api/api/indices.get_field_mapping.js @@ -101,7 +101,7 @@ function buildIndicesGetFieldMapping (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -124,20 +124,8 @@ function buildIndicesGetFieldMapping (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/indices.get_mapping.js b/api/api/indices.get_mapping.js index c7eb7160c..e0c292504 100644 --- a/api/api/indices.get_mapping.js +++ b/api/api/indices.get_mapping.js @@ -96,7 +96,7 @@ function buildIndicesGetMapping (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -119,20 +119,8 @@ function buildIndicesGetMapping (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/indices.get_settings.js b/api/api/indices.get_settings.js index 79d82cbee..faafe56c2 100644 --- a/api/api/indices.get_settings.js +++ b/api/api/indices.get_settings.js @@ -99,7 +99,7 @@ function buildIndicesGetSettings (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -122,20 +122,8 @@ function buildIndicesGetSettings (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/indices.get_template.js b/api/api/indices.get_template.js index 68d6a6b51..faed75248 100644 --- a/api/api/indices.get_template.js +++ b/api/api/indices.get_template.js @@ -89,7 +89,7 @@ function buildIndicesGetTemplate (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -108,20 +108,8 @@ function buildIndicesGetTemplate (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/indices.get_upgrade.js b/api/api/indices.get_upgrade.js index 06781bda7..1513373a7 100644 --- a/api/api/indices.get_upgrade.js +++ b/api/api/indices.get_upgrade.js @@ -87,7 +87,7 @@ function buildIndicesGetUpgrade (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -106,20 +106,8 @@ function buildIndicesGetUpgrade (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/indices.open.js b/api/api/indices.open.js index 742cb028d..490f77bbb 100644 --- a/api/api/indices.open.js +++ b/api/api/indices.open.js @@ -99,7 +99,7 @@ function buildIndicesOpen (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -114,20 +114,8 @@ function buildIndicesOpen (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/indices.put_alias.js b/api/api/indices.put_alias.js index c6d2df4a3..c0425620e 100644 --- a/api/api/indices.put_alias.js +++ b/api/api/indices.put_alias.js @@ -95,7 +95,7 @@ function buildIndicesPutAlias (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -114,20 +114,8 @@ function buildIndicesPutAlias (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/indices.put_mapping.js b/api/api/indices.put_mapping.js index b477739c0..993c41187 100644 --- a/api/api/indices.put_mapping.js +++ b/api/api/indices.put_mapping.js @@ -97,7 +97,7 @@ function buildIndicesPutMapping (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -128,20 +128,8 @@ function buildIndicesPutMapping (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/indices.put_settings.js b/api/api/indices.put_settings.js index ba394a719..253639c8e 100644 --- a/api/api/indices.put_settings.js +++ b/api/api/indices.put_settings.js @@ -99,7 +99,7 @@ function buildIndicesPutSettings (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -118,20 +118,8 @@ function buildIndicesPutSettings (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/indices.put_template.js b/api/api/indices.put_template.js index 931a2ab85..900d01db4 100644 --- a/api/api/indices.put_template.js +++ b/api/api/indices.put_template.js @@ -98,7 +98,7 @@ function buildIndicesPutTemplate (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -113,20 +113,8 @@ function buildIndicesPutTemplate (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/indices.recovery.js b/api/api/indices.recovery.js index 7362561b7..9381169a0 100644 --- a/api/api/indices.recovery.js +++ b/api/api/indices.recovery.js @@ -83,7 +83,7 @@ function buildIndicesRecovery (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -102,20 +102,8 @@ function buildIndicesRecovery (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/indices.refresh.js b/api/api/indices.refresh.js index 1a263c834..32b00c045 100644 --- a/api/api/indices.refresh.js +++ b/api/api/indices.refresh.js @@ -87,7 +87,7 @@ function buildIndicesRefresh (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -106,20 +106,8 @@ function buildIndicesRefresh (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/indices.rollover.js b/api/api/indices.rollover.js index 8b7fecb73..478e1e705 100644 --- a/api/api/indices.rollover.js +++ b/api/api/indices.rollover.js @@ -100,7 +100,7 @@ function buildIndicesRollover (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -119,20 +119,8 @@ function buildIndicesRollover (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/indices.segments.js b/api/api/indices.segments.js index a9feb67f5..da9057a5b 100644 --- a/api/api/indices.segments.js +++ b/api/api/indices.segments.js @@ -89,7 +89,7 @@ function buildIndicesSegments (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -108,20 +108,8 @@ function buildIndicesSegments (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/indices.shard_stores.js b/api/api/indices.shard_stores.js index 35d5924b8..7ea445462 100644 --- a/api/api/indices.shard_stores.js +++ b/api/api/indices.shard_stores.js @@ -89,7 +89,7 @@ function buildIndicesShardStores (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -108,20 +108,8 @@ function buildIndicesShardStores (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/indices.shrink.js b/api/api/indices.shrink.js index c746add6b..a21cd7d02 100644 --- a/api/api/indices.shrink.js +++ b/api/api/indices.shrink.js @@ -98,7 +98,7 @@ function buildIndicesShrink (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -113,20 +113,8 @@ function buildIndicesShrink (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/indices.split.js b/api/api/indices.split.js index 50f2501a0..8da6845ae 100644 --- a/api/api/indices.split.js +++ b/api/api/indices.split.js @@ -98,7 +98,7 @@ function buildIndicesSplit (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -113,20 +113,8 @@ function buildIndicesSplit (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/indices.stats.js b/api/api/indices.stats.js index bc0524bc8..da3aa176e 100644 --- a/api/api/indices.stats.js +++ b/api/api/indices.stats.js @@ -105,7 +105,7 @@ function buildIndicesStats (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -128,20 +128,8 @@ function buildIndicesStats (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/indices.unfreeze.js b/api/api/indices.unfreeze.js index 81a55968f..64a82c1e0 100644 --- a/api/api/indices.unfreeze.js +++ b/api/api/indices.unfreeze.js @@ -92,7 +92,7 @@ function buildIndicesUnfreeze (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -107,20 +107,8 @@ function buildIndicesUnfreeze (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/indices.update_aliases.js b/api/api/indices.update_aliases.js index 5c83d0798..e188b5dcc 100644 --- a/api/api/indices.update_aliases.js +++ b/api/api/indices.update_aliases.js @@ -83,7 +83,7 @@ function buildIndicesUpdateAliases (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -98,20 +98,8 @@ function buildIndicesUpdateAliases (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/indices.upgrade.js b/api/api/indices.upgrade.js index bae33c59a..afbe9bc12 100644 --- a/api/api/indices.upgrade.js +++ b/api/api/indices.upgrade.js @@ -93,7 +93,7 @@ function buildIndicesUpgrade (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -112,20 +112,8 @@ function buildIndicesUpgrade (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/indices.validate_query.js b/api/api/indices.validate_query.js index 3dea50479..2b35d18fa 100644 --- a/api/api/indices.validate_query.js +++ b/api/api/indices.validate_query.js @@ -110,7 +110,7 @@ function buildIndicesValidateQuery (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -131,20 +131,8 @@ function buildIndicesValidateQuery (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/info.js b/api/api/info.js index 0d5eb79e1..7ca83b4b6 100644 --- a/api/api/info.js +++ b/api/api/info.js @@ -77,7 +77,7 @@ function buildInfo (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -92,20 +92,8 @@ function buildInfo (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ingest.delete_pipeline.js b/api/api/ingest.delete_pipeline.js index 68a8479c4..6bb05e2d0 100644 --- a/api/api/ingest.delete_pipeline.js +++ b/api/api/ingest.delete_pipeline.js @@ -87,7 +87,7 @@ function buildIngestDeletePipeline (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -102,20 +102,8 @@ function buildIngestDeletePipeline (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ingest.get_pipeline.js b/api/api/ingest.get_pipeline.js index 29a01d7ab..689b69e2d 100644 --- a/api/api/ingest.get_pipeline.js +++ b/api/api/ingest.get_pipeline.js @@ -81,7 +81,7 @@ function buildIngestGetPipeline (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -100,20 +100,8 @@ function buildIngestGetPipeline (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ingest.processor_grok.js b/api/api/ingest.processor_grok.js index 679fbadbc..20dbeab4e 100644 --- a/api/api/ingest.processor_grok.js +++ b/api/api/ingest.processor_grok.js @@ -77,7 +77,7 @@ function buildIngestProcessorGrok (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -92,20 +92,8 @@ function buildIngestProcessorGrok (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ingest.put_pipeline.js b/api/api/ingest.put_pipeline.js index 6e2940b7b..5052f5183 100644 --- a/api/api/ingest.put_pipeline.js +++ b/api/api/ingest.put_pipeline.js @@ -88,7 +88,7 @@ function buildIngestPutPipeline (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -103,20 +103,8 @@ function buildIngestPutPipeline (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ingest.simulate.js b/api/api/ingest.simulate.js index c8f83721e..45ead8b28 100644 --- a/api/api/ingest.simulate.js +++ b/api/api/ingest.simulate.js @@ -81,7 +81,7 @@ function buildIngestSimulate (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -100,20 +100,8 @@ function buildIngestSimulate (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/license.delete.js b/api/api/license.delete.js index fdf2efbc6..40dd03cbf 100644 --- a/api/api/license.delete.js +++ b/api/api/license.delete.js @@ -72,7 +72,7 @@ function buildLicenseDelete (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -87,20 +87,8 @@ function buildLicenseDelete (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/license.get.js b/api/api/license.get.js index 57266aa82..68ae632c7 100644 --- a/api/api/license.get.js +++ b/api/api/license.get.js @@ -73,7 +73,7 @@ function buildLicenseGet (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -88,20 +88,8 @@ function buildLicenseGet (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/license.get_basic_status.js b/api/api/license.get_basic_status.js index cccf3ffef..b01252467 100644 --- a/api/api/license.get_basic_status.js +++ b/api/api/license.get_basic_status.js @@ -72,7 +72,7 @@ function buildLicenseGetBasicStatus (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -87,20 +87,8 @@ function buildLicenseGetBasicStatus (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/license.get_trial_status.js b/api/api/license.get_trial_status.js index dcc9091cc..0f5b71b99 100644 --- a/api/api/license.get_trial_status.js +++ b/api/api/license.get_trial_status.js @@ -72,7 +72,7 @@ function buildLicenseGetTrialStatus (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -87,20 +87,8 @@ function buildLicenseGetTrialStatus (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/license.post.js b/api/api/license.post.js index b29cb4d32..f1dd591fa 100644 --- a/api/api/license.post.js +++ b/api/api/license.post.js @@ -68,7 +68,7 @@ function buildLicensePost (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -83,20 +83,8 @@ function buildLicensePost (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/license.post_start_basic.js b/api/api/license.post_start_basic.js index 272e61fc4..2ec9729a2 100644 --- a/api/api/license.post_start_basic.js +++ b/api/api/license.post_start_basic.js @@ -73,7 +73,7 @@ function buildLicensePostStartBasic (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -88,20 +88,8 @@ function buildLicensePostStartBasic (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/license.post_start_trial.js b/api/api/license.post_start_trial.js index 79207341f..bdfad8063 100644 --- a/api/api/license.post_start_trial.js +++ b/api/api/license.post_start_trial.js @@ -75,7 +75,7 @@ function buildLicensePostStartTrial (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -90,20 +90,8 @@ function buildLicensePostStartTrial (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/mget.js b/api/api/mget.js index 14b29eaf4..25461f3bc 100644 --- a/api/api/mget.js +++ b/api/api/mget.js @@ -105,7 +105,7 @@ function buildMget (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -126,20 +126,8 @@ function buildMget (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/migration.deprecations.js b/api/api/migration.deprecations.js index 727d3a5ba..27b81211e 100644 --- a/api/api/migration.deprecations.js +++ b/api/api/migration.deprecations.js @@ -73,7 +73,7 @@ function buildMigrationDeprecations (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -92,20 +92,8 @@ function buildMigrationDeprecations (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ml.close_job.js b/api/api/ml.close_job.js index ec61d7008..47f043da3 100644 --- a/api/api/ml.close_job.js +++ b/api/api/ml.close_job.js @@ -80,7 +80,7 @@ function buildMlCloseJob (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -95,20 +95,8 @@ function buildMlCloseJob (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ml.delete_calendar.js b/api/api/ml.delete_calendar.js index dc94d6b92..e487edc1b 100644 --- a/api/api/ml.delete_calendar.js +++ b/api/api/ml.delete_calendar.js @@ -77,7 +77,7 @@ function buildMlDeleteCalendar (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -92,20 +92,8 @@ function buildMlDeleteCalendar (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ml.delete_calendar_event.js b/api/api/ml.delete_calendar_event.js index 4846c13fe..a8cec2b95 100644 --- a/api/api/ml.delete_calendar_event.js +++ b/api/api/ml.delete_calendar_event.js @@ -88,7 +88,7 @@ function buildMlDeleteCalendarEvent (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -103,20 +103,8 @@ function buildMlDeleteCalendarEvent (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ml.delete_calendar_job.js b/api/api/ml.delete_calendar_job.js index 27ebb4341..ae815a30b 100644 --- a/api/api/ml.delete_calendar_job.js +++ b/api/api/ml.delete_calendar_job.js @@ -88,7 +88,7 @@ function buildMlDeleteCalendarJob (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -103,20 +103,8 @@ function buildMlDeleteCalendarJob (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ml.delete_datafeed.js b/api/api/ml.delete_datafeed.js index 5350874cb..7f00ca779 100644 --- a/api/api/ml.delete_datafeed.js +++ b/api/api/ml.delete_datafeed.js @@ -78,7 +78,7 @@ function buildMlDeleteDatafeed (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -93,20 +93,8 @@ function buildMlDeleteDatafeed (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ml.delete_expired_data.js b/api/api/ml.delete_expired_data.js index d28a54756..556932b62 100644 --- a/api/api/ml.delete_expired_data.js +++ b/api/api/ml.delete_expired_data.js @@ -72,7 +72,7 @@ function buildMlDeleteExpiredData (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -87,20 +87,8 @@ function buildMlDeleteExpiredData (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ml.delete_filter.js b/api/api/ml.delete_filter.js index e14c6004a..e2debed9d 100644 --- a/api/api/ml.delete_filter.js +++ b/api/api/ml.delete_filter.js @@ -77,7 +77,7 @@ function buildMlDeleteFilter (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -92,20 +92,8 @@ function buildMlDeleteFilter (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ml.delete_forecast.js b/api/api/ml.delete_forecast.js index 61578af3c..1249cb405 100644 --- a/api/api/ml.delete_forecast.js +++ b/api/api/ml.delete_forecast.js @@ -88,7 +88,7 @@ function buildMlDeleteForecast (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -107,20 +107,8 @@ function buildMlDeleteForecast (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ml.delete_job.js b/api/api/ml.delete_job.js index 2dab49868..4cc6659f5 100644 --- a/api/api/ml.delete_job.js +++ b/api/api/ml.delete_job.js @@ -80,7 +80,7 @@ function buildMlDeleteJob (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -95,20 +95,8 @@ function buildMlDeleteJob (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ml.delete_model_snapshot.js b/api/api/ml.delete_model_snapshot.js index ee7e86377..f09526fa6 100644 --- a/api/api/ml.delete_model_snapshot.js +++ b/api/api/ml.delete_model_snapshot.js @@ -88,7 +88,7 @@ function buildMlDeleteModelSnapshot (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -103,20 +103,8 @@ function buildMlDeleteModelSnapshot (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ml.find_file_structure.js b/api/api/ml.find_file_structure.js index 1e6de545e..52ef73a83 100644 --- a/api/api/ml.find_file_structure.js +++ b/api/api/ml.find_file_structure.js @@ -105,7 +105,7 @@ function buildMlFindFileStructure (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -120,20 +120,8 @@ function buildMlFindFileStructure (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ml.flush_job.js b/api/api/ml.flush_job.js index f2b062ee2..52fc28526 100644 --- a/api/api/ml.flush_job.js +++ b/api/api/ml.flush_job.js @@ -85,7 +85,7 @@ function buildMlFlushJob (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -100,20 +100,8 @@ function buildMlFlushJob (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ml.forecast.js b/api/api/ml.forecast.js index 065d17c6c..db7c3d635 100644 --- a/api/api/ml.forecast.js +++ b/api/api/ml.forecast.js @@ -80,7 +80,7 @@ function buildMlForecast (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -95,20 +95,8 @@ function buildMlForecast (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ml.get_buckets.js b/api/api/ml.get_buckets.js index f00ae7a47..5cf5a1f96 100644 --- a/api/api/ml.get_buckets.js +++ b/api/api/ml.get_buckets.js @@ -100,7 +100,7 @@ function buildMlGetBuckets (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -119,20 +119,8 @@ function buildMlGetBuckets (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ml.get_calendar_events.js b/api/api/ml.get_calendar_events.js index 85540eb2a..f48094d84 100644 --- a/api/api/ml.get_calendar_events.js +++ b/api/api/ml.get_calendar_events.js @@ -87,7 +87,7 @@ function buildMlGetCalendarEvents (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -102,20 +102,8 @@ function buildMlGetCalendarEvents (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ml.get_calendars.js b/api/api/ml.get_calendars.js index 71d9b2771..226714b0f 100644 --- a/api/api/ml.get_calendars.js +++ b/api/api/ml.get_calendars.js @@ -71,7 +71,7 @@ function buildMlGetCalendars (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -90,20 +90,8 @@ function buildMlGetCalendars (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ml.get_categories.js b/api/api/ml.get_categories.js index 8ee43bac5..8347af697 100644 --- a/api/api/ml.get_categories.js +++ b/api/api/ml.get_categories.js @@ -78,7 +78,7 @@ function buildMlGetCategories (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -97,20 +97,8 @@ function buildMlGetCategories (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ml.get_datafeed_stats.js b/api/api/ml.get_datafeed_stats.js index d7dd811aa..575462a65 100644 --- a/api/api/ml.get_datafeed_stats.js +++ b/api/api/ml.get_datafeed_stats.js @@ -74,7 +74,7 @@ function buildMlGetDatafeedStats (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -93,20 +93,8 @@ function buildMlGetDatafeedStats (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ml.get_datafeeds.js b/api/api/ml.get_datafeeds.js index 6135237cb..5f4eec4be 100644 --- a/api/api/ml.get_datafeeds.js +++ b/api/api/ml.get_datafeeds.js @@ -74,7 +74,7 @@ function buildMlGetDatafeeds (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -93,20 +93,8 @@ function buildMlGetDatafeeds (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ml.get_filters.js b/api/api/ml.get_filters.js index 3c83a37f8..c52180e9e 100644 --- a/api/api/ml.get_filters.js +++ b/api/api/ml.get_filters.js @@ -76,7 +76,7 @@ function buildMlGetFilters (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -95,20 +95,8 @@ function buildMlGetFilters (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ml.get_influencers.js b/api/api/ml.get_influencers.js index 6ce303a12..3fc63b195 100644 --- a/api/api/ml.get_influencers.js +++ b/api/api/ml.get_influencers.js @@ -91,7 +91,7 @@ function buildMlGetInfluencers (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -106,20 +106,8 @@ function buildMlGetInfluencers (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ml.get_job_stats.js b/api/api/ml.get_job_stats.js index 8b5a68e27..e8eeb5ec2 100644 --- a/api/api/ml.get_job_stats.js +++ b/api/api/ml.get_job_stats.js @@ -74,7 +74,7 @@ function buildMlGetJobStats (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -93,20 +93,8 @@ function buildMlGetJobStats (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ml.get_jobs.js b/api/api/ml.get_jobs.js index 688334416..535aba85d 100644 --- a/api/api/ml.get_jobs.js +++ b/api/api/ml.get_jobs.js @@ -74,7 +74,7 @@ function buildMlGetJobs (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -93,20 +93,8 @@ function buildMlGetJobs (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ml.get_model_snapshots.js b/api/api/ml.get_model_snapshots.js index 7bfa74eb3..690bae93e 100644 --- a/api/api/ml.get_model_snapshots.js +++ b/api/api/ml.get_model_snapshots.js @@ -92,7 +92,7 @@ function buildMlGetModelSnapshots (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -111,20 +111,8 @@ function buildMlGetModelSnapshots (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ml.get_overall_buckets.js b/api/api/ml.get_overall_buckets.js index e6ee6338c..5a3327f7e 100644 --- a/api/api/ml.get_overall_buckets.js +++ b/api/api/ml.get_overall_buckets.js @@ -91,7 +91,7 @@ function buildMlGetOverallBuckets (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -106,20 +106,8 @@ function buildMlGetOverallBuckets (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ml.get_records.js b/api/api/ml.get_records.js index 5bcfbe7b0..1cc6a51d5 100644 --- a/api/api/ml.get_records.js +++ b/api/api/ml.get_records.js @@ -91,7 +91,7 @@ function buildMlGetRecords (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -106,20 +106,8 @@ function buildMlGetRecords (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ml.info.js b/api/api/ml.info.js index b53019e0e..ec14d25ea 100644 --- a/api/api/ml.info.js +++ b/api/api/ml.info.js @@ -66,7 +66,7 @@ function buildMlInfo (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -81,20 +81,8 @@ function buildMlInfo (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ml.open_job.js b/api/api/ml.open_job.js index ec9a3268f..4117c0be5 100644 --- a/api/api/ml.open_job.js +++ b/api/api/ml.open_job.js @@ -79,7 +79,7 @@ function buildMlOpenJob (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -94,20 +94,8 @@ function buildMlOpenJob (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ml.post_calendar_events.js b/api/api/ml.post_calendar_events.js index e671d27f9..058cb1a19 100644 --- a/api/api/ml.post_calendar_events.js +++ b/api/api/ml.post_calendar_events.js @@ -78,7 +78,7 @@ function buildMlPostCalendarEvents (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -93,20 +93,8 @@ function buildMlPostCalendarEvents (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ml.post_data.js b/api/api/ml.post_data.js index 5f500c989..eda48daad 100644 --- a/api/api/ml.post_data.js +++ b/api/api/ml.post_data.js @@ -82,7 +82,7 @@ function buildMlPostData (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -97,20 +97,8 @@ function buildMlPostData (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ml.preview_datafeed.js b/api/api/ml.preview_datafeed.js index 4a09368a1..650823588 100644 --- a/api/api/ml.preview_datafeed.js +++ b/api/api/ml.preview_datafeed.js @@ -77,7 +77,7 @@ function buildMlPreviewDatafeed (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -92,20 +92,8 @@ function buildMlPreviewDatafeed (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ml.put_calendar.js b/api/api/ml.put_calendar.js index 5f469ac85..bf5dd5ecd 100644 --- a/api/api/ml.put_calendar.js +++ b/api/api/ml.put_calendar.js @@ -74,7 +74,7 @@ function buildMlPutCalendar (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -89,20 +89,8 @@ function buildMlPutCalendar (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ml.put_calendar_job.js b/api/api/ml.put_calendar_job.js index 4af04e926..59a215d4c 100644 --- a/api/api/ml.put_calendar_job.js +++ b/api/api/ml.put_calendar_job.js @@ -88,7 +88,7 @@ function buildMlPutCalendarJob (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -103,20 +103,8 @@ function buildMlPutCalendarJob (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ml.put_datafeed.js b/api/api/ml.put_datafeed.js index d7da534fe..8f9db71a3 100644 --- a/api/api/ml.put_datafeed.js +++ b/api/api/ml.put_datafeed.js @@ -78,7 +78,7 @@ function buildMlPutDatafeed (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -93,20 +93,8 @@ function buildMlPutDatafeed (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ml.put_filter.js b/api/api/ml.put_filter.js index 6f423c071..d77a919f3 100644 --- a/api/api/ml.put_filter.js +++ b/api/api/ml.put_filter.js @@ -78,7 +78,7 @@ function buildMlPutFilter (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -93,20 +93,8 @@ function buildMlPutFilter (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ml.put_job.js b/api/api/ml.put_job.js index fa78d3239..ce4b06427 100644 --- a/api/api/ml.put_job.js +++ b/api/api/ml.put_job.js @@ -78,7 +78,7 @@ function buildMlPutJob (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -93,20 +93,8 @@ function buildMlPutJob (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ml.revert_model_snapshot.js b/api/api/ml.revert_model_snapshot.js index 162a2682c..7fe97b15c 100644 --- a/api/api/ml.revert_model_snapshot.js +++ b/api/api/ml.revert_model_snapshot.js @@ -86,7 +86,7 @@ function buildMlRevertModelSnapshot (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -101,20 +101,8 @@ function buildMlRevertModelSnapshot (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ml.set_upgrade_mode.js b/api/api/ml.set_upgrade_mode.js index d095c71f0..bb6783596 100644 --- a/api/api/ml.set_upgrade_mode.js +++ b/api/api/ml.set_upgrade_mode.js @@ -75,7 +75,7 @@ function buildMlSetUpgradeMode (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -90,20 +90,8 @@ function buildMlSetUpgradeMode (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ml.start_datafeed.js b/api/api/ml.start_datafeed.js index 9ae986cf7..dd31b69d7 100644 --- a/api/api/ml.start_datafeed.js +++ b/api/api/ml.start_datafeed.js @@ -79,7 +79,7 @@ function buildMlStartDatafeed (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -94,20 +94,8 @@ function buildMlStartDatafeed (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ml.stop_datafeed.js b/api/api/ml.stop_datafeed.js index 8e684ae2c..b1ce8e59e 100644 --- a/api/api/ml.stop_datafeed.js +++ b/api/api/ml.stop_datafeed.js @@ -79,7 +79,7 @@ function buildMlStopDatafeed (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -94,20 +94,8 @@ function buildMlStopDatafeed (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ml.update_datafeed.js b/api/api/ml.update_datafeed.js index 7e5447521..10e416eef 100644 --- a/api/api/ml.update_datafeed.js +++ b/api/api/ml.update_datafeed.js @@ -78,7 +78,7 @@ function buildMlUpdateDatafeed (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -93,20 +93,8 @@ function buildMlUpdateDatafeed (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ml.update_filter.js b/api/api/ml.update_filter.js index f8de4abc7..f2586053b 100644 --- a/api/api/ml.update_filter.js +++ b/api/api/ml.update_filter.js @@ -78,7 +78,7 @@ function buildMlUpdateFilter (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -93,20 +93,8 @@ function buildMlUpdateFilter (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ml.update_job.js b/api/api/ml.update_job.js index c34144cd3..f81e31c51 100644 --- a/api/api/ml.update_job.js +++ b/api/api/ml.update_job.js @@ -78,7 +78,7 @@ function buildMlUpdateJob (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -93,20 +93,8 @@ function buildMlUpdateJob (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ml.update_model_snapshot.js b/api/api/ml.update_model_snapshot.js index e0dc3043f..2d733a44c 100644 --- a/api/api/ml.update_model_snapshot.js +++ b/api/api/ml.update_model_snapshot.js @@ -89,7 +89,7 @@ function buildMlUpdateModelSnapshot (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -104,20 +104,8 @@ function buildMlUpdateModelSnapshot (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ml.validate.js b/api/api/ml.validate.js index 256da469a..5274da775 100644 --- a/api/api/ml.validate.js +++ b/api/api/ml.validate.js @@ -73,7 +73,7 @@ function buildMlValidate (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -88,20 +88,8 @@ function buildMlValidate (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ml.validate_detector.js b/api/api/ml.validate_detector.js index 4540ff1d5..e461bd4dc 100644 --- a/api/api/ml.validate_detector.js +++ b/api/api/ml.validate_detector.js @@ -73,7 +73,7 @@ function buildMlValidateDetector (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -88,20 +88,8 @@ function buildMlValidateDetector (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/monitoring.bulk.js b/api/api/monitoring.bulk.js index 96a7caba3..5c2eb726f 100644 --- a/api/api/monitoring.bulk.js +++ b/api/api/monitoring.bulk.js @@ -81,7 +81,7 @@ function buildMonitoringBulk (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -100,20 +100,8 @@ function buildMonitoringBulk (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/msearch.js b/api/api/msearch.js index 1bf456a67..53e14c1e0 100644 --- a/api/api/msearch.js +++ b/api/api/msearch.js @@ -107,7 +107,7 @@ function buildMsearch (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -128,20 +128,8 @@ function buildMsearch (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/msearch_template.js b/api/api/msearch_template.js index 7d877463d..2b769dac8 100644 --- a/api/api/msearch_template.js +++ b/api/api/msearch_template.js @@ -101,7 +101,7 @@ function buildMsearchTemplate (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -122,20 +122,8 @@ function buildMsearchTemplate (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/mtermvectors.js b/api/api/mtermvectors.js index a46362de3..3327704e4 100644 --- a/api/api/mtermvectors.js +++ b/api/api/mtermvectors.js @@ -109,7 +109,7 @@ function buildMtermvectors (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -130,20 +130,8 @@ function buildMtermvectors (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/nodes.hot_threads.js b/api/api/nodes.hot_threads.js index 330bc47ba..3fc015601 100644 --- a/api/api/nodes.hot_threads.js +++ b/api/api/nodes.hot_threads.js @@ -91,7 +91,7 @@ function buildNodesHotThreads (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -116,20 +116,8 @@ function buildNodesHotThreads (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/nodes.info.js b/api/api/nodes.info.js index 4e27f08ff..21f5a3177 100644 --- a/api/api/nodes.info.js +++ b/api/api/nodes.info.js @@ -84,7 +84,7 @@ function buildNodesInfo (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -107,20 +107,8 @@ function buildNodesInfo (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/nodes.reload_secure_settings.js b/api/api/nodes.reload_secure_settings.js index 7753eb77e..417a35409 100644 --- a/api/api/nodes.reload_secure_settings.js +++ b/api/api/nodes.reload_secure_settings.js @@ -80,7 +80,7 @@ function buildNodesReloadSecureSettings (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -99,20 +99,8 @@ function buildNodesReloadSecureSettings (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/nodes.stats.js b/api/api/nodes.stats.js index 04425a8fb..d32486b4b 100644 --- a/api/api/nodes.stats.js +++ b/api/api/nodes.stats.js @@ -99,7 +99,7 @@ function buildNodesStats (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -126,20 +126,8 @@ function buildNodesStats (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/nodes.usage.js b/api/api/nodes.usage.js index 1d62545be..5e92b8fca 100644 --- a/api/api/nodes.usage.js +++ b/api/api/nodes.usage.js @@ -81,7 +81,7 @@ function buildNodesUsage (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -104,20 +104,8 @@ function buildNodesUsage (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ping.js b/api/api/ping.js index 71a0dc79e..c4680a7f3 100644 --- a/api/api/ping.js +++ b/api/api/ping.js @@ -77,7 +77,7 @@ function buildPing (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -92,20 +92,8 @@ function buildPing (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/put_script.js b/api/api/put_script.js index 9ffd1db70..2bf14ee32 100644 --- a/api/api/put_script.js +++ b/api/api/put_script.js @@ -97,7 +97,7 @@ function buildPutScript (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -116,20 +116,8 @@ function buildPutScript (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/rank_eval.js b/api/api/rank_eval.js index df81a0385..47667b5fe 100644 --- a/api/api/rank_eval.js +++ b/api/api/rank_eval.js @@ -88,7 +88,7 @@ function buildRankEval (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -107,20 +107,8 @@ function buildRankEval (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/reindex.js b/api/api/reindex.js index c1286f6af..f3ea8bae1 100644 --- a/api/api/reindex.js +++ b/api/api/reindex.js @@ -95,7 +95,7 @@ function buildReindex (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -110,20 +110,8 @@ function buildReindex (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/reindex_rethrottle.js b/api/api/reindex_rethrottle.js index 2a24b921b..701458867 100644 --- a/api/api/reindex_rethrottle.js +++ b/api/api/reindex_rethrottle.js @@ -89,7 +89,7 @@ function buildReindexRethrottle (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -104,20 +104,8 @@ function buildReindexRethrottle (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/render_search_template.js b/api/api/render_search_template.js index 0564ba781..92c8ce4bc 100644 --- a/api/api/render_search_template.js +++ b/api/api/render_search_template.js @@ -73,7 +73,7 @@ function buildRenderSearchTemplate (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -92,20 +92,8 @@ function buildRenderSearchTemplate (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/rollup.delete_job.js b/api/api/rollup.delete_job.js index b0a06fdb5..924e4f7c9 100644 --- a/api/api/rollup.delete_job.js +++ b/api/api/rollup.delete_job.js @@ -73,7 +73,7 @@ function buildRollupDeleteJob (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -88,20 +88,8 @@ function buildRollupDeleteJob (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/rollup.get_jobs.js b/api/api/rollup.get_jobs.js index cb1da9051..33d19ff12 100644 --- a/api/api/rollup.get_jobs.js +++ b/api/api/rollup.get_jobs.js @@ -67,7 +67,7 @@ function buildRollupGetJobs (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -86,20 +86,8 @@ function buildRollupGetJobs (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/rollup.get_rollup_caps.js b/api/api/rollup.get_rollup_caps.js index 3d24fbbaf..a11dff599 100644 --- a/api/api/rollup.get_rollup_caps.js +++ b/api/api/rollup.get_rollup_caps.js @@ -67,7 +67,7 @@ function buildRollupGetRollupCaps (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -86,20 +86,8 @@ function buildRollupGetRollupCaps (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/rollup.get_rollup_index_caps.js b/api/api/rollup.get_rollup_index_caps.js index 54f161dc9..5083afd82 100644 --- a/api/api/rollup.get_rollup_index_caps.js +++ b/api/api/rollup.get_rollup_index_caps.js @@ -73,7 +73,7 @@ function buildRollupGetRollupIndexCaps (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -88,20 +88,8 @@ function buildRollupGetRollupIndexCaps (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/rollup.put_job.js b/api/api/rollup.put_job.js index cc8701e7f..9aab2dd62 100644 --- a/api/api/rollup.put_job.js +++ b/api/api/rollup.put_job.js @@ -78,7 +78,7 @@ function buildRollupPutJob (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -93,20 +93,8 @@ function buildRollupPutJob (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/rollup.rollup_search.js b/api/api/rollup.rollup_search.js index 4329cd2d9..3fb6436a8 100644 --- a/api/api/rollup.rollup_search.js +++ b/api/api/rollup.rollup_search.js @@ -89,7 +89,7 @@ function buildRollupRollupSearch (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -108,20 +108,8 @@ function buildRollupRollupSearch (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/rollup.start_job.js b/api/api/rollup.start_job.js index ced1af7fa..bdf53e407 100644 --- a/api/api/rollup.start_job.js +++ b/api/api/rollup.start_job.js @@ -73,7 +73,7 @@ function buildRollupStartJob (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -88,20 +88,8 @@ function buildRollupStartJob (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/rollup.stop_job.js b/api/api/rollup.stop_job.js index 856bdfe09..1d0ebcee8 100644 --- a/api/api/rollup.stop_job.js +++ b/api/api/rollup.stop_job.js @@ -77,7 +77,7 @@ function buildRollupStopJob (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -92,20 +92,8 @@ function buildRollupStopJob (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/scripts_painless_context.js b/api/api/scripts_painless_context.js index 0ef7d852a..f6f9d09bd 100644 --- a/api/api/scripts_painless_context.js +++ b/api/api/scripts_painless_context.js @@ -73,7 +73,7 @@ function buildScriptsPainlessContext (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -88,20 +88,8 @@ function buildScriptsPainlessContext (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/scripts_painless_execute.js b/api/api/scripts_painless_execute.js index 231a3e461..47a8f2c4d 100644 --- a/api/api/scripts_painless_execute.js +++ b/api/api/scripts_painless_execute.js @@ -72,7 +72,7 @@ function buildScriptsPainlessExecute (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -87,20 +87,8 @@ function buildScriptsPainlessExecute (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/scroll.js b/api/api/scroll.js index 565b0925b..5620c8466 100644 --- a/api/api/scroll.js +++ b/api/api/scroll.js @@ -81,7 +81,7 @@ function buildScroll (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -100,20 +100,8 @@ function buildScroll (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/search.js b/api/api/search.js index a4c73501e..7d9e38a78 100644 --- a/api/api/search.js +++ b/api/api/search.js @@ -191,7 +191,7 @@ function buildSearch (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -212,20 +212,8 @@ function buildSearch (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/search_shards.js b/api/api/search_shards.js index bae036cef..851616086 100644 --- a/api/api/search_shards.js +++ b/api/api/search_shards.js @@ -93,7 +93,7 @@ function buildSearchShards (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -112,20 +112,8 @@ function buildSearchShards (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/search_template.js b/api/api/search_template.js index 3a81eeba3..c0ae53124 100644 --- a/api/api/search_template.js +++ b/api/api/search_template.js @@ -120,7 +120,7 @@ function buildSearchTemplate (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -141,20 +141,8 @@ function buildSearchTemplate (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/security.authenticate.js b/api/api/security.authenticate.js index 0a144693a..d003876f1 100644 --- a/api/api/security.authenticate.js +++ b/api/api/security.authenticate.js @@ -72,7 +72,7 @@ function buildSecurityAuthenticate (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -87,20 +87,8 @@ function buildSecurityAuthenticate (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/security.change_password.js b/api/api/security.change_password.js index 3a78e5825..dd176539a 100644 --- a/api/api/security.change_password.js +++ b/api/api/security.change_password.js @@ -75,7 +75,7 @@ function buildSecurityChangePassword (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -94,20 +94,8 @@ function buildSecurityChangePassword (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/security.clear_cached_realms.js b/api/api/security.clear_cached_realms.js index aab70cec5..4744ff43a 100644 --- a/api/api/security.clear_cached_realms.js +++ b/api/api/security.clear_cached_realms.js @@ -78,7 +78,7 @@ function buildSecurityClearCachedRealms (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -93,20 +93,8 @@ function buildSecurityClearCachedRealms (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/security.clear_cached_roles.js b/api/api/security.clear_cached_roles.js index c23b1c66e..a5fe96e53 100644 --- a/api/api/security.clear_cached_roles.js +++ b/api/api/security.clear_cached_roles.js @@ -77,7 +77,7 @@ function buildSecurityClearCachedRoles (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -92,20 +92,8 @@ function buildSecurityClearCachedRoles (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/security.create_api_key.js b/api/api/security.create_api_key.js index a2e0cd315..b777605d2 100644 --- a/api/api/security.create_api_key.js +++ b/api/api/security.create_api_key.js @@ -74,7 +74,7 @@ function buildSecurityCreateApiKey (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -89,20 +89,8 @@ function buildSecurityCreateApiKey (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/security.delete_privileges.js b/api/api/security.delete_privileges.js index e64714740..72c9995fc 100644 --- a/api/api/security.delete_privileges.js +++ b/api/api/security.delete_privileges.js @@ -89,7 +89,7 @@ function buildSecurityDeletePrivileges (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -104,20 +104,8 @@ function buildSecurityDeletePrivileges (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/security.delete_role.js b/api/api/security.delete_role.js index 96ea78039..24180e15a 100644 --- a/api/api/security.delete_role.js +++ b/api/api/security.delete_role.js @@ -78,7 +78,7 @@ function buildSecurityDeleteRole (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -93,20 +93,8 @@ function buildSecurityDeleteRole (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/security.delete_role_mapping.js b/api/api/security.delete_role_mapping.js index 208c950fa..e59ba74f4 100644 --- a/api/api/security.delete_role_mapping.js +++ b/api/api/security.delete_role_mapping.js @@ -78,7 +78,7 @@ function buildSecurityDeleteRoleMapping (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -93,20 +93,8 @@ function buildSecurityDeleteRoleMapping (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/security.delete_user.js b/api/api/security.delete_user.js index 3e176ea8d..cb9f8c18e 100644 --- a/api/api/security.delete_user.js +++ b/api/api/security.delete_user.js @@ -78,7 +78,7 @@ function buildSecurityDeleteUser (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -93,20 +93,8 @@ function buildSecurityDeleteUser (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/security.disable_user.js b/api/api/security.disable_user.js index 3c7d3c000..c6f7d60ed 100644 --- a/api/api/security.disable_user.js +++ b/api/api/security.disable_user.js @@ -78,7 +78,7 @@ function buildSecurityDisableUser (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -93,20 +93,8 @@ function buildSecurityDisableUser (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/security.enable_user.js b/api/api/security.enable_user.js index 2b044b3a5..c225cc9a8 100644 --- a/api/api/security.enable_user.js +++ b/api/api/security.enable_user.js @@ -78,7 +78,7 @@ function buildSecurityEnableUser (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -93,20 +93,8 @@ function buildSecurityEnableUser (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/security.get_api_key.js b/api/api/security.get_api_key.js index eb8af6ea9..51362fb28 100644 --- a/api/api/security.get_api_key.js +++ b/api/api/security.get_api_key.js @@ -79,7 +79,7 @@ function buildSecurityGetApiKey (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -94,20 +94,8 @@ function buildSecurityGetApiKey (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/security.get_privileges.js b/api/api/security.get_privileges.js index f7e697124..5976c08b9 100644 --- a/api/api/security.get_privileges.js +++ b/api/api/security.get_privileges.js @@ -80,7 +80,7 @@ function buildSecurityGetPrivileges (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -101,20 +101,8 @@ function buildSecurityGetPrivileges (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/security.get_role.js b/api/api/security.get_role.js index ca9e9a542..e53558149 100644 --- a/api/api/security.get_role.js +++ b/api/api/security.get_role.js @@ -73,7 +73,7 @@ function buildSecurityGetRole (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -92,20 +92,8 @@ function buildSecurityGetRole (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/security.get_role_mapping.js b/api/api/security.get_role_mapping.js index 77c43e053..9ec022851 100644 --- a/api/api/security.get_role_mapping.js +++ b/api/api/security.get_role_mapping.js @@ -73,7 +73,7 @@ function buildSecurityGetRoleMapping (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -92,20 +92,8 @@ function buildSecurityGetRoleMapping (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/security.get_token.js b/api/api/security.get_token.js index b397e77cd..67391a85d 100644 --- a/api/api/security.get_token.js +++ b/api/api/security.get_token.js @@ -73,7 +73,7 @@ function buildSecurityGetToken (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -88,20 +88,8 @@ function buildSecurityGetToken (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/security.get_user.js b/api/api/security.get_user.js index d8bb47568..490cc7345 100644 --- a/api/api/security.get_user.js +++ b/api/api/security.get_user.js @@ -73,7 +73,7 @@ function buildSecurityGetUser (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -92,20 +92,8 @@ function buildSecurityGetUser (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/security.get_user_privileges.js b/api/api/security.get_user_privileges.js index fdf7e5168..c7b66b3c5 100644 --- a/api/api/security.get_user_privileges.js +++ b/api/api/security.get_user_privileges.js @@ -72,7 +72,7 @@ function buildSecurityGetUserPrivileges (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -87,20 +87,8 @@ function buildSecurityGetUserPrivileges (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/security.has_privileges.js b/api/api/security.has_privileges.js index 22c4c6cf1..b87cd7ed8 100644 --- a/api/api/security.has_privileges.js +++ b/api/api/security.has_privileges.js @@ -74,7 +74,7 @@ function buildSecurityHasPrivileges (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -93,20 +93,8 @@ function buildSecurityHasPrivileges (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/security.invalidate_api_key.js b/api/api/security.invalidate_api_key.js index 983ef2ac8..33a7558a3 100644 --- a/api/api/security.invalidate_api_key.js +++ b/api/api/security.invalidate_api_key.js @@ -73,7 +73,7 @@ function buildSecurityInvalidateApiKey (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -88,20 +88,8 @@ function buildSecurityInvalidateApiKey (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/security.invalidate_token.js b/api/api/security.invalidate_token.js index 98e6eb702..360f34503 100644 --- a/api/api/security.invalidate_token.js +++ b/api/api/security.invalidate_token.js @@ -73,7 +73,7 @@ function buildSecurityInvalidateToken (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -88,20 +88,8 @@ function buildSecurityInvalidateToken (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/security.put_privileges.js b/api/api/security.put_privileges.js index 4de0d967f..fd6d8d5ce 100644 --- a/api/api/security.put_privileges.js +++ b/api/api/security.put_privileges.js @@ -74,7 +74,7 @@ function buildSecurityPutPrivileges (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -89,20 +89,8 @@ function buildSecurityPutPrivileges (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/security.put_role.js b/api/api/security.put_role.js index 388ff9709..b5986ee98 100644 --- a/api/api/security.put_role.js +++ b/api/api/security.put_role.js @@ -79,7 +79,7 @@ function buildSecurityPutRole (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -94,20 +94,8 @@ function buildSecurityPutRole (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/security.put_role_mapping.js b/api/api/security.put_role_mapping.js index 8b3847096..edd34add2 100644 --- a/api/api/security.put_role_mapping.js +++ b/api/api/security.put_role_mapping.js @@ -79,7 +79,7 @@ function buildSecurityPutRoleMapping (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -94,20 +94,8 @@ function buildSecurityPutRoleMapping (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/security.put_user.js b/api/api/security.put_user.js index 9703b86fd..2f8b62102 100644 --- a/api/api/security.put_user.js +++ b/api/api/security.put_user.js @@ -79,7 +79,7 @@ function buildSecurityPutUser (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -94,20 +94,8 @@ function buildSecurityPutUser (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/snapshot.create.js b/api/api/snapshot.create.js index a54cc4b8e..033f98b75 100644 --- a/api/api/snapshot.create.js +++ b/api/api/snapshot.create.js @@ -96,7 +96,7 @@ function buildSnapshotCreate (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -111,20 +111,8 @@ function buildSnapshotCreate (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/snapshot.create_repository.js b/api/api/snapshot.create_repository.js index 7d06c4135..e3f2b3ece 100644 --- a/api/api/snapshot.create_repository.js +++ b/api/api/snapshot.create_repository.js @@ -90,7 +90,7 @@ function buildSnapshotCreateRepository (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -105,20 +105,8 @@ function buildSnapshotCreateRepository (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/snapshot.delete.js b/api/api/snapshot.delete.js index 86e090012..8ad994bc2 100644 --- a/api/api/snapshot.delete.js +++ b/api/api/snapshot.delete.js @@ -96,7 +96,7 @@ function buildSnapshotDelete (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -111,20 +111,8 @@ function buildSnapshotDelete (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/snapshot.delete_repository.js b/api/api/snapshot.delete_repository.js index 48aa929e1..534b7f87d 100644 --- a/api/api/snapshot.delete_repository.js +++ b/api/api/snapshot.delete_repository.js @@ -87,7 +87,7 @@ function buildSnapshotDeleteRepository (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -102,20 +102,8 @@ function buildSnapshotDeleteRepository (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/snapshot.get.js b/api/api/snapshot.get.js index 621f7417c..042e1b589 100644 --- a/api/api/snapshot.get.js +++ b/api/api/snapshot.get.js @@ -101,7 +101,7 @@ function buildSnapshotGet (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -116,20 +116,8 @@ function buildSnapshotGet (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/snapshot.get_repository.js b/api/api/snapshot.get_repository.js index ae7d9fcdc..5981751d9 100644 --- a/api/api/snapshot.get_repository.js +++ b/api/api/snapshot.get_repository.js @@ -83,7 +83,7 @@ function buildSnapshotGetRepository (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -102,20 +102,8 @@ function buildSnapshotGetRepository (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/snapshot.restore.js b/api/api/snapshot.restore.js index 217bb7fef..2d9e66297 100644 --- a/api/api/snapshot.restore.js +++ b/api/api/snapshot.restore.js @@ -96,7 +96,7 @@ function buildSnapshotRestore (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -111,20 +111,8 @@ function buildSnapshotRestore (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/snapshot.status.js b/api/api/snapshot.status.js index bf15fa342..ccabd2b85 100644 --- a/api/api/snapshot.status.js +++ b/api/api/snapshot.status.js @@ -91,7 +91,7 @@ function buildSnapshotStatus (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -112,20 +112,8 @@ function buildSnapshotStatus (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/snapshot.verify_repository.js b/api/api/snapshot.verify_repository.js index 0bb67a727..2d9b1ac51 100644 --- a/api/api/snapshot.verify_repository.js +++ b/api/api/snapshot.verify_repository.js @@ -87,7 +87,7 @@ function buildSnapshotVerifyRepository (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -102,20 +102,8 @@ function buildSnapshotVerifyRepository (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/sql.clear_cursor.js b/api/api/sql.clear_cursor.js index fccf6ba8d..456b69dbd 100644 --- a/api/api/sql.clear_cursor.js +++ b/api/api/sql.clear_cursor.js @@ -73,7 +73,7 @@ function buildSqlClearCursor (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -88,20 +88,8 @@ function buildSqlClearCursor (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/sql.query.js b/api/api/sql.query.js index 2bcd7f6e7..4408ded71 100644 --- a/api/api/sql.query.js +++ b/api/api/sql.query.js @@ -74,7 +74,7 @@ function buildSqlQuery (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -89,20 +89,8 @@ function buildSqlQuery (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/sql.translate.js b/api/api/sql.translate.js index 6b5147bb4..cb27b8a31 100644 --- a/api/api/sql.translate.js +++ b/api/api/sql.translate.js @@ -73,7 +73,7 @@ function buildSqlTranslate (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -88,20 +88,8 @@ function buildSqlTranslate (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/ssl.certificates.js b/api/api/ssl.certificates.js index 8bf875df8..afc50d6e6 100644 --- a/api/api/ssl.certificates.js +++ b/api/api/ssl.certificates.js @@ -72,7 +72,7 @@ function buildSslCertificates (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -87,20 +87,8 @@ function buildSslCertificates (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/tasks.cancel.js b/api/api/tasks.cancel.js index 6e674b2b2..078a851d0 100644 --- a/api/api/tasks.cancel.js +++ b/api/api/tasks.cancel.js @@ -85,7 +85,7 @@ function buildTasksCancel (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -104,20 +104,8 @@ function buildTasksCancel (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/tasks.get.js b/api/api/tasks.get.js index c3435158f..c62d9a7ff 100644 --- a/api/api/tasks.get.js +++ b/api/api/tasks.get.js @@ -87,7 +87,7 @@ function buildTasksGet (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -102,20 +102,8 @@ function buildTasksGet (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/tasks.list.js b/api/api/tasks.list.js index 9d74e774d..a96073b28 100644 --- a/api/api/tasks.list.js +++ b/api/api/tasks.list.js @@ -94,7 +94,7 @@ function buildTasksList (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -109,20 +109,8 @@ function buildTasksList (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/termvectors.js b/api/api/termvectors.js index d2942bc23..0ca120894 100644 --- a/api/api/termvectors.js +++ b/api/api/termvectors.js @@ -108,7 +108,7 @@ function buildTermvectors (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -131,20 +131,8 @@ function buildTermvectors (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/update.js b/api/api/update.js index 6584905ca..c488c2570 100644 --- a/api/api/update.js +++ b/api/api/update.js @@ -119,7 +119,7 @@ function buildUpdate (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -138,20 +138,8 @@ function buildUpdate (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/update_by_query.js b/api/api/update_by_query.js index ac34e44db..8cc891dc9 100644 --- a/api/api/update_by_query.js +++ b/api/api/update_by_query.js @@ -170,7 +170,7 @@ function buildUpdateByQuery (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -189,20 +189,8 @@ function buildUpdateByQuery (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/update_by_query_rethrottle.js b/api/api/update_by_query_rethrottle.js index 050feed99..d6d2408e9 100644 --- a/api/api/update_by_query_rethrottle.js +++ b/api/api/update_by_query_rethrottle.js @@ -89,7 +89,7 @@ function buildUpdateByQueryRethrottle (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -104,20 +104,8 @@ function buildUpdateByQueryRethrottle (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/watcher.ack_watch.js b/api/api/watcher.ack_watch.js index cc385c644..37b1b9458 100644 --- a/api/api/watcher.ack_watch.js +++ b/api/api/watcher.ack_watch.js @@ -84,7 +84,7 @@ function buildWatcherAckWatch (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -103,20 +103,8 @@ function buildWatcherAckWatch (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/watcher.activate_watch.js b/api/api/watcher.activate_watch.js index 6823f734b..d4a8e9594 100644 --- a/api/api/watcher.activate_watch.js +++ b/api/api/watcher.activate_watch.js @@ -77,7 +77,7 @@ function buildWatcherActivateWatch (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -92,20 +92,8 @@ function buildWatcherActivateWatch (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/watcher.deactivate_watch.js b/api/api/watcher.deactivate_watch.js index 5d089ca4b..d1fa2bcfc 100644 --- a/api/api/watcher.deactivate_watch.js +++ b/api/api/watcher.deactivate_watch.js @@ -77,7 +77,7 @@ function buildWatcherDeactivateWatch (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -92,20 +92,8 @@ function buildWatcherDeactivateWatch (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/watcher.delete_watch.js b/api/api/watcher.delete_watch.js index 21d41e1c9..28dcbcf9f 100644 --- a/api/api/watcher.delete_watch.js +++ b/api/api/watcher.delete_watch.js @@ -77,7 +77,7 @@ function buildWatcherDeleteWatch (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -92,20 +92,8 @@ function buildWatcherDeleteWatch (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/watcher.execute_watch.js b/api/api/watcher.execute_watch.js index 8b5cf89d2..137887ab2 100644 --- a/api/api/watcher.execute_watch.js +++ b/api/api/watcher.execute_watch.js @@ -69,7 +69,7 @@ function buildWatcherExecuteWatch (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -88,20 +88,8 @@ function buildWatcherExecuteWatch (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/watcher.get_watch.js b/api/api/watcher.get_watch.js index 587089f94..a0360a8a3 100644 --- a/api/api/watcher.get_watch.js +++ b/api/api/watcher.get_watch.js @@ -77,7 +77,7 @@ function buildWatcherGetWatch (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -92,20 +92,8 @@ function buildWatcherGetWatch (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/watcher.put_watch.js b/api/api/watcher.put_watch.js index 695f6eb19..45c458597 100644 --- a/api/api/watcher.put_watch.js +++ b/api/api/watcher.put_watch.js @@ -82,7 +82,7 @@ function buildWatcherPutWatch (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -97,20 +97,8 @@ function buildWatcherPutWatch (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/watcher.start.js b/api/api/watcher.start.js index 1053693f5..5827392ca 100644 --- a/api/api/watcher.start.js +++ b/api/api/watcher.start.js @@ -72,7 +72,7 @@ function buildWatcherStart (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -87,20 +87,8 @@ function buildWatcherStart (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/watcher.stats.js b/api/api/watcher.stats.js index ffa6b9bd9..0820352d3 100644 --- a/api/api/watcher.stats.js +++ b/api/api/watcher.stats.js @@ -76,7 +76,7 @@ function buildWatcherStats (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -95,20 +95,8 @@ function buildWatcherStats (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/watcher.stop.js b/api/api/watcher.stop.js index d7873de19..4dd309164 100644 --- a/api/api/watcher.stop.js +++ b/api/api/watcher.stop.js @@ -72,7 +72,7 @@ function buildWatcherStop (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -87,20 +87,8 @@ function buildWatcherStop (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/xpack.info.js b/api/api/xpack.info.js index 22d1f9f18..c35c3d50d 100644 --- a/api/api/xpack.info.js +++ b/api/api/xpack.info.js @@ -73,7 +73,7 @@ function buildXpackInfo (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -88,20 +88,8 @@ function buildXpackInfo (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} diff --git a/api/api/xpack.usage.js b/api/api/xpack.usage.js index 1885f4d93..a89831706 100644 --- a/api/api/xpack.usage.js +++ b/api/api/xpack.usage.js @@ -73,7 +73,7 @@ function buildXpackUsage (opts) { var ignore = options.ignore || null if (typeof ignore === 'number') { - ignore = [ignore] + options.ignore = [ignore] } var path = '' @@ -88,20 +88,8 @@ function buildXpackUsage (opts) { querystring } - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || null, - compression: options.compression || false, - id: options.id || null, - context: options.context || null, - warnings - } - - return makeRequest(request, requestOptions, callback) + options.warnings = warnings + return makeRequest(request, options, callback) function semicopy (obj, exclude) { var target = {} From 11d15fa214b3f2fbdb8ea6ee8aa24093a94b2c61 Mon Sep 17 00:00:00 2001 From: delvedor Date: Fri, 3 May 2019 17:58:26 +0200 Subject: [PATCH 3/6] Updated test --- test/unit/events.test.js | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/test/unit/events.test.js b/test/unit/events.test.js index d8029f2d5..1b967d900 100644 --- a/test/unit/events.test.js +++ b/test/unit/events.test.js @@ -53,15 +53,7 @@ test('Should emit a request event when a request is performed', t => { 'Content-Length': '0' } }, - options: { - ignore: null, - requestTimeout: null, - maxRetries: null, - asStream: false, - headers: null, - compression: false, - warnings: null - }, + options: {}, id: 1 }, connection: { @@ -113,15 +105,7 @@ test('Should emit a response event in case of a successful response', t => { 'Content-Length': '0' } }, - options: { - ignore: null, - requestTimeout: null, - maxRetries: null, - asStream: false, - headers: null, - compression: false, - warnings: null - }, + options: {}, id: 1 }, connection: { @@ -172,13 +156,7 @@ test('Should emit a response event with the error set', t => { } }, options: { - ignore: null, - requestTimeout: 500, - maxRetries: null, - asStream: false, - headers: null, - compression: false, - warnings: null + requestTimeout: 500 }, id: 1 }, From d06158a4655dcca06b8849e286de34c8c6d08464 Mon Sep 17 00:00:00 2001 From: delvedor Date: Fri, 3 May 2019 18:26:42 +0200 Subject: [PATCH 4/6] Updated code generation --- scripts/utils/generateApis.js | 28 ++++++---------------------- scripts/utils/generateMain.js | 14 ++++++++++++++ 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/scripts/utils/generateApis.js b/scripts/utils/generateApis.js index 61746bb8e..0f48503e2 100644 --- a/scripts/utils/generateApis.js +++ b/scripts/utils/generateApis.js @@ -128,15 +128,15 @@ function generate (spec, common) { return handleError(err, callback) } - var warnings = null - var { ${genQueryBlacklist(false)} } = params - var querystring = semicopy(params, [${genQueryBlacklist()}]) + var warnings = [] + var { ${genQueryBlacklist(false)}, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { ${generatePickMethod(methods)} } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } @@ -153,24 +153,8 @@ function generate (spec, common) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } `.trim() // always call trim to avoid newlines @@ -201,7 +185,7 @@ function generate (spec, common) { function build${name[0].toUpperCase() + name.slice(1)} (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts ${generateDocumentation(spec[api], api)} const acceptedQuerystring = [ diff --git a/scripts/utils/generateMain.js b/scripts/utils/generateMain.js index 7f0a5aeda..99d24f9a9 100644 --- a/scripts/utils/generateMain.js +++ b/scripts/utils/generateMain.js @@ -125,6 +125,7 @@ function genFactory (folder) { const { result } = opts opts.handleError = handleError + opts.snakeCaseKeys = snakeCaseKeys const apis = ${apisStr} @@ -135,6 +136,19 @@ function genFactory (folder) { if (callback) return callback(err, result) return Promise.reject(err) } + + function snakeCaseKeys (acceptedQuerystring, snakeCase, querystring, warnings) { + var target = {} + var keys = Object.keys(querystring) + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + target[snakeCase[key] || key] = querystring[key] + if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { + warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') + } + } + return target + } } // It's unlikely that a user needs all of our APIs, From 265ae3291f8ea3cd2324b7da1cf987dfb0fa5cea Mon Sep 17 00:00:00 2001 From: delvedor Date: Fri, 3 May 2019 18:26:47 +0200 Subject: [PATCH 5/6] API generation --- api/api/bulk.js | 26 ++++--------------- api/api/cat.aliases.js | 26 ++++--------------- api/api/cat.allocation.js | 26 ++++--------------- api/api/cat.count.js | 26 ++++--------------- api/api/cat.fielddata.js | 26 ++++--------------- api/api/cat.health.js | 26 ++++--------------- api/api/cat.help.js | 26 ++++--------------- api/api/cat.indices.js | 26 ++++--------------- api/api/cat.master.js | 26 ++++--------------- api/api/cat.nodeattrs.js | 26 ++++--------------- api/api/cat.nodes.js | 26 ++++--------------- api/api/cat.pending_tasks.js | 26 ++++--------------- api/api/cat.plugins.js | 26 ++++--------------- api/api/cat.recovery.js | 26 ++++--------------- api/api/cat.repositories.js | 26 ++++--------------- api/api/cat.segments.js | 26 ++++--------------- api/api/cat.shards.js | 26 ++++--------------- api/api/cat.snapshots.js | 26 ++++--------------- api/api/cat.tasks.js | 26 ++++--------------- api/api/cat.templates.js | 26 ++++--------------- api/api/cat.thread_pool.js | 26 ++++--------------- api/api/ccr.delete_auto_follow_pattern.js | 26 ++++--------------- api/api/ccr.follow.js | 26 ++++--------------- api/api/ccr.follow_info.js | 26 ++++--------------- api/api/ccr.follow_stats.js | 26 ++++--------------- api/api/ccr.forget_follower.js | 26 ++++--------------- api/api/ccr.get_auto_follow_pattern.js | 26 ++++--------------- api/api/ccr.pause_follow.js | 26 ++++--------------- api/api/ccr.put_auto_follow_pattern.js | 26 ++++--------------- api/api/ccr.resume_follow.js | 26 ++++--------------- api/api/ccr.stats.js | 26 ++++--------------- api/api/ccr.unfollow.js | 26 ++++--------------- api/api/clear_scroll.js | 26 ++++--------------- api/api/cluster.allocation_explain.js | 26 ++++--------------- api/api/cluster.get_settings.js | 26 ++++--------------- api/api/cluster.health.js | 26 ++++--------------- api/api/cluster.pending_tasks.js | 26 ++++--------------- api/api/cluster.put_settings.js | 26 ++++--------------- api/api/cluster.remote_info.js | 26 ++++--------------- api/api/cluster.reroute.js | 26 ++++--------------- api/api/cluster.state.js | 26 ++++--------------- api/api/cluster.stats.js | 26 ++++--------------- api/api/count.js | 26 ++++--------------- api/api/create.js | 26 ++++--------------- .../data_frame.delete_data_frame_transform.js | 26 ++++--------------- .../data_frame.get_data_frame_transform.js | 26 ++++--------------- ...ta_frame.get_data_frame_transform_stats.js | 26 ++++--------------- ...data_frame.preview_data_frame_transform.js | 26 ++++--------------- .../data_frame.put_data_frame_transform.js | 26 ++++--------------- .../data_frame.start_data_frame_transform.js | 26 ++++--------------- .../data_frame.stop_data_frame_transform.js | 26 ++++--------------- api/api/delete.js | 26 ++++--------------- api/api/delete_by_query.js | 26 ++++--------------- api/api/delete_by_query_rethrottle.js | 26 ++++--------------- api/api/delete_script.js | 26 ++++--------------- api/api/exists.js | 26 ++++--------------- api/api/exists_source.js | 26 ++++--------------- api/api/explain.js | 26 ++++--------------- api/api/field_caps.js | 26 ++++--------------- api/api/get.js | 26 ++++--------------- api/api/get_script.js | 26 ++++--------------- api/api/get_source.js | 26 ++++--------------- api/api/graph.explore.js | 26 ++++--------------- api/api/ilm.delete_lifecycle.js | 26 ++++--------------- api/api/ilm.explain_lifecycle.js | 26 ++++--------------- api/api/ilm.get_lifecycle.js | 26 ++++--------------- api/api/ilm.get_status.js | 26 ++++--------------- api/api/ilm.move_to_step.js | 26 ++++--------------- api/api/ilm.put_lifecycle.js | 26 ++++--------------- api/api/ilm.remove_policy.js | 26 ++++--------------- api/api/ilm.retry.js | 26 ++++--------------- api/api/ilm.start.js | 26 ++++--------------- api/api/ilm.stop.js | 26 ++++--------------- api/api/index.js | 26 ++++--------------- api/api/indices.analyze.js | 26 ++++--------------- api/api/indices.clear_cache.js | 26 ++++--------------- api/api/indices.close.js | 26 ++++--------------- api/api/indices.create.js | 26 ++++--------------- api/api/indices.delete.js | 26 ++++--------------- api/api/indices.delete_alias.js | 26 ++++--------------- api/api/indices.delete_template.js | 26 ++++--------------- api/api/indices.exists.js | 26 ++++--------------- api/api/indices.exists_alias.js | 26 ++++--------------- api/api/indices.exists_template.js | 26 ++++--------------- api/api/indices.exists_type.js | 26 ++++--------------- api/api/indices.flush.js | 26 ++++--------------- api/api/indices.flush_synced.js | 26 ++++--------------- api/api/indices.forcemerge.js | 26 ++++--------------- api/api/indices.freeze.js | 26 ++++--------------- api/api/indices.get.js | 26 ++++--------------- api/api/indices.get_alias.js | 26 ++++--------------- api/api/indices.get_field_mapping.js | 26 ++++--------------- api/api/indices.get_mapping.js | 26 ++++--------------- api/api/indices.get_settings.js | 26 ++++--------------- api/api/indices.get_template.js | 26 ++++--------------- api/api/indices.get_upgrade.js | 26 ++++--------------- api/api/indices.open.js | 26 ++++--------------- api/api/indices.put_alias.js | 26 ++++--------------- api/api/indices.put_mapping.js | 26 ++++--------------- api/api/indices.put_settings.js | 26 ++++--------------- api/api/indices.put_template.js | 26 ++++--------------- api/api/indices.recovery.js | 26 ++++--------------- api/api/indices.refresh.js | 26 ++++--------------- api/api/indices.rollover.js | 26 ++++--------------- api/api/indices.segments.js | 26 ++++--------------- api/api/indices.shard_stores.js | 26 ++++--------------- api/api/indices.shrink.js | 26 ++++--------------- api/api/indices.split.js | 26 ++++--------------- api/api/indices.stats.js | 26 ++++--------------- api/api/indices.unfreeze.js | 26 ++++--------------- api/api/indices.update_aliases.js | 26 ++++--------------- api/api/indices.upgrade.js | 26 ++++--------------- api/api/indices.validate_query.js | 26 ++++--------------- api/api/info.js | 26 ++++--------------- api/api/ingest.delete_pipeline.js | 26 ++++--------------- api/api/ingest.get_pipeline.js | 26 ++++--------------- api/api/ingest.processor_grok.js | 26 ++++--------------- api/api/ingest.put_pipeline.js | 26 ++++--------------- api/api/ingest.simulate.js | 26 ++++--------------- api/api/license.delete.js | 26 ++++--------------- api/api/license.get.js | 26 ++++--------------- api/api/license.get_basic_status.js | 26 ++++--------------- api/api/license.get_trial_status.js | 26 ++++--------------- api/api/license.post.js | 26 ++++--------------- api/api/license.post_start_basic.js | 26 ++++--------------- api/api/license.post_start_trial.js | 26 ++++--------------- api/api/mget.js | 26 ++++--------------- api/api/migration.deprecations.js | 26 ++++--------------- api/api/ml.close_job.js | 26 ++++--------------- api/api/ml.delete_calendar.js | 26 ++++--------------- api/api/ml.delete_calendar_event.js | 26 ++++--------------- api/api/ml.delete_calendar_job.js | 26 ++++--------------- api/api/ml.delete_datafeed.js | 26 ++++--------------- api/api/ml.delete_expired_data.js | 26 ++++--------------- api/api/ml.delete_filter.js | 26 ++++--------------- api/api/ml.delete_forecast.js | 26 ++++--------------- api/api/ml.delete_job.js | 26 ++++--------------- api/api/ml.delete_model_snapshot.js | 26 ++++--------------- api/api/ml.find_file_structure.js | 26 ++++--------------- api/api/ml.flush_job.js | 26 ++++--------------- api/api/ml.forecast.js | 26 ++++--------------- api/api/ml.get_buckets.js | 26 ++++--------------- api/api/ml.get_calendar_events.js | 26 ++++--------------- api/api/ml.get_calendars.js | 26 ++++--------------- api/api/ml.get_categories.js | 26 ++++--------------- api/api/ml.get_datafeed_stats.js | 26 ++++--------------- api/api/ml.get_datafeeds.js | 26 ++++--------------- api/api/ml.get_filters.js | 26 ++++--------------- api/api/ml.get_influencers.js | 26 ++++--------------- api/api/ml.get_job_stats.js | 26 ++++--------------- api/api/ml.get_jobs.js | 26 ++++--------------- api/api/ml.get_model_snapshots.js | 26 ++++--------------- api/api/ml.get_overall_buckets.js | 26 ++++--------------- api/api/ml.get_records.js | 26 ++++--------------- api/api/ml.info.js | 26 ++++--------------- api/api/ml.open_job.js | 26 ++++--------------- api/api/ml.post_calendar_events.js | 26 ++++--------------- api/api/ml.post_data.js | 26 ++++--------------- api/api/ml.preview_datafeed.js | 26 ++++--------------- api/api/ml.put_calendar.js | 26 ++++--------------- api/api/ml.put_calendar_job.js | 26 ++++--------------- api/api/ml.put_datafeed.js | 26 ++++--------------- api/api/ml.put_filter.js | 26 ++++--------------- api/api/ml.put_job.js | 26 ++++--------------- api/api/ml.revert_model_snapshot.js | 26 ++++--------------- api/api/ml.set_upgrade_mode.js | 26 ++++--------------- api/api/ml.start_datafeed.js | 26 ++++--------------- api/api/ml.stop_datafeed.js | 26 ++++--------------- api/api/ml.update_datafeed.js | 26 ++++--------------- api/api/ml.update_filter.js | 26 ++++--------------- api/api/ml.update_job.js | 26 ++++--------------- api/api/ml.update_model_snapshot.js | 26 ++++--------------- api/api/ml.validate.js | 26 ++++--------------- api/api/ml.validate_detector.js | 26 ++++--------------- api/api/monitoring.bulk.js | 26 ++++--------------- api/api/msearch.js | 26 ++++--------------- api/api/msearch_template.js | 26 ++++--------------- api/api/mtermvectors.js | 26 ++++--------------- api/api/nodes.hot_threads.js | 26 ++++--------------- api/api/nodes.info.js | 26 ++++--------------- api/api/nodes.reload_secure_settings.js | 26 ++++--------------- api/api/nodes.stats.js | 26 ++++--------------- api/api/nodes.usage.js | 26 ++++--------------- api/api/ping.js | 26 ++++--------------- api/api/put_script.js | 26 ++++--------------- api/api/rank_eval.js | 26 ++++--------------- api/api/reindex.js | 26 ++++--------------- api/api/reindex_rethrottle.js | 26 ++++--------------- api/api/render_search_template.js | 26 ++++--------------- api/api/rollup.delete_job.js | 26 ++++--------------- api/api/rollup.get_jobs.js | 26 ++++--------------- api/api/rollup.get_rollup_caps.js | 26 ++++--------------- api/api/rollup.get_rollup_index_caps.js | 26 ++++--------------- api/api/rollup.put_job.js | 26 ++++--------------- api/api/rollup.rollup_search.js | 26 ++++--------------- api/api/rollup.start_job.js | 26 ++++--------------- api/api/rollup.stop_job.js | 26 ++++--------------- api/api/scripts_painless_context.js | 26 ++++--------------- api/api/scripts_painless_execute.js | 26 ++++--------------- api/api/scroll.js | 26 ++++--------------- api/api/search.js | 26 ++++--------------- api/api/search_shards.js | 26 ++++--------------- api/api/search_template.js | 26 ++++--------------- api/api/security.authenticate.js | 26 ++++--------------- api/api/security.change_password.js | 26 ++++--------------- api/api/security.clear_cached_realms.js | 26 ++++--------------- api/api/security.clear_cached_roles.js | 26 ++++--------------- api/api/security.create_api_key.js | 26 ++++--------------- api/api/security.delete_privileges.js | 26 ++++--------------- api/api/security.delete_role.js | 26 ++++--------------- api/api/security.delete_role_mapping.js | 26 ++++--------------- api/api/security.delete_user.js | 26 ++++--------------- api/api/security.disable_user.js | 26 ++++--------------- api/api/security.enable_user.js | 26 ++++--------------- api/api/security.get_api_key.js | 26 ++++--------------- api/api/security.get_privileges.js | 26 ++++--------------- api/api/security.get_role.js | 26 ++++--------------- api/api/security.get_role_mapping.js | 26 ++++--------------- api/api/security.get_token.js | 26 ++++--------------- api/api/security.get_user.js | 26 ++++--------------- api/api/security.get_user_privileges.js | 26 ++++--------------- api/api/security.has_privileges.js | 26 ++++--------------- api/api/security.invalidate_api_key.js | 26 ++++--------------- api/api/security.invalidate_token.js | 26 ++++--------------- api/api/security.put_privileges.js | 26 ++++--------------- api/api/security.put_role.js | 26 ++++--------------- api/api/security.put_role_mapping.js | 26 ++++--------------- api/api/security.put_user.js | 26 ++++--------------- api/api/snapshot.create.js | 26 ++++--------------- api/api/snapshot.create_repository.js | 26 ++++--------------- api/api/snapshot.delete.js | 26 ++++--------------- api/api/snapshot.delete_repository.js | 26 ++++--------------- api/api/snapshot.get.js | 26 ++++--------------- api/api/snapshot.get_repository.js | 26 ++++--------------- api/api/snapshot.restore.js | 26 ++++--------------- api/api/snapshot.status.js | 26 ++++--------------- api/api/snapshot.verify_repository.js | 26 ++++--------------- api/api/sql.clear_cursor.js | 26 ++++--------------- api/api/sql.query.js | 26 ++++--------------- api/api/sql.translate.js | 26 ++++--------------- api/api/ssl.certificates.js | 26 ++++--------------- api/api/tasks.cancel.js | 26 ++++--------------- api/api/tasks.get.js | 26 ++++--------------- api/api/tasks.list.js | 26 ++++--------------- api/api/termvectors.js | 26 ++++--------------- api/api/update.js | 26 ++++--------------- api/api/update_by_query.js | 26 ++++--------------- api/api/update_by_query_rethrottle.js | 26 ++++--------------- api/api/watcher.ack_watch.js | 26 ++++--------------- api/api/watcher.activate_watch.js | 26 ++++--------------- api/api/watcher.deactivate_watch.js | 26 ++++--------------- api/api/watcher.delete_watch.js | 26 ++++--------------- api/api/watcher.execute_watch.js | 26 ++++--------------- api/api/watcher.get_watch.js | 26 ++++--------------- api/api/watcher.put_watch.js | 26 ++++--------------- api/api/watcher.start.js | 26 ++++--------------- api/api/watcher.stats.js | 26 ++++--------------- api/api/watcher.stop.js | 26 ++++--------------- api/api/xpack.info.js | 26 ++++--------------- api/api/xpack.usage.js | 26 ++++--------------- api/index.js | 14 ++++++++++ 261 files changed, 1314 insertions(+), 5460 deletions(-) diff --git a/api/api/bulk.js b/api/api/bulk.js index e916fcbd7..7a1a5ba49 100644 --- a/api/api/bulk.js +++ b/api/api/bulk.js @@ -24,7 +24,7 @@ function buildBulk (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [bulk](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-bulk.html) request * @@ -97,9 +97,9 @@ function buildBulk (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'type']) + var warnings = [] + var { method, body, index, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -128,24 +128,8 @@ function buildBulk (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/cat.aliases.js b/api/api/cat.aliases.js index f834853af..d61970caa 100644 --- a/api/api/cat.aliases.js +++ b/api/api/cat.aliases.js @@ -24,7 +24,7 @@ function buildCatAliases (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cat.aliases](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-alias.html) request * @@ -83,9 +83,9 @@ function buildCatAliases (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, name } = params - var querystring = semicopy(params, ['method', 'body', 'name']) + var warnings = [] + var { method, body, name, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -112,24 +112,8 @@ function buildCatAliases (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/cat.allocation.js b/api/api/cat.allocation.js index 6d305e256..85018422c 100644 --- a/api/api/cat.allocation.js +++ b/api/api/cat.allocation.js @@ -24,7 +24,7 @@ function buildCatAllocation (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cat.allocation](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-allocation.html) request * @@ -85,9 +85,9 @@ function buildCatAllocation (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, nodeId, node_id } = params - var querystring = semicopy(params, ['method', 'body', 'nodeId', 'node_id']) + var warnings = [] + var { method, body, nodeId, node_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -114,24 +114,8 @@ function buildCatAllocation (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/cat.count.js b/api/api/cat.count.js index 8c727fc48..bd9b0f921 100644 --- a/api/api/cat.count.js +++ b/api/api/cat.count.js @@ -24,7 +24,7 @@ function buildCatCount (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cat.count](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-count.html) request * @@ -83,9 +83,9 @@ function buildCatCount (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -112,24 +112,8 @@ function buildCatCount (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/cat.fielddata.js b/api/api/cat.fielddata.js index be5b16786..95674e08b 100644 --- a/api/api/cat.fielddata.js +++ b/api/api/cat.fielddata.js @@ -24,7 +24,7 @@ function buildCatFielddata (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cat.fielddata](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-fielddata.html) request * @@ -87,9 +87,9 @@ function buildCatFielddata (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, fields } = params - var querystring = semicopy(params, ['method', 'body', 'fields']) + var warnings = [] + var { method, body, fields, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -116,24 +116,8 @@ function buildCatFielddata (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/cat.health.js b/api/api/cat.health.js index c591c5e74..7a0ffae68 100644 --- a/api/api/cat.health.js +++ b/api/api/cat.health.js @@ -24,7 +24,7 @@ function buildCatHealth (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cat.health](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-health.html) request * @@ -84,9 +84,9 @@ function buildCatHealth (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -109,24 +109,8 @@ function buildCatHealth (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/cat.help.js b/api/api/cat.help.js index 8c7a46818..f0ac63226 100644 --- a/api/api/cat.help.js +++ b/api/api/cat.help.js @@ -24,7 +24,7 @@ function buildCatHelp (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cat.help](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat.html) request * @@ -71,9 +71,9 @@ function buildCatHelp (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -96,24 +96,8 @@ function buildCatHelp (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/cat.indices.js b/api/api/cat.indices.js index 7fe98dc03..a53f87a49 100644 --- a/api/api/cat.indices.js +++ b/api/api/cat.indices.js @@ -24,7 +24,7 @@ function buildCatIndices (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cat.indices](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-indices.html) request * @@ -92,9 +92,9 @@ function buildCatIndices (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -121,24 +121,8 @@ function buildCatIndices (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/cat.master.js b/api/api/cat.master.js index 6620d0578..d424285b5 100644 --- a/api/api/cat.master.js +++ b/api/api/cat.master.js @@ -24,7 +24,7 @@ function buildCatMaster (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cat.master](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-master.html) request * @@ -82,9 +82,9 @@ function buildCatMaster (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -107,24 +107,8 @@ function buildCatMaster (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/cat.nodeattrs.js b/api/api/cat.nodeattrs.js index 13ea0f1cc..e55f0d40e 100644 --- a/api/api/cat.nodeattrs.js +++ b/api/api/cat.nodeattrs.js @@ -24,7 +24,7 @@ function buildCatNodeattrs (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cat.nodeattrs](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-nodeattrs.html) request * @@ -82,9 +82,9 @@ function buildCatNodeattrs (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -107,24 +107,8 @@ function buildCatNodeattrs (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/cat.nodes.js b/api/api/cat.nodes.js index 19aec3f39..8f6b58617 100644 --- a/api/api/cat.nodes.js +++ b/api/api/cat.nodes.js @@ -24,7 +24,7 @@ function buildCatNodes (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cat.nodes](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-nodes.html) request * @@ -85,9 +85,9 @@ function buildCatNodes (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -110,24 +110,8 @@ function buildCatNodes (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/cat.pending_tasks.js b/api/api/cat.pending_tasks.js index 884cb0243..46d6787c9 100644 --- a/api/api/cat.pending_tasks.js +++ b/api/api/cat.pending_tasks.js @@ -24,7 +24,7 @@ function buildCatPendingTasks (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cat.pending_tasks](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-pending-tasks.html) request * @@ -82,9 +82,9 @@ function buildCatPendingTasks (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -107,24 +107,8 @@ function buildCatPendingTasks (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/cat.plugins.js b/api/api/cat.plugins.js index 84d8f068b..d18fe489a 100644 --- a/api/api/cat.plugins.js +++ b/api/api/cat.plugins.js @@ -24,7 +24,7 @@ function buildCatPlugins (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cat.plugins](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-plugins.html) request * @@ -82,9 +82,9 @@ function buildCatPlugins (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -107,24 +107,8 @@ function buildCatPlugins (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/cat.recovery.js b/api/api/cat.recovery.js index c55178acd..177b30a15 100644 --- a/api/api/cat.recovery.js +++ b/api/api/cat.recovery.js @@ -24,7 +24,7 @@ function buildCatRecovery (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cat.recovery](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-recovery.html) request * @@ -83,9 +83,9 @@ function buildCatRecovery (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -112,24 +112,8 @@ function buildCatRecovery (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/cat.repositories.js b/api/api/cat.repositories.js index 68f1e60f2..7f5a3ee7d 100644 --- a/api/api/cat.repositories.js +++ b/api/api/cat.repositories.js @@ -24,7 +24,7 @@ function buildCatRepositories (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cat.repositories](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-repositories.html) request * @@ -82,9 +82,9 @@ function buildCatRepositories (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -107,24 +107,8 @@ function buildCatRepositories (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/cat.segments.js b/api/api/cat.segments.js index 16ef904a7..ccbbda06a 100644 --- a/api/api/cat.segments.js +++ b/api/api/cat.segments.js @@ -24,7 +24,7 @@ function buildCatSegments (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cat.segments](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-segments.html) request * @@ -80,9 +80,9 @@ function buildCatSegments (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -109,24 +109,8 @@ function buildCatSegments (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/cat.shards.js b/api/api/cat.shards.js index feabfc64c..6ba32c3aa 100644 --- a/api/api/cat.shards.js +++ b/api/api/cat.shards.js @@ -24,7 +24,7 @@ function buildCatShards (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cat.shards](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-shards.html) request * @@ -85,9 +85,9 @@ function buildCatShards (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -114,24 +114,8 @@ function buildCatShards (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/cat.snapshots.js b/api/api/cat.snapshots.js index ac05968c8..d09a08f75 100644 --- a/api/api/cat.snapshots.js +++ b/api/api/cat.snapshots.js @@ -24,7 +24,7 @@ function buildCatSnapshots (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cat.snapshots](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-snapshots.html) request * @@ -84,9 +84,9 @@ function buildCatSnapshots (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, repository } = params - var querystring = semicopy(params, ['method', 'body', 'repository']) + var warnings = [] + var { method, body, repository, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -113,24 +113,8 @@ function buildCatSnapshots (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/cat.tasks.js b/api/api/cat.tasks.js index a264a9791..30ee9b81d 100644 --- a/api/api/cat.tasks.js +++ b/api/api/cat.tasks.js @@ -24,7 +24,7 @@ function buildCatTasks (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cat.tasks](http://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html) request * @@ -87,9 +87,9 @@ function buildCatTasks (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -112,24 +112,8 @@ function buildCatTasks (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/cat.templates.js b/api/api/cat.templates.js index cd7252e87..da5593fb1 100644 --- a/api/api/cat.templates.js +++ b/api/api/cat.templates.js @@ -24,7 +24,7 @@ function buildCatTemplates (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cat.templates](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-templates.html) request * @@ -83,9 +83,9 @@ function buildCatTemplates (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, name } = params - var querystring = semicopy(params, ['method', 'body', 'name']) + var warnings = [] + var { method, body, name, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -112,24 +112,8 @@ function buildCatTemplates (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/cat.thread_pool.js b/api/api/cat.thread_pool.js index f1216a9d8..bf2704ba1 100644 --- a/api/api/cat.thread_pool.js +++ b/api/api/cat.thread_pool.js @@ -24,7 +24,7 @@ function buildCatThreadPool (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cat.thread_pool](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-thread-pool.html) request * @@ -85,9 +85,9 @@ function buildCatThreadPool (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, threadPoolPatterns, thread_pool_patterns } = params - var querystring = semicopy(params, ['method', 'body', 'threadPoolPatterns', 'thread_pool_patterns']) + var warnings = [] + var { method, body, threadPoolPatterns, thread_pool_patterns, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -114,24 +114,8 @@ function buildCatThreadPool (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ccr.delete_auto_follow_pattern.js b/api/api/ccr.delete_auto_follow_pattern.js index af7d02e8a..558c62a8e 100644 --- a/api/api/ccr.delete_auto_follow_pattern.js +++ b/api/api/ccr.delete_auto_follow_pattern.js @@ -24,7 +24,7 @@ function buildCcrDeleteAutoFollowPattern (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ccr.delete_auto_follow_pattern](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-delete-auto-follow-pattern.html) request * @@ -63,9 +63,9 @@ function buildCcrDeleteAutoFollowPattern (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, name } = params - var querystring = semicopy(params, ['method', 'body', 'name']) + var warnings = [] + var { method, body, name, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' @@ -88,24 +88,8 @@ function buildCcrDeleteAutoFollowPattern (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ccr.follow.js b/api/api/ccr.follow.js index 0fb602361..6c995bfc8 100644 --- a/api/api/ccr.follow.js +++ b/api/api/ccr.follow.js @@ -24,7 +24,7 @@ function buildCcrFollow (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ccr.follow](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-put-follow.html) request * @@ -69,9 +69,9 @@ function buildCcrFollow (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' @@ -94,24 +94,8 @@ function buildCcrFollow (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ccr.follow_info.js b/api/api/ccr.follow_info.js index d75e517c4..feca34464 100644 --- a/api/api/ccr.follow_info.js +++ b/api/api/ccr.follow_info.js @@ -24,7 +24,7 @@ function buildCcrFollowInfo (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ccr.follow_info](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-follow-info.html) request * @@ -57,9 +57,9 @@ function buildCcrFollowInfo (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -82,24 +82,8 @@ function buildCcrFollowInfo (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ccr.follow_stats.js b/api/api/ccr.follow_stats.js index 8fae9f916..752c8c03e 100644 --- a/api/api/ccr.follow_stats.js +++ b/api/api/ccr.follow_stats.js @@ -24,7 +24,7 @@ function buildCcrFollowStats (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ccr.follow_stats](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-follow-stats.html) request * @@ -63,9 +63,9 @@ function buildCcrFollowStats (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -88,24 +88,8 @@ function buildCcrFollowStats (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ccr.forget_follower.js b/api/api/ccr.forget_follower.js index ab2fba318..f88ff2421 100644 --- a/api/api/ccr.forget_follower.js +++ b/api/api/ccr.forget_follower.js @@ -24,7 +24,7 @@ function buildCcrForgetFollower (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ccr.forget_follower](http://www.elastic.co/guide/en/elasticsearch/reference/current) request * @@ -68,9 +68,9 @@ function buildCcrForgetFollower (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -93,24 +93,8 @@ function buildCcrForgetFollower (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ccr.get_auto_follow_pattern.js b/api/api/ccr.get_auto_follow_pattern.js index 1ae2372a3..10d0c7603 100644 --- a/api/api/ccr.get_auto_follow_pattern.js +++ b/api/api/ccr.get_auto_follow_pattern.js @@ -24,7 +24,7 @@ function buildCcrGetAutoFollowPattern (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ccr.get_auto_follow_pattern](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-auto-follow-pattern.html) request * @@ -57,9 +57,9 @@ function buildCcrGetAutoFollowPattern (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, name } = params - var querystring = semicopy(params, ['method', 'body', 'name']) + var warnings = [] + var { method, body, name, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -86,24 +86,8 @@ function buildCcrGetAutoFollowPattern (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ccr.pause_follow.js b/api/api/ccr.pause_follow.js index 46619f641..3a5384cd7 100644 --- a/api/api/ccr.pause_follow.js +++ b/api/api/ccr.pause_follow.js @@ -24,7 +24,7 @@ function buildCcrPauseFollow (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ccr.pause_follow](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-post-pause-follow.html) request * @@ -63,9 +63,9 @@ function buildCcrPauseFollow (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -88,24 +88,8 @@ function buildCcrPauseFollow (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ccr.put_auto_follow_pattern.js b/api/api/ccr.put_auto_follow_pattern.js index 6c86180dd..e83889f9d 100644 --- a/api/api/ccr.put_auto_follow_pattern.js +++ b/api/api/ccr.put_auto_follow_pattern.js @@ -24,7 +24,7 @@ function buildCcrPutAutoFollowPattern (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ccr.put_auto_follow_pattern](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-put-auto-follow-pattern.html) request * @@ -68,9 +68,9 @@ function buildCcrPutAutoFollowPattern (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, name } = params - var querystring = semicopy(params, ['method', 'body', 'name']) + var warnings = [] + var { method, body, name, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' @@ -93,24 +93,8 @@ function buildCcrPutAutoFollowPattern (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ccr.resume_follow.js b/api/api/ccr.resume_follow.js index 5f757bc98..9369253cb 100644 --- a/api/api/ccr.resume_follow.js +++ b/api/api/ccr.resume_follow.js @@ -24,7 +24,7 @@ function buildCcrResumeFollow (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ccr.resume_follow](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-post-resume-follow.html) request * @@ -64,9 +64,9 @@ function buildCcrResumeFollow (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -89,24 +89,8 @@ function buildCcrResumeFollow (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ccr.stats.js b/api/api/ccr.stats.js index 305f21bff..2dbf6c50b 100644 --- a/api/api/ccr.stats.js +++ b/api/api/ccr.stats.js @@ -24,7 +24,7 @@ function buildCcrStats (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ccr.stats](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-stats.html) request * @@ -56,9 +56,9 @@ function buildCcrStats (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -81,24 +81,8 @@ function buildCcrStats (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ccr.unfollow.js b/api/api/ccr.unfollow.js index d142f2a4e..b984d46df 100644 --- a/api/api/ccr.unfollow.js +++ b/api/api/ccr.unfollow.js @@ -24,7 +24,7 @@ function buildCcrUnfollow (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ccr.unfollow](http://www.elastic.co/guide/en/elasticsearch/reference/current) request * @@ -63,9 +63,9 @@ function buildCcrUnfollow (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -88,24 +88,8 @@ function buildCcrUnfollow (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/clear_scroll.js b/api/api/clear_scroll.js index 7181f0b0e..52075c4b7 100644 --- a/api/api/clear_scroll.js +++ b/api/api/clear_scroll.js @@ -24,7 +24,7 @@ function buildClearScroll (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [clear_scroll](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-request-scroll.html) request * @@ -63,9 +63,9 @@ function buildClearScroll (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, scrollId, scroll_id } = params - var querystring = semicopy(params, ['method', 'body', 'scrollId', 'scroll_id']) + var warnings = [] + var { method, body, scrollId, scroll_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' @@ -92,24 +92,8 @@ function buildClearScroll (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/cluster.allocation_explain.js b/api/api/cluster.allocation_explain.js index d5f834562..6bef973b4 100644 --- a/api/api/cluster.allocation_explain.js +++ b/api/api/cluster.allocation_explain.js @@ -24,7 +24,7 @@ function buildClusterAllocationExplain (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cluster.allocation_explain](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-allocation-explain.html) request * @@ -68,9 +68,9 @@ function buildClusterAllocationExplain (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' @@ -93,24 +93,8 @@ function buildClusterAllocationExplain (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/cluster.get_settings.js b/api/api/cluster.get_settings.js index 4032e501b..902e61ee1 100644 --- a/api/api/cluster.get_settings.js +++ b/api/api/cluster.get_settings.js @@ -24,7 +24,7 @@ function buildClusterGetSettings (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cluster.get_settings](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-update-settings.html) request * @@ -78,9 +78,9 @@ function buildClusterGetSettings (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -103,24 +103,8 @@ function buildClusterGetSettings (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/cluster.health.js b/api/api/cluster.health.js index c67bbc629..eab0c9a19 100644 --- a/api/api/cluster.health.js +++ b/api/api/cluster.health.js @@ -24,7 +24,7 @@ function buildClusterHealth (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cluster.health](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-health.html) request * @@ -98,9 +98,9 @@ function buildClusterHealth (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -127,24 +127,8 @@ function buildClusterHealth (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/cluster.pending_tasks.js b/api/api/cluster.pending_tasks.js index 593e23dca..7649c1695 100644 --- a/api/api/cluster.pending_tasks.js +++ b/api/api/cluster.pending_tasks.js @@ -24,7 +24,7 @@ function buildClusterPendingTasks (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cluster.pending_tasks](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-pending.html) request * @@ -72,9 +72,9 @@ function buildClusterPendingTasks (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -97,24 +97,8 @@ function buildClusterPendingTasks (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/cluster.put_settings.js b/api/api/cluster.put_settings.js index c355e51a5..214276d20 100644 --- a/api/api/cluster.put_settings.js +++ b/api/api/cluster.put_settings.js @@ -24,7 +24,7 @@ function buildClusterPutSettings (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cluster.put_settings](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-update-settings.html) request * @@ -76,9 +76,9 @@ function buildClusterPutSettings (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' @@ -101,24 +101,8 @@ function buildClusterPutSettings (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/cluster.remote_info.js b/api/api/cluster.remote_info.js index 677af6093..081409d0b 100644 --- a/api/api/cluster.remote_info.js +++ b/api/api/cluster.remote_info.js @@ -24,7 +24,7 @@ function buildClusterRemoteInfo (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cluster.remote_info](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-remote-info.html) request * @@ -67,9 +67,9 @@ function buildClusterRemoteInfo (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -92,24 +92,8 @@ function buildClusterRemoteInfo (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/cluster.reroute.js b/api/api/cluster.reroute.js index 980e7fc1c..921c5c72f 100644 --- a/api/api/cluster.reroute.js +++ b/api/api/cluster.reroute.js @@ -24,7 +24,7 @@ function buildClusterReroute (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cluster.reroute](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-reroute.html) request * @@ -77,9 +77,9 @@ function buildClusterReroute (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -102,24 +102,8 @@ function buildClusterReroute (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/cluster.state.js b/api/api/cluster.state.js index 108fb84cc..1f2ac004d 100644 --- a/api/api/cluster.state.js +++ b/api/api/cluster.state.js @@ -24,7 +24,7 @@ function buildClusterState (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cluster.state](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-state.html) request * @@ -98,9 +98,9 @@ function buildClusterState (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, metric } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'metric']) + var warnings = [] + var { method, body, index, metric, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -129,24 +129,8 @@ function buildClusterState (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/cluster.stats.js b/api/api/cluster.stats.js index 188d9a9df..13c5d045f 100644 --- a/api/api/cluster.stats.js +++ b/api/api/cluster.stats.js @@ -24,7 +24,7 @@ function buildClusterStats (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [cluster.stats](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-stats.html) request * @@ -73,9 +73,9 @@ function buildClusterStats (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, nodeId, node_id } = params - var querystring = semicopy(params, ['method', 'body', 'nodeId', 'node_id']) + var warnings = [] + var { method, body, nodeId, node_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -102,24 +102,8 @@ function buildClusterStats (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/count.js b/api/api/count.js index 723e6f262..e29c6b139 100644 --- a/api/api/count.js +++ b/api/api/count.js @@ -24,7 +24,7 @@ function buildCount (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [count](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-count.html) request * @@ -106,9 +106,9 @@ function buildCount (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'type']) + var warnings = [] + var { method, body, index, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' @@ -137,24 +137,8 @@ function buildCount (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/create.js b/api/api/create.js index ce6ec2b19..94e15a5c9 100644 --- a/api/api/create.js +++ b/api/api/create.js @@ -24,7 +24,7 @@ function buildCreate (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [create](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-index_.html) request * @@ -97,9 +97,9 @@ function buildCreate (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'id', 'index', 'type']) + var warnings = [] + var { method, body, id, index, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' @@ -126,24 +126,8 @@ function buildCreate (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/data_frame.delete_data_frame_transform.js b/api/api/data_frame.delete_data_frame_transform.js index 811033d76..528c80c9a 100644 --- a/api/api/data_frame.delete_data_frame_transform.js +++ b/api/api/data_frame.delete_data_frame_transform.js @@ -24,7 +24,7 @@ function buildDataFrameDeleteDataFrameTransform (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [data_frame.delete_data_frame_transform](https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-data-frame-transform.html) request * @@ -67,9 +67,9 @@ function buildDataFrameDeleteDataFrameTransform (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, transformId, transform_id } = params - var querystring = semicopy(params, ['method', 'body', 'transformId', 'transform_id']) + var warnings = [] + var { method, body, transformId, transform_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' @@ -92,24 +92,8 @@ function buildDataFrameDeleteDataFrameTransform (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/data_frame.get_data_frame_transform.js b/api/api/data_frame.get_data_frame_transform.js index eac731c16..e98621fd9 100644 --- a/api/api/data_frame.get_data_frame_transform.js +++ b/api/api/data_frame.get_data_frame_transform.js @@ -24,7 +24,7 @@ function buildDataFrameGetDataFrameTransform (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [data_frame.get_data_frame_transform](https://www.elastic.co/guide/en/elasticsearch/reference/current/get-data-frame-transform.html) request * @@ -66,9 +66,9 @@ function buildDataFrameGetDataFrameTransform (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, transformId, transform_id } = params - var querystring = semicopy(params, ['method', 'body', 'transformId', 'transform_id']) + var warnings = [] + var { method, body, transformId, transform_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -95,24 +95,8 @@ function buildDataFrameGetDataFrameTransform (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/data_frame.get_data_frame_transform_stats.js b/api/api/data_frame.get_data_frame_transform_stats.js index 4c4f8cf91..027ff31ba 100644 --- a/api/api/data_frame.get_data_frame_transform_stats.js +++ b/api/api/data_frame.get_data_frame_transform_stats.js @@ -24,7 +24,7 @@ function buildDataFrameGetDataFrameTransformStats (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [data_frame.get_data_frame_transform_stats](https://www.elastic.co/guide/en/elasticsearch/reference/current/get-data-frame-transform-stats.html) request * @@ -66,9 +66,9 @@ function buildDataFrameGetDataFrameTransformStats (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, transformId, transform_id } = params - var querystring = semicopy(params, ['method', 'body', 'transformId', 'transform_id']) + var warnings = [] + var { method, body, transformId, transform_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -91,24 +91,8 @@ function buildDataFrameGetDataFrameTransformStats (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/data_frame.preview_data_frame_transform.js b/api/api/data_frame.preview_data_frame_transform.js index 64ca95ae8..2a81a4226 100644 --- a/api/api/data_frame.preview_data_frame_transform.js +++ b/api/api/data_frame.preview_data_frame_transform.js @@ -24,7 +24,7 @@ function buildDataFramePreviewDataFrameTransform (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [data_frame.preview_data_frame_transform](https://www.elastic.co/guide/en/elasticsearch/reference/current/preview-data-frame-transform.html) request * @@ -63,9 +63,9 @@ function buildDataFramePreviewDataFrameTransform (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -88,24 +88,8 @@ function buildDataFramePreviewDataFrameTransform (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/data_frame.put_data_frame_transform.js b/api/api/data_frame.put_data_frame_transform.js index f02f8e1db..d14b7435c 100644 --- a/api/api/data_frame.put_data_frame_transform.js +++ b/api/api/data_frame.put_data_frame_transform.js @@ -24,7 +24,7 @@ function buildDataFramePutDataFrameTransform (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [data_frame.put_data_frame_transform](https://www.elastic.co/guide/en/elasticsearch/reference/current/put-data-frame-transform.html) request * @@ -68,9 +68,9 @@ function buildDataFramePutDataFrameTransform (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, transformId, transform_id } = params - var querystring = semicopy(params, ['method', 'body', 'transformId', 'transform_id']) + var warnings = [] + var { method, body, transformId, transform_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' @@ -93,24 +93,8 @@ function buildDataFramePutDataFrameTransform (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/data_frame.start_data_frame_transform.js b/api/api/data_frame.start_data_frame_transform.js index 7bca597f4..9728343ef 100644 --- a/api/api/data_frame.start_data_frame_transform.js +++ b/api/api/data_frame.start_data_frame_transform.js @@ -24,7 +24,7 @@ function buildDataFrameStartDataFrameTransform (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [data_frame.start_data_frame_transform](https://www.elastic.co/guide/en/elasticsearch/reference/current/start-data-frame-transform.html) request * @@ -68,9 +68,9 @@ function buildDataFrameStartDataFrameTransform (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, transformId, transform_id } = params - var querystring = semicopy(params, ['method', 'body', 'transformId', 'transform_id']) + var warnings = [] + var { method, body, transformId, transform_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -93,24 +93,8 @@ function buildDataFrameStartDataFrameTransform (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/data_frame.stop_data_frame_transform.js b/api/api/data_frame.stop_data_frame_transform.js index 254f2ba47..868f72b7b 100644 --- a/api/api/data_frame.stop_data_frame_transform.js +++ b/api/api/data_frame.stop_data_frame_transform.js @@ -24,7 +24,7 @@ function buildDataFrameStopDataFrameTransform (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [data_frame.stop_data_frame_transform](https://www.elastic.co/guide/en/elasticsearch/reference/current/stop-data-frame-transform.html) request * @@ -71,9 +71,9 @@ function buildDataFrameStopDataFrameTransform (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, transformId, transform_id } = params - var querystring = semicopy(params, ['method', 'body', 'transformId', 'transform_id']) + var warnings = [] + var { method, body, transformId, transform_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -96,24 +96,8 @@ function buildDataFrameStopDataFrameTransform (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/delete.js b/api/api/delete.js index c33f9b459..7ce5d9b06 100644 --- a/api/api/delete.js +++ b/api/api/delete.js @@ -24,7 +24,7 @@ function buildDelete (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [delete](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete.html) request * @@ -100,9 +100,9 @@ function buildDelete (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'id', 'index', 'type']) + var warnings = [] + var { method, body, id, index, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' @@ -129,24 +129,8 @@ function buildDelete (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/delete_by_query.js b/api/api/delete_by_query.js index 57996e85c..52a4a8850 100644 --- a/api/api/delete_by_query.js +++ b/api/api/delete_by_query.js @@ -24,7 +24,7 @@ function buildDeleteByQuery (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [delete_by_query](https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete-by-query.html) request * @@ -159,9 +159,9 @@ function buildDeleteByQuery (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'type']) + var warnings = [] + var { method, body, index, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -188,24 +188,8 @@ function buildDeleteByQuery (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/delete_by_query_rethrottle.js b/api/api/delete_by_query_rethrottle.js index 62b5cf37f..3c7759916 100644 --- a/api/api/delete_by_query_rethrottle.js +++ b/api/api/delete_by_query_rethrottle.js @@ -24,7 +24,7 @@ function buildDeleteByQueryRethrottle (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [delete_by_query_rethrottle](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html) request * @@ -79,9 +79,9 @@ function buildDeleteByQueryRethrottle (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, taskId, task_id } = params - var querystring = semicopy(params, ['method', 'body', 'taskId', 'task_id']) + var warnings = [] + var { method, body, taskId, task_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -104,24 +104,8 @@ function buildDeleteByQueryRethrottle (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/delete_script.js b/api/api/delete_script.js index f5d146229..b1d15756f 100644 --- a/api/api/delete_script.js +++ b/api/api/delete_script.js @@ -24,7 +24,7 @@ function buildDeleteScript (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [delete_script](http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html) request * @@ -77,9 +77,9 @@ function buildDeleteScript (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id } = params - var querystring = semicopy(params, ['method', 'body', 'id']) + var warnings = [] + var { method, body, id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' @@ -102,24 +102,8 @@ function buildDeleteScript (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/exists.js b/api/api/exists.js index cb88ddaf3..92a6c4322 100644 --- a/api/api/exists.js +++ b/api/api/exists.js @@ -24,7 +24,7 @@ function buildExists (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [exists](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html) request * @@ -104,9 +104,9 @@ function buildExists (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'id', 'index', 'type']) + var warnings = [] + var { method, body, id, index, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'HEAD' @@ -133,24 +133,8 @@ function buildExists (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/exists_source.js b/api/api/exists_source.js index a02acaf4b..7ec88e867 100644 --- a/api/api/exists_source.js +++ b/api/api/exists_source.js @@ -24,7 +24,7 @@ function buildExistsSource (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [exists_source](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html) request * @@ -110,9 +110,9 @@ function buildExistsSource (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'id', 'index', 'type']) + var warnings = [] + var { method, body, id, index, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'HEAD' @@ -139,24 +139,8 @@ function buildExistsSource (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/explain.js b/api/api/explain.js index 7d46448b8..e0447ef30 100644 --- a/api/api/explain.js +++ b/api/api/explain.js @@ -24,7 +24,7 @@ function buildExplain (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [explain](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-explain.html) request * @@ -106,9 +106,9 @@ function buildExplain (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'id', 'index', 'type']) + var warnings = [] + var { method, body, id, index, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' @@ -135,24 +135,8 @@ function buildExplain (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/field_caps.js b/api/api/field_caps.js index b4094734d..a4843f046 100644 --- a/api/api/field_caps.js +++ b/api/api/field_caps.js @@ -24,7 +24,7 @@ function buildFieldCaps (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [field_caps](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-field-caps.html) request * @@ -82,9 +82,9 @@ function buildFieldCaps (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' @@ -111,24 +111,8 @@ function buildFieldCaps (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/get.js b/api/api/get.js index 037142c1c..d512b2d5a 100644 --- a/api/api/get.js +++ b/api/api/get.js @@ -24,7 +24,7 @@ function buildGet (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [get](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html) request * @@ -104,9 +104,9 @@ function buildGet (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'id', 'index', 'type']) + var warnings = [] + var { method, body, id, index, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -133,24 +133,8 @@ function buildGet (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/get_script.js b/api/api/get_script.js index a51628a4b..af1b23054 100644 --- a/api/api/get_script.js +++ b/api/api/get_script.js @@ -24,7 +24,7 @@ function buildGetScript (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [get_script](http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html) request * @@ -75,9 +75,9 @@ function buildGetScript (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id } = params - var querystring = semicopy(params, ['method', 'body', 'id']) + var warnings = [] + var { method, body, id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -100,24 +100,8 @@ function buildGetScript (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/get_source.js b/api/api/get_source.js index 81cd2dd43..be536d155 100644 --- a/api/api/get_source.js +++ b/api/api/get_source.js @@ -24,7 +24,7 @@ function buildGetSource (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [get_source](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html) request * @@ -101,9 +101,9 @@ function buildGetSource (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'id', 'index', 'type']) + var warnings = [] + var { method, body, id, index, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -130,24 +130,8 @@ function buildGetSource (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/graph.explore.js b/api/api/graph.explore.js index a3b856666..994bcb835 100644 --- a/api/api/graph.explore.js +++ b/api/api/graph.explore.js @@ -24,7 +24,7 @@ function buildGraphExplore (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [graph.explore](https://www.elastic.co/guide/en/elasticsearch/reference/current/graph-explore-api.html) request * @@ -68,9 +68,9 @@ function buildGraphExplore (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'type']) + var warnings = [] + var { method, body, index, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' @@ -97,24 +97,8 @@ function buildGraphExplore (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ilm.delete_lifecycle.js b/api/api/ilm.delete_lifecycle.js index f1cb697be..fa0af34b2 100644 --- a/api/api/ilm.delete_lifecycle.js +++ b/api/api/ilm.delete_lifecycle.js @@ -24,7 +24,7 @@ function buildIlmDeleteLifecycle (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ilm.delete_lifecycle](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-delete-lifecycle.html) request * @@ -63,9 +63,9 @@ function buildIlmDeleteLifecycle (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, policy } = params - var querystring = semicopy(params, ['method', 'body', 'policy']) + var warnings = [] + var { method, body, policy, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' @@ -88,24 +88,8 @@ function buildIlmDeleteLifecycle (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ilm.explain_lifecycle.js b/api/api/ilm.explain_lifecycle.js index 50f09678d..51a931853 100644 --- a/api/api/ilm.explain_lifecycle.js +++ b/api/api/ilm.explain_lifecycle.js @@ -24,7 +24,7 @@ function buildIlmExplainLifecycle (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ilm.explain_lifecycle](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-explain-lifecycle.html) request * @@ -63,9 +63,9 @@ function buildIlmExplainLifecycle (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -88,24 +88,8 @@ function buildIlmExplainLifecycle (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ilm.get_lifecycle.js b/api/api/ilm.get_lifecycle.js index 7c9fcdc96..a029fae4f 100644 --- a/api/api/ilm.get_lifecycle.js +++ b/api/api/ilm.get_lifecycle.js @@ -24,7 +24,7 @@ function buildIlmGetLifecycle (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ilm.get_lifecycle](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-get-lifecycle.html) request * @@ -63,9 +63,9 @@ function buildIlmGetLifecycle (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, policy } = params - var querystring = semicopy(params, ['method', 'body', 'policy']) + var warnings = [] + var { method, body, policy, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -92,24 +92,8 @@ function buildIlmGetLifecycle (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ilm.get_status.js b/api/api/ilm.get_status.js index c9e63ed19..4745f6f8c 100644 --- a/api/api/ilm.get_status.js +++ b/api/api/ilm.get_status.js @@ -24,7 +24,7 @@ function buildIlmGetStatus (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ilm.get_status](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-get-status.html) request * @@ -62,9 +62,9 @@ function buildIlmGetStatus (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -87,24 +87,8 @@ function buildIlmGetStatus (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ilm.move_to_step.js b/api/api/ilm.move_to_step.js index 382badd95..a55e2e519 100644 --- a/api/api/ilm.move_to_step.js +++ b/api/api/ilm.move_to_step.js @@ -24,7 +24,7 @@ function buildIlmMoveToStep (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ilm.move_to_step](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-move-to-step.html) request * @@ -58,9 +58,9 @@ function buildIlmMoveToStep (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -83,24 +83,8 @@ function buildIlmMoveToStep (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ilm.put_lifecycle.js b/api/api/ilm.put_lifecycle.js index def795c63..b103a2aa7 100644 --- a/api/api/ilm.put_lifecycle.js +++ b/api/api/ilm.put_lifecycle.js @@ -24,7 +24,7 @@ function buildIlmPutLifecycle (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ilm.put_lifecycle](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-put-lifecycle.html) request * @@ -58,9 +58,9 @@ function buildIlmPutLifecycle (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, policy } = params - var querystring = semicopy(params, ['method', 'body', 'policy']) + var warnings = [] + var { method, body, policy, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' @@ -83,24 +83,8 @@ function buildIlmPutLifecycle (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ilm.remove_policy.js b/api/api/ilm.remove_policy.js index ef4e4963c..faac2af2d 100644 --- a/api/api/ilm.remove_policy.js +++ b/api/api/ilm.remove_policy.js @@ -24,7 +24,7 @@ function buildIlmRemovePolicy (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ilm.remove_policy](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-remove-policy.html) request * @@ -63,9 +63,9 @@ function buildIlmRemovePolicy (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -88,24 +88,8 @@ function buildIlmRemovePolicy (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ilm.retry.js b/api/api/ilm.retry.js index 57c44fda5..60aac54b0 100644 --- a/api/api/ilm.retry.js +++ b/api/api/ilm.retry.js @@ -24,7 +24,7 @@ function buildIlmRetry (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ilm.retry](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-retry-policy.html) request * @@ -63,9 +63,9 @@ function buildIlmRetry (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -88,24 +88,8 @@ function buildIlmRetry (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ilm.start.js b/api/api/ilm.start.js index 3752cc584..4ebf60bfa 100644 --- a/api/api/ilm.start.js +++ b/api/api/ilm.start.js @@ -24,7 +24,7 @@ function buildIlmStart (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ilm.start](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-start.html) request * @@ -62,9 +62,9 @@ function buildIlmStart (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -87,24 +87,8 @@ function buildIlmStart (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ilm.stop.js b/api/api/ilm.stop.js index 8a3e94d68..08f700c2d 100644 --- a/api/api/ilm.stop.js +++ b/api/api/ilm.stop.js @@ -24,7 +24,7 @@ function buildIlmStop (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ilm.stop](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-stop.html) request * @@ -62,9 +62,9 @@ function buildIlmStop (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -87,24 +87,8 @@ function buildIlmStop (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/index.js b/api/api/index.js index 687991d55..3b050d360 100644 --- a/api/api/index.js +++ b/api/api/index.js @@ -24,7 +24,7 @@ function buildIndex (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [index](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-index_.html) request * @@ -102,9 +102,9 @@ function buildIndex (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'id', 'index', 'type']) + var warnings = [] + var { method, body, id, index, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -135,24 +135,8 @@ function buildIndex (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/indices.analyze.js b/api/api/indices.analyze.js index ec5330855..ac35c577e 100644 --- a/api/api/indices.analyze.js +++ b/api/api/indices.analyze.js @@ -24,7 +24,7 @@ function buildIndicesAnalyze (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.analyze](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-analyze.html) request * @@ -65,9 +65,9 @@ function buildIndicesAnalyze (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' @@ -94,24 +94,8 @@ function buildIndicesAnalyze (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/indices.clear_cache.js b/api/api/indices.clear_cache.js index bee56bea3..1738fb605 100644 --- a/api/api/indices.clear_cache.js +++ b/api/api/indices.clear_cache.js @@ -24,7 +24,7 @@ function buildIndicesClearCache (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.clear_cache](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-clearcache.html) request * @@ -87,9 +87,9 @@ function buildIndicesClearCache (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -116,24 +116,8 @@ function buildIndicesClearCache (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/indices.close.js b/api/api/indices.close.js index 824d7e60a..9ceffe482 100644 --- a/api/api/indices.close.js +++ b/api/api/indices.close.js @@ -24,7 +24,7 @@ function buildIndicesClose (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.close](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-open-close.html) request * @@ -89,9 +89,9 @@ function buildIndicesClose (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -114,24 +114,8 @@ function buildIndicesClose (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/indices.create.js b/api/api/indices.create.js index f7186b67c..61aeea7d2 100644 --- a/api/api/indices.create.js +++ b/api/api/indices.create.js @@ -24,7 +24,7 @@ function buildIndicesCreate (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.create](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-create-index.html) request * @@ -80,9 +80,9 @@ function buildIndicesCreate (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' @@ -105,24 +105,8 @@ function buildIndicesCreate (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/indices.delete.js b/api/api/indices.delete.js index d4da1c450..49214d04c 100644 --- a/api/api/indices.delete.js +++ b/api/api/indices.delete.js @@ -24,7 +24,7 @@ function buildIndicesDelete (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.delete](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-delete-index.html) request * @@ -86,9 +86,9 @@ function buildIndicesDelete (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' @@ -111,24 +111,8 @@ function buildIndicesDelete (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/indices.delete_alias.js b/api/api/indices.delete_alias.js index 65ced4f4b..8a0d9b730 100644 --- a/api/api/indices.delete_alias.js +++ b/api/api/indices.delete_alias.js @@ -24,7 +24,7 @@ function buildIndicesDeleteAlias (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.delete_alias](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html) request * @@ -88,9 +88,9 @@ function buildIndicesDeleteAlias (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, name } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'name']) + var warnings = [] + var { method, body, index, name, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' @@ -117,24 +117,8 @@ function buildIndicesDeleteAlias (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/indices.delete_template.js b/api/api/indices.delete_template.js index 1e771247d..d19459368 100644 --- a/api/api/indices.delete_template.js +++ b/api/api/indices.delete_template.js @@ -24,7 +24,7 @@ function buildIndicesDeleteTemplate (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.delete_template](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html) request * @@ -77,9 +77,9 @@ function buildIndicesDeleteTemplate (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, name } = params - var querystring = semicopy(params, ['method', 'body', 'name']) + var warnings = [] + var { method, body, name, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' @@ -102,24 +102,8 @@ function buildIndicesDeleteTemplate (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/indices.exists.js b/api/api/indices.exists.js index d9084504d..f7978bd10 100644 --- a/api/api/indices.exists.js +++ b/api/api/indices.exists.js @@ -24,7 +24,7 @@ function buildIndicesExists (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.exists](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-exists.html) request * @@ -89,9 +89,9 @@ function buildIndicesExists (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'HEAD' @@ -114,24 +114,8 @@ function buildIndicesExists (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/indices.exists_alias.js b/api/api/indices.exists_alias.js index 790764bf9..0034bf8b5 100644 --- a/api/api/indices.exists_alias.js +++ b/api/api/indices.exists_alias.js @@ -24,7 +24,7 @@ function buildIndicesExistsAlias (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.exists_alias](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html) request * @@ -84,9 +84,9 @@ function buildIndicesExistsAlias (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, name } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'name']) + var warnings = [] + var { method, body, index, name, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'HEAD' @@ -113,24 +113,8 @@ function buildIndicesExistsAlias (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/indices.exists_template.js b/api/api/indices.exists_template.js index a433a2b1b..55b881591 100644 --- a/api/api/indices.exists_template.js +++ b/api/api/indices.exists_template.js @@ -24,7 +24,7 @@ function buildIndicesExistsTemplate (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.exists_template](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html) request * @@ -80,9 +80,9 @@ function buildIndicesExistsTemplate (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, name } = params - var querystring = semicopy(params, ['method', 'body', 'name']) + var warnings = [] + var { method, body, name, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'HEAD' @@ -105,24 +105,8 @@ function buildIndicesExistsTemplate (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/indices.exists_type.js b/api/api/indices.exists_type.js index 36dfdd109..acacc729e 100644 --- a/api/api/indices.exists_type.js +++ b/api/api/indices.exists_type.js @@ -24,7 +24,7 @@ function buildIndicesExistsType (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.exists_type](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-types-exists.html) request * @@ -94,9 +94,9 @@ function buildIndicesExistsType (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'type']) + var warnings = [] + var { method, body, index, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'HEAD' @@ -119,24 +119,8 @@ function buildIndicesExistsType (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/indices.flush.js b/api/api/indices.flush.js index ef39494e5..020fc4831 100644 --- a/api/api/indices.flush.js +++ b/api/api/indices.flush.js @@ -24,7 +24,7 @@ function buildIndicesFlush (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.flush](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-flush.html) request * @@ -82,9 +82,9 @@ function buildIndicesFlush (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' @@ -111,24 +111,8 @@ function buildIndicesFlush (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/indices.flush_synced.js b/api/api/indices.flush_synced.js index 9105cd7e4..9794eb2d5 100644 --- a/api/api/indices.flush_synced.js +++ b/api/api/indices.flush_synced.js @@ -24,7 +24,7 @@ function buildIndicesFlushSynced (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.flush_synced](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-synced-flush.html) request * @@ -77,9 +77,9 @@ function buildIndicesFlushSynced (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' @@ -106,24 +106,8 @@ function buildIndicesFlushSynced (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/indices.forcemerge.js b/api/api/indices.forcemerge.js index 0f68c466e..ab3747ef8 100644 --- a/api/api/indices.forcemerge.js +++ b/api/api/indices.forcemerge.js @@ -24,7 +24,7 @@ function buildIndicesForcemerge (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.forcemerge](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-forcemerge.html) request * @@ -85,9 +85,9 @@ function buildIndicesForcemerge (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -114,24 +114,8 @@ function buildIndicesForcemerge (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/indices.freeze.js b/api/api/indices.freeze.js index 6e0cc2bdc..a11b21dec 100644 --- a/api/api/indices.freeze.js +++ b/api/api/indices.freeze.js @@ -24,7 +24,7 @@ function buildIndicesFreeze (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.freeze](https://www.elastic.co/guide/en/elasticsearch/reference/current/frozen.html) request * @@ -82,9 +82,9 @@ function buildIndicesFreeze (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -107,24 +107,8 @@ function buildIndicesFreeze (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/indices.get.js b/api/api/indices.get.js index 069d7f23e..270ed8884 100644 --- a/api/api/indices.get.js +++ b/api/api/indices.get.js @@ -24,7 +24,7 @@ function buildIndicesGet (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.get](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-index.html) request * @@ -95,9 +95,9 @@ function buildIndicesGet (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -120,24 +120,8 @@ function buildIndicesGet (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/indices.get_alias.js b/api/api/indices.get_alias.js index 913b3d22d..01085e8bf 100644 --- a/api/api/indices.get_alias.js +++ b/api/api/indices.get_alias.js @@ -24,7 +24,7 @@ function buildIndicesGetAlias (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.get_alias](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html) request * @@ -80,9 +80,9 @@ function buildIndicesGetAlias (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, name } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'name']) + var warnings = [] + var { method, body, index, name, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -113,24 +113,8 @@ function buildIndicesGetAlias (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/indices.get_field_mapping.js b/api/api/indices.get_field_mapping.js index 968124774..eb123b9e3 100644 --- a/api/api/indices.get_field_mapping.js +++ b/api/api/indices.get_field_mapping.js @@ -24,7 +24,7 @@ function buildIndicesGetFieldMapping (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.get_field_mapping](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-field-mapping.html) request * @@ -91,9 +91,9 @@ function buildIndicesGetFieldMapping (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, type, fields } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'type', 'fields']) + var warnings = [] + var { method, body, index, type, fields, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -124,24 +124,8 @@ function buildIndicesGetFieldMapping (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/indices.get_mapping.js b/api/api/indices.get_mapping.js index e0c292504..03abea27a 100644 --- a/api/api/indices.get_mapping.js +++ b/api/api/indices.get_mapping.js @@ -24,7 +24,7 @@ function buildIndicesGetMapping (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.get_mapping](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-mapping.html) request * @@ -86,9 +86,9 @@ function buildIndicesGetMapping (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'type']) + var warnings = [] + var { method, body, index, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -119,24 +119,8 @@ function buildIndicesGetMapping (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/indices.get_settings.js b/api/api/indices.get_settings.js index faafe56c2..708a6909a 100644 --- a/api/api/indices.get_settings.js +++ b/api/api/indices.get_settings.js @@ -24,7 +24,7 @@ function buildIndicesGetSettings (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.get_settings](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-settings.html) request * @@ -89,9 +89,9 @@ function buildIndicesGetSettings (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, name } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'name']) + var warnings = [] + var { method, body, index, name, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -122,24 +122,8 @@ function buildIndicesGetSettings (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/indices.get_template.js b/api/api/indices.get_template.js index faed75248..b458cb8fd 100644 --- a/api/api/indices.get_template.js +++ b/api/api/indices.get_template.js @@ -24,7 +24,7 @@ function buildIndicesGetTemplate (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.get_template](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html) request * @@ -79,9 +79,9 @@ function buildIndicesGetTemplate (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, name } = params - var querystring = semicopy(params, ['method', 'body', 'name']) + var warnings = [] + var { method, body, name, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -108,24 +108,8 @@ function buildIndicesGetTemplate (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/indices.get_upgrade.js b/api/api/indices.get_upgrade.js index 1513373a7..a38397963 100644 --- a/api/api/indices.get_upgrade.js +++ b/api/api/indices.get_upgrade.js @@ -24,7 +24,7 @@ function buildIndicesGetUpgrade (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.get_upgrade](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-upgrade.html) request * @@ -77,9 +77,9 @@ function buildIndicesGetUpgrade (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -106,24 +106,8 @@ function buildIndicesGetUpgrade (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/indices.open.js b/api/api/indices.open.js index 490f77bbb..3e3f1740d 100644 --- a/api/api/indices.open.js +++ b/api/api/indices.open.js @@ -24,7 +24,7 @@ function buildIndicesOpen (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.open](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-open-close.html) request * @@ -89,9 +89,9 @@ function buildIndicesOpen (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -114,24 +114,8 @@ function buildIndicesOpen (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/indices.put_alias.js b/api/api/indices.put_alias.js index c0425620e..47352d607 100644 --- a/api/api/indices.put_alias.js +++ b/api/api/indices.put_alias.js @@ -24,7 +24,7 @@ function buildIndicesPutAlias (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.put_alias](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html) request * @@ -85,9 +85,9 @@ function buildIndicesPutAlias (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, name } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'name']) + var warnings = [] + var { method, body, index, name, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' @@ -114,24 +114,8 @@ function buildIndicesPutAlias (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/indices.put_mapping.js b/api/api/indices.put_mapping.js index 993c41187..4743a34a4 100644 --- a/api/api/indices.put_mapping.js +++ b/api/api/indices.put_mapping.js @@ -24,7 +24,7 @@ function buildIndicesPutMapping (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.put_mapping](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-put-mapping.html) request * @@ -87,9 +87,9 @@ function buildIndicesPutMapping (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'type']) + var warnings = [] + var { method, body, index, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' @@ -128,24 +128,8 @@ function buildIndicesPutMapping (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/indices.put_settings.js b/api/api/indices.put_settings.js index 253639c8e..01a82b782 100644 --- a/api/api/indices.put_settings.js +++ b/api/api/indices.put_settings.js @@ -24,7 +24,7 @@ function buildIndicesPutSettings (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.put_settings](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-update-settings.html) request * @@ -89,9 +89,9 @@ function buildIndicesPutSettings (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' @@ -118,24 +118,8 @@ function buildIndicesPutSettings (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/indices.put_template.js b/api/api/indices.put_template.js index 900d01db4..e55d4a565 100644 --- a/api/api/indices.put_template.js +++ b/api/api/indices.put_template.js @@ -24,7 +24,7 @@ function buildIndicesPutTemplate (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.put_template](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html) request * @@ -88,9 +88,9 @@ function buildIndicesPutTemplate (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, name } = params - var querystring = semicopy(params, ['method', 'body', 'name']) + var warnings = [] + var { method, body, name, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' @@ -113,24 +113,8 @@ function buildIndicesPutTemplate (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/indices.recovery.js b/api/api/indices.recovery.js index 9381169a0..7da92f059 100644 --- a/api/api/indices.recovery.js +++ b/api/api/indices.recovery.js @@ -24,7 +24,7 @@ function buildIndicesRecovery (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.recovery](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-recovery.html) request * @@ -73,9 +73,9 @@ function buildIndicesRecovery (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -102,24 +102,8 @@ function buildIndicesRecovery (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/indices.refresh.js b/api/api/indices.refresh.js index 32b00c045..63a490367 100644 --- a/api/api/indices.refresh.js +++ b/api/api/indices.refresh.js @@ -24,7 +24,7 @@ function buildIndicesRefresh (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.refresh](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-refresh.html) request * @@ -77,9 +77,9 @@ function buildIndicesRefresh (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' @@ -106,24 +106,8 @@ function buildIndicesRefresh (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/indices.rollover.js b/api/api/indices.rollover.js index 478e1e705..2f7a95336 100644 --- a/api/api/indices.rollover.js +++ b/api/api/indices.rollover.js @@ -24,7 +24,7 @@ function buildIndicesRollover (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.rollover](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-rollover-index.html) request * @@ -90,9 +90,9 @@ function buildIndicesRollover (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, alias, newIndex, new_index } = params - var querystring = semicopy(params, ['method', 'body', 'alias', 'newIndex', 'new_index']) + var warnings = [] + var { method, body, alias, newIndex, new_index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -119,24 +119,8 @@ function buildIndicesRollover (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/indices.segments.js b/api/api/indices.segments.js index da9057a5b..41e2a6b1b 100644 --- a/api/api/indices.segments.js +++ b/api/api/indices.segments.js @@ -24,7 +24,7 @@ function buildIndicesSegments (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.segments](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-segments.html) request * @@ -79,9 +79,9 @@ function buildIndicesSegments (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -108,24 +108,8 @@ function buildIndicesSegments (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/indices.shard_stores.js b/api/api/indices.shard_stores.js index 7ea445462..923c22f93 100644 --- a/api/api/indices.shard_stores.js +++ b/api/api/indices.shard_stores.js @@ -24,7 +24,7 @@ function buildIndicesShardStores (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.shard_stores](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-shards-stores.html) request * @@ -79,9 +79,9 @@ function buildIndicesShardStores (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -108,24 +108,8 @@ function buildIndicesShardStores (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/indices.shrink.js b/api/api/indices.shrink.js index a21cd7d02..6cc2f7602 100644 --- a/api/api/indices.shrink.js +++ b/api/api/indices.shrink.js @@ -24,7 +24,7 @@ function buildIndicesShrink (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.shrink](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-shrink-index.html) request * @@ -88,9 +88,9 @@ function buildIndicesShrink (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, target } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'target']) + var warnings = [] + var { method, body, index, target, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' @@ -113,24 +113,8 @@ function buildIndicesShrink (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/indices.split.js b/api/api/indices.split.js index 8da6845ae..8070e96d6 100644 --- a/api/api/indices.split.js +++ b/api/api/indices.split.js @@ -24,7 +24,7 @@ function buildIndicesSplit (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.split](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-split-index.html) request * @@ -88,9 +88,9 @@ function buildIndicesSplit (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, target } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'target']) + var warnings = [] + var { method, body, index, target, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' @@ -113,24 +113,8 @@ function buildIndicesSplit (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/indices.stats.js b/api/api/indices.stats.js index da3aa176e..764a2f46f 100644 --- a/api/api/indices.stats.js +++ b/api/api/indices.stats.js @@ -24,7 +24,7 @@ function buildIndicesStats (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.stats](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-stats.html) request * @@ -95,9 +95,9 @@ function buildIndicesStats (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, metric } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'metric']) + var warnings = [] + var { method, body, index, metric, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -128,24 +128,8 @@ function buildIndicesStats (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/indices.unfreeze.js b/api/api/indices.unfreeze.js index 64a82c1e0..6eefcdf80 100644 --- a/api/api/indices.unfreeze.js +++ b/api/api/indices.unfreeze.js @@ -24,7 +24,7 @@ function buildIndicesUnfreeze (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.unfreeze](https://www.elastic.co/guide/en/elasticsearch/reference/current/frozen.html) request * @@ -82,9 +82,9 @@ function buildIndicesUnfreeze (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -107,24 +107,8 @@ function buildIndicesUnfreeze (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/indices.update_aliases.js b/api/api/indices.update_aliases.js index e188b5dcc..468aaffe4 100644 --- a/api/api/indices.update_aliases.js +++ b/api/api/indices.update_aliases.js @@ -24,7 +24,7 @@ function buildIndicesUpdateAliases (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.update_aliases](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html) request * @@ -73,9 +73,9 @@ function buildIndicesUpdateAliases (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -98,24 +98,8 @@ function buildIndicesUpdateAliases (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/indices.upgrade.js b/api/api/indices.upgrade.js index afbe9bc12..392424957 100644 --- a/api/api/indices.upgrade.js +++ b/api/api/indices.upgrade.js @@ -24,7 +24,7 @@ function buildIndicesUpgrade (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.upgrade](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-upgrade.html) request * @@ -83,9 +83,9 @@ function buildIndicesUpgrade (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -112,24 +112,8 @@ function buildIndicesUpgrade (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/indices.validate_query.js b/api/api/indices.validate_query.js index 2b35d18fa..642726ade 100644 --- a/api/api/indices.validate_query.js +++ b/api/api/indices.validate_query.js @@ -24,7 +24,7 @@ function buildIndicesValidateQuery (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [indices.validate_query](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-validate.html) request * @@ -100,9 +100,9 @@ function buildIndicesValidateQuery (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'type']) + var warnings = [] + var { method, body, index, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' @@ -131,24 +131,8 @@ function buildIndicesValidateQuery (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/info.js b/api/api/info.js index 7ca83b4b6..d62bf1455 100644 --- a/api/api/info.js +++ b/api/api/info.js @@ -24,7 +24,7 @@ function buildInfo (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [info](http://www.elastic.co/guide/) request * @@ -67,9 +67,9 @@ function buildInfo (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -92,24 +92,8 @@ function buildInfo (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ingest.delete_pipeline.js b/api/api/ingest.delete_pipeline.js index 6bb05e2d0..12b51f75c 100644 --- a/api/api/ingest.delete_pipeline.js +++ b/api/api/ingest.delete_pipeline.js @@ -24,7 +24,7 @@ function buildIngestDeletePipeline (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ingest.delete_pipeline](https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-pipeline-api.html) request * @@ -77,9 +77,9 @@ function buildIngestDeletePipeline (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id } = params - var querystring = semicopy(params, ['method', 'body', 'id']) + var warnings = [] + var { method, body, id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' @@ -102,24 +102,8 @@ function buildIngestDeletePipeline (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ingest.get_pipeline.js b/api/api/ingest.get_pipeline.js index 689b69e2d..bc03b7fa8 100644 --- a/api/api/ingest.get_pipeline.js +++ b/api/api/ingest.get_pipeline.js @@ -24,7 +24,7 @@ function buildIngestGetPipeline (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ingest.get_pipeline](https://www.elastic.co/guide/en/elasticsearch/reference/master/get-pipeline-api.html) request * @@ -71,9 +71,9 @@ function buildIngestGetPipeline (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id } = params - var querystring = semicopy(params, ['method', 'body', 'id']) + var warnings = [] + var { method, body, id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -100,24 +100,8 @@ function buildIngestGetPipeline (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ingest.processor_grok.js b/api/api/ingest.processor_grok.js index 20dbeab4e..9e3f61e09 100644 --- a/api/api/ingest.processor_grok.js +++ b/api/api/ingest.processor_grok.js @@ -24,7 +24,7 @@ function buildIngestProcessorGrok (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ingest.processor_grok](https://www.elastic.co/guide/en/elasticsearch/reference/master/grok-processor.html#grok-processor-rest-get) request * @@ -67,9 +67,9 @@ function buildIngestProcessorGrok (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -92,24 +92,8 @@ function buildIngestProcessorGrok (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ingest.put_pipeline.js b/api/api/ingest.put_pipeline.js index 5052f5183..bfed81790 100644 --- a/api/api/ingest.put_pipeline.js +++ b/api/api/ingest.put_pipeline.js @@ -24,7 +24,7 @@ function buildIngestPutPipeline (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ingest.put_pipeline](https://www.elastic.co/guide/en/elasticsearch/reference/master/put-pipeline-api.html) request * @@ -78,9 +78,9 @@ function buildIngestPutPipeline (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id } = params - var querystring = semicopy(params, ['method', 'body', 'id']) + var warnings = [] + var { method, body, id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' @@ -103,24 +103,8 @@ function buildIngestPutPipeline (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ingest.simulate.js b/api/api/ingest.simulate.js index 45ead8b28..b13992a66 100644 --- a/api/api/ingest.simulate.js +++ b/api/api/ingest.simulate.js @@ -24,7 +24,7 @@ function buildIngestSimulate (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ingest.simulate](https://www.elastic.co/guide/en/elasticsearch/reference/master/simulate-pipeline-api.html) request * @@ -71,9 +71,9 @@ function buildIngestSimulate (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id } = params - var querystring = semicopy(params, ['method', 'body', 'id']) + var warnings = [] + var { method, body, id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' @@ -100,24 +100,8 @@ function buildIngestSimulate (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/license.delete.js b/api/api/license.delete.js index 40dd03cbf..05060956f 100644 --- a/api/api/license.delete.js +++ b/api/api/license.delete.js @@ -24,7 +24,7 @@ function buildLicenseDelete (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [license.delete](https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-license.html) request * @@ -62,9 +62,9 @@ function buildLicenseDelete (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' @@ -87,24 +87,8 @@ function buildLicenseDelete (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/license.get.js b/api/api/license.get.js index 68ae632c7..31b7cd870 100644 --- a/api/api/license.get.js +++ b/api/api/license.get.js @@ -24,7 +24,7 @@ function buildLicenseGet (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [license.get](https://www.elastic.co/guide/en/elasticsearch/reference/master/get-license.html) request * @@ -63,9 +63,9 @@ function buildLicenseGet (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -88,24 +88,8 @@ function buildLicenseGet (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/license.get_basic_status.js b/api/api/license.get_basic_status.js index b01252467..a552e215a 100644 --- a/api/api/license.get_basic_status.js +++ b/api/api/license.get_basic_status.js @@ -24,7 +24,7 @@ function buildLicenseGetBasicStatus (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [license.get_basic_status](https://www.elastic.co/guide/en/elasticsearch/reference/master/get-basic-status.html) request * @@ -62,9 +62,9 @@ function buildLicenseGetBasicStatus (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -87,24 +87,8 @@ function buildLicenseGetBasicStatus (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/license.get_trial_status.js b/api/api/license.get_trial_status.js index 0f5b71b99..66e88862d 100644 --- a/api/api/license.get_trial_status.js +++ b/api/api/license.get_trial_status.js @@ -24,7 +24,7 @@ function buildLicenseGetTrialStatus (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [license.get_trial_status](https://www.elastic.co/guide/en/elasticsearch/reference/master/get-trial-status.html) request * @@ -62,9 +62,9 @@ function buildLicenseGetTrialStatus (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -87,24 +87,8 @@ function buildLicenseGetTrialStatus (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/license.post.js b/api/api/license.post.js index f1dd591fa..d318687f5 100644 --- a/api/api/license.post.js +++ b/api/api/license.post.js @@ -24,7 +24,7 @@ function buildLicensePost (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [license.post](https://www.elastic.co/guide/en/elasticsearch/reference/master/update-license.html) request * @@ -58,9 +58,9 @@ function buildLicensePost (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' @@ -83,24 +83,8 @@ function buildLicensePost (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/license.post_start_basic.js b/api/api/license.post_start_basic.js index 2ec9729a2..c3bcda3da 100644 --- a/api/api/license.post_start_basic.js +++ b/api/api/license.post_start_basic.js @@ -24,7 +24,7 @@ function buildLicensePostStartBasic (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [license.post_start_basic](https://www.elastic.co/guide/en/elasticsearch/reference/master/start-basic.html) request * @@ -63,9 +63,9 @@ function buildLicensePostStartBasic (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -88,24 +88,8 @@ function buildLicensePostStartBasic (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/license.post_start_trial.js b/api/api/license.post_start_trial.js index bdfad8063..0e24eea1c 100644 --- a/api/api/license.post_start_trial.js +++ b/api/api/license.post_start_trial.js @@ -24,7 +24,7 @@ function buildLicensePostStartTrial (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [license.post_start_trial](https://www.elastic.co/guide/en/elasticsearch/reference/master/start-trial.html) request * @@ -65,9 +65,9 @@ function buildLicensePostStartTrial (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -90,24 +90,8 @@ function buildLicensePostStartTrial (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/mget.js b/api/api/mget.js index 25461f3bc..cd1faaa3e 100644 --- a/api/api/mget.js +++ b/api/api/mget.js @@ -24,7 +24,7 @@ function buildMget (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [mget](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-multi-get.html) request * @@ -95,9 +95,9 @@ function buildMget (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'type']) + var warnings = [] + var { method, body, index, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' @@ -126,24 +126,8 @@ function buildMget (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/migration.deprecations.js b/api/api/migration.deprecations.js index 27b81211e..0c8696576 100644 --- a/api/api/migration.deprecations.js +++ b/api/api/migration.deprecations.js @@ -24,7 +24,7 @@ function buildMigrationDeprecations (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [migration.deprecations](http://www.elastic.co/guide/en/elasticsearch/reference/current/migration-api-deprecation.html) request * @@ -63,9 +63,9 @@ function buildMigrationDeprecations (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -92,24 +92,8 @@ function buildMigrationDeprecations (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ml.close_job.js b/api/api/ml.close_job.js index 47f043da3..2aa6b8d23 100644 --- a/api/api/ml.close_job.js +++ b/api/api/ml.close_job.js @@ -24,7 +24,7 @@ function buildMlCloseJob (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.close_job](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-close-job.html) request * @@ -70,9 +70,9 @@ function buildMlCloseJob (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, jobId, job_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id']) + var warnings = [] + var { method, body, jobId, job_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -95,24 +95,8 @@ function buildMlCloseJob (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ml.delete_calendar.js b/api/api/ml.delete_calendar.js index e487edc1b..06de541a2 100644 --- a/api/api/ml.delete_calendar.js +++ b/api/api/ml.delete_calendar.js @@ -24,7 +24,7 @@ function buildMlDeleteCalendar (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.delete_calendar](undefined) request * @@ -67,9 +67,9 @@ function buildMlDeleteCalendar (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, calendarId, calendar_id } = params - var querystring = semicopy(params, ['method', 'body', 'calendarId', 'calendar_id']) + var warnings = [] + var { method, body, calendarId, calendar_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' @@ -92,24 +92,8 @@ function buildMlDeleteCalendar (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ml.delete_calendar_event.js b/api/api/ml.delete_calendar_event.js index a8cec2b95..1b44f246f 100644 --- a/api/api/ml.delete_calendar_event.js +++ b/api/api/ml.delete_calendar_event.js @@ -24,7 +24,7 @@ function buildMlDeleteCalendarEvent (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.delete_calendar_event](undefined) request * @@ -78,9 +78,9 @@ function buildMlDeleteCalendarEvent (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, calendarId, calendar_id, eventId, event_id } = params - var querystring = semicopy(params, ['method', 'body', 'calendarId', 'calendar_id', 'eventId', 'event_id']) + var warnings = [] + var { method, body, calendarId, calendar_id, eventId, event_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' @@ -103,24 +103,8 @@ function buildMlDeleteCalendarEvent (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ml.delete_calendar_job.js b/api/api/ml.delete_calendar_job.js index ae815a30b..5e361f407 100644 --- a/api/api/ml.delete_calendar_job.js +++ b/api/api/ml.delete_calendar_job.js @@ -24,7 +24,7 @@ function buildMlDeleteCalendarJob (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.delete_calendar_job](undefined) request * @@ -78,9 +78,9 @@ function buildMlDeleteCalendarJob (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, calendarId, calendar_id, jobId, job_id } = params - var querystring = semicopy(params, ['method', 'body', 'calendarId', 'calendar_id', 'jobId', 'job_id']) + var warnings = [] + var { method, body, calendarId, calendar_id, jobId, job_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' @@ -103,24 +103,8 @@ function buildMlDeleteCalendarJob (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ml.delete_datafeed.js b/api/api/ml.delete_datafeed.js index 7f00ca779..8efcdd073 100644 --- a/api/api/ml.delete_datafeed.js +++ b/api/api/ml.delete_datafeed.js @@ -24,7 +24,7 @@ function buildMlDeleteDatafeed (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.delete_datafeed](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-datafeed.html) request * @@ -68,9 +68,9 @@ function buildMlDeleteDatafeed (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, datafeedId, datafeed_id } = params - var querystring = semicopy(params, ['method', 'body', 'datafeedId', 'datafeed_id']) + var warnings = [] + var { method, body, datafeedId, datafeed_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' @@ -93,24 +93,8 @@ function buildMlDeleteDatafeed (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ml.delete_expired_data.js b/api/api/ml.delete_expired_data.js index 556932b62..8c0c5e5e5 100644 --- a/api/api/ml.delete_expired_data.js +++ b/api/api/ml.delete_expired_data.js @@ -24,7 +24,7 @@ function buildMlDeleteExpiredData (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.delete_expired_data](undefined) request * @@ -62,9 +62,9 @@ function buildMlDeleteExpiredData (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' @@ -87,24 +87,8 @@ function buildMlDeleteExpiredData (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ml.delete_filter.js b/api/api/ml.delete_filter.js index e2debed9d..e092b9b30 100644 --- a/api/api/ml.delete_filter.js +++ b/api/api/ml.delete_filter.js @@ -24,7 +24,7 @@ function buildMlDeleteFilter (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.delete_filter](undefined) request * @@ -67,9 +67,9 @@ function buildMlDeleteFilter (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, filterId, filter_id } = params - var querystring = semicopy(params, ['method', 'body', 'filterId', 'filter_id']) + var warnings = [] + var { method, body, filterId, filter_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' @@ -92,24 +92,8 @@ function buildMlDeleteFilter (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ml.delete_forecast.js b/api/api/ml.delete_forecast.js index 1249cb405..56db9627b 100644 --- a/api/api/ml.delete_forecast.js +++ b/api/api/ml.delete_forecast.js @@ -24,7 +24,7 @@ function buildMlDeleteForecast (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.delete_forecast](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-forecast.html) request * @@ -78,9 +78,9 @@ function buildMlDeleteForecast (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, jobId, job_id, forecastId, forecast_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id', 'forecastId', 'forecast_id']) + var warnings = [] + var { method, body, jobId, job_id, forecastId, forecast_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' @@ -107,24 +107,8 @@ function buildMlDeleteForecast (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ml.delete_job.js b/api/api/ml.delete_job.js index 4cc6659f5..d836b820a 100644 --- a/api/api/ml.delete_job.js +++ b/api/api/ml.delete_job.js @@ -24,7 +24,7 @@ function buildMlDeleteJob (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.delete_job](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-job.html) request * @@ -70,9 +70,9 @@ function buildMlDeleteJob (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, jobId, job_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id']) + var warnings = [] + var { method, body, jobId, job_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' @@ -95,24 +95,8 @@ function buildMlDeleteJob (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ml.delete_model_snapshot.js b/api/api/ml.delete_model_snapshot.js index f09526fa6..63f2888aa 100644 --- a/api/api/ml.delete_model_snapshot.js +++ b/api/api/ml.delete_model_snapshot.js @@ -24,7 +24,7 @@ function buildMlDeleteModelSnapshot (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.delete_model_snapshot](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-snapshot.html) request * @@ -78,9 +78,9 @@ function buildMlDeleteModelSnapshot (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, jobId, job_id, snapshotId, snapshot_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id', 'snapshotId', 'snapshot_id']) + var warnings = [] + var { method, body, jobId, job_id, snapshotId, snapshot_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' @@ -103,24 +103,8 @@ function buildMlDeleteModelSnapshot (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ml.find_file_structure.js b/api/api/ml.find_file_structure.js index 52ef73a83..ce7419b6b 100644 --- a/api/api/ml.find_file_structure.js +++ b/api/api/ml.find_file_structure.js @@ -24,7 +24,7 @@ function buildMlFindFileStructure (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.find_file_structure](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-find-file-structure.html) request * @@ -95,9 +95,9 @@ function buildMlFindFileStructure (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -120,24 +120,8 @@ function buildMlFindFileStructure (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ml.flush_job.js b/api/api/ml.flush_job.js index 52fc28526..262ddea60 100644 --- a/api/api/ml.flush_job.js +++ b/api/api/ml.flush_job.js @@ -24,7 +24,7 @@ function buildMlFlushJob (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.flush_job](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-flush-job.html) request * @@ -75,9 +75,9 @@ function buildMlFlushJob (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, jobId, job_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id']) + var warnings = [] + var { method, body, jobId, job_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -100,24 +100,8 @@ function buildMlFlushJob (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ml.forecast.js b/api/api/ml.forecast.js index db7c3d635..05c2d3f25 100644 --- a/api/api/ml.forecast.js +++ b/api/api/ml.forecast.js @@ -24,7 +24,7 @@ function buildMlForecast (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.forecast](undefined) request * @@ -70,9 +70,9 @@ function buildMlForecast (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, jobId, job_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id']) + var warnings = [] + var { method, body, jobId, job_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -95,24 +95,8 @@ function buildMlForecast (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ml.get_buckets.js b/api/api/ml.get_buckets.js index 5cf5a1f96..5c36a4bf7 100644 --- a/api/api/ml.get_buckets.js +++ b/api/api/ml.get_buckets.js @@ -24,7 +24,7 @@ function buildMlGetBuckets (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.get_buckets](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-bucket.html) request * @@ -90,9 +90,9 @@ function buildMlGetBuckets (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, jobId, job_id, timestamp } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id', 'timestamp']) + var warnings = [] + var { method, body, jobId, job_id, timestamp, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' @@ -119,24 +119,8 @@ function buildMlGetBuckets (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ml.get_calendar_events.js b/api/api/ml.get_calendar_events.js index f48094d84..ac3a7ed2c 100644 --- a/api/api/ml.get_calendar_events.js +++ b/api/api/ml.get_calendar_events.js @@ -24,7 +24,7 @@ function buildMlGetCalendarEvents (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.get_calendar_events](undefined) request * @@ -77,9 +77,9 @@ function buildMlGetCalendarEvents (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, calendarId, calendar_id } = params - var querystring = semicopy(params, ['method', 'body', 'calendarId', 'calendar_id']) + var warnings = [] + var { method, body, calendarId, calendar_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -102,24 +102,8 @@ function buildMlGetCalendarEvents (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ml.get_calendars.js b/api/api/ml.get_calendars.js index 226714b0f..edacda0cb 100644 --- a/api/api/ml.get_calendars.js +++ b/api/api/ml.get_calendars.js @@ -24,7 +24,7 @@ function buildMlGetCalendars (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.get_calendars](undefined) request * @@ -61,9 +61,9 @@ function buildMlGetCalendars (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, calendarId, calendar_id } = params - var querystring = semicopy(params, ['method', 'body', 'calendarId', 'calendar_id']) + var warnings = [] + var { method, body, calendarId, calendar_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' @@ -90,24 +90,8 @@ function buildMlGetCalendars (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ml.get_categories.js b/api/api/ml.get_categories.js index 8347af697..dc263c8b1 100644 --- a/api/api/ml.get_categories.js +++ b/api/api/ml.get_categories.js @@ -24,7 +24,7 @@ function buildMlGetCategories (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.get_categories](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-category.html) request * @@ -68,9 +68,9 @@ function buildMlGetCategories (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, jobId, job_id, categoryId, category_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id', 'categoryId', 'category_id']) + var warnings = [] + var { method, body, jobId, job_id, categoryId, category_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' @@ -97,24 +97,8 @@ function buildMlGetCategories (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ml.get_datafeed_stats.js b/api/api/ml.get_datafeed_stats.js index 575462a65..c32e9d76a 100644 --- a/api/api/ml.get_datafeed_stats.js +++ b/api/api/ml.get_datafeed_stats.js @@ -24,7 +24,7 @@ function buildMlGetDatafeedStats (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.get_datafeed_stats](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed-stats.html) request * @@ -64,9 +64,9 @@ function buildMlGetDatafeedStats (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, datafeedId, datafeed_id } = params - var querystring = semicopy(params, ['method', 'body', 'datafeedId', 'datafeed_id']) + var warnings = [] + var { method, body, datafeedId, datafeed_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -93,24 +93,8 @@ function buildMlGetDatafeedStats (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ml.get_datafeeds.js b/api/api/ml.get_datafeeds.js index 5f4eec4be..01f9f4653 100644 --- a/api/api/ml.get_datafeeds.js +++ b/api/api/ml.get_datafeeds.js @@ -24,7 +24,7 @@ function buildMlGetDatafeeds (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.get_datafeeds](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed.html) request * @@ -64,9 +64,9 @@ function buildMlGetDatafeeds (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, datafeedId, datafeed_id } = params - var querystring = semicopy(params, ['method', 'body', 'datafeedId', 'datafeed_id']) + var warnings = [] + var { method, body, datafeedId, datafeed_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -93,24 +93,8 @@ function buildMlGetDatafeeds (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ml.get_filters.js b/api/api/ml.get_filters.js index c52180e9e..93e70583e 100644 --- a/api/api/ml.get_filters.js +++ b/api/api/ml.get_filters.js @@ -24,7 +24,7 @@ function buildMlGetFilters (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.get_filters](undefined) request * @@ -66,9 +66,9 @@ function buildMlGetFilters (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, filterId, filter_id } = params - var querystring = semicopy(params, ['method', 'body', 'filterId', 'filter_id']) + var warnings = [] + var { method, body, filterId, filter_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -95,24 +95,8 @@ function buildMlGetFilters (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ml.get_influencers.js b/api/api/ml.get_influencers.js index 3fc63b195..09d7c4dfb 100644 --- a/api/api/ml.get_influencers.js +++ b/api/api/ml.get_influencers.js @@ -24,7 +24,7 @@ function buildMlGetInfluencers (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.get_influencers](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-influencer.html) request * @@ -81,9 +81,9 @@ function buildMlGetInfluencers (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, jobId, job_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id']) + var warnings = [] + var { method, body, jobId, job_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' @@ -106,24 +106,8 @@ function buildMlGetInfluencers (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ml.get_job_stats.js b/api/api/ml.get_job_stats.js index e8eeb5ec2..bd9f72eb5 100644 --- a/api/api/ml.get_job_stats.js +++ b/api/api/ml.get_job_stats.js @@ -24,7 +24,7 @@ function buildMlGetJobStats (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.get_job_stats](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job-stats.html) request * @@ -64,9 +64,9 @@ function buildMlGetJobStats (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, jobId, job_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id']) + var warnings = [] + var { method, body, jobId, job_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -93,24 +93,8 @@ function buildMlGetJobStats (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ml.get_jobs.js b/api/api/ml.get_jobs.js index 535aba85d..3dbf536ef 100644 --- a/api/api/ml.get_jobs.js +++ b/api/api/ml.get_jobs.js @@ -24,7 +24,7 @@ function buildMlGetJobs (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.get_jobs](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job.html) request * @@ -64,9 +64,9 @@ function buildMlGetJobs (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, jobId, job_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id']) + var warnings = [] + var { method, body, jobId, job_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -93,24 +93,8 @@ function buildMlGetJobs (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ml.get_model_snapshots.js b/api/api/ml.get_model_snapshots.js index 690bae93e..a89562d29 100644 --- a/api/api/ml.get_model_snapshots.js +++ b/api/api/ml.get_model_snapshots.js @@ -24,7 +24,7 @@ function buildMlGetModelSnapshots (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.get_model_snapshots](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-snapshot.html) request * @@ -82,9 +82,9 @@ function buildMlGetModelSnapshots (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, jobId, job_id, snapshotId, snapshot_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id', 'snapshotId', 'snapshot_id']) + var warnings = [] + var { method, body, jobId, job_id, snapshotId, snapshot_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' @@ -111,24 +111,8 @@ function buildMlGetModelSnapshots (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ml.get_overall_buckets.js b/api/api/ml.get_overall_buckets.js index 5a3327f7e..becd01c56 100644 --- a/api/api/ml.get_overall_buckets.js +++ b/api/api/ml.get_overall_buckets.js @@ -24,7 +24,7 @@ function buildMlGetOverallBuckets (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.get_overall_buckets](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-overall-buckets.html) request * @@ -81,9 +81,9 @@ function buildMlGetOverallBuckets (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, jobId, job_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id']) + var warnings = [] + var { method, body, jobId, job_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' @@ -106,24 +106,8 @@ function buildMlGetOverallBuckets (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ml.get_records.js b/api/api/ml.get_records.js index 1cc6a51d5..966c0d591 100644 --- a/api/api/ml.get_records.js +++ b/api/api/ml.get_records.js @@ -24,7 +24,7 @@ function buildMlGetRecords (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.get_records](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-record.html) request * @@ -81,9 +81,9 @@ function buildMlGetRecords (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, jobId, job_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id']) + var warnings = [] + var { method, body, jobId, job_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' @@ -106,24 +106,8 @@ function buildMlGetRecords (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ml.info.js b/api/api/ml.info.js index ec14d25ea..8e2cf5c70 100644 --- a/api/api/ml.info.js +++ b/api/api/ml.info.js @@ -24,7 +24,7 @@ function buildMlInfo (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.info](undefined) request * @@ -56,9 +56,9 @@ function buildMlInfo (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -81,24 +81,8 @@ function buildMlInfo (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ml.open_job.js b/api/api/ml.open_job.js index 4117c0be5..05610b894 100644 --- a/api/api/ml.open_job.js +++ b/api/api/ml.open_job.js @@ -24,7 +24,7 @@ function buildMlOpenJob (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.open_job](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-open-job.html) request * @@ -69,9 +69,9 @@ function buildMlOpenJob (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, jobId, job_id, ignoreDowntime, ignore_downtime, timeout } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id', 'ignoreDowntime', 'ignore_downtime', 'timeout']) + var warnings = [] + var { method, body, jobId, job_id, ignoreDowntime, ignore_downtime, timeout, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -94,24 +94,8 @@ function buildMlOpenJob (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ml.post_calendar_events.js b/api/api/ml.post_calendar_events.js index 058cb1a19..0f7c9f435 100644 --- a/api/api/ml.post_calendar_events.js +++ b/api/api/ml.post_calendar_events.js @@ -24,7 +24,7 @@ function buildMlPostCalendarEvents (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.post_calendar_events](undefined) request * @@ -68,9 +68,9 @@ function buildMlPostCalendarEvents (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, calendarId, calendar_id } = params - var querystring = semicopy(params, ['method', 'body', 'calendarId', 'calendar_id']) + var warnings = [] + var { method, body, calendarId, calendar_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -93,24 +93,8 @@ function buildMlPostCalendarEvents (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ml.post_data.js b/api/api/ml.post_data.js index eda48daad..6c1105a81 100644 --- a/api/api/ml.post_data.js +++ b/api/api/ml.post_data.js @@ -24,7 +24,7 @@ function buildMlPostData (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.post_data](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-post-data.html) request * @@ -72,9 +72,9 @@ function buildMlPostData (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, jobId, job_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id']) + var warnings = [] + var { method, body, jobId, job_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -97,24 +97,8 @@ function buildMlPostData (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ml.preview_datafeed.js b/api/api/ml.preview_datafeed.js index 650823588..2814ffdf5 100644 --- a/api/api/ml.preview_datafeed.js +++ b/api/api/ml.preview_datafeed.js @@ -24,7 +24,7 @@ function buildMlPreviewDatafeed (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.preview_datafeed](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-preview-datafeed.html) request * @@ -67,9 +67,9 @@ function buildMlPreviewDatafeed (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, datafeedId, datafeed_id } = params - var querystring = semicopy(params, ['method', 'body', 'datafeedId', 'datafeed_id']) + var warnings = [] + var { method, body, datafeedId, datafeed_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -92,24 +92,8 @@ function buildMlPreviewDatafeed (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ml.put_calendar.js b/api/api/ml.put_calendar.js index bf5dd5ecd..39621616d 100644 --- a/api/api/ml.put_calendar.js +++ b/api/api/ml.put_calendar.js @@ -24,7 +24,7 @@ function buildMlPutCalendar (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.put_calendar](undefined) request * @@ -64,9 +64,9 @@ function buildMlPutCalendar (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, calendarId, calendar_id } = params - var querystring = semicopy(params, ['method', 'body', 'calendarId', 'calendar_id']) + var warnings = [] + var { method, body, calendarId, calendar_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' @@ -89,24 +89,8 @@ function buildMlPutCalendar (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ml.put_calendar_job.js b/api/api/ml.put_calendar_job.js index 59a215d4c..f8db0b6c5 100644 --- a/api/api/ml.put_calendar_job.js +++ b/api/api/ml.put_calendar_job.js @@ -24,7 +24,7 @@ function buildMlPutCalendarJob (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.put_calendar_job](undefined) request * @@ -78,9 +78,9 @@ function buildMlPutCalendarJob (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, calendarId, calendar_id, jobId, job_id } = params - var querystring = semicopy(params, ['method', 'body', 'calendarId', 'calendar_id', 'jobId', 'job_id']) + var warnings = [] + var { method, body, calendarId, calendar_id, jobId, job_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' @@ -103,24 +103,8 @@ function buildMlPutCalendarJob (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ml.put_datafeed.js b/api/api/ml.put_datafeed.js index 8f9db71a3..4c796b653 100644 --- a/api/api/ml.put_datafeed.js +++ b/api/api/ml.put_datafeed.js @@ -24,7 +24,7 @@ function buildMlPutDatafeed (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.put_datafeed](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-datafeed.html) request * @@ -68,9 +68,9 @@ function buildMlPutDatafeed (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, datafeedId, datafeed_id } = params - var querystring = semicopy(params, ['method', 'body', 'datafeedId', 'datafeed_id']) + var warnings = [] + var { method, body, datafeedId, datafeed_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' @@ -93,24 +93,8 @@ function buildMlPutDatafeed (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ml.put_filter.js b/api/api/ml.put_filter.js index d77a919f3..3040f3261 100644 --- a/api/api/ml.put_filter.js +++ b/api/api/ml.put_filter.js @@ -24,7 +24,7 @@ function buildMlPutFilter (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.put_filter](undefined) request * @@ -68,9 +68,9 @@ function buildMlPutFilter (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, filterId, filter_id } = params - var querystring = semicopy(params, ['method', 'body', 'filterId', 'filter_id']) + var warnings = [] + var { method, body, filterId, filter_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' @@ -93,24 +93,8 @@ function buildMlPutFilter (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ml.put_job.js b/api/api/ml.put_job.js index ce4b06427..55f441d3b 100644 --- a/api/api/ml.put_job.js +++ b/api/api/ml.put_job.js @@ -24,7 +24,7 @@ function buildMlPutJob (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.put_job](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-job.html) request * @@ -68,9 +68,9 @@ function buildMlPutJob (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, jobId, job_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id']) + var warnings = [] + var { method, body, jobId, job_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' @@ -93,24 +93,8 @@ function buildMlPutJob (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ml.revert_model_snapshot.js b/api/api/ml.revert_model_snapshot.js index 7fe97b15c..20a858212 100644 --- a/api/api/ml.revert_model_snapshot.js +++ b/api/api/ml.revert_model_snapshot.js @@ -24,7 +24,7 @@ function buildMlRevertModelSnapshot (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.revert_model_snapshot](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-revert-snapshot.html) request * @@ -76,9 +76,9 @@ function buildMlRevertModelSnapshot (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, jobId, job_id, snapshotId, snapshot_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id', 'snapshotId', 'snapshot_id']) + var warnings = [] + var { method, body, jobId, job_id, snapshotId, snapshot_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -101,24 +101,8 @@ function buildMlRevertModelSnapshot (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ml.set_upgrade_mode.js b/api/api/ml.set_upgrade_mode.js index bb6783596..1e098d7b8 100644 --- a/api/api/ml.set_upgrade_mode.js +++ b/api/api/ml.set_upgrade_mode.js @@ -24,7 +24,7 @@ function buildMlSetUpgradeMode (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.set_upgrade_mode](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-set-upgrade-mode.html) request * @@ -65,9 +65,9 @@ function buildMlSetUpgradeMode (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -90,24 +90,8 @@ function buildMlSetUpgradeMode (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ml.start_datafeed.js b/api/api/ml.start_datafeed.js index dd31b69d7..773f47ae1 100644 --- a/api/api/ml.start_datafeed.js +++ b/api/api/ml.start_datafeed.js @@ -24,7 +24,7 @@ function buildMlStartDatafeed (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.start_datafeed](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-start-datafeed.html) request * @@ -69,9 +69,9 @@ function buildMlStartDatafeed (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, datafeedId, datafeed_id } = params - var querystring = semicopy(params, ['method', 'body', 'datafeedId', 'datafeed_id']) + var warnings = [] + var { method, body, datafeedId, datafeed_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -94,24 +94,8 @@ function buildMlStartDatafeed (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ml.stop_datafeed.js b/api/api/ml.stop_datafeed.js index b1ce8e59e..3284f8fbe 100644 --- a/api/api/ml.stop_datafeed.js +++ b/api/api/ml.stop_datafeed.js @@ -24,7 +24,7 @@ function buildMlStopDatafeed (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.stop_datafeed](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-stop-datafeed.html) request * @@ -69,9 +69,9 @@ function buildMlStopDatafeed (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, datafeedId, datafeed_id } = params - var querystring = semicopy(params, ['method', 'body', 'datafeedId', 'datafeed_id']) + var warnings = [] + var { method, body, datafeedId, datafeed_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -94,24 +94,8 @@ function buildMlStopDatafeed (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ml.update_datafeed.js b/api/api/ml.update_datafeed.js index 10e416eef..33160a97c 100644 --- a/api/api/ml.update_datafeed.js +++ b/api/api/ml.update_datafeed.js @@ -24,7 +24,7 @@ function buildMlUpdateDatafeed (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.update_datafeed](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-datafeed.html) request * @@ -68,9 +68,9 @@ function buildMlUpdateDatafeed (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, datafeedId, datafeed_id } = params - var querystring = semicopy(params, ['method', 'body', 'datafeedId', 'datafeed_id']) + var warnings = [] + var { method, body, datafeedId, datafeed_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -93,24 +93,8 @@ function buildMlUpdateDatafeed (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ml.update_filter.js b/api/api/ml.update_filter.js index f2586053b..7596e282a 100644 --- a/api/api/ml.update_filter.js +++ b/api/api/ml.update_filter.js @@ -24,7 +24,7 @@ function buildMlUpdateFilter (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.update_filter](undefined) request * @@ -68,9 +68,9 @@ function buildMlUpdateFilter (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, filterId, filter_id } = params - var querystring = semicopy(params, ['method', 'body', 'filterId', 'filter_id']) + var warnings = [] + var { method, body, filterId, filter_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -93,24 +93,8 @@ function buildMlUpdateFilter (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ml.update_job.js b/api/api/ml.update_job.js index f81e31c51..df5701bd5 100644 --- a/api/api/ml.update_job.js +++ b/api/api/ml.update_job.js @@ -24,7 +24,7 @@ function buildMlUpdateJob (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.update_job](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-job.html) request * @@ -68,9 +68,9 @@ function buildMlUpdateJob (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, jobId, job_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id']) + var warnings = [] + var { method, body, jobId, job_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -93,24 +93,8 @@ function buildMlUpdateJob (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ml.update_model_snapshot.js b/api/api/ml.update_model_snapshot.js index 2d733a44c..451d16177 100644 --- a/api/api/ml.update_model_snapshot.js +++ b/api/api/ml.update_model_snapshot.js @@ -24,7 +24,7 @@ function buildMlUpdateModelSnapshot (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.update_model_snapshot](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-snapshot.html) request * @@ -79,9 +79,9 @@ function buildMlUpdateModelSnapshot (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, jobId, job_id, snapshotId, snapshot_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id', 'snapshotId', 'snapshot_id']) + var warnings = [] + var { method, body, jobId, job_id, snapshotId, snapshot_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -104,24 +104,8 @@ function buildMlUpdateModelSnapshot (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ml.validate.js b/api/api/ml.validate.js index 5274da775..e67d65f10 100644 --- a/api/api/ml.validate.js +++ b/api/api/ml.validate.js @@ -24,7 +24,7 @@ function buildMlValidate (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.validate](undefined) request * @@ -63,9 +63,9 @@ function buildMlValidate (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -88,24 +88,8 @@ function buildMlValidate (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ml.validate_detector.js b/api/api/ml.validate_detector.js index e461bd4dc..3bf4d5a53 100644 --- a/api/api/ml.validate_detector.js +++ b/api/api/ml.validate_detector.js @@ -24,7 +24,7 @@ function buildMlValidateDetector (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ml.validate_detector](undefined) request * @@ -63,9 +63,9 @@ function buildMlValidateDetector (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -88,24 +88,8 @@ function buildMlValidateDetector (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/monitoring.bulk.js b/api/api/monitoring.bulk.js index 5c2eb726f..4819e81ba 100644 --- a/api/api/monitoring.bulk.js +++ b/api/api/monitoring.bulk.js @@ -24,7 +24,7 @@ function buildMonitoringBulk (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [monitoring.bulk](https://www.elastic.co/guide/en/elasticsearch/reference/master/es-monitoring.html) request * @@ -71,9 +71,9 @@ function buildMonitoringBulk (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, type } = params - var querystring = semicopy(params, ['method', 'body', 'type']) + var warnings = [] + var { method, body, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -100,24 +100,8 @@ function buildMonitoringBulk (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/msearch.js b/api/api/msearch.js index 53e14c1e0..648a022d5 100644 --- a/api/api/msearch.js +++ b/api/api/msearch.js @@ -24,7 +24,7 @@ function buildMsearch (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [msearch](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-multi-search.html) request * @@ -97,9 +97,9 @@ function buildMsearch (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'type']) + var warnings = [] + var { method, body, index, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' @@ -128,24 +128,8 @@ function buildMsearch (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/msearch_template.js b/api/api/msearch_template.js index 2b769dac8..1ccd25d07 100644 --- a/api/api/msearch_template.js +++ b/api/api/msearch_template.js @@ -24,7 +24,7 @@ function buildMsearchTemplate (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [msearch_template](http://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html) request * @@ -91,9 +91,9 @@ function buildMsearchTemplate (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'type']) + var warnings = [] + var { method, body, index, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' @@ -122,24 +122,8 @@ function buildMsearchTemplate (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/mtermvectors.js b/api/api/mtermvectors.js index 3327704e4..e7a099142 100644 --- a/api/api/mtermvectors.js +++ b/api/api/mtermvectors.js @@ -24,7 +24,7 @@ function buildMtermvectors (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [mtermvectors](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-multi-termvectors.html) request * @@ -99,9 +99,9 @@ function buildMtermvectors (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'type']) + var warnings = [] + var { method, body, index, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' @@ -130,24 +130,8 @@ function buildMtermvectors (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/nodes.hot_threads.js b/api/api/nodes.hot_threads.js index 3fc015601..1fca9889e 100644 --- a/api/api/nodes.hot_threads.js +++ b/api/api/nodes.hot_threads.js @@ -24,7 +24,7 @@ function buildNodesHotThreads (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [nodes.hot_threads](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-hot-threads.html) request * @@ -81,9 +81,9 @@ function buildNodesHotThreads (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, nodeId, node_id } = params - var querystring = semicopy(params, ['method', 'body', 'nodeId', 'node_id']) + var warnings = [] + var { method, body, nodeId, node_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -116,24 +116,8 @@ function buildNodesHotThreads (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/nodes.info.js b/api/api/nodes.info.js index 21f5a3177..e3d9187eb 100644 --- a/api/api/nodes.info.js +++ b/api/api/nodes.info.js @@ -24,7 +24,7 @@ function buildNodesInfo (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [nodes.info](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-info.html) request * @@ -74,9 +74,9 @@ function buildNodesInfo (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, nodeId, node_id, metric } = params - var querystring = semicopy(params, ['method', 'body', 'nodeId', 'node_id', 'metric']) + var warnings = [] + var { method, body, nodeId, node_id, metric, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -107,24 +107,8 @@ function buildNodesInfo (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/nodes.reload_secure_settings.js b/api/api/nodes.reload_secure_settings.js index 417a35409..1223e9f53 100644 --- a/api/api/nodes.reload_secure_settings.js +++ b/api/api/nodes.reload_secure_settings.js @@ -24,7 +24,7 @@ function buildNodesReloadSecureSettings (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [nodes.reload_secure_settings](https://www.elastic.co/guide/en/elasticsearch/reference/master/secure-settings.html#reloadable-secure-settings) request * @@ -70,9 +70,9 @@ function buildNodesReloadSecureSettings (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, nodeId, node_id } = params - var querystring = semicopy(params, ['method', 'body', 'nodeId', 'node_id']) + var warnings = [] + var { method, body, nodeId, node_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -99,24 +99,8 @@ function buildNodesReloadSecureSettings (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/nodes.stats.js b/api/api/nodes.stats.js index d32486b4b..248971842 100644 --- a/api/api/nodes.stats.js +++ b/api/api/nodes.stats.js @@ -24,7 +24,7 @@ function buildNodesStats (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [nodes.stats](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-stats.html) request * @@ -89,9 +89,9 @@ function buildNodesStats (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, metric, indexMetric, index_metric, nodeId, node_id } = params - var querystring = semicopy(params, ['method', 'body', 'metric', 'indexMetric', 'index_metric', 'nodeId', 'node_id']) + var warnings = [] + var { method, body, metric, indexMetric, index_metric, nodeId, node_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -126,24 +126,8 @@ function buildNodesStats (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/nodes.usage.js b/api/api/nodes.usage.js index 5e92b8fca..b41f5d15b 100644 --- a/api/api/nodes.usage.js +++ b/api/api/nodes.usage.js @@ -24,7 +24,7 @@ function buildNodesUsage (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [nodes.usage](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-usage.html) request * @@ -71,9 +71,9 @@ function buildNodesUsage (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, metric, nodeId, node_id } = params - var querystring = semicopy(params, ['method', 'body', 'metric', 'nodeId', 'node_id']) + var warnings = [] + var { method, body, metric, nodeId, node_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -104,24 +104,8 @@ function buildNodesUsage (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ping.js b/api/api/ping.js index c4680a7f3..503b059e5 100644 --- a/api/api/ping.js +++ b/api/api/ping.js @@ -24,7 +24,7 @@ function buildPing (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ping](http://www.elastic.co/guide/) request * @@ -67,9 +67,9 @@ function buildPing (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'HEAD' @@ -92,24 +92,8 @@ function buildPing (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/put_script.js b/api/api/put_script.js index 2bf14ee32..f045faa20 100644 --- a/api/api/put_script.js +++ b/api/api/put_script.js @@ -24,7 +24,7 @@ function buildPutScript (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [put_script](http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html) request * @@ -87,9 +87,9 @@ function buildPutScript (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id, context } = params - var querystring = semicopy(params, ['method', 'body', 'id', 'context']) + var warnings = [] + var { method, body, id, context, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' @@ -116,24 +116,8 @@ function buildPutScript (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/rank_eval.js b/api/api/rank_eval.js index 47667b5fe..05d75f642 100644 --- a/api/api/rank_eval.js +++ b/api/api/rank_eval.js @@ -24,7 +24,7 @@ function buildRankEval (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [rank_eval](https://www.elastic.co/guide/en/elasticsearch/reference/master/search-rank-eval.html) request * @@ -78,9 +78,9 @@ function buildRankEval (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' @@ -107,24 +107,8 @@ function buildRankEval (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/reindex.js b/api/api/reindex.js index f3ea8bae1..177137075 100644 --- a/api/api/reindex.js +++ b/api/api/reindex.js @@ -24,7 +24,7 @@ function buildReindex (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [reindex](https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-reindex.html) request * @@ -85,9 +85,9 @@ function buildReindex (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -110,24 +110,8 @@ function buildReindex (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/reindex_rethrottle.js b/api/api/reindex_rethrottle.js index 701458867..97ea781df 100644 --- a/api/api/reindex_rethrottle.js +++ b/api/api/reindex_rethrottle.js @@ -24,7 +24,7 @@ function buildReindexRethrottle (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [reindex_rethrottle](https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-reindex.html) request * @@ -79,9 +79,9 @@ function buildReindexRethrottle (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, taskId, task_id } = params - var querystring = semicopy(params, ['method', 'body', 'taskId', 'task_id']) + var warnings = [] + var { method, body, taskId, task_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -104,24 +104,8 @@ function buildReindexRethrottle (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/render_search_template.js b/api/api/render_search_template.js index 92c8ce4bc..ff24164c4 100644 --- a/api/api/render_search_template.js +++ b/api/api/render_search_template.js @@ -24,7 +24,7 @@ function buildRenderSearchTemplate (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [render_search_template](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-template.html) request * @@ -63,9 +63,9 @@ function buildRenderSearchTemplate (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id } = params - var querystring = semicopy(params, ['method', 'body', 'id']) + var warnings = [] + var { method, body, id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' @@ -92,24 +92,8 @@ function buildRenderSearchTemplate (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/rollup.delete_job.js b/api/api/rollup.delete_job.js index 924e4f7c9..68bbf440b 100644 --- a/api/api/rollup.delete_job.js +++ b/api/api/rollup.delete_job.js @@ -24,7 +24,7 @@ function buildRollupDeleteJob (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [rollup.delete_job]() request * @@ -63,9 +63,9 @@ function buildRollupDeleteJob (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id } = params - var querystring = semicopy(params, ['method', 'body', 'id']) + var warnings = [] + var { method, body, id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' @@ -88,24 +88,8 @@ function buildRollupDeleteJob (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/rollup.get_jobs.js b/api/api/rollup.get_jobs.js index 33d19ff12..b8cb730c4 100644 --- a/api/api/rollup.get_jobs.js +++ b/api/api/rollup.get_jobs.js @@ -24,7 +24,7 @@ function buildRollupGetJobs (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [rollup.get_jobs]() request * @@ -57,9 +57,9 @@ function buildRollupGetJobs (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id } = params - var querystring = semicopy(params, ['method', 'body', 'id']) + var warnings = [] + var { method, body, id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -86,24 +86,8 @@ function buildRollupGetJobs (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/rollup.get_rollup_caps.js b/api/api/rollup.get_rollup_caps.js index a11dff599..56139c7af 100644 --- a/api/api/rollup.get_rollup_caps.js +++ b/api/api/rollup.get_rollup_caps.js @@ -24,7 +24,7 @@ function buildRollupGetRollupCaps (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [rollup.get_rollup_caps]() request * @@ -57,9 +57,9 @@ function buildRollupGetRollupCaps (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id } = params - var querystring = semicopy(params, ['method', 'body', 'id']) + var warnings = [] + var { method, body, id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -86,24 +86,8 @@ function buildRollupGetRollupCaps (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/rollup.get_rollup_index_caps.js b/api/api/rollup.get_rollup_index_caps.js index 5083afd82..d20022c3f 100644 --- a/api/api/rollup.get_rollup_index_caps.js +++ b/api/api/rollup.get_rollup_index_caps.js @@ -24,7 +24,7 @@ function buildRollupGetRollupIndexCaps (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [rollup.get_rollup_index_caps]() request * @@ -63,9 +63,9 @@ function buildRollupGetRollupIndexCaps (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -88,24 +88,8 @@ function buildRollupGetRollupIndexCaps (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/rollup.put_job.js b/api/api/rollup.put_job.js index 9aab2dd62..5ec296d80 100644 --- a/api/api/rollup.put_job.js +++ b/api/api/rollup.put_job.js @@ -24,7 +24,7 @@ function buildRollupPutJob (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [rollup.put_job]() request * @@ -68,9 +68,9 @@ function buildRollupPutJob (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id } = params - var querystring = semicopy(params, ['method', 'body', 'id']) + var warnings = [] + var { method, body, id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' @@ -93,24 +93,8 @@ function buildRollupPutJob (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/rollup.rollup_search.js b/api/api/rollup.rollup_search.js index 3fb6436a8..13519fbad 100644 --- a/api/api/rollup.rollup_search.js +++ b/api/api/rollup.rollup_search.js @@ -24,7 +24,7 @@ function buildRollupRollupSearch (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [rollup.rollup_search]() request * @@ -79,9 +79,9 @@ function buildRollupRollupSearch (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'type']) + var warnings = [] + var { method, body, index, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' @@ -108,24 +108,8 @@ function buildRollupRollupSearch (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/rollup.start_job.js b/api/api/rollup.start_job.js index bdf53e407..2d8d33f33 100644 --- a/api/api/rollup.start_job.js +++ b/api/api/rollup.start_job.js @@ -24,7 +24,7 @@ function buildRollupStartJob (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [rollup.start_job]() request * @@ -63,9 +63,9 @@ function buildRollupStartJob (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id } = params - var querystring = semicopy(params, ['method', 'body', 'id']) + var warnings = [] + var { method, body, id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -88,24 +88,8 @@ function buildRollupStartJob (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/rollup.stop_job.js b/api/api/rollup.stop_job.js index 1d0ebcee8..eb7131c84 100644 --- a/api/api/rollup.stop_job.js +++ b/api/api/rollup.stop_job.js @@ -24,7 +24,7 @@ function buildRollupStopJob (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [rollup.stop_job]() request * @@ -67,9 +67,9 @@ function buildRollupStopJob (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id } = params - var querystring = semicopy(params, ['method', 'body', 'id']) + var warnings = [] + var { method, body, id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -92,24 +92,8 @@ function buildRollupStopJob (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/scripts_painless_context.js b/api/api/scripts_painless_context.js index f6f9d09bd..940ee4a28 100644 --- a/api/api/scripts_painless_context.js +++ b/api/api/scripts_painless_context.js @@ -24,7 +24,7 @@ function buildScriptsPainlessContext (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [scripts_painless_context](undefined) request * @@ -63,9 +63,9 @@ function buildScriptsPainlessContext (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -88,24 +88,8 @@ function buildScriptsPainlessContext (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/scripts_painless_execute.js b/api/api/scripts_painless_execute.js index 47a8f2c4d..aafe11519 100644 --- a/api/api/scripts_painless_execute.js +++ b/api/api/scripts_painless_execute.js @@ -24,7 +24,7 @@ function buildScriptsPainlessExecute (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [scripts_painless_execute](https://www.elastic.co/guide/en/elasticsearch/painless/master/painless-execute-api.html) request * @@ -62,9 +62,9 @@ function buildScriptsPainlessExecute (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' @@ -87,24 +87,8 @@ function buildScriptsPainlessExecute (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/scroll.js b/api/api/scroll.js index 5620c8466..29fee4e32 100644 --- a/api/api/scroll.js +++ b/api/api/scroll.js @@ -24,7 +24,7 @@ function buildScroll (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [scroll](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-request-scroll.html) request * @@ -71,9 +71,9 @@ function buildScroll (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, scrollId, scroll_id } = params - var querystring = semicopy(params, ['method', 'body', 'scrollId', 'scroll_id']) + var warnings = [] + var { method, body, scrollId, scroll_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' @@ -100,24 +100,8 @@ function buildScroll (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/search.js b/api/api/search.js index 7d9e38a78..9714a6c7b 100644 --- a/api/api/search.js +++ b/api/api/search.js @@ -24,7 +24,7 @@ function buildSearch (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [search](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-search.html) request * @@ -181,9 +181,9 @@ function buildSearch (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'type']) + var warnings = [] + var { method, body, index, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' @@ -212,24 +212,8 @@ function buildSearch (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/search_shards.js b/api/api/search_shards.js index 851616086..61b8d1176 100644 --- a/api/api/search_shards.js +++ b/api/api/search_shards.js @@ -24,7 +24,7 @@ function buildSearchShards (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [search_shards](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-shards.html) request * @@ -83,9 +83,9 @@ function buildSearchShards (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var warnings = [] + var { method, body, index, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' @@ -112,24 +112,8 @@ function buildSearchShards (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/search_template.js b/api/api/search_template.js index c0ae53124..f6bb085d6 100644 --- a/api/api/search_template.js +++ b/api/api/search_template.js @@ -24,7 +24,7 @@ function buildSearchTemplate (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [search_template](http://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html) request * @@ -110,9 +110,9 @@ function buildSearchTemplate (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'type']) + var warnings = [] + var { method, body, index, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' @@ -141,24 +141,8 @@ function buildSearchTemplate (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/security.authenticate.js b/api/api/security.authenticate.js index d003876f1..2704a1259 100644 --- a/api/api/security.authenticate.js +++ b/api/api/security.authenticate.js @@ -24,7 +24,7 @@ function buildSecurityAuthenticate (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [security.authenticate](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-authenticate.html) request * @@ -62,9 +62,9 @@ function buildSecurityAuthenticate (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -87,24 +87,8 @@ function buildSecurityAuthenticate (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/security.change_password.js b/api/api/security.change_password.js index dd176539a..46c25fa0e 100644 --- a/api/api/security.change_password.js +++ b/api/api/security.change_password.js @@ -24,7 +24,7 @@ function buildSecurityChangePassword (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [security.change_password](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-change-password.html) request * @@ -65,9 +65,9 @@ function buildSecurityChangePassword (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, username } = params - var querystring = semicopy(params, ['method', 'body', 'username']) + var warnings = [] + var { method, body, username, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' @@ -94,24 +94,8 @@ function buildSecurityChangePassword (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/security.clear_cached_realms.js b/api/api/security.clear_cached_realms.js index 4744ff43a..60cf9fa7a 100644 --- a/api/api/security.clear_cached_realms.js +++ b/api/api/security.clear_cached_realms.js @@ -24,7 +24,7 @@ function buildSecurityClearCachedRealms (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [security.clear_cached_realms](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-clear-cache.html) request * @@ -68,9 +68,9 @@ function buildSecurityClearCachedRealms (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, realms } = params - var querystring = semicopy(params, ['method', 'body', 'realms']) + var warnings = [] + var { method, body, realms, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -93,24 +93,8 @@ function buildSecurityClearCachedRealms (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/security.clear_cached_roles.js b/api/api/security.clear_cached_roles.js index a5fe96e53..2d3a5d663 100644 --- a/api/api/security.clear_cached_roles.js +++ b/api/api/security.clear_cached_roles.js @@ -24,7 +24,7 @@ function buildSecurityClearCachedRoles (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [security.clear_cached_roles](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-clear-role-cache.html) request * @@ -67,9 +67,9 @@ function buildSecurityClearCachedRoles (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, name } = params - var querystring = semicopy(params, ['method', 'body', 'name']) + var warnings = [] + var { method, body, name, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -92,24 +92,8 @@ function buildSecurityClearCachedRoles (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/security.create_api_key.js b/api/api/security.create_api_key.js index b777605d2..4feda504a 100644 --- a/api/api/security.create_api_key.js +++ b/api/api/security.create_api_key.js @@ -24,7 +24,7 @@ function buildSecurityCreateApiKey (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [security.create_api_key](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-api-key.html) request * @@ -64,9 +64,9 @@ function buildSecurityCreateApiKey (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' @@ -89,24 +89,8 @@ function buildSecurityCreateApiKey (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/security.delete_privileges.js b/api/api/security.delete_privileges.js index 72c9995fc..0758e7828 100644 --- a/api/api/security.delete_privileges.js +++ b/api/api/security.delete_privileges.js @@ -24,7 +24,7 @@ function buildSecurityDeletePrivileges (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [security.delete_privileges](TODO) request * @@ -79,9 +79,9 @@ function buildSecurityDeletePrivileges (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, application, name } = params - var querystring = semicopy(params, ['method', 'body', 'application', 'name']) + var warnings = [] + var { method, body, application, name, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' @@ -104,24 +104,8 @@ function buildSecurityDeletePrivileges (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/security.delete_role.js b/api/api/security.delete_role.js index 24180e15a..1cdd0baad 100644 --- a/api/api/security.delete_role.js +++ b/api/api/security.delete_role.js @@ -24,7 +24,7 @@ function buildSecurityDeleteRole (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [security.delete_role](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-delete-role.html) request * @@ -68,9 +68,9 @@ function buildSecurityDeleteRole (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, name } = params - var querystring = semicopy(params, ['method', 'body', 'name']) + var warnings = [] + var { method, body, name, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' @@ -93,24 +93,8 @@ function buildSecurityDeleteRole (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/security.delete_role_mapping.js b/api/api/security.delete_role_mapping.js index e59ba74f4..9a935a9e7 100644 --- a/api/api/security.delete_role_mapping.js +++ b/api/api/security.delete_role_mapping.js @@ -24,7 +24,7 @@ function buildSecurityDeleteRoleMapping (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [security.delete_role_mapping](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-delete-role-mapping.html) request * @@ -68,9 +68,9 @@ function buildSecurityDeleteRoleMapping (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, name } = params - var querystring = semicopy(params, ['method', 'body', 'name']) + var warnings = [] + var { method, body, name, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' @@ -93,24 +93,8 @@ function buildSecurityDeleteRoleMapping (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/security.delete_user.js b/api/api/security.delete_user.js index cb9f8c18e..936691020 100644 --- a/api/api/security.delete_user.js +++ b/api/api/security.delete_user.js @@ -24,7 +24,7 @@ function buildSecurityDeleteUser (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [security.delete_user](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-delete-user.html) request * @@ -68,9 +68,9 @@ function buildSecurityDeleteUser (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, username } = params - var querystring = semicopy(params, ['method', 'body', 'username']) + var warnings = [] + var { method, body, username, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' @@ -93,24 +93,8 @@ function buildSecurityDeleteUser (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/security.disable_user.js b/api/api/security.disable_user.js index c6f7d60ed..788e83209 100644 --- a/api/api/security.disable_user.js +++ b/api/api/security.disable_user.js @@ -24,7 +24,7 @@ function buildSecurityDisableUser (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [security.disable_user](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-disable-user.html) request * @@ -68,9 +68,9 @@ function buildSecurityDisableUser (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, username } = params - var querystring = semicopy(params, ['method', 'body', 'username']) + var warnings = [] + var { method, body, username, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' @@ -93,24 +93,8 @@ function buildSecurityDisableUser (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/security.enable_user.js b/api/api/security.enable_user.js index c225cc9a8..fb61f38d6 100644 --- a/api/api/security.enable_user.js +++ b/api/api/security.enable_user.js @@ -24,7 +24,7 @@ function buildSecurityEnableUser (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [security.enable_user](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-enable-user.html) request * @@ -68,9 +68,9 @@ function buildSecurityEnableUser (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, username } = params - var querystring = semicopy(params, ['method', 'body', 'username']) + var warnings = [] + var { method, body, username, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' @@ -93,24 +93,8 @@ function buildSecurityEnableUser (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/security.get_api_key.js b/api/api/security.get_api_key.js index 51362fb28..7456a83b3 100644 --- a/api/api/security.get_api_key.js +++ b/api/api/security.get_api_key.js @@ -24,7 +24,7 @@ function buildSecurityGetApiKey (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [security.get_api_key](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-api-key.html) request * @@ -69,9 +69,9 @@ function buildSecurityGetApiKey (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -94,24 +94,8 @@ function buildSecurityGetApiKey (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/security.get_privileges.js b/api/api/security.get_privileges.js index 5976c08b9..9ddd8685a 100644 --- a/api/api/security.get_privileges.js +++ b/api/api/security.get_privileges.js @@ -24,7 +24,7 @@ function buildSecurityGetPrivileges (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [security.get_privileges](TODO) request * @@ -70,9 +70,9 @@ function buildSecurityGetPrivileges (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, application, name } = params - var querystring = semicopy(params, ['method', 'body', 'application', 'name']) + var warnings = [] + var { method, body, application, name, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -101,24 +101,8 @@ function buildSecurityGetPrivileges (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/security.get_role.js b/api/api/security.get_role.js index e53558149..a984e56e2 100644 --- a/api/api/security.get_role.js +++ b/api/api/security.get_role.js @@ -24,7 +24,7 @@ function buildSecurityGetRole (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [security.get_role](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-role.html) request * @@ -63,9 +63,9 @@ function buildSecurityGetRole (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, name } = params - var querystring = semicopy(params, ['method', 'body', 'name']) + var warnings = [] + var { method, body, name, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -92,24 +92,8 @@ function buildSecurityGetRole (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/security.get_role_mapping.js b/api/api/security.get_role_mapping.js index 9ec022851..a64c9ef63 100644 --- a/api/api/security.get_role_mapping.js +++ b/api/api/security.get_role_mapping.js @@ -24,7 +24,7 @@ function buildSecurityGetRoleMapping (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [security.get_role_mapping](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-role-mapping.html) request * @@ -63,9 +63,9 @@ function buildSecurityGetRoleMapping (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, name } = params - var querystring = semicopy(params, ['method', 'body', 'name']) + var warnings = [] + var { method, body, name, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -92,24 +92,8 @@ function buildSecurityGetRoleMapping (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/security.get_token.js b/api/api/security.get_token.js index 67391a85d..749027740 100644 --- a/api/api/security.get_token.js +++ b/api/api/security.get_token.js @@ -24,7 +24,7 @@ function buildSecurityGetToken (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [security.get_token](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-token.html) request * @@ -63,9 +63,9 @@ function buildSecurityGetToken (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -88,24 +88,8 @@ function buildSecurityGetToken (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/security.get_user.js b/api/api/security.get_user.js index 490cc7345..8658b8b0f 100644 --- a/api/api/security.get_user.js +++ b/api/api/security.get_user.js @@ -24,7 +24,7 @@ function buildSecurityGetUser (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [security.get_user](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-user.html) request * @@ -63,9 +63,9 @@ function buildSecurityGetUser (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, username } = params - var querystring = semicopy(params, ['method', 'body', 'username']) + var warnings = [] + var { method, body, username, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -92,24 +92,8 @@ function buildSecurityGetUser (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/security.get_user_privileges.js b/api/api/security.get_user_privileges.js index c7b66b3c5..9199c3a23 100644 --- a/api/api/security.get_user_privileges.js +++ b/api/api/security.get_user_privileges.js @@ -24,7 +24,7 @@ function buildSecurityGetUserPrivileges (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [security.get_user_privileges](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-privileges.html) request * @@ -62,9 +62,9 @@ function buildSecurityGetUserPrivileges (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -87,24 +87,8 @@ function buildSecurityGetUserPrivileges (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/security.has_privileges.js b/api/api/security.has_privileges.js index b87cd7ed8..4ab9890f4 100644 --- a/api/api/security.has_privileges.js +++ b/api/api/security.has_privileges.js @@ -24,7 +24,7 @@ function buildSecurityHasPrivileges (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [security.has_privileges](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-has-privileges.html) request * @@ -64,9 +64,9 @@ function buildSecurityHasPrivileges (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, user } = params - var querystring = semicopy(params, ['method', 'body', 'user']) + var warnings = [] + var { method, body, user, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' @@ -93,24 +93,8 @@ function buildSecurityHasPrivileges (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/security.invalidate_api_key.js b/api/api/security.invalidate_api_key.js index 33a7558a3..6006f48a8 100644 --- a/api/api/security.invalidate_api_key.js +++ b/api/api/security.invalidate_api_key.js @@ -24,7 +24,7 @@ function buildSecurityInvalidateApiKey (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [security.invalidate_api_key](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-invalidate-api-key.html) request * @@ -63,9 +63,9 @@ function buildSecurityInvalidateApiKey (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' @@ -88,24 +88,8 @@ function buildSecurityInvalidateApiKey (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/security.invalidate_token.js b/api/api/security.invalidate_token.js index 360f34503..308392171 100644 --- a/api/api/security.invalidate_token.js +++ b/api/api/security.invalidate_token.js @@ -24,7 +24,7 @@ function buildSecurityInvalidateToken (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [security.invalidate_token](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-invalidate-token.html) request * @@ -63,9 +63,9 @@ function buildSecurityInvalidateToken (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' @@ -88,24 +88,8 @@ function buildSecurityInvalidateToken (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/security.put_privileges.js b/api/api/security.put_privileges.js index fd6d8d5ce..16f5b5766 100644 --- a/api/api/security.put_privileges.js +++ b/api/api/security.put_privileges.js @@ -24,7 +24,7 @@ function buildSecurityPutPrivileges (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [security.put_privileges](TODO) request * @@ -64,9 +64,9 @@ function buildSecurityPutPrivileges (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' @@ -89,24 +89,8 @@ function buildSecurityPutPrivileges (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/security.put_role.js b/api/api/security.put_role.js index b5986ee98..bf456bec9 100644 --- a/api/api/security.put_role.js +++ b/api/api/security.put_role.js @@ -24,7 +24,7 @@ function buildSecurityPutRole (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [security.put_role](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put-role.html) request * @@ -69,9 +69,9 @@ function buildSecurityPutRole (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, name } = params - var querystring = semicopy(params, ['method', 'body', 'name']) + var warnings = [] + var { method, body, name, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' @@ -94,24 +94,8 @@ function buildSecurityPutRole (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/security.put_role_mapping.js b/api/api/security.put_role_mapping.js index edd34add2..0a96cea9f 100644 --- a/api/api/security.put_role_mapping.js +++ b/api/api/security.put_role_mapping.js @@ -24,7 +24,7 @@ function buildSecurityPutRoleMapping (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [security.put_role_mapping](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put-role-mapping.html) request * @@ -69,9 +69,9 @@ function buildSecurityPutRoleMapping (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, name } = params - var querystring = semicopy(params, ['method', 'body', 'name']) + var warnings = [] + var { method, body, name, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' @@ -94,24 +94,8 @@ function buildSecurityPutRoleMapping (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/security.put_user.js b/api/api/security.put_user.js index 2f8b62102..0af60be76 100644 --- a/api/api/security.put_user.js +++ b/api/api/security.put_user.js @@ -24,7 +24,7 @@ function buildSecurityPutUser (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [security.put_user](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put-user.html) request * @@ -69,9 +69,9 @@ function buildSecurityPutUser (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, username } = params - var querystring = semicopy(params, ['method', 'body', 'username']) + var warnings = [] + var { method, body, username, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' @@ -94,24 +94,8 @@ function buildSecurityPutUser (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/snapshot.create.js b/api/api/snapshot.create.js index 033f98b75..ba71cf395 100644 --- a/api/api/snapshot.create.js +++ b/api/api/snapshot.create.js @@ -24,7 +24,7 @@ function buildSnapshotCreate (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [snapshot.create](http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html) request * @@ -86,9 +86,9 @@ function buildSnapshotCreate (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, repository, snapshot } = params - var querystring = semicopy(params, ['method', 'body', 'repository', 'snapshot']) + var warnings = [] + var { method, body, repository, snapshot, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' @@ -111,24 +111,8 @@ function buildSnapshotCreate (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/snapshot.create_repository.js b/api/api/snapshot.create_repository.js index e3f2b3ece..6ad35e417 100644 --- a/api/api/snapshot.create_repository.js +++ b/api/api/snapshot.create_repository.js @@ -24,7 +24,7 @@ function buildSnapshotCreateRepository (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [snapshot.create_repository](http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html) request * @@ -80,9 +80,9 @@ function buildSnapshotCreateRepository (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, repository } = params - var querystring = semicopy(params, ['method', 'body', 'repository']) + var warnings = [] + var { method, body, repository, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' @@ -105,24 +105,8 @@ function buildSnapshotCreateRepository (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/snapshot.delete.js b/api/api/snapshot.delete.js index 8ad994bc2..a7bc7ee35 100644 --- a/api/api/snapshot.delete.js +++ b/api/api/snapshot.delete.js @@ -24,7 +24,7 @@ function buildSnapshotDelete (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [snapshot.delete](http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html) request * @@ -86,9 +86,9 @@ function buildSnapshotDelete (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, repository, snapshot } = params - var querystring = semicopy(params, ['method', 'body', 'repository', 'snapshot']) + var warnings = [] + var { method, body, repository, snapshot, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' @@ -111,24 +111,8 @@ function buildSnapshotDelete (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/snapshot.delete_repository.js b/api/api/snapshot.delete_repository.js index 534b7f87d..21aacf4b1 100644 --- a/api/api/snapshot.delete_repository.js +++ b/api/api/snapshot.delete_repository.js @@ -24,7 +24,7 @@ function buildSnapshotDeleteRepository (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [snapshot.delete_repository](http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html) request * @@ -77,9 +77,9 @@ function buildSnapshotDeleteRepository (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, repository } = params - var querystring = semicopy(params, ['method', 'body', 'repository']) + var warnings = [] + var { method, body, repository, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' @@ -102,24 +102,8 @@ function buildSnapshotDeleteRepository (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/snapshot.get.js b/api/api/snapshot.get.js index 042e1b589..26d2da462 100644 --- a/api/api/snapshot.get.js +++ b/api/api/snapshot.get.js @@ -24,7 +24,7 @@ function buildSnapshotGet (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [snapshot.get](http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html) request * @@ -91,9 +91,9 @@ function buildSnapshotGet (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, repository, snapshot } = params - var querystring = semicopy(params, ['method', 'body', 'repository', 'snapshot']) + var warnings = [] + var { method, body, repository, snapshot, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -116,24 +116,8 @@ function buildSnapshotGet (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/snapshot.get_repository.js b/api/api/snapshot.get_repository.js index 5981751d9..edafa1aca 100644 --- a/api/api/snapshot.get_repository.js +++ b/api/api/snapshot.get_repository.js @@ -24,7 +24,7 @@ function buildSnapshotGetRepository (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [snapshot.get_repository](http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html) request * @@ -73,9 +73,9 @@ function buildSnapshotGetRepository (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, repository } = params - var querystring = semicopy(params, ['method', 'body', 'repository']) + var warnings = [] + var { method, body, repository, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -102,24 +102,8 @@ function buildSnapshotGetRepository (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/snapshot.restore.js b/api/api/snapshot.restore.js index 2d9e66297..8173839d9 100644 --- a/api/api/snapshot.restore.js +++ b/api/api/snapshot.restore.js @@ -24,7 +24,7 @@ function buildSnapshotRestore (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [snapshot.restore](http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html) request * @@ -86,9 +86,9 @@ function buildSnapshotRestore (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, repository, snapshot } = params - var querystring = semicopy(params, ['method', 'body', 'repository', 'snapshot']) + var warnings = [] + var { method, body, repository, snapshot, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -111,24 +111,8 @@ function buildSnapshotRestore (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/snapshot.status.js b/api/api/snapshot.status.js index ccabd2b85..3ab18cf55 100644 --- a/api/api/snapshot.status.js +++ b/api/api/snapshot.status.js @@ -24,7 +24,7 @@ function buildSnapshotStatus (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [snapshot.status](http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html) request * @@ -81,9 +81,9 @@ function buildSnapshotStatus (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, repository, snapshot } = params - var querystring = semicopy(params, ['method', 'body', 'repository', 'snapshot']) + var warnings = [] + var { method, body, repository, snapshot, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -112,24 +112,8 @@ function buildSnapshotStatus (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/snapshot.verify_repository.js b/api/api/snapshot.verify_repository.js index 2d9b1ac51..155408828 100644 --- a/api/api/snapshot.verify_repository.js +++ b/api/api/snapshot.verify_repository.js @@ -24,7 +24,7 @@ function buildSnapshotVerifyRepository (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [snapshot.verify_repository](http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html) request * @@ -77,9 +77,9 @@ function buildSnapshotVerifyRepository (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, repository } = params - var querystring = semicopy(params, ['method', 'body', 'repository']) + var warnings = [] + var { method, body, repository, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -102,24 +102,8 @@ function buildSnapshotVerifyRepository (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/sql.clear_cursor.js b/api/api/sql.clear_cursor.js index 456b69dbd..d7cf85bb0 100644 --- a/api/api/sql.clear_cursor.js +++ b/api/api/sql.clear_cursor.js @@ -24,7 +24,7 @@ function buildSqlClearCursor (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [sql.clear_cursor](Clear SQL cursor) request * @@ -63,9 +63,9 @@ function buildSqlClearCursor (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -88,24 +88,8 @@ function buildSqlClearCursor (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/sql.query.js b/api/api/sql.query.js index 4408ded71..5cddb4d53 100644 --- a/api/api/sql.query.js +++ b/api/api/sql.query.js @@ -24,7 +24,7 @@ function buildSqlQuery (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [sql.query](Execute SQL) request * @@ -64,9 +64,9 @@ function buildSqlQuery (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' @@ -89,24 +89,8 @@ function buildSqlQuery (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/sql.translate.js b/api/api/sql.translate.js index cb27b8a31..fc94e016e 100644 --- a/api/api/sql.translate.js +++ b/api/api/sql.translate.js @@ -24,7 +24,7 @@ function buildSqlTranslate (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [sql.translate](Translate SQL into Elasticsearch queries) request * @@ -63,9 +63,9 @@ function buildSqlTranslate (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' @@ -88,24 +88,8 @@ function buildSqlTranslate (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/ssl.certificates.js b/api/api/ssl.certificates.js index afc50d6e6..e23e5f3ad 100644 --- a/api/api/ssl.certificates.js +++ b/api/api/ssl.certificates.js @@ -24,7 +24,7 @@ function buildSslCertificates (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [ssl.certificates](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-ssl.html) request * @@ -62,9 +62,9 @@ function buildSslCertificates (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -87,24 +87,8 @@ function buildSslCertificates (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/tasks.cancel.js b/api/api/tasks.cancel.js index 078a851d0..36db925fc 100644 --- a/api/api/tasks.cancel.js +++ b/api/api/tasks.cancel.js @@ -24,7 +24,7 @@ function buildTasksCancel (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [tasks.cancel](http://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html) request * @@ -75,9 +75,9 @@ function buildTasksCancel (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, taskId, task_id } = params - var querystring = semicopy(params, ['method', 'body', 'taskId', 'task_id']) + var warnings = [] + var { method, body, taskId, task_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -104,24 +104,8 @@ function buildTasksCancel (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/tasks.get.js b/api/api/tasks.get.js index c62d9a7ff..e67bcb9eb 100644 --- a/api/api/tasks.get.js +++ b/api/api/tasks.get.js @@ -24,7 +24,7 @@ function buildTasksGet (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [tasks.get](http://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html) request * @@ -77,9 +77,9 @@ function buildTasksGet (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, taskId, task_id } = params - var querystring = semicopy(params, ['method', 'body', 'taskId', 'task_id']) + var warnings = [] + var { method, body, taskId, task_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -102,24 +102,8 @@ function buildTasksGet (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/tasks.list.js b/api/api/tasks.list.js index a96073b28..20759e997 100644 --- a/api/api/tasks.list.js +++ b/api/api/tasks.list.js @@ -24,7 +24,7 @@ function buildTasksList (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [tasks.list](http://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html) request * @@ -84,9 +84,9 @@ function buildTasksList (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -109,24 +109,8 @@ function buildTasksList (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/termvectors.js b/api/api/termvectors.js index 0ca120894..6c1a79a25 100644 --- a/api/api/termvectors.js +++ b/api/api/termvectors.js @@ -24,7 +24,7 @@ function buildTermvectors (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [termvectors](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-termvectors.html) request * @@ -98,9 +98,9 @@ function buildTermvectors (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, type, id } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'type', 'id']) + var warnings = [] + var { method, body, index, type, id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = body == null ? 'GET' : 'POST' @@ -131,24 +131,8 @@ function buildTermvectors (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/update.js b/api/api/update.js index c488c2570..6d564626e 100644 --- a/api/api/update.js +++ b/api/api/update.js @@ -24,7 +24,7 @@ function buildUpdate (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [update](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-update.html) request * @@ -109,9 +109,9 @@ function buildUpdate (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'id', 'index', 'type']) + var warnings = [] + var { method, body, id, index, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -138,24 +138,8 @@ function buildUpdate (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/update_by_query.js b/api/api/update_by_query.js index 8cc891dc9..5346ba3d9 100644 --- a/api/api/update_by_query.js +++ b/api/api/update_by_query.js @@ -24,7 +24,7 @@ function buildUpdateByQuery (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [update_by_query](https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-update-by-query.html) request * @@ -160,9 +160,9 @@ function buildUpdateByQuery (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'type']) + var warnings = [] + var { method, body, index, type, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -189,24 +189,8 @@ function buildUpdateByQuery (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/update_by_query_rethrottle.js b/api/api/update_by_query_rethrottle.js index d6d2408e9..b8a5ff701 100644 --- a/api/api/update_by_query_rethrottle.js +++ b/api/api/update_by_query_rethrottle.js @@ -24,7 +24,7 @@ function buildUpdateByQueryRethrottle (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [update_by_query_rethrottle](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update-by-query.html) request * @@ -79,9 +79,9 @@ function buildUpdateByQueryRethrottle (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, taskId, task_id } = params - var querystring = semicopy(params, ['method', 'body', 'taskId', 'task_id']) + var warnings = [] + var { method, body, taskId, task_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -104,24 +104,8 @@ function buildUpdateByQueryRethrottle (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/watcher.ack_watch.js b/api/api/watcher.ack_watch.js index 37b1b9458..b85428326 100644 --- a/api/api/watcher.ack_watch.js +++ b/api/api/watcher.ack_watch.js @@ -24,7 +24,7 @@ function buildWatcherAckWatch (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [watcher.ack_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-ack-watch.html) request * @@ -74,9 +74,9 @@ function buildWatcherAckWatch (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, watchId, watch_id, actionId, action_id } = params - var querystring = semicopy(params, ['method', 'body', 'watchId', 'watch_id', 'actionId', 'action_id']) + var warnings = [] + var { method, body, watchId, watch_id, actionId, action_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' @@ -103,24 +103,8 @@ function buildWatcherAckWatch (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/watcher.activate_watch.js b/api/api/watcher.activate_watch.js index d4a8e9594..73f06de84 100644 --- a/api/api/watcher.activate_watch.js +++ b/api/api/watcher.activate_watch.js @@ -24,7 +24,7 @@ function buildWatcherActivateWatch (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [watcher.activate_watch](https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-activate-watch.html) request * @@ -67,9 +67,9 @@ function buildWatcherActivateWatch (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, watchId, watch_id } = params - var querystring = semicopy(params, ['method', 'body', 'watchId', 'watch_id']) + var warnings = [] + var { method, body, watchId, watch_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' @@ -92,24 +92,8 @@ function buildWatcherActivateWatch (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/watcher.deactivate_watch.js b/api/api/watcher.deactivate_watch.js index d1fa2bcfc..5b7e4eb48 100644 --- a/api/api/watcher.deactivate_watch.js +++ b/api/api/watcher.deactivate_watch.js @@ -24,7 +24,7 @@ function buildWatcherDeactivateWatch (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [watcher.deactivate_watch](https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-deactivate-watch.html) request * @@ -67,9 +67,9 @@ function buildWatcherDeactivateWatch (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, watchId, watch_id } = params - var querystring = semicopy(params, ['method', 'body', 'watchId', 'watch_id']) + var warnings = [] + var { method, body, watchId, watch_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' @@ -92,24 +92,8 @@ function buildWatcherDeactivateWatch (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/watcher.delete_watch.js b/api/api/watcher.delete_watch.js index 28dcbcf9f..64263193b 100644 --- a/api/api/watcher.delete_watch.js +++ b/api/api/watcher.delete_watch.js @@ -24,7 +24,7 @@ function buildWatcherDeleteWatch (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [watcher.delete_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-delete-watch.html) request * @@ -67,9 +67,9 @@ function buildWatcherDeleteWatch (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id } = params - var querystring = semicopy(params, ['method', 'body', 'id']) + var warnings = [] + var { method, body, id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'DELETE' @@ -92,24 +92,8 @@ function buildWatcherDeleteWatch (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/watcher.execute_watch.js b/api/api/watcher.execute_watch.js index 137887ab2..409e507f1 100644 --- a/api/api/watcher.execute_watch.js +++ b/api/api/watcher.execute_watch.js @@ -24,7 +24,7 @@ function buildWatcherExecuteWatch (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [watcher.execute_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-execute-watch.html) request * @@ -59,9 +59,9 @@ function buildWatcherExecuteWatch (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id } = params - var querystring = semicopy(params, ['method', 'body', 'id']) + var warnings = [] + var { method, body, id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' @@ -88,24 +88,8 @@ function buildWatcherExecuteWatch (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/watcher.get_watch.js b/api/api/watcher.get_watch.js index a0360a8a3..bee524669 100644 --- a/api/api/watcher.get_watch.js +++ b/api/api/watcher.get_watch.js @@ -24,7 +24,7 @@ function buildWatcherGetWatch (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [watcher.get_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-get-watch.html) request * @@ -67,9 +67,9 @@ function buildWatcherGetWatch (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id } = params - var querystring = semicopy(params, ['method', 'body', 'id']) + var warnings = [] + var { method, body, id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -92,24 +92,8 @@ function buildWatcherGetWatch (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/watcher.put_watch.js b/api/api/watcher.put_watch.js index 45c458597..d227f8b8e 100644 --- a/api/api/watcher.put_watch.js +++ b/api/api/watcher.put_watch.js @@ -24,7 +24,7 @@ function buildWatcherPutWatch (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [watcher.put_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-put-watch.html) request * @@ -72,9 +72,9 @@ function buildWatcherPutWatch (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, id } = params - var querystring = semicopy(params, ['method', 'body', 'id']) + var warnings = [] + var { method, body, id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'PUT' @@ -97,24 +97,8 @@ function buildWatcherPutWatch (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/watcher.start.js b/api/api/watcher.start.js index 5827392ca..3ad4f4bac 100644 --- a/api/api/watcher.start.js +++ b/api/api/watcher.start.js @@ -24,7 +24,7 @@ function buildWatcherStart (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [watcher.start](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-start.html) request * @@ -62,9 +62,9 @@ function buildWatcherStart (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -87,24 +87,8 @@ function buildWatcherStart (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/watcher.stats.js b/api/api/watcher.stats.js index 0820352d3..3d0dcc90b 100644 --- a/api/api/watcher.stats.js +++ b/api/api/watcher.stats.js @@ -24,7 +24,7 @@ function buildWatcherStats (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [watcher.stats](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-stats.html) request * @@ -66,9 +66,9 @@ function buildWatcherStats (opts) { return handleError(err, callback) } - var warnings = null - var { method, body, metric } = params - var querystring = semicopy(params, ['method', 'body', 'metric']) + var warnings = [] + var { method, body, metric, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -95,24 +95,8 @@ function buildWatcherStats (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/watcher.stop.js b/api/api/watcher.stop.js index 4dd309164..af179d8ce 100644 --- a/api/api/watcher.stop.js +++ b/api/api/watcher.stop.js @@ -24,7 +24,7 @@ function buildWatcherStop (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [watcher.stop](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-stop.html) request * @@ -62,9 +62,9 @@ function buildWatcherStop (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'POST' @@ -87,24 +87,8 @@ function buildWatcherStop (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/xpack.info.js b/api/api/xpack.info.js index c35c3d50d..f2f5dc8ef 100644 --- a/api/api/xpack.info.js +++ b/api/api/xpack.info.js @@ -24,7 +24,7 @@ function buildXpackInfo (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [xpack.info](https://www.elastic.co/guide/en/elasticsearch/reference/current/info-api.html) request * @@ -63,9 +63,9 @@ function buildXpackInfo (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -88,24 +88,8 @@ function buildXpackInfo (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/api/xpack.usage.js b/api/api/xpack.usage.js index a89831706..62937f1ff 100644 --- a/api/api/xpack.usage.js +++ b/api/api/xpack.usage.js @@ -24,7 +24,7 @@ function buildXpackUsage (opts) { // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, handleError } = opts + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts /** * Perform a [xpack.usage](Retrieve information about xpack features usage) request * @@ -63,9 +63,9 @@ function buildXpackUsage (opts) { return handleError(err, callback) } - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) + var warnings = [] + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) if (method == null) { method = 'GET' @@ -88,24 +88,8 @@ function buildXpackUsage (opts) { querystring } - options.warnings = warnings + options.warnings = warnings.length === 0 ? null : warnings return makeRequest(request, options, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } } } diff --git a/api/index.js b/api/index.js index d31ded72e..461bfa8a4 100644 --- a/api/index.js +++ b/api/index.js @@ -28,6 +28,7 @@ function ESAPI (opts) { const { result } = opts opts.handleError = handleError + opts.snakeCaseKeys = snakeCaseKeys const apis = { bulk: lazyLoad('bulk', opts), @@ -521,6 +522,19 @@ function ESAPI (opts) { if (callback) return callback(err, result) return Promise.reject(err) } + + function snakeCaseKeys (acceptedQuerystring, snakeCase, querystring, warnings) { + var target = {} + var keys = Object.keys(querystring) + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + target[snakeCase[key] || key] = querystring[key] + if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { + warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') + } + } + return target + } } // It's unlikely that a user needs all of our APIs, From caba9fa2a2cc9d3ac7d8222a1da92b3d3ea027fa Mon Sep 17 00:00:00 2001 From: delvedor Date: Fri, 3 May 2019 18:27:17 +0200 Subject: [PATCH 6/6] API generation --- api/api/bulk.js | 2 +- api/api/cat.aliases.js | 2 +- api/api/cat.allocation.js | 2 +- api/api/cat.count.js | 2 +- api/api/cat.fielddata.js | 2 +- api/api/cat.health.js | 2 +- api/api/cat.help.js | 2 +- api/api/cat.indices.js | 2 +- api/api/cat.master.js | 2 +- api/api/cat.nodeattrs.js | 2 +- api/api/cat.nodes.js | 2 +- api/api/cat.pending_tasks.js | 2 +- api/api/cat.plugins.js | 2 +- api/api/cat.recovery.js | 2 +- api/api/cat.repositories.js | 2 +- api/api/cat.segments.js | 2 +- api/api/cat.shards.js | 2 +- api/api/cat.snapshots.js | 2 +- api/api/cat.tasks.js | 2 +- api/api/cat.templates.js | 2 +- api/api/cat.thread_pool.js | 2 +- api/api/ccr.delete_auto_follow_pattern.js | 2 +- api/api/ccr.follow.js | 2 +- api/api/ccr.follow_info.js | 2 +- api/api/ccr.follow_stats.js | 2 +- api/api/ccr.forget_follower.js | 2 +- api/api/ccr.get_auto_follow_pattern.js | 2 +- api/api/ccr.pause_follow.js | 2 +- api/api/ccr.put_auto_follow_pattern.js | 2 +- api/api/ccr.resume_follow.js | 2 +- api/api/ccr.stats.js | 2 +- api/api/ccr.unfollow.js | 2 +- api/api/clear_scroll.js | 2 +- api/api/cluster.allocation_explain.js | 2 +- api/api/cluster.get_settings.js | 2 +- api/api/cluster.health.js | 2 +- api/api/cluster.pending_tasks.js | 2 +- api/api/cluster.put_settings.js | 2 +- api/api/cluster.remote_info.js | 2 +- api/api/cluster.reroute.js | 2 +- api/api/cluster.state.js | 2 +- api/api/cluster.stats.js | 2 +- api/api/count.js | 2 +- api/api/create.js | 2 +- api/api/data_frame.delete_data_frame_transform.js | 2 +- api/api/data_frame.get_data_frame_transform.js | 2 +- api/api/data_frame.get_data_frame_transform_stats.js | 2 +- api/api/data_frame.preview_data_frame_transform.js | 2 +- api/api/data_frame.put_data_frame_transform.js | 2 +- api/api/data_frame.start_data_frame_transform.js | 2 +- api/api/data_frame.stop_data_frame_transform.js | 2 +- api/api/delete.js | 2 +- api/api/delete_by_query.js | 2 +- api/api/delete_by_query_rethrottle.js | 2 +- api/api/delete_script.js | 2 +- api/api/exists.js | 2 +- api/api/exists_source.js | 2 +- api/api/explain.js | 2 +- api/api/field_caps.js | 2 +- api/api/get.js | 2 +- api/api/get_script.js | 2 +- api/api/get_source.js | 2 +- api/api/graph.explore.js | 2 +- api/api/ilm.delete_lifecycle.js | 2 +- api/api/ilm.explain_lifecycle.js | 2 +- api/api/ilm.get_lifecycle.js | 2 +- api/api/ilm.get_status.js | 2 +- api/api/ilm.move_to_step.js | 2 +- api/api/ilm.put_lifecycle.js | 2 +- api/api/ilm.remove_policy.js | 2 +- api/api/ilm.retry.js | 2 +- api/api/ilm.start.js | 2 +- api/api/ilm.stop.js | 2 +- api/api/index.js | 2 +- api/api/indices.analyze.js | 2 +- api/api/indices.clear_cache.js | 2 +- api/api/indices.close.js | 2 +- api/api/indices.create.js | 2 +- api/api/indices.delete.js | 2 +- api/api/indices.delete_alias.js | 2 +- api/api/indices.delete_template.js | 2 +- api/api/indices.exists.js | 2 +- api/api/indices.exists_alias.js | 2 +- api/api/indices.exists_template.js | 2 +- api/api/indices.exists_type.js | 2 +- api/api/indices.flush.js | 2 +- api/api/indices.flush_synced.js | 2 +- api/api/indices.forcemerge.js | 2 +- api/api/indices.freeze.js | 2 +- api/api/indices.get.js | 2 +- api/api/indices.get_alias.js | 2 +- api/api/indices.get_field_mapping.js | 2 +- api/api/indices.get_mapping.js | 2 +- api/api/indices.get_settings.js | 2 +- api/api/indices.get_template.js | 2 +- api/api/indices.get_upgrade.js | 2 +- api/api/indices.open.js | 2 +- api/api/indices.put_alias.js | 2 +- api/api/indices.put_mapping.js | 2 +- api/api/indices.put_settings.js | 2 +- api/api/indices.put_template.js | 2 +- api/api/indices.recovery.js | 2 +- api/api/indices.refresh.js | 2 +- api/api/indices.rollover.js | 2 +- api/api/indices.segments.js | 2 +- api/api/indices.shard_stores.js | 2 +- api/api/indices.shrink.js | 2 +- api/api/indices.split.js | 2 +- api/api/indices.stats.js | 2 +- api/api/indices.unfreeze.js | 2 +- api/api/indices.update_aliases.js | 2 +- api/api/indices.upgrade.js | 2 +- api/api/indices.validate_query.js | 2 +- api/api/info.js | 2 +- api/api/ingest.delete_pipeline.js | 2 +- api/api/ingest.get_pipeline.js | 2 +- api/api/ingest.processor_grok.js | 2 +- api/api/ingest.put_pipeline.js | 2 +- api/api/ingest.simulate.js | 2 +- api/api/license.delete.js | 2 +- api/api/license.get.js | 2 +- api/api/license.get_basic_status.js | 2 +- api/api/license.get_trial_status.js | 2 +- api/api/license.post.js | 2 +- api/api/license.post_start_basic.js | 2 +- api/api/license.post_start_trial.js | 2 +- api/api/mget.js | 2 +- api/api/migration.deprecations.js | 2 +- api/api/ml.close_job.js | 2 +- api/api/ml.delete_calendar.js | 2 +- api/api/ml.delete_calendar_event.js | 2 +- api/api/ml.delete_calendar_job.js | 2 +- api/api/ml.delete_datafeed.js | 2 +- api/api/ml.delete_expired_data.js | 2 +- api/api/ml.delete_filter.js | 2 +- api/api/ml.delete_forecast.js | 2 +- api/api/ml.delete_job.js | 2 +- api/api/ml.delete_model_snapshot.js | 2 +- api/api/ml.find_file_structure.js | 2 +- api/api/ml.flush_job.js | 2 +- api/api/ml.forecast.js | 2 +- api/api/ml.get_buckets.js | 2 +- api/api/ml.get_calendar_events.js | 2 +- api/api/ml.get_calendars.js | 2 +- api/api/ml.get_categories.js | 2 +- api/api/ml.get_datafeed_stats.js | 2 +- api/api/ml.get_datafeeds.js | 2 +- api/api/ml.get_filters.js | 2 +- api/api/ml.get_influencers.js | 2 +- api/api/ml.get_job_stats.js | 2 +- api/api/ml.get_jobs.js | 2 +- api/api/ml.get_model_snapshots.js | 2 +- api/api/ml.get_overall_buckets.js | 2 +- api/api/ml.get_records.js | 2 +- api/api/ml.info.js | 2 +- api/api/ml.open_job.js | 2 +- api/api/ml.post_calendar_events.js | 2 +- api/api/ml.post_data.js | 2 +- api/api/ml.preview_datafeed.js | 2 +- api/api/ml.put_calendar.js | 2 +- api/api/ml.put_calendar_job.js | 2 +- api/api/ml.put_datafeed.js | 2 +- api/api/ml.put_filter.js | 2 +- api/api/ml.put_job.js | 2 +- api/api/ml.revert_model_snapshot.js | 2 +- api/api/ml.set_upgrade_mode.js | 2 +- api/api/ml.start_datafeed.js | 2 +- api/api/ml.stop_datafeed.js | 2 +- api/api/ml.update_datafeed.js | 2 +- api/api/ml.update_filter.js | 2 +- api/api/ml.update_job.js | 2 +- api/api/ml.update_model_snapshot.js | 2 +- api/api/ml.validate.js | 2 +- api/api/ml.validate_detector.js | 2 +- api/api/monitoring.bulk.js | 2 +- api/api/msearch.js | 2 +- api/api/msearch_template.js | 2 +- api/api/mtermvectors.js | 2 +- api/api/nodes.hot_threads.js | 2 +- api/api/nodes.info.js | 2 +- api/api/nodes.reload_secure_settings.js | 2 +- api/api/nodes.stats.js | 2 +- api/api/nodes.usage.js | 2 +- api/api/ping.js | 2 +- api/api/put_script.js | 2 +- api/api/rank_eval.js | 2 +- api/api/reindex.js | 2 +- api/api/reindex_rethrottle.js | 2 +- api/api/render_search_template.js | 2 +- api/api/rollup.delete_job.js | 2 +- api/api/rollup.get_jobs.js | 2 +- api/api/rollup.get_rollup_caps.js | 2 +- api/api/rollup.get_rollup_index_caps.js | 2 +- api/api/rollup.put_job.js | 2 +- api/api/rollup.rollup_search.js | 2 +- api/api/rollup.start_job.js | 2 +- api/api/rollup.stop_job.js | 2 +- api/api/scripts_painless_context.js | 2 +- api/api/scripts_painless_execute.js | 2 +- api/api/scroll.js | 2 +- api/api/search.js | 2 +- api/api/search_shards.js | 2 +- api/api/search_template.js | 2 +- api/api/security.authenticate.js | 2 +- api/api/security.change_password.js | 2 +- api/api/security.clear_cached_realms.js | 2 +- api/api/security.clear_cached_roles.js | 2 +- api/api/security.create_api_key.js | 2 +- api/api/security.delete_privileges.js | 2 +- api/api/security.delete_role.js | 2 +- api/api/security.delete_role_mapping.js | 2 +- api/api/security.delete_user.js | 2 +- api/api/security.disable_user.js | 2 +- api/api/security.enable_user.js | 2 +- api/api/security.get_api_key.js | 2 +- api/api/security.get_privileges.js | 2 +- api/api/security.get_role.js | 2 +- api/api/security.get_role_mapping.js | 2 +- api/api/security.get_token.js | 2 +- api/api/security.get_user.js | 2 +- api/api/security.get_user_privileges.js | 2 +- api/api/security.has_privileges.js | 2 +- api/api/security.invalidate_api_key.js | 2 +- api/api/security.invalidate_token.js | 2 +- api/api/security.put_privileges.js | 2 +- api/api/security.put_role.js | 2 +- api/api/security.put_role_mapping.js | 2 +- api/api/security.put_user.js | 2 +- api/api/snapshot.create.js | 2 +- api/api/snapshot.create_repository.js | 2 +- api/api/snapshot.delete.js | 2 +- api/api/snapshot.delete_repository.js | 2 +- api/api/snapshot.get.js | 2 +- api/api/snapshot.get_repository.js | 2 +- api/api/snapshot.restore.js | 2 +- api/api/snapshot.status.js | 2 +- api/api/snapshot.verify_repository.js | 2 +- api/api/sql.clear_cursor.js | 2 +- api/api/sql.query.js | 2 +- api/api/sql.translate.js | 2 +- api/api/ssl.certificates.js | 2 +- api/api/tasks.cancel.js | 2 +- api/api/tasks.get.js | 2 +- api/api/tasks.list.js | 2 +- api/api/termvectors.js | 2 +- api/api/update.js | 2 +- api/api/update_by_query.js | 2 +- api/api/update_by_query_rethrottle.js | 2 +- api/api/watcher.ack_watch.js | 2 +- api/api/watcher.activate_watch.js | 2 +- api/api/watcher.deactivate_watch.js | 2 +- api/api/watcher.delete_watch.js | 2 +- api/api/watcher.execute_watch.js | 2 +- api/api/watcher.get_watch.js | 2 +- api/api/watcher.put_watch.js | 2 +- api/api/watcher.start.js | 2 +- api/api/watcher.stats.js | 2 +- api/api/watcher.stop.js | 2 +- api/api/xpack.info.js | 2 +- api/api/xpack.usage.js | 2 +- 260 files changed, 260 insertions(+), 260 deletions(-) diff --git a/api/api/bulk.js b/api/api/bulk.js index 7a1a5ba49..cf09dbbdd 100644 --- a/api/api/bulk.js +++ b/api/api/bulk.js @@ -105,7 +105,7 @@ function buildBulk (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/cat.aliases.js b/api/api/cat.aliases.js index d61970caa..c5dd54002 100644 --- a/api/api/cat.aliases.js +++ b/api/api/cat.aliases.js @@ -91,7 +91,7 @@ function buildCatAliases (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/cat.allocation.js b/api/api/cat.allocation.js index 85018422c..0813c9adf 100644 --- a/api/api/cat.allocation.js +++ b/api/api/cat.allocation.js @@ -93,7 +93,7 @@ function buildCatAllocation (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/cat.count.js b/api/api/cat.count.js index bd9b0f921..79e6ba665 100644 --- a/api/api/cat.count.js +++ b/api/api/cat.count.js @@ -91,7 +91,7 @@ function buildCatCount (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/cat.fielddata.js b/api/api/cat.fielddata.js index 95674e08b..2871e8276 100644 --- a/api/api/cat.fielddata.js +++ b/api/api/cat.fielddata.js @@ -95,7 +95,7 @@ function buildCatFielddata (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/cat.health.js b/api/api/cat.health.js index 7a0ffae68..ee9088774 100644 --- a/api/api/cat.health.js +++ b/api/api/cat.health.js @@ -92,7 +92,7 @@ function buildCatHealth (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/cat.help.js b/api/api/cat.help.js index f0ac63226..3129b9892 100644 --- a/api/api/cat.help.js +++ b/api/api/cat.help.js @@ -79,7 +79,7 @@ function buildCatHelp (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/cat.indices.js b/api/api/cat.indices.js index a53f87a49..b262476a7 100644 --- a/api/api/cat.indices.js +++ b/api/api/cat.indices.js @@ -100,7 +100,7 @@ function buildCatIndices (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/cat.master.js b/api/api/cat.master.js index d424285b5..859eaa3a0 100644 --- a/api/api/cat.master.js +++ b/api/api/cat.master.js @@ -90,7 +90,7 @@ function buildCatMaster (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/cat.nodeattrs.js b/api/api/cat.nodeattrs.js index e55f0d40e..94b6c5a03 100644 --- a/api/api/cat.nodeattrs.js +++ b/api/api/cat.nodeattrs.js @@ -90,7 +90,7 @@ function buildCatNodeattrs (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/cat.nodes.js b/api/api/cat.nodes.js index 8f6b58617..024a85d9c 100644 --- a/api/api/cat.nodes.js +++ b/api/api/cat.nodes.js @@ -93,7 +93,7 @@ function buildCatNodes (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/cat.pending_tasks.js b/api/api/cat.pending_tasks.js index 46d6787c9..399fa8df0 100644 --- a/api/api/cat.pending_tasks.js +++ b/api/api/cat.pending_tasks.js @@ -90,7 +90,7 @@ function buildCatPendingTasks (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/cat.plugins.js b/api/api/cat.plugins.js index d18fe489a..accfcd225 100644 --- a/api/api/cat.plugins.js +++ b/api/api/cat.plugins.js @@ -90,7 +90,7 @@ function buildCatPlugins (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/cat.recovery.js b/api/api/cat.recovery.js index 177b30a15..1e2673d45 100644 --- a/api/api/cat.recovery.js +++ b/api/api/cat.recovery.js @@ -91,7 +91,7 @@ function buildCatRecovery (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/cat.repositories.js b/api/api/cat.repositories.js index 7f5a3ee7d..a5fccaf72 100644 --- a/api/api/cat.repositories.js +++ b/api/api/cat.repositories.js @@ -90,7 +90,7 @@ function buildCatRepositories (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/cat.segments.js b/api/api/cat.segments.js index ccbbda06a..80289fab2 100644 --- a/api/api/cat.segments.js +++ b/api/api/cat.segments.js @@ -88,7 +88,7 @@ function buildCatSegments (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/cat.shards.js b/api/api/cat.shards.js index 6ba32c3aa..8a558a3f6 100644 --- a/api/api/cat.shards.js +++ b/api/api/cat.shards.js @@ -93,7 +93,7 @@ function buildCatShards (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/cat.snapshots.js b/api/api/cat.snapshots.js index d09a08f75..dd13a1a3b 100644 --- a/api/api/cat.snapshots.js +++ b/api/api/cat.snapshots.js @@ -92,7 +92,7 @@ function buildCatSnapshots (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/cat.tasks.js b/api/api/cat.tasks.js index 30ee9b81d..7de46c56a 100644 --- a/api/api/cat.tasks.js +++ b/api/api/cat.tasks.js @@ -95,7 +95,7 @@ function buildCatTasks (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/cat.templates.js b/api/api/cat.templates.js index da5593fb1..13ab47f23 100644 --- a/api/api/cat.templates.js +++ b/api/api/cat.templates.js @@ -91,7 +91,7 @@ function buildCatTemplates (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/cat.thread_pool.js b/api/api/cat.thread_pool.js index bf2704ba1..d1dcde6f1 100644 --- a/api/api/cat.thread_pool.js +++ b/api/api/cat.thread_pool.js @@ -93,7 +93,7 @@ function buildCatThreadPool (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ccr.delete_auto_follow_pattern.js b/api/api/ccr.delete_auto_follow_pattern.js index 558c62a8e..d9d8dbf8c 100644 --- a/api/api/ccr.delete_auto_follow_pattern.js +++ b/api/api/ccr.delete_auto_follow_pattern.js @@ -71,7 +71,7 @@ function buildCcrDeleteAutoFollowPattern (opts) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ccr.follow.js b/api/api/ccr.follow.js index 6c995bfc8..f98f46dab 100644 --- a/api/api/ccr.follow.js +++ b/api/api/ccr.follow.js @@ -77,7 +77,7 @@ function buildCcrFollow (opts) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ccr.follow_info.js b/api/api/ccr.follow_info.js index feca34464..2599c47eb 100644 --- a/api/api/ccr.follow_info.js +++ b/api/api/ccr.follow_info.js @@ -65,7 +65,7 @@ function buildCcrFollowInfo (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ccr.follow_stats.js b/api/api/ccr.follow_stats.js index 752c8c03e..6d4b118d7 100644 --- a/api/api/ccr.follow_stats.js +++ b/api/api/ccr.follow_stats.js @@ -71,7 +71,7 @@ function buildCcrFollowStats (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ccr.forget_follower.js b/api/api/ccr.forget_follower.js index f88ff2421..a13fed2f7 100644 --- a/api/api/ccr.forget_follower.js +++ b/api/api/ccr.forget_follower.js @@ -76,7 +76,7 @@ function buildCcrForgetFollower (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ccr.get_auto_follow_pattern.js b/api/api/ccr.get_auto_follow_pattern.js index 10d0c7603..4408c4fc9 100644 --- a/api/api/ccr.get_auto_follow_pattern.js +++ b/api/api/ccr.get_auto_follow_pattern.js @@ -65,7 +65,7 @@ function buildCcrGetAutoFollowPattern (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ccr.pause_follow.js b/api/api/ccr.pause_follow.js index 3a5384cd7..36038853a 100644 --- a/api/api/ccr.pause_follow.js +++ b/api/api/ccr.pause_follow.js @@ -71,7 +71,7 @@ function buildCcrPauseFollow (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ccr.put_auto_follow_pattern.js b/api/api/ccr.put_auto_follow_pattern.js index e83889f9d..c01ceeeae 100644 --- a/api/api/ccr.put_auto_follow_pattern.js +++ b/api/api/ccr.put_auto_follow_pattern.js @@ -76,7 +76,7 @@ function buildCcrPutAutoFollowPattern (opts) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ccr.resume_follow.js b/api/api/ccr.resume_follow.js index 9369253cb..6a55c779d 100644 --- a/api/api/ccr.resume_follow.js +++ b/api/api/ccr.resume_follow.js @@ -72,7 +72,7 @@ function buildCcrResumeFollow (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ccr.stats.js b/api/api/ccr.stats.js index 2dbf6c50b..4297da6c7 100644 --- a/api/api/ccr.stats.js +++ b/api/api/ccr.stats.js @@ -64,7 +64,7 @@ function buildCcrStats (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ccr.unfollow.js b/api/api/ccr.unfollow.js index b984d46df..50601072b 100644 --- a/api/api/ccr.unfollow.js +++ b/api/api/ccr.unfollow.js @@ -71,7 +71,7 @@ function buildCcrUnfollow (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/clear_scroll.js b/api/api/clear_scroll.js index 52075c4b7..7d02162ad 100644 --- a/api/api/clear_scroll.js +++ b/api/api/clear_scroll.js @@ -71,7 +71,7 @@ function buildClearScroll (opts) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/cluster.allocation_explain.js b/api/api/cluster.allocation_explain.js index 6bef973b4..f7d18de2c 100644 --- a/api/api/cluster.allocation_explain.js +++ b/api/api/cluster.allocation_explain.js @@ -76,7 +76,7 @@ function buildClusterAllocationExplain (opts) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/cluster.get_settings.js b/api/api/cluster.get_settings.js index 902e61ee1..7bf393d80 100644 --- a/api/api/cluster.get_settings.js +++ b/api/api/cluster.get_settings.js @@ -86,7 +86,7 @@ function buildClusterGetSettings (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/cluster.health.js b/api/api/cluster.health.js index eab0c9a19..12e495377 100644 --- a/api/api/cluster.health.js +++ b/api/api/cluster.health.js @@ -106,7 +106,7 @@ function buildClusterHealth (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/cluster.pending_tasks.js b/api/api/cluster.pending_tasks.js index 7649c1695..c8bdd8ca3 100644 --- a/api/api/cluster.pending_tasks.js +++ b/api/api/cluster.pending_tasks.js @@ -80,7 +80,7 @@ function buildClusterPendingTasks (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/cluster.put_settings.js b/api/api/cluster.put_settings.js index 214276d20..06a07efa0 100644 --- a/api/api/cluster.put_settings.js +++ b/api/api/cluster.put_settings.js @@ -84,7 +84,7 @@ function buildClusterPutSettings (opts) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/cluster.remote_info.js b/api/api/cluster.remote_info.js index 081409d0b..5c3b65f54 100644 --- a/api/api/cluster.remote_info.js +++ b/api/api/cluster.remote_info.js @@ -75,7 +75,7 @@ function buildClusterRemoteInfo (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/cluster.reroute.js b/api/api/cluster.reroute.js index 921c5c72f..c7e083bf8 100644 --- a/api/api/cluster.reroute.js +++ b/api/api/cluster.reroute.js @@ -85,7 +85,7 @@ function buildClusterReroute (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/cluster.state.js b/api/api/cluster.state.js index 1f2ac004d..b4eaa7995 100644 --- a/api/api/cluster.state.js +++ b/api/api/cluster.state.js @@ -106,7 +106,7 @@ function buildClusterState (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/cluster.stats.js b/api/api/cluster.stats.js index 13c5d045f..f90bdd11f 100644 --- a/api/api/cluster.stats.js +++ b/api/api/cluster.stats.js @@ -81,7 +81,7 @@ function buildClusterStats (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/count.js b/api/api/count.js index e29c6b139..c4559bcd3 100644 --- a/api/api/count.js +++ b/api/api/count.js @@ -114,7 +114,7 @@ function buildCount (opts) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/create.js b/api/api/create.js index 94e15a5c9..2c5c20dbd 100644 --- a/api/api/create.js +++ b/api/api/create.js @@ -105,7 +105,7 @@ function buildCreate (opts) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/data_frame.delete_data_frame_transform.js b/api/api/data_frame.delete_data_frame_transform.js index 528c80c9a..68fb7118d 100644 --- a/api/api/data_frame.delete_data_frame_transform.js +++ b/api/api/data_frame.delete_data_frame_transform.js @@ -75,7 +75,7 @@ function buildDataFrameDeleteDataFrameTransform (opts) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/data_frame.get_data_frame_transform.js b/api/api/data_frame.get_data_frame_transform.js index e98621fd9..160f75c7e 100644 --- a/api/api/data_frame.get_data_frame_transform.js +++ b/api/api/data_frame.get_data_frame_transform.js @@ -74,7 +74,7 @@ function buildDataFrameGetDataFrameTransform (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/data_frame.get_data_frame_transform_stats.js b/api/api/data_frame.get_data_frame_transform_stats.js index 027ff31ba..c11e1e94b 100644 --- a/api/api/data_frame.get_data_frame_transform_stats.js +++ b/api/api/data_frame.get_data_frame_transform_stats.js @@ -74,7 +74,7 @@ function buildDataFrameGetDataFrameTransformStats (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/data_frame.preview_data_frame_transform.js b/api/api/data_frame.preview_data_frame_transform.js index 2a81a4226..c51772d8f 100644 --- a/api/api/data_frame.preview_data_frame_transform.js +++ b/api/api/data_frame.preview_data_frame_transform.js @@ -71,7 +71,7 @@ function buildDataFramePreviewDataFrameTransform (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/data_frame.put_data_frame_transform.js b/api/api/data_frame.put_data_frame_transform.js index d14b7435c..30993de05 100644 --- a/api/api/data_frame.put_data_frame_transform.js +++ b/api/api/data_frame.put_data_frame_transform.js @@ -76,7 +76,7 @@ function buildDataFramePutDataFrameTransform (opts) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/data_frame.start_data_frame_transform.js b/api/api/data_frame.start_data_frame_transform.js index 9728343ef..2bffd5d50 100644 --- a/api/api/data_frame.start_data_frame_transform.js +++ b/api/api/data_frame.start_data_frame_transform.js @@ -76,7 +76,7 @@ function buildDataFrameStartDataFrameTransform (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/data_frame.stop_data_frame_transform.js b/api/api/data_frame.stop_data_frame_transform.js index 868f72b7b..87ee0929f 100644 --- a/api/api/data_frame.stop_data_frame_transform.js +++ b/api/api/data_frame.stop_data_frame_transform.js @@ -79,7 +79,7 @@ function buildDataFrameStopDataFrameTransform (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/delete.js b/api/api/delete.js index 7ce5d9b06..1a02977e2 100644 --- a/api/api/delete.js +++ b/api/api/delete.js @@ -108,7 +108,7 @@ function buildDelete (opts) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/delete_by_query.js b/api/api/delete_by_query.js index 52a4a8850..c760a1dab 100644 --- a/api/api/delete_by_query.js +++ b/api/api/delete_by_query.js @@ -167,7 +167,7 @@ function buildDeleteByQuery (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/delete_by_query_rethrottle.js b/api/api/delete_by_query_rethrottle.js index 3c7759916..6759b1d4a 100644 --- a/api/api/delete_by_query_rethrottle.js +++ b/api/api/delete_by_query_rethrottle.js @@ -87,7 +87,7 @@ function buildDeleteByQueryRethrottle (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/delete_script.js b/api/api/delete_script.js index b1d15756f..4efd049d2 100644 --- a/api/api/delete_script.js +++ b/api/api/delete_script.js @@ -85,7 +85,7 @@ function buildDeleteScript (opts) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/exists.js b/api/api/exists.js index 92a6c4322..b0647a16d 100644 --- a/api/api/exists.js +++ b/api/api/exists.js @@ -112,7 +112,7 @@ function buildExists (opts) { method = 'HEAD' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/exists_source.js b/api/api/exists_source.js index 7ec88e867..1d94e75d1 100644 --- a/api/api/exists_source.js +++ b/api/api/exists_source.js @@ -118,7 +118,7 @@ function buildExistsSource (opts) { method = 'HEAD' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/explain.js b/api/api/explain.js index e0447ef30..ef8c82a9b 100644 --- a/api/api/explain.js +++ b/api/api/explain.js @@ -114,7 +114,7 @@ function buildExplain (opts) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/field_caps.js b/api/api/field_caps.js index a4843f046..d30fbe70b 100644 --- a/api/api/field_caps.js +++ b/api/api/field_caps.js @@ -90,7 +90,7 @@ function buildFieldCaps (opts) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/get.js b/api/api/get.js index d512b2d5a..38d95b1c0 100644 --- a/api/api/get.js +++ b/api/api/get.js @@ -112,7 +112,7 @@ function buildGet (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/get_script.js b/api/api/get_script.js index af1b23054..b02c02455 100644 --- a/api/api/get_script.js +++ b/api/api/get_script.js @@ -83,7 +83,7 @@ function buildGetScript (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/get_source.js b/api/api/get_source.js index be536d155..c74c9f6aa 100644 --- a/api/api/get_source.js +++ b/api/api/get_source.js @@ -109,7 +109,7 @@ function buildGetSource (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/graph.explore.js b/api/api/graph.explore.js index 994bcb835..2f626c42b 100644 --- a/api/api/graph.explore.js +++ b/api/api/graph.explore.js @@ -76,7 +76,7 @@ function buildGraphExplore (opts) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ilm.delete_lifecycle.js b/api/api/ilm.delete_lifecycle.js index fa0af34b2..6ae64f5ae 100644 --- a/api/api/ilm.delete_lifecycle.js +++ b/api/api/ilm.delete_lifecycle.js @@ -71,7 +71,7 @@ function buildIlmDeleteLifecycle (opts) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ilm.explain_lifecycle.js b/api/api/ilm.explain_lifecycle.js index 51a931853..7317c5af5 100644 --- a/api/api/ilm.explain_lifecycle.js +++ b/api/api/ilm.explain_lifecycle.js @@ -71,7 +71,7 @@ function buildIlmExplainLifecycle (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ilm.get_lifecycle.js b/api/api/ilm.get_lifecycle.js index a029fae4f..05050040c 100644 --- a/api/api/ilm.get_lifecycle.js +++ b/api/api/ilm.get_lifecycle.js @@ -71,7 +71,7 @@ function buildIlmGetLifecycle (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ilm.get_status.js b/api/api/ilm.get_status.js index 4745f6f8c..5cbb2bc12 100644 --- a/api/api/ilm.get_status.js +++ b/api/api/ilm.get_status.js @@ -70,7 +70,7 @@ function buildIlmGetStatus (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ilm.move_to_step.js b/api/api/ilm.move_to_step.js index a55e2e519..3f699d25d 100644 --- a/api/api/ilm.move_to_step.js +++ b/api/api/ilm.move_to_step.js @@ -66,7 +66,7 @@ function buildIlmMoveToStep (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ilm.put_lifecycle.js b/api/api/ilm.put_lifecycle.js index b103a2aa7..8f875547a 100644 --- a/api/api/ilm.put_lifecycle.js +++ b/api/api/ilm.put_lifecycle.js @@ -66,7 +66,7 @@ function buildIlmPutLifecycle (opts) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ilm.remove_policy.js b/api/api/ilm.remove_policy.js index faac2af2d..0ad388fc0 100644 --- a/api/api/ilm.remove_policy.js +++ b/api/api/ilm.remove_policy.js @@ -71,7 +71,7 @@ function buildIlmRemovePolicy (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ilm.retry.js b/api/api/ilm.retry.js index 60aac54b0..30ee6a8ea 100644 --- a/api/api/ilm.retry.js +++ b/api/api/ilm.retry.js @@ -71,7 +71,7 @@ function buildIlmRetry (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ilm.start.js b/api/api/ilm.start.js index 4ebf60bfa..2dcd08d4b 100644 --- a/api/api/ilm.start.js +++ b/api/api/ilm.start.js @@ -70,7 +70,7 @@ function buildIlmStart (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ilm.stop.js b/api/api/ilm.stop.js index 08f700c2d..d22d2491a 100644 --- a/api/api/ilm.stop.js +++ b/api/api/ilm.stop.js @@ -70,7 +70,7 @@ function buildIlmStop (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/index.js b/api/api/index.js index 3b050d360..4dbb666d9 100644 --- a/api/api/index.js +++ b/api/api/index.js @@ -110,7 +110,7 @@ function buildIndex (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/indices.analyze.js b/api/api/indices.analyze.js index ac35c577e..718a3e094 100644 --- a/api/api/indices.analyze.js +++ b/api/api/indices.analyze.js @@ -73,7 +73,7 @@ function buildIndicesAnalyze (opts) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/indices.clear_cache.js b/api/api/indices.clear_cache.js index 1738fb605..ee4dc3f9c 100644 --- a/api/api/indices.clear_cache.js +++ b/api/api/indices.clear_cache.js @@ -95,7 +95,7 @@ function buildIndicesClearCache (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/indices.close.js b/api/api/indices.close.js index 9ceffe482..f5be95a27 100644 --- a/api/api/indices.close.js +++ b/api/api/indices.close.js @@ -97,7 +97,7 @@ function buildIndicesClose (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/indices.create.js b/api/api/indices.create.js index 61aeea7d2..1005977d0 100644 --- a/api/api/indices.create.js +++ b/api/api/indices.create.js @@ -88,7 +88,7 @@ function buildIndicesCreate (opts) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/indices.delete.js b/api/api/indices.delete.js index 49214d04c..277ecd916 100644 --- a/api/api/indices.delete.js +++ b/api/api/indices.delete.js @@ -94,7 +94,7 @@ function buildIndicesDelete (opts) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/indices.delete_alias.js b/api/api/indices.delete_alias.js index 8a0d9b730..b32076509 100644 --- a/api/api/indices.delete_alias.js +++ b/api/api/indices.delete_alias.js @@ -96,7 +96,7 @@ function buildIndicesDeleteAlias (opts) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/indices.delete_template.js b/api/api/indices.delete_template.js index d19459368..2304f0127 100644 --- a/api/api/indices.delete_template.js +++ b/api/api/indices.delete_template.js @@ -85,7 +85,7 @@ function buildIndicesDeleteTemplate (opts) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/indices.exists.js b/api/api/indices.exists.js index f7978bd10..72386351a 100644 --- a/api/api/indices.exists.js +++ b/api/api/indices.exists.js @@ -97,7 +97,7 @@ function buildIndicesExists (opts) { method = 'HEAD' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/indices.exists_alias.js b/api/api/indices.exists_alias.js index 0034bf8b5..a86badbf2 100644 --- a/api/api/indices.exists_alias.js +++ b/api/api/indices.exists_alias.js @@ -92,7 +92,7 @@ function buildIndicesExistsAlias (opts) { method = 'HEAD' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/indices.exists_template.js b/api/api/indices.exists_template.js index 55b881591..e05a64740 100644 --- a/api/api/indices.exists_template.js +++ b/api/api/indices.exists_template.js @@ -88,7 +88,7 @@ function buildIndicesExistsTemplate (opts) { method = 'HEAD' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/indices.exists_type.js b/api/api/indices.exists_type.js index acacc729e..b7adfa719 100644 --- a/api/api/indices.exists_type.js +++ b/api/api/indices.exists_type.js @@ -102,7 +102,7 @@ function buildIndicesExistsType (opts) { method = 'HEAD' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/indices.flush.js b/api/api/indices.flush.js index 020fc4831..cb4712260 100644 --- a/api/api/indices.flush.js +++ b/api/api/indices.flush.js @@ -90,7 +90,7 @@ function buildIndicesFlush (opts) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/indices.flush_synced.js b/api/api/indices.flush_synced.js index 9794eb2d5..239e07b20 100644 --- a/api/api/indices.flush_synced.js +++ b/api/api/indices.flush_synced.js @@ -85,7 +85,7 @@ function buildIndicesFlushSynced (opts) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/indices.forcemerge.js b/api/api/indices.forcemerge.js index ab3747ef8..175d010ae 100644 --- a/api/api/indices.forcemerge.js +++ b/api/api/indices.forcemerge.js @@ -93,7 +93,7 @@ function buildIndicesForcemerge (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/indices.freeze.js b/api/api/indices.freeze.js index a11b21dec..b5e239f45 100644 --- a/api/api/indices.freeze.js +++ b/api/api/indices.freeze.js @@ -90,7 +90,7 @@ function buildIndicesFreeze (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/indices.get.js b/api/api/indices.get.js index 270ed8884..4aa5f5bae 100644 --- a/api/api/indices.get.js +++ b/api/api/indices.get.js @@ -103,7 +103,7 @@ function buildIndicesGet (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/indices.get_alias.js b/api/api/indices.get_alias.js index 01085e8bf..e462915ae 100644 --- a/api/api/indices.get_alias.js +++ b/api/api/indices.get_alias.js @@ -88,7 +88,7 @@ function buildIndicesGetAlias (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/indices.get_field_mapping.js b/api/api/indices.get_field_mapping.js index eb123b9e3..1c2df81ef 100644 --- a/api/api/indices.get_field_mapping.js +++ b/api/api/indices.get_field_mapping.js @@ -99,7 +99,7 @@ function buildIndicesGetFieldMapping (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/indices.get_mapping.js b/api/api/indices.get_mapping.js index 03abea27a..a6b004ee4 100644 --- a/api/api/indices.get_mapping.js +++ b/api/api/indices.get_mapping.js @@ -94,7 +94,7 @@ function buildIndicesGetMapping (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/indices.get_settings.js b/api/api/indices.get_settings.js index 708a6909a..8d876e932 100644 --- a/api/api/indices.get_settings.js +++ b/api/api/indices.get_settings.js @@ -97,7 +97,7 @@ function buildIndicesGetSettings (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/indices.get_template.js b/api/api/indices.get_template.js index b458cb8fd..31e49a339 100644 --- a/api/api/indices.get_template.js +++ b/api/api/indices.get_template.js @@ -87,7 +87,7 @@ function buildIndicesGetTemplate (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/indices.get_upgrade.js b/api/api/indices.get_upgrade.js index a38397963..61f9bc4dd 100644 --- a/api/api/indices.get_upgrade.js +++ b/api/api/indices.get_upgrade.js @@ -85,7 +85,7 @@ function buildIndicesGetUpgrade (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/indices.open.js b/api/api/indices.open.js index 3e3f1740d..7a77de7dd 100644 --- a/api/api/indices.open.js +++ b/api/api/indices.open.js @@ -97,7 +97,7 @@ function buildIndicesOpen (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/indices.put_alias.js b/api/api/indices.put_alias.js index 47352d607..d38dd6d83 100644 --- a/api/api/indices.put_alias.js +++ b/api/api/indices.put_alias.js @@ -93,7 +93,7 @@ function buildIndicesPutAlias (opts) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/indices.put_mapping.js b/api/api/indices.put_mapping.js index 4743a34a4..561274e12 100644 --- a/api/api/indices.put_mapping.js +++ b/api/api/indices.put_mapping.js @@ -95,7 +95,7 @@ function buildIndicesPutMapping (opts) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/indices.put_settings.js b/api/api/indices.put_settings.js index 01a82b782..82984834d 100644 --- a/api/api/indices.put_settings.js +++ b/api/api/indices.put_settings.js @@ -97,7 +97,7 @@ function buildIndicesPutSettings (opts) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/indices.put_template.js b/api/api/indices.put_template.js index e55d4a565..12c08451f 100644 --- a/api/api/indices.put_template.js +++ b/api/api/indices.put_template.js @@ -96,7 +96,7 @@ function buildIndicesPutTemplate (opts) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/indices.recovery.js b/api/api/indices.recovery.js index 7da92f059..f373a3236 100644 --- a/api/api/indices.recovery.js +++ b/api/api/indices.recovery.js @@ -81,7 +81,7 @@ function buildIndicesRecovery (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/indices.refresh.js b/api/api/indices.refresh.js index 63a490367..7f11d2faa 100644 --- a/api/api/indices.refresh.js +++ b/api/api/indices.refresh.js @@ -85,7 +85,7 @@ function buildIndicesRefresh (opts) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/indices.rollover.js b/api/api/indices.rollover.js index 2f7a95336..bb5e45ebe 100644 --- a/api/api/indices.rollover.js +++ b/api/api/indices.rollover.js @@ -98,7 +98,7 @@ function buildIndicesRollover (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/indices.segments.js b/api/api/indices.segments.js index 41e2a6b1b..aabd9e7df 100644 --- a/api/api/indices.segments.js +++ b/api/api/indices.segments.js @@ -87,7 +87,7 @@ function buildIndicesSegments (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/indices.shard_stores.js b/api/api/indices.shard_stores.js index 923c22f93..dccc29561 100644 --- a/api/api/indices.shard_stores.js +++ b/api/api/indices.shard_stores.js @@ -87,7 +87,7 @@ function buildIndicesShardStores (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/indices.shrink.js b/api/api/indices.shrink.js index 6cc2f7602..b3e42dcbe 100644 --- a/api/api/indices.shrink.js +++ b/api/api/indices.shrink.js @@ -96,7 +96,7 @@ function buildIndicesShrink (opts) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/indices.split.js b/api/api/indices.split.js index 8070e96d6..bbf9c25e9 100644 --- a/api/api/indices.split.js +++ b/api/api/indices.split.js @@ -96,7 +96,7 @@ function buildIndicesSplit (opts) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/indices.stats.js b/api/api/indices.stats.js index 764a2f46f..581dd8815 100644 --- a/api/api/indices.stats.js +++ b/api/api/indices.stats.js @@ -103,7 +103,7 @@ function buildIndicesStats (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/indices.unfreeze.js b/api/api/indices.unfreeze.js index 6eefcdf80..6004938fa 100644 --- a/api/api/indices.unfreeze.js +++ b/api/api/indices.unfreeze.js @@ -90,7 +90,7 @@ function buildIndicesUnfreeze (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/indices.update_aliases.js b/api/api/indices.update_aliases.js index 468aaffe4..69836c820 100644 --- a/api/api/indices.update_aliases.js +++ b/api/api/indices.update_aliases.js @@ -81,7 +81,7 @@ function buildIndicesUpdateAliases (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/indices.upgrade.js b/api/api/indices.upgrade.js index 392424957..72cba50ca 100644 --- a/api/api/indices.upgrade.js +++ b/api/api/indices.upgrade.js @@ -91,7 +91,7 @@ function buildIndicesUpgrade (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/indices.validate_query.js b/api/api/indices.validate_query.js index 642726ade..4615cd2eb 100644 --- a/api/api/indices.validate_query.js +++ b/api/api/indices.validate_query.js @@ -108,7 +108,7 @@ function buildIndicesValidateQuery (opts) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/info.js b/api/api/info.js index d62bf1455..b43a6c1d3 100644 --- a/api/api/info.js +++ b/api/api/info.js @@ -75,7 +75,7 @@ function buildInfo (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ingest.delete_pipeline.js b/api/api/ingest.delete_pipeline.js index 12b51f75c..a03e89b05 100644 --- a/api/api/ingest.delete_pipeline.js +++ b/api/api/ingest.delete_pipeline.js @@ -85,7 +85,7 @@ function buildIngestDeletePipeline (opts) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ingest.get_pipeline.js b/api/api/ingest.get_pipeline.js index bc03b7fa8..ce094a2c4 100644 --- a/api/api/ingest.get_pipeline.js +++ b/api/api/ingest.get_pipeline.js @@ -79,7 +79,7 @@ function buildIngestGetPipeline (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ingest.processor_grok.js b/api/api/ingest.processor_grok.js index 9e3f61e09..697356aa9 100644 --- a/api/api/ingest.processor_grok.js +++ b/api/api/ingest.processor_grok.js @@ -75,7 +75,7 @@ function buildIngestProcessorGrok (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ingest.put_pipeline.js b/api/api/ingest.put_pipeline.js index bfed81790..f20822d7d 100644 --- a/api/api/ingest.put_pipeline.js +++ b/api/api/ingest.put_pipeline.js @@ -86,7 +86,7 @@ function buildIngestPutPipeline (opts) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ingest.simulate.js b/api/api/ingest.simulate.js index b13992a66..7a1374d31 100644 --- a/api/api/ingest.simulate.js +++ b/api/api/ingest.simulate.js @@ -79,7 +79,7 @@ function buildIngestSimulate (opts) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/license.delete.js b/api/api/license.delete.js index 05060956f..cce9d75e5 100644 --- a/api/api/license.delete.js +++ b/api/api/license.delete.js @@ -70,7 +70,7 @@ function buildLicenseDelete (opts) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/license.get.js b/api/api/license.get.js index 31b7cd870..ae139fffd 100644 --- a/api/api/license.get.js +++ b/api/api/license.get.js @@ -71,7 +71,7 @@ function buildLicenseGet (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/license.get_basic_status.js b/api/api/license.get_basic_status.js index a552e215a..ec41252bf 100644 --- a/api/api/license.get_basic_status.js +++ b/api/api/license.get_basic_status.js @@ -70,7 +70,7 @@ function buildLicenseGetBasicStatus (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/license.get_trial_status.js b/api/api/license.get_trial_status.js index 66e88862d..af6b35917 100644 --- a/api/api/license.get_trial_status.js +++ b/api/api/license.get_trial_status.js @@ -70,7 +70,7 @@ function buildLicenseGetTrialStatus (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/license.post.js b/api/api/license.post.js index d318687f5..0c1ac7d07 100644 --- a/api/api/license.post.js +++ b/api/api/license.post.js @@ -66,7 +66,7 @@ function buildLicensePost (opts) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/license.post_start_basic.js b/api/api/license.post_start_basic.js index c3bcda3da..5fa1373fb 100644 --- a/api/api/license.post_start_basic.js +++ b/api/api/license.post_start_basic.js @@ -71,7 +71,7 @@ function buildLicensePostStartBasic (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/license.post_start_trial.js b/api/api/license.post_start_trial.js index 0e24eea1c..d68c00f90 100644 --- a/api/api/license.post_start_trial.js +++ b/api/api/license.post_start_trial.js @@ -73,7 +73,7 @@ function buildLicensePostStartTrial (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/mget.js b/api/api/mget.js index cd1faaa3e..7a0b5ee4c 100644 --- a/api/api/mget.js +++ b/api/api/mget.js @@ -103,7 +103,7 @@ function buildMget (opts) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/migration.deprecations.js b/api/api/migration.deprecations.js index 0c8696576..e074c1bdb 100644 --- a/api/api/migration.deprecations.js +++ b/api/api/migration.deprecations.js @@ -71,7 +71,7 @@ function buildMigrationDeprecations (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ml.close_job.js b/api/api/ml.close_job.js index 2aa6b8d23..361d14971 100644 --- a/api/api/ml.close_job.js +++ b/api/api/ml.close_job.js @@ -78,7 +78,7 @@ function buildMlCloseJob (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ml.delete_calendar.js b/api/api/ml.delete_calendar.js index 06de541a2..71f7505f8 100644 --- a/api/api/ml.delete_calendar.js +++ b/api/api/ml.delete_calendar.js @@ -75,7 +75,7 @@ function buildMlDeleteCalendar (opts) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ml.delete_calendar_event.js b/api/api/ml.delete_calendar_event.js index 1b44f246f..cd4d751d3 100644 --- a/api/api/ml.delete_calendar_event.js +++ b/api/api/ml.delete_calendar_event.js @@ -86,7 +86,7 @@ function buildMlDeleteCalendarEvent (opts) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ml.delete_calendar_job.js b/api/api/ml.delete_calendar_job.js index 5e361f407..19823d1af 100644 --- a/api/api/ml.delete_calendar_job.js +++ b/api/api/ml.delete_calendar_job.js @@ -86,7 +86,7 @@ function buildMlDeleteCalendarJob (opts) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ml.delete_datafeed.js b/api/api/ml.delete_datafeed.js index 8efcdd073..e245dbbb7 100644 --- a/api/api/ml.delete_datafeed.js +++ b/api/api/ml.delete_datafeed.js @@ -76,7 +76,7 @@ function buildMlDeleteDatafeed (opts) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ml.delete_expired_data.js b/api/api/ml.delete_expired_data.js index 8c0c5e5e5..c2c5edca7 100644 --- a/api/api/ml.delete_expired_data.js +++ b/api/api/ml.delete_expired_data.js @@ -70,7 +70,7 @@ function buildMlDeleteExpiredData (opts) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ml.delete_filter.js b/api/api/ml.delete_filter.js index e092b9b30..46ae221ab 100644 --- a/api/api/ml.delete_filter.js +++ b/api/api/ml.delete_filter.js @@ -75,7 +75,7 @@ function buildMlDeleteFilter (opts) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ml.delete_forecast.js b/api/api/ml.delete_forecast.js index 56db9627b..1b6616590 100644 --- a/api/api/ml.delete_forecast.js +++ b/api/api/ml.delete_forecast.js @@ -86,7 +86,7 @@ function buildMlDeleteForecast (opts) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ml.delete_job.js b/api/api/ml.delete_job.js index d836b820a..dae7db48c 100644 --- a/api/api/ml.delete_job.js +++ b/api/api/ml.delete_job.js @@ -78,7 +78,7 @@ function buildMlDeleteJob (opts) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ml.delete_model_snapshot.js b/api/api/ml.delete_model_snapshot.js index 63f2888aa..6f5cb1c43 100644 --- a/api/api/ml.delete_model_snapshot.js +++ b/api/api/ml.delete_model_snapshot.js @@ -86,7 +86,7 @@ function buildMlDeleteModelSnapshot (opts) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ml.find_file_structure.js b/api/api/ml.find_file_structure.js index ce7419b6b..eee5b0e56 100644 --- a/api/api/ml.find_file_structure.js +++ b/api/api/ml.find_file_structure.js @@ -103,7 +103,7 @@ function buildMlFindFileStructure (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ml.flush_job.js b/api/api/ml.flush_job.js index 262ddea60..670aa49a5 100644 --- a/api/api/ml.flush_job.js +++ b/api/api/ml.flush_job.js @@ -83,7 +83,7 @@ function buildMlFlushJob (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ml.forecast.js b/api/api/ml.forecast.js index 05c2d3f25..ce19e9e65 100644 --- a/api/api/ml.forecast.js +++ b/api/api/ml.forecast.js @@ -78,7 +78,7 @@ function buildMlForecast (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ml.get_buckets.js b/api/api/ml.get_buckets.js index 5c36a4bf7..4e8a3e68d 100644 --- a/api/api/ml.get_buckets.js +++ b/api/api/ml.get_buckets.js @@ -98,7 +98,7 @@ function buildMlGetBuckets (opts) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ml.get_calendar_events.js b/api/api/ml.get_calendar_events.js index ac3a7ed2c..45752948d 100644 --- a/api/api/ml.get_calendar_events.js +++ b/api/api/ml.get_calendar_events.js @@ -85,7 +85,7 @@ function buildMlGetCalendarEvents (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ml.get_calendars.js b/api/api/ml.get_calendars.js index edacda0cb..549f5530f 100644 --- a/api/api/ml.get_calendars.js +++ b/api/api/ml.get_calendars.js @@ -69,7 +69,7 @@ function buildMlGetCalendars (opts) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ml.get_categories.js b/api/api/ml.get_categories.js index dc263c8b1..381ebb54c 100644 --- a/api/api/ml.get_categories.js +++ b/api/api/ml.get_categories.js @@ -76,7 +76,7 @@ function buildMlGetCategories (opts) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ml.get_datafeed_stats.js b/api/api/ml.get_datafeed_stats.js index c32e9d76a..4f042ce05 100644 --- a/api/api/ml.get_datafeed_stats.js +++ b/api/api/ml.get_datafeed_stats.js @@ -72,7 +72,7 @@ function buildMlGetDatafeedStats (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ml.get_datafeeds.js b/api/api/ml.get_datafeeds.js index 01f9f4653..709418c6a 100644 --- a/api/api/ml.get_datafeeds.js +++ b/api/api/ml.get_datafeeds.js @@ -72,7 +72,7 @@ function buildMlGetDatafeeds (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ml.get_filters.js b/api/api/ml.get_filters.js index 93e70583e..bac797feb 100644 --- a/api/api/ml.get_filters.js +++ b/api/api/ml.get_filters.js @@ -74,7 +74,7 @@ function buildMlGetFilters (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ml.get_influencers.js b/api/api/ml.get_influencers.js index 09d7c4dfb..e128965d1 100644 --- a/api/api/ml.get_influencers.js +++ b/api/api/ml.get_influencers.js @@ -89,7 +89,7 @@ function buildMlGetInfluencers (opts) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ml.get_job_stats.js b/api/api/ml.get_job_stats.js index bd9f72eb5..af2096023 100644 --- a/api/api/ml.get_job_stats.js +++ b/api/api/ml.get_job_stats.js @@ -72,7 +72,7 @@ function buildMlGetJobStats (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ml.get_jobs.js b/api/api/ml.get_jobs.js index 3dbf536ef..a61691dff 100644 --- a/api/api/ml.get_jobs.js +++ b/api/api/ml.get_jobs.js @@ -72,7 +72,7 @@ function buildMlGetJobs (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ml.get_model_snapshots.js b/api/api/ml.get_model_snapshots.js index a89562d29..efc1b770c 100644 --- a/api/api/ml.get_model_snapshots.js +++ b/api/api/ml.get_model_snapshots.js @@ -90,7 +90,7 @@ function buildMlGetModelSnapshots (opts) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ml.get_overall_buckets.js b/api/api/ml.get_overall_buckets.js index becd01c56..03798dbe4 100644 --- a/api/api/ml.get_overall_buckets.js +++ b/api/api/ml.get_overall_buckets.js @@ -89,7 +89,7 @@ function buildMlGetOverallBuckets (opts) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ml.get_records.js b/api/api/ml.get_records.js index 966c0d591..00cdbf7ec 100644 --- a/api/api/ml.get_records.js +++ b/api/api/ml.get_records.js @@ -89,7 +89,7 @@ function buildMlGetRecords (opts) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ml.info.js b/api/api/ml.info.js index 8e2cf5c70..f21bbc95d 100644 --- a/api/api/ml.info.js +++ b/api/api/ml.info.js @@ -64,7 +64,7 @@ function buildMlInfo (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ml.open_job.js b/api/api/ml.open_job.js index 05610b894..a5bb89244 100644 --- a/api/api/ml.open_job.js +++ b/api/api/ml.open_job.js @@ -77,7 +77,7 @@ function buildMlOpenJob (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ml.post_calendar_events.js b/api/api/ml.post_calendar_events.js index 0f7c9f435..17112d594 100644 --- a/api/api/ml.post_calendar_events.js +++ b/api/api/ml.post_calendar_events.js @@ -76,7 +76,7 @@ function buildMlPostCalendarEvents (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ml.post_data.js b/api/api/ml.post_data.js index 6c1105a81..54d5dba4d 100644 --- a/api/api/ml.post_data.js +++ b/api/api/ml.post_data.js @@ -80,7 +80,7 @@ function buildMlPostData (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ml.preview_datafeed.js b/api/api/ml.preview_datafeed.js index 2814ffdf5..e4e64c0f6 100644 --- a/api/api/ml.preview_datafeed.js +++ b/api/api/ml.preview_datafeed.js @@ -75,7 +75,7 @@ function buildMlPreviewDatafeed (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ml.put_calendar.js b/api/api/ml.put_calendar.js index 39621616d..f3bf2a1a6 100644 --- a/api/api/ml.put_calendar.js +++ b/api/api/ml.put_calendar.js @@ -72,7 +72,7 @@ function buildMlPutCalendar (opts) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ml.put_calendar_job.js b/api/api/ml.put_calendar_job.js index f8db0b6c5..87fecf728 100644 --- a/api/api/ml.put_calendar_job.js +++ b/api/api/ml.put_calendar_job.js @@ -86,7 +86,7 @@ function buildMlPutCalendarJob (opts) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ml.put_datafeed.js b/api/api/ml.put_datafeed.js index 4c796b653..14745042c 100644 --- a/api/api/ml.put_datafeed.js +++ b/api/api/ml.put_datafeed.js @@ -76,7 +76,7 @@ function buildMlPutDatafeed (opts) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ml.put_filter.js b/api/api/ml.put_filter.js index 3040f3261..3ce82f6b8 100644 --- a/api/api/ml.put_filter.js +++ b/api/api/ml.put_filter.js @@ -76,7 +76,7 @@ function buildMlPutFilter (opts) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ml.put_job.js b/api/api/ml.put_job.js index 55f441d3b..45ce0d481 100644 --- a/api/api/ml.put_job.js +++ b/api/api/ml.put_job.js @@ -76,7 +76,7 @@ function buildMlPutJob (opts) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ml.revert_model_snapshot.js b/api/api/ml.revert_model_snapshot.js index 20a858212..9b9f7b3d4 100644 --- a/api/api/ml.revert_model_snapshot.js +++ b/api/api/ml.revert_model_snapshot.js @@ -84,7 +84,7 @@ function buildMlRevertModelSnapshot (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ml.set_upgrade_mode.js b/api/api/ml.set_upgrade_mode.js index 1e098d7b8..cae1b7cbf 100644 --- a/api/api/ml.set_upgrade_mode.js +++ b/api/api/ml.set_upgrade_mode.js @@ -73,7 +73,7 @@ function buildMlSetUpgradeMode (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ml.start_datafeed.js b/api/api/ml.start_datafeed.js index 773f47ae1..ade441af4 100644 --- a/api/api/ml.start_datafeed.js +++ b/api/api/ml.start_datafeed.js @@ -77,7 +77,7 @@ function buildMlStartDatafeed (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ml.stop_datafeed.js b/api/api/ml.stop_datafeed.js index 3284f8fbe..61ce3876d 100644 --- a/api/api/ml.stop_datafeed.js +++ b/api/api/ml.stop_datafeed.js @@ -77,7 +77,7 @@ function buildMlStopDatafeed (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ml.update_datafeed.js b/api/api/ml.update_datafeed.js index 33160a97c..492310dfa 100644 --- a/api/api/ml.update_datafeed.js +++ b/api/api/ml.update_datafeed.js @@ -76,7 +76,7 @@ function buildMlUpdateDatafeed (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ml.update_filter.js b/api/api/ml.update_filter.js index 7596e282a..03e03b014 100644 --- a/api/api/ml.update_filter.js +++ b/api/api/ml.update_filter.js @@ -76,7 +76,7 @@ function buildMlUpdateFilter (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ml.update_job.js b/api/api/ml.update_job.js index df5701bd5..d51325d13 100644 --- a/api/api/ml.update_job.js +++ b/api/api/ml.update_job.js @@ -76,7 +76,7 @@ function buildMlUpdateJob (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ml.update_model_snapshot.js b/api/api/ml.update_model_snapshot.js index 451d16177..117cb7fb0 100644 --- a/api/api/ml.update_model_snapshot.js +++ b/api/api/ml.update_model_snapshot.js @@ -87,7 +87,7 @@ function buildMlUpdateModelSnapshot (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ml.validate.js b/api/api/ml.validate.js index e67d65f10..3f3ca43f4 100644 --- a/api/api/ml.validate.js +++ b/api/api/ml.validate.js @@ -71,7 +71,7 @@ function buildMlValidate (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ml.validate_detector.js b/api/api/ml.validate_detector.js index 3bf4d5a53..8dcea86d3 100644 --- a/api/api/ml.validate_detector.js +++ b/api/api/ml.validate_detector.js @@ -71,7 +71,7 @@ function buildMlValidateDetector (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/monitoring.bulk.js b/api/api/monitoring.bulk.js index 4819e81ba..872e48e1d 100644 --- a/api/api/monitoring.bulk.js +++ b/api/api/monitoring.bulk.js @@ -79,7 +79,7 @@ function buildMonitoringBulk (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/msearch.js b/api/api/msearch.js index 648a022d5..668ec0a6f 100644 --- a/api/api/msearch.js +++ b/api/api/msearch.js @@ -105,7 +105,7 @@ function buildMsearch (opts) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/msearch_template.js b/api/api/msearch_template.js index 1ccd25d07..2a6cb3514 100644 --- a/api/api/msearch_template.js +++ b/api/api/msearch_template.js @@ -99,7 +99,7 @@ function buildMsearchTemplate (opts) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/mtermvectors.js b/api/api/mtermvectors.js index e7a099142..92d14c93c 100644 --- a/api/api/mtermvectors.js +++ b/api/api/mtermvectors.js @@ -107,7 +107,7 @@ function buildMtermvectors (opts) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/nodes.hot_threads.js b/api/api/nodes.hot_threads.js index 1fca9889e..44e3688f7 100644 --- a/api/api/nodes.hot_threads.js +++ b/api/api/nodes.hot_threads.js @@ -89,7 +89,7 @@ function buildNodesHotThreads (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/nodes.info.js b/api/api/nodes.info.js index e3d9187eb..26e7421ea 100644 --- a/api/api/nodes.info.js +++ b/api/api/nodes.info.js @@ -82,7 +82,7 @@ function buildNodesInfo (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/nodes.reload_secure_settings.js b/api/api/nodes.reload_secure_settings.js index 1223e9f53..948910a44 100644 --- a/api/api/nodes.reload_secure_settings.js +++ b/api/api/nodes.reload_secure_settings.js @@ -78,7 +78,7 @@ function buildNodesReloadSecureSettings (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/nodes.stats.js b/api/api/nodes.stats.js index 248971842..7a8a1db36 100644 --- a/api/api/nodes.stats.js +++ b/api/api/nodes.stats.js @@ -97,7 +97,7 @@ function buildNodesStats (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/nodes.usage.js b/api/api/nodes.usage.js index b41f5d15b..159b09f7c 100644 --- a/api/api/nodes.usage.js +++ b/api/api/nodes.usage.js @@ -79,7 +79,7 @@ function buildNodesUsage (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ping.js b/api/api/ping.js index 503b059e5..7aa59fb5e 100644 --- a/api/api/ping.js +++ b/api/api/ping.js @@ -75,7 +75,7 @@ function buildPing (opts) { method = 'HEAD' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/put_script.js b/api/api/put_script.js index f045faa20..9f17d8316 100644 --- a/api/api/put_script.js +++ b/api/api/put_script.js @@ -95,7 +95,7 @@ function buildPutScript (opts) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/rank_eval.js b/api/api/rank_eval.js index 05d75f642..98242a4cd 100644 --- a/api/api/rank_eval.js +++ b/api/api/rank_eval.js @@ -86,7 +86,7 @@ function buildRankEval (opts) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/reindex.js b/api/api/reindex.js index 177137075..85722b4ce 100644 --- a/api/api/reindex.js +++ b/api/api/reindex.js @@ -93,7 +93,7 @@ function buildReindex (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/reindex_rethrottle.js b/api/api/reindex_rethrottle.js index 97ea781df..7f9e0bc67 100644 --- a/api/api/reindex_rethrottle.js +++ b/api/api/reindex_rethrottle.js @@ -87,7 +87,7 @@ function buildReindexRethrottle (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/render_search_template.js b/api/api/render_search_template.js index ff24164c4..9ec822538 100644 --- a/api/api/render_search_template.js +++ b/api/api/render_search_template.js @@ -71,7 +71,7 @@ function buildRenderSearchTemplate (opts) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/rollup.delete_job.js b/api/api/rollup.delete_job.js index 68bbf440b..a6d7b8800 100644 --- a/api/api/rollup.delete_job.js +++ b/api/api/rollup.delete_job.js @@ -71,7 +71,7 @@ function buildRollupDeleteJob (opts) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/rollup.get_jobs.js b/api/api/rollup.get_jobs.js index b8cb730c4..8bb1f2e71 100644 --- a/api/api/rollup.get_jobs.js +++ b/api/api/rollup.get_jobs.js @@ -65,7 +65,7 @@ function buildRollupGetJobs (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/rollup.get_rollup_caps.js b/api/api/rollup.get_rollup_caps.js index 56139c7af..b0e8d288c 100644 --- a/api/api/rollup.get_rollup_caps.js +++ b/api/api/rollup.get_rollup_caps.js @@ -65,7 +65,7 @@ function buildRollupGetRollupCaps (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/rollup.get_rollup_index_caps.js b/api/api/rollup.get_rollup_index_caps.js index d20022c3f..cde9a275a 100644 --- a/api/api/rollup.get_rollup_index_caps.js +++ b/api/api/rollup.get_rollup_index_caps.js @@ -71,7 +71,7 @@ function buildRollupGetRollupIndexCaps (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/rollup.put_job.js b/api/api/rollup.put_job.js index 5ec296d80..b117f198c 100644 --- a/api/api/rollup.put_job.js +++ b/api/api/rollup.put_job.js @@ -76,7 +76,7 @@ function buildRollupPutJob (opts) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/rollup.rollup_search.js b/api/api/rollup.rollup_search.js index 13519fbad..4310e49f9 100644 --- a/api/api/rollup.rollup_search.js +++ b/api/api/rollup.rollup_search.js @@ -87,7 +87,7 @@ function buildRollupRollupSearch (opts) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/rollup.start_job.js b/api/api/rollup.start_job.js index 2d8d33f33..bf39647a7 100644 --- a/api/api/rollup.start_job.js +++ b/api/api/rollup.start_job.js @@ -71,7 +71,7 @@ function buildRollupStartJob (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/rollup.stop_job.js b/api/api/rollup.stop_job.js index eb7131c84..e4b2e1cc2 100644 --- a/api/api/rollup.stop_job.js +++ b/api/api/rollup.stop_job.js @@ -75,7 +75,7 @@ function buildRollupStopJob (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/scripts_painless_context.js b/api/api/scripts_painless_context.js index 940ee4a28..b10b63ac9 100644 --- a/api/api/scripts_painless_context.js +++ b/api/api/scripts_painless_context.js @@ -71,7 +71,7 @@ function buildScriptsPainlessContext (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/scripts_painless_execute.js b/api/api/scripts_painless_execute.js index aafe11519..db99454e1 100644 --- a/api/api/scripts_painless_execute.js +++ b/api/api/scripts_painless_execute.js @@ -70,7 +70,7 @@ function buildScriptsPainlessExecute (opts) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/scroll.js b/api/api/scroll.js index 29fee4e32..fd9e518c1 100644 --- a/api/api/scroll.js +++ b/api/api/scroll.js @@ -79,7 +79,7 @@ function buildScroll (opts) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/search.js b/api/api/search.js index 9714a6c7b..6a1726ee0 100644 --- a/api/api/search.js +++ b/api/api/search.js @@ -189,7 +189,7 @@ function buildSearch (opts) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/search_shards.js b/api/api/search_shards.js index 61b8d1176..b819d66b2 100644 --- a/api/api/search_shards.js +++ b/api/api/search_shards.js @@ -91,7 +91,7 @@ function buildSearchShards (opts) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/search_template.js b/api/api/search_template.js index f6bb085d6..5b6d53853 100644 --- a/api/api/search_template.js +++ b/api/api/search_template.js @@ -118,7 +118,7 @@ function buildSearchTemplate (opts) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/security.authenticate.js b/api/api/security.authenticate.js index 2704a1259..c2f5ea868 100644 --- a/api/api/security.authenticate.js +++ b/api/api/security.authenticate.js @@ -70,7 +70,7 @@ function buildSecurityAuthenticate (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/security.change_password.js b/api/api/security.change_password.js index 46c25fa0e..831f013a7 100644 --- a/api/api/security.change_password.js +++ b/api/api/security.change_password.js @@ -73,7 +73,7 @@ function buildSecurityChangePassword (opts) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/security.clear_cached_realms.js b/api/api/security.clear_cached_realms.js index 60cf9fa7a..b5483c8c4 100644 --- a/api/api/security.clear_cached_realms.js +++ b/api/api/security.clear_cached_realms.js @@ -76,7 +76,7 @@ function buildSecurityClearCachedRealms (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/security.clear_cached_roles.js b/api/api/security.clear_cached_roles.js index 2d3a5d663..13eee568b 100644 --- a/api/api/security.clear_cached_roles.js +++ b/api/api/security.clear_cached_roles.js @@ -75,7 +75,7 @@ function buildSecurityClearCachedRoles (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/security.create_api_key.js b/api/api/security.create_api_key.js index 4feda504a..a2e6a2e29 100644 --- a/api/api/security.create_api_key.js +++ b/api/api/security.create_api_key.js @@ -72,7 +72,7 @@ function buildSecurityCreateApiKey (opts) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/security.delete_privileges.js b/api/api/security.delete_privileges.js index 0758e7828..72efa3bdd 100644 --- a/api/api/security.delete_privileges.js +++ b/api/api/security.delete_privileges.js @@ -87,7 +87,7 @@ function buildSecurityDeletePrivileges (opts) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/security.delete_role.js b/api/api/security.delete_role.js index 1cdd0baad..6401406c1 100644 --- a/api/api/security.delete_role.js +++ b/api/api/security.delete_role.js @@ -76,7 +76,7 @@ function buildSecurityDeleteRole (opts) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/security.delete_role_mapping.js b/api/api/security.delete_role_mapping.js index 9a935a9e7..b9f69494c 100644 --- a/api/api/security.delete_role_mapping.js +++ b/api/api/security.delete_role_mapping.js @@ -76,7 +76,7 @@ function buildSecurityDeleteRoleMapping (opts) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/security.delete_user.js b/api/api/security.delete_user.js index 936691020..da25eda5e 100644 --- a/api/api/security.delete_user.js +++ b/api/api/security.delete_user.js @@ -76,7 +76,7 @@ function buildSecurityDeleteUser (opts) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/security.disable_user.js b/api/api/security.disable_user.js index 788e83209..c12de072d 100644 --- a/api/api/security.disable_user.js +++ b/api/api/security.disable_user.js @@ -76,7 +76,7 @@ function buildSecurityDisableUser (opts) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/security.enable_user.js b/api/api/security.enable_user.js index fb61f38d6..b59558acb 100644 --- a/api/api/security.enable_user.js +++ b/api/api/security.enable_user.js @@ -76,7 +76,7 @@ function buildSecurityEnableUser (opts) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/security.get_api_key.js b/api/api/security.get_api_key.js index 7456a83b3..eea2eb066 100644 --- a/api/api/security.get_api_key.js +++ b/api/api/security.get_api_key.js @@ -77,7 +77,7 @@ function buildSecurityGetApiKey (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/security.get_privileges.js b/api/api/security.get_privileges.js index 9ddd8685a..5bea2a86c 100644 --- a/api/api/security.get_privileges.js +++ b/api/api/security.get_privileges.js @@ -78,7 +78,7 @@ function buildSecurityGetPrivileges (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/security.get_role.js b/api/api/security.get_role.js index a984e56e2..f4c757bf6 100644 --- a/api/api/security.get_role.js +++ b/api/api/security.get_role.js @@ -71,7 +71,7 @@ function buildSecurityGetRole (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/security.get_role_mapping.js b/api/api/security.get_role_mapping.js index a64c9ef63..fc58769f6 100644 --- a/api/api/security.get_role_mapping.js +++ b/api/api/security.get_role_mapping.js @@ -71,7 +71,7 @@ function buildSecurityGetRoleMapping (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/security.get_token.js b/api/api/security.get_token.js index 749027740..1f4c8c761 100644 --- a/api/api/security.get_token.js +++ b/api/api/security.get_token.js @@ -71,7 +71,7 @@ function buildSecurityGetToken (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/security.get_user.js b/api/api/security.get_user.js index 8658b8b0f..590661f6b 100644 --- a/api/api/security.get_user.js +++ b/api/api/security.get_user.js @@ -71,7 +71,7 @@ function buildSecurityGetUser (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/security.get_user_privileges.js b/api/api/security.get_user_privileges.js index 9199c3a23..dc8e3f803 100644 --- a/api/api/security.get_user_privileges.js +++ b/api/api/security.get_user_privileges.js @@ -70,7 +70,7 @@ function buildSecurityGetUserPrivileges (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/security.has_privileges.js b/api/api/security.has_privileges.js index 4ab9890f4..cea2e5a13 100644 --- a/api/api/security.has_privileges.js +++ b/api/api/security.has_privileges.js @@ -72,7 +72,7 @@ function buildSecurityHasPrivileges (opts) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/security.invalidate_api_key.js b/api/api/security.invalidate_api_key.js index 6006f48a8..16f0bf3f1 100644 --- a/api/api/security.invalidate_api_key.js +++ b/api/api/security.invalidate_api_key.js @@ -71,7 +71,7 @@ function buildSecurityInvalidateApiKey (opts) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/security.invalidate_token.js b/api/api/security.invalidate_token.js index 308392171..262d82ce4 100644 --- a/api/api/security.invalidate_token.js +++ b/api/api/security.invalidate_token.js @@ -71,7 +71,7 @@ function buildSecurityInvalidateToken (opts) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/security.put_privileges.js b/api/api/security.put_privileges.js index 16f5b5766..80cf7976f 100644 --- a/api/api/security.put_privileges.js +++ b/api/api/security.put_privileges.js @@ -72,7 +72,7 @@ function buildSecurityPutPrivileges (opts) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/security.put_role.js b/api/api/security.put_role.js index bf456bec9..62d8dae4d 100644 --- a/api/api/security.put_role.js +++ b/api/api/security.put_role.js @@ -77,7 +77,7 @@ function buildSecurityPutRole (opts) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/security.put_role_mapping.js b/api/api/security.put_role_mapping.js index 0a96cea9f..091d7b477 100644 --- a/api/api/security.put_role_mapping.js +++ b/api/api/security.put_role_mapping.js @@ -77,7 +77,7 @@ function buildSecurityPutRoleMapping (opts) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/security.put_user.js b/api/api/security.put_user.js index 0af60be76..7b8b04f54 100644 --- a/api/api/security.put_user.js +++ b/api/api/security.put_user.js @@ -77,7 +77,7 @@ function buildSecurityPutUser (opts) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/snapshot.create.js b/api/api/snapshot.create.js index ba71cf395..d11ff8931 100644 --- a/api/api/snapshot.create.js +++ b/api/api/snapshot.create.js @@ -94,7 +94,7 @@ function buildSnapshotCreate (opts) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/snapshot.create_repository.js b/api/api/snapshot.create_repository.js index 6ad35e417..c779a0f07 100644 --- a/api/api/snapshot.create_repository.js +++ b/api/api/snapshot.create_repository.js @@ -88,7 +88,7 @@ function buildSnapshotCreateRepository (opts) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/snapshot.delete.js b/api/api/snapshot.delete.js index a7bc7ee35..a7338d088 100644 --- a/api/api/snapshot.delete.js +++ b/api/api/snapshot.delete.js @@ -94,7 +94,7 @@ function buildSnapshotDelete (opts) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/snapshot.delete_repository.js b/api/api/snapshot.delete_repository.js index 21aacf4b1..af9c5a287 100644 --- a/api/api/snapshot.delete_repository.js +++ b/api/api/snapshot.delete_repository.js @@ -85,7 +85,7 @@ function buildSnapshotDeleteRepository (opts) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/snapshot.get.js b/api/api/snapshot.get.js index 26d2da462..86a18d362 100644 --- a/api/api/snapshot.get.js +++ b/api/api/snapshot.get.js @@ -99,7 +99,7 @@ function buildSnapshotGet (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/snapshot.get_repository.js b/api/api/snapshot.get_repository.js index edafa1aca..3de7b4b7e 100644 --- a/api/api/snapshot.get_repository.js +++ b/api/api/snapshot.get_repository.js @@ -81,7 +81,7 @@ function buildSnapshotGetRepository (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/snapshot.restore.js b/api/api/snapshot.restore.js index 8173839d9..5694aa4ec 100644 --- a/api/api/snapshot.restore.js +++ b/api/api/snapshot.restore.js @@ -94,7 +94,7 @@ function buildSnapshotRestore (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/snapshot.status.js b/api/api/snapshot.status.js index 3ab18cf55..6a8213b16 100644 --- a/api/api/snapshot.status.js +++ b/api/api/snapshot.status.js @@ -89,7 +89,7 @@ function buildSnapshotStatus (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/snapshot.verify_repository.js b/api/api/snapshot.verify_repository.js index 155408828..fcf6a1caa 100644 --- a/api/api/snapshot.verify_repository.js +++ b/api/api/snapshot.verify_repository.js @@ -85,7 +85,7 @@ function buildSnapshotVerifyRepository (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/sql.clear_cursor.js b/api/api/sql.clear_cursor.js index d7cf85bb0..ab620ca6a 100644 --- a/api/api/sql.clear_cursor.js +++ b/api/api/sql.clear_cursor.js @@ -71,7 +71,7 @@ function buildSqlClearCursor (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/sql.query.js b/api/api/sql.query.js index 5cddb4d53..87246c23e 100644 --- a/api/api/sql.query.js +++ b/api/api/sql.query.js @@ -72,7 +72,7 @@ function buildSqlQuery (opts) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/sql.translate.js b/api/api/sql.translate.js index fc94e016e..cb5d62754 100644 --- a/api/api/sql.translate.js +++ b/api/api/sql.translate.js @@ -71,7 +71,7 @@ function buildSqlTranslate (opts) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/ssl.certificates.js b/api/api/ssl.certificates.js index e23e5f3ad..706bf117d 100644 --- a/api/api/ssl.certificates.js +++ b/api/api/ssl.certificates.js @@ -70,7 +70,7 @@ function buildSslCertificates (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/tasks.cancel.js b/api/api/tasks.cancel.js index 36db925fc..1dbd66ac4 100644 --- a/api/api/tasks.cancel.js +++ b/api/api/tasks.cancel.js @@ -83,7 +83,7 @@ function buildTasksCancel (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/tasks.get.js b/api/api/tasks.get.js index e67bcb9eb..d4e886adb 100644 --- a/api/api/tasks.get.js +++ b/api/api/tasks.get.js @@ -85,7 +85,7 @@ function buildTasksGet (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/tasks.list.js b/api/api/tasks.list.js index 20759e997..e8a69211f 100644 --- a/api/api/tasks.list.js +++ b/api/api/tasks.list.js @@ -92,7 +92,7 @@ function buildTasksList (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/termvectors.js b/api/api/termvectors.js index 6c1a79a25..93092d9f9 100644 --- a/api/api/termvectors.js +++ b/api/api/termvectors.js @@ -106,7 +106,7 @@ function buildTermvectors (opts) { method = body == null ? 'GET' : 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/update.js b/api/api/update.js index 6d564626e..615a07aea 100644 --- a/api/api/update.js +++ b/api/api/update.js @@ -117,7 +117,7 @@ function buildUpdate (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/update_by_query.js b/api/api/update_by_query.js index 5346ba3d9..7d7d7bc47 100644 --- a/api/api/update_by_query.js +++ b/api/api/update_by_query.js @@ -168,7 +168,7 @@ function buildUpdateByQuery (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/update_by_query_rethrottle.js b/api/api/update_by_query_rethrottle.js index b8a5ff701..59a72a6e5 100644 --- a/api/api/update_by_query_rethrottle.js +++ b/api/api/update_by_query_rethrottle.js @@ -87,7 +87,7 @@ function buildUpdateByQueryRethrottle (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/watcher.ack_watch.js b/api/api/watcher.ack_watch.js index b85428326..323ba16d7 100644 --- a/api/api/watcher.ack_watch.js +++ b/api/api/watcher.ack_watch.js @@ -82,7 +82,7 @@ function buildWatcherAckWatch (opts) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/watcher.activate_watch.js b/api/api/watcher.activate_watch.js index 73f06de84..31640579a 100644 --- a/api/api/watcher.activate_watch.js +++ b/api/api/watcher.activate_watch.js @@ -75,7 +75,7 @@ function buildWatcherActivateWatch (opts) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/watcher.deactivate_watch.js b/api/api/watcher.deactivate_watch.js index 5b7e4eb48..54501a2f0 100644 --- a/api/api/watcher.deactivate_watch.js +++ b/api/api/watcher.deactivate_watch.js @@ -75,7 +75,7 @@ function buildWatcherDeactivateWatch (opts) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/watcher.delete_watch.js b/api/api/watcher.delete_watch.js index 64263193b..1e7add318 100644 --- a/api/api/watcher.delete_watch.js +++ b/api/api/watcher.delete_watch.js @@ -75,7 +75,7 @@ function buildWatcherDeleteWatch (opts) { method = 'DELETE' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/watcher.execute_watch.js b/api/api/watcher.execute_watch.js index 409e507f1..8a7865d2a 100644 --- a/api/api/watcher.execute_watch.js +++ b/api/api/watcher.execute_watch.js @@ -67,7 +67,7 @@ function buildWatcherExecuteWatch (opts) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/watcher.get_watch.js b/api/api/watcher.get_watch.js index bee524669..f40151c35 100644 --- a/api/api/watcher.get_watch.js +++ b/api/api/watcher.get_watch.js @@ -75,7 +75,7 @@ function buildWatcherGetWatch (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/watcher.put_watch.js b/api/api/watcher.put_watch.js index d227f8b8e..05ba4edfe 100644 --- a/api/api/watcher.put_watch.js +++ b/api/api/watcher.put_watch.js @@ -80,7 +80,7 @@ function buildWatcherPutWatch (opts) { method = 'PUT' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/watcher.start.js b/api/api/watcher.start.js index 3ad4f4bac..5221faf23 100644 --- a/api/api/watcher.start.js +++ b/api/api/watcher.start.js @@ -70,7 +70,7 @@ function buildWatcherStart (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/watcher.stats.js b/api/api/watcher.stats.js index 3d0dcc90b..792a895c1 100644 --- a/api/api/watcher.stats.js +++ b/api/api/watcher.stats.js @@ -74,7 +74,7 @@ function buildWatcherStats (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/watcher.stop.js b/api/api/watcher.stop.js index af179d8ce..5eea1055c 100644 --- a/api/api/watcher.stop.js +++ b/api/api/watcher.stop.js @@ -70,7 +70,7 @@ function buildWatcherStop (opts) { method = 'POST' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/xpack.info.js b/api/api/xpack.info.js index f2f5dc8ef..504e3543d 100644 --- a/api/api/xpack.info.js +++ b/api/api/xpack.info.js @@ -71,7 +71,7 @@ function buildXpackInfo (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] } diff --git a/api/api/xpack.usage.js b/api/api/xpack.usage.js index 62937f1ff..e7f3971a3 100644 --- a/api/api/xpack.usage.js +++ b/api/api/xpack.usage.js @@ -71,7 +71,7 @@ function buildXpackUsage (opts) { method = 'GET' } - var ignore = options.ignore || null + var ignore = options.ignore if (typeof ignore === 'number') { options.ignore = [ignore] }