Skip to content

[typescript-fetch] add interfaces, withInterfaces #5612

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,60 @@ export interface {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterIn
{{/allParams.0}}
{{/operation}}
{{/operations}}
{{#withInterfaces}}
{{#operations}}
/**
* {{classname}} - interface{{#description}}
* {{&description}}{{/description}}
* @export
* @interface {{classname}}Interface
*/
export interface {{classname}}Interface {
{{#operation}}
/**
* {{&notes}}
{{#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}}
* {{&notes}}
{{/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}}
/**
* {{#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 {
{{/withInterfaces}}

{{#operation}}
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,146 @@ export interface UploadFileRequest {
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
*/
export class PetApi extends runtime.BaseAPI {
export class PetApi extends runtime.BaseAPI implements PetApiInterface {

/**
* Add a new pet to the store
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,80 @@ export interface PlaceOrderRequest {
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
*/
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
Expand Down
Loading