Skip to content

Commit 66723ee

Browse files
committed
API generation
1 parent 0817e3f commit 66723ee

File tree

15 files changed

+2237
-665
lines changed

15 files changed

+2237
-665
lines changed

src/api/api/_internal.ts

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
/* eslint-disable import/export */
21+
/* eslint-disable @typescript-eslint/no-misused-new */
22+
/* eslint-disable @typescript-eslint/no-extraneous-class */
23+
/* eslint-disable @typescript-eslint/no-unused-vars */
24+
25+
// This file was automatically generated by elastic/elastic-client-generator-js
26+
// DO NOT MODIFY IT BY HAND. Instead, modify the source open api file,
27+
// and elastic/elastic-client-generator-js to regenerate this file again.
28+
29+
import {
30+
Transport,
31+
TransportRequestOptions,
32+
TransportRequestOptionsWithMeta,
33+
TransportRequestOptionsWithOutMeta,
34+
TransportResult
35+
} from '@elastic/transport'
36+
import * as T from '../types'
37+
import * as TB from '../typesWithBodyKey'
38+
interface That { transport: Transport }
39+
40+
export default class Internal {
41+
transport: Transport
42+
constructor (transport: Transport) {
43+
this.transport = transport
44+
}
45+
46+
async deleteDesiredNodes (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise<T.TODO>
47+
async deleteDesiredNodes (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
48+
async deleteDesiredNodes (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<T.TODO>
49+
async deleteDesiredNodes (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<any> {
50+
const acceptedPath: string[] = []
51+
const querystring: Record<string, any> = {}
52+
const body = undefined
53+
54+
params = params ?? {}
55+
for (const key in params) {
56+
if (acceptedPath.includes(key)) {
57+
continue
58+
} else if (key !== 'body') {
59+
querystring[key] = params[key]
60+
}
61+
}
62+
63+
const method = 'DELETE'
64+
const path = '/_internal/desired_nodes'
65+
return await this.transport.request({ path, method, querystring, body }, options)
66+
}
67+
68+
async getDesiredNodes (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise<T.TODO>
69+
async getDesiredNodes (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
70+
async getDesiredNodes (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<T.TODO>
71+
async getDesiredNodes (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<any> {
72+
const acceptedPath: string[] = []
73+
const querystring: Record<string, any> = {}
74+
const body = undefined
75+
76+
params = params ?? {}
77+
for (const key in params) {
78+
if (acceptedPath.includes(key)) {
79+
continue
80+
} else if (key !== 'body') {
81+
querystring[key] = params[key]
82+
}
83+
}
84+
85+
const method = 'GET'
86+
const path = '/_internal/desired_nodes/_latest'
87+
return await this.transport.request({ path, method, querystring, body }, options)
88+
}
89+
90+
async updateDesiredNodes (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise<T.TODO>
91+
async updateDesiredNodes (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
92+
async updateDesiredNodes (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<T.TODO>
93+
async updateDesiredNodes (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<any> {
94+
const acceptedPath: string[] = ['history_id', 'version']
95+
const querystring: Record<string, any> = {}
96+
const body = undefined
97+
98+
params = params ?? {}
99+
for (const key in params) {
100+
if (acceptedPath.includes(key)) {
101+
continue
102+
} else if (key !== 'body') {
103+
querystring[key] = params[key]
104+
}
105+
}
106+
107+
const method = 'PUT'
108+
const path = `/_internal/desired_nodes/${encodeURIComponent(params.history_id.toString())}/${encodeURIComponent(params.version.toString())}`
109+
return await this.transport.request({ path, method, querystring, body }, options)
110+
}
111+
}

src/api/api/bulk.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ import * as T from '../types'
3737
import * as TB from '../typesWithBodyKey'
3838
interface That { transport: Transport }
3939

40-
export default async function BulkApi<TSource = unknown> (this: That, params: T.BulkRequest<TSource> | TB.BulkRequest<TSource>, options?: TransportRequestOptionsWithOutMeta): Promise<T.BulkResponse>
41-
export default async function BulkApi<TSource = unknown> (this: That, params: T.BulkRequest<TSource> | TB.BulkRequest<TSource>, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.BulkResponse, unknown>>
42-
export default async function BulkApi<TSource = unknown> (this: That, params: T.BulkRequest<TSource> | TB.BulkRequest<TSource>, options?: TransportRequestOptions): Promise<T.BulkResponse>
43-
export default async function BulkApi<TSource = unknown> (this: That, params: T.BulkRequest<TSource> | TB.BulkRequest<TSource>, options?: TransportRequestOptions): Promise<any> {
40+
export default async function BulkApi<TDocument = unknown, TPartialDocument = unknown> (this: That, params: T.BulkRequest<TDocument, TPartialDocument> | TB.BulkRequest<TDocument, TPartialDocument>, options?: TransportRequestOptionsWithOutMeta): Promise<T.BulkResponse>
41+
export default async function BulkApi<TDocument = unknown, TPartialDocument = unknown> (this: That, params: T.BulkRequest<TDocument, TPartialDocument> | TB.BulkRequest<TDocument, TPartialDocument>, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.BulkResponse, unknown>>
42+
export default async function BulkApi<TDocument = unknown, TPartialDocument = unknown> (this: That, params: T.BulkRequest<TDocument, TPartialDocument> | TB.BulkRequest<TDocument, TPartialDocument>, options?: TransportRequestOptions): Promise<T.BulkResponse>
43+
export default async function BulkApi<TDocument = unknown, TPartialDocument = unknown> (this: That, params: T.BulkRequest<TDocument, TPartialDocument> | TB.BulkRequest<TDocument, TPartialDocument>, options?: TransportRequestOptions): Promise<any> {
4444
const acceptedPath: string[] = ['index']
4545
const acceptedBody: string[] = ['operations']
4646
const querystring: Record<string, any> = {}

src/api/api/eql.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export default class Eql {
114114
async search<TEvent = unknown> (this: That, params: T.EqlSearchRequest | TB.EqlSearchRequest, options?: TransportRequestOptions): Promise<T.EqlSearchResponse<TEvent>>
115115
async search<TEvent = unknown> (this: That, params: T.EqlSearchRequest | TB.EqlSearchRequest, options?: TransportRequestOptions): Promise<any> {
116116
const acceptedPath: string[] = ['index']
117-
const acceptedBody: string[] = ['query', 'case_sensitive', 'event_category_field', 'tiebreaker_field', 'timestamp_field', 'fetch_size', 'filter', 'keep_alive', 'keep_on_completion', 'wait_for_completion_timeout', 'size', 'fields', 'result_position']
117+
const acceptedBody: string[] = ['query', 'case_sensitive', 'event_category_field', 'tiebreaker_field', 'timestamp_field', 'fetch_size', 'filter', 'keep_alive', 'keep_on_completion', 'wait_for_completion_timeout', 'size', 'fields', 'result_position', 'runtime_mappings']
118118
const querystring: Record<string, any> = {}
119119
// @ts-expect-error
120120
const userBody: any = params?.body

src/api/api/fleet.ts

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,24 @@ export default class Fleet {
6565
return await this.transport.request({ path, method, querystring, body }, options)
6666
}
6767

68-
async msearch (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise<T.TODO>
69-
async msearch (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
70-
async msearch (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<T.TODO>
71-
async msearch (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<any> {
68+
async msearch<TDocument = unknown> (this: That, params: T.FleetMsearchRequest | TB.FleetMsearchRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.FleetMsearchResponse<TDocument>>
69+
async msearch<TDocument = unknown> (this: That, params: T.FleetMsearchRequest | TB.FleetMsearchRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.FleetMsearchResponse<TDocument>, unknown>>
70+
async msearch<TDocument = unknown> (this: That, params: T.FleetMsearchRequest | TB.FleetMsearchRequest, options?: TransportRequestOptions): Promise<T.FleetMsearchResponse<TDocument>>
71+
async msearch<TDocument = unknown> (this: That, params: T.FleetMsearchRequest | TB.FleetMsearchRequest, options?: TransportRequestOptions): Promise<any> {
7272
const acceptedPath: string[] = ['index']
73+
const acceptedBody: string[] = ['searches']
7374
const querystring: Record<string, any> = {}
74-
const body = undefined
75+
// @ts-expect-error
76+
let body: any = params.body ?? undefined
7577

76-
params = params ?? {}
7778
for (const key in params) {
78-
if (acceptedPath.includes(key)) {
79+
if (acceptedBody.includes(key)) {
80+
// @ts-expect-error
81+
body = params[key]
82+
} else if (acceptedPath.includes(key)) {
7983
continue
8084
} else if (key !== 'body') {
85+
// @ts-expect-error
8186
querystring[key] = params[key]
8287
}
8388
}
@@ -94,19 +99,31 @@ export default class Fleet {
9499
return await this.transport.request({ path, method, querystring, bulkBody: body }, options)
95100
}
96101

97-
async search (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise<T.TODO>
98-
async search (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
99-
async search (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<T.TODO>
100-
async search (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<any> {
102+
async search<TDocument = unknown> (this: That, params: T.FleetSearchRequest | TB.FleetSearchRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.FleetSearchResponse<TDocument>>
103+
async search<TDocument = unknown> (this: That, params: T.FleetSearchRequest | TB.FleetSearchRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.FleetSearchResponse<TDocument>, unknown>>
104+
async search<TDocument = unknown> (this: That, params: T.FleetSearchRequest | TB.FleetSearchRequest, options?: TransportRequestOptions): Promise<T.FleetSearchResponse<TDocument>>
105+
async search<TDocument = unknown> (this: That, params: T.FleetSearchRequest | TB.FleetSearchRequest, options?: TransportRequestOptions): Promise<any> {
101106
const acceptedPath: string[] = ['index']
107+
const acceptedBody: string[] = ['aggregations', 'aggs', 'collapse', 'explain', 'from', 'highlight', 'track_total_hits', 'indices_boost', 'docvalue_fields', 'min_score', 'post_filter', 'profile', 'query', 'rescore', 'script_fields', 'search_after', 'size', 'slice', 'sort', '_source', 'fields', 'suggest', 'terminate_after', 'timeout', 'track_scores', 'version', 'seq_no_primary_term', 'stored_fields', 'pit', 'runtime_mappings', 'stats']
102108
const querystring: Record<string, any> = {}
103-
const body = undefined
109+
// @ts-expect-error
110+
const userBody: any = params?.body
111+
let body: Record<string, any> | string
112+
if (typeof userBody === 'string') {
113+
body = userBody
114+
} else {
115+
body = userBody != null ? { ...userBody } : undefined
116+
}
104117

105-
params = params ?? {}
106118
for (const key in params) {
107-
if (acceptedPath.includes(key)) {
119+
if (acceptedBody.includes(key)) {
120+
body = body ?? {}
121+
// @ts-expect-error
122+
body[key] = params[key]
123+
} else if (acceptedPath.includes(key)) {
108124
continue
109125
} else if (key !== 'body') {
126+
// @ts-expect-error
110127
querystring[key] = params[key]
111128
}
112129
}

src/api/api/ilm.ts

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,19 +140,32 @@ export default class Ilm {
140140
return await this.transport.request({ path, method, querystring, body }, options)
141141
}
142142

143-
async migrateToDataTiers (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise<T.TODO>
144-
async migrateToDataTiers (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
145-
async migrateToDataTiers (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<T.TODO>
146-
async migrateToDataTiers (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<any> {
143+
async migrateToDataTiers (this: That, params?: T.IlmMigrateToDataTiersRequest | TB.IlmMigrateToDataTiersRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.IlmMigrateToDataTiersResponse>
144+
async migrateToDataTiers (this: That, params?: T.IlmMigrateToDataTiersRequest | TB.IlmMigrateToDataTiersRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.IlmMigrateToDataTiersResponse, unknown>>
145+
async migrateToDataTiers (this: That, params?: T.IlmMigrateToDataTiersRequest | TB.IlmMigrateToDataTiersRequest, options?: TransportRequestOptions): Promise<T.IlmMigrateToDataTiersResponse>
146+
async migrateToDataTiers (this: That, params?: T.IlmMigrateToDataTiersRequest | TB.IlmMigrateToDataTiersRequest, options?: TransportRequestOptions): Promise<any> {
147147
const acceptedPath: string[] = []
148+
const acceptedBody: string[] = ['legacy_template_to_delete', 'node_attribute']
148149
const querystring: Record<string, any> = {}
149-
const body = undefined
150+
// @ts-expect-error
151+
const userBody: any = params?.body
152+
let body: Record<string, any> | string
153+
if (typeof userBody === 'string') {
154+
body = userBody
155+
} else {
156+
body = userBody != null ? { ...userBody } : undefined
157+
}
150158

151159
params = params ?? {}
152160
for (const key in params) {
153-
if (acceptedPath.includes(key)) {
161+
if (acceptedBody.includes(key)) {
162+
body = body ?? {}
163+
// @ts-expect-error
164+
body[key] = params[key]
165+
} else if (acceptedPath.includes(key)) {
154166
continue
155167
} else if (key !== 'body') {
168+
// @ts-expect-error
156169
querystring[key] = params[key]
157170
}
158171
}

src/api/api/indices.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -513,19 +513,19 @@ export default class Indices {
513513
return await this.transport.request({ path, method, querystring, body }, options)
514514
}
515515

516-
async fieldUsageStats (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise<T.TODO>
517-
async fieldUsageStats (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
518-
async fieldUsageStats (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<T.TODO>
519-
async fieldUsageStats (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<any> {
516+
async fieldUsageStats (this: That, params: T.IndicesFieldUsageStatsRequest | TB.IndicesFieldUsageStatsRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.IndicesFieldUsageStatsResponse>
517+
async fieldUsageStats (this: That, params: T.IndicesFieldUsageStatsRequest | TB.IndicesFieldUsageStatsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.IndicesFieldUsageStatsResponse, unknown>>
518+
async fieldUsageStats (this: That, params: T.IndicesFieldUsageStatsRequest | TB.IndicesFieldUsageStatsRequest, options?: TransportRequestOptions): Promise<T.IndicesFieldUsageStatsResponse>
519+
async fieldUsageStats (this: That, params: T.IndicesFieldUsageStatsRequest | TB.IndicesFieldUsageStatsRequest, options?: TransportRequestOptions): Promise<any> {
520520
const acceptedPath: string[] = ['index']
521521
const querystring: Record<string, any> = {}
522522
const body = undefined
523523

524-
params = params ?? {}
525524
for (const key in params) {
526525
if (acceptedPath.includes(key)) {
527526
continue
528527
} else if (key !== 'body') {
528+
// @ts-expect-error
529529
querystring[key] = params[key]
530530
}
531531
}

src/api/api/monitoring.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ export default class Monitoring {
4343
this.transport = transport
4444
}
4545

46-
async bulk<TSource = unknown> (this: That, params: T.MonitoringBulkRequest<TSource> | TB.MonitoringBulkRequest<TSource>, options?: TransportRequestOptionsWithOutMeta): Promise<T.MonitoringBulkResponse>
47-
async bulk<TSource = unknown> (this: That, params: T.MonitoringBulkRequest<TSource> | TB.MonitoringBulkRequest<TSource>, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.MonitoringBulkResponse, unknown>>
48-
async bulk<TSource = unknown> (this: That, params: T.MonitoringBulkRequest<TSource> | TB.MonitoringBulkRequest<TSource>, options?: TransportRequestOptions): Promise<T.MonitoringBulkResponse>
49-
async bulk<TSource = unknown> (this: That, params: T.MonitoringBulkRequest<TSource> | TB.MonitoringBulkRequest<TSource>, options?: TransportRequestOptions): Promise<any> {
46+
async bulk<TDocument = unknown, TPartialDocument = unknown> (this: That, params: T.MonitoringBulkRequest<TDocument, TPartialDocument> | TB.MonitoringBulkRequest<TDocument, TPartialDocument>, options?: TransportRequestOptionsWithOutMeta): Promise<T.MonitoringBulkResponse>
47+
async bulk<TDocument = unknown, TPartialDocument = unknown> (this: That, params: T.MonitoringBulkRequest<TDocument, TPartialDocument> | TB.MonitoringBulkRequest<TDocument, TPartialDocument>, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.MonitoringBulkResponse, unknown>>
48+
async bulk<TDocument = unknown, TPartialDocument = unknown> (this: That, params: T.MonitoringBulkRequest<TDocument, TPartialDocument> | TB.MonitoringBulkRequest<TDocument, TPartialDocument>, options?: TransportRequestOptions): Promise<T.MonitoringBulkResponse>
49+
async bulk<TDocument = unknown, TPartialDocument = unknown> (this: That, params: T.MonitoringBulkRequest<TDocument, TPartialDocument> | TB.MonitoringBulkRequest<TDocument, TPartialDocument>, options?: TransportRequestOptions): Promise<any> {
5050
const acceptedPath: string[] = ['type']
5151
const acceptedBody: string[] = ['operations']
5252
const querystring: Record<string, any> = {}

0 commit comments

Comments
 (0)