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 SearchableSnapshots { transport : Transport ; constructor ( transport ) { this . transport = transport ; } async cacheStats ( this , params ? , options ? ) ; async cacheStats ( this , params ? , options ? ) ; async cacheStats ( this , params ? , options ? ) ; async cacheStats ( this , params ? , options ? ) { const acceptedPath = [ 'node_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 . node_id != null ) { method = 'GET' ; path = `/_searchable_snapshots/${ encodeURIComponent ( params . node_id . toString ( ) ) }/cache/stats` ; } else { method = 'GET' ; path = '/_searchable_snapshots/cache/stats' ; } return await this . transport . request ( { path , method , querystring , body } , options ) ; } async clearCache ( this , params ? , options ? ) ; async clearCache ( this , params ? , options ? ) ; async clearCache ( this , params ? , options ? ) ; async clearCache ( this , params ? , options ? ) { const acceptedPath = [ 'index' ] ; 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 . index != null ) { method = 'POST' ; path = `/${ encodeURIComponent ( params . index . toString ( ) ) }/_searchable_snapshots/cache/clear` ; } else { method = 'POST' ; path = '/_searchable_snapshots/cache/clear' ; } return await this . transport . request ( { path , method , querystring , body } , options ) ; } async mount ( this , params , options ? ) ; async mount ( this , params , options ? ) ; async mount ( this , params , options ? ) ; async mount ( this , params , options ? ) { const acceptedPath = [ 'repository' , 'snapshot' ] ; const acceptedBody = [ 'index' , 'renamed_index' , 'index_settings' , 'ignore_index_settings' ] ; 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 = `/_snapshot/${ encodeURIComponent ( params . repository . toString ( ) ) }/${ encodeURIComponent ( params . snapshot . toString ( ) ) }/_mount` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async stats ( this , params ? , options ? ) ; async stats ( this , params ? , options ? ) ; async stats ( this , params ? , options ? ) ; async stats ( this , params ? , options ? ) { const acceptedPath = [ 'index' ] ; 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 . index != null ) { method = 'GET' ; path = `/${ encodeURIComponent ( params . index . toString ( ) ) }/_searchable_snapshots/stats` ; } else { method = 'GET' ; path = '/_searchable_snapshots/stats' ; } return await this . transport . request ( { path , method , querystring , body } , options ) ; } }