Skip to content

Commit

Permalink
Auto-generated API code
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine committed May 7, 2024
1 parent fe2d8c1 commit 084978f
Show file tree
Hide file tree
Showing 7 changed files with 1,426 additions and 273 deletions.
146 changes: 85 additions & 61 deletions docs/reference.asciidoc

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/api/api/cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ export default class Cluster {
async putComponentTemplate (this: That, params: T.ClusterPutComponentTemplateRequest | TB.ClusterPutComponentTemplateRequest, options?: TransportRequestOptions): Promise<T.ClusterPutComponentTemplateResponse>
async putComponentTemplate (this: That, params: T.ClusterPutComponentTemplateRequest | TB.ClusterPutComponentTemplateRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const acceptedBody: string[] = ['allow_auto_create', 'template', 'version', '_meta']
const acceptedBody: string[] = ['template', 'version', '_meta', 'deprecated']
const querystring: Record<string, any> = {}
// @ts-expect-error
const userBody: any = params?.body
Expand Down
2 changes: 1 addition & 1 deletion src/api/api/esql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default class Esql {
async query (this: That, params: T.EsqlQueryRequest | TB.EsqlQueryRequest, options?: TransportRequestOptions): Promise<T.EsqlQueryResponse>
async query (this: That, params: T.EsqlQueryRequest | TB.EsqlQueryRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const acceptedBody: string[] = ['columnar', 'filter', 'locale', 'params', 'query']
const acceptedBody: string[] = ['columnar', 'filter', 'locale', 'params', 'query', 'version']
const querystring: Record<string, any> = {}
// @ts-expect-error
const userBody: any = params?.body
Expand Down
40 changes: 18 additions & 22 deletions src/api/api/indices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1271,7 +1271,7 @@ export default class Indices {
async putIndexTemplate (this: That, params: T.IndicesPutIndexTemplateRequest | TB.IndicesPutIndexTemplateRequest, options?: TransportRequestOptions): Promise<T.IndicesPutIndexTemplateResponse>
async putIndexTemplate (this: That, params: T.IndicesPutIndexTemplateRequest | TB.IndicesPutIndexTemplateRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const acceptedBody: string[] = ['index_patterns', 'composed_of', 'template', 'data_stream', 'priority', 'version', '_meta']
const acceptedBody: string[] = ['index_patterns', 'composed_of', 'template', 'data_stream', 'priority', 'version', '_meta', 'allow_auto_create', 'ignore_missing_component_templates', 'deprecated']
const querystring: Record<string, any> = {}
// @ts-expect-error
const userBody: any = params?.body
Expand Down Expand Up @@ -1720,23 +1720,11 @@ export default class Indices {
async simulateIndexTemplate (this: That, params: T.IndicesSimulateIndexTemplateRequest | TB.IndicesSimulateIndexTemplateRequest, options?: TransportRequestOptions): Promise<T.IndicesSimulateIndexTemplateResponse>
async simulateIndexTemplate (this: That, params: T.IndicesSimulateIndexTemplateRequest | TB.IndicesSimulateIndexTemplateRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const acceptedBody: string[] = ['allow_auto_create', 'index_patterns', 'composed_of', 'template', 'data_stream', 'priority', 'version', '_meta']
const querystring: Record<string, any> = {}
// @ts-expect-error
const userBody: any = params?.body
let body: Record<string, any> | string
if (typeof userBody === 'string') {
body = userBody
} else {
body = userBody != null ? { ...userBody } : undefined
}
const body = undefined

for (const key in params) {
if (acceptedBody.includes(key)) {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
} else if (acceptedPath.includes(key)) {
if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body') {
// @ts-expect-error
Expand All @@ -1753,20 +1741,28 @@ export default class Indices {
* Simulate resolving the given template name or body
* @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-simulate-template.html | Elasticsearch API documentation}
*/
async simulateTemplate (this: That, params: T.IndicesSimulateTemplateRequest | TB.IndicesSimulateTemplateRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.IndicesSimulateTemplateResponse>
async simulateTemplate (this: That, params: T.IndicesSimulateTemplateRequest | TB.IndicesSimulateTemplateRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.IndicesSimulateTemplateResponse, unknown>>
async simulateTemplate (this: That, params: T.IndicesSimulateTemplateRequest | TB.IndicesSimulateTemplateRequest, options?: TransportRequestOptions): Promise<T.IndicesSimulateTemplateResponse>
async simulateTemplate (this: That, params: T.IndicesSimulateTemplateRequest | TB.IndicesSimulateTemplateRequest, options?: TransportRequestOptions): Promise<any> {
async simulateTemplate (this: That, params?: T.IndicesSimulateTemplateRequest | TB.IndicesSimulateTemplateRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.IndicesSimulateTemplateResponse>
async simulateTemplate (this: That, params?: T.IndicesSimulateTemplateRequest | TB.IndicesSimulateTemplateRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.IndicesSimulateTemplateResponse, unknown>>
async simulateTemplate (this: That, params?: T.IndicesSimulateTemplateRequest | TB.IndicesSimulateTemplateRequest, options?: TransportRequestOptions): Promise<T.IndicesSimulateTemplateResponse>
async simulateTemplate (this: That, params?: T.IndicesSimulateTemplateRequest | TB.IndicesSimulateTemplateRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const acceptedBody: string[] = ['template']
const acceptedBody: string[] = ['allow_auto_create', 'index_patterns', 'composed_of', 'template', 'data_stream', 'priority', 'version', '_meta', 'ignore_missing_component_templates', 'deprecated']
const querystring: Record<string, any> = {}
// @ts-expect-error
let body: any = params.body ?? undefined
const userBody: any = params?.body
let body: Record<string, any> | string
if (typeof userBody === 'string') {
body = userBody
} else {
body = userBody != null ? { ...userBody } : undefined
}

params = params ?? {}
for (const key in params) {
if (acceptedBody.includes(key)) {
body = body ?? {}
// @ts-expect-error
body = params[key]
body[key] = params[key]
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body') {
Expand Down
42 changes: 23 additions & 19 deletions src/api/api/inference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ export default class Inference {
}

/**
* Delete model in the Inference API
* Delete an inference endpoint
* @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-inference-api.html | Elasticsearch API documentation}
*/
async deleteModel (this: That, params: T.InferenceDeleteModelRequest | TB.InferenceDeleteModelRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.InferenceDeleteModelResponse>
async deleteModel (this: That, params: T.InferenceDeleteModelRequest | TB.InferenceDeleteModelRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.InferenceDeleteModelResponse, unknown>>
async deleteModel (this: That, params: T.InferenceDeleteModelRequest | TB.InferenceDeleteModelRequest, options?: TransportRequestOptions): Promise<T.InferenceDeleteModelResponse>
async deleteModel (this: That, params: T.InferenceDeleteModelRequest | TB.InferenceDeleteModelRequest, options?: TransportRequestOptions): Promise<any> {
async delete (this: That, params: T.InferenceDeleteRequest | TB.InferenceDeleteRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.InferenceDeleteResponse>
async delete (this: That, params: T.InferenceDeleteRequest | TB.InferenceDeleteRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.InferenceDeleteResponse, unknown>>
async delete (this: That, params: T.InferenceDeleteRequest | TB.InferenceDeleteRequest, options?: TransportRequestOptions): Promise<T.InferenceDeleteResponse>
async delete (this: That, params: T.InferenceDeleteRequest | TB.InferenceDeleteRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['task_type', 'inference_id']
const querystring: Record<string, any> = {}
const body = undefined
Expand All @@ -77,17 +77,18 @@ export default class Inference {
}

/**
* Get a model in the Inference API
* Get an inference endpoint
* @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/get-inference-api.html | Elasticsearch API documentation}
*/
async getModel (this: That, params: T.InferenceGetModelRequest | TB.InferenceGetModelRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.InferenceGetModelResponse>
async getModel (this: That, params: T.InferenceGetModelRequest | TB.InferenceGetModelRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.InferenceGetModelResponse, unknown>>
async getModel (this: That, params: T.InferenceGetModelRequest | TB.InferenceGetModelRequest, options?: TransportRequestOptions): Promise<T.InferenceGetModelResponse>
async getModel (this: That, params: T.InferenceGetModelRequest | TB.InferenceGetModelRequest, options?: TransportRequestOptions): Promise<any> {
async get (this: That, params?: T.InferenceGetRequest | TB.InferenceGetRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.InferenceGetResponse>
async get (this: That, params?: T.InferenceGetRequest | TB.InferenceGetRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.InferenceGetResponse, unknown>>
async get (this: That, params?: T.InferenceGetRequest | TB.InferenceGetRequest, options?: TransportRequestOptions): Promise<T.InferenceGetResponse>
async get (this: That, params?: T.InferenceGetRequest | TB.InferenceGetRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['task_type', 'inference_id']
const querystring: Record<string, any> = {}
const body = undefined

params = params ?? {}
for (const key in params) {
if (acceptedPath.includes(key)) {
continue
Expand All @@ -102,23 +103,26 @@ export default class Inference {
if (params.task_type != null && params.inference_id != null) {
method = 'GET'
path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.inference_id.toString())}`
} else {
} else if (params.inference_id != null) {
method = 'GET'
path = `/_inference/${encodeURIComponent(params.inference_id.toString())}`
} else {
method = 'GET'
path = '/_inference'
}
return await this.transport.request({ path, method, querystring, body }, options)
}

/**
* Perform inference on a model
* Perform inference
* @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/post-inference-api.html | Elasticsearch API documentation}
*/
async inference (this: That, params: T.InferenceInferenceRequest | TB.InferenceInferenceRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.InferenceInferenceResponse>
async inference (this: That, params: T.InferenceInferenceRequest | TB.InferenceInferenceRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.InferenceInferenceResponse, unknown>>
async inference (this: That, params: T.InferenceInferenceRequest | TB.InferenceInferenceRequest, options?: TransportRequestOptions): Promise<T.InferenceInferenceResponse>
async inference (this: That, params: T.InferenceInferenceRequest | TB.InferenceInferenceRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['task_type', 'inference_id']
const acceptedBody: string[] = ['input', 'task_settings']
const acceptedBody: string[] = ['query', 'input', 'task_settings']
const querystring: Record<string, any> = {}
// @ts-expect-error
const userBody: any = params?.body
Expand Down Expand Up @@ -155,15 +159,15 @@ export default class Inference {
}

/**
* Configure a model for use in the Inference API
* Configure an inference endpoint for use in the Inference API
* @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/master/put-inference-api.html | Elasticsearch API documentation}
*/
async putModel (this: That, params: T.InferencePutModelRequest | TB.InferencePutModelRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.InferencePutModelResponse>
async putModel (this: That, params: T.InferencePutModelRequest | TB.InferencePutModelRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.InferencePutModelResponse, unknown>>
async putModel (this: That, params: T.InferencePutModelRequest | TB.InferencePutModelRequest, options?: TransportRequestOptions): Promise<T.InferencePutModelResponse>
async putModel (this: That, params: T.InferencePutModelRequest | TB.InferencePutModelRequest, options?: TransportRequestOptions): Promise<any> {
async put (this: That, params: T.InferencePutRequest | TB.InferencePutRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.InferencePutResponse>
async put (this: That, params: T.InferencePutRequest | TB.InferencePutRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.InferencePutResponse, unknown>>
async put (this: That, params: T.InferencePutRequest | TB.InferencePutRequest, options?: TransportRequestOptions): Promise<T.InferencePutResponse>
async put (this: That, params: T.InferencePutRequest | TB.InferencePutRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['task_type', 'inference_id']
const acceptedBody: string[] = ['model_config']
const acceptedBody: string[] = ['inference_config']
const querystring: Record<string, any> = {}
// @ts-expect-error
let body: any = params.body ?? undefined
Expand Down
Loading

0 comments on commit 084978f

Please sign in to comment.