Skip to content

Commit a1e86e2

Browse files
committed
refactor: change options parameter
1 parent 11ca862 commit a1e86e2

File tree

7 files changed

+207
-207
lines changed

7 files changed

+207
-207
lines changed

modules/openapi-generator/src/main/resources/typescript-nestjs/api.service.mustache

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,15 @@ export class {{classname}} {
9393
{{/allParams}}* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
9494
* @param reportProgress flag to report request and response progress.
9595
{{/useSingleRequestParameter}}
96-
* @param {*} [options] Override http request option.
96+
* @param {*} [{{nickname}}RequestConfig.options] Override http request option.
9797
*/
9898
{{#useSingleRequestParameter}}
99-
public {{nickname}}({{#allParams.0}}requestParameters: {{classname}}{{operationIdCamelCase}}Request, {{/allParams.0}}options?: AxiosRequestConfig): Observable<AxiosResponse<{{#returnType}}{{{returnType}}}{{#isResponseTypeFile}}|undefined{{/isResponseTypeFile}}{{/returnType}}{{^returnType}}any{{/returnType}}>>;
100-
public {{nickname}}({{#allParams.0}}requestParameters: {{classname}}{{operationIdCamelCase}}Request, {{/allParams.0}}options?: AxiosRequestConfig): Observable<any> {
99+
public {{nickname}}({{#allParams.0}}requestParameters: {{classname}}{{operationIdCamelCase}}Request, {{/allParams.0}}{{nickname}}RequestConfig?: { options?: AxiosRequestConfig }): Observable<AxiosResponse<{{#returnType}}{{{returnType}}}{{#isResponseTypeFile}}|undefined{{/isResponseTypeFile}}{{/returnType}}{{^returnType}}any{{/returnType}}>>;
100+
public {{nickname}}({{#allParams.0}}requestParameters: {{classname}}{{operationIdCamelCase}}Request, {{/allParams.0}}{{nickname}}RequestConfig?: { options?: AxiosRequestConfig }): Observable<any> {
101101
{{/useSingleRequestParameter}}
102102
{{^useSingleRequestParameter}}
103-
public {{nickname}}({{#allParams}}{{^isConstEnumParam}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/isConstEnumParam}}{{/allParams}}options?: AxiosRequestConfig): Observable<AxiosResponse<{{#returnType}}{{{returnType}}}{{#isResponseTypeFile}}|undefined{{/isResponseTypeFile}}{{/returnType}}{{^returnType}}any{{/returnType}}>>;
104-
public {{nickname}}({{#allParams}}{{^isConstEnumParam}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/isConstEnumParam}}{{/allParams}}options?: AxiosRequestConfig): Observable<any> {
103+
public {{nickname}}({{#allParams}}{{^isConstEnumParam}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/isConstEnumParam}}{{/allParams}}{{nickname}}RequestConfig?: { options?: AxiosRequestConfig }): Observable<AxiosResponse<{{#returnType}}{{{returnType}}}{{#isResponseTypeFile}}|undefined{{/isResponseTypeFile}}{{/returnType}}{{^returnType}}any{{/returnType}}>>;
104+
public {{nickname}}({{#allParams}}{{^isConstEnumParam}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/isConstEnumParam}}{{/allParams}}{{nickname}}RequestConfig?: { options?: AxiosRequestConfig }): Observable<any> {
105105
{{/useSingleRequestParameter}}
106106
{{#allParams.0}}
107107
{{#useSingleRequestParameter}}
@@ -292,8 +292,8 @@ export class {{classname}} {
292292
responseType: "blob",
293293
{{/isResponseFile}}
294294
withCredentials: this.configuration.withCredentials,
295-
headers: {...headers, ...options?.headers},
296-
...options,
295+
headers: {...headers, ...{{nickname}}RequestConfig?.options?.headers},
296+
...{{nickname}}RequestConfig?.options,
297297
}
298298
);
299299
})

samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/api/pet.service.ts

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ export class PetService {
4949
* @param pet Pet object that needs to be added to the store
5050
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
5151
* @param reportProgress flag to report request and response progress.
52-
* @param {*} [options] Override http request option.
52+
* @param {*} [addPetRequestConfig.options] Override http request option.
5353
*/
54-
public addPet(pet: Pet, options?: AxiosRequestConfig): Observable<AxiosResponse<Pet>>;
55-
public addPet(pet: Pet, options?: AxiosRequestConfig): Observable<any> {
54+
public addPet(pet: Pet, addPetRequestConfig?: { options?: AxiosRequestConfig }): Observable<AxiosResponse<Pet>>;
55+
public addPet(pet: Pet, addPetRequestConfig?: { options?: AxiosRequestConfig }): Observable<any> {
5656
if (pet === null || pet === undefined) {
5757
throw new Error('Required parameter pet was null or undefined when calling addPet.');
5858
}
@@ -97,8 +97,8 @@ export class PetService {
9797
pet,
9898
{
9999
withCredentials: this.configuration.withCredentials,
100-
headers: {...headers, ...options?.headers},
101-
...options,
100+
headers: {...headers, ...addPetRequestConfig?.options?.headers},
101+
...addPetRequestConfig?.options,
102102
}
103103
);
104104
})
@@ -111,10 +111,10 @@ export class PetService {
111111
* @param apiKey
112112
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
113113
* @param reportProgress flag to report request and response progress.
114-
* @param {*} [options] Override http request option.
114+
* @param {*} [deletePetRequestConfig.options] Override http request option.
115115
*/
116-
public deletePet(petId: number, apiKey?: string, options?: AxiosRequestConfig): Observable<AxiosResponse<any>>;
117-
public deletePet(petId: number, apiKey?: string, options?: AxiosRequestConfig): Observable<any> {
116+
public deletePet(petId: number, apiKey?: string, deletePetRequestConfig?: { options?: AxiosRequestConfig }): Observable<AxiosResponse<any>>;
117+
public deletePet(petId: number, apiKey?: string, deletePetRequestConfig?: { options?: AxiosRequestConfig }): Observable<any> {
118118
if (petId === null || petId === undefined) {
119119
throw new Error('Required parameter petId was null or undefined when calling deletePet.');
120120
}
@@ -153,8 +153,8 @@ export class PetService {
153153
return this.httpClient.delete<any>(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`,
154154
{
155155
withCredentials: this.configuration.withCredentials,
156-
headers: {...headers, ...options?.headers},
157-
...options,
156+
headers: {...headers, ...deletePetRequestConfig?.options?.headers},
157+
...deletePetRequestConfig?.options,
158158
}
159159
);
160160
})
@@ -166,10 +166,10 @@ export class PetService {
166166
* @param status Status values that need to be considered for filter
167167
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
168168
* @param reportProgress flag to report request and response progress.
169-
* @param {*} [options] Override http request option.
169+
* @param {*} [findPetsByStatusRequestConfig.options] Override http request option.
170170
*/
171-
public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: AxiosRequestConfig): Observable<AxiosResponse<Array<Pet>>>;
172-
public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: AxiosRequestConfig): Observable<any> {
171+
public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, findPetsByStatusRequestConfig?: { options?: AxiosRequestConfig }): Observable<AxiosResponse<Array<Pet>>>;
172+
public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, findPetsByStatusRequestConfig?: { options?: AxiosRequestConfig }): Observable<any> {
173173
if (status === null || status === undefined) {
174174
throw new Error('Required parameter status was null or undefined when calling findPetsByStatus.');
175175
}
@@ -213,8 +213,8 @@ export class PetService {
213213
{
214214
params: queryParameters,
215215
withCredentials: this.configuration.withCredentials,
216-
headers: {...headers, ...options?.headers},
217-
...options,
216+
headers: {...headers, ...findPetsByStatusRequestConfig?.options?.headers},
217+
...findPetsByStatusRequestConfig?.options,
218218
}
219219
);
220220
})
@@ -226,10 +226,10 @@ export class PetService {
226226
* @param tags Tags to filter by
227227
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
228228
* @param reportProgress flag to report request and response progress.
229-
* @param {*} [options] Override http request option.
229+
* @param {*} [findPetsByTagsRequestConfig.options] Override http request option.
230230
*/
231-
public findPetsByTags(tags: Array<string>, options?: AxiosRequestConfig): Observable<AxiosResponse<Array<Pet>>>;
232-
public findPetsByTags(tags: Array<string>, options?: AxiosRequestConfig): Observable<any> {
231+
public findPetsByTags(tags: Array<string>, findPetsByTagsRequestConfig?: { options?: AxiosRequestConfig }): Observable<AxiosResponse<Array<Pet>>>;
232+
public findPetsByTags(tags: Array<string>, findPetsByTagsRequestConfig?: { options?: AxiosRequestConfig }): Observable<any> {
233233
if (tags === null || tags === undefined) {
234234
throw new Error('Required parameter tags was null or undefined when calling findPetsByTags.');
235235
}
@@ -273,8 +273,8 @@ export class PetService {
273273
{
274274
params: queryParameters,
275275
withCredentials: this.configuration.withCredentials,
276-
headers: {...headers, ...options?.headers},
277-
...options,
276+
headers: {...headers, ...findPetsByTagsRequestConfig?.options?.headers},
277+
...findPetsByTagsRequestConfig?.options,
278278
}
279279
);
280280
})
@@ -286,10 +286,10 @@ export class PetService {
286286
* @param petId ID of pet to return
287287
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
288288
* @param reportProgress flag to report request and response progress.
289-
* @param {*} [options] Override http request option.
289+
* @param {*} [getPetByIdRequestConfig.options] Override http request option.
290290
*/
291-
public getPetById(petId: number, options?: AxiosRequestConfig): Observable<AxiosResponse<Pet>>;
292-
public getPetById(petId: number, options?: AxiosRequestConfig): Observable<any> {
291+
public getPetById(petId: number, getPetByIdRequestConfig?: { options?: AxiosRequestConfig }): Observable<AxiosResponse<Pet>>;
292+
public getPetById(petId: number, getPetByIdRequestConfig?: { options?: AxiosRequestConfig }): Observable<any> {
293293
if (petId === null || petId === undefined) {
294294
throw new Error('Required parameter petId was null or undefined when calling getPetById.');
295295
}
@@ -325,8 +325,8 @@ export class PetService {
325325
return this.httpClient.get<Pet>(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`,
326326
{
327327
withCredentials: this.configuration.withCredentials,
328-
headers: {...headers, ...options?.headers},
329-
...options,
328+
headers: {...headers, ...getPetByIdRequestConfig?.options?.headers},
329+
...getPetByIdRequestConfig?.options,
330330
}
331331
);
332332
})
@@ -338,10 +338,10 @@ export class PetService {
338338
* @param pet Pet object that needs to be added to the store
339339
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
340340
* @param reportProgress flag to report request and response progress.
341-
* @param {*} [options] Override http request option.
341+
* @param {*} [updatePetRequestConfig.options] Override http request option.
342342
*/
343-
public updatePet(pet: Pet, options?: AxiosRequestConfig): Observable<AxiosResponse<Pet>>;
344-
public updatePet(pet: Pet, options?: AxiosRequestConfig): Observable<any> {
343+
public updatePet(pet: Pet, updatePetRequestConfig?: { options?: AxiosRequestConfig }): Observable<AxiosResponse<Pet>>;
344+
public updatePet(pet: Pet, updatePetRequestConfig?: { options?: AxiosRequestConfig }): Observable<any> {
345345
if (pet === null || pet === undefined) {
346346
throw new Error('Required parameter pet was null or undefined when calling updatePet.');
347347
}
@@ -386,8 +386,8 @@ export class PetService {
386386
pet,
387387
{
388388
withCredentials: this.configuration.withCredentials,
389-
headers: {...headers, ...options?.headers},
390-
...options,
389+
headers: {...headers, ...updatePetRequestConfig?.options?.headers},
390+
...updatePetRequestConfig?.options,
391391
}
392392
);
393393
})
@@ -401,10 +401,10 @@ export class PetService {
401401
* @param status Updated status of the pet
402402
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
403403
* @param reportProgress flag to report request and response progress.
404-
* @param {*} [options] Override http request option.
404+
* @param {*} [updatePetWithFormRequestConfig.options] Override http request option.
405405
*/
406-
public updatePetWithForm(petId: number, name?: string, status?: string, options?: AxiosRequestConfig): Observable<AxiosResponse<any>>;
407-
public updatePetWithForm(petId: number, name?: string, status?: string, options?: AxiosRequestConfig): Observable<any> {
406+
public updatePetWithForm(petId: number, name?: string, status?: string, updatePetWithFormRequestConfig?: { options?: AxiosRequestConfig }): Observable<AxiosResponse<any>>;
407+
public updatePetWithForm(petId: number, name?: string, status?: string, updatePetWithFormRequestConfig?: { options?: AxiosRequestConfig }): Observable<any> {
408408
if (petId === null || petId === undefined) {
409409
throw new Error('Required parameter petId was null or undefined when calling updatePetWithForm.');
410410
}
@@ -462,8 +462,8 @@ export class PetService {
462462
convertFormParamsToString ? formParams!.toString() : formParams!,
463463
{
464464
withCredentials: this.configuration.withCredentials,
465-
headers: {...headers, ...options?.headers},
466-
...options,
465+
headers: {...headers, ...updatePetWithFormRequestConfig?.options?.headers},
466+
...updatePetWithFormRequestConfig?.options,
467467
}
468468
);
469469
})
@@ -477,10 +477,10 @@ export class PetService {
477477
* @param file file to upload
478478
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
479479
* @param reportProgress flag to report request and response progress.
480-
* @param {*} [options] Override http request option.
480+
* @param {*} [uploadFileRequestConfig.options] Override http request option.
481481
*/
482-
public uploadFile(petId: number, additionalMetadata?: string, file?: Blob, options?: AxiosRequestConfig): Observable<AxiosResponse<ApiResponse>>;
483-
public uploadFile(petId: number, additionalMetadata?: string, file?: Blob, options?: AxiosRequestConfig): Observable<any> {
482+
public uploadFile(petId: number, additionalMetadata?: string, file?: Blob, uploadFileRequestConfig?: { options?: AxiosRequestConfig }): Observable<AxiosResponse<ApiResponse>>;
483+
public uploadFile(petId: number, additionalMetadata?: string, file?: Blob, uploadFileRequestConfig?: { options?: AxiosRequestConfig }): Observable<any> {
484484
if (petId === null || petId === undefined) {
485485
throw new Error('Required parameter petId was null or undefined when calling uploadFile.');
486486
}
@@ -543,8 +543,8 @@ export class PetService {
543543
convertFormParamsToString ? formParams!.toString() : formParams!,
544544
{
545545
withCredentials: this.configuration.withCredentials,
546-
headers: {...headers, ...options?.headers},
547-
...options,
546+
headers: {...headers, ...uploadFileRequestConfig?.options?.headers},
547+
...uploadFileRequestConfig?.options,
548548
}
549549
);
550550
})

0 commit comments

Comments
 (0)