forked from loafle/openapi-generator-original
[typescript-fetch] add interfaces, withInterfaces (#5612)
* typescript-fetch: interfaces, first draft * fix name in description
This commit is contained in:
parent
47e24af369
commit
d42f27c9f5
@ -25,11 +25,60 @@ export interface {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterIn
|
|||||||
{{/allParams.0}}
|
{{/allParams.0}}
|
||||||
{{/operation}}
|
{{/operation}}
|
||||||
{{/operations}}
|
{{/operations}}
|
||||||
|
{{#withInterfaces}}
|
||||||
|
{{#operations}}
|
||||||
|
/**
|
||||||
|
* {{classname}} - interface{{#description}}
|
||||||
|
* {{&description}}{{/description}}
|
||||||
|
* @export
|
||||||
|
* @interface {{classname}}Interface
|
||||||
|
*/
|
||||||
|
export interface {{classname}}Interface {
|
||||||
|
{{#operation}}
|
||||||
|
/**
|
||||||
|
* {{¬es}}
|
||||||
|
{{#summary}}
|
||||||
|
* @summary {{&summary}}
|
||||||
|
{{/summary}}
|
||||||
|
{{#allParams}}
|
||||||
|
* @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}}
|
||||||
|
{{/allParams}}
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
* @memberof {{classname}}Interface
|
||||||
|
*/
|
||||||
|
{{nickname}}Raw({{#allParams.0}}requestParameters: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}Request{{/allParams.0}}): Promise<runtime.ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}>>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
{{#notes}}
|
||||||
|
* {{¬es}}
|
||||||
|
{{/notes}}
|
||||||
|
{{#summary}}
|
||||||
|
* {{&summary}}
|
||||||
|
{{/summary}}
|
||||||
|
*/
|
||||||
|
{{^useSingleRequestParameter}}
|
||||||
|
{{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{#isNullable}} | null{{/isNullable}}{{/isEnum}}{{#hasMore}}, {{/hasMore}}{{/allParams}}): Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}>;
|
||||||
|
{{/useSingleRequestParameter}}
|
||||||
|
{{#useSingleRequestParameter}}
|
||||||
|
{{nickname}}({{#allParams.0}}requestParameters: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}Request{{/allParams.0}}): Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}>;
|
||||||
|
{{/useSingleRequestParameter}}
|
||||||
|
|
||||||
|
{{/operation}}
|
||||||
|
}
|
||||||
|
|
||||||
|
{{/operations}}
|
||||||
|
{{/withInterfaces}}
|
||||||
{{#operations}}
|
{{#operations}}
|
||||||
/**
|
/**
|
||||||
* {{#description}}{{{description}}}{{/description}}{{^description}}no description{{/description}}
|
* {{#description}}{{{description}}}{{/description}}{{^description}}no description{{/description}}
|
||||||
*/
|
*/
|
||||||
|
{{#withInterfaces}}
|
||||||
|
export class {{classname}} extends runtime.BaseAPI implements {{classname}}Interface {
|
||||||
|
{{/withInterfaces}}
|
||||||
|
{{^withInterfaces}}
|
||||||
export class {{classname}} extends runtime.BaseAPI {
|
export class {{classname}} extends runtime.BaseAPI {
|
||||||
|
{{/withInterfaces}}
|
||||||
|
|
||||||
{{#operation}}
|
{{#operation}}
|
||||||
/**
|
/**
|
||||||
|
@ -60,10 +60,146 @@ export interface UploadFileRequest {
|
|||||||
file?: Blob;
|
file?: Blob;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PetApi - interface
|
||||||
|
* @export
|
||||||
|
* @interface PetApiInterface
|
||||||
|
*/
|
||||||
|
export interface PetApiInterface {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @summary Add a new pet to the store
|
||||||
|
* @param {Pet} body Pet object that needs to be added to the store
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
* @memberof PetApiInterface
|
||||||
|
*/
|
||||||
|
addPetRaw(requestParameters: AddPetRequest): Promise<runtime.ApiResponse<void>>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a new pet to the store
|
||||||
|
*/
|
||||||
|
addPet(requestParameters: AddPetRequest): Promise<void>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @summary Deletes a pet
|
||||||
|
* @param {number} petId Pet id to delete
|
||||||
|
* @param {string} [apiKey]
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
* @memberof PetApiInterface
|
||||||
|
*/
|
||||||
|
deletePetRaw(requestParameters: DeletePetRequest): Promise<runtime.ApiResponse<void>>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes a pet
|
||||||
|
*/
|
||||||
|
deletePet(requestParameters: DeletePetRequest): Promise<void>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Multiple status values can be provided with comma separated strings
|
||||||
|
* @summary Finds Pets by status
|
||||||
|
* @param {Array<'available' | 'pending' | 'sold'>} status Status values that need to be considered for filter
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
* @memberof PetApiInterface
|
||||||
|
*/
|
||||||
|
findPetsByStatusRaw(requestParameters: FindPetsByStatusRequest): Promise<runtime.ApiResponse<Array<Pet>>>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Multiple status values can be provided with comma separated strings
|
||||||
|
* Finds Pets by status
|
||||||
|
*/
|
||||||
|
findPetsByStatus(requestParameters: FindPetsByStatusRequest): Promise<Array<Pet>>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||||
|
* @summary Finds Pets by tags
|
||||||
|
* @param {Array<string>} tags Tags to filter by
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
* @memberof PetApiInterface
|
||||||
|
*/
|
||||||
|
findPetsByTagsRaw(requestParameters: FindPetsByTagsRequest): Promise<runtime.ApiResponse<Array<Pet>>>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||||
|
* Finds Pets by tags
|
||||||
|
*/
|
||||||
|
findPetsByTags(requestParameters: FindPetsByTagsRequest): Promise<Array<Pet>>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a single pet
|
||||||
|
* @summary Find pet by ID
|
||||||
|
* @param {number} petId ID of pet to return
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
* @memberof PetApiInterface
|
||||||
|
*/
|
||||||
|
getPetByIdRaw(requestParameters: GetPetByIdRequest): Promise<runtime.ApiResponse<Pet>>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a single pet
|
||||||
|
* Find pet by ID
|
||||||
|
*/
|
||||||
|
getPetById(requestParameters: GetPetByIdRequest): Promise<Pet>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @summary Update an existing pet
|
||||||
|
* @param {Pet} body Pet object that needs to be added to the store
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
* @memberof PetApiInterface
|
||||||
|
*/
|
||||||
|
updatePetRaw(requestParameters: UpdatePetRequest): Promise<runtime.ApiResponse<void>>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update an existing pet
|
||||||
|
*/
|
||||||
|
updatePet(requestParameters: UpdatePetRequest): Promise<void>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @summary Updates a pet in the store with form data
|
||||||
|
* @param {number} petId ID of pet that needs to be updated
|
||||||
|
* @param {string} [name] Updated name of the pet
|
||||||
|
* @param {string} [status] Updated status of the pet
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
* @memberof PetApiInterface
|
||||||
|
*/
|
||||||
|
updatePetWithFormRaw(requestParameters: UpdatePetWithFormRequest): Promise<runtime.ApiResponse<void>>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates a pet in the store with form data
|
||||||
|
*/
|
||||||
|
updatePetWithForm(requestParameters: UpdatePetWithFormRequest): Promise<void>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @summary uploads an image
|
||||||
|
* @param {number} petId ID of pet to update
|
||||||
|
* @param {string} [additionalMetadata] Additional data to pass to server
|
||||||
|
* @param {Blob} [file] file to upload
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
* @memberof PetApiInterface
|
||||||
|
*/
|
||||||
|
uploadFileRaw(requestParameters: UploadFileRequest): Promise<runtime.ApiResponse<ModelApiResponse>>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* uploads an image
|
||||||
|
*/
|
||||||
|
uploadFile(requestParameters: UploadFileRequest): Promise<ModelApiResponse>;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* no description
|
* no description
|
||||||
*/
|
*/
|
||||||
export class PetApi extends runtime.BaseAPI {
|
export class PetApi extends runtime.BaseAPI implements PetApiInterface {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a new pet to the store
|
* Add a new pet to the store
|
||||||
|
@ -32,10 +32,80 @@ export interface PlaceOrderRequest {
|
|||||||
body: Order;
|
body: Order;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* StoreApi - interface
|
||||||
|
* @export
|
||||||
|
* @interface StoreApiInterface
|
||||||
|
*/
|
||||||
|
export interface StoreApiInterface {
|
||||||
|
/**
|
||||||
|
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||||
|
* @summary Delete purchase order by ID
|
||||||
|
* @param {string} orderId ID of the order that needs to be deleted
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
* @memberof StoreApiInterface
|
||||||
|
*/
|
||||||
|
deleteOrderRaw(requestParameters: DeleteOrderRequest): Promise<runtime.ApiResponse<void>>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||||
|
* Delete purchase order by ID
|
||||||
|
*/
|
||||||
|
deleteOrder(requestParameters: DeleteOrderRequest): Promise<void>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a map of status codes to quantities
|
||||||
|
* @summary Returns pet inventories by status
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
* @memberof StoreApiInterface
|
||||||
|
*/
|
||||||
|
getInventoryRaw(): Promise<runtime.ApiResponse<{ [key: string]: number; }>>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a map of status codes to quantities
|
||||||
|
* Returns pet inventories by status
|
||||||
|
*/
|
||||||
|
getInventory(): Promise<{ [key: string]: number; }>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||||
|
* @summary Find purchase order by ID
|
||||||
|
* @param {number} orderId ID of pet that needs to be fetched
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
* @memberof StoreApiInterface
|
||||||
|
*/
|
||||||
|
getOrderByIdRaw(requestParameters: GetOrderByIdRequest): Promise<runtime.ApiResponse<Order>>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||||
|
* Find purchase order by ID
|
||||||
|
*/
|
||||||
|
getOrderById(requestParameters: GetOrderByIdRequest): Promise<Order>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @summary Place an order for a pet
|
||||||
|
* @param {Order} body order placed for purchasing the pet
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
* @memberof StoreApiInterface
|
||||||
|
*/
|
||||||
|
placeOrderRaw(requestParameters: PlaceOrderRequest): Promise<runtime.ApiResponse<Order>>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Place an order for a pet
|
||||||
|
*/
|
||||||
|
placeOrder(requestParameters: PlaceOrderRequest): Promise<Order>;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* no description
|
* no description
|
||||||
*/
|
*/
|
||||||
export class StoreApi extends runtime.BaseAPI {
|
export class StoreApi extends runtime.BaseAPI implements StoreApiInterface {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||||
|
@ -50,10 +50,142 @@ export interface UpdateUserRequest {
|
|||||||
body: User;
|
body: User;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* UserApi - interface
|
||||||
|
* @export
|
||||||
|
* @interface UserApiInterface
|
||||||
|
*/
|
||||||
|
export interface UserApiInterface {
|
||||||
|
/**
|
||||||
|
* This can only be done by the logged in user.
|
||||||
|
* @summary Create user
|
||||||
|
* @param {User} body Created user object
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
* @memberof UserApiInterface
|
||||||
|
*/
|
||||||
|
createUserRaw(requestParameters: CreateUserRequest): Promise<runtime.ApiResponse<void>>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This can only be done by the logged in user.
|
||||||
|
* Create user
|
||||||
|
*/
|
||||||
|
createUser(requestParameters: CreateUserRequest): Promise<void>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @summary Creates list of users with given input array
|
||||||
|
* @param {Array<User>} body List of user object
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
* @memberof UserApiInterface
|
||||||
|
*/
|
||||||
|
createUsersWithArrayInputRaw(requestParameters: CreateUsersWithArrayInputRequest): Promise<runtime.ApiResponse<void>>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates list of users with given input array
|
||||||
|
*/
|
||||||
|
createUsersWithArrayInput(requestParameters: CreateUsersWithArrayInputRequest): Promise<void>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @summary Creates list of users with given input array
|
||||||
|
* @param {Array<User>} body List of user object
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
* @memberof UserApiInterface
|
||||||
|
*/
|
||||||
|
createUsersWithListInputRaw(requestParameters: CreateUsersWithListInputRequest): Promise<runtime.ApiResponse<void>>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates list of users with given input array
|
||||||
|
*/
|
||||||
|
createUsersWithListInput(requestParameters: CreateUsersWithListInputRequest): Promise<void>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This can only be done by the logged in user.
|
||||||
|
* @summary Delete user
|
||||||
|
* @param {string} username The name that needs to be deleted
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
* @memberof UserApiInterface
|
||||||
|
*/
|
||||||
|
deleteUserRaw(requestParameters: DeleteUserRequest): Promise<runtime.ApiResponse<void>>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This can only be done by the logged in user.
|
||||||
|
* Delete user
|
||||||
|
*/
|
||||||
|
deleteUser(requestParameters: DeleteUserRequest): Promise<void>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @summary Get user by user name
|
||||||
|
* @param {string} username The name that needs to be fetched. Use user1 for testing.
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
* @memberof UserApiInterface
|
||||||
|
*/
|
||||||
|
getUserByNameRaw(requestParameters: GetUserByNameRequest): Promise<runtime.ApiResponse<User>>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get user by user name
|
||||||
|
*/
|
||||||
|
getUserByName(requestParameters: GetUserByNameRequest): Promise<User>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @summary Logs user into the system
|
||||||
|
* @param {string} username The user name for login
|
||||||
|
* @param {string} password The password for login in clear text
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
* @memberof UserApiInterface
|
||||||
|
*/
|
||||||
|
loginUserRaw(requestParameters: LoginUserRequest): Promise<runtime.ApiResponse<string>>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logs user into the system
|
||||||
|
*/
|
||||||
|
loginUser(requestParameters: LoginUserRequest): Promise<string>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @summary Logs out current logged in user session
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
* @memberof UserApiInterface
|
||||||
|
*/
|
||||||
|
logoutUserRaw(): Promise<runtime.ApiResponse<void>>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logs out current logged in user session
|
||||||
|
*/
|
||||||
|
logoutUser(): Promise<void>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This can only be done by the logged in user.
|
||||||
|
* @summary Updated user
|
||||||
|
* @param {string} username name that need to be deleted
|
||||||
|
* @param {User} body Updated user object
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
* @memberof UserApiInterface
|
||||||
|
*/
|
||||||
|
updateUserRaw(requestParameters: UpdateUserRequest): Promise<runtime.ApiResponse<void>>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This can only be done by the logged in user.
|
||||||
|
* Updated user
|
||||||
|
*/
|
||||||
|
updateUser(requestParameters: UpdateUserRequest): Promise<void>;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* no description
|
* no description
|
||||||
*/
|
*/
|
||||||
export class UserApi extends runtime.BaseAPI {
|
export class UserApi extends runtime.BaseAPI implements UserApiInterface {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This can only be done by the logged in user.
|
* This can only be done by the logged in user.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user