@@ -53,16 +53,20 @@ export class ApiEndpoints {
5353 const contentType : string = httpRes ?. headers ?. [ "content-type" ] ?? "" ;
5454
5555 if ( httpRes ?. status == null ) throw new Error ( `status code not found in response: ${ httpRes } ` ) ;
56- const res : operations . DeleteApiEndpointResponse = { statusCode : httpRes . status , contentType : contentType , rawResponse : httpRes } ;
56+ const res : operations . DeleteApiEndpointResponse =
57+ new operations . DeleteApiEndpointResponse ( {
58+ statusCode : httpRes . status ,
59+ contentType : contentType ,
60+ rawResponse : httpRes
61+ } ) ;
5762 switch ( true ) {
5863 case httpRes ?. status == 200 :
5964 break ;
6065 default :
6166 if ( utils . matchContentType ( contentType , `application/json` ) ) {
62- res . error = plainToInstance (
67+ res . error = utils . deserializeJSONResponse (
68+ httpRes ?. data ,
6369 shared . ErrorT ,
64- httpRes ?. data as shared . ErrorT ,
65- { excludeExtraneousValues : true }
6670 ) ;
6771 }
6872 break ;
@@ -106,23 +110,26 @@ export class ApiEndpoints {
106110 const contentType : string = httpRes ?. headers ?. [ "content-type" ] ?? "" ;
107111
108112 if ( httpRes ?. status == null ) throw new Error ( `status code not found in response: ${ httpRes } ` ) ;
109- const res : operations . FindApiEndpointResponse = { statusCode : httpRes . status , contentType : contentType , rawResponse : httpRes } ;
113+ const res : operations . FindApiEndpointResponse =
114+ new operations . FindApiEndpointResponse ( {
115+ statusCode : httpRes . status ,
116+ contentType : contentType ,
117+ rawResponse : httpRes
118+ } ) ;
110119 switch ( true ) {
111120 case httpRes ?. status == 200 :
112121 if ( utils . matchContentType ( contentType , `application/json` ) ) {
113- res . apiEndpoint = plainToInstance (
122+ res . apiEndpoint = utils . deserializeJSONResponse (
123+ httpRes ?. data ,
114124 shared . ApiEndpoint ,
115- httpRes ?. data as shared . ApiEndpoint ,
116- { excludeExtraneousValues : true }
117125 ) ;
118126 }
119127 break ;
120128 default :
121129 if ( utils . matchContentType ( contentType , `application/json` ) ) {
122- res . error = plainToInstance (
130+ res . error = utils . deserializeJSONResponse (
131+ httpRes ?. data ,
123132 shared . ErrorT ,
124- httpRes ?. data as shared . ErrorT ,
125- { excludeExtraneousValues : true }
126133 ) ;
127134 }
128135 break ;
@@ -166,23 +173,26 @@ export class ApiEndpoints {
166173 const contentType : string = httpRes ?. headers ?. [ "content-type" ] ?? "" ;
167174
168175 if ( httpRes ?. status == null ) throw new Error ( `status code not found in response: ${ httpRes } ` ) ;
169- const res : operations . GenerateOpenApiSpecForApiEndpointResponse = { statusCode : httpRes . status , contentType : contentType , rawResponse : httpRes } ;
176+ const res : operations . GenerateOpenApiSpecForApiEndpointResponse =
177+ new operations . GenerateOpenApiSpecForApiEndpointResponse ( {
178+ statusCode : httpRes . status ,
179+ contentType : contentType ,
180+ rawResponse : httpRes
181+ } ) ;
170182 switch ( true ) {
171183 case httpRes ?. status == 200 :
172184 if ( utils . matchContentType ( contentType , `application/json` ) ) {
173- res . generateOpenApiSpecDiff = plainToInstance (
185+ res . generateOpenApiSpecDiff = utils . deserializeJSONResponse (
186+ httpRes ?. data ,
174187 shared . GenerateOpenApiSpecDiff ,
175- httpRes ?. data as shared . GenerateOpenApiSpecDiff ,
176- { excludeExtraneousValues : true }
177188 ) ;
178189 }
179190 break ;
180191 default :
181192 if ( utils . matchContentType ( contentType , `application/json` ) ) {
182- res . error = plainToInstance (
193+ res . error = utils . deserializeJSONResponse (
194+ httpRes ?. data ,
183195 shared . ErrorT ,
184- httpRes ?. data as shared . ErrorT ,
185- { excludeExtraneousValues : true }
186196 ) ;
187197 }
188198 break ;
@@ -225,7 +235,12 @@ export class ApiEndpoints {
225235 const contentType : string = httpRes ?. headers ?. [ "content-type" ] ?? "" ;
226236
227237 if ( httpRes ?. status == null ) throw new Error ( `status code not found in response: ${ httpRes } ` ) ;
228- const res : operations . GeneratePostmanCollectionForApiEndpointResponse = { statusCode : httpRes . status , contentType : contentType , rawResponse : httpRes } ;
238+ const res : operations . GeneratePostmanCollectionForApiEndpointResponse =
239+ new operations . GeneratePostmanCollectionForApiEndpointResponse ( {
240+ statusCode : httpRes . status ,
241+ contentType : contentType ,
242+ rawResponse : httpRes
243+ } ) ;
229244 switch ( true ) {
230245 case httpRes ?. status == 200 :
231246 if ( utils . matchContentType ( contentType , `application/octet-stream` ) ) {
@@ -237,10 +252,9 @@ export class ApiEndpoints {
237252 break ;
238253 default :
239254 if ( utils . matchContentType ( contentType , `application/json` ) ) {
240- res . error = plainToInstance (
255+ res . error = utils . deserializeJSONResponse (
256+ httpRes ?. data ,
241257 shared . ErrorT ,
242- httpRes ?. data as shared . ErrorT ,
243- { excludeExtraneousValues : true }
244258 ) ;
245259 }
246260 break ;
@@ -281,19 +295,29 @@ export class ApiEndpoints {
281295 const contentType : string = httpRes ?. headers ?. [ "content-type" ] ?? "" ;
282296
283297 if ( httpRes ?. status == null ) throw new Error ( `status code not found in response: ${ httpRes } ` ) ;
284- const res : operations . GetAllApiEndpointsResponse = { statusCode : httpRes . status , contentType : contentType , rawResponse : httpRes } ;
298+ const res : operations . GetAllApiEndpointsResponse =
299+ new operations . GetAllApiEndpointsResponse ( {
300+ statusCode : httpRes . status ,
301+ contentType : contentType ,
302+ rawResponse : httpRes
303+ } ) ;
285304 switch ( true ) {
286305 case httpRes ?. status == 200 :
287306 if ( utils . matchContentType ( contentType , `application/json` ) ) {
288- res . apiEndpoints = httpRes ?. data ;
307+ res . apiEndpoints = [ ] ;
308+ const resFieldDepth : number = utils . getResFieldDepth ( res ) ;
309+ res . apiEndpoints = utils . deserializeJSONResponse (
310+ httpRes ?. data ,
311+ shared . ApiEndpoint ,
312+ resFieldDepth
313+ ) ;
289314 }
290315 break ;
291316 default :
292317 if ( utils . matchContentType ( contentType , `application/json` ) ) {
293- res . error = plainToInstance (
318+ res . error = utils . deserializeJSONResponse (
319+ httpRes ?. data ,
294320 shared . ErrorT ,
295- httpRes ?. data as shared . ErrorT ,
296- { excludeExtraneousValues : true }
297321 ) ;
298322 }
299323 break ;
@@ -334,19 +358,29 @@ export class ApiEndpoints {
334358 const contentType : string = httpRes ?. headers ?. [ "content-type" ] ?? "" ;
335359
336360 if ( httpRes ?. status == null ) throw new Error ( `status code not found in response: ${ httpRes } ` ) ;
337- const res : operations . GetAllForVersionApiEndpointsResponse = { statusCode : httpRes . status , contentType : contentType , rawResponse : httpRes } ;
361+ const res : operations . GetAllForVersionApiEndpointsResponse =
362+ new operations . GetAllForVersionApiEndpointsResponse ( {
363+ statusCode : httpRes . status ,
364+ contentType : contentType ,
365+ rawResponse : httpRes
366+ } ) ;
338367 switch ( true ) {
339368 case httpRes ?. status == 200 :
340369 if ( utils . matchContentType ( contentType , `application/json` ) ) {
341- res . apiEndpoints = httpRes ?. data ;
370+ res . apiEndpoints = [ ] ;
371+ const resFieldDepth : number = utils . getResFieldDepth ( res ) ;
372+ res . apiEndpoints = utils . deserializeJSONResponse (
373+ httpRes ?. data ,
374+ shared . ApiEndpoint ,
375+ resFieldDepth
376+ ) ;
342377 }
343378 break ;
344379 default :
345380 if ( utils . matchContentType ( contentType , `application/json` ) ) {
346- res . error = plainToInstance (
381+ res . error = utils . deserializeJSONResponse (
382+ httpRes ?. data ,
347383 shared . ErrorT ,
348- httpRes ?. data as shared . ErrorT ,
349- { excludeExtraneousValues : true }
350384 ) ;
351385 }
352386 break ;
@@ -387,23 +421,26 @@ export class ApiEndpoints {
387421 const contentType : string = httpRes ?. headers ?. [ "content-type" ] ?? "" ;
388422
389423 if ( httpRes ?. status == null ) throw new Error ( `status code not found in response: ${ httpRes } ` ) ;
390- const res : operations . GetApiEndpointResponse = { statusCode : httpRes . status , contentType : contentType , rawResponse : httpRes } ;
424+ const res : operations . GetApiEndpointResponse =
425+ new operations . GetApiEndpointResponse ( {
426+ statusCode : httpRes . status ,
427+ contentType : contentType ,
428+ rawResponse : httpRes
429+ } ) ;
391430 switch ( true ) {
392431 case httpRes ?. status == 200 :
393432 if ( utils . matchContentType ( contentType , `application/json` ) ) {
394- res . apiEndpoint = plainToInstance (
433+ res . apiEndpoint = utils . deserializeJSONResponse (
434+ httpRes ?. data ,
395435 shared . ApiEndpoint ,
396- httpRes ?. data as shared . ApiEndpoint ,
397- { excludeExtraneousValues : true }
398436 ) ;
399437 }
400438 break ;
401439 default :
402440 if ( utils . matchContentType ( contentType , `application/json` ) ) {
403- res . error = plainToInstance (
441+ res . error = utils . deserializeJSONResponse (
442+ httpRes ?. data ,
404443 shared . ErrorT ,
405- httpRes ?. data as shared . ErrorT ,
406- { excludeExtraneousValues : true }
407444 ) ;
408445 }
409446 break ;
@@ -458,23 +495,26 @@ export class ApiEndpoints {
458495 const contentType : string = httpRes ?. headers ?. [ "content-type" ] ?? "" ;
459496
460497 if ( httpRes ?. status == null ) throw new Error ( `status code not found in response: ${ httpRes } ` ) ;
461- const res : operations . UpsertApiEndpointResponse = { statusCode : httpRes . status , contentType : contentType , rawResponse : httpRes } ;
498+ const res : operations . UpsertApiEndpointResponse =
499+ new operations . UpsertApiEndpointResponse ( {
500+ statusCode : httpRes . status ,
501+ contentType : contentType ,
502+ rawResponse : httpRes
503+ } ) ;
462504 switch ( true ) {
463505 case httpRes ?. status == 200 :
464506 if ( utils . matchContentType ( contentType , `application/json` ) ) {
465- res . apiEndpoint = plainToInstance (
507+ res . apiEndpoint = utils . deserializeJSONResponse (
508+ httpRes ?. data ,
466509 shared . ApiEndpoint ,
467- httpRes ?. data as shared . ApiEndpoint ,
468- { excludeExtraneousValues : true }
469510 ) ;
470511 }
471512 break ;
472513 default :
473514 if ( utils . matchContentType ( contentType , `application/json` ) ) {
474- res . error = plainToInstance (
515+ res . error = utils . deserializeJSONResponse (
516+ httpRes ?. data ,
475517 shared . ErrorT ,
476- httpRes ?. data as shared . ErrorT ,
477- { excludeExtraneousValues : true }
478518 ) ;
479519 }
480520 break ;
0 commit comments