1111 */
1212/* tslint:disable:no-unused-variable member-ordering */
1313
14- import { HttpService , Inject , Injectable , Optional } from '@nestjs/common' ;
15- import { AxiosResponse } from 'axios' ;
14+ import { Inject , Injectable , Optional } from '@nestjs/common' ;
15+ import { HttpService } from '@nestjs/axios' ;
16+ import { AxiosResponse , AxiosRequestHeaders } from 'axios' ;
1617import { Observable } from 'rxjs' ;
1718import { ApiResponse } from '../model/apiResponse' ;
1819import { Pet } from '../model/pet' ;
1920import { Configuration } from '../configuration' ;
2021
21-
22+ type addPetParams = {
23+ pet : Pet ,
24+ }
25+ type deletePetParams = {
26+ petId : number ,
27+ apiKey ?: string ,
28+ }
29+ type findPetsByStatusParams = {
30+ status : Array < 'available' | 'pending' | 'sold' > ,
31+ }
32+ type findPetsByTagsParams = {
33+ tags : Array < string > ,
34+ }
35+ type getPetByIdParams = {
36+ petId : number ,
37+ }
38+ type updatePetParams = {
39+ pet : Pet ,
40+ }
41+ type updatePetWithFormParams = {
42+ petId : number ,
43+ name ?: string ,
44+ status ?: string ,
45+ }
46+ type uploadFileParams = {
47+ petId : number ,
48+ additionalMetadata ?: string ,
49+ file ?: Blob ,
50+ }
2251@Injectable ( )
2352export class PetService {
2453
2554 protected basePath = 'http://petstore.swagger.io/v2' ;
26- public defaultHeaders = new Map ( )
55+ public defaultHeaders : Record < string , string > = { } ;
2756 public configuration = new Configuration ( ) ;
2857
2958 constructor ( protected httpClient : HttpService , @Optional ( ) configuration : Configuration ) {
@@ -43,15 +72,15 @@ export class PetService {
4372 /**
4473 * Add a new pet to the store
4574 *
46- * @param pet Pet object that needs to be added to the store
75+ * @param addPetParams
4776 * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
4877 * @param reportProgress flag to report request and response progress.
4978 */
50- public addPet ( pet : Pet , ) : Observable < AxiosResponse < Pet > > ;
51- public addPet ( pet : Pet , ) : Observable < any > {
79+ public addPet ( params : addPetParams ) : Observable < AxiosResponse < Pet > > ;
80+ public addPet ( params : addPetParams ) : Observable < any > {
5281
53- if ( pet === null || pet === undefined ) {
54- throw new Error ( 'Required parameter pet was null or undefined when calling addPet.' ) ;
82+ if ( params . pet === null || params . pet === undefined ) {
83+ throw new Error ( 'Required parameter params. pet was null or undefined when calling addPet.' ) ;
5584 }
5685
5786 let headers = this . defaultHeaders ;
@@ -84,7 +113,7 @@ export class PetService {
84113 headers [ 'Content-Type' ] = httpContentTypeSelected ;
85114 }
86115 return this . httpClient . post < Pet > ( `${ this . basePath } /pet` ,
87- pet ,
116+ params . pet ,
88117 {
89118 withCredentials : this . configuration . withCredentials ,
90119 headers : headers
@@ -94,22 +123,21 @@ export class PetService {
94123 /**
95124 * Deletes a pet
96125 *
97- * @param petId Pet id to delete
98- * @param apiKey
126+ * @param deletePetParams
99127 * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
100128 * @param reportProgress flag to report request and response progress.
101129 */
102- public deletePet ( petId : number , apiKey ?: string , ) : Observable < AxiosResponse < any > > ;
103- public deletePet ( petId : number , apiKey ?: string , ) : Observable < any > {
130+ public deletePet ( params : deletePetParams ) : Observable < AxiosResponse < any > > ;
131+ public deletePet ( params : deletePetParams ) : Observable < any > {
104132
105- if ( petId === null || petId === undefined ) {
106- throw new Error ( 'Required parameter petId was null or undefined when calling deletePet.' ) ;
133+ if ( params . petId === null || params . petId === undefined ) {
134+ throw new Error ( 'Required parameter params. petId was null or undefined when calling deletePet.' ) ;
107135 }
108136
109137
110138 let headers = this . defaultHeaders ;
111- if ( apiKey !== undefined && apiKey !== null ) {
112- headers [ 'api_key' ] = String ( apiKey ) ;
139+ if ( params . apiKey !== undefined && params . apiKey !== null ) {
140+ headers [ 'api_key' ] = String ( params . apiKey ) ;
113141 }
114142
115143 // authentication (petstore_auth) required
@@ -131,7 +159,7 @@ export class PetService {
131159 // to determine the Content-Type header
132160 const consumes : string [ ] = [
133161 ] ;
134- return this . httpClient . delete < any > ( `${ this . basePath } /pet/${ encodeURIComponent ( String ( petId ) ) } ` ,
162+ return this . httpClient . delete < any > ( `${ this . basePath } /pet/${ encodeURIComponent ( String ( params . petId ) ) } ` ,
135163 {
136164 withCredentials : this . configuration . withCredentials ,
137165 headers : headers
@@ -141,20 +169,20 @@ export class PetService {
141169 /**
142170 * Finds Pets by status
143171 * Multiple status values can be provided with comma separated strings
144- * @param status Status values that need to be considered for filter
172+ * @param findPetsByStatusParams
145173 * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
146174 * @param reportProgress flag to report request and response progress.
147175 */
148- public findPetsByStatus ( status : Array < 'available' | 'pending' | 'sold' > , ) : Observable < AxiosResponse < Array < Pet > > > ;
149- public findPetsByStatus ( status : Array < 'available' | 'pending' | 'sold' > , ) : Observable < any > {
176+ public findPetsByStatus ( params : findPetsByStatusParams ) : Observable < AxiosResponse < Array < Pet > > > ;
177+ public findPetsByStatus ( params : findPetsByStatusParams ) : Observable < any > {
150178
151- if ( status === null || status === undefined ) {
152- throw new Error ( 'Required parameter status was null or undefined when calling findPetsByStatus.' ) ;
179+ if ( params . status === null || params . status === undefined ) {
180+ throw new Error ( 'Required parameter params. status was null or undefined when calling findPetsByStatus.' ) ;
153181 }
154182
155183 let queryParameters = { } ;
156- if ( status !== undefined && status !== null ) {
157- queryParameters [ 'status' ] = < any > status ;
184+ if ( params . status !== undefined && params . status !== null ) {
185+ queryParameters [ 'status' ] = < any > params . status ;
158186 }
159187
160188 let headers = this . defaultHeaders ;
@@ -191,20 +219,20 @@ export class PetService {
191219 /**
192220 * Finds Pets by tags
193221 * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
194- * @param tags Tags to filter by
222+ * @param findPetsByTagsParams
195223 * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
196224 * @param reportProgress flag to report request and response progress.
197225 */
198- public findPetsByTags ( tags : Array < string > , ) : Observable < AxiosResponse < Array < Pet > > > ;
199- public findPetsByTags ( tags : Array < string > , ) : Observable < any > {
226+ public findPetsByTags ( params : findPetsByTagsParams ) : Observable < AxiosResponse < Array < Pet > > > ;
227+ public findPetsByTags ( params : findPetsByTagsParams ) : Observable < any > {
200228
201- if ( tags === null || tags === undefined ) {
202- throw new Error ( 'Required parameter tags was null or undefined when calling findPetsByTags.' ) ;
229+ if ( params . tags === null || params . tags === undefined ) {
230+ throw new Error ( 'Required parameter params. tags was null or undefined when calling findPetsByTags.' ) ;
203231 }
204232
205233 let queryParameters = { } ;
206- if ( tags !== undefined && tags !== null ) {
207- queryParameters [ 'tags' ] = < any > tags ;
234+ if ( params . tags !== undefined && params . tags !== null ) {
235+ queryParameters [ 'tags' ] = < any > params . tags ;
208236 }
209237
210238 let headers = this . defaultHeaders ;
@@ -241,15 +269,15 @@ export class PetService {
241269 /**
242270 * Find pet by ID
243271 * Returns a single pet
244- * @param petId ID of pet to return
272+ * @param getPetByIdParams
245273 * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
246274 * @param reportProgress flag to report request and response progress.
247275 */
248- public getPetById ( petId : number , ) : Observable < AxiosResponse < Pet > > ;
249- public getPetById ( petId : number , ) : Observable < any > {
276+ public getPetById ( params : getPetByIdParams ) : Observable < AxiosResponse < Pet > > ;
277+ public getPetById ( params : getPetByIdParams ) : Observable < any > {
250278
251- if ( petId === null || petId === undefined ) {
252- throw new Error ( 'Required parameter petId was null or undefined when calling getPetById.' ) ;
279+ if ( params . petId === null || params . petId === undefined ) {
280+ throw new Error ( 'Required parameter params. petId was null or undefined when calling getPetById.' ) ;
253281 }
254282
255283 let headers = this . defaultHeaders ;
@@ -272,7 +300,7 @@ export class PetService {
272300 // to determine the Content-Type header
273301 const consumes : string [ ] = [
274302 ] ;
275- return this . httpClient . get < Pet > ( `${ this . basePath } /pet/${ encodeURIComponent ( String ( petId ) ) } ` ,
303+ return this . httpClient . get < Pet > ( `${ this . basePath } /pet/${ encodeURIComponent ( String ( params . petId ) ) } ` ,
276304 {
277305 withCredentials : this . configuration . withCredentials ,
278306 headers : headers
@@ -282,15 +310,15 @@ export class PetService {
282310 /**
283311 * Update an existing pet
284312 *
285- * @param pet Pet object that needs to be added to the store
313+ * @param updatePetParams
286314 * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
287315 * @param reportProgress flag to report request and response progress.
288316 */
289- public updatePet ( pet : Pet , ) : Observable < AxiosResponse < Pet > > ;
290- public updatePet ( pet : Pet , ) : Observable < any > {
317+ public updatePet ( params : updatePetParams ) : Observable < AxiosResponse < Pet > > ;
318+ public updatePet ( params : updatePetParams ) : Observable < any > {
291319
292- if ( pet === null || pet === undefined ) {
293- throw new Error ( 'Required parameter pet was null or undefined when calling updatePet.' ) ;
320+ if ( params . pet === null || params . pet === undefined ) {
321+ throw new Error ( 'Required parameter params. pet was null or undefined when calling updatePet.' ) ;
294322 }
295323
296324 let headers = this . defaultHeaders ;
@@ -323,7 +351,7 @@ export class PetService {
323351 headers [ 'Content-Type' ] = httpContentTypeSelected ;
324352 }
325353 return this . httpClient . put < Pet > ( `${ this . basePath } /pet` ,
326- pet ,
354+ params . pet ,
327355 {
328356 withCredentials : this . configuration . withCredentials ,
329357 headers : headers
@@ -333,17 +361,15 @@ export class PetService {
333361 /**
334362 * Updates a pet in the store with form data
335363 *
336- * @param petId ID of pet that needs to be updated
337- * @param name Updated name of the pet
338- * @param status Updated status of the pet
364+ * @param updatePetWithFormParams
339365 * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
340366 * @param reportProgress flag to report request and response progress.
341367 */
342- public updatePetWithForm ( petId : number , name ?: string , status ?: string , ) : Observable < AxiosResponse < any > > ;
343- public updatePetWithForm ( petId : number , name ?: string , status ?: string , ) : Observable < any > {
368+ public updatePetWithForm ( params : updatePetWithFormParams ) : Observable < AxiosResponse < any > > ;
369+ public updatePetWithForm ( params : updatePetWithFormParams ) : Observable < any > {
344370
345- if ( petId === null || petId === undefined ) {
346- throw new Error ( 'Required parameter petId was null or undefined when calling updatePetWithForm.' ) ;
371+ if ( params . petId === null || params . petId === undefined ) {
372+ throw new Error ( 'Required parameter params. petId was null or undefined when calling updatePetWithForm.' ) ;
347373 }
348374
349375
@@ -382,15 +408,15 @@ export class PetService {
382408 // formParams = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()});
383409 }
384410
385- if ( name !== undefined ) {
386- formParams . append ( 'name' , < any > name ) ;
411+ if ( params . name !== undefined ) {
412+ formParams . append ( 'name' , < any > params . name ) ;
387413 }
388414
389- if ( status !== undefined ) {
390- formParams . append ( 'status' , < any > status ) ;
415+ if ( params . status !== undefined ) {
416+ formParams . append ( 'status' , < any > params . status ) ;
391417 }
392418
393- return this . httpClient . post < any > ( `${ this . basePath } /pet/${ encodeURIComponent ( String ( petId ) ) } ` ,
419+ return this . httpClient . post < any > ( `${ this . basePath } /pet/${ encodeURIComponent ( String ( params . petId ) ) } ` ,
394420 convertFormParamsToString ? formParams . toString ( ) : formParams ,
395421 {
396422 withCredentials : this . configuration . withCredentials ,
@@ -401,17 +427,15 @@ export class PetService {
401427 /**
402428 * uploads an image
403429 *
404- * @param petId ID of pet to update
405- * @param additionalMetadata Additional data to pass to server
406- * @param file file to upload
430+ * @param uploadFileParams
407431 * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
408432 * @param reportProgress flag to report request and response progress.
409433 */
410- public uploadFile ( petId : number , additionalMetadata ?: string , file ?: Blob , ) : Observable < AxiosResponse < ApiResponse > > ;
411- public uploadFile ( petId : number , additionalMetadata ?: string , file ?: Blob , ) : Observable < any > {
434+ public uploadFile ( params : uploadFileParams ) : Observable < AxiosResponse < ApiResponse > > ;
435+ public uploadFile ( params : uploadFileParams ) : Observable < any > {
412436
413- if ( petId === null || petId === undefined ) {
414- throw new Error ( 'Required parameter petId was null or undefined when calling uploadFile.' ) ;
437+ if ( params . petId === null || params . petId === undefined ) {
438+ throw new Error ( 'Required parameter params. petId was null or undefined when calling uploadFile.' ) ;
415439 }
416440
417441
@@ -455,15 +479,15 @@ export class PetService {
455479 // formParams = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()});
456480 }
457481
458- if ( additionalMetadata !== undefined ) {
459- formParams . append ( 'additionalMetadata' , < any > additionalMetadata ) ;
482+ if ( params . additionalMetadata !== undefined ) {
483+ formParams . append ( 'additionalMetadata' , < any > params . additionalMetadata ) ;
460484 }
461485
462- if ( file !== undefined ) {
463- formParams . append ( 'file' , < any > file ) ;
486+ if ( params . file !== undefined ) {
487+ formParams . append ( 'file' , < any > params . file ) ;
464488 }
465489
466- return this . httpClient . post < ApiResponse > ( `${ this . basePath } /pet/${ encodeURIComponent ( String ( petId ) ) } /uploadImage` ,
490+ return this . httpClient . post < ApiResponse > ( `${ this . basePath } /pet/${ encodeURIComponent ( String ( params . petId ) ) } /uploadImage` ,
467491 convertFormParamsToString ? formParams . toString ( ) : formParams ,
468492 {
469493 withCredentials : this . configuration . withCredentials ,
0 commit comments