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 async function SearchMvtApi ( this , params , options ? ) ; export default async function SearchMvtApi ( this , params , options ? ) ; export default async function SearchMvtApi ( this , params , options ? ) ; export default async function SearchMvtApi ( this , params , options ? ) { const acceptedPath = [ 'index' , 'field' , 'zoom' , 'x' , 'y' ] ; const acceptedBody = [ 'aggs' , 'exact_bounds' , 'extent' , 'fields' , 'grid_precision' , 'grid_type' , 'query' , 'runtime_mappings' , 'size' , 'sort' , 'track_total_hits' ] ; 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 = body != null ? 'POST' : 'GET' ; const path = `/${ encodeURIComponent ( params . index . toString ( ) ) }/_mvt/${ encodeURIComponent ( params . field . toString ( ) ) }/${ encodeURIComponent ( params . zoom . toString ( ) ) }/${ encodeURIComponent ( params . x . toString ( ) ) }/${ encodeURIComponent ( params . y . toString ( ) ) }` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; }