import { Transport , TransportRequestOptions , TransportRequestOptionsWithMeta , TransportRequestOptionsWithOutMeta , TransportResult } from '@elastic/transport' ; import * as T from '../types' ; import * as TB from '../typesWithBodyKey' ; interface That { transport : Transport ; } export default class Transform { transport : Transport ; constructor ( transport ) { this . transport = transport ; } async deleteTransform ( this , params , options ? ) ; async deleteTransform ( this , params , options ? ) ; async deleteTransform ( this , params , options ? ) ; async deleteTransform ( this , params , options ? ) { const acceptedPath = [ 'transform_id' ] ; const querystring = { } ; const body = undefined ; for ( const key in params ) { if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'DELETE' ; const path = `/_transform/${ encodeURIComponent ( params . transform_id . toString ( ) ) }` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async getTransform ( this , params ? , options ? ) ; async getTransform ( this , params ? , options ? ) ; async getTransform ( this , params ? , options ? ) ; async getTransform ( this , params ? , options ? ) { const acceptedPath = [ 'transform_id' ] ; const querystring = { } ; const body = undefined ; params = params ?? { } ; for ( const key in params ) { if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } let method = '' ; let path = '' ; if ( params . transform_id != null ) { method = 'GET' ; path = `/_transform/${ encodeURIComponent ( params . transform_id . toString ( ) ) }` ; } else { method = 'GET' ; path = '/_transform' ; } return await this . transport . request ( { path , method , querystring , body } , options ) ; } async getTransformStats ( this , params , options ? ) ; async getTransformStats ( this , params , options ? ) ; async getTransformStats ( this , params , options ? ) ; async getTransformStats ( this , params , options ? ) { const acceptedPath = [ 'transform_id' ] ; const querystring = { } ; const body = undefined ; for ( const key in params ) { if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'GET' ; const path = `/_transform/${ encodeURIComponent ( params . transform_id . toString ( ) ) }/_stats` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async previewTransform < TTransform = unknown > ( this , params ? , options ? ) ; async previewTransform < TTransform = unknown > ( this , params ? , options ? ) ; async previewTransform < TTransform = unknown > ( this , params ? , options ? ) ; async previewTransform < TTransform = unknown > ( this , params ? , options ? ) { const acceptedPath = [ 'transform_id' ] ; const acceptedBody = [ 'dest' , 'description' , 'frequency' , 'pivot' , 'source' , 'settings' , 'sync' , 'retention_policy' , 'latest' ] ; const querystring = { } ; const userBody = params ?. body ; let body ; 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 ?? { } ; body [ key ] = params [ key ] ; } else if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } let method = '' ; let path = '' ; if ( params . transform_id != null ) { method = body != null ? 'POST' : 'GET' ; path = `/_transform/${ encodeURIComponent ( params . transform_id . toString ( ) ) }/_preview` ; } else { method = body != null ? 'POST' : 'GET' ; path = '/_transform/_preview' ; } return await this . transport . request ( { path , method , querystring , body } , options ) ; } async putTransform ( this , params , options ? ) ; async putTransform ( this , params , options ? ) ; async putTransform ( this , params , options ? ) ; async putTransform ( this , params , options ? ) { const acceptedPath = [ 'transform_id' ] ; const acceptedBody = [ 'dest' , 'description' , 'frequency' , 'latest' , '_meta' , 'pivot' , 'retention_policy' , 'settings' , 'source' , 'sync' ] ; const querystring = { } ; const userBody = params ?. body ; let body ; if ( typeof userBody === 'string' ) { body = userBody ; } else { body = userBody != null ? { ... userBody } : undefined ; } for ( const key in params ) { if ( acceptedBody . includes ( key ) ) { body = body ?? { } ; body [ key ] = params [ key ] ; } else if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'PUT' ; const path = `/_transform/${ encodeURIComponent ( params . transform_id . toString ( ) ) }` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async resetTransform ( this , params , options ? ) ; async resetTransform ( this , params , options ? ) ; async resetTransform ( this , params , options ? ) ; async resetTransform ( this , params , options ? ) { const acceptedPath = [ 'transform_id' ] ; const querystring = { } ; const body = undefined ; for ( const key in params ) { if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'POST' ; const path = `/_transform/${ encodeURIComponent ( params . transform_id . toString ( ) ) }/_reset` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async startTransform ( this , params , options ? ) ; async startTransform ( this , params , options ? ) ; async startTransform ( this , params , options ? ) ; async startTransform ( this , params , options ? ) { const acceptedPath = [ 'transform_id' ] ; const querystring = { } ; const body = undefined ; for ( const key in params ) { if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'POST' ; const path = `/_transform/${ encodeURIComponent ( params . transform_id . toString ( ) ) }/_start` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async stopTransform ( this , params , options ? ) ; async stopTransform ( this , params , options ? ) ; async stopTransform ( this , params , options ? ) ; async stopTransform ( this , params , options ? ) { const acceptedPath = [ 'transform_id' ] ; const querystring = { } ; const body = undefined ; for ( const key in params ) { if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'POST' ; const path = `/_transform/${ encodeURIComponent ( params . transform_id . toString ( ) ) }/_stop` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async updateTransform ( this , params , options ? ) ; async updateTransform ( this , params , options ? ) ; async updateTransform ( this , params , options ? ) ; async updateTransform ( this , params , options ? ) { const acceptedPath = [ 'transform_id' ] ; const acceptedBody = [ 'dest' , 'description' , 'frequency' , '_meta' , 'source' , 'settings' , 'sync' , 'retention_policy' ] ; const querystring = { } ; const userBody = params ?. body ; let body ; if ( typeof userBody === 'string' ) { body = userBody ; } else { body = userBody != null ? { ... userBody } : undefined ; } for ( const key in params ) { if ( acceptedBody . includes ( key ) ) { body = body ?? { } ; body [ key ] = params [ key ] ; } else if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'POST' ; const path = `/_transform/${ encodeURIComponent ( params . transform_id . toString ( ) ) }/_update` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async upgradeTransforms ( this , params ? , options ? ) ; async upgradeTransforms ( this , params ? , options ? ) ; async upgradeTransforms ( this , params ? , options ? ) ; async upgradeTransforms ( this , params ? , options ? ) { const acceptedPath = [ ] ; const querystring = { } ; 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 ) ; } }