Skip to content

Commit

Permalink
[typescript-nestjs] Fix template for useSingleRequestParameter (OpenA…
Browse files Browse the repository at this point in the history
…PITools#18744)

* fix: template

* chore: samples
  • Loading branch information
arivanandan authored May 23, 2024
1 parent f49efe0 commit 7d3258f
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ export class {{classname}} {
{{#useSingleRequestParameter}}
{{#allParams.0}}
* @param {{=<% %>=}}{<%& classname %><%& operationIdCamelCase %>Request}<%={{ }}=%> requestParameters Request parameters.
*/
{{/allParams.0}}
*/
{{/useSingleRequestParameter}}
{{^useSingleRequestParameter}}
{{#allParams}}* @param {{paramName}} {{description}}
Expand All @@ -101,15 +101,16 @@ export class {{classname}} {
public {{nickname}}({{#allParams}}{{^isConstEnumParam}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/isConstEnumParam}}{{/allParams}}): Observable<AxiosResponse<{{#returnType}}{{{returnType}}}{{#isResponseTypeFile}}|undefined{{/isResponseTypeFile}}{{/returnType}}{{^returnType}}any{{/returnType}}>>;
public {{nickname}}({{#allParams}}{{^isConstEnumParam}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/isConstEnumParam}}{{/allParams}}): Observable<any> {
{{/useSingleRequestParameter}}
{{#allParams.0}}
{{#useSingleRequestParameter}}
const {
{{#allParams}}
{{paramName}},
{{/allParams}}
} = requestParameters;
const {
{{#allParams}}
{{paramName}},
{{/allParams}}
} = requestParameters;

{{/useSingleRequestParameter}}

{{/allParams.0}}
{{#allParams}}
{{#required}}
{{#isConstEnumParam}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ export class PetService {
*/
public addPet(pet: Pet, ): Observable<AxiosResponse<Pet>>;
public addPet(pet: Pet, ): Observable<any> {

if (pet === null || pet === undefined) {
throw new Error('Required parameter pet was null or undefined when calling addPet.');
}
Expand Down Expand Up @@ -111,7 +110,6 @@ export class PetService {
*/
public deletePet(petId: number, apiKey?: string, ): Observable<AxiosResponse<any>>;
public deletePet(petId: number, apiKey?: string, ): Observable<any> {

if (petId === null || petId === undefined) {
throw new Error('Required parameter petId was null or undefined when calling deletePet.');
}
Expand Down Expand Up @@ -165,7 +163,6 @@ export class PetService {
*/
public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, ): Observable<AxiosResponse<Array<Pet>>>;
public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, ): Observable<any> {

if (status === null || status === undefined) {
throw new Error('Required parameter status was null or undefined when calling findPetsByStatus.');
}
Expand Down Expand Up @@ -224,7 +221,6 @@ export class PetService {
*/
public findPetsByTags(tags: Array<string>, ): Observable<AxiosResponse<Array<Pet>>>;
public findPetsByTags(tags: Array<string>, ): Observable<any> {

if (tags === null || tags === undefined) {
throw new Error('Required parameter tags was null or undefined when calling findPetsByTags.');
}
Expand Down Expand Up @@ -283,7 +279,6 @@ export class PetService {
*/
public getPetById(petId: number, ): Observable<AxiosResponse<Pet>>;
public getPetById(petId: number, ): Observable<any> {

if (petId === null || petId === undefined) {
throw new Error('Required parameter petId was null or undefined when calling getPetById.');
}
Expand Down Expand Up @@ -334,7 +329,6 @@ export class PetService {
*/
public updatePet(pet: Pet, ): Observable<AxiosResponse<Pet>>;
public updatePet(pet: Pet, ): Observable<any> {

if (pet === null || pet === undefined) {
throw new Error('Required parameter pet was null or undefined when calling updatePet.');
}
Expand Down Expand Up @@ -396,7 +390,6 @@ export class PetService {
*/
public updatePetWithForm(petId: number, name?: string, status?: string, ): Observable<AxiosResponse<any>>;
public updatePetWithForm(petId: number, name?: string, status?: string, ): Observable<any> {

if (petId === null || petId === undefined) {
throw new Error('Required parameter petId was null or undefined when calling updatePetWithForm.');
}
Expand Down Expand Up @@ -471,7 +464,6 @@ export class PetService {
*/
public uploadFile(petId: number, additionalMetadata?: string, file?: Blob, ): Observable<AxiosResponse<ApiResponse>>;
public uploadFile(petId: number, additionalMetadata?: string, file?: Blob, ): Observable<any> {

if (petId === null || petId === undefined) {
throw new Error('Required parameter petId was null or undefined when calling uploadFile.');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ export class StoreService {
*/
public deleteOrder(orderId: string, ): Observable<AxiosResponse<any>>;
public deleteOrder(orderId: string, ): Observable<any> {

if (orderId === null || orderId === undefined) {
throw new Error('Required parameter orderId was null or undefined when calling deleteOrder.');
}
Expand Down Expand Up @@ -92,7 +91,6 @@ export class StoreService {
*/
public getInventory(): Observable<AxiosResponse<{ [key: string]: number; }>>;
public getInventory(): Observable<any> {

let headers = {...this.defaultHeaders};

let accessTokenObservable: Observable<any> = of(null);
Expand Down Expand Up @@ -138,7 +136,6 @@ export class StoreService {
*/
public getOrderById(orderId: number, ): Observable<AxiosResponse<Order>>;
public getOrderById(orderId: number, ): Observable<any> {

if (orderId === null || orderId === undefined) {
throw new Error('Required parameter orderId was null or undefined when calling getOrderById.');
}
Expand Down Expand Up @@ -184,7 +181,6 @@ export class StoreService {
*/
public placeOrder(order: Order, ): Observable<AxiosResponse<Order>>;
public placeOrder(order: Order, ): Observable<any> {

if (order === null || order === undefined) {
throw new Error('Required parameter order was null or undefined when calling placeOrder.');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ export class UserService {
*/
public createUser(user: User, ): Observable<AxiosResponse<any>>;
public createUser(user: User, ): Observable<any> {

if (user === null || user === undefined) {
throw new Error('Required parameter user was null or undefined when calling createUser.');
}
Expand Down Expand Up @@ -104,7 +103,6 @@ export class UserService {
*/
public createUsersWithArrayInput(user: Array<User>, ): Observable<AxiosResponse<any>>;
public createUsersWithArrayInput(user: Array<User>, ): Observable<any> {

if (user === null || user === undefined) {
throw new Error('Required parameter user was null or undefined when calling createUsersWithArrayInput.');
}
Expand Down Expand Up @@ -159,7 +157,6 @@ export class UserService {
*/
public createUsersWithListInput(user: Array<User>, ): Observable<AxiosResponse<any>>;
public createUsersWithListInput(user: Array<User>, ): Observable<any> {

if (user === null || user === undefined) {
throw new Error('Required parameter user was null or undefined when calling createUsersWithListInput.');
}
Expand Down Expand Up @@ -214,7 +211,6 @@ export class UserService {
*/
public deleteUser(username: string, ): Observable<AxiosResponse<any>>;
public deleteUser(username: string, ): Observable<any> {

if (username === null || username === undefined) {
throw new Error('Required parameter username was null or undefined when calling deleteUser.');
}
Expand Down Expand Up @@ -263,7 +259,6 @@ export class UserService {
*/
public getUserByName(username: string, ): Observable<AxiosResponse<User>>;
public getUserByName(username: string, ): Observable<any> {

if (username === null || username === undefined) {
throw new Error('Required parameter username was null or undefined when calling getUserByName.');
}
Expand Down Expand Up @@ -310,7 +305,6 @@ export class UserService {
*/
public loginUser(username: string, password: string, ): Observable<AxiosResponse<string>>;
public loginUser(username: string, password: string, ): Observable<any> {

if (username === null || username === undefined) {
throw new Error('Required parameter username was null or undefined when calling loginUser.');
}
Expand Down Expand Up @@ -368,7 +362,6 @@ export class UserService {
*/
public logoutUser(): Observable<AxiosResponse<any>>;
public logoutUser(): Observable<any> {

let headers = {...this.defaultHeaders};

let accessTokenObservable: Observable<any> = of(null);
Expand Down Expand Up @@ -414,7 +407,6 @@ export class UserService {
*/
public updateUser(username: string, user: User, ): Observable<AxiosResponse<any>>;
public updateUser(username: string, user: User, ): Observable<any> {

if (username === null || username === undefined) {
throw new Error('Required parameter username was null or undefined when calling updateUser.');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ export class PetService {
*/
public addPet(pet: Pet, ): Observable<AxiosResponse<Pet>>;
public addPet(pet: Pet, ): Observable<any> {

if (pet === null || pet === undefined) {
throw new Error('Required parameter pet was null or undefined when calling addPet.');
}
Expand Down Expand Up @@ -112,7 +111,6 @@ export class PetService {
*/
public deletePet(petId: number, apiKey?: string, ): Observable<AxiosResponse<any>>;
public deletePet(petId: number, apiKey?: string, ): Observable<any> {

if (petId === null || petId === undefined) {
throw new Error('Required parameter petId was null or undefined when calling deletePet.');
}
Expand Down Expand Up @@ -166,7 +164,6 @@ export class PetService {
*/
public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, ): Observable<AxiosResponse<Array<Pet>>>;
public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, ): Observable<any> {

if (status === null || status === undefined) {
throw new Error('Required parameter status was null or undefined when calling findPetsByStatus.');
}
Expand Down Expand Up @@ -225,7 +222,6 @@ export class PetService {
*/
public findPetsByTags(tags: Array<string>, ): Observable<AxiosResponse<Array<Pet>>>;
public findPetsByTags(tags: Array<string>, ): Observable<any> {

if (tags === null || tags === undefined) {
throw new Error('Required parameter tags was null or undefined when calling findPetsByTags.');
}
Expand Down Expand Up @@ -284,7 +280,6 @@ export class PetService {
*/
public getPetById(petId: number, ): Observable<AxiosResponse<Pet>>;
public getPetById(petId: number, ): Observable<any> {

if (petId === null || petId === undefined) {
throw new Error('Required parameter petId was null or undefined when calling getPetById.');
}
Expand Down Expand Up @@ -335,7 +330,6 @@ export class PetService {
*/
public updatePet(pet: Pet, ): Observable<AxiosResponse<Pet>>;
public updatePet(pet: Pet, ): Observable<any> {

if (pet === null || pet === undefined) {
throw new Error('Required parameter pet was null or undefined when calling updatePet.');
}
Expand Down Expand Up @@ -397,7 +391,6 @@ export class PetService {
*/
public updatePetWithForm(petId: number, name?: string, status?: string, ): Observable<AxiosResponse<any>>;
public updatePetWithForm(petId: number, name?: string, status?: string, ): Observable<any> {

if (petId === null || petId === undefined) {
throw new Error('Required parameter petId was null or undefined when calling updatePetWithForm.');
}
Expand Down Expand Up @@ -472,7 +465,6 @@ export class PetService {
*/
public uploadFile(petId: number, additionalMetadata?: string, file?: Blob, ): Observable<AxiosResponse<ApiResponse>>;
public uploadFile(petId: number, additionalMetadata?: string, file?: Blob, ): Observable<any> {

if (petId === null || petId === undefined) {
throw new Error('Required parameter petId was null or undefined when calling uploadFile.');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ export class StoreService {
*/
public deleteOrder(orderId: string, ): Observable<AxiosResponse<any>>;
public deleteOrder(orderId: string, ): Observable<any> {

if (orderId === null || orderId === undefined) {
throw new Error('Required parameter orderId was null or undefined when calling deleteOrder.');
}
Expand Down Expand Up @@ -93,7 +92,6 @@ export class StoreService {
*/
public getInventory(): Observable<AxiosResponse<{ [key: string]: number; }>>;
public getInventory(): Observable<any> {

let headers = {...this.defaultHeaders};

let accessTokenObservable: Observable<any> = of(null);
Expand Down Expand Up @@ -139,7 +137,6 @@ export class StoreService {
*/
public getOrderById(orderId: number, ): Observable<AxiosResponse<Order>>;
public getOrderById(orderId: number, ): Observable<any> {

if (orderId === null || orderId === undefined) {
throw new Error('Required parameter orderId was null or undefined when calling getOrderById.');
}
Expand Down Expand Up @@ -185,7 +182,6 @@ export class StoreService {
*/
public placeOrder(order: Order, ): Observable<AxiosResponse<Order>>;
public placeOrder(order: Order, ): Observable<any> {

if (order === null || order === undefined) {
throw new Error('Required parameter order was null or undefined when calling placeOrder.');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ export class UserService {
*/
public createUser(user: User, ): Observable<AxiosResponse<any>>;
public createUser(user: User, ): Observable<any> {

if (user === null || user === undefined) {
throw new Error('Required parameter user was null or undefined when calling createUser.');
}
Expand Down Expand Up @@ -105,7 +104,6 @@ export class UserService {
*/
public createUsersWithArrayInput(user: Array<User>, ): Observable<AxiosResponse<any>>;
public createUsersWithArrayInput(user: Array<User>, ): Observable<any> {

if (user === null || user === undefined) {
throw new Error('Required parameter user was null or undefined when calling createUsersWithArrayInput.');
}
Expand Down Expand Up @@ -160,7 +158,6 @@ export class UserService {
*/
public createUsersWithListInput(user: Array<User>, ): Observable<AxiosResponse<any>>;
public createUsersWithListInput(user: Array<User>, ): Observable<any> {

if (user === null || user === undefined) {
throw new Error('Required parameter user was null or undefined when calling createUsersWithListInput.');
}
Expand Down Expand Up @@ -215,7 +212,6 @@ export class UserService {
*/
public deleteUser(username: string, ): Observable<AxiosResponse<any>>;
public deleteUser(username: string, ): Observable<any> {

if (username === null || username === undefined) {
throw new Error('Required parameter username was null or undefined when calling deleteUser.');
}
Expand Down Expand Up @@ -264,7 +260,6 @@ export class UserService {
*/
public getUserByName(username: string, ): Observable<AxiosResponse<User>>;
public getUserByName(username: string, ): Observable<any> {

if (username === null || username === undefined) {
throw new Error('Required parameter username was null or undefined when calling getUserByName.');
}
Expand Down Expand Up @@ -311,7 +306,6 @@ export class UserService {
*/
public loginUser(username: string, password: string, ): Observable<AxiosResponse<string>>;
public loginUser(username: string, password: string, ): Observable<any> {

if (username === null || username === undefined) {
throw new Error('Required parameter username was null or undefined when calling loginUser.');
}
Expand Down Expand Up @@ -369,7 +363,6 @@ export class UserService {
*/
public logoutUser(): Observable<AxiosResponse<any>>;
public logoutUser(): Observable<any> {

let headers = {...this.defaultHeaders};

let accessTokenObservable: Observable<any> = of(null);
Expand Down Expand Up @@ -415,7 +408,6 @@ export class UserService {
*/
public updateUser(username: string, user: User, ): Observable<AxiosResponse<any>>;
public updateUser(username: string, user: User, ): Observable<any> {

if (username === null || username === undefined) {
throw new Error('Required parameter username was null or undefined when calling updateUser.');
}
Expand Down

0 comments on commit 7d3258f

Please sign in to comment.