From 66222f01110991626d0d65e3c4be7a1633031019 Mon Sep 17 00:00:00 2001 From: delvedor Date: Mon, 25 Oct 2021 09:32:19 +0200 Subject: [PATCH] API generation --- src/api/api/ml.ts | 20 ++++++++++++++++---- src/api/api/scroll.ts | 10 ++++++++-- src/api/types.ts | 2 +- src/api/typesWithBodyKey.ts | 2 +- 4 files changed, 26 insertions(+), 8 deletions(-) diff --git a/src/api/api/ml.ts b/src/api/api/ml.ts index ad376d4a7..28bc3d7f9 100644 --- a/src/api/api/ml.ts +++ b/src/api/api/ml.ts @@ -180,12 +180,18 @@ 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 acceptedBody: string[] = ['requests_per_second', 'timeout'] const querystring: Record = {} - const body = undefined + // @ts-expect-error + let body: Record = params?.body ?? undefined params = params ?? {} for (const key in params) { - if (acceptedPath.includes(key)) { + 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 @@ -863,11 +869,17 @@ 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 acceptedBody: string[] = ['start', 'end'] const querystring: Record = {} - const body = undefined + // @ts-expect-error + let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedPath.includes(key)) { + 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 diff --git a/src/api/api/scroll.ts b/src/api/api/scroll.ts index e6a16fe9a..b71ba0523 100644 --- a/src/api/api/scroll.ts +++ b/src/api/api/scroll.ts @@ -42,11 +42,17 @@ 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 acceptedBody: string[] = ['scroll', 'scroll_id'] const querystring: Record = {} - const body = undefined + // @ts-expect-error + let body: Record = params.body ?? undefined for (const key in params) { - if (acceptedPath.includes(key)) { + 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 diff --git a/src/api/types.ts b/src/api/types.ts index b21a28f37..b2e433035 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -8280,7 +8280,7 @@ export interface IndicesDataStream { hidden?: boolean } -export type IndicesDataStreamHealthStatus = 'green' | 'yellow' | 'red' +export type IndicesDataStreamHealthStatus = 'green' | 'GREEN' | 'yellow' | 'YELLOW' | 'red' | 'RED' export interface IndicesFielddataFrequencyFilter { max: double diff --git a/src/api/typesWithBodyKey.ts b/src/api/typesWithBodyKey.ts index 519bd8245..7f023a232 100644 --- a/src/api/typesWithBodyKey.ts +++ b/src/api/typesWithBodyKey.ts @@ -8436,7 +8436,7 @@ export interface IndicesDataStream { hidden?: boolean } -export type IndicesDataStreamHealthStatus = 'green' | 'yellow' | 'red' +export type IndicesDataStreamHealthStatus = 'green' | 'GREEN' | 'yellow' | 'YELLOW' | 'red' | 'RED' export interface IndicesFielddataFrequencyFilter { max: double