Skip to content

Commit 33e0873

Browse files
committed
API generation
1 parent 2774877 commit 33e0873

File tree

11 files changed

+970
-279
lines changed

11 files changed

+970
-279
lines changed

docs/reference.asciidoc

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2384,6 +2384,8 @@ client.ml.getJobs(...)
23842384
[discrete]
23852385
==== get_memory_stats
23862386
Returns information on how ML is using memory.
2387+
2388+
https://www.elastic.co/guide/en/elasticsearch/reference/current/get-ml-memory.html[Endpoint documentation]
23872389
[source,ts]
23882390
----
23892391
client.ml.getMemoryStats(...)
@@ -2450,13 +2452,13 @@ client.ml.getTrainedModelsStats(...)
24502452
----
24512453

24522454
[discrete]
2453-
==== infer_trained_model_deployment
2455+
==== infer_trained_model
24542456
Evaluate a trained model.
24552457

2456-
https://www.elastic.co/guide/en/elasticsearch/reference/master/infer-trained-model-deployment.html[Endpoint documentation]
2458+
https://www.elastic.co/guide/en/elasticsearch/reference/master/infer-trained-model.html[Endpoint documentation]
24572459
[source,ts]
24582460
----
2459-
client.ml.inferTrainedModelDeployment(...)
2461+
client.ml.inferTrainedModel(...)
24602462
----
24612463

24622464
[discrete]
@@ -2980,6 +2982,8 @@ client.searchableSnapshots.stats(...)
29802982
[discrete]
29812983
==== activate_user_profile
29822984
Creates or updates the user profile on behalf of another user.
2985+
2986+
https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-activate-user-profile.html[Endpoint documentation]
29832987
[source,ts]
29842988
----
29852989
client.security.activateUserProfile(...)
@@ -3288,6 +3292,8 @@ client.security.getUserPrivileges(...)
32883292
[discrete]
32893293
==== get_user_profile
32903294
Retrieves user profile for the given unique ID.
3295+
3296+
https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-user-profile.html[Endpoint documentation]
32913297
[source,ts]
32923298
----
32933299
client.security.getUserProfile(...)
@@ -3474,18 +3480,20 @@ client.security.samlServiceProviderMetadata(...)
34743480
----
34753481

34763482
[discrete]
3477-
==== search_user_profiles
3478-
Searches for user profiles that match specified criteria.
3483+
==== suggest_user_profiles
3484+
Get suggestions for user profiles that match specified search criteria.
34793485

3480-
https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-search-user-profile.html[Endpoint documentation]
3486+
https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-suggest-user-profile.html[Endpoint documentation]
34813487
[source,ts]
34823488
----
3483-
client.security.searchUserProfiles(...)
3489+
client.security.suggestUserProfiles(...)
34843490
----
34853491

34863492
[discrete]
34873493
==== update_user_profile_data
34883494
Update application specific data for the user profile of the given unique ID.
3495+
3496+
https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-update-user-profile-data.html[Endpoint documentation]
34893497
[source,ts]
34903498
----
34913499
client.security.updateUserProfileData(...)

src/api/api/_internal.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,18 @@ export default class Internal {
104104
}
105105
}
106106

107-
const method = 'GET'
108-
const path = '/_internal/_health'
107+
let method = ''
108+
let path = ''
109+
if (params.component != null && params.feature != null) {
110+
method = 'GET'
111+
path = `/_internal/_health/${encodeURIComponent(params.component.toString())}/${encodeURIComponent(params.feature.toString())}`
112+
} else if (params.component != null) {
113+
method = 'GET'
114+
path = `/_internal/_health/${encodeURIComponent(params.component.toString())}`
115+
} else {
116+
method = 'GET'
117+
path = '/_internal/_health'
118+
}
109119
return await this.transport.request({ path, method, querystring, body }, options)
110120
}
111121

src/api/api/async_search.ts

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

68-
async get<TDocument = unknown> (this: That, params: T.AsyncSearchGetRequest | TB.AsyncSearchGetRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.AsyncSearchGetResponse<TDocument>>
69-
async get<TDocument = unknown> (this: That, params: T.AsyncSearchGetRequest | TB.AsyncSearchGetRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.AsyncSearchGetResponse<TDocument>, unknown>>
70-
async get<TDocument = unknown> (this: That, params: T.AsyncSearchGetRequest | TB.AsyncSearchGetRequest, options?: TransportRequestOptions): Promise<T.AsyncSearchGetResponse<TDocument>>
71-
async get<TDocument = unknown> (this: That, params: T.AsyncSearchGetRequest | TB.AsyncSearchGetRequest, options?: TransportRequestOptions): Promise<any> {
68+
async get<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params: T.AsyncSearchGetRequest | TB.AsyncSearchGetRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.AsyncSearchGetResponse<TDocument, TAggregations>>
69+
async get<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params: T.AsyncSearchGetRequest | TB.AsyncSearchGetRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.AsyncSearchGetResponse<TDocument, TAggregations>, unknown>>
70+
async get<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params: T.AsyncSearchGetRequest | TB.AsyncSearchGetRequest, options?: TransportRequestOptions): Promise<T.AsyncSearchGetResponse<TDocument, TAggregations>>
71+
async get<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params: T.AsyncSearchGetRequest | TB.AsyncSearchGetRequest, options?: TransportRequestOptions): Promise<any> {
7272
const acceptedPath: string[] = ['id']
7373
const querystring: Record<string, any> = {}
7474
const body = undefined
@@ -109,10 +109,10 @@ export default class AsyncSearch {
109109
return await this.transport.request({ path, method, querystring, body }, options)
110110
}
111111

112-
async submit<TDocument = unknown> (this: That, params?: T.AsyncSearchSubmitRequest | TB.AsyncSearchSubmitRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.AsyncSearchSubmitResponse<TDocument>>
113-
async submit<TDocument = unknown> (this: That, params?: T.AsyncSearchSubmitRequest | TB.AsyncSearchSubmitRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.AsyncSearchSubmitResponse<TDocument>, unknown>>
114-
async submit<TDocument = unknown> (this: That, params?: T.AsyncSearchSubmitRequest | TB.AsyncSearchSubmitRequest, options?: TransportRequestOptions): Promise<T.AsyncSearchSubmitResponse<TDocument>>
115-
async submit<TDocument = unknown> (this: That, params?: T.AsyncSearchSubmitRequest | TB.AsyncSearchSubmitRequest, options?: TransportRequestOptions): Promise<any> {
112+
async submit<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params?: T.AsyncSearchSubmitRequest | TB.AsyncSearchSubmitRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.AsyncSearchSubmitResponse<TDocument, TAggregations>>
113+
async submit<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params?: T.AsyncSearchSubmitRequest | TB.AsyncSearchSubmitRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.AsyncSearchSubmitResponse<TDocument, TAggregations>, unknown>>
114+
async submit<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params?: T.AsyncSearchSubmitRequest | TB.AsyncSearchSubmitRequest, options?: TransportRequestOptions): Promise<T.AsyncSearchSubmitResponse<TDocument, TAggregations>>
115+
async submit<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params?: T.AsyncSearchSubmitRequest | TB.AsyncSearchSubmitRequest, options?: TransportRequestOptions): Promise<any> {
116116
const acceptedPath: string[] = ['index']
117117
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']
118118
const querystring: Record<string, any> = {}

src/api/api/cat.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,10 @@ export default class Cat {
103103
return await this.transport.request({ path, method, querystring, body }, options)
104104
}
105105

106-
async componentTemplates (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise<T.TODO>
107-
async componentTemplates (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
108-
async componentTemplates (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<T.TODO>
109-
async componentTemplates (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<any> {
106+
async componentTemplates (this: That, params?: T.CatComponentTemplatesRequest | TB.CatComponentTemplatesRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.CatComponentTemplatesResponse>
107+
async componentTemplates (this: That, params?: T.CatComponentTemplatesRequest | TB.CatComponentTemplatesRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.CatComponentTemplatesResponse, unknown>>
108+
async componentTemplates (this: That, params?: T.CatComponentTemplatesRequest | TB.CatComponentTemplatesRequest, options?: TransportRequestOptions): Promise<T.CatComponentTemplatesResponse>
109+
async componentTemplates (this: That, params?: T.CatComponentTemplatesRequest | TB.CatComponentTemplatesRequest, options?: TransportRequestOptions): Promise<any> {
110110
const acceptedPath: string[] = ['name']
111111
const querystring: Record<string, any> = {}
112112
const body = undefined
@@ -116,6 +116,7 @@ export default class Cat {
116116
if (acceptedPath.includes(key)) {
117117
continue
118118
} else if (key !== 'body') {
119+
// @ts-expect-error
119120
querystring[key] = params[key]
120121
}
121122
}

src/api/api/enrich.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ export default class Enrich {
122122
async putPolicy (this: That, params: T.EnrichPutPolicyRequest | TB.EnrichPutPolicyRequest, options?: TransportRequestOptions): Promise<T.EnrichPutPolicyResponse>
123123
async putPolicy (this: That, params: T.EnrichPutPolicyRequest | TB.EnrichPutPolicyRequest, options?: TransportRequestOptions): Promise<any> {
124124
const acceptedPath: string[] = ['name']
125-
const acceptedBody: string[] = ['geo_match', 'match']
125+
const acceptedBody: string[] = ['geo_match', 'match', 'range']
126126
const querystring: Record<string, any> = {}
127127
// @ts-expect-error
128128
const userBody: any = params?.body

src/api/api/indices.ts

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -860,19 +860,31 @@ export default class Indices {
860860
return await this.transport.request({ path, method, querystring, body }, options)
861861
}
862862

863-
async modifyDataStream (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise<T.TODO>
864-
async modifyDataStream (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
865-
async modifyDataStream (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<T.TODO>
866-
async modifyDataStream (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<any> {
863+
async modifyDataStream (this: That, params: T.IndicesModifyDataStreamRequest | TB.IndicesModifyDataStreamRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.IndicesModifyDataStreamResponse>
864+
async modifyDataStream (this: That, params: T.IndicesModifyDataStreamRequest | TB.IndicesModifyDataStreamRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.IndicesModifyDataStreamResponse, unknown>>
865+
async modifyDataStream (this: That, params: T.IndicesModifyDataStreamRequest | TB.IndicesModifyDataStreamRequest, options?: TransportRequestOptions): Promise<T.IndicesModifyDataStreamResponse>
866+
async modifyDataStream (this: That, params: T.IndicesModifyDataStreamRequest | TB.IndicesModifyDataStreamRequest, options?: TransportRequestOptions): Promise<any> {
867867
const acceptedPath: string[] = []
868+
const acceptedBody: string[] = ['actions']
868869
const querystring: Record<string, any> = {}
869-
const body = undefined
870+
// @ts-expect-error
871+
const userBody: any = params?.body
872+
let body: Record<string, any> | string
873+
if (typeof userBody === 'string') {
874+
body = userBody
875+
} else {
876+
body = userBody != null ? { ...userBody } : undefined
877+
}
870878

871-
params = params ?? {}
872879
for (const key in params) {
873-
if (acceptedPath.includes(key)) {
880+
if (acceptedBody.includes(key)) {
881+
body = body ?? {}
882+
// @ts-expect-error
883+
body[key] = params[key]
884+
} else if (acceptedPath.includes(key)) {
874885
continue
875886
} else if (key !== 'body') {
887+
// @ts-expect-error
876888
querystring[key] = params[key]
877889
}
878890
}

src/api/api/ml.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,12 +1158,12 @@ export default class Ml {
11581158
return await this.transport.request({ path, method, querystring, body }, options)
11591159
}
11601160

1161-
async inferTrainedModelDeployment (this: That, params: T.MlInferTrainedModelDeploymentRequest | TB.MlInferTrainedModelDeploymentRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.MlInferTrainedModelDeploymentResponse>
1162-
async inferTrainedModelDeployment (this: That, params: T.MlInferTrainedModelDeploymentRequest | TB.MlInferTrainedModelDeploymentRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.MlInferTrainedModelDeploymentResponse, unknown>>
1163-
async inferTrainedModelDeployment (this: That, params: T.MlInferTrainedModelDeploymentRequest | TB.MlInferTrainedModelDeploymentRequest, options?: TransportRequestOptions): Promise<T.MlInferTrainedModelDeploymentResponse>
1164-
async inferTrainedModelDeployment (this: That, params: T.MlInferTrainedModelDeploymentRequest | TB.MlInferTrainedModelDeploymentRequest, options?: TransportRequestOptions): Promise<any> {
1161+
async inferTrainedModel (this: That, params: T.MlInferTrainedModelRequest | TB.MlInferTrainedModelRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.MlInferTrainedModelResponse>
1162+
async inferTrainedModel (this: That, params: T.MlInferTrainedModelRequest | TB.MlInferTrainedModelRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.MlInferTrainedModelResponse, unknown>>
1163+
async inferTrainedModel (this: That, params: T.MlInferTrainedModelRequest | TB.MlInferTrainedModelRequest, options?: TransportRequestOptions): Promise<T.MlInferTrainedModelResponse>
1164+
async inferTrainedModel (this: That, params: T.MlInferTrainedModelRequest | TB.MlInferTrainedModelRequest, options?: TransportRequestOptions): Promise<any> {
11651165
const acceptedPath: string[] = ['model_id']
1166-
const acceptedBody: string[] = ['docs']
1166+
const acceptedBody: string[] = ['docs', 'inference_config']
11671167
const querystring: Record<string, any> = {}
11681168
// @ts-expect-error
11691169
const userBody: any = params?.body
@@ -1188,7 +1188,7 @@ export default class Ml {
11881188
}
11891189

11901190
const method = 'POST'
1191-
const path = `/_ml/trained_models/${encodeURIComponent(params.model_id.toString())}/deployment/_infer`
1191+
const path = `/_ml/trained_models/${encodeURIComponent(params.model_id.toString())}/_infer`
11921192
return await this.transport.request({ path, method, querystring, body }, options)
11931193
}
11941194

0 commit comments

Comments
 (0)