From 4492532727055da684f56e5af411af539f20cb80 Mon Sep 17 00:00:00 2001 From: Tomas Della Vedova Date: Mon, 18 Oct 2021 16:01:55 +0200 Subject: [PATCH] Update unknown parameter handling. (#1568) --- index.js | 52 +- src/api/api/async_search.ts | 50 +- src/api/api/autoscaling.ts | 44 +- src/api/api/bulk.ts | 8 +- src/api/api/cat.ts | 300 ++----- src/api/api/ccr.ts | 164 ++-- src/api/api/clear_scroll.ts | 14 +- src/api/api/close_point_in_time.ts | 14 +- src/api/api/cluster.ts | 188 ++--- src/api/api/count.ts | 14 +- src/api/api/create.ts | 8 +- src/api/api/dangling_indices.ts | 36 +- src/api/api/delete.ts | 12 +- src/api/api/delete_by_query.ts | 14 +- src/api/api/delete_by_query_rethrottle.ts | 12 +- src/api/api/delete_script.ts | 12 +- src/api/api/enrich.ts | 62 +- src/api/api/eql.ts | 50 +- src/api/api/exists.ts | 12 +- src/api/api/exists_source.ts | 12 +- src/api/api/explain.ts | 14 +- src/api/api/features.ts | 24 +- src/api/api/field_caps.ts | 14 +- src/api/api/fleet.ts | 10 +- src/api/api/get.ts | 12 +- src/api/api/get_script.ts | 12 +- src/api/api/get_script_context.ts | 12 +- src/api/api/get_script_languages.ts | 12 +- src/api/api/get_source.ts | 12 +- src/api/api/graph.ts | 14 +- src/api/api/ilm.ts | 134 +-- src/api/api/index.ts | 8 +- src/api/api/indices.ts | 640 +++++--------- src/api/api/info.ts | 12 +- src/api/api/ingest.ts | 76 +- src/api/api/license.ts | 86 +- src/api/api/logstash.ts | 32 +- src/api/api/mget.ts | 14 +- src/api/api/migration.ts | 56 +- src/api/api/ml.ts | 876 ++++++++------------ src/api/api/monitoring.ts | 8 +- src/api/api/msearch.ts | 8 +- src/api/api/msearch_template.ts | 8 +- src/api/api/mtermvectors.ts | 14 +- src/api/api/nodes.ts | 82 +- src/api/api/open_point_in_time.ts | 12 +- src/api/api/ping.ts | 12 +- src/api/api/put_script.ts | 14 +- src/api/api/rank_eval.ts | 14 +- src/api/api/reindex.ts | 14 +- src/api/api/reindex_rethrottle.ts | 12 +- src/api/api/render_search_template.ts | 14 +- src/api/api/rollup.ts | 108 +-- src/api/api/scripts_painless_execute.ts | 14 +- src/api/api/scroll.ts | 12 +- src/api/api/search.ts | 14 +- src/api/api/search_mvt.ts | 14 +- src/api/api/search_shards.ts | 12 +- src/api/api/search_template.ts | 14 +- src/api/api/searchable_snapshots.ts | 48 +- src/api/api/security.ts | 514 ++++-------- src/api/api/shutdown.ts | 36 +- src/api/api/slm.ts | 110 +-- src/api/api/snapshot.ts | 150 ++-- src/api/api/sql.ts | 72 +- src/api/api/ssl.ts | 12 +- src/api/api/tasks.ts | 36 +- src/api/api/terms_enum.ts | 14 +- src/api/api/termvectors.ts | 14 +- src/api/api/text_structure.ts | 8 +- src/api/api/transform.ts | 120 ++- src/api/api/update.ts | 14 +- src/api/api/update_by_query.ts | 14 +- src/api/api/update_by_query_rethrottle.ts | 12 +- src/api/api/watcher.ts | 138 +-- src/api/api/xpack.ts | 24 +- src/api/kibana.ts | 18 +- src/api/types.ts | 202 +++-- src/api/typesWithBodyKey.ts | 232 +++--- src/helpers.ts | 2 +- test/integration/helper.js | 1 + test/integration/integration/test-runner.js | 2 +- test/unit/api.test.ts | 136 +++ test/unit/helpers/scroll.test.ts | 4 +- 84 files changed, 2094 insertions(+), 3387 deletions(-) create mode 100644 test/unit/api.test.ts diff --git a/index.js b/index.js index 9b39327fb..57068f4b2 100644 --- a/index.js +++ b/index.js @@ -20,34 +20,34 @@ 'use strict' const { - Diagnostic, - Transport, - WeightedConnectionPool, - ClusterConnectionPool, - BaseConnectionPool, - CloudConnectionPool, - BaseConnection, - HttpConnection, - UndiciConnection, - Serializer, - errors, - events + Diagnostic, + Transport, + WeightedConnectionPool, + ClusterConnectionPool, + BaseConnectionPool, + CloudConnectionPool, + BaseConnection, + HttpConnection, + UndiciConnection, + Serializer, + errors, + events } = require('@elastic/transport') const { default: Client } = require('./lib/client') -module.exports = { - Client, - Diagnostic, - Transport, - WeightedConnectionPool, - ClusterConnectionPool, - BaseConnectionPool, - CloudConnectionPool, - BaseConnection, - HttpConnection, - UndiciConnection, - Serializer, - errors, - events +module.exports = { + Client, + Diagnostic, + Transport, + WeightedConnectionPool, + ClusterConnectionPool, + BaseConnectionPool, + CloudConnectionPool, + BaseConnection, + HttpConnection, + UndiciConnection, + Serializer, + errors, + events } diff --git a/src/api/api/async_search.ts b/src/api/api/async_search.ts index d071d3119..264c881b4 100644 --- a/src/api/api/async_search.ts +++ b/src/api/api/async_search.ts @@ -48,21 +48,15 @@ export default class AsyncSearch { async delete (this: That, params: T.AsyncSearchDeleteRequest | TB.AsyncSearchDeleteRequest, options?: TransportRequestOptions): Promise async delete (this: That, params: T.AsyncSearchDeleteRequest | TB.AsyncSearchDeleteRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -76,21 +70,15 @@ export default class AsyncSearch { async get (this: That, params: T.AsyncSearchGetRequest | TB.AsyncSearchGetRequest, options?: TransportRequestOptions): Promise> async get (this: That, params: T.AsyncSearchGetRequest | TB.AsyncSearchGetRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const acceptedQuery: string[] = ['keep_alive', 'typed_keys', 'wait_for_completion_timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -104,21 +92,15 @@ export default class AsyncSearch { async status (this: That, params: T.AsyncSearchStatusRequest | TB.AsyncSearchStatusRequest, options?: TransportRequestOptions): Promise> async status (this: That, params: T.AsyncSearchStatusRequest | TB.AsyncSearchStatusRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -132,22 +114,22 @@ export default class AsyncSearch { async submit (this: That, params?: T.AsyncSearchSubmitRequest | TB.AsyncSearchSubmitRequest, options?: TransportRequestOptions): Promise> async submit (this: That, params?: T.AsyncSearchSubmitRequest | TB.AsyncSearchSubmitRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['batched_reduce_size', 'wait_for_completion_timeout', 'keep_on_completion', 'typed_keys', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['aggs', 'aggregations', 'collapse', 'highlight', 'indices_boost', 'min_score', 'post_filter', 'profile', 'query', 'rescore', 'script_fields', 'search_after', 'slice', 'fields', 'suggest', 'pit', 'runtime_mappings'] const querystring: Record = {} // @ts-expect-error let body: Record = params?.body ?? undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } diff --git a/src/api/api/autoscaling.ts b/src/api/api/autoscaling.ts index 413d9ef75..af5fc0c66 100644 --- a/src/api/api/autoscaling.ts +++ b/src/api/api/autoscaling.ts @@ -48,21 +48,15 @@ export default class Autoscaling { async deleteAutoscalingPolicy (this: That, params: T.AutoscalingDeleteAutoscalingPolicyRequest | TB.AutoscalingDeleteAutoscalingPolicyRequest, options?: TransportRequestOptions): Promise async deleteAutoscalingPolicy (this: That, params: T.AutoscalingDeleteAutoscalingPolicyRequest | TB.AutoscalingDeleteAutoscalingPolicyRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -76,22 +70,16 @@ export default class Autoscaling { async getAutoscalingCapacity (this: That, params?: T.AutoscalingGetAutoscalingCapacityRequest | TB.AutoscalingGetAutoscalingCapacityRequest, options?: TransportRequestOptions): Promise async getAutoscalingCapacity (this: That, params?: T.AutoscalingGetAutoscalingCapacityRequest | TB.AutoscalingGetAutoscalingCapacityRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -105,21 +93,15 @@ export default class Autoscaling { async getAutoscalingPolicy (this: That, params: T.AutoscalingGetAutoscalingPolicyRequest | TB.AutoscalingGetAutoscalingPolicyRequest, options?: TransportRequestOptions): Promise async getAutoscalingPolicy (this: That, params: T.AutoscalingGetAutoscalingPolicyRequest | TB.AutoscalingGetAutoscalingPolicyRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -133,20 +115,20 @@ export default class Autoscaling { async putAutoscalingPolicy (this: That, params: T.AutoscalingPutAutoscalingPolicyRequest | TB.AutoscalingPutAutoscalingPolicyRequest, options?: TransportRequestOptions): Promise async putAutoscalingPolicy (this: That, params: T.AutoscalingPutAutoscalingPolicyRequest | TB.AutoscalingPutAutoscalingPolicyRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['policy'] const querystring: Record = {} // @ts-expect-error let body: any = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { + if (acceptedBody.includes(key)) { // @ts-expect-error - querystring[key] = params[key] + body = params[key] } else if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { // @ts-expect-error - body = params[key] + querystring[key] = params[key] } } diff --git a/src/api/api/bulk.ts b/src/api/api/bulk.ts index f41f1ca5d..3b4e4ae04 100644 --- a/src/api/api/bulk.ts +++ b/src/api/api/bulk.ts @@ -42,20 +42,20 @@ export default async function BulkApi (this: That, params: T. export default async function BulkApi (this: That, params: T.BulkRequest | TB.BulkRequest, options?: TransportRequestOptions): Promise export default async function BulkApi (this: That, params: T.BulkRequest | TB.BulkRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index', 'type'] - const acceptedQuery: string[] = ['pipeline', 'refresh', 'routing', '_source', '_source_excludes', '_source_includes', 'timeout', 'type', 'wait_for_active_shards', 'require_alias', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['operations'] const querystring: Record = {} // @ts-expect-error let body: any = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { + if (acceptedBody.includes(key)) { // @ts-expect-error - querystring[key] = params[key] + body = params[key] } else if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { // @ts-expect-error - body = params[key] + querystring[key] = params[key] } } diff --git a/src/api/api/cat.ts b/src/api/api/cat.ts index dbadd370e..d052c4528 100644 --- a/src/api/api/cat.ts +++ b/src/api/api/cat.ts @@ -48,22 +48,16 @@ export default class Cat { async aliases (this: That, params?: T.CatAliasesRequest | TB.CatAliasesRequest, options?: TransportRequestOptions): Promise async aliases (this: That, params?: T.CatAliasesRequest | TB.CatAliasesRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const acceptedQuery: string[] = ['expand_wildcards', 'format', 'h', 'help', 'local', 'master_timeout', 's', 'v', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -84,22 +78,16 @@ export default class Cat { async allocation (this: That, params?: T.CatAllocationRequest | TB.CatAllocationRequest, options?: TransportRequestOptions): Promise async allocation (this: That, params?: T.CatAllocationRequest | TB.CatAllocationRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['node_id'] - const acceptedQuery: string[] = ['bytes', 'format', 'h', 'help', 'local', 'master_timeout', 's', 'v', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -120,22 +108,16 @@ export default class Cat { async count (this: That, params?: T.CatCountRequest | TB.CatCountRequest, options?: TransportRequestOptions): Promise async count (this: That, params?: T.CatCountRequest | TB.CatCountRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['format', 'h', 'help', 'local', 'master_timeout', 's', 'v', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -156,22 +138,16 @@ export default class Cat { async fielddata (this: That, params?: T.CatFielddataRequest | TB.CatFielddataRequest, options?: TransportRequestOptions): Promise async fielddata (this: That, params?: T.CatFielddataRequest | TB.CatFielddataRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['fields'] - const acceptedQuery: string[] = ['bytes', 'format', 'h', 'help', 'local', 'master_timeout', 's', 'v', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -192,22 +168,16 @@ export default class Cat { async health (this: That, params?: T.CatHealthRequest | TB.CatHealthRequest, options?: TransportRequestOptions): Promise async health (this: That, params?: T.CatHealthRequest | TB.CatHealthRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['include_timestamp', 'ts', 'format', 'h', 'help', 'local', 'master_timeout', 's', 'v', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -221,22 +191,16 @@ export default class Cat { async help (this: That, params?: T.CatHelpRequest | TB.CatHelpRequest, options?: TransportRequestOptions): Promise async help (this: That, params?: T.CatHelpRequest | TB.CatHelpRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['format', 'h', 'help', 'local', 'master_timeout', 's', 'v', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -250,22 +214,16 @@ export default class Cat { async indices (this: That, params?: T.CatIndicesRequest | TB.CatIndicesRequest, options?: TransportRequestOptions): Promise async indices (this: That, params?: T.CatIndicesRequest | TB.CatIndicesRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['bytes', 'expand_wildcards', 'health', 'include_unloaded_segments', 'pri', 'format', 'h', 'help', 'local', 'master_timeout', 's', 'v', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -286,22 +244,16 @@ export default class Cat { async master (this: That, params?: T.CatMasterRequest | TB.CatMasterRequest, options?: TransportRequestOptions): Promise async master (this: That, params?: T.CatMasterRequest | TB.CatMasterRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['format', 'h', 'help', 'local', 'master_timeout', 's', 'v', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -315,22 +267,16 @@ export default class Cat { async mlDataFrameAnalytics (this: That, params?: T.CatMlDataFrameAnalyticsRequest | TB.CatMlDataFrameAnalyticsRequest, options?: TransportRequestOptions): Promise async mlDataFrameAnalytics (this: That, params?: T.CatMlDataFrameAnalyticsRequest | TB.CatMlDataFrameAnalyticsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const acceptedQuery: string[] = ['allow_no_match', 'bytes', 'format', 'h', 'help', 'local', 'master_timeout', 's', 'v', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -351,22 +297,16 @@ export default class Cat { async mlDatafeeds (this: That, params?: T.CatMlDatafeedsRequest | TB.CatMlDatafeedsRequest, options?: TransportRequestOptions): Promise async mlDatafeeds (this: That, params?: T.CatMlDatafeedsRequest | TB.CatMlDatafeedsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['datafeed_id'] - const acceptedQuery: string[] = ['allow_no_datafeeds', 'format', 'h', 'help', 'local', 'master_timeout', 's', 'v', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -387,22 +327,16 @@ export default class Cat { async mlJobs (this: That, params?: T.CatMlJobsRequest | TB.CatMlJobsRequest, options?: TransportRequestOptions): Promise async mlJobs (this: That, params?: T.CatMlJobsRequest | TB.CatMlJobsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['job_id'] - const acceptedQuery: string[] = ['allow_no_jobs', 'bytes', 'format', 'h', 'help', 'local', 'master_timeout', 's', 'v', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -423,22 +357,16 @@ export default class Cat { async mlTrainedModels (this: That, params?: T.CatMlTrainedModelsRequest | TB.CatMlTrainedModelsRequest, options?: TransportRequestOptions): Promise async mlTrainedModels (this: That, params?: T.CatMlTrainedModelsRequest | TB.CatMlTrainedModelsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['model_id'] - const acceptedQuery: string[] = ['allow_no_match', 'bytes', 'from', 'size', 'format', 'h', 'help', 'local', 'master_timeout', 's', 'v', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -459,22 +387,16 @@ export default class Cat { async nodeattrs (this: That, params?: T.CatNodeattrsRequest | TB.CatNodeattrsRequest, options?: TransportRequestOptions): Promise async nodeattrs (this: That, params?: T.CatNodeattrsRequest | TB.CatNodeattrsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['format', 'h', 'help', 'local', 'master_timeout', 's', 'v', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -488,22 +410,16 @@ export default class Cat { async nodes (this: That, params?: T.CatNodesRequest | TB.CatNodesRequest, options?: TransportRequestOptions): Promise async nodes (this: That, params?: T.CatNodesRequest | TB.CatNodesRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['bytes', 'full_id', 'format', 'h', 'help', 'local', 'master_timeout', 's', 'v', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -517,22 +433,16 @@ export default class Cat { async pendingTasks (this: That, params?: T.CatPendingTasksRequest | TB.CatPendingTasksRequest, options?: TransportRequestOptions): Promise async pendingTasks (this: That, params?: T.CatPendingTasksRequest | TB.CatPendingTasksRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['format', 'h', 'help', 'local', 'master_timeout', 's', 'v', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -546,22 +456,16 @@ export default class Cat { async plugins (this: That, params?: T.CatPluginsRequest | TB.CatPluginsRequest, options?: TransportRequestOptions): Promise async plugins (this: That, params?: T.CatPluginsRequest | TB.CatPluginsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['format', 'h', 'help', 'local', 'master_timeout', 's', 'v', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -575,22 +479,16 @@ export default class Cat { async recovery (this: That, params?: T.CatRecoveryRequest | TB.CatRecoveryRequest, options?: TransportRequestOptions): Promise async recovery (this: That, params?: T.CatRecoveryRequest | TB.CatRecoveryRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['active_only', 'bytes', 'detailed', 'format', 'h', 'help', 'local', 'master_timeout', 's', 'v', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -611,22 +509,16 @@ export default class Cat { async repositories (this: That, params?: T.CatRepositoriesRequest | TB.CatRepositoriesRequest, options?: TransportRequestOptions): Promise async repositories (this: That, params?: T.CatRepositoriesRequest | TB.CatRepositoriesRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['format', 'h', 'help', 'local', 'master_timeout', 's', 'v', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -640,22 +532,16 @@ export default class Cat { async segments (this: That, params?: T.CatSegmentsRequest | TB.CatSegmentsRequest, options?: TransportRequestOptions): Promise async segments (this: That, params?: T.CatSegmentsRequest | TB.CatSegmentsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['bytes', 'format', 'h', 'help', 'local', 'master_timeout', 's', 'v', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -676,22 +562,16 @@ export default class Cat { async shards (this: That, params?: T.CatShardsRequest | TB.CatShardsRequest, options?: TransportRequestOptions): Promise async shards (this: That, params?: T.CatShardsRequest | TB.CatShardsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['bytes', 'format', 'h', 'help', 'local', 'master_timeout', 's', 'v', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -712,22 +592,16 @@ export default class Cat { async snapshots (this: That, params?: T.CatSnapshotsRequest | TB.CatSnapshotsRequest, options?: TransportRequestOptions): Promise async snapshots (this: That, params?: T.CatSnapshotsRequest | TB.CatSnapshotsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['repository'] - const acceptedQuery: string[] = ['ignore_unavailable', 'format', 'h', 'help', 'local', 'master_timeout', 's', 'v', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -748,22 +622,16 @@ export default class Cat { async tasks (this: That, params?: T.CatTasksRequest | TB.CatTasksRequest, options?: TransportRequestOptions): Promise async tasks (this: That, params?: T.CatTasksRequest | TB.CatTasksRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['actions', 'detailed', 'node_id', 'parent_task', 'format', 'h', 'help', 'local', 'master_timeout', 's', 'v', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -777,22 +645,16 @@ export default class Cat { async templates (this: That, params?: T.CatTemplatesRequest | TB.CatTemplatesRequest, options?: TransportRequestOptions): Promise async templates (this: That, params?: T.CatTemplatesRequest | TB.CatTemplatesRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const acceptedQuery: string[] = ['format', 'h', 'help', 'local', 'master_timeout', 's', 'v', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -813,22 +675,16 @@ export default class Cat { async threadPool (this: That, params?: T.CatThreadPoolRequest | TB.CatThreadPoolRequest, options?: TransportRequestOptions): Promise async threadPool (this: That, params?: T.CatThreadPoolRequest | TB.CatThreadPoolRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['thread_pool_patterns'] - const acceptedQuery: string[] = ['size', 'format', 'h', 'help', 'local', 'master_timeout', 's', 'v', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -849,22 +705,16 @@ export default class Cat { async transforms (this: That, params?: T.CatTransformsRequest | TB.CatTransformsRequest, options?: TransportRequestOptions): Promise async transforms (this: That, params?: T.CatTransformsRequest | TB.CatTransformsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['transform_id'] - const acceptedQuery: string[] = ['allow_no_match', 'from', 'size', 'format', 'h', 'help', 'local', 'master_timeout', 's', 'v', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } diff --git a/src/api/api/ccr.ts b/src/api/api/ccr.ts index 644257e36..7dc3e650a 100644 --- a/src/api/api/ccr.ts +++ b/src/api/api/ccr.ts @@ -48,21 +48,15 @@ export default class Ccr { async deleteAutoFollowPattern (this: That, params: T.CcrDeleteAutoFollowPatternRequest | TB.CcrDeleteAutoFollowPatternRequest, options?: TransportRequestOptions): Promise async deleteAutoFollowPattern (this: That, params: T.CcrDeleteAutoFollowPatternRequest | TB.CcrDeleteAutoFollowPatternRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -76,21 +70,21 @@ export default class Ccr { async follow (this: That, params: T.CcrFollowRequest | TB.CcrFollowRequest, options?: TransportRequestOptions): Promise async follow (this: That, params: T.CcrFollowRequest | TB.CcrFollowRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['wait_for_active_shards', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['leader_index', 'max_outstanding_read_requests', 'max_outstanding_write_requests', 'max_read_request_operation_count', 'max_read_request_size', 'max_retry_delay', 'max_write_buffer_count', 'max_write_buffer_size', 'max_write_request_operation_count', 'max_write_request_size', 'read_poll_timeout', 'remote_cluster'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -104,21 +98,15 @@ export default class Ccr { async followInfo (this: That, params: T.CcrFollowInfoRequest | TB.CcrFollowInfoRequest, options?: TransportRequestOptions): Promise async followInfo (this: That, params: T.CcrFollowInfoRequest | TB.CcrFollowInfoRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -132,21 +120,15 @@ export default class Ccr { async followStats (this: That, params: T.CcrFollowStatsRequest | TB.CcrFollowStatsRequest, options?: TransportRequestOptions): Promise async followStats (this: That, params: T.CcrFollowStatsRequest | TB.CcrFollowStatsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -160,21 +142,21 @@ export default class Ccr { async forgetFollower (this: That, params: T.CcrForgetFollowerRequest | TB.CcrForgetFollowerRequest, options?: TransportRequestOptions): Promise async forgetFollower (this: That, params: T.CcrForgetFollowerRequest | TB.CcrForgetFollowerRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['follower_cluster', 'follower_index', 'follower_index_uuid', 'leader_remote_cluster'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -188,22 +170,16 @@ export default class Ccr { async getAutoFollowPattern (this: That, params?: T.CcrGetAutoFollowPatternRequest | TB.CcrGetAutoFollowPatternRequest, options?: TransportRequestOptions): Promise async getAutoFollowPattern (this: That, params?: T.CcrGetAutoFollowPatternRequest | TB.CcrGetAutoFollowPatternRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -224,21 +200,15 @@ export default class Ccr { async pauseAutoFollowPattern (this: That, params: T.CcrPauseAutoFollowPatternRequest | TB.CcrPauseAutoFollowPatternRequest, options?: TransportRequestOptions): Promise async pauseAutoFollowPattern (this: That, params: T.CcrPauseAutoFollowPatternRequest | TB.CcrPauseAutoFollowPatternRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -252,21 +222,15 @@ export default class Ccr { async pauseFollow (this: That, params: T.CcrPauseFollowRequest | TB.CcrPauseFollowRequest, options?: TransportRequestOptions): Promise async pauseFollow (this: That, params: T.CcrPauseFollowRequest | TB.CcrPauseFollowRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -280,21 +244,21 @@ export default class Ccr { async putAutoFollowPattern (this: That, params: T.CcrPutAutoFollowPatternRequest | TB.CcrPutAutoFollowPatternRequest, options?: TransportRequestOptions): Promise async putAutoFollowPattern (this: That, params: T.CcrPutAutoFollowPatternRequest | TB.CcrPutAutoFollowPatternRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['remote_cluster', 'follow_index_pattern', 'leader_index_patterns', 'leader_index_exclusion_patterns', 'max_outstanding_read_requests', 'settings', 'max_outstanding_write_requests', 'read_poll_timeout', 'max_read_request_operation_count', 'max_read_request_size', 'max_retry_delay', 'max_write_buffer_count', 'max_write_buffer_size', 'max_write_request_operation_count', 'max_write_request_size'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -308,21 +272,15 @@ export default class Ccr { async resumeAutoFollowPattern (this: That, params: T.CcrResumeAutoFollowPatternRequest | TB.CcrResumeAutoFollowPatternRequest, options?: TransportRequestOptions): Promise async resumeAutoFollowPattern (this: That, params: T.CcrResumeAutoFollowPatternRequest | TB.CcrResumeAutoFollowPatternRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -336,21 +294,21 @@ export default class Ccr { async resumeFollow (this: That, params: T.CcrResumeFollowRequest | TB.CcrResumeFollowRequest, options?: TransportRequestOptions): Promise async resumeFollow (this: That, params: T.CcrResumeFollowRequest | TB.CcrResumeFollowRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['max_outstanding_read_requests', 'max_outstanding_write_requests', 'max_read_request_operation_count', 'max_read_request_size', 'max_retry_delay', 'max_write_buffer_count', 'max_write_buffer_size', 'max_write_request_operation_count', 'max_write_request_size', 'read_poll_timeout'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -364,22 +322,16 @@ export default class Ccr { async stats (this: That, params?: T.CcrStatsRequest | TB.CcrStatsRequest, options?: TransportRequestOptions): Promise async stats (this: That, params?: T.CcrStatsRequest | TB.CcrStatsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -393,21 +345,15 @@ export default class Ccr { async unfollow (this: That, params: T.CcrUnfollowRequest | TB.CcrUnfollowRequest, options?: TransportRequestOptions): Promise async unfollow (this: That, params: T.CcrUnfollowRequest | TB.CcrUnfollowRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } diff --git a/src/api/api/clear_scroll.ts b/src/api/api/clear_scroll.ts index 1db7bc45c..56512249c 100644 --- a/src/api/api/clear_scroll.ts +++ b/src/api/api/clear_scroll.ts @@ -42,22 +42,22 @@ export default async function ClearScrollApi (this: That, params?: T.ClearScroll export default async function ClearScrollApi (this: That, params?: T.ClearScrollRequest | TB.ClearScrollRequest, options?: TransportRequestOptions): Promise export default async function ClearScrollApi (this: That, params?: T.ClearScrollRequest | TB.ClearScrollRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['scroll_id'] const querystring: Record = {} // @ts-expect-error let body: Record = params?.body ?? undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } diff --git a/src/api/api/close_point_in_time.ts b/src/api/api/close_point_in_time.ts index 677d953b2..fd930ba00 100644 --- a/src/api/api/close_point_in_time.ts +++ b/src/api/api/close_point_in_time.ts @@ -42,21 +42,21 @@ export default async function ClosePointInTimeApi (this: That, params: T.ClosePo export default async function ClosePointInTimeApi (this: That, params: T.ClosePointInTimeRequest | TB.ClosePointInTimeRequest, options?: TransportRequestOptions): Promise export default async function ClosePointInTimeApi (this: That, params: T.ClosePointInTimeRequest | TB.ClosePointInTimeRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['id'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } diff --git a/src/api/api/cluster.ts b/src/api/api/cluster.ts index 1656788f9..ac6f9b16a 100644 --- a/src/api/api/cluster.ts +++ b/src/api/api/cluster.ts @@ -48,22 +48,22 @@ export default class Cluster { async allocationExplain (this: That, params?: T.ClusterAllocationExplainRequest | TB.ClusterAllocationExplainRequest, options?: TransportRequestOptions): Promise async allocationExplain (this: That, params?: T.ClusterAllocationExplainRequest | TB.ClusterAllocationExplainRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['include_disk_info', 'include_yes_decisions', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['current_node', 'index', 'primary', 'shard'] const querystring: Record = {} // @ts-expect-error let body: Record = params?.body ?? undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -77,21 +77,15 @@ export default class Cluster { async deleteComponentTemplate (this: That, params: T.ClusterDeleteComponentTemplateRequest | TB.ClusterDeleteComponentTemplateRequest, options?: TransportRequestOptions): Promise async deleteComponentTemplate (this: That, params: T.ClusterDeleteComponentTemplateRequest | TB.ClusterDeleteComponentTemplateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const acceptedQuery: string[] = ['master_timeout', 'timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -105,22 +99,16 @@ export default class Cluster { async deleteVotingConfigExclusions (this: That, params?: T.ClusterDeleteVotingConfigExclusionsRequest | TB.ClusterDeleteVotingConfigExclusionsRequest, options?: TransportRequestOptions): Promise async deleteVotingConfigExclusions (this: That, params?: T.ClusterDeleteVotingConfigExclusionsRequest | TB.ClusterDeleteVotingConfigExclusionsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['wait_for_removal', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -134,21 +122,15 @@ export default class Cluster { async existsComponentTemplate (this: That, params: T.ClusterExistsComponentTemplateRequest | TB.ClusterExistsComponentTemplateRequest, options?: TransportRequestOptions): Promise async existsComponentTemplate (this: That, params: T.ClusterExistsComponentTemplateRequest | TB.ClusterExistsComponentTemplateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const acceptedQuery: string[] = ['master_timeout', 'local', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -162,22 +144,16 @@ export default class Cluster { async getComponentTemplate (this: That, params?: T.ClusterGetComponentTemplateRequest | TB.ClusterGetComponentTemplateRequest, options?: TransportRequestOptions): Promise async getComponentTemplate (this: That, params?: T.ClusterGetComponentTemplateRequest | TB.ClusterGetComponentTemplateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const acceptedQuery: string[] = ['flat_settings', 'local', 'master_timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -198,22 +174,16 @@ export default class Cluster { async getSettings (this: That, params?: T.ClusterGetSettingsRequest | TB.ClusterGetSettingsRequest, options?: TransportRequestOptions): Promise async getSettings (this: That, params?: T.ClusterGetSettingsRequest | TB.ClusterGetSettingsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['flat_settings', 'include_defaults', 'master_timeout', 'timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -227,22 +197,16 @@ export default class Cluster { async health (this: That, params?: T.ClusterHealthRequest | TB.ClusterHealthRequest, options?: TransportRequestOptions): Promise async health (this: That, params?: T.ClusterHealthRequest | TB.ClusterHealthRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['expand_wildcards', 'level', 'local', 'master_timeout', 'timeout', 'wait_for_active_shards', 'wait_for_events', 'wait_for_nodes', 'wait_for_no_initializing_shards', 'wait_for_no_relocating_shards', 'wait_for_status', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -263,22 +227,16 @@ export default class Cluster { async pendingTasks (this: That, params?: T.ClusterPendingTasksRequest | TB.ClusterPendingTasksRequest, options?: TransportRequestOptions): Promise async pendingTasks (this: That, params?: T.ClusterPendingTasksRequest | TB.ClusterPendingTasksRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['local', 'master_timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -292,22 +250,16 @@ export default class Cluster { async postVotingConfigExclusions (this: That, params?: T.ClusterPostVotingConfigExclusionsRequest | TB.ClusterPostVotingConfigExclusionsRequest, options?: TransportRequestOptions): Promise async postVotingConfigExclusions (this: That, params?: T.ClusterPostVotingConfigExclusionsRequest | TB.ClusterPostVotingConfigExclusionsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['node_names', 'node_ids', 'timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -321,21 +273,21 @@ export default class Cluster { async putComponentTemplate (this: That, params: T.ClusterPutComponentTemplateRequest | TB.ClusterPutComponentTemplateRequest, options?: TransportRequestOptions): Promise async putComponentTemplate (this: That, params: T.ClusterPutComponentTemplateRequest | TB.ClusterPutComponentTemplateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const acceptedQuery: string[] = ['create', 'master_timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['template', 'aliases', 'mappings', 'settings', 'version', '_meta'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -349,22 +301,22 @@ export default class Cluster { async putSettings (this: That, params?: T.ClusterPutSettingsRequest | TB.ClusterPutSettingsRequest, options?: TransportRequestOptions): Promise async putSettings (this: That, params?: T.ClusterPutSettingsRequest | TB.ClusterPutSettingsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['flat_settings', 'master_timeout', 'timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['persistent', 'transient'] const querystring: Record = {} // @ts-expect-error let body: Record = params?.body ?? undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -378,22 +330,16 @@ export default class Cluster { async remoteInfo (this: That, params?: T.ClusterRemoteInfoRequest | TB.ClusterRemoteInfoRequest, options?: TransportRequestOptions): Promise async remoteInfo (this: That, params?: T.ClusterRemoteInfoRequest | TB.ClusterRemoteInfoRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -407,22 +353,22 @@ export default class Cluster { async reroute (this: That, params?: T.ClusterRerouteRequest | TB.ClusterRerouteRequest, options?: TransportRequestOptions): Promise async reroute (this: That, params?: T.ClusterRerouteRequest | TB.ClusterRerouteRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['dry_run', 'explain', 'metric', 'retry_failed', 'master_timeout', 'timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['commands'] const querystring: Record = {} // @ts-expect-error let body: Record = params?.body ?? undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -436,22 +382,16 @@ export default class Cluster { async state (this: That, params?: T.ClusterStateRequest | TB.ClusterStateRequest, options?: TransportRequestOptions): Promise async state (this: That, params?: T.ClusterStateRequest | TB.ClusterStateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['metric', 'index'] - const acceptedQuery: string[] = ['allow_no_indices', 'expand_wildcards', 'flat_settings', 'ignore_unavailable', 'local', 'master_timeout', 'wait_for_metadata_version', 'wait_for_timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -475,22 +415,16 @@ export default class Cluster { async stats (this: That, params?: T.ClusterStatsRequest | TB.ClusterStatsRequest, options?: TransportRequestOptions): Promise async stats (this: That, params?: T.ClusterStatsRequest | TB.ClusterStatsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['node_id'] - const acceptedQuery: string[] = ['flat_settings', 'timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } diff --git a/src/api/api/count.ts b/src/api/api/count.ts index 1b786e867..999cbf3bb 100644 --- a/src/api/api/count.ts +++ b/src/api/api/count.ts @@ -42,22 +42,22 @@ export default async function CountApi (this: That, params?: T.CountRequest | TB export default async function CountApi (this: That, params?: T.CountRequest | TB.CountRequest, options?: TransportRequestOptions): Promise export default async function CountApi (this: That, params?: T.CountRequest | TB.CountRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['allow_no_indices', 'analyzer', 'analyze_wildcard', 'default_operator', 'df', 'expand_wildcards', 'ignore_throttled', 'ignore_unavailable', 'lenient', 'min_score', 'preference', 'routing', 'terminate_after', 'q', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['query'] const querystring: Record = {} // @ts-expect-error let body: Record = params?.body ?? undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } diff --git a/src/api/api/create.ts b/src/api/api/create.ts index 5f78ec9b9..31e3fca29 100644 --- a/src/api/api/create.ts +++ b/src/api/api/create.ts @@ -42,20 +42,20 @@ export default async function CreateApi (this: That, params export default async function CreateApi (this: That, params: T.CreateRequest | TB.CreateRequest, options?: TransportRequestOptions): Promise export default async function CreateApi (this: That, params: T.CreateRequest | TB.CreateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id', 'index', 'type'] - const acceptedQuery: string[] = ['pipeline', 'refresh', 'routing', 'timeout', 'version', 'version_type', 'wait_for_active_shards', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['document'] const querystring: Record = {} // @ts-expect-error let body: any = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { + if (acceptedBody.includes(key)) { // @ts-expect-error - querystring[key] = params[key] + body = params[key] } else if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { // @ts-expect-error - body = params[key] + querystring[key] = params[key] } } diff --git a/src/api/api/dangling_indices.ts b/src/api/api/dangling_indices.ts index 585d13504..493260a94 100644 --- a/src/api/api/dangling_indices.ts +++ b/src/api/api/dangling_indices.ts @@ -48,21 +48,15 @@ export default class DanglingIndices { async deleteDanglingIndex (this: That, params: T.DanglingIndicesDeleteDanglingIndexRequest | TB.DanglingIndicesDeleteDanglingIndexRequest, options?: TransportRequestOptions): Promise async deleteDanglingIndex (this: That, params: T.DanglingIndicesDeleteDanglingIndexRequest | TB.DanglingIndicesDeleteDanglingIndexRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index_uuid'] - const acceptedQuery: string[] = ['accept_data_loss', 'master_timeout', 'timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -76,21 +70,15 @@ export default class DanglingIndices { async importDanglingIndex (this: That, params: T.DanglingIndicesImportDanglingIndexRequest | TB.DanglingIndicesImportDanglingIndexRequest, options?: TransportRequestOptions): Promise async importDanglingIndex (this: That, params: T.DanglingIndicesImportDanglingIndexRequest | TB.DanglingIndicesImportDanglingIndexRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index_uuid'] - const acceptedQuery: string[] = ['accept_data_loss', 'master_timeout', 'timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -104,22 +92,16 @@ export default class DanglingIndices { async listDanglingIndices (this: That, params?: T.DanglingIndicesListDanglingIndicesRequest | TB.DanglingIndicesListDanglingIndicesRequest, options?: TransportRequestOptions): Promise async listDanglingIndices (this: That, params?: T.DanglingIndicesListDanglingIndicesRequest | TB.DanglingIndicesListDanglingIndicesRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } diff --git a/src/api/api/delete.ts b/src/api/api/delete.ts index 1a937b06b..ee4dba53b 100644 --- a/src/api/api/delete.ts +++ b/src/api/api/delete.ts @@ -42,21 +42,15 @@ export default async function DeleteApi (this: That, params: T.DeleteRequest | T export default async function DeleteApi (this: That, params: T.DeleteRequest | TB.DeleteRequest, options?: TransportRequestOptions): Promise export default async function DeleteApi (this: That, params: T.DeleteRequest | TB.DeleteRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id', 'index', 'type'] - const acceptedQuery: string[] = ['if_primary_term', 'if_seq_no', 'refresh', 'routing', 'timeout', 'version', 'version_type', 'wait_for_active_shards', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } diff --git a/src/api/api/delete_by_query.ts b/src/api/api/delete_by_query.ts index 96fa6681f..d957c4faf 100644 --- a/src/api/api/delete_by_query.ts +++ b/src/api/api/delete_by_query.ts @@ -42,21 +42,21 @@ export default async function DeleteByQueryApi (this: That, params: T.DeleteByQu export default async function DeleteByQueryApi (this: That, params: T.DeleteByQueryRequest | TB.DeleteByQueryRequest, options?: TransportRequestOptions): Promise export default async function DeleteByQueryApi (this: That, params: T.DeleteByQueryRequest | TB.DeleteByQueryRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['allow_no_indices', 'analyzer', 'analyze_wildcard', 'conflicts', 'default_operator', 'df', 'expand_wildcards', 'from', 'ignore_unavailable', 'lenient', 'preference', 'refresh', 'request_cache', 'requests_per_second', 'routing', 'q', 'scroll', 'scroll_size', 'search_timeout', 'search_type', 'size', 'slices', 'sort', '_source', '_source_excludes', '_source_includes', 'stats', 'terminate_after', 'timeout', 'version', 'wait_for_active_shards', 'wait_for_completion', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['query', 'slice'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } diff --git a/src/api/api/delete_by_query_rethrottle.ts b/src/api/api/delete_by_query_rethrottle.ts index 3ca74fd52..60c722e0a 100644 --- a/src/api/api/delete_by_query_rethrottle.ts +++ b/src/api/api/delete_by_query_rethrottle.ts @@ -42,21 +42,15 @@ export default async function DeleteByQueryRethrottleApi (this: That, params: T. export default async function DeleteByQueryRethrottleApi (this: That, params: T.DeleteByQueryRethrottleRequest | TB.DeleteByQueryRethrottleRequest, options?: TransportRequestOptions): Promise export default async function DeleteByQueryRethrottleApi (this: That, params: T.DeleteByQueryRethrottleRequest | TB.DeleteByQueryRethrottleRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['task_id'] - const acceptedQuery: string[] = ['requests_per_second', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } diff --git a/src/api/api/delete_script.ts b/src/api/api/delete_script.ts index 3f603f40b..5e2e4f50f 100644 --- a/src/api/api/delete_script.ts +++ b/src/api/api/delete_script.ts @@ -42,21 +42,15 @@ export default async function DeleteScriptApi (this: That, params: T.DeleteScrip export default async function DeleteScriptApi (this: That, params: T.DeleteScriptRequest | TB.DeleteScriptRequest, options?: TransportRequestOptions): Promise export default async function DeleteScriptApi (this: That, params: T.DeleteScriptRequest | TB.DeleteScriptRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const acceptedQuery: string[] = ['master_timeout', 'timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } diff --git a/src/api/api/enrich.ts b/src/api/api/enrich.ts index c3c575c35..0fb852e05 100644 --- a/src/api/api/enrich.ts +++ b/src/api/api/enrich.ts @@ -48,21 +48,15 @@ export default class Enrich { async deletePolicy (this: That, params: T.EnrichDeletePolicyRequest | TB.EnrichDeletePolicyRequest, options?: TransportRequestOptions): Promise async deletePolicy (this: That, params: T.EnrichDeletePolicyRequest | TB.EnrichDeletePolicyRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -76,21 +70,15 @@ export default class Enrich { async executePolicy (this: That, params: T.EnrichExecutePolicyRequest | TB.EnrichExecutePolicyRequest, options?: TransportRequestOptions): Promise async executePolicy (this: That, params: T.EnrichExecutePolicyRequest | TB.EnrichExecutePolicyRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const acceptedQuery: string[] = ['wait_for_completion', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -104,22 +92,16 @@ export default class Enrich { async getPolicy (this: That, params?: T.EnrichGetPolicyRequest | TB.EnrichGetPolicyRequest, options?: TransportRequestOptions): Promise async getPolicy (this: That, params?: T.EnrichGetPolicyRequest | TB.EnrichGetPolicyRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -140,21 +122,21 @@ export default class Enrich { async putPolicy (this: That, params: T.EnrichPutPolicyRequest | TB.EnrichPutPolicyRequest, options?: TransportRequestOptions): Promise async putPolicy (this: That, params: T.EnrichPutPolicyRequest | TB.EnrichPutPolicyRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['geo_match', 'match'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -168,22 +150,16 @@ export default class Enrich { async stats (this: That, params?: T.EnrichStatsRequest | TB.EnrichStatsRequest, options?: TransportRequestOptions): Promise async stats (this: That, params?: T.EnrichStatsRequest | TB.EnrichStatsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } diff --git a/src/api/api/eql.ts b/src/api/api/eql.ts index 8a7d5ae9c..49d2bfb9d 100644 --- a/src/api/api/eql.ts +++ b/src/api/api/eql.ts @@ -48,21 +48,15 @@ export default class Eql { async delete (this: That, params: T.EqlDeleteRequest | TB.EqlDeleteRequest, options?: TransportRequestOptions): Promise async delete (this: That, params: T.EqlDeleteRequest | TB.EqlDeleteRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -76,21 +70,15 @@ export default class Eql { async get (this: That, params: T.EqlGetRequest | TB.EqlGetRequest, options?: TransportRequestOptions): Promise> async get (this: That, params: T.EqlGetRequest | TB.EqlGetRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const acceptedQuery: string[] = ['keep_alive', 'wait_for_completion_timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -104,21 +92,15 @@ export default class Eql { async getStatus (this: That, params: T.EqlGetStatusRequest | TB.EqlGetStatusRequest, options?: TransportRequestOptions): Promise async getStatus (this: That, params: T.EqlGetStatusRequest | TB.EqlGetStatusRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -132,21 +114,21 @@ export default class Eql { async search (this: That, params: T.EqlSearchRequest | TB.EqlSearchRequest, options?: TransportRequestOptions): Promise> async search (this: That, params: T.EqlSearchRequest | TB.EqlSearchRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['allow_no_indices', 'expand_wildcards', 'ignore_unavailable', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['query', 'case_sensitive', 'event_category_field', 'tiebreaker_field', 'timestamp_field', 'fetch_size', 'filter', 'size', 'fields', 'result_position'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } diff --git a/src/api/api/exists.ts b/src/api/api/exists.ts index b1c8d14cd..f0cfd6276 100644 --- a/src/api/api/exists.ts +++ b/src/api/api/exists.ts @@ -42,21 +42,15 @@ export default async function ExistsApi (this: That, params: T.ExistsRequest | T export default async function ExistsApi (this: That, params: T.ExistsRequest | TB.ExistsRequest, options?: TransportRequestOptions): Promise export default async function ExistsApi (this: That, params: T.ExistsRequest | TB.ExistsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id', 'index'] - const acceptedQuery: string[] = ['preference', 'realtime', 'refresh', 'routing', '_source', '_source_excludes', '_source_includes', 'stored_fields', 'version', 'version_type', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } diff --git a/src/api/api/exists_source.ts b/src/api/api/exists_source.ts index 375ef4f3a..eec41b8cd 100644 --- a/src/api/api/exists_source.ts +++ b/src/api/api/exists_source.ts @@ -42,21 +42,15 @@ export default async function ExistsSourceApi (this: That, params: T.ExistsSourc export default async function ExistsSourceApi (this: That, params: T.ExistsSourceRequest | TB.ExistsSourceRequest, options?: TransportRequestOptions): Promise export default async function ExistsSourceApi (this: That, params: T.ExistsSourceRequest | TB.ExistsSourceRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id', 'index', 'type'] - const acceptedQuery: string[] = ['preference', 'realtime', 'refresh', 'routing', '_source', '_source_excludes', '_source_includes', 'version', 'version_type', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } diff --git a/src/api/api/explain.ts b/src/api/api/explain.ts index 62e5f0198..eea152590 100644 --- a/src/api/api/explain.ts +++ b/src/api/api/explain.ts @@ -42,21 +42,21 @@ export default async function ExplainApi (this: That, param export default async function ExplainApi (this: That, params: T.ExplainRequest | TB.ExplainRequest, options?: TransportRequestOptions): Promise> export default async function ExplainApi (this: That, params: T.ExplainRequest | TB.ExplainRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id', 'index'] - const acceptedQuery: string[] = ['analyzer', 'analyze_wildcard', 'default_operator', 'df', 'lenient', 'preference', 'routing', '_source', '_source_excludes', '_source_includes', 'stored_fields', 'q', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['query'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } diff --git a/src/api/api/features.ts b/src/api/api/features.ts index f1b834ed8..d05d4831a 100644 --- a/src/api/api/features.ts +++ b/src/api/api/features.ts @@ -48,22 +48,16 @@ export default class Features { async getFeatures (this: That, params?: T.FeaturesGetFeaturesRequest | TB.FeaturesGetFeaturesRequest, options?: TransportRequestOptions): Promise async getFeatures (this: That, params?: T.FeaturesGetFeaturesRequest | TB.FeaturesGetFeaturesRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -77,22 +71,16 @@ export default class Features { async resetFeatures (this: That, params?: T.FeaturesResetFeaturesRequest | TB.FeaturesResetFeaturesRequest, options?: TransportRequestOptions): Promise async resetFeatures (this: That, params?: T.FeaturesResetFeaturesRequest | TB.FeaturesResetFeaturesRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } diff --git a/src/api/api/field_caps.ts b/src/api/api/field_caps.ts index 0fa9ca6bf..6c5692125 100644 --- a/src/api/api/field_caps.ts +++ b/src/api/api/field_caps.ts @@ -42,22 +42,22 @@ export default async function FieldCapsApi (this: That, params?: T.FieldCapsRequ export default async function FieldCapsApi (this: That, params?: T.FieldCapsRequest | TB.FieldCapsRequest, options?: TransportRequestOptions): Promise export default async function FieldCapsApi (this: That, params?: T.FieldCapsRequest | TB.FieldCapsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['allow_no_indices', 'expand_wildcards', 'fields', 'ignore_unavailable', 'include_unmapped', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['index_filter', 'runtime_mappings'] const querystring: Record = {} // @ts-expect-error let body: Record = params?.body ?? undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } diff --git a/src/api/api/fleet.ts b/src/api/api/fleet.ts index 44f1f2758..fbf076cce 100644 --- a/src/api/api/fleet.ts +++ b/src/api/api/fleet.ts @@ -48,19 +48,15 @@ export default class Fleet { async globalCheckpoints (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise async globalCheckpoints (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['wait_for_advance', 'wait_for_index', 'checkpoints', 'timeout'] const querystring: Record = {} - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} - body[key] = params[key] + querystring[key] = params[key] } } diff --git a/src/api/api/get.ts b/src/api/api/get.ts index 9344e573b..12aa2faf9 100644 --- a/src/api/api/get.ts +++ b/src/api/api/get.ts @@ -42,21 +42,15 @@ export default async function GetApi (this: That, params: T export default async function GetApi (this: That, params: T.GetRequest | TB.GetRequest, options?: TransportRequestOptions): Promise> export default async function GetApi (this: That, params: T.GetRequest | TB.GetRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id', 'index'] - const acceptedQuery: string[] = ['preference', 'realtime', 'refresh', 'routing', '_source', '_source_excludes', '_source_includes', 'stored_fields', 'version', 'version_type', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } diff --git a/src/api/api/get_script.ts b/src/api/api/get_script.ts index 0e27e86d0..515926b66 100644 --- a/src/api/api/get_script.ts +++ b/src/api/api/get_script.ts @@ -42,21 +42,15 @@ export default async function GetScriptApi (this: That, params: T.GetScriptReque export default async function GetScriptApi (this: That, params: T.GetScriptRequest | TB.GetScriptRequest, options?: TransportRequestOptions): Promise export default async function GetScriptApi (this: That, params: T.GetScriptRequest | TB.GetScriptRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const acceptedQuery: string[] = ['master_timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } diff --git a/src/api/api/get_script_context.ts b/src/api/api/get_script_context.ts index 0e0bc0f7a..9cb53cdb0 100644 --- a/src/api/api/get_script_context.ts +++ b/src/api/api/get_script_context.ts @@ -42,22 +42,16 @@ export default async function GetScriptContextApi (this: That, params?: T.GetScr export default async function GetScriptContextApi (this: That, params?: T.GetScriptContextRequest | TB.GetScriptContextRequest, options?: TransportRequestOptions): Promise export default async function GetScriptContextApi (this: That, params?: T.GetScriptContextRequest | TB.GetScriptContextRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } diff --git a/src/api/api/get_script_languages.ts b/src/api/api/get_script_languages.ts index 6d492458f..e4ce35ca0 100644 --- a/src/api/api/get_script_languages.ts +++ b/src/api/api/get_script_languages.ts @@ -42,22 +42,16 @@ export default async function GetScriptLanguagesApi (this: That, params?: T.GetS export default async function GetScriptLanguagesApi (this: That, params?: T.GetScriptLanguagesRequest | TB.GetScriptLanguagesRequest, options?: TransportRequestOptions): Promise export default async function GetScriptLanguagesApi (this: That, params?: T.GetScriptLanguagesRequest | TB.GetScriptLanguagesRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } diff --git a/src/api/api/get_source.ts b/src/api/api/get_source.ts index 60c6e7e55..0e0aa6737 100644 --- a/src/api/api/get_source.ts +++ b/src/api/api/get_source.ts @@ -42,21 +42,15 @@ export default async function GetSourceApi (this: That, par export default async function GetSourceApi (this: That, params: T.GetSourceRequest | TB.GetSourceRequest, options?: TransportRequestOptions): Promise> export default async function GetSourceApi (this: That, params: T.GetSourceRequest | TB.GetSourceRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id', 'index'] - const acceptedQuery: string[] = ['preference', 'realtime', 'refresh', 'routing', '_source', '_source_excludes', '_source_includes', 'stored_fields', 'version', 'version_type', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } diff --git a/src/api/api/graph.ts b/src/api/api/graph.ts index 38ec4fa0a..c92260c0e 100644 --- a/src/api/api/graph.ts +++ b/src/api/api/graph.ts @@ -48,21 +48,21 @@ export default class Graph { async explore (this: That, params: T.GraphExploreRequest | TB.GraphExploreRequest, options?: TransportRequestOptions): Promise async explore (this: That, params: T.GraphExploreRequest | TB.GraphExploreRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['routing', 'timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['connections', 'controls', 'query', 'vertices'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } diff --git a/src/api/api/ilm.ts b/src/api/api/ilm.ts index eebf27269..7ccac54f0 100644 --- a/src/api/api/ilm.ts +++ b/src/api/api/ilm.ts @@ -48,21 +48,15 @@ export default class Ilm { async deleteLifecycle (this: That, params: T.IlmDeleteLifecycleRequest | TB.IlmDeleteLifecycleRequest, options?: TransportRequestOptions): Promise async deleteLifecycle (this: That, params: T.IlmDeleteLifecycleRequest | TB.IlmDeleteLifecycleRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['policy'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -76,21 +70,15 @@ export default class Ilm { async explainLifecycle (this: That, params: T.IlmExplainLifecycleRequest | TB.IlmExplainLifecycleRequest, options?: TransportRequestOptions): Promise async explainLifecycle (this: That, params: T.IlmExplainLifecycleRequest | TB.IlmExplainLifecycleRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['only_errors', 'only_managed', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -104,22 +92,16 @@ export default class Ilm { async getLifecycle (this: That, params?: T.IlmGetLifecycleRequest | TB.IlmGetLifecycleRequest, options?: TransportRequestOptions): Promise async getLifecycle (this: That, params?: T.IlmGetLifecycleRequest | TB.IlmGetLifecycleRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['policy'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -140,22 +122,16 @@ export default class Ilm { async getStatus (this: That, params?: T.IlmGetStatusRequest | TB.IlmGetStatusRequest, options?: TransportRequestOptions): Promise async getStatus (this: That, params?: T.IlmGetStatusRequest | TB.IlmGetStatusRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -169,19 +145,15 @@ export default class Ilm { async migrateToDataTiers (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise async migrateToDataTiers (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['dry_run'] const querystring: Record = {} - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} - body[key] = params[key] + querystring[key] = params[key] } } @@ -195,21 +167,21 @@ export default class Ilm { async moveToStep (this: That, params: T.IlmMoveToStepRequest | TB.IlmMoveToStepRequest, options?: TransportRequestOptions): Promise async moveToStep (this: That, params: T.IlmMoveToStepRequest | TB.IlmMoveToStepRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['current_step', 'next_step'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -223,21 +195,21 @@ export default class Ilm { async putLifecycle (this: That, params: T.IlmPutLifecycleRequest | TB.IlmPutLifecycleRequest, options?: TransportRequestOptions): Promise async putLifecycle (this: That, params: T.IlmPutLifecycleRequest | TB.IlmPutLifecycleRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['policy'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -251,21 +223,15 @@ export default class Ilm { async removePolicy (this: That, params: T.IlmRemovePolicyRequest | TB.IlmRemovePolicyRequest, options?: TransportRequestOptions): Promise async removePolicy (this: That, params: T.IlmRemovePolicyRequest | TB.IlmRemovePolicyRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -279,21 +245,15 @@ export default class Ilm { async retry (this: That, params: T.IlmRetryRequest | TB.IlmRetryRequest, options?: TransportRequestOptions): Promise async retry (this: That, params: T.IlmRetryRequest | TB.IlmRetryRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -307,22 +267,16 @@ export default class Ilm { async start (this: That, params?: T.IlmStartRequest | TB.IlmStartRequest, options?: TransportRequestOptions): Promise async start (this: That, params?: T.IlmStartRequest | TB.IlmStartRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['master_timeout', 'timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -336,22 +290,16 @@ export default class Ilm { async stop (this: That, params?: T.IlmStopRequest | TB.IlmStopRequest, options?: TransportRequestOptions): Promise async stop (this: That, params?: T.IlmStopRequest | TB.IlmStopRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['master_timeout', 'timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } diff --git a/src/api/api/index.ts b/src/api/api/index.ts index 2800f42da..f1aac6a12 100644 --- a/src/api/api/index.ts +++ b/src/api/api/index.ts @@ -42,20 +42,20 @@ export default async function IndexApi (this: That, params: export default async function IndexApi (this: That, params: T.IndexRequest | TB.IndexRequest, options?: TransportRequestOptions): Promise export default async function IndexApi (this: That, params: T.IndexRequest | TB.IndexRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id', 'index'] - const acceptedQuery: string[] = ['if_primary_term', 'if_seq_no', 'op_type', 'pipeline', 'refresh', 'routing', 'timeout', 'version', 'version_type', 'wait_for_active_shards', 'require_alias', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['document'] const querystring: Record = {} // @ts-expect-error let body: any = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { + if (acceptedBody.includes(key)) { // @ts-expect-error - querystring[key] = params[key] + body = params[key] } else if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { // @ts-expect-error - body = params[key] + querystring[key] = params[key] } } diff --git a/src/api/api/indices.ts b/src/api/api/indices.ts index c51601c59..52fd341f6 100644 --- a/src/api/api/indices.ts +++ b/src/api/api/indices.ts @@ -48,21 +48,15 @@ export default class Indices { async addBlock (this: That, params: T.IndicesAddBlockRequest | TB.IndicesAddBlockRequest, options?: TransportRequestOptions): Promise async addBlock (this: That, params: T.IndicesAddBlockRequest | TB.IndicesAddBlockRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index', 'block'] - const acceptedQuery: string[] = ['allow_no_indices', 'expand_wildcards', 'ignore_unavailable', 'master_timeout', 'timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -76,22 +70,22 @@ export default class Indices { async analyze (this: That, params?: T.IndicesAnalyzeRequest | TB.IndicesAnalyzeRequest, options?: TransportRequestOptions): Promise async analyze (this: That, params?: T.IndicesAnalyzeRequest | TB.IndicesAnalyzeRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['analyzer', 'attributes', 'char_filter', 'explain', 'field', 'filter', 'normalizer', 'text', 'tokenizer'] const querystring: Record = {} // @ts-expect-error let body: Record = params?.body ?? undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -112,22 +106,16 @@ export default class Indices { async clearCache (this: That, params?: T.IndicesClearCacheRequest | TB.IndicesClearCacheRequest, options?: TransportRequestOptions): Promise async clearCache (this: That, params?: T.IndicesClearCacheRequest | TB.IndicesClearCacheRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['allow_no_indices', 'expand_wildcards', 'fielddata', 'fields', 'ignore_unavailable', 'query', 'request', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -148,21 +136,21 @@ export default class Indices { async clone (this: That, params: T.IndicesCloneRequest | TB.IndicesCloneRequest, options?: TransportRequestOptions): Promise async clone (this: That, params: T.IndicesCloneRequest | TB.IndicesCloneRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index', 'target'] - const acceptedQuery: string[] = ['master_timeout', 'timeout', 'wait_for_active_shards', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['aliases', 'settings'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -176,21 +164,15 @@ export default class Indices { async close (this: That, params: T.IndicesCloseRequest | TB.IndicesCloseRequest, options?: TransportRequestOptions): Promise async close (this: That, params: T.IndicesCloseRequest | TB.IndicesCloseRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['allow_no_indices', 'expand_wildcards', 'ignore_unavailable', 'master_timeout', 'timeout', 'wait_for_active_shards', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -204,21 +186,21 @@ export default class Indices { async create (this: That, params: T.IndicesCreateRequest | TB.IndicesCreateRequest, options?: TransportRequestOptions): Promise async create (this: That, params: T.IndicesCreateRequest | TB.IndicesCreateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['include_type_name', 'master_timeout', 'timeout', 'wait_for_active_shards', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['aliases', 'mappings', 'settings'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -232,21 +214,15 @@ export default class Indices { async createDataStream (this: That, params: T.IndicesCreateDataStreamRequest | TB.IndicesCreateDataStreamRequest, options?: TransportRequestOptions): Promise async createDataStream (this: That, params: T.IndicesCreateDataStreamRequest | TB.IndicesCreateDataStreamRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -260,22 +236,16 @@ export default class Indices { async dataStreamsStats (this: That, params?: T.IndicesDataStreamsStatsRequest | TB.IndicesDataStreamsStatsRequest, options?: TransportRequestOptions): Promise async dataStreamsStats (this: That, params?: T.IndicesDataStreamsStatsRequest | TB.IndicesDataStreamsStatsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const acceptedQuery: string[] = ['expand_wildcards', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -296,21 +266,15 @@ export default class Indices { async delete (this: That, params: T.IndicesDeleteRequest | TB.IndicesDeleteRequest, options?: TransportRequestOptions): Promise async delete (this: That, params: T.IndicesDeleteRequest | TB.IndicesDeleteRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['allow_no_indices', 'expand_wildcards', 'ignore_unavailable', 'master_timeout', 'timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -324,21 +288,15 @@ export default class Indices { async deleteAlias (this: That, params: T.IndicesDeleteAliasRequest | TB.IndicesDeleteAliasRequest, options?: TransportRequestOptions): Promise async deleteAlias (this: That, params: T.IndicesDeleteAliasRequest | TB.IndicesDeleteAliasRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index', 'name'] - const acceptedQuery: string[] = ['master_timeout', 'timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -359,21 +317,15 @@ export default class Indices { async deleteDataStream (this: That, params: T.IndicesDeleteDataStreamRequest | TB.IndicesDeleteDataStreamRequest, options?: TransportRequestOptions): Promise async deleteDataStream (this: That, params: T.IndicesDeleteDataStreamRequest | TB.IndicesDeleteDataStreamRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const acceptedQuery: string[] = ['expand_wildcards', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -387,21 +339,15 @@ export default class Indices { async deleteIndexTemplate (this: That, params: T.IndicesDeleteIndexTemplateRequest | TB.IndicesDeleteIndexTemplateRequest, options?: TransportRequestOptions): Promise async deleteIndexTemplate (this: That, params: T.IndicesDeleteIndexTemplateRequest | TB.IndicesDeleteIndexTemplateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -415,21 +361,15 @@ export default class Indices { async deleteTemplate (this: That, params: T.IndicesDeleteTemplateRequest | TB.IndicesDeleteTemplateRequest, options?: TransportRequestOptions): Promise async deleteTemplate (this: That, params: T.IndicesDeleteTemplateRequest | TB.IndicesDeleteTemplateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const acceptedQuery: string[] = ['master_timeout', 'timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -443,21 +383,15 @@ export default class Indices { async diskUsage (this: That, params: T.IndicesDiskUsageRequest | TB.IndicesDiskUsageRequest, options?: TransportRequestOptions): Promise async diskUsage (this: That, params: T.IndicesDiskUsageRequest | TB.IndicesDiskUsageRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['allow_no_indices', 'expand_wildcards', 'flush', 'ignore_unavailable', 'master_timeout', 'timeout', 'run_expensive_tasks', 'wait_for_active_shards', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -471,21 +405,15 @@ export default class Indices { async exists (this: That, params: T.IndicesExistsRequest | TB.IndicesExistsRequest, options?: TransportRequestOptions): Promise async exists (this: That, params: T.IndicesExistsRequest | TB.IndicesExistsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['allow_no_indices', 'expand_wildcards', 'flat_settings', 'ignore_unavailable', 'include_defaults', 'local', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -499,21 +427,15 @@ export default class Indices { async existsAlias (this: That, params: T.IndicesExistsAliasRequest | TB.IndicesExistsAliasRequest, options?: TransportRequestOptions): Promise async existsAlias (this: That, params: T.IndicesExistsAliasRequest | TB.IndicesExistsAliasRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name', 'index'] - const acceptedQuery: string[] = ['allow_no_indices', 'expand_wildcards', 'ignore_unavailable', 'local', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -534,21 +456,15 @@ export default class Indices { async existsIndexTemplate (this: That, params: T.IndicesExistsIndexTemplateRequest | TB.IndicesExistsIndexTemplateRequest, options?: TransportRequestOptions): Promise async existsIndexTemplate (this: That, params: T.IndicesExistsIndexTemplateRequest | TB.IndicesExistsIndexTemplateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const acceptedQuery: string[] = ['master_timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -562,21 +478,15 @@ export default class Indices { async existsTemplate (this: That, params: T.IndicesExistsTemplateRequest | TB.IndicesExistsTemplateRequest, options?: TransportRequestOptions): Promise async existsTemplate (this: That, params: T.IndicesExistsTemplateRequest | TB.IndicesExistsTemplateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const acceptedQuery: string[] = ['flat_settings', 'local', 'master_timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -590,21 +500,15 @@ export default class Indices { async existsType (this: That, params: T.IndicesExistsTypeRequest | TB.IndicesExistsTypeRequest, options?: TransportRequestOptions): Promise async existsType (this: That, params: T.IndicesExistsTypeRequest | TB.IndicesExistsTypeRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index', 'type'] - const acceptedQuery: string[] = ['allow_no_indices', 'expand_wildcards', 'ignore_unavailable', 'local', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -618,19 +522,15 @@ export default class Indices { async fieldUsageStats (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise async fieldUsageStats (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['fields', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards'] const querystring: Record = {} - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} - body[key] = params[key] + querystring[key] = params[key] } } @@ -644,22 +544,16 @@ export default class Indices { async flush (this: That, params?: T.IndicesFlushRequest | TB.IndicesFlushRequest, options?: TransportRequestOptions): Promise async flush (this: That, params?: T.IndicesFlushRequest | TB.IndicesFlushRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['allow_no_indices', 'expand_wildcards', 'force', 'ignore_unavailable', 'wait_if_ongoing', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -680,22 +574,16 @@ export default class Indices { async forcemerge (this: That, params?: T.IndicesForcemergeRequest | TB.IndicesForcemergeRequest, options?: TransportRequestOptions): Promise async forcemerge (this: That, params?: T.IndicesForcemergeRequest | TB.IndicesForcemergeRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['allow_no_indices', 'expand_wildcards', 'flush', 'ignore_unavailable', 'max_num_segments', 'only_expunge_deletes', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -716,21 +604,15 @@ export default class Indices { async get (this: That, params: T.IndicesGetRequest | TB.IndicesGetRequest, options?: TransportRequestOptions): Promise async get (this: That, params: T.IndicesGetRequest | TB.IndicesGetRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['allow_no_indices', 'expand_wildcards', 'flat_settings', 'ignore_unavailable', 'include_defaults', 'include_type_name', 'local', 'master_timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -744,22 +626,16 @@ export default class Indices { async getAlias (this: That, params?: T.IndicesGetAliasRequest | TB.IndicesGetAliasRequest, options?: TransportRequestOptions): Promise async getAlias (this: That, params?: T.IndicesGetAliasRequest | TB.IndicesGetAliasRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name', 'index'] - const acceptedQuery: string[] = ['allow_no_indices', 'expand_wildcards', 'ignore_unavailable', 'local', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -786,22 +662,16 @@ export default class Indices { async getDataStream (this: That, params?: T.IndicesGetDataStreamRequest | TB.IndicesGetDataStreamRequest, options?: TransportRequestOptions): Promise async getDataStream (this: That, params?: T.IndicesGetDataStreamRequest | TB.IndicesGetDataStreamRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const acceptedQuery: string[] = ['expand_wildcards', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -822,21 +692,15 @@ export default class Indices { async getFieldMapping (this: That, params: T.IndicesGetFieldMappingRequest | TB.IndicesGetFieldMappingRequest, options?: TransportRequestOptions): Promise async getFieldMapping (this: That, params: T.IndicesGetFieldMappingRequest | TB.IndicesGetFieldMappingRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['fields', 'index'] - const acceptedQuery: string[] = ['allow_no_indices', 'expand_wildcards', 'ignore_unavailable', 'include_defaults', 'include_type_name', 'local', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -857,22 +721,16 @@ export default class Indices { async getIndexTemplate (this: That, params?: T.IndicesGetIndexTemplateRequest | TB.IndicesGetIndexTemplateRequest, options?: TransportRequestOptions): Promise async getIndexTemplate (this: That, params?: T.IndicesGetIndexTemplateRequest | TB.IndicesGetIndexTemplateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const acceptedQuery: string[] = ['local', 'flat_settings', 'include_type_name', 'master_timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -893,22 +751,16 @@ export default class Indices { async getMapping (this: That, params?: T.IndicesGetMappingRequest | TB.IndicesGetMappingRequest, options?: TransportRequestOptions): Promise async getMapping (this: That, params?: T.IndicesGetMappingRequest | TB.IndicesGetMappingRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['allow_no_indices', 'expand_wildcards', 'ignore_unavailable', 'include_type_name', 'local', 'master_timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -929,22 +781,16 @@ export default class Indices { async getSettings (this: That, params?: T.IndicesGetSettingsRequest | TB.IndicesGetSettingsRequest, options?: TransportRequestOptions): Promise async getSettings (this: That, params?: T.IndicesGetSettingsRequest | TB.IndicesGetSettingsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index', 'name'] - const acceptedQuery: string[] = ['allow_no_indices', 'expand_wildcards', 'flat_settings', 'ignore_unavailable', 'include_defaults', 'local', 'master_timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -971,22 +817,16 @@ export default class Indices { async getTemplate (this: That, params?: T.IndicesGetTemplateRequest | TB.IndicesGetTemplateRequest, options?: TransportRequestOptions): Promise async getTemplate (this: That, params?: T.IndicesGetTemplateRequest | TB.IndicesGetTemplateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const acceptedQuery: string[] = ['flat_settings', 'include_type_name', 'local', 'master_timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -1007,21 +847,15 @@ export default class Indices { async migrateToDataStream (this: That, params: T.IndicesMigrateToDataStreamRequest | TB.IndicesMigrateToDataStreamRequest, options?: TransportRequestOptions): Promise async migrateToDataStream (this: That, params: T.IndicesMigrateToDataStreamRequest | TB.IndicesMigrateToDataStreamRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -1035,21 +869,15 @@ export default class Indices { async open (this: That, params: T.IndicesOpenRequest | TB.IndicesOpenRequest, options?: TransportRequestOptions): Promise async open (this: That, params: T.IndicesOpenRequest | TB.IndicesOpenRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['allow_no_indices', 'expand_wildcards', 'ignore_unavailable', 'master_timeout', 'timeout', 'wait_for_active_shards', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -1063,21 +891,15 @@ export default class Indices { async promoteDataStream (this: That, params: T.IndicesPromoteDataStreamRequest | TB.IndicesPromoteDataStreamRequest, options?: TransportRequestOptions): Promise async promoteDataStream (this: That, params: T.IndicesPromoteDataStreamRequest | TB.IndicesPromoteDataStreamRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -1091,21 +913,21 @@ export default class Indices { async putAlias (this: That, params: T.IndicesPutAliasRequest | TB.IndicesPutAliasRequest, options?: TransportRequestOptions): Promise async putAlias (this: That, params: T.IndicesPutAliasRequest | TB.IndicesPutAliasRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index', 'name'] - const acceptedQuery: string[] = ['master_timeout', 'timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['filter', 'index_routing', 'is_write_index', 'routing', 'search_routing'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -1126,21 +948,21 @@ export default class Indices { async putIndexTemplate (this: That, params: T.IndicesPutIndexTemplateRequest | TB.IndicesPutIndexTemplateRequest, options?: TransportRequestOptions): Promise async putIndexTemplate (this: That, params: T.IndicesPutIndexTemplateRequest | TB.IndicesPutIndexTemplateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['index_patterns', 'composed_of', 'template', 'data_stream', 'priority', 'version', '_meta'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -1154,21 +976,21 @@ export default class Indices { async putMapping (this: That, params: T.IndicesPutMappingRequest | TB.IndicesPutMappingRequest, options?: TransportRequestOptions): Promise async putMapping (this: That, params: T.IndicesPutMappingRequest | TB.IndicesPutMappingRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['allow_no_indices', 'expand_wildcards', 'ignore_unavailable', 'include_type_name', 'master_timeout', 'timeout', 'write_index_only', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['date_detection', 'dynamic', 'dynamic_date_formats', 'dynamic_templates', '_field_names', '_meta', 'numeric_detection', 'properties', '_routing', '_source', 'runtime'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -1182,20 +1004,20 @@ export default class Indices { async putSettings (this: That, params: T.IndicesPutSettingsRequest | TB.IndicesPutSettingsRequest, options?: TransportRequestOptions): Promise async putSettings (this: That, params: T.IndicesPutSettingsRequest | TB.IndicesPutSettingsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['allow_no_indices', 'expand_wildcards', 'flat_settings', 'ignore_unavailable', 'master_timeout', 'preserve_existing', 'timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['settings'] const querystring: Record = {} // @ts-expect-error let body: any = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { + if (acceptedBody.includes(key)) { // @ts-expect-error - querystring[key] = params[key] + body = params[key] } else if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { // @ts-expect-error - body = params[key] + querystring[key] = params[key] } } @@ -1216,21 +1038,21 @@ export default class Indices { async putTemplate (this: That, params: T.IndicesPutTemplateRequest | TB.IndicesPutTemplateRequest, options?: TransportRequestOptions): Promise async putTemplate (this: That, params: T.IndicesPutTemplateRequest | TB.IndicesPutTemplateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const acceptedQuery: string[] = ['create', 'flat_settings', 'include_type_name', 'master_timeout', 'timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['aliases', 'index_patterns', 'mappings', 'settings', 'version'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -1244,22 +1066,16 @@ export default class Indices { async recovery (this: That, params?: T.IndicesRecoveryRequest | TB.IndicesRecoveryRequest, options?: TransportRequestOptions): Promise async recovery (this: That, params?: T.IndicesRecoveryRequest | TB.IndicesRecoveryRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['active_only', 'detailed', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -1280,22 +1096,16 @@ export default class Indices { async refresh (this: That, params?: T.IndicesRefreshRequest | TB.IndicesRefreshRequest, options?: TransportRequestOptions): Promise async refresh (this: That, params?: T.IndicesRefreshRequest | TB.IndicesRefreshRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['allow_no_indices', 'expand_wildcards', 'ignore_unavailable', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -1316,21 +1126,15 @@ export default class Indices { async reloadSearchAnalyzers (this: That, params: T.IndicesReloadSearchAnalyzersRequest | TB.IndicesReloadSearchAnalyzersRequest, options?: TransportRequestOptions): Promise async reloadSearchAnalyzers (this: That, params: T.IndicesReloadSearchAnalyzersRequest | TB.IndicesReloadSearchAnalyzersRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['allow_no_indices', 'expand_wildcards', 'ignore_unavailable', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -1344,21 +1148,15 @@ export default class Indices { async resolveIndex (this: That, params: T.IndicesResolveIndexRequest | TB.IndicesResolveIndexRequest, options?: TransportRequestOptions): Promise async resolveIndex (this: That, params: T.IndicesResolveIndexRequest | TB.IndicesResolveIndexRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const acceptedQuery: string[] = ['expand_wildcards', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -1372,21 +1170,21 @@ export default class Indices { async rollover (this: That, params: T.IndicesRolloverRequest | TB.IndicesRolloverRequest, options?: TransportRequestOptions): Promise async rollover (this: That, params: T.IndicesRolloverRequest | TB.IndicesRolloverRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['alias', 'new_index'] - const acceptedQuery: string[] = ['dry_run', 'include_type_name', 'master_timeout', 'timeout', 'wait_for_active_shards', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['aliases', 'conditions', 'mappings', 'settings'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -1407,22 +1205,16 @@ export default class Indices { async segments (this: That, params?: T.IndicesSegmentsRequest | TB.IndicesSegmentsRequest, options?: TransportRequestOptions): Promise async segments (this: That, params?: T.IndicesSegmentsRequest | TB.IndicesSegmentsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['allow_no_indices', 'expand_wildcards', 'ignore_unavailable', 'verbose', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -1443,22 +1235,16 @@ export default class Indices { async shardStores (this: That, params?: T.IndicesShardStoresRequest | TB.IndicesShardStoresRequest, options?: TransportRequestOptions): Promise async shardStores (this: That, params?: T.IndicesShardStoresRequest | TB.IndicesShardStoresRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['allow_no_indices', 'expand_wildcards', 'ignore_unavailable', 'status', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -1479,21 +1265,21 @@ export default class Indices { async shrink (this: That, params: T.IndicesShrinkRequest | TB.IndicesShrinkRequest, options?: TransportRequestOptions): Promise async shrink (this: That, params: T.IndicesShrinkRequest | TB.IndicesShrinkRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index', 'target'] - const acceptedQuery: string[] = ['master_timeout', 'timeout', 'wait_for_active_shards', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['aliases', 'settings'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -1507,21 +1293,21 @@ export default class Indices { async simulateIndexTemplate (this: That, params: T.IndicesSimulateIndexTemplateRequest | TB.IndicesSimulateIndexTemplateRequest, options?: TransportRequestOptions): Promise async simulateIndexTemplate (this: That, params: T.IndicesSimulateIndexTemplateRequest | TB.IndicesSimulateIndexTemplateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['index_patterns', 'composed_of', 'overlapping', 'template'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -1535,20 +1321,20 @@ export default class Indices { async simulateTemplate (this: That, params: T.IndicesSimulateTemplateRequest | TB.IndicesSimulateTemplateRequest, options?: TransportRequestOptions): Promise async simulateTemplate (this: That, params: T.IndicesSimulateTemplateRequest | TB.IndicesSimulateTemplateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const acceptedQuery: string[] = ['create', 'master_timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['template'] const querystring: Record = {} // @ts-expect-error let body: any = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { + if (acceptedBody.includes(key)) { // @ts-expect-error - querystring[key] = params[key] + body = params[key] } else if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { // @ts-expect-error - body = params[key] + querystring[key] = params[key] } } @@ -1569,21 +1355,21 @@ export default class Indices { async split (this: That, params: T.IndicesSplitRequest | TB.IndicesSplitRequest, options?: TransportRequestOptions): Promise async split (this: That, params: T.IndicesSplitRequest | TB.IndicesSplitRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index', 'target'] - const acceptedQuery: string[] = ['master_timeout', 'timeout', 'wait_for_active_shards', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['aliases', 'settings'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -1597,22 +1383,16 @@ export default class Indices { async stats (this: That, params?: T.IndicesStatsRequest | TB.IndicesStatsRequest, options?: TransportRequestOptions): Promise async stats (this: That, params?: T.IndicesStatsRequest | TB.IndicesStatsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['metric', 'index'] - const acceptedQuery: string[] = ['completion_fields', 'expand_wildcards', 'fielddata_fields', 'fields', 'forbid_closed_indices', 'groups', 'include_segment_file_sizes', 'include_unloaded_segments', 'level', 'types', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -1639,22 +1419,22 @@ export default class Indices { async updateAliases (this: That, params?: T.IndicesUpdateAliasesRequest | TB.IndicesUpdateAliasesRequest, options?: TransportRequestOptions): Promise async updateAliases (this: That, params?: T.IndicesUpdateAliasesRequest | TB.IndicesUpdateAliasesRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['master_timeout', 'timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['actions'] const querystring: Record = {} // @ts-expect-error let body: Record = params?.body ?? undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -1668,22 +1448,22 @@ export default class Indices { async validateQuery (this: That, params?: T.IndicesValidateQueryRequest | TB.IndicesValidateQueryRequest, options?: TransportRequestOptions): Promise async validateQuery (this: That, params?: T.IndicesValidateQueryRequest | TB.IndicesValidateQueryRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index', 'type'] - const acceptedQuery: string[] = ['allow_no_indices', 'all_shards', 'analyzer', 'analyze_wildcard', 'default_operator', 'df', 'expand_wildcards', 'explain', 'ignore_unavailable', 'lenient', 'rewrite', 'q', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['query'] const querystring: Record = {} // @ts-expect-error let body: Record = params?.body ?? undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } diff --git a/src/api/api/info.ts b/src/api/api/info.ts index 336e08268..b7d58c650 100644 --- a/src/api/api/info.ts +++ b/src/api/api/info.ts @@ -42,22 +42,16 @@ export default async function InfoApi (this: That, params?: T.InfoRequest | TB.I export default async function InfoApi (this: That, params?: T.InfoRequest | TB.InfoRequest, options?: TransportRequestOptions): Promise export default async function InfoApi (this: That, params?: T.InfoRequest | TB.InfoRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } diff --git a/src/api/api/ingest.ts b/src/api/api/ingest.ts index e9bc410fd..8ab5146a0 100644 --- a/src/api/api/ingest.ts +++ b/src/api/api/ingest.ts @@ -48,21 +48,15 @@ export default class Ingest { async deletePipeline (this: That, params: T.IngestDeletePipelineRequest | TB.IngestDeletePipelineRequest, options?: TransportRequestOptions): Promise async deletePipeline (this: That, params: T.IngestDeletePipelineRequest | TB.IngestDeletePipelineRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const acceptedQuery: string[] = ['master_timeout', 'timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -76,22 +70,16 @@ export default class Ingest { async geoIpStats (this: That, params?: T.IngestGeoIpStatsRequest | TB.IngestGeoIpStatsRequest, options?: TransportRequestOptions): Promise async geoIpStats (this: That, params?: T.IngestGeoIpStatsRequest | TB.IngestGeoIpStatsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -105,22 +93,16 @@ export default class Ingest { async getPipeline (this: That, params?: T.IngestGetPipelineRequest | TB.IngestGetPipelineRequest, options?: TransportRequestOptions): Promise async getPipeline (this: That, params?: T.IngestGetPipelineRequest | TB.IngestGetPipelineRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const acceptedQuery: string[] = ['master_timeout', 'summary', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -141,22 +123,16 @@ export default class Ingest { async processorGrok (this: That, params?: T.IngestProcessorGrokRequest | TB.IngestProcessorGrokRequest, options?: TransportRequestOptions): Promise async processorGrok (this: That, params?: T.IngestProcessorGrokRequest | TB.IngestProcessorGrokRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -170,21 +146,21 @@ export default class Ingest { async putPipeline (this: That, params: T.IngestPutPipelineRequest | TB.IngestPutPipelineRequest, options?: TransportRequestOptions): Promise async putPipeline (this: That, params: T.IngestPutPipelineRequest | TB.IngestPutPipelineRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const acceptedQuery: string[] = ['master_timeout', 'timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['_meta', 'description', 'on_failure', 'processors', 'version'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -198,22 +174,22 @@ export default class Ingest { async simulate (this: That, params?: T.IngestSimulateRequest | TB.IngestSimulateRequest, options?: TransportRequestOptions): Promise async simulate (this: That, params?: T.IngestSimulateRequest | TB.IngestSimulateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const acceptedQuery: string[] = ['verbose', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['docs', 'pipeline'] const querystring: Record = {} // @ts-expect-error let body: Record = params?.body ?? undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } diff --git a/src/api/api/license.ts b/src/api/api/license.ts index 1ab3ee8e2..fafeb3f4a 100644 --- a/src/api/api/license.ts +++ b/src/api/api/license.ts @@ -48,22 +48,16 @@ export default class License { async delete (this: That, params?: T.LicenseDeleteRequest | TB.LicenseDeleteRequest, options?: TransportRequestOptions): Promise async delete (this: That, params?: T.LicenseDeleteRequest | TB.LicenseDeleteRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -77,22 +71,16 @@ export default class License { async get (this: That, params?: T.LicenseGetRequest | TB.LicenseGetRequest, options?: TransportRequestOptions): Promise async get (this: That, params?: T.LicenseGetRequest | TB.LicenseGetRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['accept_enterprise', 'local', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -106,22 +94,16 @@ export default class License { async getBasicStatus (this: That, params?: T.LicenseGetBasicStatusRequest | TB.LicenseGetBasicStatusRequest, options?: TransportRequestOptions): Promise async getBasicStatus (this: That, params?: T.LicenseGetBasicStatusRequest | TB.LicenseGetBasicStatusRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -135,22 +117,16 @@ export default class License { async getTrialStatus (this: That, params?: T.LicenseGetTrialStatusRequest | TB.LicenseGetTrialStatusRequest, options?: TransportRequestOptions): Promise async getTrialStatus (this: That, params?: T.LicenseGetTrialStatusRequest | TB.LicenseGetTrialStatusRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -164,22 +140,22 @@ export default class License { async post (this: That, params?: T.LicensePostRequest | TB.LicensePostRequest, options?: TransportRequestOptions): Promise async post (this: That, params?: T.LicensePostRequest | TB.LicensePostRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['acknowledge', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['license', 'licenses'] const querystring: Record = {} // @ts-expect-error let body: Record = params?.body ?? undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -193,22 +169,16 @@ export default class License { async postStartBasic (this: That, params?: T.LicensePostStartBasicRequest | TB.LicensePostStartBasicRequest, options?: TransportRequestOptions): Promise async postStartBasic (this: That, params?: T.LicensePostStartBasicRequest | TB.LicensePostStartBasicRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['acknowledge', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -222,22 +192,16 @@ export default class License { async postStartTrial (this: That, params?: T.LicensePostStartTrialRequest | TB.LicensePostStartTrialRequest, options?: TransportRequestOptions): Promise async postStartTrial (this: That, params?: T.LicensePostStartTrialRequest | TB.LicensePostStartTrialRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['acknowledge', 'type_query_string', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } diff --git a/src/api/api/logstash.ts b/src/api/api/logstash.ts index 7080312a4..9fc6d44bb 100644 --- a/src/api/api/logstash.ts +++ b/src/api/api/logstash.ts @@ -48,21 +48,15 @@ export default class Logstash { async deletePipeline (this: That, params: T.LogstashDeletePipelineRequest | TB.LogstashDeletePipelineRequest, options?: TransportRequestOptions): Promise async deletePipeline (this: That, params: T.LogstashDeletePipelineRequest | TB.LogstashDeletePipelineRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -76,21 +70,15 @@ export default class Logstash { async getPipeline (this: That, params: T.LogstashGetPipelineRequest | TB.LogstashGetPipelineRequest, options?: TransportRequestOptions): Promise async getPipeline (this: That, params: T.LogstashGetPipelineRequest | TB.LogstashGetPipelineRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -104,20 +92,20 @@ export default class Logstash { async putPipeline (this: That, params: T.LogstashPutPipelineRequest | TB.LogstashPutPipelineRequest, options?: TransportRequestOptions): Promise async putPipeline (this: That, params: T.LogstashPutPipelineRequest | TB.LogstashPutPipelineRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['pipeline'] const querystring: Record = {} // @ts-expect-error let body: any = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { + if (acceptedBody.includes(key)) { // @ts-expect-error - querystring[key] = params[key] + body = params[key] } else if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { // @ts-expect-error - body = params[key] + querystring[key] = params[key] } } diff --git a/src/api/api/mget.ts b/src/api/api/mget.ts index 292c07b01..d4a11874f 100644 --- a/src/api/api/mget.ts +++ b/src/api/api/mget.ts @@ -42,22 +42,22 @@ export default async function MgetApi (this: That, params?: export default async function MgetApi (this: That, params?: T.MgetRequest | TB.MgetRequest, options?: TransportRequestOptions): Promise> export default async function MgetApi (this: That, params?: T.MgetRequest | TB.MgetRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['preference', 'realtime', 'refresh', 'routing', '_source', '_source_excludes', '_source_includes', 'stored_fields', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['docs', 'ids'] const querystring: Record = {} // @ts-expect-error let body: Record = params?.body ?? undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } diff --git a/src/api/api/migration.ts b/src/api/api/migration.ts index de7253afd..27682a2f5 100644 --- a/src/api/api/migration.ts +++ b/src/api/api/migration.ts @@ -48,22 +48,16 @@ export default class Migration { async deprecations (this: That, params?: T.MigrationDeprecationsRequest | TB.MigrationDeprecationsRequest, options?: TransportRequestOptions): Promise async deprecations (this: That, params?: T.MigrationDeprecationsRequest | TB.MigrationDeprecationsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -78,4 +72,48 @@ export default class Migration { } return await this.transport.request({ path, method, querystring, body }, options) } + + async getFeatureUpgradeStatus (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise + async getFeatureUpgradeStatus (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise> + async getFeatureUpgradeStatus (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise + async getFeatureUpgradeStatus (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { + const acceptedPath: string[] = [] + const querystring: Record = {} + const body = undefined + + params = params ?? {} + for (const key in params) { + if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + querystring[key] = params[key] + } + } + + const method = 'GET' + const path = '/_migration/system_features' + return await this.transport.request({ path, method, querystring, body }, options) + } + + async postFeatureUpgrade (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise + async postFeatureUpgrade (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise> + async postFeatureUpgrade (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise + async postFeatureUpgrade (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { + const acceptedPath: string[] = [] + const querystring: Record = {} + const body = undefined + + params = params ?? {} + for (const key in params) { + if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + querystring[key] = params[key] + } + } + + const method = 'POST' + const path = '/_migration/system_features' + return await this.transport.request({ path, method, querystring, body }, options) + } } diff --git a/src/api/api/ml.ts b/src/api/api/ml.ts index 57596a6f2..945dad7a9 100644 --- a/src/api/api/ml.ts +++ b/src/api/api/ml.ts @@ -48,21 +48,15 @@ export default class Ml { async closeJob (this: That, params: T.MlCloseJobRequest | TB.MlCloseJobRequest, options?: TransportRequestOptions): Promise async closeJob (this: That, params: T.MlCloseJobRequest | TB.MlCloseJobRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['job_id'] - const acceptedQuery: string[] = ['allow_no_match', 'allow_no_jobs', 'force', 'timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -76,21 +70,15 @@ export default class Ml { async deleteCalendar (this: That, params: T.MlDeleteCalendarRequest | TB.MlDeleteCalendarRequest, options?: TransportRequestOptions): Promise async deleteCalendar (this: That, params: T.MlDeleteCalendarRequest | TB.MlDeleteCalendarRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['calendar_id'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -104,21 +92,15 @@ export default class Ml { async deleteCalendarEvent (this: That, params: T.MlDeleteCalendarEventRequest | TB.MlDeleteCalendarEventRequest, options?: TransportRequestOptions): Promise async deleteCalendarEvent (this: That, params: T.MlDeleteCalendarEventRequest | TB.MlDeleteCalendarEventRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['calendar_id', 'event_id'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -132,21 +114,15 @@ export default class Ml { async deleteCalendarJob (this: That, params: T.MlDeleteCalendarJobRequest | TB.MlDeleteCalendarJobRequest, options?: TransportRequestOptions): Promise async deleteCalendarJob (this: That, params: T.MlDeleteCalendarJobRequest | TB.MlDeleteCalendarJobRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['calendar_id', 'job_id'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -160,21 +136,15 @@ export default class Ml { async deleteDataFrameAnalytics (this: That, params: T.MlDeleteDataFrameAnalyticsRequest | TB.MlDeleteDataFrameAnalyticsRequest, options?: TransportRequestOptions): Promise async deleteDataFrameAnalytics (this: That, params: T.MlDeleteDataFrameAnalyticsRequest | TB.MlDeleteDataFrameAnalyticsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const acceptedQuery: string[] = ['force', 'timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -188,21 +158,15 @@ export default class Ml { async deleteDatafeed (this: That, params: T.MlDeleteDatafeedRequest | TB.MlDeleteDatafeedRequest, options?: TransportRequestOptions): Promise async deleteDatafeed (this: That, params: T.MlDeleteDatafeedRequest | TB.MlDeleteDatafeedRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['datafeed_id'] - const acceptedQuery: string[] = ['force', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -216,22 +180,16 @@ export default class Ml { async deleteExpiredData (this: That, params?: T.MlDeleteExpiredDataRequest | TB.MlDeleteExpiredDataRequest, options?: TransportRequestOptions): Promise async deleteExpiredData (this: That, params?: T.MlDeleteExpiredDataRequest | TB.MlDeleteExpiredDataRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['job_id'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -252,21 +210,15 @@ export default class Ml { async deleteFilter (this: That, params: T.MlDeleteFilterRequest | TB.MlDeleteFilterRequest, options?: TransportRequestOptions): Promise async deleteFilter (this: That, params: T.MlDeleteFilterRequest | TB.MlDeleteFilterRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['filter_id'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -280,21 +232,15 @@ export default class Ml { async deleteForecast (this: That, params: T.MlDeleteForecastRequest | TB.MlDeleteForecastRequest, options?: TransportRequestOptions): Promise async deleteForecast (this: That, params: T.MlDeleteForecastRequest | TB.MlDeleteForecastRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['job_id', 'forecast_id'] - const acceptedQuery: string[] = ['allow_no_forecasts', 'timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -315,21 +261,15 @@ export default class Ml { async deleteJob (this: That, params: T.MlDeleteJobRequest | TB.MlDeleteJobRequest, options?: TransportRequestOptions): Promise async deleteJob (this: That, params: T.MlDeleteJobRequest | TB.MlDeleteJobRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['job_id'] - const acceptedQuery: string[] = ['force', 'wait_for_completion', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -343,21 +283,15 @@ export default class Ml { async deleteModelSnapshot (this: That, params: T.MlDeleteModelSnapshotRequest | TB.MlDeleteModelSnapshotRequest, options?: TransportRequestOptions): Promise async deleteModelSnapshot (this: That, params: T.MlDeleteModelSnapshotRequest | TB.MlDeleteModelSnapshotRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['job_id', 'snapshot_id'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -371,21 +305,15 @@ export default class Ml { async deleteTrainedModel (this: That, params: T.MlDeleteTrainedModelRequest | TB.MlDeleteTrainedModelRequest, options?: TransportRequestOptions): Promise async deleteTrainedModel (this: That, params: T.MlDeleteTrainedModelRequest | TB.MlDeleteTrainedModelRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['model_id'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -399,21 +327,15 @@ export default class Ml { async deleteTrainedModelAlias (this: That, params: T.MlDeleteTrainedModelAliasRequest | TB.MlDeleteTrainedModelAliasRequest, options?: TransportRequestOptions): Promise async deleteTrainedModelAlias (this: That, params: T.MlDeleteTrainedModelAliasRequest | TB.MlDeleteTrainedModelAliasRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['model_alias', 'model_id'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -427,22 +349,22 @@ export default class Ml { async estimateModelMemory (this: That, params?: T.MlEstimateModelMemoryRequest | TB.MlEstimateModelMemoryRequest, options?: TransportRequestOptions): Promise async estimateModelMemory (this: That, params?: T.MlEstimateModelMemoryRequest | TB.MlEstimateModelMemoryRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['analysis_config', 'max_bucket_cardinality', 'overall_cardinality'] const querystring: Record = {} // @ts-expect-error let body: Record = params?.body ?? undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -456,21 +378,21 @@ export default class Ml { async evaluateDataFrame (this: That, params: T.MlEvaluateDataFrameRequest | TB.MlEvaluateDataFrameRequest, options?: TransportRequestOptions): Promise async evaluateDataFrame (this: That, params: T.MlEvaluateDataFrameRequest | TB.MlEvaluateDataFrameRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['evaluation', 'index', 'query'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -484,21 +406,21 @@ export default class Ml { async explainDataFrameAnalytics (this: That, params: T.MlExplainDataFrameAnalyticsRequest | TB.MlExplainDataFrameAnalyticsRequest, options?: TransportRequestOptions): Promise async explainDataFrameAnalytics (this: That, params: T.MlExplainDataFrameAnalyticsRequest | TB.MlExplainDataFrameAnalyticsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['source', 'dest', 'analysis', 'description', 'model_memory_limit', 'max_num_threads', 'analyzed_fields', 'allow_lazy_start'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -519,21 +441,21 @@ export default class Ml { async flushJob (this: That, params: T.MlFlushJobRequest | TB.MlFlushJobRequest, options?: TransportRequestOptions): Promise async flushJob (this: That, params: T.MlFlushJobRequest | TB.MlFlushJobRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['job_id'] - const acceptedQuery: string[] = ['skip_time', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['advance_time', 'calc_interim', 'end', 'start'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -547,21 +469,21 @@ export default class Ml { async forecast (this: That, params: T.MlForecastRequest | TB.MlForecastRequest, options?: TransportRequestOptions): Promise async forecast (this: That, params: T.MlForecastRequest | TB.MlForecastRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['job_id'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['duration', 'expires_in', 'max_model_memory'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -575,21 +497,21 @@ export default class Ml { async getBuckets (this: That, params: T.MlGetBucketsRequest | TB.MlGetBucketsRequest, options?: TransportRequestOptions): Promise async getBuckets (this: That, params: T.MlGetBucketsRequest | TB.MlGetBucketsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['job_id', 'timestamp'] - const acceptedQuery: string[] = ['from', 'size', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['anomaly_score', 'expand', 'page'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -610,21 +532,15 @@ export default class Ml { async getCalendarEvents (this: That, params: T.MlGetCalendarEventsRequest | TB.MlGetCalendarEventsRequest, options?: TransportRequestOptions): Promise async getCalendarEvents (this: That, params: T.MlGetCalendarEventsRequest | TB.MlGetCalendarEventsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['calendar_id'] - const acceptedQuery: string[] = ['job_id', 'end', 'from', 'start', 'size', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -638,22 +554,22 @@ export default class Ml { async getCalendars (this: That, params?: T.MlGetCalendarsRequest | TB.MlGetCalendarsRequest, options?: TransportRequestOptions): Promise async getCalendars (this: That, params?: T.MlGetCalendarsRequest | TB.MlGetCalendarsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['calendar_id'] - const acceptedQuery: string[] = ['from', 'size', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['page'] const querystring: Record = {} // @ts-expect-error let body: Record = params?.body ?? undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -674,21 +590,21 @@ export default class Ml { async getCategories (this: That, params: T.MlGetCategoriesRequest | TB.MlGetCategoriesRequest, options?: TransportRequestOptions): Promise async getCategories (this: That, params: T.MlGetCategoriesRequest | TB.MlGetCategoriesRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['job_id', 'category_id'] - const acceptedQuery: string[] = ['from', 'size', 'partition_field_value', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['page'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -709,22 +625,16 @@ export default class Ml { async getDataFrameAnalytics (this: That, params?: T.MlGetDataFrameAnalyticsRequest | TB.MlGetDataFrameAnalyticsRequest, options?: TransportRequestOptions): Promise async getDataFrameAnalytics (this: That, params?: T.MlGetDataFrameAnalyticsRequest | TB.MlGetDataFrameAnalyticsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const acceptedQuery: string[] = ['allow_no_match', 'from', 'size', 'exclude_generated', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -745,22 +655,16 @@ export default class Ml { async getDataFrameAnalyticsStats (this: That, params?: T.MlGetDataFrameAnalyticsStatsRequest | TB.MlGetDataFrameAnalyticsStatsRequest, options?: TransportRequestOptions): Promise async getDataFrameAnalyticsStats (this: That, params?: T.MlGetDataFrameAnalyticsStatsRequest | TB.MlGetDataFrameAnalyticsStatsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const acceptedQuery: string[] = ['allow_no_match', 'from', 'size', 'verbose', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -781,22 +685,16 @@ export default class Ml { async getDatafeedStats (this: That, params?: T.MlGetDatafeedStatsRequest | TB.MlGetDatafeedStatsRequest, options?: TransportRequestOptions): Promise async getDatafeedStats (this: That, params?: T.MlGetDatafeedStatsRequest | TB.MlGetDatafeedStatsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['datafeed_id'] - const acceptedQuery: string[] = ['allow_no_datafeeds', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -817,22 +715,16 @@ export default class Ml { async getDatafeeds (this: That, params?: T.MlGetDatafeedsRequest | TB.MlGetDatafeedsRequest, options?: TransportRequestOptions): Promise async getDatafeeds (this: That, params?: T.MlGetDatafeedsRequest | TB.MlGetDatafeedsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['datafeed_id'] - const acceptedQuery: string[] = ['allow_no_datafeeds', 'exclude_generated', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -853,22 +745,16 @@ export default class Ml { async getFilters (this: That, params?: T.MlGetFiltersRequest | TB.MlGetFiltersRequest, options?: TransportRequestOptions): Promise async getFilters (this: That, params?: T.MlGetFiltersRequest | TB.MlGetFiltersRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['filter_id'] - const acceptedQuery: string[] = ['from', 'size', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -889,21 +775,21 @@ export default class Ml { async getInfluencers (this: That, params: T.MlGetInfluencersRequest | TB.MlGetInfluencersRequest, options?: TransportRequestOptions): Promise async getInfluencers (this: That, params: T.MlGetInfluencersRequest | TB.MlGetInfluencersRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['job_id'] - const acceptedQuery: string[] = ['desc', 'end', 'exclude_interim', 'influencer_score', 'from', 'size', 'sort', 'start', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['page'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -917,22 +803,16 @@ export default class Ml { async getJobStats (this: That, params?: T.MlGetJobStatsRequest | TB.MlGetJobStatsRequest, options?: TransportRequestOptions): Promise async getJobStats (this: That, params?: T.MlGetJobStatsRequest | TB.MlGetJobStatsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['job_id'] - const acceptedQuery: string[] = ['allow_no_jobs', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -953,22 +833,16 @@ export default class Ml { async getJobs (this: That, params?: T.MlGetJobsRequest | TB.MlGetJobsRequest, options?: TransportRequestOptions): Promise async getJobs (this: That, params?: T.MlGetJobsRequest | TB.MlGetJobsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['job_id'] - const acceptedQuery: string[] = ['allow_no_match', 'allow_no_jobs', 'exclude_generated', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -989,21 +863,15 @@ export default class Ml { async getModelSnapshots (this: That, params: T.MlGetModelSnapshotsRequest | TB.MlGetModelSnapshotsRequest, options?: TransportRequestOptions): Promise async getModelSnapshots (this: That, params: T.MlGetModelSnapshotsRequest | TB.MlGetModelSnapshotsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['job_id', 'snapshot_id'] - const acceptedQuery: string[] = ['desc', 'from', 'size', 'sort', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -1024,21 +892,21 @@ export default class Ml { async getOverallBuckets (this: That, params: T.MlGetOverallBucketsRequest | TB.MlGetOverallBucketsRequest, options?: TransportRequestOptions): Promise async getOverallBuckets (this: That, params: T.MlGetOverallBucketsRequest | TB.MlGetOverallBucketsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['job_id'] - const acceptedQuery: string[] = ['bucket_span', 'overall_score', 'top_n', 'end', 'start', 'exclude_interim', 'allow_no_match', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['allow_no_jobs'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -1052,21 +920,21 @@ export default class Ml { async getRecords (this: That, params: T.MlGetRecordsRequest | TB.MlGetRecordsRequest, options?: TransportRequestOptions): Promise async getRecords (this: That, params: T.MlGetRecordsRequest | TB.MlGetRecordsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['job_id'] - const acceptedQuery: string[] = ['from', 'size', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['desc', 'page', 'record_score', 'sort'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -1080,19 +948,15 @@ export default class Ml { async getTrainedModelDeploymentStats (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise async getTrainedModelDeploymentStats (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['model_id'] - const acceptedQuery: string[] = [] const querystring: Record = {} - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} - body[key] = params[key] + querystring[key] = params[key] } } @@ -1106,22 +970,16 @@ export default class Ml { async getTrainedModels (this: That, params?: T.MlGetTrainedModelsRequest | TB.MlGetTrainedModelsRequest, options?: TransportRequestOptions): Promise async getTrainedModels (this: That, params?: T.MlGetTrainedModelsRequest | TB.MlGetTrainedModelsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['model_id'] - const acceptedQuery: string[] = ['allow_no_match', 'decompress_definition', 'exclude_generated', 'from', 'include', 'size', 'tags', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -1142,22 +1000,16 @@ export default class Ml { async getTrainedModelsStats (this: That, params?: T.MlGetTrainedModelsStatsRequest | TB.MlGetTrainedModelsStatsRequest, options?: TransportRequestOptions): Promise async getTrainedModelsStats (this: That, params?: T.MlGetTrainedModelsStatsRequest | TB.MlGetTrainedModelsStatsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['model_id'] - const acceptedQuery: string[] = ['allow_no_match', 'from', 'size', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -1178,19 +1030,15 @@ export default class Ml { async inferTrainedModelDeployment (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise async inferTrainedModelDeployment (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['model_id'] - const acceptedQuery: string[] = ['timeout'] const querystring: Record = {} - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} - body[key] = params[key] + querystring[key] = params[key] } } @@ -1204,22 +1052,16 @@ export default class Ml { async info (this: That, params?: T.MlInfoRequest | TB.MlInfoRequest, options?: TransportRequestOptions): Promise async info (this: That, params?: T.MlInfoRequest | TB.MlInfoRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -1233,21 +1075,21 @@ export default class Ml { async openJob (this: That, params: T.MlOpenJobRequest | TB.MlOpenJobRequest, options?: TransportRequestOptions): Promise async openJob (this: That, params: T.MlOpenJobRequest | TB.MlOpenJobRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['job_id'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['timeout'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -1261,21 +1103,21 @@ export default class Ml { async postCalendarEvents (this: That, params: T.MlPostCalendarEventsRequest | TB.MlPostCalendarEventsRequest, options?: TransportRequestOptions): Promise async postCalendarEvents (this: That, params: T.MlPostCalendarEventsRequest | TB.MlPostCalendarEventsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['calendar_id'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['events'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -1289,20 +1131,20 @@ export default class Ml { async postData (this: That, params: T.MlPostDataRequest | TB.MlPostDataRequest, options?: TransportRequestOptions): Promise async postData (this: That, params: T.MlPostDataRequest | TB.MlPostDataRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['job_id'] - const acceptedQuery: string[] = ['reset_end', 'reset_start', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['data'] const querystring: Record = {} // @ts-expect-error let body: any = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { + if (acceptedBody.includes(key)) { // @ts-expect-error - querystring[key] = params[key] + body = params[key] } else if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { // @ts-expect-error - body = params[key] + querystring[key] = params[key] } } @@ -1316,22 +1158,22 @@ export default class Ml { async previewDataFrameAnalytics (this: That, params?: T.MlPreviewDataFrameAnalyticsRequest | TB.MlPreviewDataFrameAnalyticsRequest, options?: TransportRequestOptions): Promise async previewDataFrameAnalytics (this: That, params?: T.MlPreviewDataFrameAnalyticsRequest | TB.MlPreviewDataFrameAnalyticsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['config'] const querystring: Record = {} // @ts-expect-error let body: Record = params?.body ?? undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -1352,22 +1194,22 @@ export default class Ml { async previewDatafeed (this: That, params?: T.MlPreviewDatafeedRequest | TB.MlPreviewDatafeedRequest, options?: TransportRequestOptions): Promise> async previewDatafeed (this: That, params?: T.MlPreviewDatafeedRequest | TB.MlPreviewDatafeedRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['datafeed_id'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['job_config', 'datafeed_config'] const querystring: Record = {} // @ts-expect-error let body: Record = params?.body ?? undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -1388,21 +1230,21 @@ export default class Ml { async putCalendar (this: That, params: T.MlPutCalendarRequest | TB.MlPutCalendarRequest, options?: TransportRequestOptions): Promise async putCalendar (this: That, params: T.MlPutCalendarRequest | TB.MlPutCalendarRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['calendar_id'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['description'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -1416,21 +1258,15 @@ export default class Ml { async putCalendarJob (this: That, params: T.MlPutCalendarJobRequest | TB.MlPutCalendarJobRequest, options?: TransportRequestOptions): Promise async putCalendarJob (this: That, params: T.MlPutCalendarJobRequest | TB.MlPutCalendarJobRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['calendar_id', 'job_id'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -1444,21 +1280,21 @@ export default class Ml { async putDataFrameAnalytics (this: That, params: T.MlPutDataFrameAnalyticsRequest | TB.MlPutDataFrameAnalyticsRequest, options?: TransportRequestOptions): Promise async putDataFrameAnalytics (this: That, params: T.MlPutDataFrameAnalyticsRequest | TB.MlPutDataFrameAnalyticsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['allow_lazy_start', 'analysis', 'analyzed_fields', 'description', 'dest', 'max_num_threads', 'model_memory_limit', 'source'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -1472,21 +1308,21 @@ export default class Ml { async putDatafeed (this: That, params: T.MlPutDatafeedRequest | TB.MlPutDatafeedRequest, options?: TransportRequestOptions): Promise async putDatafeed (this: That, params: T.MlPutDatafeedRequest | TB.MlPutDatafeedRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['datafeed_id'] - const acceptedQuery: string[] = ['allow_no_indices', 'expand_wildcards', 'ignore_throttled', 'ignore_unavailable', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['aggregations', 'chunking_config', 'delayed_data_check_config', 'frequency', 'indices', 'indices_options', 'job_id', 'max_empty_searches', 'query', 'query_delay', 'runtime_mappings', 'script_fields', 'scroll_size'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -1500,21 +1336,21 @@ export default class Ml { async putFilter (this: That, params: T.MlPutFilterRequest | TB.MlPutFilterRequest, options?: TransportRequestOptions): Promise async putFilter (this: That, params: T.MlPutFilterRequest | TB.MlPutFilterRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['filter_id'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['description', 'items'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -1528,21 +1364,21 @@ export default class Ml { async putJob (this: That, params: T.MlPutJobRequest | TB.MlPutJobRequest, options?: TransportRequestOptions): Promise async putJob (this: That, params: T.MlPutJobRequest | TB.MlPutJobRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['job_id'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['allow_lazy_open', 'analysis_config', 'analysis_limits', 'background_persist_interval', 'custom_settings', 'daily_model_snapshot_retention_after_days', 'data_description', 'datafeed_config', 'description', 'groups', 'model_plot_config', 'model_snapshot_retention_days', 'renormalization_window_days', 'results_index_name', 'results_retention_days'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -1556,21 +1392,21 @@ export default class Ml { async putTrainedModel (this: That, params: T.MlPutTrainedModelRequest | TB.MlPutTrainedModelRequest, options?: TransportRequestOptions): Promise async putTrainedModel (this: That, params: T.MlPutTrainedModelRequest | TB.MlPutTrainedModelRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['model_id'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['compressed_definition', 'definition', 'description', 'inference_config', 'input', 'metadata', 'tags'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -1584,21 +1420,15 @@ export default class Ml { async putTrainedModelAlias (this: That, params: T.MlPutTrainedModelAliasRequest | TB.MlPutTrainedModelAliasRequest, options?: TransportRequestOptions): Promise async putTrainedModelAlias (this: That, params: T.MlPutTrainedModelAliasRequest | TB.MlPutTrainedModelAliasRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['model_alias', 'model_id'] - const acceptedQuery: string[] = ['reassign', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -1612,19 +1442,15 @@ export default class Ml { async putTrainedModelDefinitionPart (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise async putTrainedModelDefinitionPart (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['model_id', 'part'] - const acceptedQuery: string[] = [] const querystring: Record = {} - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} - body[key] = params[key] + querystring[key] = params[key] } } @@ -1638,19 +1464,15 @@ export default class Ml { async putTrainedModelVocabulary (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise async putTrainedModelVocabulary (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['model_id'] - const acceptedQuery: string[] = [] const querystring: Record = {} - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} - body[key] = params[key] + querystring[key] = params[key] } } @@ -1664,21 +1486,15 @@ export default class Ml { async resetJob (this: That, params: T.MlResetJobRequest | TB.MlResetJobRequest, options?: TransportRequestOptions): Promise async resetJob (this: That, params: T.MlResetJobRequest | TB.MlResetJobRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['job_id'] - const acceptedQuery: string[] = ['wait_for_completion', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -1692,21 +1508,21 @@ export default class Ml { async revertModelSnapshot (this: That, params: T.MlRevertModelSnapshotRequest | TB.MlRevertModelSnapshotRequest, options?: TransportRequestOptions): Promise async revertModelSnapshot (this: That, params: T.MlRevertModelSnapshotRequest | TB.MlRevertModelSnapshotRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['job_id', 'snapshot_id'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['delete_intervening_results'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -1720,22 +1536,16 @@ export default class Ml { async setUpgradeMode (this: That, params?: T.MlSetUpgradeModeRequest | TB.MlSetUpgradeModeRequest, options?: TransportRequestOptions): Promise async setUpgradeMode (this: That, params?: T.MlSetUpgradeModeRequest | TB.MlSetUpgradeModeRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['enabled', 'timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -1749,21 +1559,15 @@ export default class Ml { async startDataFrameAnalytics (this: That, params: T.MlStartDataFrameAnalyticsRequest | TB.MlStartDataFrameAnalyticsRequest, options?: TransportRequestOptions): Promise async startDataFrameAnalytics (this: That, params: T.MlStartDataFrameAnalyticsRequest | TB.MlStartDataFrameAnalyticsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const acceptedQuery: string[] = ['timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -1777,21 +1581,21 @@ export default class Ml { async startDatafeed (this: That, params: T.MlStartDatafeedRequest | TB.MlStartDatafeedRequest, options?: TransportRequestOptions): Promise async startDatafeed (this: That, params: T.MlStartDatafeedRequest | TB.MlStartDatafeedRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['datafeed_id'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['end', 'timeout'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -1805,19 +1609,15 @@ export default class Ml { async startTrainedModelDeployment (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise async startTrainedModelDeployment (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['model_id'] - const acceptedQuery: string[] = ['timeout', 'wait_for'] const querystring: Record = {} - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} - body[key] = params[key] + querystring[key] = params[key] } } @@ -1831,21 +1631,15 @@ export default class Ml { async stopDataFrameAnalytics (this: That, params: T.MlStopDataFrameAnalyticsRequest | TB.MlStopDataFrameAnalyticsRequest, options?: TransportRequestOptions): Promise async stopDataFrameAnalytics (this: That, params: T.MlStopDataFrameAnalyticsRequest | TB.MlStopDataFrameAnalyticsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const acceptedQuery: string[] = ['allow_no_match', 'force', 'timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -1859,21 +1653,21 @@ export default class Ml { async stopDatafeed (this: That, params: T.MlStopDatafeedRequest | TB.MlStopDatafeedRequest, options?: TransportRequestOptions): Promise async stopDatafeed (this: That, params: T.MlStopDatafeedRequest | TB.MlStopDatafeedRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['datafeed_id'] - const acceptedQuery: string[] = ['allow_no_match', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['timeout'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -1887,19 +1681,15 @@ export default class Ml { async stopTrainedModelDeployment (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise async stopTrainedModelDeployment (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['model_id'] - const acceptedQuery: string[] = [] const querystring: Record = {} - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} - body[key] = params[key] + querystring[key] = params[key] } } @@ -1913,21 +1703,21 @@ export default class Ml { async updateDataFrameAnalytics (this: That, params: T.MlUpdateDataFrameAnalyticsRequest | TB.MlUpdateDataFrameAnalyticsRequest, options?: TransportRequestOptions): Promise async updateDataFrameAnalytics (this: That, params: T.MlUpdateDataFrameAnalyticsRequest | TB.MlUpdateDataFrameAnalyticsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['description', 'model_memory_limit', 'max_num_threads', 'allow_lazy_start'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -1941,19 +1731,15 @@ export default class Ml { async updateDatafeed (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise async updateDatafeed (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['datafeed_id'] - const acceptedQuery: string[] = ['ignore_unavailable', 'allow_no_indices', 'ignore_throttled', 'expand_wildcards'] const querystring: Record = {} - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} - body[key] = params[key] + querystring[key] = params[key] } } @@ -1967,21 +1753,21 @@ export default class Ml { async updateFilter (this: That, params: T.MlUpdateFilterRequest | TB.MlUpdateFilterRequest, options?: TransportRequestOptions): Promise async updateFilter (this: That, params: T.MlUpdateFilterRequest | TB.MlUpdateFilterRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['filter_id'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['add_items', 'description', 'remove_items'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -1995,21 +1781,21 @@ export default class Ml { async updateJob (this: That, params: T.MlUpdateJobRequest | TB.MlUpdateJobRequest, options?: TransportRequestOptions): Promise async updateJob (this: That, params: T.MlUpdateJobRequest | TB.MlUpdateJobRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['job_id'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['allow_lazy_open', 'analysis_limits', 'background_persist_interval', 'custom_settings', 'categorization_filters', 'description', 'model_plot_config', 'daily_model_snapshot_retention_after_days', 'model_snapshot_retention_days', 'renormalization_window_days', 'results_retention_days', 'groups', 'detectors', 'per_partition_categorization'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -2023,21 +1809,21 @@ export default class Ml { async updateModelSnapshot (this: That, params: T.MlUpdateModelSnapshotRequest | TB.MlUpdateModelSnapshotRequest, options?: TransportRequestOptions): Promise async updateModelSnapshot (this: That, params: T.MlUpdateModelSnapshotRequest | TB.MlUpdateModelSnapshotRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['job_id', 'snapshot_id'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['description', 'retain'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -2051,21 +1837,15 @@ export default class Ml { async upgradeJobSnapshot (this: That, params: T.MlUpgradeJobSnapshotRequest | TB.MlUpgradeJobSnapshotRequest, options?: TransportRequestOptions): Promise async upgradeJobSnapshot (this: That, params: T.MlUpgradeJobSnapshotRequest | TB.MlUpgradeJobSnapshotRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['job_id', 'snapshot_id'] - const acceptedQuery: string[] = ['wait_for_completion', 'timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -2079,22 +1859,22 @@ export default class Ml { async validate (this: That, params?: T.MlValidateRequest | TB.MlValidateRequest, options?: TransportRequestOptions): Promise async validate (this: That, params?: T.MlValidateRequest | TB.MlValidateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['job_id', 'analysis_config', 'analysis_limits', 'data_description', 'description', 'model_plot', 'model_snapshot_retention_days', 'results_index_name'] const querystring: Record = {} // @ts-expect-error let body: Record = params?.body ?? undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -2108,20 +1888,20 @@ export default class Ml { async validateDetector (this: That, params: T.MlValidateDetectorRequest | TB.MlValidateDetectorRequest, options?: TransportRequestOptions): Promise async validateDetector (this: That, params: T.MlValidateDetectorRequest | TB.MlValidateDetectorRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['detector'] const querystring: Record = {} // @ts-expect-error let body: any = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { + if (acceptedBody.includes(key)) { // @ts-expect-error - querystring[key] = params[key] + body = params[key] } else if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { // @ts-expect-error - body = params[key] + querystring[key] = params[key] } } diff --git a/src/api/api/monitoring.ts b/src/api/api/monitoring.ts index 2822b7699..6db509050 100644 --- a/src/api/api/monitoring.ts +++ b/src/api/api/monitoring.ts @@ -48,20 +48,20 @@ export default class Monitoring { async bulk (this: That, params: T.MonitoringBulkRequest | TB.MonitoringBulkRequest, options?: TransportRequestOptions): Promise async bulk (this: That, params: T.MonitoringBulkRequest | TB.MonitoringBulkRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['type'] - const acceptedQuery: string[] = ['system_id', 'system_api_version', 'interval', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['operations'] const querystring: Record = {} // @ts-expect-error let body: any = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { + if (acceptedBody.includes(key)) { // @ts-expect-error - querystring[key] = params[key] + body = params[key] } else if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { // @ts-expect-error - body = params[key] + querystring[key] = params[key] } } diff --git a/src/api/api/msearch.ts b/src/api/api/msearch.ts index b55b46093..67139b26e 100644 --- a/src/api/api/msearch.ts +++ b/src/api/api/msearch.ts @@ -42,20 +42,20 @@ export default async function MsearchApi (this: That, param export default async function MsearchApi (this: That, params: T.MsearchRequest | TB.MsearchRequest, options?: TransportRequestOptions): Promise> export default async function MsearchApi (this: That, params: T.MsearchRequest | TB.MsearchRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['allow_no_indices', 'ccs_minimize_roundtrips', 'expand_wildcards', 'ignore_throttled', 'ignore_unavailable', 'max_concurrent_searches', 'max_concurrent_shard_requests', 'pre_filter_shard_size', 'search_type', 'rest_total_hits_as_int', 'typed_keys', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['searches'] const querystring: Record = {} // @ts-expect-error let body: any = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { + if (acceptedBody.includes(key)) { // @ts-expect-error - querystring[key] = params[key] + body = params[key] } else if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { // @ts-expect-error - body = params[key] + querystring[key] = params[key] } } diff --git a/src/api/api/msearch_template.ts b/src/api/api/msearch_template.ts index b6298aff1..8cd92bcb7 100644 --- a/src/api/api/msearch_template.ts +++ b/src/api/api/msearch_template.ts @@ -42,20 +42,20 @@ export default async function MsearchTemplateApi (this: Tha export default async function MsearchTemplateApi (this: That, params: T.MsearchTemplateRequest | TB.MsearchTemplateRequest, options?: TransportRequestOptions): Promise> export default async function MsearchTemplateApi (this: That, params: T.MsearchTemplateRequest | TB.MsearchTemplateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['ccs_minimize_roundtrips', 'max_concurrent_searches', 'search_type', 'rest_total_hits_as_int', 'typed_keys', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['search_templates'] const querystring: Record = {} // @ts-expect-error let body: any = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { + if (acceptedBody.includes(key)) { // @ts-expect-error - querystring[key] = params[key] + body = params[key] } else if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { // @ts-expect-error - body = params[key] + querystring[key] = params[key] } } diff --git a/src/api/api/mtermvectors.ts b/src/api/api/mtermvectors.ts index 4cdc15eab..449504437 100644 --- a/src/api/api/mtermvectors.ts +++ b/src/api/api/mtermvectors.ts @@ -42,22 +42,22 @@ export default async function MtermvectorsApi (this: That, params?: T.Mtermvecto export default async function MtermvectorsApi (this: That, params?: T.MtermvectorsRequest | TB.MtermvectorsRequest, options?: TransportRequestOptions): Promise export default async function MtermvectorsApi (this: That, params?: T.MtermvectorsRequest | TB.MtermvectorsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['fields', 'field_statistics', 'offsets', 'payloads', 'positions', 'preference', 'realtime', 'routing', 'term_statistics', 'version', 'version_type', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['docs'] const querystring: Record = {} // @ts-expect-error let body: Record = params?.body ?? undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } diff --git a/src/api/api/nodes.ts b/src/api/api/nodes.ts index a07b701e0..6fc2c0798 100644 --- a/src/api/api/nodes.ts +++ b/src/api/api/nodes.ts @@ -48,19 +48,15 @@ export default class Nodes { async clearRepositoriesMeteringArchive (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise async clearRepositoriesMeteringArchive (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['node_id', 'max_archive_version'] - const acceptedQuery: string[] = [] const querystring: Record = {} - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} - body[key] = params[key] + querystring[key] = params[key] } } @@ -74,19 +70,15 @@ export default class Nodes { async getRepositoriesMeteringInfo (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise async getRepositoriesMeteringInfo (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['node_id'] - const acceptedQuery: string[] = [] const querystring: Record = {} - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} - body[key] = params[key] + querystring[key] = params[key] } } @@ -100,22 +92,16 @@ export default class Nodes { async hotThreads (this: That, params?: T.NodesHotThreadsRequest | TB.NodesHotThreadsRequest, options?: TransportRequestOptions): Promise async hotThreads (this: That, params?: T.NodesHotThreadsRequest | TB.NodesHotThreadsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['node_id'] - const acceptedQuery: string[] = ['ignore_idle_threads', 'interval', 'snapshots', 'threads', 'thread_type', 'timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -136,22 +122,16 @@ export default class Nodes { async info (this: That, params?: T.NodesInfoRequest | TB.NodesInfoRequest, options?: TransportRequestOptions): Promise async info (this: That, params?: T.NodesInfoRequest | TB.NodesInfoRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['node_id', 'metric'] - const acceptedQuery: string[] = ['flat_settings', 'master_timeout', 'timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -178,22 +158,22 @@ export default class Nodes { async reloadSecureSettings (this: That, params?: T.NodesReloadSecureSettingsRequest | TB.NodesReloadSecureSettingsRequest, options?: TransportRequestOptions): Promise async reloadSecureSettings (this: That, params?: T.NodesReloadSecureSettingsRequest | TB.NodesReloadSecureSettingsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['node_id'] - const acceptedQuery: string[] = ['timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['secure_settings_password'] const querystring: Record = {} // @ts-expect-error let body: Record = params?.body ?? undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -214,22 +194,16 @@ export default class Nodes { async stats (this: That, params?: T.NodesStatsRequest | TB.NodesStatsRequest, options?: TransportRequestOptions): Promise async stats (this: That, params?: T.NodesStatsRequest | TB.NodesStatsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['node_id', 'metric', 'index_metric'] - const acceptedQuery: string[] = ['completion_fields', 'fielddata_fields', 'fields', 'groups', 'include_segment_file_sizes', 'level', 'master_timeout', 'timeout', 'types', 'include_unloaded_segments', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -262,22 +236,16 @@ export default class Nodes { async usage (this: That, params?: T.NodesUsageRequest | TB.NodesUsageRequest, options?: TransportRequestOptions): Promise async usage (this: That, params?: T.NodesUsageRequest | TB.NodesUsageRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['node_id', 'metric'] - const acceptedQuery: string[] = ['timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } diff --git a/src/api/api/open_point_in_time.ts b/src/api/api/open_point_in_time.ts index 94be5c04b..81507983a 100644 --- a/src/api/api/open_point_in_time.ts +++ b/src/api/api/open_point_in_time.ts @@ -42,21 +42,15 @@ export default async function OpenPointInTimeApi (this: That, params: T.OpenPoin export default async function OpenPointInTimeApi (this: That, params: T.OpenPointInTimeRequest | TB.OpenPointInTimeRequest, options?: TransportRequestOptions): Promise export default async function OpenPointInTimeApi (this: That, params: T.OpenPointInTimeRequest | TB.OpenPointInTimeRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['keep_alive', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } diff --git a/src/api/api/ping.ts b/src/api/api/ping.ts index 49ec7c223..4b8a07e8f 100644 --- a/src/api/api/ping.ts +++ b/src/api/api/ping.ts @@ -42,22 +42,16 @@ export default async function PingApi (this: That, params?: T.PingRequest | TB.P export default async function PingApi (this: That, params?: T.PingRequest | TB.PingRequest, options?: TransportRequestOptions): Promise export default async function PingApi (this: That, params?: T.PingRequest | TB.PingRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } diff --git a/src/api/api/put_script.ts b/src/api/api/put_script.ts index 1f82c1445..1d75aeda1 100644 --- a/src/api/api/put_script.ts +++ b/src/api/api/put_script.ts @@ -42,21 +42,21 @@ export default async function PutScriptApi (this: That, params: T.PutScriptReque export default async function PutScriptApi (this: That, params: T.PutScriptRequest | TB.PutScriptRequest, options?: TransportRequestOptions): Promise export default async function PutScriptApi (this: That, params: T.PutScriptRequest | TB.PutScriptRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id', 'context'] - const acceptedQuery: string[] = ['master_timeout', 'timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['script'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } diff --git a/src/api/api/rank_eval.ts b/src/api/api/rank_eval.ts index 921372d5c..c47112fef 100644 --- a/src/api/api/rank_eval.ts +++ b/src/api/api/rank_eval.ts @@ -42,21 +42,21 @@ export default async function RankEvalApi (this: That, params: T.RankEvalRequest export default async function RankEvalApi (this: That, params: T.RankEvalRequest | TB.RankEvalRequest, options?: TransportRequestOptions): Promise export default async function RankEvalApi (this: That, params: T.RankEvalRequest | TB.RankEvalRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['allow_no_indices', 'expand_wildcards', 'ignore_unavailable', 'search_type', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['requests', 'metric'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } diff --git a/src/api/api/reindex.ts b/src/api/api/reindex.ts index 513f1cd60..c182e1ed6 100644 --- a/src/api/api/reindex.ts +++ b/src/api/api/reindex.ts @@ -42,22 +42,22 @@ export default async function ReindexApi (this: That, params?: T.ReindexRequest export default async function ReindexApi (this: That, params?: T.ReindexRequest | TB.ReindexRequest, options?: TransportRequestOptions): Promise export default async function ReindexApi (this: That, params?: T.ReindexRequest | TB.ReindexRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['refresh', 'requests_per_second', 'scroll', 'slices', 'timeout', 'wait_for_active_shards', 'wait_for_completion', 'require_alias', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['conflicts', 'dest', 'max_docs', 'script', 'size', 'source'] const querystring: Record = {} // @ts-expect-error let body: Record = params?.body ?? undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } diff --git a/src/api/api/reindex_rethrottle.ts b/src/api/api/reindex_rethrottle.ts index 436f34394..030ff50a5 100644 --- a/src/api/api/reindex_rethrottle.ts +++ b/src/api/api/reindex_rethrottle.ts @@ -42,21 +42,15 @@ export default async function ReindexRethrottleApi (this: That, params: T.Reinde export default async function ReindexRethrottleApi (this: That, params: T.ReindexRethrottleRequest | TB.ReindexRethrottleRequest, options?: TransportRequestOptions): Promise export default async function ReindexRethrottleApi (this: That, params: T.ReindexRethrottleRequest | TB.ReindexRethrottleRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['task_id'] - const acceptedQuery: string[] = ['requests_per_second', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } diff --git a/src/api/api/render_search_template.ts b/src/api/api/render_search_template.ts index 03285bf5a..2fa44bd57 100644 --- a/src/api/api/render_search_template.ts +++ b/src/api/api/render_search_template.ts @@ -42,22 +42,22 @@ export default async function RenderSearchTemplateApi (this: That, params?: T.Re export default async function RenderSearchTemplateApi (this: That, params?: T.RenderSearchTemplateRequest | TB.RenderSearchTemplateRequest, options?: TransportRequestOptions): Promise export default async function RenderSearchTemplateApi (this: That, params?: T.RenderSearchTemplateRequest | TB.RenderSearchTemplateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['file', 'params', 'source'] const querystring: Record = {} // @ts-expect-error let body: Record = params?.body ?? undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } diff --git a/src/api/api/rollup.ts b/src/api/api/rollup.ts index 0a728192f..a3e7592ea 100644 --- a/src/api/api/rollup.ts +++ b/src/api/api/rollup.ts @@ -48,21 +48,15 @@ export default class Rollup { async deleteJob (this: That, params: T.RollupDeleteJobRequest | TB.RollupDeleteJobRequest, options?: TransportRequestOptions): Promise async deleteJob (this: That, params: T.RollupDeleteJobRequest | TB.RollupDeleteJobRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -76,22 +70,16 @@ export default class Rollup { async getJobs (this: That, params?: T.RollupGetJobsRequest | TB.RollupGetJobsRequest, options?: TransportRequestOptions): Promise async getJobs (this: That, params?: T.RollupGetJobsRequest | TB.RollupGetJobsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -112,22 +100,16 @@ export default class Rollup { async getRollupCaps (this: That, params?: T.RollupGetRollupCapsRequest | TB.RollupGetRollupCapsRequest, options?: TransportRequestOptions): Promise async getRollupCaps (this: That, params?: T.RollupGetRollupCapsRequest | TB.RollupGetRollupCapsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -148,21 +130,15 @@ export default class Rollup { async getRollupIndexCaps (this: That, params: T.RollupGetRollupIndexCapsRequest | TB.RollupGetRollupIndexCapsRequest, options?: TransportRequestOptions): Promise async getRollupIndexCaps (this: That, params: T.RollupGetRollupIndexCapsRequest | TB.RollupGetRollupIndexCapsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -176,21 +152,21 @@ export default class Rollup { async putJob (this: That, params: T.RollupPutJobRequest | TB.RollupPutJobRequest, options?: TransportRequestOptions): Promise async putJob (this: That, params: T.RollupPutJobRequest | TB.RollupPutJobRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['cron', 'groups', 'index_pattern', 'metrics', 'page_size', 'rollup_index'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -204,20 +180,20 @@ export default class Rollup { async rollup (this: That, params: T.RollupRollupRequest | TB.RollupRollupRequest, options?: TransportRequestOptions): Promise async rollup (this: That, params: T.RollupRollupRequest | TB.RollupRollupRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index', 'rollup_index'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['config'] const querystring: Record = {} // @ts-expect-error let body: any = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { + if (acceptedBody.includes(key)) { // @ts-expect-error - querystring[key] = params[key] + body = params[key] } else if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { // @ts-expect-error - body = params[key] + querystring[key] = params[key] } } @@ -231,21 +207,21 @@ export default class Rollup { async rollupSearch (this: That, params: T.RollupRollupSearchRequest | TB.RollupRollupSearchRequest, options?: TransportRequestOptions): Promise> async rollupSearch (this: That, params: T.RollupRollupSearchRequest | TB.RollupRollupSearchRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index', 'type'] - const acceptedQuery: string[] = ['rest_total_hits_as_int', 'typed_keys', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['aggs', 'query', 'size'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -259,21 +235,15 @@ export default class Rollup { async startJob (this: That, params: T.RollupStartJobRequest | TB.RollupStartJobRequest, options?: TransportRequestOptions): Promise async startJob (this: That, params: T.RollupStartJobRequest | TB.RollupStartJobRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -287,21 +257,15 @@ export default class Rollup { async stopJob (this: That, params: T.RollupStopJobRequest | TB.RollupStopJobRequest, options?: TransportRequestOptions): Promise async stopJob (this: That, params: T.RollupStopJobRequest | TB.RollupStopJobRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const acceptedQuery: string[] = ['timeout', 'wait_for_completion', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } diff --git a/src/api/api/scripts_painless_execute.ts b/src/api/api/scripts_painless_execute.ts index 968516d40..cd04ce880 100644 --- a/src/api/api/scripts_painless_execute.ts +++ b/src/api/api/scripts_painless_execute.ts @@ -42,22 +42,22 @@ export default async function ScriptsPainlessExecuteApi (this export default async function ScriptsPainlessExecuteApi (this: That, params?: T.ScriptsPainlessExecuteRequest | TB.ScriptsPainlessExecuteRequest, options?: TransportRequestOptions): Promise> export default async function ScriptsPainlessExecuteApi (this: That, params?: T.ScriptsPainlessExecuteRequest | TB.ScriptsPainlessExecuteRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['context', 'context_setup', 'script'] const querystring: Record = {} // @ts-expect-error let body: Record = params?.body ?? undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } diff --git a/src/api/api/scroll.ts b/src/api/api/scroll.ts index 0592663ba..e6a16fe9a 100644 --- a/src/api/api/scroll.ts +++ b/src/api/api/scroll.ts @@ -42,21 +42,15 @@ export default async function ScrollApi (this: That, params export default async function ScrollApi (this: That, params: T.ScrollRequest | TB.ScrollRequest, options?: TransportRequestOptions): Promise> export default async function ScrollApi (this: That, params: T.ScrollRequest | TB.ScrollRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['rest_total_hits_as_int', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } diff --git a/src/api/api/search.ts b/src/api/api/search.ts index 388cc6f33..a888230c5 100644 --- a/src/api/api/search.ts +++ b/src/api/api/search.ts @@ -42,22 +42,22 @@ export default async function SearchApi (this: That, params export default async function SearchApi (this: That, params?: T.SearchRequest | TB.SearchRequest, options?: TransportRequestOptions): Promise> export default async function SearchApi (this: That, params?: T.SearchRequest | TB.SearchRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['allow_no_indices', 'allow_partial_search_results', 'analyzer', 'analyze_wildcard', 'batched_reduce_size', 'ccs_minimize_roundtrips', 'default_operator', 'df', 'expand_wildcards', 'ignore_throttled', 'ignore_unavailable', 'lenient', 'max_concurrent_shard_requests', 'min_compatible_shard_node', 'preference', 'pre_filter_shard_size', 'request_cache', 'routing', 'scroll', 'search_type', 'suggest_field', 'suggest_mode', 'suggest_size', 'suggest_text', 'typed_keys', 'rest_total_hits_as_int', '_source_excludes', '_source_includes', 'q', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['aggs', 'aggregations', 'collapse', 'highlight', 'indices_boost', 'min_score', 'post_filter', 'profile', 'query', 'rescore', 'script_fields', 'search_after', 'slice', 'fields', 'suggest', 'pit', 'runtime_mappings'] const querystring: Record = {} // @ts-expect-error let body: Record = params?.body ?? undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } diff --git a/src/api/api/search_mvt.ts b/src/api/api/search_mvt.ts index 43a63b254..e15c7e2d0 100644 --- a/src/api/api/search_mvt.ts +++ b/src/api/api/search_mvt.ts @@ -42,21 +42,21 @@ export default async function SearchMvtApi (this: That, params: T.SearchMvtReque export default async function SearchMvtApi (this: That, params: T.SearchMvtRequest | TB.SearchMvtRequest, options?: TransportRequestOptions): Promise export default async function SearchMvtApi (this: That, params: T.SearchMvtRequest | TB.SearchMvtRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index', 'field', 'zoom', 'x', 'y'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['aggs', 'fields', 'query', 'runtime_mappings', 'sort'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } diff --git a/src/api/api/search_shards.ts b/src/api/api/search_shards.ts index 24216f115..999ea6be4 100644 --- a/src/api/api/search_shards.ts +++ b/src/api/api/search_shards.ts @@ -42,22 +42,16 @@ export default async function SearchShardsApi (this: That, params?: T.SearchShar export default async function SearchShardsApi (this: That, params?: T.SearchShardsRequest | TB.SearchShardsRequest, options?: TransportRequestOptions): Promise export default async function SearchShardsApi (this: That, params?: T.SearchShardsRequest | TB.SearchShardsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['allow_no_indices', 'expand_wildcards', 'ignore_unavailable', 'local', 'preference', 'routing', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } diff --git a/src/api/api/search_template.ts b/src/api/api/search_template.ts index f15905827..5c240f484 100644 --- a/src/api/api/search_template.ts +++ b/src/api/api/search_template.ts @@ -42,22 +42,22 @@ export default async function SearchTemplateApi (this: That export default async function SearchTemplateApi (this: That, params?: T.SearchTemplateRequest | TB.SearchTemplateRequest, options?: TransportRequestOptions): Promise> export default async function SearchTemplateApi (this: That, params?: T.SearchTemplateRequest | TB.SearchTemplateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['allow_no_indices', 'ccs_minimize_roundtrips', 'expand_wildcards', 'ignore_throttled', 'ignore_unavailable', 'preference', 'routing', 'scroll', 'search_type', 'rest_total_hits_as_int', 'typed_keys', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['id', 'params', 'source'] const querystring: Record = {} // @ts-expect-error let body: Record = params?.body ?? undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } diff --git a/src/api/api/searchable_snapshots.ts b/src/api/api/searchable_snapshots.ts index 08156add7..1604d4def 100644 --- a/src/api/api/searchable_snapshots.ts +++ b/src/api/api/searchable_snapshots.ts @@ -48,19 +48,15 @@ export default class SearchableSnapshots { async cacheStats (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise async cacheStats (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['node_id'] - const acceptedQuery: string[] = [] const querystring: Record = {} - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} - body[key] = params[key] + querystring[key] = params[key] } } @@ -81,22 +77,16 @@ export default class SearchableSnapshots { async clearCache (this: That, params?: T.SearchableSnapshotsClearCacheRequest | TB.SearchableSnapshotsClearCacheRequest, options?: TransportRequestOptions): Promise async clearCache (this: That, params?: T.SearchableSnapshotsClearCacheRequest | TB.SearchableSnapshotsClearCacheRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['expand_wildcards', 'allow_no_indices', 'ignore_unavailable', 'pretty', 'human', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -117,21 +107,21 @@ export default class SearchableSnapshots { async mount (this: That, params: T.SearchableSnapshotsMountRequest | TB.SearchableSnapshotsMountRequest, options?: TransportRequestOptions): Promise async mount (this: That, params: T.SearchableSnapshotsMountRequest | TB.SearchableSnapshotsMountRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['repository', 'snapshot'] - const acceptedQuery: string[] = ['master_timeout', 'wait_for_completion', 'storage', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['index', 'renamed_index', 'index_settings', 'ignore_index_settings'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -145,22 +135,16 @@ export default class SearchableSnapshots { async stats (this: That, params?: T.SearchableSnapshotsStatsRequest | TB.SearchableSnapshotsStatsRequest, options?: TransportRequestOptions): Promise async stats (this: That, params?: T.SearchableSnapshotsStatsRequest | TB.SearchableSnapshotsStatsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['level', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } diff --git a/src/api/api/security.ts b/src/api/api/security.ts index 673023465..55363814a 100644 --- a/src/api/api/security.ts +++ b/src/api/api/security.ts @@ -48,22 +48,16 @@ export default class Security { async authenticate (this: That, params?: T.SecurityAuthenticateRequest | TB.SecurityAuthenticateRequest, options?: TransportRequestOptions): Promise async authenticate (this: That, params?: T.SecurityAuthenticateRequest | TB.SecurityAuthenticateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -77,22 +71,22 @@ export default class Security { async changePassword (this: That, params?: T.SecurityChangePasswordRequest | TB.SecurityChangePasswordRequest, options?: TransportRequestOptions): Promise async changePassword (this: That, params?: T.SecurityChangePasswordRequest | TB.SecurityChangePasswordRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['username'] - const acceptedQuery: string[] = ['refresh', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['password'] const querystring: Record = {} // @ts-expect-error let body: Record = params?.body ?? undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -113,21 +107,15 @@ export default class Security { async clearApiKeyCache (this: That, params: T.SecurityClearApiKeyCacheRequest | TB.SecurityClearApiKeyCacheRequest, options?: TransportRequestOptions): Promise async clearApiKeyCache (this: That, params: T.SecurityClearApiKeyCacheRequest | TB.SecurityClearApiKeyCacheRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['ids'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -141,21 +129,15 @@ export default class Security { async clearCachedPrivileges (this: That, params: T.SecurityClearCachedPrivilegesRequest | TB.SecurityClearCachedPrivilegesRequest, options?: TransportRequestOptions): Promise async clearCachedPrivileges (this: That, params: T.SecurityClearCachedPrivilegesRequest | TB.SecurityClearCachedPrivilegesRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['application'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -169,21 +151,15 @@ export default class Security { async clearCachedRealms (this: That, params: T.SecurityClearCachedRealmsRequest | TB.SecurityClearCachedRealmsRequest, options?: TransportRequestOptions): Promise async clearCachedRealms (this: That, params: T.SecurityClearCachedRealmsRequest | TB.SecurityClearCachedRealmsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['realms'] - const acceptedQuery: string[] = ['usernames', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -197,21 +173,15 @@ export default class Security { async clearCachedRoles (this: That, params: T.SecurityClearCachedRolesRequest | TB.SecurityClearCachedRolesRequest, options?: TransportRequestOptions): Promise async clearCachedRoles (this: That, params: T.SecurityClearCachedRolesRequest | TB.SecurityClearCachedRolesRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -225,21 +195,15 @@ export default class Security { async clearCachedServiceTokens (this: That, params: T.SecurityClearCachedServiceTokensRequest | TB.SecurityClearCachedServiceTokensRequest, options?: TransportRequestOptions): Promise async clearCachedServiceTokens (this: That, params: T.SecurityClearCachedServiceTokensRequest | TB.SecurityClearCachedServiceTokensRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['namespace', 'service', 'name'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -253,22 +217,22 @@ export default class Security { async createApiKey (this: That, params?: T.SecurityCreateApiKeyRequest | TB.SecurityCreateApiKeyRequest, options?: TransportRequestOptions): Promise async createApiKey (this: That, params?: T.SecurityCreateApiKeyRequest | TB.SecurityCreateApiKeyRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['refresh', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['expiration', 'name', 'role_descriptors', 'metadata'] const querystring: Record = {} // @ts-expect-error let body: Record = params?.body ?? undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -282,21 +246,15 @@ export default class Security { async createServiceToken (this: That, params: T.SecurityCreateServiceTokenRequest | TB.SecurityCreateServiceTokenRequest, options?: TransportRequestOptions): Promise async createServiceToken (this: That, params: T.SecurityCreateServiceTokenRequest | TB.SecurityCreateServiceTokenRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['namespace', 'service', 'name'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -317,21 +275,15 @@ export default class Security { async deletePrivileges (this: That, params: T.SecurityDeletePrivilegesRequest | TB.SecurityDeletePrivilegesRequest, options?: TransportRequestOptions): Promise async deletePrivileges (this: That, params: T.SecurityDeletePrivilegesRequest | TB.SecurityDeletePrivilegesRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['application', 'name'] - const acceptedQuery: string[] = ['refresh', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -345,21 +297,15 @@ export default class Security { async deleteRole (this: That, params: T.SecurityDeleteRoleRequest | TB.SecurityDeleteRoleRequest, options?: TransportRequestOptions): Promise async deleteRole (this: That, params: T.SecurityDeleteRoleRequest | TB.SecurityDeleteRoleRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const acceptedQuery: string[] = ['refresh', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -373,21 +319,15 @@ export default class Security { async deleteRoleMapping (this: That, params: T.SecurityDeleteRoleMappingRequest | TB.SecurityDeleteRoleMappingRequest, options?: TransportRequestOptions): Promise async deleteRoleMapping (this: That, params: T.SecurityDeleteRoleMappingRequest | TB.SecurityDeleteRoleMappingRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const acceptedQuery: string[] = ['refresh', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -401,21 +341,15 @@ export default class Security { async deleteServiceToken (this: That, params: T.SecurityDeleteServiceTokenRequest | TB.SecurityDeleteServiceTokenRequest, options?: TransportRequestOptions): Promise async deleteServiceToken (this: That, params: T.SecurityDeleteServiceTokenRequest | TB.SecurityDeleteServiceTokenRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['namespace', 'service', 'name'] - const acceptedQuery: string[] = ['refresh', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -429,21 +363,15 @@ export default class Security { async deleteUser (this: That, params: T.SecurityDeleteUserRequest | TB.SecurityDeleteUserRequest, options?: TransportRequestOptions): Promise async deleteUser (this: That, params: T.SecurityDeleteUserRequest | TB.SecurityDeleteUserRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['username'] - const acceptedQuery: string[] = ['refresh', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -457,21 +385,15 @@ export default class Security { async disableUser (this: That, params: T.SecurityDisableUserRequest | TB.SecurityDisableUserRequest, options?: TransportRequestOptions): Promise async disableUser (this: That, params: T.SecurityDisableUserRequest | TB.SecurityDisableUserRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['username'] - const acceptedQuery: string[] = ['refresh', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -485,21 +407,15 @@ export default class Security { async enableUser (this: That, params: T.SecurityEnableUserRequest | TB.SecurityEnableUserRequest, options?: TransportRequestOptions): Promise async enableUser (this: That, params: T.SecurityEnableUserRequest | TB.SecurityEnableUserRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['username'] - const acceptedQuery: string[] = ['refresh', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -513,19 +429,15 @@ export default class Security { async enrollKibana (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise async enrollKibana (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = [] const querystring: Record = {} - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} - body[key] = params[key] + querystring[key] = params[key] } } @@ -539,19 +451,15 @@ export default class Security { async enrollNode (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise async enrollNode (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = [] const querystring: Record = {} - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} - body[key] = params[key] + querystring[key] = params[key] } } @@ -565,22 +473,16 @@ export default class Security { async getApiKey (this: That, params?: T.SecurityGetApiKeyRequest | TB.SecurityGetApiKeyRequest, options?: TransportRequestOptions): Promise async getApiKey (this: That, params?: T.SecurityGetApiKeyRequest | TB.SecurityGetApiKeyRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['id', 'name', 'owner', 'realm_name', 'username', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -594,22 +496,16 @@ export default class Security { async getBuiltinPrivileges (this: That, params?: T.SecurityGetBuiltinPrivilegesRequest | TB.SecurityGetBuiltinPrivilegesRequest, options?: TransportRequestOptions): Promise async getBuiltinPrivileges (this: That, params?: T.SecurityGetBuiltinPrivilegesRequest | TB.SecurityGetBuiltinPrivilegesRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -623,22 +519,16 @@ export default class Security { async getPrivileges (this: That, params?: T.SecurityGetPrivilegesRequest | TB.SecurityGetPrivilegesRequest, options?: TransportRequestOptions): Promise async getPrivileges (this: That, params?: T.SecurityGetPrivilegesRequest | TB.SecurityGetPrivilegesRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['application', 'name'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -662,22 +552,16 @@ export default class Security { async getRole (this: That, params?: T.SecurityGetRoleRequest | TB.SecurityGetRoleRequest, options?: TransportRequestOptions): Promise async getRole (this: That, params?: T.SecurityGetRoleRequest | TB.SecurityGetRoleRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -698,22 +582,16 @@ export default class Security { async getRoleMapping (this: That, params?: T.SecurityGetRoleMappingRequest | TB.SecurityGetRoleMappingRequest, options?: TransportRequestOptions): Promise async getRoleMapping (this: That, params?: T.SecurityGetRoleMappingRequest | TB.SecurityGetRoleMappingRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -734,22 +612,16 @@ export default class Security { async getServiceAccounts (this: That, params?: T.SecurityGetServiceAccountsRequest | TB.SecurityGetServiceAccountsRequest, options?: TransportRequestOptions): Promise async getServiceAccounts (this: That, params?: T.SecurityGetServiceAccountsRequest | TB.SecurityGetServiceAccountsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['namespace', 'service'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -773,21 +645,15 @@ export default class Security { async getServiceCredentials (this: That, params: T.SecurityGetServiceCredentialsRequest | TB.SecurityGetServiceCredentialsRequest, options?: TransportRequestOptions): Promise async getServiceCredentials (this: That, params: T.SecurityGetServiceCredentialsRequest | TB.SecurityGetServiceCredentialsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['namespace', 'service'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -801,22 +667,22 @@ export default class Security { async getToken (this: That, params?: T.SecurityGetTokenRequest | TB.SecurityGetTokenRequest, options?: TransportRequestOptions): Promise async getToken (this: That, params?: T.SecurityGetTokenRequest | TB.SecurityGetTokenRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['grant_type', 'scope', 'password', 'kerberos_ticket', 'refresh_token', 'username'] const querystring: Record = {} // @ts-expect-error let body: Record = params?.body ?? undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -830,22 +696,16 @@ export default class Security { async getUser (this: That, params?: T.SecurityGetUserRequest | TB.SecurityGetUserRequest, options?: TransportRequestOptions): Promise async getUser (this: That, params?: T.SecurityGetUserRequest | TB.SecurityGetUserRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['username'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -866,22 +726,16 @@ export default class Security { async getUserPrivileges (this: That, params?: T.SecurityGetUserPrivilegesRequest | TB.SecurityGetUserPrivilegesRequest, options?: TransportRequestOptions): Promise async getUserPrivileges (this: That, params?: T.SecurityGetUserPrivilegesRequest | TB.SecurityGetUserPrivilegesRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['application', 'priviledge', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -895,21 +749,21 @@ export default class Security { async grantApiKey (this: That, params: T.SecurityGrantApiKeyRequest | TB.SecurityGrantApiKeyRequest, options?: TransportRequestOptions): Promise async grantApiKey (this: That, params: T.SecurityGrantApiKeyRequest | TB.SecurityGrantApiKeyRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['api_key', 'grant_type', 'access_token', 'username', 'password'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -923,22 +777,22 @@ export default class Security { async hasPrivileges (this: That, params?: T.SecurityHasPrivilegesRequest | TB.SecurityHasPrivilegesRequest, options?: TransportRequestOptions): Promise async hasPrivileges (this: That, params?: T.SecurityHasPrivilegesRequest | TB.SecurityHasPrivilegesRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['user'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['application', 'cluster', 'index'] const querystring: Record = {} // @ts-expect-error let body: Record = params?.body ?? undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -959,22 +813,22 @@ export default class Security { async invalidateApiKey (this: That, params?: T.SecurityInvalidateApiKeyRequest | TB.SecurityInvalidateApiKeyRequest, options?: TransportRequestOptions): Promise async invalidateApiKey (this: That, params?: T.SecurityInvalidateApiKeyRequest | TB.SecurityInvalidateApiKeyRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['id', 'ids', 'name', 'owner', 'realm_name', 'username'] const querystring: Record = {} // @ts-expect-error let body: Record = params?.body ?? undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -988,22 +842,22 @@ export default class Security { async invalidateToken (this: That, params?: T.SecurityInvalidateTokenRequest | TB.SecurityInvalidateTokenRequest, options?: TransportRequestOptions): Promise async invalidateToken (this: That, params?: T.SecurityInvalidateTokenRequest | TB.SecurityInvalidateTokenRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['token', 'refresh_token', 'realm_name', 'username'] const querystring: Record = {} // @ts-expect-error let body: Record = params?.body ?? undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -1017,20 +871,20 @@ export default class Security { async putPrivileges (this: That, params: T.SecurityPutPrivilegesRequest | TB.SecurityPutPrivilegesRequest, options?: TransportRequestOptions): Promise async putPrivileges (this: That, params: T.SecurityPutPrivilegesRequest | TB.SecurityPutPrivilegesRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['refresh', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['privileges'] const querystring: Record = {} // @ts-expect-error let body: any = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { + if (acceptedBody.includes(key)) { // @ts-expect-error - querystring[key] = params[key] + body = params[key] } else if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { // @ts-expect-error - body = params[key] + querystring[key] = params[key] } } @@ -1044,21 +898,21 @@ export default class Security { async putRole (this: That, params: T.SecurityPutRoleRequest | TB.SecurityPutRoleRequest, options?: TransportRequestOptions): Promise async putRole (this: That, params: T.SecurityPutRoleRequest | TB.SecurityPutRoleRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const acceptedQuery: string[] = ['refresh', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['applications', 'cluster', 'global', 'indices', 'metadata', 'run_as', 'transient_metadata'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -1072,21 +926,21 @@ export default class Security { async putRoleMapping (this: That, params: T.SecurityPutRoleMappingRequest | TB.SecurityPutRoleMappingRequest, options?: TransportRequestOptions): Promise async putRoleMapping (this: That, params: T.SecurityPutRoleMappingRequest | TB.SecurityPutRoleMappingRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const acceptedQuery: string[] = ['refresh', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['enabled', 'metadata', 'roles', 'rules', 'run_as'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -1100,21 +954,21 @@ export default class Security { async putUser (this: That, params: T.SecurityPutUserRequest | TB.SecurityPutUserRequest, options?: TransportRequestOptions): Promise async putUser (this: That, params: T.SecurityPutUserRequest | TB.SecurityPutUserRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['refresh', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['username', 'email', 'full_name', 'metadata', 'password', 'password_hash', 'roles', 'enabled'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -1128,19 +982,15 @@ export default class Security { async queryApiKeys (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise async queryApiKeys (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = [] const querystring: Record = {} - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} - body[key] = params[key] + querystring[key] = params[key] } } @@ -1154,19 +1004,15 @@ export default class Security { async samlAuthenticate (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise async samlAuthenticate (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = [] const querystring: Record = {} - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} - body[key] = params[key] + querystring[key] = params[key] } } @@ -1180,19 +1026,15 @@ export default class Security { async samlCompleteLogout (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise async samlCompleteLogout (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = [] const querystring: Record = {} - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} - body[key] = params[key] + querystring[key] = params[key] } } @@ -1206,19 +1048,15 @@ export default class Security { async samlInvalidate (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise async samlInvalidate (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = [] const querystring: Record = {} - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} - body[key] = params[key] + querystring[key] = params[key] } } @@ -1232,19 +1070,15 @@ export default class Security { async samlLogout (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise async samlLogout (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = [] const querystring: Record = {} - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} - body[key] = params[key] + querystring[key] = params[key] } } @@ -1258,19 +1092,15 @@ export default class Security { async samlPrepareAuthentication (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise async samlPrepareAuthentication (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = [] const querystring: Record = {} - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} - body[key] = params[key] + querystring[key] = params[key] } } @@ -1284,19 +1114,15 @@ export default class Security { async samlServiceProviderMetadata (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise async samlServiceProviderMetadata (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['realm_name'] - const acceptedQuery: string[] = [] const querystring: Record = {} - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} - body[key] = params[key] + querystring[key] = params[key] } } diff --git a/src/api/api/shutdown.ts b/src/api/api/shutdown.ts index 10f9bb2f8..9ee79c1d1 100644 --- a/src/api/api/shutdown.ts +++ b/src/api/api/shutdown.ts @@ -48,21 +48,15 @@ export default class Shutdown { async deleteNode (this: That, params: T.ShutdownDeleteNodeRequest | TB.ShutdownDeleteNodeRequest, options?: TransportRequestOptions): Promise async deleteNode (this: That, params: T.ShutdownDeleteNodeRequest | TB.ShutdownDeleteNodeRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['node_id'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -76,22 +70,16 @@ export default class Shutdown { async getNode (this: That, params?: T.ShutdownGetNodeRequest | TB.ShutdownGetNodeRequest, options?: TransportRequestOptions): Promise async getNode (this: That, params?: T.ShutdownGetNodeRequest | TB.ShutdownGetNodeRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['node_id'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -112,21 +100,15 @@ export default class Shutdown { async putNode (this: That, params: T.ShutdownPutNodeRequest | TB.ShutdownPutNodeRequest, options?: TransportRequestOptions): Promise async putNode (this: That, params: T.ShutdownPutNodeRequest | TB.ShutdownPutNodeRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['node_id'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } diff --git a/src/api/api/slm.ts b/src/api/api/slm.ts index a4033c13c..57d289040 100644 --- a/src/api/api/slm.ts +++ b/src/api/api/slm.ts @@ -48,21 +48,15 @@ export default class Slm { async deleteLifecycle (this: That, params: T.SlmDeleteLifecycleRequest | TB.SlmDeleteLifecycleRequest, options?: TransportRequestOptions): Promise async deleteLifecycle (this: That, params: T.SlmDeleteLifecycleRequest | TB.SlmDeleteLifecycleRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['policy_id'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -76,21 +70,15 @@ export default class Slm { async executeLifecycle (this: That, params: T.SlmExecuteLifecycleRequest | TB.SlmExecuteLifecycleRequest, options?: TransportRequestOptions): Promise async executeLifecycle (this: That, params: T.SlmExecuteLifecycleRequest | TB.SlmExecuteLifecycleRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['policy_id'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -104,22 +92,16 @@ export default class Slm { async executeRetention (this: That, params?: T.SlmExecuteRetentionRequest | TB.SlmExecuteRetentionRequest, options?: TransportRequestOptions): Promise async executeRetention (this: That, params?: T.SlmExecuteRetentionRequest | TB.SlmExecuteRetentionRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -133,22 +115,16 @@ export default class Slm { async getLifecycle (this: That, params?: T.SlmGetLifecycleRequest | TB.SlmGetLifecycleRequest, options?: TransportRequestOptions): Promise async getLifecycle (this: That, params?: T.SlmGetLifecycleRequest | TB.SlmGetLifecycleRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['policy_id'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -169,22 +145,16 @@ export default class Slm { async getStats (this: That, params?: T.SlmGetStatsRequest | TB.SlmGetStatsRequest, options?: TransportRequestOptions): Promise async getStats (this: That, params?: T.SlmGetStatsRequest | TB.SlmGetStatsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -198,22 +168,16 @@ export default class Slm { async getStatus (this: That, params?: T.SlmGetStatusRequest | TB.SlmGetStatusRequest, options?: TransportRequestOptions): Promise async getStatus (this: That, params?: T.SlmGetStatusRequest | TB.SlmGetStatusRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -227,21 +191,21 @@ export default class Slm { async putLifecycle (this: That, params: T.SlmPutLifecycleRequest | TB.SlmPutLifecycleRequest, options?: TransportRequestOptions): Promise async putLifecycle (this: That, params: T.SlmPutLifecycleRequest | TB.SlmPutLifecycleRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['policy_id'] - const acceptedQuery: string[] = ['master_timeout', 'timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['config', 'name', 'repository', 'retention', 'schedule'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -255,22 +219,16 @@ export default class Slm { async start (this: That, params?: T.SlmStartRequest | TB.SlmStartRequest, options?: TransportRequestOptions): Promise async start (this: That, params?: T.SlmStartRequest | TB.SlmStartRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -284,22 +242,16 @@ export default class Slm { async stop (this: That, params?: T.SlmStopRequest | TB.SlmStopRequest, options?: TransportRequestOptions): Promise async stop (this: That, params?: T.SlmStopRequest | TB.SlmStopRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } diff --git a/src/api/api/snapshot.ts b/src/api/api/snapshot.ts index 62b0df495..be6066590 100644 --- a/src/api/api/snapshot.ts +++ b/src/api/api/snapshot.ts @@ -48,21 +48,15 @@ export default class Snapshot { async cleanupRepository (this: That, params: T.SnapshotCleanupRepositoryRequest | TB.SnapshotCleanupRepositoryRequest, options?: TransportRequestOptions): Promise async cleanupRepository (this: That, params: T.SnapshotCleanupRepositoryRequest | TB.SnapshotCleanupRepositoryRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['repository'] - const acceptedQuery: string[] = ['master_timeout', 'timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -76,21 +70,21 @@ export default class Snapshot { async clone (this: That, params: T.SnapshotCloneRequest | TB.SnapshotCloneRequest, options?: TransportRequestOptions): Promise async clone (this: That, params: T.SnapshotCloneRequest | TB.SnapshotCloneRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['repository', 'snapshot', 'target_snapshot'] - const acceptedQuery: string[] = ['master_timeout', 'timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['indices'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -104,21 +98,21 @@ export default class Snapshot { async create (this: That, params: T.SnapshotCreateRequest | TB.SnapshotCreateRequest, options?: TransportRequestOptions): Promise async create (this: That, params: T.SnapshotCreateRequest | TB.SnapshotCreateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['repository', 'snapshot'] - const acceptedQuery: string[] = ['master_timeout', 'wait_for_completion', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['ignore_unavailable', 'include_global_state', 'indices', 'feature_states', 'metadata', 'partial'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -132,21 +126,21 @@ export default class Snapshot { async createRepository (this: That, params: T.SnapshotCreateRepositoryRequest | TB.SnapshotCreateRepositoryRequest, options?: TransportRequestOptions): Promise async createRepository (this: That, params: T.SnapshotCreateRepositoryRequest | TB.SnapshotCreateRepositoryRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['master_timeout', 'timeout', 'verify', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['repository', 'type', 'settings'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -160,21 +154,15 @@ export default class Snapshot { async delete (this: That, params: T.SnapshotDeleteRequest | TB.SnapshotDeleteRequest, options?: TransportRequestOptions): Promise async delete (this: That, params: T.SnapshotDeleteRequest | TB.SnapshotDeleteRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['repository', 'snapshot'] - const acceptedQuery: string[] = ['master_timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -188,21 +176,15 @@ export default class Snapshot { async deleteRepository (this: That, params: T.SnapshotDeleteRepositoryRequest | TB.SnapshotDeleteRepositoryRequest, options?: TransportRequestOptions): Promise async deleteRepository (this: That, params: T.SnapshotDeleteRepositoryRequest | TB.SnapshotDeleteRepositoryRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['repository'] - const acceptedQuery: string[] = ['master_timeout', 'timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -216,21 +198,15 @@ export default class Snapshot { async get (this: That, params: T.SnapshotGetRequest | TB.SnapshotGetRequest, options?: TransportRequestOptions): Promise async get (this: That, params: T.SnapshotGetRequest | TB.SnapshotGetRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['repository', 'snapshot'] - const acceptedQuery: string[] = ['ignore_unavailable', 'master_timeout', 'verbose', 'index_details', 'human', 'include_repository', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -244,22 +220,16 @@ export default class Snapshot { async getRepository (this: That, params?: T.SnapshotGetRepositoryRequest | TB.SnapshotGetRepositoryRequest, options?: TransportRequestOptions): Promise async getRepository (this: That, params?: T.SnapshotGetRepositoryRequest | TB.SnapshotGetRepositoryRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['repository'] - const acceptedQuery: string[] = ['local', 'master_timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -280,19 +250,15 @@ export default class Snapshot { async repositoryAnalyze (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise async repositoryAnalyze (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['repository'] - const acceptedQuery: string[] = ['blob_count', 'concurrency', 'read_node_count', 'early_read_node_count', 'seed', 'rare_action_probability', 'max_blob_size', 'max_total_data_size', 'timeout', 'detailed', 'rarely_abort_writes'] const querystring: Record = {} - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} - body[key] = params[key] + querystring[key] = params[key] } } @@ -306,21 +272,21 @@ export default class Snapshot { async restore (this: That, params: T.SnapshotRestoreRequest | TB.SnapshotRestoreRequest, options?: TransportRequestOptions): Promise async restore (this: That, params: T.SnapshotRestoreRequest | TB.SnapshotRestoreRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['repository', 'snapshot'] - const acceptedQuery: string[] = ['master_timeout', 'wait_for_completion', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['ignore_index_settings', 'ignore_unavailable', 'include_aliases', 'include_global_state', 'index_settings', 'indices', 'partial', 'rename_pattern', 'rename_replacement'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -334,22 +300,16 @@ export default class Snapshot { async status (this: That, params?: T.SnapshotStatusRequest | TB.SnapshotStatusRequest, options?: TransportRequestOptions): Promise async status (this: That, params?: T.SnapshotStatusRequest | TB.SnapshotStatusRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['repository', 'snapshot'] - const acceptedQuery: string[] = ['ignore_unavailable', 'master_timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -373,21 +333,15 @@ export default class Snapshot { async verifyRepository (this: That, params: T.SnapshotVerifyRepositoryRequest | TB.SnapshotVerifyRepositoryRequest, options?: TransportRequestOptions): Promise async verifyRepository (this: That, params: T.SnapshotVerifyRepositoryRequest | TB.SnapshotVerifyRepositoryRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['repository'] - const acceptedQuery: string[] = ['master_timeout', 'timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } diff --git a/src/api/api/sql.ts b/src/api/api/sql.ts index 2e180dd11..6fe2a6191 100644 --- a/src/api/api/sql.ts +++ b/src/api/api/sql.ts @@ -48,21 +48,21 @@ export default class Sql { async clearCursor (this: That, params: T.SqlClearCursorRequest | TB.SqlClearCursorRequest, options?: TransportRequestOptions): Promise async clearCursor (this: That, params: T.SqlClearCursorRequest | TB.SqlClearCursorRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['cursor'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -76,19 +76,15 @@ export default class Sql { async deleteAsync (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise async deleteAsync (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const acceptedQuery: string[] = [] const querystring: Record = {} - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} - body[key] = params[key] + querystring[key] = params[key] } } @@ -102,19 +98,15 @@ export default class Sql { async getAsync (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise async getAsync (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const acceptedQuery: string[] = ['delimiter', 'format', 'keep_alive', 'wait_for_completion_timeout'] const querystring: Record = {} - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} - body[key] = params[key] + querystring[key] = params[key] } } @@ -128,19 +120,15 @@ export default class Sql { async getAsyncStatus (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise async getAsyncStatus (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const acceptedQuery: string[] = [] const querystring: Record = {} - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} - body[key] = params[key] + querystring[key] = params[key] } } @@ -154,22 +142,22 @@ export default class Sql { async query (this: That, params?: T.SqlQueryRequest | TB.SqlQueryRequest, options?: TransportRequestOptions): Promise async query (this: That, params?: T.SqlQueryRequest | TB.SqlQueryRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['format', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['columnar', 'cursor', 'fetch_size', 'filter', 'query', 'request_timeout', 'page_timeout', 'time_zone', 'field_multi_value_leniency'] const querystring: Record = {} // @ts-expect-error let body: Record = params?.body ?? undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -183,21 +171,21 @@ export default class Sql { async translate (this: That, params: T.SqlTranslateRequest | TB.SqlTranslateRequest, options?: TransportRequestOptions): Promise async translate (this: That, params: T.SqlTranslateRequest | TB.SqlTranslateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['fetch_size', 'filter', 'query', 'time_zone'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } diff --git a/src/api/api/ssl.ts b/src/api/api/ssl.ts index 416d0ea0c..08c360806 100644 --- a/src/api/api/ssl.ts +++ b/src/api/api/ssl.ts @@ -48,22 +48,16 @@ export default class Ssl { async certificates (this: That, params?: T.SslCertificatesRequest | TB.SslCertificatesRequest, options?: TransportRequestOptions): Promise async certificates (this: That, params?: T.SslCertificatesRequest | TB.SslCertificatesRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } diff --git a/src/api/api/tasks.ts b/src/api/api/tasks.ts index 69d4cf61f..def117eaa 100644 --- a/src/api/api/tasks.ts +++ b/src/api/api/tasks.ts @@ -48,22 +48,16 @@ export default class Tasks { async cancel (this: That, params?: T.TasksCancelRequest | TB.TasksCancelRequest, options?: TransportRequestOptions): Promise async cancel (this: That, params?: T.TasksCancelRequest | TB.TasksCancelRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['task_id'] - const acceptedQuery: string[] = ['actions', 'nodes', 'parent_task_id', 'wait_for_completion', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -84,21 +78,15 @@ export default class Tasks { async get (this: That, params: T.TasksGetRequest | TB.TasksGetRequest, options?: TransportRequestOptions): Promise async get (this: That, params: T.TasksGetRequest | TB.TasksGetRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['task_id'] - const acceptedQuery: string[] = ['timeout', 'wait_for_completion', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -112,22 +100,16 @@ export default class Tasks { async list (this: That, params?: T.TasksListRequest | TB.TasksListRequest, options?: TransportRequestOptions): Promise async list (this: That, params?: T.TasksListRequest | TB.TasksListRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['actions', 'detailed', 'group_by', 'nodes', 'parent_task_id', 'timeout', 'wait_for_completion', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } diff --git a/src/api/api/terms_enum.ts b/src/api/api/terms_enum.ts index d072cfb8d..5cb9ba471 100644 --- a/src/api/api/terms_enum.ts +++ b/src/api/api/terms_enum.ts @@ -42,21 +42,21 @@ export default async function TermsEnumApi (this: That, params: T.TermsEnumReque export default async function TermsEnumApi (this: That, params: T.TermsEnumRequest | TB.TermsEnumRequest, options?: TransportRequestOptions): Promise export default async function TermsEnumApi (this: That, params: T.TermsEnumRequest | TB.TermsEnumRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['field', 'size', 'timeout', 'case_insensitive', 'index_filter', 'string', 'search_after'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } diff --git a/src/api/api/termvectors.ts b/src/api/api/termvectors.ts index 8c1994730..ad3a6ebfc 100644 --- a/src/api/api/termvectors.ts +++ b/src/api/api/termvectors.ts @@ -42,21 +42,21 @@ export default async function TermvectorsApi (this: That, p export default async function TermvectorsApi (this: That, params: T.TermvectorsRequest | TB.TermvectorsRequest, options?: TransportRequestOptions): Promise export default async function TermvectorsApi (this: That, params: T.TermvectorsRequest | TB.TermvectorsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index', 'id'] - const acceptedQuery: string[] = ['fields', 'field_statistics', 'offsets', 'payloads', 'positions', 'preference', 'realtime', 'routing', 'term_statistics', 'version', 'version_type', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['doc', 'filter', 'per_field_analyzer'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } diff --git a/src/api/api/text_structure.ts b/src/api/api/text_structure.ts index ad3ab4fea..6274fca23 100644 --- a/src/api/api/text_structure.ts +++ b/src/api/api/text_structure.ts @@ -48,20 +48,20 @@ export default class TextStructure { async findStructure (this: That, params: T.TextStructureFindStructureRequest | TB.TextStructureFindStructureRequest, options?: TransportRequestOptions): Promise async findStructure (this: That, params: T.TextStructureFindStructureRequest | TB.TextStructureFindStructureRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['charset', 'column_names', 'delimiter', 'explain', 'format', 'grok_pattern', 'has_header_row', 'line_merge_size_limit', 'lines_to_sample', 'quote', 'should_trim_fields', 'timeout', 'timestamp_field', 'timestamp_format'] + const acceptedBody: string[] = ['text_files'] const querystring: Record = {} // @ts-expect-error let body: any = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { + if (acceptedBody.includes(key)) { // @ts-expect-error - querystring[key] = params[key] + body = params[key] } else if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { // @ts-expect-error - body = params[key] + querystring[key] = params[key] } } diff --git a/src/api/api/transform.ts b/src/api/api/transform.ts index de9e0b877..6a804f970 100644 --- a/src/api/api/transform.ts +++ b/src/api/api/transform.ts @@ -48,21 +48,15 @@ export default class Transform { async deleteTransform (this: That, params: T.TransformDeleteTransformRequest | TB.TransformDeleteTransformRequest, options?: TransportRequestOptions): Promise async deleteTransform (this: That, params: T.TransformDeleteTransformRequest | TB.TransformDeleteTransformRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['transform_id'] - const acceptedQuery: string[] = ['force', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -76,22 +70,16 @@ export default class Transform { async getTransform (this: That, params?: T.TransformGetTransformRequest | TB.TransformGetTransformRequest, options?: TransportRequestOptions): Promise async getTransform (this: That, params?: T.TransformGetTransformRequest | TB.TransformGetTransformRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['transform_id'] - const acceptedQuery: string[] = ['allow_no_match', 'from', 'size', 'exclude_generated', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -112,21 +100,15 @@ export default class Transform { async getTransformStats (this: That, params: T.TransformGetTransformStatsRequest | TB.TransformGetTransformStatsRequest, options?: TransportRequestOptions): Promise async getTransformStats (this: That, params: T.TransformGetTransformStatsRequest | TB.TransformGetTransformStatsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['transform_id'] - const acceptedQuery: string[] = ['allow_no_match', 'from', 'size', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -140,22 +122,22 @@ export default class Transform { async previewTransform (this: That, params?: T.TransformPreviewTransformRequest | TB.TransformPreviewTransformRequest, options?: TransportRequestOptions): Promise> async previewTransform (this: That, params?: T.TransformPreviewTransformRequest | TB.TransformPreviewTransformRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['transform_id'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['dest', 'description', 'frequency', 'pivot', 'source', 'settings', 'sync', 'retention_policy', 'latest'] const querystring: Record = {} // @ts-expect-error let body: Record = params?.body ?? undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -176,21 +158,15 @@ export default class Transform { async putTransform (this: That, params: T.TransformPutTransformRequest | TB.TransformPutTransformRequest, options?: TransportRequestOptions): Promise async putTransform (this: That, params: T.TransformPutTransformRequest | TB.TransformPutTransformRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['transform_id', 'transform_id'] - const acceptedQuery: string[] = ['defer_validation', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -204,21 +180,15 @@ export default class Transform { async startTransform (this: That, params: T.TransformStartTransformRequest | TB.TransformStartTransformRequest, options?: TransportRequestOptions): Promise async startTransform (this: That, params: T.TransformStartTransformRequest | TB.TransformStartTransformRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['transform_id'] - const acceptedQuery: string[] = ['timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -232,21 +202,15 @@ export default class Transform { async stopTransform (this: That, params: T.TransformStopTransformRequest | TB.TransformStopTransformRequest, options?: TransportRequestOptions): Promise async stopTransform (this: That, params: T.TransformStopTransformRequest | TB.TransformStopTransformRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['transform_id'] - const acceptedQuery: string[] = ['allow_no_match', 'force', 'timeout', 'wait_for_checkpoint', 'wait_for_completion', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -260,21 +224,15 @@ export default class Transform { async updateTransform (this: That, params: T.TransformUpdateTransformRequest | TB.TransformUpdateTransformRequest, options?: TransportRequestOptions): Promise async updateTransform (this: That, params: T.TransformUpdateTransformRequest | TB.TransformUpdateTransformRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['transform_id', 'transform_id'] - const acceptedQuery: string[] = ['defer_validation', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -282,4 +240,26 @@ export default class Transform { const path = `/_transform/${encodeURIComponent(params.transform_id.toString())}/_update` return await this.transport.request({ path, method, querystring, body }, options) } + + async upgradeTransforms (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise + async upgradeTransforms (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise> + async upgradeTransforms (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise + async upgradeTransforms (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { + const acceptedPath: string[] = [] + const querystring: Record = {} + const body = undefined + + params = params ?? {} + for (const key in params) { + if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + querystring[key] = params[key] + } + } + + const method = 'POST' + const path = '/_transform/_upgrade' + return await this.transport.request({ path, method, querystring, body }, options) + } } diff --git a/src/api/api/update.ts b/src/api/api/update.ts index 83f547c92..4ab127557 100644 --- a/src/api/api/update.ts +++ b/src/api/api/update.ts @@ -42,21 +42,21 @@ export default async function UpdateApi (this: That, params: T.UpdateRequest | TB.UpdateRequest, options?: TransportRequestOptions): Promise> export default async function UpdateApi (this: That, params: T.UpdateRequest | TB.UpdateRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id', 'index', 'type'] - const acceptedQuery: string[] = ['if_primary_term', 'if_seq_no', 'lang', 'refresh', 'require_alias', 'retry_on_conflict', 'routing', 'timeout', 'wait_for_active_shards', '_source_excludes', '_source_includes', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['detect_noop', 'doc', 'doc_as_upsert', 'script', 'scripted_upsert', 'upsert'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } diff --git a/src/api/api/update_by_query.ts b/src/api/api/update_by_query.ts index 4e964edd6..2dc41349e 100644 --- a/src/api/api/update_by_query.ts +++ b/src/api/api/update_by_query.ts @@ -42,21 +42,21 @@ export default async function UpdateByQueryApi (this: That, params: T.UpdateByQu export default async function UpdateByQueryApi (this: That, params: T.UpdateByQueryRequest | TB.UpdateByQueryRequest, options?: TransportRequestOptions): Promise export default async function UpdateByQueryApi (this: That, params: T.UpdateByQueryRequest | TB.UpdateByQueryRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['index'] - const acceptedQuery: string[] = ['allow_no_indices', 'analyzer', 'analyze_wildcard', 'default_operator', 'df', 'expand_wildcards', 'from', 'ignore_unavailable', 'lenient', 'pipeline', 'preference', 'refresh', 'request_cache', 'requests_per_second', 'routing', 'scroll', 'scroll_size', 'search_timeout', 'search_type', 'size', 'slices', 'sort', '_source', '_source_excludes', '_source_includes', 'stats', 'terminate_after', 'timeout', 'version', 'version_type', 'wait_for_active_shards', 'wait_for_completion', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['max_docs', 'query', 'script', 'slice'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } diff --git a/src/api/api/update_by_query_rethrottle.ts b/src/api/api/update_by_query_rethrottle.ts index e5252fae9..8af59d09b 100644 --- a/src/api/api/update_by_query_rethrottle.ts +++ b/src/api/api/update_by_query_rethrottle.ts @@ -42,21 +42,15 @@ export default async function UpdateByQueryRethrottleApi (this: That, params: T. export default async function UpdateByQueryRethrottleApi (this: That, params: T.UpdateByQueryRethrottleRequest | TB.UpdateByQueryRethrottleRequest, options?: TransportRequestOptions): Promise export default async function UpdateByQueryRethrottleApi (this: That, params: T.UpdateByQueryRethrottleRequest | TB.UpdateByQueryRethrottleRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['task_id'] - const acceptedQuery: string[] = ['requests_per_second', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } diff --git a/src/api/api/watcher.ts b/src/api/api/watcher.ts index 0fa326977..6e0c9fd5a 100644 --- a/src/api/api/watcher.ts +++ b/src/api/api/watcher.ts @@ -48,21 +48,15 @@ export default class Watcher { async ackWatch (this: That, params: T.WatcherAckWatchRequest | TB.WatcherAckWatchRequest, options?: TransportRequestOptions): Promise async ackWatch (this: That, params: T.WatcherAckWatchRequest | TB.WatcherAckWatchRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['watch_id', 'action_id'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -83,21 +77,15 @@ export default class Watcher { async activateWatch (this: That, params: T.WatcherActivateWatchRequest | TB.WatcherActivateWatchRequest, options?: TransportRequestOptions): Promise async activateWatch (this: That, params: T.WatcherActivateWatchRequest | TB.WatcherActivateWatchRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['watch_id'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -111,21 +99,15 @@ export default class Watcher { async deactivateWatch (this: That, params: T.WatcherDeactivateWatchRequest | TB.WatcherDeactivateWatchRequest, options?: TransportRequestOptions): Promise async deactivateWatch (this: That, params: T.WatcherDeactivateWatchRequest | TB.WatcherDeactivateWatchRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['watch_id'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -139,21 +121,15 @@ export default class Watcher { async deleteWatch (this: That, params: T.WatcherDeleteWatchRequest | TB.WatcherDeleteWatchRequest, options?: TransportRequestOptions): Promise async deleteWatch (this: That, params: T.WatcherDeleteWatchRequest | TB.WatcherDeleteWatchRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -167,22 +143,22 @@ export default class Watcher { async executeWatch (this: That, params?: T.WatcherExecuteWatchRequest | TB.WatcherExecuteWatchRequest, options?: TransportRequestOptions): Promise async executeWatch (this: That, params?: T.WatcherExecuteWatchRequest | TB.WatcherExecuteWatchRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const acceptedQuery: string[] = ['debug', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['action_modes', 'alternative_input', 'ignore_condition', 'record_execution', 'simulated_actions', 'trigger_data', 'watch'] const querystring: Record = {} // @ts-expect-error let body: Record = params?.body ?? undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -203,21 +179,15 @@ export default class Watcher { async getWatch (this: That, params: T.WatcherGetWatchRequest | TB.WatcherGetWatchRequest, options?: TransportRequestOptions): Promise async getWatch (this: That, params: T.WatcherGetWatchRequest | TB.WatcherGetWatchRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params.body ?? undefined + const body = undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -231,21 +201,21 @@ export default class Watcher { async putWatch (this: That, params: T.WatcherPutWatchRequest | TB.WatcherPutWatchRequest, options?: TransportRequestOptions): Promise async putWatch (this: That, params: T.WatcherPutWatchRequest | TB.WatcherPutWatchRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['id'] - const acceptedQuery: string[] = ['active', 'if_primary_term', 'if_sequence_number', 'version', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['actions', 'condition', 'input', 'metadata', 'throttle_period', 'transform', 'trigger'] const querystring: Record = {} // @ts-expect-error let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -259,22 +229,22 @@ export default class Watcher { async queryWatches (this: That, params?: T.WatcherQueryWatchesRequest | TB.WatcherQueryWatchesRequest, options?: TransportRequestOptions): Promise async queryWatches (this: That, params?: T.WatcherQueryWatchesRequest | TB.WatcherQueryWatchesRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] + const acceptedBody: string[] = ['from', 'size', 'query', 'sort', 'search_after'] const querystring: Record = {} // @ts-expect-error let body: Record = params?.body ?? undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { - continue - } else if (key !== 'body') { + if (acceptedBody.includes(key)) { body = body ?? {} // @ts-expect-error body[key] = params[key] + } else if (acceptedPath.includes(key)) { + continue + } else if (key !== 'body') { + // @ts-expect-error + querystring[key] = params[key] } } @@ -288,22 +258,16 @@ export default class Watcher { async start (this: That, params?: T.WatcherStartRequest | TB.WatcherStartRequest, options?: TransportRequestOptions): Promise async start (this: That, params?: T.WatcherStartRequest | TB.WatcherStartRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -317,22 +281,16 @@ export default class Watcher { async stats (this: That, params?: T.WatcherStatsRequest | TB.WatcherStatsRequest, options?: TransportRequestOptions): Promise async stats (this: That, params?: T.WatcherStatsRequest | TB.WatcherStatsRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['metric'] - const acceptedQuery: string[] = ['emit_stacktraces', 'metric', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -353,22 +311,16 @@ export default class Watcher { async stop (this: That, params?: T.WatcherStopRequest | TB.WatcherStopRequest, options?: TransportRequestOptions): Promise async stop (this: That, params?: T.WatcherStopRequest | TB.WatcherStopRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } diff --git a/src/api/api/xpack.ts b/src/api/api/xpack.ts index 190c2a93f..8e67e2635 100644 --- a/src/api/api/xpack.ts +++ b/src/api/api/xpack.ts @@ -48,22 +48,16 @@ export default class Xpack { async info (this: That, params?: T.XpackInfoRequest | TB.XpackInfoRequest, options?: TransportRequestOptions): Promise async info (this: That, params?: T.XpackInfoRequest | TB.XpackInfoRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['categories', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } @@ -77,22 +71,16 @@ export default class Xpack { async usage (this: That, params?: T.XpackUsageRequest | TB.XpackUsageRequest, options?: TransportRequestOptions): Promise async usage (this: That, params?: T.XpackUsageRequest | TB.XpackUsageRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedQuery: string[] = ['master_timeout', 'error_trace', 'filter_path', 'human', 'pretty', 'source_query_string'] const querystring: Record = {} - // @ts-expect-error - let body: Record = params?.body ?? undefined + const body = undefined params = params ?? {} for (const key in params) { - if (acceptedQuery.includes(key)) { - // @ts-expect-error - querystring[key] = params[key] - } else if (acceptedPath.includes(key)) { + if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + querystring[key] = params[key] } } diff --git a/src/api/kibana.ts b/src/api/kibana.ts index 8d8e99013..b358ceed3 100644 --- a/src/api/kibana.ts +++ b/src/api/kibana.ts @@ -30,6 +30,7 @@ import { Serializer, Diagnostic, BaseConnectionPool, + TransportRequestParams, TransportRequestOptions, TransportResult } from '@elastic/transport' @@ -43,7 +44,9 @@ interface KibanaClient { diagnostic: Diagnostic name: string | symbol connectionPool: BaseConnectionPool - transport: SniffingTransport + transport: Omit & { + request: (params: TransportRequestParams, options?: TransportRequestOptions) => Promise> + } serializer: Serializer helpers: Helpers child: (opts?: ClientOptions) => KibanaClient @@ -129,16 +132,6 @@ interface KibanaClient { importDanglingIndex: (params: T.DanglingIndicesImportDanglingIndexRequest| TB.DanglingIndicesImportDanglingIndexRequest, options?: TransportRequestOptions) => Promise> listDanglingIndices: (params?: T.DanglingIndicesListDanglingIndicesRequest| TB.DanglingIndicesListDanglingIndicesRequest, options?: TransportRequestOptions) => Promise> } - dataFrameTransformDeprecated: { - deleteTransform: (params?: T.TODO, options?: TransportRequestOptions) => Promise> - getTransform: (params?: T.TODO, options?: TransportRequestOptions) => Promise> - getTransformStats: (params?: T.TODO, options?: TransportRequestOptions) => Promise> - previewTransform: (params?: T.TODO, options?: TransportRequestOptions) => Promise> - putTransform: (params?: T.TODO, options?: TransportRequestOptions) => Promise> - startTransform: (params?: T.TODO, options?: TransportRequestOptions) => Promise> - stopTransform: (params?: T.TODO, options?: TransportRequestOptions) => Promise> - updateTransform: (params?: T.TODO, options?: TransportRequestOptions) => Promise> - } delete: (params: T.DeleteRequest| TB.DeleteRequest, options?: TransportRequestOptions) => Promise> deleteByQuery: (params: T.DeleteByQueryRequest| TB.DeleteByQueryRequest, options?: TransportRequestOptions) => Promise> deleteByQueryRethrottle: (params: T.DeleteByQueryRethrottleRequest| TB.DeleteByQueryRethrottleRequest, options?: TransportRequestOptions) => Promise> @@ -271,6 +264,8 @@ interface KibanaClient { mget: (params?: T.MgetRequest| TB.MgetRequest, options?: TransportRequestOptions) => Promise, TContext>> migration: { deprecations: (params?: T.MigrationDeprecationsRequest| TB.MigrationDeprecationsRequest, options?: TransportRequestOptions) => Promise> + getFeatureUpgradeStatus: (params?: T.TODO, options?: TransportRequestOptions) => Promise> + postFeatureUpgrade: (params?: T.TODO, options?: TransportRequestOptions) => Promise> } ml: { closeJob: (params: T.MlCloseJobRequest| TB.MlCloseJobRequest, options?: TransportRequestOptions) => Promise> @@ -494,6 +489,7 @@ interface KibanaClient { startTransform: (params: T.TransformStartTransformRequest| TB.TransformStartTransformRequest, options?: TransportRequestOptions) => Promise> stopTransform: (params: T.TransformStopTransformRequest| TB.TransformStopTransformRequest, options?: TransportRequestOptions) => Promise> updateTransform: (params?: T.TransformUpdateTransformRequest| TB.TransformUpdateTransformRequest, options?: TransportRequestOptions) => Promise> + upgradeTransforms: (params?: T.TODO, options?: TransportRequestOptions) => Promise> } update: (params: T.UpdateRequest| TB.UpdateRequest, options?: TransportRequestOptions) => Promise, TContext>> updateByQuery: (params: T.UpdateByQueryRequest| TB.UpdateByQueryRequest, options?: TransportRequestOptions) => Promise> diff --git a/src/api/types.ts b/src/api/types.ts index a9eeea661..c7791a450 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -28,29 +28,21 @@ */ export type TODO = Record -export interface BulkCreateOperation extends BulkOperation { +export interface BulkCreateOperation extends BulkWriteOperation { } -export interface BulkCreateResponseItem extends BulkResponseItemBase { +export interface BulkDeleteOperation extends BulkOperationBase { } -export interface BulkDeleteOperation extends BulkOperation { +export interface BulkIndexOperation extends BulkWriteOperation { } -export interface BulkDeleteResponseItem extends BulkResponseItemBase { -} - -export interface BulkIndexOperation extends BulkOperation { -} - -export interface BulkIndexResponseItem extends BulkResponseItemBase { -} - -export interface BulkOperation { +export interface BulkOperationBase { _id?: Id _index?: IndexName - retry_on_conflict?: integer routing?: Routing + if_primary_term?: long + if_seq_no?: SequenceNumber version?: VersionNumber version_type?: VersionType } @@ -62,6 +54,8 @@ export interface BulkOperationContainer { delete?: BulkDeleteOperation } +export type BulkOperationType = 'index' | 'create' | 'update' | 'delete' + export interface BulkRequest extends RequestBase { index?: IndexName type?: Type @@ -79,12 +73,12 @@ export interface BulkRequest extends RequestBase { export interface BulkResponse { errors: boolean - items: BulkResponseItemContainer[] + items: Partial>[] took: long ingest_took?: long } -export interface BulkResponseItemBase { +export interface BulkResponseItem { _id?: string | null _index: string status: integer @@ -99,17 +93,15 @@ export interface BulkResponseItemBase { get?: InlineGet> } -export interface BulkResponseItemContainer { - index?: BulkIndexResponseItem - create?: BulkCreateResponseItem - update?: BulkUpdateResponseItem - delete?: BulkDeleteResponseItem +export interface BulkUpdateOperation extends BulkOperationBase { + require_alias?: boolean + retry_on_conflict?: integer } -export interface BulkUpdateOperation extends BulkOperation { -} - -export interface BulkUpdateResponseItem extends BulkResponseItemBase { +export interface BulkWriteOperation extends BulkOperationBase { + dynamic_templates?: Record + pipeline?: string + require_alias?: boolean } export interface ClearScrollRequest extends RequestBase { @@ -589,7 +581,7 @@ export interface MsearchTemplateTemplateItem { export interface MtermvectorsOperation { _id: Id _index?: IndexName - doc?: object + doc?: any fields?: Fields field_statistics?: boolean filter?: TermvectorsFilter @@ -1660,7 +1652,7 @@ export interface UpdateRequest lang?: string refresh?: Refresh require_alias?: boolean - retry_on_conflict?: long + retry_on_conflict?: integer routing?: Routing timeout?: Time wait_for_active_shards?: WaitForActiveShards @@ -1980,14 +1972,16 @@ export interface IndicesResponseBase extends AcknowledgedResponseBase { _shards?: ShardStatistics } -export interface InlineGet { +export interface InlineGetKeys { fields?: Record found: boolean - _seq_no: SequenceNumber - _primary_term: long + _seq_no?: SequenceNumber + _primary_term?: long _routing?: Routing _source: TDocument } +export type InlineGet = InlineGetKeys | +{ [property: string]: any } export interface InlineScript extends ScriptBase { source: string @@ -2224,7 +2218,7 @@ export interface SegmentsStats { version_map_memory_in_bytes: integer } -export type SequenceNumber = integer +export type SequenceNumber = long export type Service = string @@ -3914,7 +3908,7 @@ export interface MappingFieldAliasProperty extends MappingPropertyBase { export interface MappingFieldMapping { full_name: string - mapping: Record + mapping: Partial> } export interface MappingFieldNamesField { @@ -3955,7 +3949,7 @@ export interface MappingGenericProperty extends MappingDocValuesPropertyBase { type: string } -export type MappingGeoOrientation = 'right' | 'left' +export type MappingGeoOrientation = 'right' | 'RIGHT' | 'counterclockwise' | 'ccw' | 'left' | 'LEFT' | 'clockwise' | 'cw' export interface MappingGeoPointProperty extends MappingDocValuesPropertyBase { ignore_malformed?: boolean @@ -4685,14 +4679,14 @@ export interface QueryDslQueryBase { export interface QueryDslQueryContainer { bool?: QueryDslBoolQuery boosting?: QueryDslBoostingQuery - common?: Record + common?: Partial> combined_fields?: QueryDslCombinedFieldsQuery constant_score?: QueryDslConstantScoreQuery dis_max?: QueryDslDisMaxQuery distance_feature?: QueryDslDistanceFeatureQuery exists?: QueryDslExistsQuery function_score?: QueryDslFunctionScoreQuery - fuzzy?: Record + fuzzy?: Partial> geo_bounding_box?: QueryDslGeoBoundingBoxQuery geo_distance?: QueryDslGeoDistanceQuery geo_polygon?: QueryDslGeoPolygonQuery @@ -4700,24 +4694,24 @@ export interface QueryDslQueryContainer { has_child?: QueryDslHasChildQuery has_parent?: QueryDslHasParentQuery ids?: QueryDslIdsQuery - intervals?: Record - match?: Record + intervals?: Partial> + match?: Partial> match_all?: QueryDslMatchAllQuery - match_bool_prefix?: Record + match_bool_prefix?: Partial> match_none?: QueryDslMatchNoneQuery - match_phrase?: Record - match_phrase_prefix?: Record + match_phrase?: Partial> + match_phrase_prefix?: Partial> more_like_this?: QueryDslMoreLikeThisQuery multi_match?: QueryDslMultiMatchQuery nested?: QueryDslNestedQuery parent_id?: QueryDslParentIdQuery percolate?: QueryDslPercolateQuery pinned?: QueryDslPinnedQuery - prefix?: Record + prefix?: Partial> query_string?: QueryDslQueryStringQuery - range?: Record + range?: Partial> rank_feature?: QueryDslRankFeatureQuery - regexp?: Record + regexp?: Partial> script?: QueryDslScriptQuery script_score?: QueryDslScriptScoreQuery shape?: QueryDslShapeQuery @@ -4729,12 +4723,12 @@ export interface QueryDslQueryContainer { span_near?: QueryDslSpanNearQuery span_not?: QueryDslSpanNotQuery span_or?: QueryDslSpanOrQuery - span_term?: Record + span_term?: Partial> span_within?: QueryDslSpanWithinQuery - term?: Record + term?: Partial> terms?: QueryDslTermsQuery - terms_set?: Record - wildcard?: Record + terms_set?: Partial> + wildcard?: Partial> type?: QueryDslTypeQuery } @@ -4880,7 +4874,7 @@ export interface QueryDslSpanFirstQuery extends QueryDslQueryBase { match: QueryDslSpanQuery } -export type QueryDslSpanGapQuery = Record +export type QueryDslSpanGapQuery = Partial> export interface QueryDslSpanMultiTermQuery extends QueryDslQueryBase { match: QueryDslQueryContainer @@ -4913,7 +4907,7 @@ export interface QueryDslSpanQuery { span_near?: QueryDslSpanNearQuery span_not?: QueryDslSpanNotQuery span_or?: QueryDslSpanOrQuery - span_term?: Record + span_term?: Partial> span_within?: QueryDslSpanWithinQuery } @@ -4943,17 +4937,12 @@ export interface QueryDslTermsQueryKeys extends QueryDslQueryBase { export type QueryDslTermsQuery = QueryDslTermsQueryKeys | { [property: string]: string[] | long[] | QueryDslTermsLookup } -export interface QueryDslTermsSetFieldQuery { +export interface QueryDslTermsSetQuery extends QueryDslQueryBase { minimum_should_match_field?: Field minimum_should_match_script?: Script terms: string[] } -export interface QueryDslTermsSetQueryKeys extends QueryDslQueryBase { -} -export type QueryDslTermsSetQuery = QueryDslTermsSetQueryKeys | -{ [property: string]: QueryDslTermsSetFieldQuery } - export type QueryDslTextQueryType = 'best_fields' | 'most_fields' | 'cross_fields' | 'phrase' | 'phrase_prefix' | 'bool_prefix' export interface QueryDslThreeDimensionalPoint { @@ -5036,58 +5025,68 @@ export interface AsyncSearchStatusResponse extends AsyncSea export interface AsyncSearchSubmitRequest extends RequestBase { index?: Indices - batched_reduce_size?: long wait_for_completion_timeout?: Time keep_on_completion?: boolean - typed_keys?: boolean - aggs?: Record + keep_alive?: Time allow_no_indices?: boolean allow_partial_search_results?: boolean analyzer?: string analyze_wildcard?: boolean - collapse?: SearchFieldCollapse + batched_reduce_size?: long + ccs_minimize_roundtrips?: boolean default_operator?: DefaultOperator df?: string docvalue_fields?: Fields expand_wildcards?: ExpandWildcards explain?: boolean - from?: integer - highlight?: SearchHighlight ignore_throttled?: boolean ignore_unavailable?: boolean - indices_boost?: Record[] - keep_alive?: Time lenient?: boolean max_concurrent_shard_requests?: long - min_score?: double - post_filter?: QueryDslQueryContainer + min_compatible_shard_node?: VersionString preference?: string - profile?: boolean - pit?: SearchPointInTimeReference - query?: QueryDslQueryContainer + pre_filter_shard_size?: long request_cache?: boolean - rescore?: SearchRescore[] routing?: Routing - script_fields?: Record - search_after?: SearchSortResults + scroll?: Time search_type?: SearchType - sequence_number_primary_term?: boolean - size?: integer - sort?: SearchSort - _source?: boolean | SearchSourceFilter stats?: string[] stored_fields?: Fields - suggest?: Record suggest_field?: Field suggest_mode?: SuggestMode suggest_size?: long suggest_text?: string terminate_after?: long - timeout?: string + timeout?: Time + track_total_hits?: boolean | integer track_scores?: boolean - track_total_hits?: boolean + typed_keys?: boolean + rest_total_hits_as_int?: boolean version?: boolean + _source?: boolean | Fields + _source_excludes?: Fields + _source_includes?: Fields + seq_no_primary_term?: boolean + q?: string + size?: integer + from?: integer + sort?: string | string[] + aggs?: Record + aggregations?: Record + collapse?: SearchFieldCollapse + highlight?: SearchHighlight + indices_boost?: Record[] + min_score?: double + post_filter?: QueryDslQueryContainer + profile?: boolean + query?: QueryDslQueryContainer + rescore?: SearchRescore | SearchRescore[] + script_fields?: Record + search_after?: SearchSortResults + slice?: SlicedScroll fields?: (Field | DateField)[] + suggest?: SearchSuggestContainer | Record + pit?: SearchPointInTimeReference runtime_mappings?: MappingRuntimeFields } @@ -8831,7 +8830,7 @@ export interface IndicesGetFieldMappingResponse extends DictionaryResponseBase + mappings: Partial> } export interface IndicesGetIndexTemplateIndexTemplate { @@ -9525,14 +9524,42 @@ export interface IndicesUnfreezeResponse extends AcknowledgedResponseBase { shards_acknowledged: boolean } -export interface IndicesUpdateAliasesIndicesUpdateAliasBulk { - [key: string]: never +export interface IndicesUpdateAliasesAction { + add?: IndicesUpdateAliasesAddAction + remove?: IndicesUpdateAliasesRemoveAction + remove_index?: IndicesUpdateAliasesRemoveIndexAction +} + +export interface IndicesUpdateAliasesAddAction { + alias?: IndexAlias + aliases?: IndexAlias | IndexAlias[] + filter?: QueryDslQueryContainer + index?: IndexName + indices?: Indices + index_routing?: Routing + is_hidden?: boolean + is_write_index?: boolean + routing?: Routing + search_routing?: Routing +} + +export interface IndicesUpdateAliasesRemoveAction { + alias?: IndexAlias + aliases?: IndexAlias | IndexAlias[] + index?: IndexName + indices?: Indices + must_exist?: boolean +} + +export interface IndicesUpdateAliasesRemoveIndexAction { + index?: IndexName + indices?: Indices } export interface IndicesUpdateAliasesRequest extends RequestBase { master_timeout?: Time timeout?: Time - actions?: IndicesUpdateAliasesIndicesUpdateAliasBulk[] + actions?: IndicesUpdateAliasesAction[] } export interface IndicesUpdateAliasesResponse extends AcknowledgedResponseBase { @@ -11220,6 +11247,7 @@ export interface MlForecastRequest extends RequestBase { job_id: Id duration?: Time expires_in?: Time + max_model_memory?: string } export interface MlForecastResponse extends AcknowledgedResponseBase { @@ -15243,7 +15271,7 @@ export interface XpackUsageKibanaUrlConfig extends XpackUsageBaseUrlConfig { export interface XpackUsageMachineLearning extends XpackUsageBase { datafeeds: Record - jobs: Record | Record + jobs: Record | Partial> node_count: integer data_frame_analytics_jobs: XpackUsageMlDataFrameAnalyticsJobs inference: XpackUsageMlInference @@ -15491,6 +15519,10 @@ export interface XpackUsageWatcherWatchTriggerSchedule extends XpackUsageCounter _all: XpackUsageCounter } +export interface SpecUtilsAdditionalProperty { + [key: string]: never +} + export interface SpecUtilsAdditionalProperties { [key: string]: never } @@ -15503,10 +15535,6 @@ export interface SpecUtilsCommonQueryParameters { source_query_string?: string } -export interface SpecUtilsAdditionalProperty { - [key: string]: never -} - export interface SpecUtilsCommonCatQueryParameters { format?: string h?: Names diff --git a/src/api/typesWithBodyKey.ts b/src/api/typesWithBodyKey.ts index 2671958fd..a86224423 100644 --- a/src/api/typesWithBodyKey.ts +++ b/src/api/typesWithBodyKey.ts @@ -28,29 +28,21 @@ */ export type TODO = Record -export interface BulkCreateOperation extends BulkOperation { +export interface BulkCreateOperation extends BulkWriteOperation { } -export interface BulkCreateResponseItem extends BulkResponseItemBase { +export interface BulkDeleteOperation extends BulkOperationBase { } -export interface BulkDeleteOperation extends BulkOperation { +export interface BulkIndexOperation extends BulkWriteOperation { } -export interface BulkDeleteResponseItem extends BulkResponseItemBase { -} - -export interface BulkIndexOperation extends BulkOperation { -} - -export interface BulkIndexResponseItem extends BulkResponseItemBase { -} - -export interface BulkOperation { +export interface BulkOperationBase { _id?: Id _index?: IndexName - retry_on_conflict?: integer routing?: Routing + if_primary_term?: long + if_seq_no?: SequenceNumber version?: VersionNumber version_type?: VersionType } @@ -62,6 +54,8 @@ export interface BulkOperationContainer { delete?: BulkDeleteOperation } +export type BulkOperationType = 'index' | 'create' | 'update' | 'delete' + export interface BulkRequest extends RequestBase { index?: IndexName type?: Type @@ -80,12 +74,12 @@ export interface BulkRequest extends RequestBase { export interface BulkResponse { errors: boolean - items: BulkResponseItemContainer[] + items: Partial>[] took: long ingest_took?: long } -export interface BulkResponseItemBase { +export interface BulkResponseItem { _id?: string | null _index: string status: integer @@ -100,17 +94,15 @@ export interface BulkResponseItemBase { get?: InlineGet> } -export interface BulkResponseItemContainer { - index?: BulkIndexResponseItem - create?: BulkCreateResponseItem - update?: BulkUpdateResponseItem - delete?: BulkDeleteResponseItem +export interface BulkUpdateOperation extends BulkOperationBase { + require_alias?: boolean + retry_on_conflict?: integer } -export interface BulkUpdateOperation extends BulkOperation { -} - -export interface BulkUpdateResponseItem extends BulkResponseItemBase { +export interface BulkWriteOperation extends BulkOperationBase { + dynamic_templates?: Record + pipeline?: string + require_alias?: boolean } export interface ClearScrollRequest extends RequestBase { @@ -617,7 +609,7 @@ export interface MsearchTemplateTemplateItem { export interface MtermvectorsOperation { _id: Id _index?: IndexName - doc?: object + doc?: any fields?: Fields field_statistics?: boolean filter?: TermvectorsFilter @@ -1748,7 +1740,7 @@ export interface UpdateRequest lang?: string refresh?: Refresh require_alias?: boolean - retry_on_conflict?: long + retry_on_conflict?: integer routing?: Routing timeout?: Time wait_for_active_shards?: WaitForActiveShards @@ -2076,14 +2068,16 @@ export interface IndicesResponseBase extends AcknowledgedResponseBase { _shards?: ShardStatistics } -export interface InlineGet { +export interface InlineGetKeys { fields?: Record found: boolean - _seq_no: SequenceNumber - _primary_term: long + _seq_no?: SequenceNumber + _primary_term?: long _routing?: Routing _source: TDocument } +export type InlineGet = InlineGetKeys | +{ [property: string]: any } export interface InlineScript extends ScriptBase { source: string @@ -2320,7 +2314,7 @@ export interface SegmentsStats { version_map_memory_in_bytes: integer } -export type SequenceNumber = integer +export type SequenceNumber = long export type Service = string @@ -4010,7 +4004,7 @@ export interface MappingFieldAliasProperty extends MappingPropertyBase { export interface MappingFieldMapping { full_name: string - mapping: Record + mapping: Partial> } export interface MappingFieldNamesField { @@ -4051,7 +4045,7 @@ export interface MappingGenericProperty extends MappingDocValuesPropertyBase { type: string } -export type MappingGeoOrientation = 'right' | 'left' +export type MappingGeoOrientation = 'right' | 'RIGHT' | 'counterclockwise' | 'ccw' | 'left' | 'LEFT' | 'clockwise' | 'cw' export interface MappingGeoPointProperty extends MappingDocValuesPropertyBase { ignore_malformed?: boolean @@ -4781,14 +4775,14 @@ export interface QueryDslQueryBase { export interface QueryDslQueryContainer { bool?: QueryDslBoolQuery boosting?: QueryDslBoostingQuery - common?: Record + common?: Partial> combined_fields?: QueryDslCombinedFieldsQuery constant_score?: QueryDslConstantScoreQuery dis_max?: QueryDslDisMaxQuery distance_feature?: QueryDslDistanceFeatureQuery exists?: QueryDslExistsQuery function_score?: QueryDslFunctionScoreQuery - fuzzy?: Record + fuzzy?: Partial> geo_bounding_box?: QueryDslGeoBoundingBoxQuery geo_distance?: QueryDslGeoDistanceQuery geo_polygon?: QueryDslGeoPolygonQuery @@ -4796,24 +4790,24 @@ export interface QueryDslQueryContainer { has_child?: QueryDslHasChildQuery has_parent?: QueryDslHasParentQuery ids?: QueryDslIdsQuery - intervals?: Record - match?: Record + intervals?: Partial> + match?: Partial> match_all?: QueryDslMatchAllQuery - match_bool_prefix?: Record + match_bool_prefix?: Partial> match_none?: QueryDslMatchNoneQuery - match_phrase?: Record - match_phrase_prefix?: Record + match_phrase?: Partial> + match_phrase_prefix?: Partial> more_like_this?: QueryDslMoreLikeThisQuery multi_match?: QueryDslMultiMatchQuery nested?: QueryDslNestedQuery parent_id?: QueryDslParentIdQuery percolate?: QueryDslPercolateQuery pinned?: QueryDslPinnedQuery - prefix?: Record + prefix?: Partial> query_string?: QueryDslQueryStringQuery - range?: Record + range?: Partial> rank_feature?: QueryDslRankFeatureQuery - regexp?: Record + regexp?: Partial> script?: QueryDslScriptQuery script_score?: QueryDslScriptScoreQuery shape?: QueryDslShapeQuery @@ -4825,12 +4819,12 @@ export interface QueryDslQueryContainer { span_near?: QueryDslSpanNearQuery span_not?: QueryDslSpanNotQuery span_or?: QueryDslSpanOrQuery - span_term?: Record + span_term?: Partial> span_within?: QueryDslSpanWithinQuery - term?: Record + term?: Partial> terms?: QueryDslTermsQuery - terms_set?: Record - wildcard?: Record + terms_set?: Partial> + wildcard?: Partial> type?: QueryDslTypeQuery } @@ -4976,7 +4970,7 @@ export interface QueryDslSpanFirstQuery extends QueryDslQueryBase { match: QueryDslSpanQuery } -export type QueryDslSpanGapQuery = Record +export type QueryDslSpanGapQuery = Partial> export interface QueryDslSpanMultiTermQuery extends QueryDslQueryBase { match: QueryDslQueryContainer @@ -5009,7 +5003,7 @@ export interface QueryDslSpanQuery { span_near?: QueryDslSpanNearQuery span_not?: QueryDslSpanNotQuery span_or?: QueryDslSpanOrQuery - span_term?: Record + span_term?: Partial> span_within?: QueryDslSpanWithinQuery } @@ -5039,17 +5033,12 @@ export interface QueryDslTermsQueryKeys extends QueryDslQueryBase { export type QueryDslTermsQuery = QueryDslTermsQueryKeys | { [property: string]: string[] | long[] | QueryDslTermsLookup } -export interface QueryDslTermsSetFieldQuery { +export interface QueryDslTermsSetQuery extends QueryDslQueryBase { minimum_should_match_field?: Field minimum_should_match_script?: Script terms: string[] } -export interface QueryDslTermsSetQueryKeys extends QueryDslQueryBase { -} -export type QueryDslTermsSetQuery = QueryDslTermsSetQueryKeys | -{ [property: string]: QueryDslTermsSetFieldQuery } - export type QueryDslTextQueryType = 'best_fields' | 'most_fields' | 'cross_fields' | 'phrase' | 'phrase_prefix' | 'bool_prefix' export interface QueryDslThreeDimensionalPoint { @@ -5132,61 +5121,85 @@ export interface AsyncSearchStatusResponse extends AsyncSea export interface AsyncSearchSubmitRequest extends RequestBase { index?: Indices - batched_reduce_size?: long wait_for_completion_timeout?: Time keep_on_completion?: boolean + keep_alive?: Time + allow_no_indices?: boolean + allow_partial_search_results?: boolean + analyzer?: string + analyze_wildcard?: boolean + batched_reduce_size?: long + ccs_minimize_roundtrips?: boolean + default_operator?: DefaultOperator + df?: string + docvalue_fields?: Fields + expand_wildcards?: ExpandWildcards + explain?: boolean + ignore_throttled?: boolean + ignore_unavailable?: boolean + lenient?: boolean + max_concurrent_shard_requests?: long + min_compatible_shard_node?: VersionString + preference?: string + pre_filter_shard_size?: long + request_cache?: boolean + routing?: Routing + scroll?: Time + search_type?: SearchType + stats?: string[] + stored_fields?: Fields + suggest_field?: Field + suggest_mode?: SuggestMode + suggest_size?: long + suggest_text?: string + terminate_after?: long + timeout?: Time + track_total_hits?: boolean | integer + track_scores?: boolean typed_keys?: boolean + rest_total_hits_as_int?: boolean + version?: boolean + _source?: boolean | Fields + _source_excludes?: Fields + _source_includes?: Fields + seq_no_primary_term?: boolean + q?: string + size?: integer + from?: integer + sort?: string | string[] /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ body?: { aggs?: Record - allow_no_indices?: boolean - allow_partial_search_results?: boolean - analyzer?: string - analyze_wildcard?: boolean + aggregations?: Record collapse?: SearchFieldCollapse - default_operator?: DefaultOperator - df?: string - docvalue_fields?: Fields - expand_wildcards?: ExpandWildcards explain?: boolean from?: integer highlight?: SearchHighlight - ignore_throttled?: boolean - ignore_unavailable?: boolean + track_total_hits?: boolean | integer indices_boost?: Record[] - keep_alive?: Time - lenient?: boolean - max_concurrent_shard_requests?: long + docvalue_fields?: SearchDocValueField | (Field | SearchDocValueField)[] min_score?: double post_filter?: QueryDslQueryContainer - preference?: string profile?: boolean - pit?: SearchPointInTimeReference query?: QueryDslQueryContainer - request_cache?: boolean - rescore?: SearchRescore[] - routing?: Routing + rescore?: SearchRescore | SearchRescore[] script_fields?: Record search_after?: SearchSortResults - search_type?: SearchType - sequence_number_primary_term?: boolean size?: integer + slice?: SlicedScroll sort?: SearchSort - _source?: boolean | SearchSourceFilter - stats?: string[] - stored_fields?: Fields - suggest?: Record - suggest_field?: Field - suggest_mode?: SuggestMode - suggest_size?: long - suggest_text?: string + _source?: boolean | Fields | SearchSourceFilter + fields?: (Field | DateField)[] + suggest?: SearchSuggestContainer | Record terminate_after?: long timeout?: string track_scores?: boolean - track_total_hits?: boolean version?: boolean - fields?: (Field | DateField)[] + seq_no_primary_term?: boolean + stored_fields?: Fields + pit?: SearchPointInTimeReference runtime_mappings?: MappingRuntimeFields + stats?: string[] } } @@ -8983,7 +8996,7 @@ export interface IndicesGetFieldMappingResponse extends DictionaryResponseBase + mappings: Partial> } export interface IndicesGetIndexTemplateIndexTemplate { @@ -9704,8 +9717,36 @@ export interface IndicesUnfreezeResponse extends AcknowledgedResponseBase { shards_acknowledged: boolean } -export interface IndicesUpdateAliasesIndicesUpdateAliasBulk { - [key: string]: never +export interface IndicesUpdateAliasesAction { + add?: IndicesUpdateAliasesAddAction + remove?: IndicesUpdateAliasesRemoveAction + remove_index?: IndicesUpdateAliasesRemoveIndexAction +} + +export interface IndicesUpdateAliasesAddAction { + alias?: IndexAlias + aliases?: IndexAlias | IndexAlias[] + filter?: QueryDslQueryContainer + index?: IndexName + indices?: Indices + index_routing?: Routing + is_hidden?: boolean + is_write_index?: boolean + routing?: Routing + search_routing?: Routing +} + +export interface IndicesUpdateAliasesRemoveAction { + alias?: IndexAlias + aliases?: IndexAlias | IndexAlias[] + index?: IndexName + indices?: Indices + must_exist?: boolean +} + +export interface IndicesUpdateAliasesRemoveIndexAction { + index?: IndexName + indices?: Indices } export interface IndicesUpdateAliasesRequest extends RequestBase { @@ -9713,7 +9754,7 @@ export interface IndicesUpdateAliasesRequest extends RequestBase { timeout?: Time /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ body?: { - actions?: IndicesUpdateAliasesIndicesUpdateAliasBulk[] + actions?: IndicesUpdateAliasesAction[] } } @@ -11434,6 +11475,7 @@ export interface MlForecastRequest extends RequestBase { body?: { duration?: Time expires_in?: Time + max_model_memory?: string } } @@ -15631,7 +15673,7 @@ export interface XpackUsageKibanaUrlConfig extends XpackUsageBaseUrlConfig { export interface XpackUsageMachineLearning extends XpackUsageBase { datafeeds: Record - jobs: Record | Record + jobs: Record | Partial> node_count: integer data_frame_analytics_jobs: XpackUsageMlDataFrameAnalyticsJobs inference: XpackUsageMlInference @@ -15879,6 +15921,10 @@ export interface XpackUsageWatcherWatchTriggerSchedule extends XpackUsageCounter _all: XpackUsageCounter } +export interface SpecUtilsAdditionalProperty { + [key: string]: never +} + export interface SpecUtilsAdditionalProperties { [key: string]: never } @@ -15891,10 +15937,6 @@ export interface SpecUtilsCommonQueryParameters { source_query_string?: string } -export interface SpecUtilsAdditionalProperty { - [key: string]: never -} - export interface SpecUtilsCommonCatQueryParameters { format?: string h?: Names diff --git a/src/helpers.ts b/src/helpers.ts index 8c3e7c9c4..b945ac20c 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -821,6 +821,7 @@ export default class Helpers { for (let i = 0, len = items.length; i < len; i++) { const action = items[i] const operation = Object.keys(action)[0] + // @ts-expect-error const responseItem = action[operation as keyof T.BulkResponseItemContainer] assert(responseItem !== undefined, 'The responseItem is undefined, please file a bug report') const indexSlice = operation !== 'delete' ? i * 2 : i @@ -838,7 +839,6 @@ export default class Helpers { } else { onDrop({ status: responseItem.status, - // @ts-expect-error error: responseItem.error ?? null, operation: serializer.deserialize(bulkBody[indexSlice]), document: operation !== 'delete' diff --git a/test/integration/helper.js b/test/integration/helper.js index eb2021040..b8e965b89 100644 --- a/test/integration/helper.js +++ b/test/integration/helper.js @@ -88,6 +88,7 @@ function isXPackTemplate (name) { case '.deprecation-indexing-mappings': case '.deprecation-indexing-settings': case 'data-streams-mappings': + case '.logs-deprecation.elasticsearch-default': return true } return false diff --git a/test/integration/integration/test-runner.js b/test/integration/integration/test-runner.js index 824fb05fb..49807d548 100644 --- a/test/integration/integration/test-runner.js +++ b/test/integration/integration/test-runner.js @@ -103,7 +103,7 @@ function build (opts = {}) { if (isXPack) { // clean data streams - await client.indices.deleteDataStream({ name: '*' }) + await client.indices.deleteDataStream({ name: '*', expand_wildcards: 'all' }) } // clean all indices diff --git a/test/unit/api.test.ts b/test/unit/api.test.ts new file mode 100644 index 000000000..95f352035 --- /dev/null +++ b/test/unit/api.test.ts @@ -0,0 +1,136 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { test } from 'tap' +import { connection } from '../utils' +import { Client } from '../..' + +test('Api without body key and top level body', async t => { + t.plan(2) + + const Connection = connection.buildMockConnection({ + onRequest (opts) { + // @ts-expect-error + t.same(JSON.parse(opts.body), { query: { match_all: {} } }) + return { + statusCode: 200, + body: { took: 42 } + } + } + }) + + const client = new Client({ + node: 'http://localhost:9200', + Connection + }) + + const response = await client.search({ + index: 'test', + allow_no_indices: true, + query: { match_all: {} } + }) + + t.equal(response.took, 42) +}) + +test('Api with body key and top level body', async t => { + t.plan(2) + + const Connection = connection.buildMockConnection({ + onRequest (opts) { + // @ts-expect-error + t.same(JSON.parse(opts.body), { query: { match_all: {} } }) + return { + statusCode: 200, + body: { took: 42 } + } + } + }) + + const client = new Client({ + node: 'http://localhost:9200', + Connection + }) + + const response = await client.search({ + index: 'test', + allow_no_indices: true, + body: { + query: { match_all: {} } + } + }) + + t.equal(response.took, 42) +}) + +test('Api without body key and keyed body', async t => { + t.plan(2) + + const Connection = connection.buildMockConnection({ + onRequest (opts) { + // @ts-expect-error + t.same(JSON.parse(opts.body), { foo: 'bar' }) + return { + statusCode: 200, + body: { result: 'created' } + } + } + }) + + const client = new Client({ + node: 'http://localhost:9200', + Connection + }) + + const response = await client.create({ + index: 'test', + id: '1', + document: { foo: 'bar' } + }) + + t.equal(response.result, 'created') +}) + +test('Api with body key and keyed body', async t => { + t.plan(2) + + const Connection = connection.buildMockConnection({ + onRequest (opts) { + // @ts-expect-error + t.same(JSON.parse(opts.body), { foo: 'bar' }) + return { + statusCode: 200, + body: { result: 'created' } + } + } + }) + + const client = new Client({ + node: 'http://localhost:9200', + Connection + }) + + const response = await client.create({ + index: 'test', + id: '1', + body: { foo: 'bar' } + }) + + t.equal(response.result, 'created') +}) diff --git a/test/unit/helpers/scroll.test.ts b/test/unit/helpers/scroll.test.ts index b7ab9f735..43885cb29 100644 --- a/test/unit/helpers/scroll.test.ts +++ b/test/unit/helpers/scroll.test.ts @@ -297,7 +297,7 @@ test('Scroll search documents', async t => { t.equal(params.querystring, 'filter_path=hits.hits._source%2C_scroll_id&scroll=1m') } else { if (params.method !== 'DELETE') { - t.equal(params.body, '{"scroll":"1m","scroll_id":"id"}') + t.equal(params.querystring, 'scroll=1m&scroll_id=id') } } return { @@ -381,7 +381,7 @@ test('Fix querystring for scroll search', async t => { const MockConnection = connection.buildMockConnection({ onRequest (params) { if (count === 0) { - t.equal(params.querystring, 'scroll=1m') + t.equal(params.querystring, 'size=1&scroll=1m') } else { if (params.method !== 'DELETE') { if (params.method === 'POST') {