@@ -330,32 +330,25 @@ export default class Indices {
330330 return await this . transport . request ( { path, method, querystring, body } , options )
331331 }
332332
333- async deleteDataLifecycle ( this : That , params ? : T . TODO | TB . TODO , options ?: TransportRequestOptionsWithOutMeta ) : Promise < T . TODO >
334- async deleteDataLifecycle ( this : That , params ? : T . TODO | TB . TODO , options ?: TransportRequestOptionsWithMeta ) : Promise < TransportResult < T . TODO , unknown > >
335- async deleteDataLifecycle ( this : That , params ? : T . TODO | TB . TODO , options ?: TransportRequestOptions ) : Promise < T . TODO >
336- async deleteDataLifecycle ( this : That , params ? : T . TODO | TB . TODO , options ?: TransportRequestOptions ) : Promise < any > {
333+ async deleteDataLifecycle ( this : That , params : T . IndicesDeleteDataLifecycleRequest | TB . IndicesDeleteDataLifecycleRequest , options ?: TransportRequestOptionsWithOutMeta ) : Promise < T . IndicesDeleteDataLifecycleResponse >
334+ async deleteDataLifecycle ( this : That , params : T . IndicesDeleteDataLifecycleRequest | TB . IndicesDeleteDataLifecycleRequest , options ?: TransportRequestOptionsWithMeta ) : Promise < TransportResult < T . IndicesDeleteDataLifecycleResponse , unknown > >
335+ async deleteDataLifecycle ( this : That , params : T . IndicesDeleteDataLifecycleRequest | TB . IndicesDeleteDataLifecycleRequest , options ?: TransportRequestOptions ) : Promise < T . IndicesDeleteDataLifecycleResponse >
336+ async deleteDataLifecycle ( this : That , params : T . IndicesDeleteDataLifecycleRequest | TB . IndicesDeleteDataLifecycleRequest , options ?: TransportRequestOptions ) : Promise < any > {
337337 const acceptedPath : string [ ] = [ 'name' ]
338338 const querystring : Record < string , any > = { }
339339 const body = undefined
340340
341- params = params ?? { }
342341 for ( const key in params ) {
343342 if ( acceptedPath . includes ( key ) ) {
344343 continue
345344 } else if ( key !== 'body' ) {
345+ // @ts -expect-error
346346 querystring [ key ] = params [ key ]
347347 }
348348 }
349349
350- let method = ''
351- let path = ''
352- if ( params . name != null ) {
353- method = 'DELETE'
354- path = `/_data_stream/${ encodeURIComponent ( params . name . toString ( ) ) } /_lifecycle`
355- } else {
356- method = 'DELETE'
357- path = '/_data_stream/_lifecycle'
358- }
350+ const method = 'DELETE'
351+ const path = `/_data_stream/${ encodeURIComponent ( params . name . toString ( ) ) } /_lifecycle`
359352 return await this . transport . request ( { path, method, querystring, body } , options )
360353 }
361354
@@ -569,24 +562,24 @@ export default class Indices {
569562 return await this . transport . request ( { path, method, querystring, body } , options )
570563 }
571564
572- async explainDataLifecycle ( this : That , params ? : T . TODO | TB . TODO , options ?: TransportRequestOptionsWithOutMeta ) : Promise < T . TODO >
573- async explainDataLifecycle ( this : That , params ? : T . TODO | TB . TODO , options ?: TransportRequestOptionsWithMeta ) : Promise < TransportResult < T . TODO , unknown > >
574- async explainDataLifecycle ( this : That , params ? : T . TODO | TB . TODO , options ?: TransportRequestOptions ) : Promise < T . TODO >
575- async explainDataLifecycle ( this : That , params ? : T . TODO | TB . TODO , options ?: TransportRequestOptions ) : Promise < any > {
565+ async explainDataLifecycle ( this : That , params : T . IndicesExplainDataLifecycleRequest | TB . IndicesExplainDataLifecycleRequest , options ?: TransportRequestOptionsWithOutMeta ) : Promise < T . IndicesExplainDataLifecycleResponse >
566+ async explainDataLifecycle ( this : That , params : T . IndicesExplainDataLifecycleRequest | TB . IndicesExplainDataLifecycleRequest , options ?: TransportRequestOptionsWithMeta ) : Promise < TransportResult < T . IndicesExplainDataLifecycleResponse , unknown > >
567+ async explainDataLifecycle ( this : That , params : T . IndicesExplainDataLifecycleRequest | TB . IndicesExplainDataLifecycleRequest , options ?: TransportRequestOptions ) : Promise < T . IndicesExplainDataLifecycleResponse >
568+ async explainDataLifecycle ( this : That , params : T . IndicesExplainDataLifecycleRequest | TB . IndicesExplainDataLifecycleRequest , options ?: TransportRequestOptions ) : Promise < any > {
576569 const acceptedPath : string [ ] = [ 'index' ]
577570 const querystring : Record < string , any > = { }
578571 const body = undefined
579572
580- params = params ?? { }
581573 for ( const key in params ) {
582574 if ( acceptedPath . includes ( key ) ) {
583575 continue
584576 } else if ( key !== 'body' ) {
577+ // @ts -expect-error
585578 querystring [ key ] = params [ key ]
586579 }
587580 }
588581
589- const method = 'POST '
582+ const method = 'GET '
590583 const path = `/${ encodeURIComponent ( params . index . toString ( ) ) } /_lifecycle/explain`
591584 return await this . transport . request ( { path, method, querystring, body } , options )
592585 }
@@ -731,32 +724,25 @@ export default class Indices {
731724 return await this . transport . request ( { path, method, querystring, body } , options )
732725 }
733726
734- async getDataLifecycle ( this : That , params ? : T . TODO | TB . TODO , options ?: TransportRequestOptionsWithOutMeta ) : Promise < T . TODO >
735- async getDataLifecycle ( this : That , params ? : T . TODO | TB . TODO , options ?: TransportRequestOptionsWithMeta ) : Promise < TransportResult < T . TODO , unknown > >
736- async getDataLifecycle ( this : That , params ? : T . TODO | TB . TODO , options ?: TransportRequestOptions ) : Promise < T . TODO >
737- async getDataLifecycle ( this : That , params ? : T . TODO | TB . TODO , options ?: TransportRequestOptions ) : Promise < any > {
727+ async getDataLifecycle ( this : That , params : T . IndicesGetDataLifecycleRequest | TB . IndicesGetDataLifecycleRequest , options ?: TransportRequestOptionsWithOutMeta ) : Promise < T . IndicesGetDataLifecycleResponse >
728+ async getDataLifecycle ( this : That , params : T . IndicesGetDataLifecycleRequest | TB . IndicesGetDataLifecycleRequest , options ?: TransportRequestOptionsWithMeta ) : Promise < TransportResult < T . IndicesGetDataLifecycleResponse , unknown > >
729+ async getDataLifecycle ( this : That , params : T . IndicesGetDataLifecycleRequest | TB . IndicesGetDataLifecycleRequest , options ?: TransportRequestOptions ) : Promise < T . IndicesGetDataLifecycleResponse >
730+ async getDataLifecycle ( this : That , params : T . IndicesGetDataLifecycleRequest | TB . IndicesGetDataLifecycleRequest , options ?: TransportRequestOptions ) : Promise < any > {
738731 const acceptedPath : string [ ] = [ 'name' ]
739732 const querystring : Record < string , any > = { }
740733 const body = undefined
741734
742- params = params ?? { }
743735 for ( const key in params ) {
744736 if ( acceptedPath . includes ( key ) ) {
745737 continue
746738 } else if ( key !== 'body' ) {
739+ // @ts -expect-error
747740 querystring [ key ] = params [ key ]
748741 }
749742 }
750743
751- let method = ''
752- let path = ''
753- if ( params . name != null ) {
754- method = 'GET'
755- path = `/_data_stream/${ encodeURIComponent ( params . name . toString ( ) ) } /_lifecycle`
756- } else {
757- method = 'GET'
758- path = '/_data_stream/_lifecycle'
759- }
744+ const method = 'GET'
745+ const path = `/_data_stream/${ encodeURIComponent ( params . name . toString ( ) ) } /_lifecycle`
760746 return await this . transport . request ( { path, method, querystring, body } , options )
761747 }
762748
@@ -1086,32 +1072,37 @@ export default class Indices {
10861072 return await this . transport . request ( { path, method, querystring, body } , options )
10871073 }
10881074
1089- async putDataLifecycle ( this : That , params ? : T . TODO | TB . TODO , options ?: TransportRequestOptionsWithOutMeta ) : Promise < T . TODO >
1090- async putDataLifecycle ( this : That , params ? : T . TODO | TB . TODO , options ?: TransportRequestOptionsWithMeta ) : Promise < TransportResult < T . TODO , unknown > >
1091- async putDataLifecycle ( this : That , params ? : T . TODO | TB . TODO , options ?: TransportRequestOptions ) : Promise < T . TODO >
1092- async putDataLifecycle ( this : That , params ? : T . TODO | TB . TODO , options ?: TransportRequestOptions ) : Promise < any > {
1075+ async putDataLifecycle ( this : That , params : T . IndicesPutDataLifecycleRequest | TB . IndicesPutDataLifecycleRequest , options ?: TransportRequestOptionsWithOutMeta ) : Promise < T . IndicesPutDataLifecycleResponse >
1076+ async putDataLifecycle ( this : That , params : T . IndicesPutDataLifecycleRequest | TB . IndicesPutDataLifecycleRequest , options ?: TransportRequestOptionsWithMeta ) : Promise < TransportResult < T . IndicesPutDataLifecycleResponse , unknown > >
1077+ async putDataLifecycle ( this : That , params : T . IndicesPutDataLifecycleRequest | TB . IndicesPutDataLifecycleRequest , options ?: TransportRequestOptions ) : Promise < T . IndicesPutDataLifecycleResponse >
1078+ async putDataLifecycle ( this : That , params : T . IndicesPutDataLifecycleRequest | TB . IndicesPutDataLifecycleRequest , options ?: TransportRequestOptions ) : Promise < any > {
10931079 const acceptedPath : string [ ] = [ 'name' ]
1080+ const acceptedBody : string [ ] = [ 'data_retention' ]
10941081 const querystring : Record < string , any > = { }
1095- const body = undefined
1082+ // @ts -expect-error
1083+ const userBody : any = params ?. body
1084+ let body : Record < string , any > | string
1085+ if ( typeof userBody === 'string' ) {
1086+ body = userBody
1087+ } else {
1088+ body = userBody != null ? { ...userBody } : undefined
1089+ }
10961090
1097- params = params ?? { }
10981091 for ( const key in params ) {
1099- if ( acceptedPath . includes ( key ) ) {
1092+ if ( acceptedBody . includes ( key ) ) {
1093+ body = body ?? { }
1094+ // @ts -expect-error
1095+ body [ key ] = params [ key ]
1096+ } else if ( acceptedPath . includes ( key ) ) {
11001097 continue
11011098 } else if ( key !== 'body' ) {
1099+ // @ts -expect-error
11021100 querystring [ key ] = params [ key ]
11031101 }
11041102 }
11051103
1106- let method = ''
1107- let path = ''
1108- if ( params . name != null ) {
1109- method = 'PUT'
1110- path = `/_data_stream/${ encodeURIComponent ( params . name . toString ( ) ) } /_lifecycle`
1111- } else {
1112- method = 'PUT'
1113- path = '/_data_stream/_lifecycle'
1114- }
1104+ const method = 'PUT'
1105+ const path = `/_data_stream/${ encodeURIComponent ( params . name . toString ( ) ) } /_lifecycle`
11151106 return await this . transport . request ( { path, method, querystring, body } , options )
11161107 }
11171108
0 commit comments