[typescript-fetch] fix #1998: prefix req ifaces. (#3740)

Prefix generated request interface names with API classname rather than
using namespaces, because namespaces are not well-supported by some
tooling (in particular, Babel).
This commit is contained in:
Josh Giles 2019-08-23 10:58:51 -04:00 committed by Esteban Gehring
parent 1fc03c88b2
commit 158cdfeb3c
34 changed files with 126 additions and 173 deletions

View File

@ -1,7 +1,7 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.openapitools</groupId>
<artifactId>TypeScriptFetchBuildNamespaceParameterInterfacesPestoreClientTests</artifactId>
<artifactId>TypeScriptFetchBuildPrefixParameterInterfacesPestoreClientTests</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>TS Fetch Petstore Client (with namespacing for parameter interfaces)</name>

View File

@ -4,4 +4,4 @@
./bin/openapi3/typescript-fetch-petstore-with-npm-version.sh
./bin/openapi3/typescript-fetch-petstore-interfaces.sh
./bin/openapi3/typescript-fetch-petstore.sh
./bin/openapi3/typescript-fetch-petstore-namespace-parameter-interfaces.sh
./bin/openapi3/typescript-fetch-petstore-prefix-parameter-interfaces.sh

View File

@ -27,6 +27,6 @@ fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g typescript-fetch -o samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces --additional-properties namespaceParameterInterfaces=true $@"
ags="generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g typescript-fetch -o samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces --additional-properties prefixParameterInterfaces=true $@"
java $JAVA_OPTS -jar $executable $ags

View File

@ -5,4 +5,4 @@
./bin/typescript-fetch-petstore-interfaces.sh
./bin/typescript-fetch-petstore.sh
./bin/typescript-fetch-petstore-multiple-parameters.sh
./bin/typescript-fetch-petstore-namespace-parameter-interfaces.sh
./bin/typescript-fetch-petstore-prefix-parameter-interfaces.sh

View File

@ -3,5 +3,5 @@
"npmVersion": "1.0.0",
"npmRepository" : "https://skimdb.npmjs.com/registry",
"snapshot" : false,
"namespaceParameterInterfaces": true
"prefixParameterInterfaces": true
}

View File

@ -27,8 +27,8 @@ fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-fetch -c bin/typescript-fetch-petstore-namespace-parameter-interfaces.json -o samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces $@"
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-fetch -c bin/typescript-fetch-petstore-prefix-parameter-interfaces.json -o samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces $@"
java $JAVA_OPTS -jar $executable $ags
cp CI/samples.ci/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/pom.xml samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces/pom.xml
cp CI/samples.ci/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/pom.xml samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/pom.xml

View File

@ -5,4 +5,4 @@ call bin\windows\typescript-fetch-petstore-target-es6.bat
call bin\windows\typescript-fetch-petstore-with-npm-version.bat
call bin\windows\typescript-fetch-petstore-interfaces.bat
call bin\windows\typescript-fetch-petstore-multiple-parameters.bat
call bin\windows\typescript-fetch-petstore-namespace-parameter-interfaces.bat
call bin\windows\typescript-fetch-petstore-prefix-parameter-interfaces.bat

View File

@ -7,6 +7,6 @@ If Not Exist %executable% (
)
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g typescript-fetch -o samples\client\petstore\typescript-fetch\builds\namespace-parameter-interfaces --additional-properties namespaceParameterInterfaces=true
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g typescript-fetch -o samples\client\petstore\typescript-fetch\builds\prefix-parameter-interfaces --additional-properties prefixParameterInterfaces=true
java %JAVA_OPTS% -jar %executable% %ags%

View File

@ -19,4 +19,4 @@ sidebar_label: typescript-fetch
|npmRepository|Use this property to set an url your private npmRepo in the package.json| |null|
|withInterfaces|Setting this property to true will generate interfaces next to the default class implementations.| |false|
|useSingleRequestParameter|Setting this property to true will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter.| |true|
|namespaceParameterInterfaces|Setting this property to true will generate parameter interface declarations within a dedicated namespace to avoid name conflicts.| |false|
|prefixParameterInterfaces|Setting this property to true will generate parameter interface declarations prefixed with API class name to avoid name conflicts.| |false|

View File

@ -33,11 +33,11 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
public static final String NPM_REPOSITORY = "npmRepository";
public static final String WITH_INTERFACES = "withInterfaces";
public static final String USE_SINGLE_REQUEST_PARAMETER = "useSingleRequestParameter";
public static final String NAMESPACE_PARAMETER_INTERFACES = "namespaceParameterInterfaces";
public static final String PREFIX_PARAMETER_INTERFACES = "prefixParameterInterfaces";
protected String npmRepository = null;
private boolean useSingleRequestParameter = true;
private boolean namespaceParameterInterfaces = false;
private boolean prefixParameterInterfaces = false;
protected boolean addedApiIndex = false;
protected boolean addedModelIndex = false;
@ -61,7 +61,7 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
this.cliOptions.add(new CliOption(NPM_REPOSITORY, "Use this property to set an url your private npmRepo in the package.json"));
this.cliOptions.add(new CliOption(WITH_INTERFACES, "Setting this property to true will generate interfaces next to the default class implementations.", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString()));
this.cliOptions.add(new CliOption(USE_SINGLE_REQUEST_PARAMETER, "Setting this property to true will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter.", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.TRUE.toString()));
this.cliOptions.add(new CliOption(NAMESPACE_PARAMETER_INTERFACES, "Setting this property to true will generate parameter interface declarations within a dedicated namespace to avoid name conflicts.", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString()));
this.cliOptions.add(new CliOption(PREFIX_PARAMETER_INTERFACES, "Setting this property to true will generate parameter interface declarations prefixed with API class name to avoid name conflicts.", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString()));
}
@Override
@ -97,10 +97,10 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
}
writePropertyBack(USE_SINGLE_REQUEST_PARAMETER, getUseSingleRequestParameter());
if (additionalProperties.containsKey(NAMESPACE_PARAMETER_INTERFACES)) {
this.setNamespaceParameterInterfaces(convertPropertyToBoolean(NAMESPACE_PARAMETER_INTERFACES));
if (additionalProperties.containsKey(PREFIX_PARAMETER_INTERFACES)) {
this.setPrefixParameterInterfaces(convertPropertyToBoolean(PREFIX_PARAMETER_INTERFACES));
}
writePropertyBack(NAMESPACE_PARAMETER_INTERFACES, getNamespaceParameterInterfaces());
writePropertyBack(PREFIX_PARAMETER_INTERFACES, getPrefixParameterInterfaces());
if (additionalProperties.containsKey(NPM_NAME)) {
addNpmPackageGeneration();
@ -216,7 +216,7 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
this.addOperationModelImportInfomation(operations);
this.updateOperationParameterEnumInformation(operations);
this.addOperationObjectResponseInformation(operations);
this.addOperationNamespaceParameterInterfacesInformation(operations);
this.addOperationPrefixParameterInterfacesInformation(operations);
return operations;
}
@ -263,20 +263,9 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
}
}
private void addOperationNamespaceParameterInterfacesInformation(Map<String, Object> operations) {
private void addOperationPrefixParameterInterfacesInformation(Map<String, Object> operations) {
Map<String, Object> _operations = (Map<String, Object>) operations.get("operations");
List<CodegenOperation> operationList = (List<CodegenOperation>) _operations.get("operation");
if (!operationList.isEmpty() && getNamespaceParameterInterfaces()) {
operations.put("namespaceParameterInterfaces", true);
operations.put("paramIfaceIndent", " ");
operations.put("paramIfaceSuffix", "");
operations.put("paramIfaceNsPrefix", operationList.get(0).baseName + "Requests.");
} else {
operations.put("namespaceParameterInterfaces", false);
operations.put("paramIfaceIndent", "");
operations.put("paramIfaceSuffix", "Request");
operations.put("paramIfaceNsPrefix", "");
}
operations.put("prefixParameterInterfaces", getPrefixParameterInterfaces());
}
private void addExtraReservedWords() {
@ -315,11 +304,11 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
this.useSingleRequestParameter = useSingleRequestParameter;
}
private boolean getNamespaceParameterInterfaces() {
return namespaceParameterInterfaces;
private boolean getPrefixParameterInterfaces() {
return prefixParameterInterfaces;
}
private void setNamespaceParameterInterfaces(boolean namespaceParameterInterfaces) {
this.namespaceParameterInterfaces = namespaceParameterInterfaces;
private void setPrefixParameterInterfaces(boolean prefixParameterInterfaces) {
this.prefixParameterInterfaces = prefixParameterInterfaces;
}
}

View File

@ -13,31 +13,16 @@ import {
{{/imports.0}}
{{#operations}}
{{#namespaceParameterInterfaces}}
{{#operation.0}}
/**
* Generated request parameter interface declarations (in namespace to avoid collisions).
*/
export namespace {{baseName}}Requests {
{{/operation.0}}
{{/namespaceParameterInterfaces}}
{{#operation}}
{{#allParams.0}}
{{paramIfaceIndent}}export interface {{operationIdCamelCase}}{{paramIfaceSuffix}} {
export interface {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}Request {
{{#allParams}}
{{paramIfaceIndent}} {{paramName}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{#isNullable}} | null{{/isNullable}}{{/isEnum}};
{{paramName}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{#isNullable}} | null{{/isNullable}}{{/isEnum}};
{{/allParams}}
{{paramIfaceIndent}}}
}
{{/allParams.0}}
{{/operation}}
{{#namespaceParameterInterfaces}}
{{#operation.0}}
}
{{/operation.0}}
{{/namespaceParameterInterfaces}}
{{/operations}}
{{#operations}}
/**
@ -54,7 +39,7 @@ export class {{classname}} extends runtime.BaseAPI {
* {{&summary}}
{{/summary}}
*/
async {{nickname}}Raw({{#allParams.0}}requestParameters: {{paramIfaceNsPrefix}}{{operationIdCamelCase}}{{paramIfaceSuffix}}{{/allParams.0}}): Promise<runtime.ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}>> {
async {{nickname}}Raw({{#allParams.0}}requestParameters: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}Request{{/allParams.0}}): Promise<runtime.ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}>> {
{{#allParams}}
{{#required}}
if (requestParameters.{{paramName}} === null || requestParameters.{{paramName}} === undefined) {
@ -264,7 +249,7 @@ export class {{classname}} extends runtime.BaseAPI {
}
{{/useSingleRequestParameter}}
{{#useSingleRequestParameter}}
async {{nickname}}({{#allParams.0}}requestParameters: {{paramIfaceNsPrefix}}{{operationIdCamelCase}}{{paramIfaceSuffix}}{{/allParams.0}}): Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}> {
async {{nickname}}({{#allParams.0}}requestParameters: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}Request{{/allParams.0}}): Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}> {
{{#returnType}}
const response = await this.{{nickname}}Raw({{#allParams.0}}requestParameters{{/allParams.0}});
return await response.value();

View File

@ -52,7 +52,7 @@ public class TypeScriptFetchClientOptionsProvider implements OptionsProvider {
.put(TypeScriptFetchClientCodegen.SNAPSHOT, Boolean.FALSE.toString())
.put(TypeScriptFetchClientCodegen.WITH_INTERFACES, Boolean.FALSE.toString())
.put(TypeScriptFetchClientCodegen.USE_SINGLE_REQUEST_PARAMETER, Boolean.FALSE.toString())
.put(TypeScriptFetchClientCodegen.NAMESPACE_PARAMETER_INTERFACES, Boolean.FALSE.toString())
.put(TypeScriptFetchClientCodegen.PREFIX_PARAMETER_INTERFACES, Boolean.FALSE.toString())
.put(CodegenConstants.ALLOW_UNICODE_IDENTIFIERS, ALLOW_UNICODE_IDENTIFIERS_VALUE)
.put(CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS, PREPEND_FORM_OR_BODY_PARAMETERS_VALUE)
.build();

View File

@ -844,7 +844,7 @@
</modules>
</profile>
<profile>
<id>typescript-fetch-client-builds-namespace-parameter-interfaces</id>
<id>typescript-fetch-client-builds-prefix-parameter-interfaces</id>
<activation>
<property>
<name>env</name>
@ -852,7 +852,7 @@
</property>
</activation>
<modules>
<module>samples/client/petstore/typescript-fetch/builds/namespace-parameter-interfaces</module>
<module>samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces</module>
</modules>
</profile>
<profile>

View File

@ -1,7 +1,7 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.openapitools</groupId>
<artifactId>TypeScriptFetchBuildNamespaceParameterInterfacesPestoreClientTests</artifactId>
<artifactId>TypeScriptFetchBuildPrefixParameterInterfacesPestoreClientTests</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>TS Fetch Petstore Client (with namespacing for parameter interfaces)</name>

View File

@ -22,50 +22,43 @@ import {
PetToJSON,
} from '../models';
/**
* Generated request parameter interface declarations (in namespace to avoid collisions).
*/
export namespace PetRequests {
export interface AddPet {
export interface PetApiAddPetRequest {
body: Pet;
}
export interface DeletePet {
export interface PetApiDeletePetRequest {
petId: number;
apiKey?: string;
}
export interface FindPetsByStatus {
export interface PetApiFindPetsByStatusRequest {
status: Array<FindPetsByStatusStatusEnum>;
}
export interface FindPetsByTags {
export interface PetApiFindPetsByTagsRequest {
tags: Array<string>;
}
export interface GetPetById {
export interface PetApiGetPetByIdRequest {
petId: number;
}
export interface UpdatePet {
export interface PetApiUpdatePetRequest {
body: Pet;
}
export interface UpdatePetWithForm {
export interface PetApiUpdatePetWithFormRequest {
petId: number;
name?: string;
status?: string;
}
export interface UploadFile {
export interface PetApiUploadFileRequest {
petId: number;
additionalMetadata?: string;
file?: Blob;
}
}
/**
* no description
*/
@ -74,7 +67,7 @@ export class PetApi extends runtime.BaseAPI {
/**
* Add a new pet to the store
*/
async addPetRaw(requestParameters: PetRequests.AddPet): Promise<runtime.ApiResponse<void>> {
async addPetRaw(requestParameters: PetApiAddPetRequest): Promise<runtime.ApiResponse<void>> {
if (requestParameters.body === null || requestParameters.body === undefined) {
throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling addPet.');
}
@ -108,14 +101,14 @@ export class PetApi extends runtime.BaseAPI {
/**
* Add a new pet to the store
*/
async addPet(requestParameters: PetRequests.AddPet): Promise<void> {
async addPet(requestParameters: PetApiAddPetRequest): Promise<void> {
await this.addPetRaw(requestParameters);
}
/**
* Deletes a pet
*/
async deletePetRaw(requestParameters: PetRequests.DeletePet): Promise<runtime.ApiResponse<void>> {
async deletePetRaw(requestParameters: PetApiDeletePetRequest): Promise<runtime.ApiResponse<void>> {
if (requestParameters.petId === null || requestParameters.petId === undefined) {
throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling deletePet.');
}
@ -150,7 +143,7 @@ export class PetApi extends runtime.BaseAPI {
/**
* Deletes a pet
*/
async deletePet(requestParameters: PetRequests.DeletePet): Promise<void> {
async deletePet(requestParameters: PetApiDeletePetRequest): Promise<void> {
await this.deletePetRaw(requestParameters);
}
@ -158,7 +151,7 @@ export class PetApi extends runtime.BaseAPI {
* Multiple status values can be provided with comma separated strings
* Finds Pets by status
*/
async findPetsByStatusRaw(requestParameters: PetRequests.FindPetsByStatus): Promise<runtime.ApiResponse<Array<Pet>>> {
async findPetsByStatusRaw(requestParameters: PetApiFindPetsByStatusRequest): Promise<runtime.ApiResponse<Array<Pet>>> {
if (requestParameters.status === null || requestParameters.status === undefined) {
throw new runtime.RequiredError('status','Required parameter requestParameters.status was null or undefined when calling findPetsByStatus.');
}
@ -194,7 +187,7 @@ export class PetApi extends runtime.BaseAPI {
* Multiple status values can be provided with comma separated strings
* Finds Pets by status
*/
async findPetsByStatus(requestParameters: PetRequests.FindPetsByStatus): Promise<Array<Pet>> {
async findPetsByStatus(requestParameters: PetApiFindPetsByStatusRequest): Promise<Array<Pet>> {
const response = await this.findPetsByStatusRaw(requestParameters);
return await response.value();
}
@ -203,7 +196,7 @@ export class PetApi extends runtime.BaseAPI {
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* Finds Pets by tags
*/
async findPetsByTagsRaw(requestParameters: PetRequests.FindPetsByTags): Promise<runtime.ApiResponse<Array<Pet>>> {
async findPetsByTagsRaw(requestParameters: PetApiFindPetsByTagsRequest): Promise<runtime.ApiResponse<Array<Pet>>> {
if (requestParameters.tags === null || requestParameters.tags === undefined) {
throw new runtime.RequiredError('tags','Required parameter requestParameters.tags was null or undefined when calling findPetsByTags.');
}
@ -239,7 +232,7 @@ export class PetApi extends runtime.BaseAPI {
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* Finds Pets by tags
*/
async findPetsByTags(requestParameters: PetRequests.FindPetsByTags): Promise<Array<Pet>> {
async findPetsByTags(requestParameters: PetApiFindPetsByTagsRequest): Promise<Array<Pet>> {
const response = await this.findPetsByTagsRaw(requestParameters);
return await response.value();
}
@ -248,7 +241,7 @@ export class PetApi extends runtime.BaseAPI {
* Returns a single pet
* Find pet by ID
*/
async getPetByIdRaw(requestParameters: PetRequests.GetPetById): Promise<runtime.ApiResponse<Pet>> {
async getPetByIdRaw(requestParameters: PetApiGetPetByIdRequest): Promise<runtime.ApiResponse<Pet>> {
if (requestParameters.petId === null || requestParameters.petId === undefined) {
throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling getPetById.');
}
@ -275,7 +268,7 @@ export class PetApi extends runtime.BaseAPI {
* Returns a single pet
* Find pet by ID
*/
async getPetById(requestParameters: PetRequests.GetPetById): Promise<Pet> {
async getPetById(requestParameters: PetApiGetPetByIdRequest): Promise<Pet> {
const response = await this.getPetByIdRaw(requestParameters);
return await response.value();
}
@ -283,7 +276,7 @@ export class PetApi extends runtime.BaseAPI {
/**
* Update an existing pet
*/
async updatePetRaw(requestParameters: PetRequests.UpdatePet): Promise<runtime.ApiResponse<void>> {
async updatePetRaw(requestParameters: PetApiUpdatePetRequest): Promise<runtime.ApiResponse<void>> {
if (requestParameters.body === null || requestParameters.body === undefined) {
throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling updatePet.');
}
@ -317,14 +310,14 @@ export class PetApi extends runtime.BaseAPI {
/**
* Update an existing pet
*/
async updatePet(requestParameters: PetRequests.UpdatePet): Promise<void> {
async updatePet(requestParameters: PetApiUpdatePetRequest): Promise<void> {
await this.updatePetRaw(requestParameters);
}
/**
* Updates a pet in the store with form data
*/
async updatePetWithFormRaw(requestParameters: PetRequests.UpdatePetWithForm): Promise<runtime.ApiResponse<void>> {
async updatePetWithFormRaw(requestParameters: PetApiUpdatePetWithFormRequest): Promise<runtime.ApiResponse<void>> {
if (requestParameters.petId === null || requestParameters.petId === undefined) {
throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling updatePetWithForm.');
}
@ -365,14 +358,14 @@ export class PetApi extends runtime.BaseAPI {
/**
* Updates a pet in the store with form data
*/
async updatePetWithForm(requestParameters: PetRequests.UpdatePetWithForm): Promise<void> {
async updatePetWithForm(requestParameters: PetApiUpdatePetWithFormRequest): Promise<void> {
await this.updatePetWithFormRaw(requestParameters);
}
/**
* uploads an image
*/
async uploadFileRaw(requestParameters: PetRequests.UploadFile): Promise<runtime.ApiResponse<ModelApiResponse>> {
async uploadFileRaw(requestParameters: PetApiUploadFileRequest): Promise<runtime.ApiResponse<ModelApiResponse>> {
if (requestParameters.petId === null || requestParameters.petId === undefined) {
throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling uploadFile.');
}
@ -413,7 +406,7 @@ export class PetApi extends runtime.BaseAPI {
/**
* uploads an image
*/
async uploadFile(requestParameters: PetRequests.UploadFile): Promise<ModelApiResponse> {
async uploadFile(requestParameters: PetApiUploadFileRequest): Promise<ModelApiResponse> {
const response = await this.uploadFileRaw(requestParameters);
return await response.value();
}

View File

@ -19,25 +19,18 @@ import {
OrderToJSON,
} from '../models';
/**
* Generated request parameter interface declarations (in namespace to avoid collisions).
*/
export namespace StoreRequests {
export interface DeleteOrder {
export interface StoreApiDeleteOrderRequest {
orderId: string;
}
export interface GetOrderById {
export interface StoreApiGetOrderByIdRequest {
orderId: number;
}
export interface PlaceOrder {
export interface StoreApiPlaceOrderRequest {
body: Order;
}
}
/**
* no description
*/
@ -47,7 +40,7 @@ export class StoreApi extends runtime.BaseAPI {
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
* Delete purchase order by ID
*/
async deleteOrderRaw(requestParameters: StoreRequests.DeleteOrder): Promise<runtime.ApiResponse<void>> {
async deleteOrderRaw(requestParameters: StoreApiDeleteOrderRequest): Promise<runtime.ApiResponse<void>> {
if (requestParameters.orderId === null || requestParameters.orderId === undefined) {
throw new runtime.RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling deleteOrder.');
}
@ -70,7 +63,7 @@ export class StoreApi extends runtime.BaseAPI {
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
* Delete purchase order by ID
*/
async deleteOrder(requestParameters: StoreRequests.DeleteOrder): Promise<void> {
async deleteOrder(requestParameters: StoreApiDeleteOrderRequest): Promise<void> {
await this.deleteOrderRaw(requestParameters);
}
@ -110,7 +103,7 @@ export class StoreApi extends runtime.BaseAPI {
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
* Find purchase order by ID
*/
async getOrderByIdRaw(requestParameters: StoreRequests.GetOrderById): Promise<runtime.ApiResponse<Order>> {
async getOrderByIdRaw(requestParameters: StoreApiGetOrderByIdRequest): Promise<runtime.ApiResponse<Order>> {
if (requestParameters.orderId === null || requestParameters.orderId === undefined) {
throw new runtime.RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling getOrderById.');
}
@ -133,7 +126,7 @@ export class StoreApi extends runtime.BaseAPI {
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
* Find purchase order by ID
*/
async getOrderById(requestParameters: StoreRequests.GetOrderById): Promise<Order> {
async getOrderById(requestParameters: StoreApiGetOrderByIdRequest): Promise<Order> {
const response = await this.getOrderByIdRaw(requestParameters);
return await response.value();
}
@ -141,7 +134,7 @@ export class StoreApi extends runtime.BaseAPI {
/**
* Place an order for a pet
*/
async placeOrderRaw(requestParameters: StoreRequests.PlaceOrder): Promise<runtime.ApiResponse<Order>> {
async placeOrderRaw(requestParameters: StoreApiPlaceOrderRequest): Promise<runtime.ApiResponse<Order>> {
if (requestParameters.body === null || requestParameters.body === undefined) {
throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling placeOrder.');
}
@ -166,7 +159,7 @@ export class StoreApi extends runtime.BaseAPI {
/**
* Place an order for a pet
*/
async placeOrder(requestParameters: StoreRequests.PlaceOrder): Promise<Order> {
async placeOrder(requestParameters: StoreApiPlaceOrderRequest): Promise<Order> {
const response = await this.placeOrderRaw(requestParameters);
return await response.value();
}

View File

@ -19,43 +19,36 @@ import {
UserToJSON,
} from '../models';
/**
* Generated request parameter interface declarations (in namespace to avoid collisions).
*/
export namespace UserRequests {
export interface CreateUser {
export interface UserApiCreateUserRequest {
body: User;
}
export interface CreateUsersWithArrayInput {
export interface UserApiCreateUsersWithArrayInputRequest {
body: Array<User>;
}
export interface CreateUsersWithListInput {
export interface UserApiCreateUsersWithListInputRequest {
body: Array<User>;
}
export interface DeleteUser {
export interface UserApiDeleteUserRequest {
username: string;
}
export interface GetUserByName {
export interface UserApiGetUserByNameRequest {
username: string;
}
export interface LoginUser {
export interface UserApiLoginUserRequest {
username: string;
password: string;
}
export interface UpdateUser {
export interface UserApiUpdateUserRequest {
username: string;
body: User;
}
}
/**
* no description
*/
@ -65,7 +58,7 @@ export class UserApi extends runtime.BaseAPI {
* This can only be done by the logged in user.
* Create user
*/
async createUserRaw(requestParameters: UserRequests.CreateUser): Promise<runtime.ApiResponse<void>> {
async createUserRaw(requestParameters: UserApiCreateUserRequest): Promise<runtime.ApiResponse<void>> {
if (requestParameters.body === null || requestParameters.body === undefined) {
throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUser.');
}
@ -91,14 +84,14 @@ export class UserApi extends runtime.BaseAPI {
* This can only be done by the logged in user.
* Create user
*/
async createUser(requestParameters: UserRequests.CreateUser): Promise<void> {
async createUser(requestParameters: UserApiCreateUserRequest): Promise<void> {
await this.createUserRaw(requestParameters);
}
/**
* Creates list of users with given input array
*/
async createUsersWithArrayInputRaw(requestParameters: UserRequests.CreateUsersWithArrayInput): Promise<runtime.ApiResponse<void>> {
async createUsersWithArrayInputRaw(requestParameters: UserApiCreateUsersWithArrayInputRequest): Promise<runtime.ApiResponse<void>> {
if (requestParameters.body === null || requestParameters.body === undefined) {
throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUsersWithArrayInput.');
}
@ -123,14 +116,14 @@ export class UserApi extends runtime.BaseAPI {
/**
* Creates list of users with given input array
*/
async createUsersWithArrayInput(requestParameters: UserRequests.CreateUsersWithArrayInput): Promise<void> {
async createUsersWithArrayInput(requestParameters: UserApiCreateUsersWithArrayInputRequest): Promise<void> {
await this.createUsersWithArrayInputRaw(requestParameters);
}
/**
* Creates list of users with given input array
*/
async createUsersWithListInputRaw(requestParameters: UserRequests.CreateUsersWithListInput): Promise<runtime.ApiResponse<void>> {
async createUsersWithListInputRaw(requestParameters: UserApiCreateUsersWithListInputRequest): Promise<runtime.ApiResponse<void>> {
if (requestParameters.body === null || requestParameters.body === undefined) {
throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUsersWithListInput.');
}
@ -155,7 +148,7 @@ export class UserApi extends runtime.BaseAPI {
/**
* Creates list of users with given input array
*/
async createUsersWithListInput(requestParameters: UserRequests.CreateUsersWithListInput): Promise<void> {
async createUsersWithListInput(requestParameters: UserApiCreateUsersWithListInputRequest): Promise<void> {
await this.createUsersWithListInputRaw(requestParameters);
}
@ -163,7 +156,7 @@ export class UserApi extends runtime.BaseAPI {
* This can only be done by the logged in user.
* Delete user
*/
async deleteUserRaw(requestParameters: UserRequests.DeleteUser): Promise<runtime.ApiResponse<void>> {
async deleteUserRaw(requestParameters: UserApiDeleteUserRequest): Promise<runtime.ApiResponse<void>> {
if (requestParameters.username === null || requestParameters.username === undefined) {
throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling deleteUser.');
}
@ -186,14 +179,14 @@ export class UserApi extends runtime.BaseAPI {
* This can only be done by the logged in user.
* Delete user
*/
async deleteUser(requestParameters: UserRequests.DeleteUser): Promise<void> {
async deleteUser(requestParameters: UserApiDeleteUserRequest): Promise<void> {
await this.deleteUserRaw(requestParameters);
}
/**
* Get user by user name
*/
async getUserByNameRaw(requestParameters: UserRequests.GetUserByName): Promise<runtime.ApiResponse<User>> {
async getUserByNameRaw(requestParameters: UserApiGetUserByNameRequest): Promise<runtime.ApiResponse<User>> {
if (requestParameters.username === null || requestParameters.username === undefined) {
throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling getUserByName.');
}
@ -215,7 +208,7 @@ export class UserApi extends runtime.BaseAPI {
/**
* Get user by user name
*/
async getUserByName(requestParameters: UserRequests.GetUserByName): Promise<User> {
async getUserByName(requestParameters: UserApiGetUserByNameRequest): Promise<User> {
const response = await this.getUserByNameRaw(requestParameters);
return await response.value();
}
@ -223,7 +216,7 @@ export class UserApi extends runtime.BaseAPI {
/**
* Logs user into the system
*/
async loginUserRaw(requestParameters: UserRequests.LoginUser): Promise<runtime.ApiResponse<string>> {
async loginUserRaw(requestParameters: UserApiLoginUserRequest): Promise<runtime.ApiResponse<string>> {
if (requestParameters.username === null || requestParameters.username === undefined) {
throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling loginUser.');
}
@ -257,7 +250,7 @@ export class UserApi extends runtime.BaseAPI {
/**
* Logs user into the system
*/
async loginUser(requestParameters: UserRequests.LoginUser): Promise<string> {
async loginUser(requestParameters: UserApiLoginUserRequest): Promise<string> {
const response = await this.loginUserRaw(requestParameters);
return await response.value();
}
@ -291,7 +284,7 @@ export class UserApi extends runtime.BaseAPI {
* This can only be done by the logged in user.
* Updated user
*/
async updateUserRaw(requestParameters: UserRequests.UpdateUser): Promise<runtime.ApiResponse<void>> {
async updateUserRaw(requestParameters: UserApiUpdateUserRequest): Promise<runtime.ApiResponse<void>> {
if (requestParameters.username === null || requestParameters.username === undefined) {
throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling updateUser.');
}
@ -321,7 +314,7 @@ export class UserApi extends runtime.BaseAPI {
* This can only be done by the logged in user.
* Updated user
*/
async updateUser(requestParameters: UserRequests.UpdateUser): Promise<void> {
async updateUser(requestParameters: UserApiUpdateUserRequest): Promise<void> {
await this.updateUserRaw(requestParameters);
}