@@ -280,7 +280,11 @@ export class Tunings extends BaseModule {
280280 * await ai.tunings.cancel({name: '...'}); // The server-generated resource name.
281281 * ```
282282 */
283- async cancel ( params : types . CancelTuningJobParameters ) : Promise < void > {
283+ async cancel (
284+ params : types . CancelTuningJobParameters ,
285+ ) : Promise < types . CancelTuningJobResponse > {
286+ let response : Promise < types . CancelTuningJobResponse > ;
287+
284288 let path : string = '' ;
285289 let queryParams : Record < string , string > = { } ;
286290 if ( this . apiClient . isVertexAI ( ) ) {
@@ -293,13 +297,30 @@ export class Tunings extends BaseModule {
293297 delete body [ '_url' ] ;
294298 delete body [ '_query' ] ;
295299
296- await this . apiClient . request ( {
297- path : path ,
298- queryParams : queryParams ,
299- body : JSON . stringify ( body ) ,
300- httpMethod : 'POST' ,
301- httpOptions : params . config ?. httpOptions ,
302- abortSignal : params . config ?. abortSignal ,
300+ response = this . apiClient
301+ . request ( {
302+ path : path ,
303+ queryParams : queryParams ,
304+ body : JSON . stringify ( body ) ,
305+ httpMethod : 'POST' ,
306+ httpOptions : params . config ?. httpOptions ,
307+ abortSignal : params . config ?. abortSignal ,
308+ } )
309+ . then ( ( httpResponse ) => {
310+ return httpResponse . json ( ) . then ( ( jsonResponse ) => {
311+ const response = jsonResponse as types . CancelTuningJobResponse ;
312+ response . sdkHttpResponse = {
313+ headers : httpResponse . headers ,
314+ } as types . HttpResponse ;
315+ return response ;
316+ } ) ;
317+ } ) as Promise < types . CancelTuningJobResponse > ;
318+
319+ return response . then ( ( apiResponse ) => {
320+ const resp = converters . cancelTuningJobResponseFromVertex ( apiResponse ) ;
321+ const typedResp = new types . CancelTuningJobResponse ( ) ;
322+ Object . assign ( typedResp , resp ) ;
323+ return typedResp ;
303324 } ) ;
304325 } else {
305326 const body = converters . cancelTuningJobParametersToMldev ( params , params ) ;
@@ -311,13 +332,30 @@ export class Tunings extends BaseModule {
311332 delete body [ '_url' ] ;
312333 delete body [ '_query' ] ;
313334
314- await this . apiClient . request ( {
315- path : path ,
316- queryParams : queryParams ,
317- body : JSON . stringify ( body ) ,
318- httpMethod : 'POST' ,
319- httpOptions : params . config ?. httpOptions ,
320- abortSignal : params . config ?. abortSignal ,
335+ response = this . apiClient
336+ . request ( {
337+ path : path ,
338+ queryParams : queryParams ,
339+ body : JSON . stringify ( body ) ,
340+ httpMethod : 'POST' ,
341+ httpOptions : params . config ?. httpOptions ,
342+ abortSignal : params . config ?. abortSignal ,
343+ } )
344+ . then ( ( httpResponse ) => {
345+ return httpResponse . json ( ) . then ( ( jsonResponse ) => {
346+ const response = jsonResponse as types . CancelTuningJobResponse ;
347+ response . sdkHttpResponse = {
348+ headers : httpResponse . headers ,
349+ } as types . HttpResponse ;
350+ return response ;
351+ } ) ;
352+ } ) as Promise < types . CancelTuningJobResponse > ;
353+
354+ return response . then ( ( apiResponse ) => {
355+ const resp = converters . cancelTuningJobResponseFromMldev ( apiResponse ) ;
356+ const typedResp = new types . CancelTuningJobResponse ( ) ;
357+ Object . assign ( typedResp , resp ) ;
358+ return typedResp ;
321359 } ) ;
322360 }
323361 }
0 commit comments