mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-05 23:20:52 +00:00
[cpp][qt] Start cleanup of cpp qt readme (#10549)
* Update Qt cpp readme * update sample * Update indentation and codeblocks * More cleanup of duplicate/dead content
This commit is contained in:
parent
3d0d1d5ed8
commit
5defb9a353
@ -1,3 +1,5 @@
|
|||||||
|
# C++ Qt API client
|
||||||
|
|
||||||
# {{artifactId}}
|
# {{artifactId}}
|
||||||
|
|
||||||
{{appName}}
|
{{appName}}
|
||||||
@ -16,55 +18,18 @@
|
|||||||
|
|
||||||
*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)*
|
*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)*
|
||||||
|
|
||||||
## Licence
|
|
||||||
|
|
||||||
{{licenseInfo}}
|
|
||||||
|
|
||||||
for more information visit [{{licenseInfo}}]({{licenseUrl}})
|
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
Building the API client library requires:
|
Building the API client library requires:
|
||||||
|
|
||||||
1. Java {{#supportJava6}}1.6{{/supportJava6}}{{^supportJava6}}{{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}}{{/supportJava6}}+
|
1. CMake 3.2+
|
||||||
2. Maven/Gradle
|
2. Qt
|
||||||
|
3. C++ Compiler
|
||||||
## Installation
|
|
||||||
|
|
||||||
To install the API client library to your local Maven repository, simply execute:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
mvn clean install
|
|
||||||
```
|
|
||||||
|
|
||||||
To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
mvn clean deploy
|
|
||||||
```
|
|
||||||
|
|
||||||
Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information.
|
|
||||||
|
|
||||||
### Generate manually
|
|
||||||
|
|
||||||
At first generate the JAR by executing:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
mvn clean package
|
|
||||||
```
|
|
||||||
|
|
||||||
Use the Jar file to generate the Qt Client:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
java -jar target/openapi-generator-cli.jar generate -i <yourOpenApiFile> -g cpp-qt-client -o <outputDir>
|
|
||||||
```
|
|
||||||
|
|
||||||
## Getting Started
|
## Getting Started
|
||||||
|
|
||||||
Please follow the [installation](#installation) instruction and execute the following Java code:
|
|
||||||
|
|
||||||
example.h:
|
example.h:
|
||||||
|
|
||||||
```c++
|
```c++
|
||||||
{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}
|
{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@ -82,8 +47,8 @@ public slots:
|
|||||||
};
|
};
|
||||||
{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
|
{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
|
||||||
```
|
```
|
||||||
example.cpp:
|
|
||||||
|
|
||||||
|
example.cpp:
|
||||||
```c++
|
```c++
|
||||||
{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}
|
{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}
|
||||||
#include "../client/{{{classname}}}.h"
|
#include "../client/{{{classname}}}.h"
|
||||||
@ -132,25 +97,11 @@ void Example::exampleFunction1(){
|
|||||||
{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
|
{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Documentation for API Endpoints
|
|
||||||
|
|
||||||
All URIs are relative to *{{basePath}}*
|
|
||||||
|
|
||||||
Class | Method | HTTP request | Description
|
|
||||||
------------ | ------------- | ------------- | -------------
|
|
||||||
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{commonPath}}{{path}} | {{summary}}
|
|
||||||
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
|
|
||||||
|
|
||||||
## Documentation for Models
|
|
||||||
|
|
||||||
{{#models}}{{#model}} - [{{classname}}]({{modelDocPath}}{{classname}}.md)
|
|
||||||
{{/model}}{{/models}}
|
|
||||||
|
|
||||||
## Documentation for Servers
|
## Documentation for Servers
|
||||||
|
|
||||||
Parameterized Servers are supported. Define a server in the API for each endpoint with arbitrary numbers of variables:
|
Parameterized Servers are supported. Define a server in the API for each endpoint with arbitrary numbers of variables:
|
||||||
|
|
||||||
```
|
```yaml
|
||||||
servers:
|
servers:
|
||||||
- url: http://{server}:{port}/{basePath}
|
- url: http://{server}:{port}/{basePath}
|
||||||
description: Description of the Server
|
description: Description of the Server
|
||||||
@ -170,20 +121,20 @@ servers:
|
|||||||
default: v1
|
default: v1
|
||||||
```
|
```
|
||||||
To change the default variable, use this function in each Api:
|
To change the default variable, use this function in each Api:
|
||||||
```
|
```c++
|
||||||
int setDefaultServerValue(int serverIndex,const QString &operation, const QString &variable,const QString &val);
|
int setDefaultServerValue(int serverIndex,const QString &operation, const QString &variable,const QString &val);
|
||||||
```
|
```
|
||||||
The parameter "serverIndex" will choose a server from the server list for each endpoint. There is always at least one server with index 0. The Parameter "operation" should be the desired endpoint operationid.
|
The parameter "serverIndex" will choose a server from the server list for each endpoint. There is always at least one server with index 0. The Parameter "operation" should be the desired endpoint operationid.
|
||||||
Variable is the name of the variable you wish to change and the value is the new default Value.
|
Variable is the name of the variable you wish to change and the value is the new default Value.
|
||||||
The function will return -1 when the variable does not exists, -2 if value is not defined in the variable enum and -3 if the operation is not found.
|
The function will return -1 when the variable does not exists, -2 if value is not defined in the variable enum and -3 if the operation is not found.
|
||||||
|
|
||||||
If your endpoint has multiple server objects in the servers array, you can set the server that will be used with this function:
|
If your endpoint has multiple server objects in the servers array, you can set the server that will be used with this function:
|
||||||
```
|
```c++
|
||||||
void setServerIndex(const QString &operation, int serverIndex);
|
void setServerIndex(const QString &operation, int serverIndex);
|
||||||
```
|
```
|
||||||
Parameter "operation" should be your operationid. "serverIndex" is the index you want to set as your default server. The function will check if there is a server with your index.
|
Parameter "operation" should be your operationid. "serverIndex" is the index you want to set as your default server. The function will check if there is a server with your index.
|
||||||
Here is an example of multiple servers in the servers array. The first server will have index 0 and the second will have index 1.
|
Here is an example of multiple servers in the servers array. The first server will have index 0 and the second will have index 1.
|
||||||
```
|
```yaml
|
||||||
servers:
|
servers:
|
||||||
- url: http://{server}:8080/
|
- url: http://{server}:8080/
|
||||||
description: Description of the Server
|
description: Description of the Server
|
||||||
@ -197,7 +148,6 @@ servers:
|
|||||||
- url: https://localhost:8080/v1
|
- url: https://localhost:8080/v1
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## Documentation for Authorization
|
## Documentation for Authorization
|
||||||
|
|
||||||
{{^authMethods}}All endpoints do not require authorization.
|
{{^authMethods}}All endpoints do not require authorization.
|
||||||
@ -233,3 +183,7 @@ servers:
|
|||||||
|
|
||||||
{{#apiInfo}}{{#apis}}{{#-last}}{{infoEmail}}
|
{{#apiInfo}}{{#apis}}{{#-last}}{{infoEmail}}
|
||||||
{{/-last}}{{/apis}}{{/apiInfo}}
|
{{/-last}}{{/apis}}{{/apiInfo}}
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
{{licenseInfo}} for more information visit [{{licenseInfo}}]({{licenseUrl}})
|
@ -1,3 +1,5 @@
|
|||||||
|
# C++ Qt API client
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
||||||
OpenAPI Petstore
|
OpenAPI Petstore
|
||||||
@ -9,55 +11,18 @@ This is a sample server Petstore server. For this sample, you can use the api ke
|
|||||||
|
|
||||||
*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)*
|
*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)*
|
||||||
|
|
||||||
## Licence
|
|
||||||
|
|
||||||
Apache-2.0
|
|
||||||
|
|
||||||
for more information visit [Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0.html)
|
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
Building the API client library requires:
|
Building the API client library requires:
|
||||||
|
|
||||||
1. Java 1.7+
|
1. CMake 3.2+
|
||||||
2. Maven/Gradle
|
2. Qt
|
||||||
|
3. C++ Compiler
|
||||||
## Installation
|
|
||||||
|
|
||||||
To install the API client library to your local Maven repository, simply execute:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
mvn clean install
|
|
||||||
```
|
|
||||||
|
|
||||||
To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
mvn clean deploy
|
|
||||||
```
|
|
||||||
|
|
||||||
Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information.
|
|
||||||
|
|
||||||
### Generate manually
|
|
||||||
|
|
||||||
At first generate the JAR by executing:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
mvn clean package
|
|
||||||
```
|
|
||||||
|
|
||||||
Use the Jar file to generate the Qt Client:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
java -jar target/openapi-generator-cli.jar generate -i <yourOpenApiFile> -g cpp-qt-client -o <outputDir>
|
|
||||||
```
|
|
||||||
|
|
||||||
## Getting Started
|
## Getting Started
|
||||||
|
|
||||||
Please follow the [installation](#installation) instruction and execute the following Java code:
|
|
||||||
|
|
||||||
example.h:
|
example.h:
|
||||||
|
|
||||||
```c++
|
```c++
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@ -73,8 +38,8 @@ public slots:
|
|||||||
};
|
};
|
||||||
|
|
||||||
```
|
```
|
||||||
example.cpp:
|
|
||||||
|
|
||||||
|
example.cpp:
|
||||||
```c++
|
```c++
|
||||||
|
|
||||||
#include "../client/PFXPetApi.h"
|
#include "../client/PFXPetApi.h"
|
||||||
@ -109,49 +74,11 @@ void Example::exampleFunction1(){
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Documentation for API Endpoints
|
|
||||||
|
|
||||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
|
||||||
|
|
||||||
Class | Method | HTTP request | Description
|
|
||||||
------------ | ------------- | ------------- | -------------
|
|
||||||
*PFXPetApi* | [**addPet**](PFXPetApi.md#addPet) | **POST** /pet | Add a new pet to the store
|
|
||||||
*PFXPetApi* | [**deletePet**](PFXPetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet
|
|
||||||
*PFXPetApi* | [**findPetsByStatus**](PFXPetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status
|
|
||||||
*PFXPetApi* | [**findPetsByTags**](PFXPetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags
|
|
||||||
*PFXPetApi* | [**getPetById**](PFXPetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID
|
|
||||||
*PFXPetApi* | [**updatePet**](PFXPetApi.md#updatePet) | **PUT** /pet | Update an existing pet
|
|
||||||
*PFXPetApi* | [**updatePetWithForm**](PFXPetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
|
||||||
*PFXPetApi* | [**uploadFile**](PFXPetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
|
|
||||||
*PFXStoreApi* | [**deleteOrder**](PFXStoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
|
|
||||||
*PFXStoreApi* | [**getInventory**](PFXStoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status
|
|
||||||
*PFXStoreApi* | [**getOrderById**](PFXStoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID
|
|
||||||
*PFXStoreApi* | [**placeOrder**](PFXStoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet
|
|
||||||
*PFXUserApi* | [**createUser**](PFXUserApi.md#createUser) | **POST** /user | Create user
|
|
||||||
*PFXUserApi* | [**createUsersWithArrayInput**](PFXUserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array
|
|
||||||
*PFXUserApi* | [**createUsersWithListInput**](PFXUserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array
|
|
||||||
*PFXUserApi* | [**deleteUser**](PFXUserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user
|
|
||||||
*PFXUserApi* | [**getUserByName**](PFXUserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name
|
|
||||||
*PFXUserApi* | [**loginUser**](PFXUserApi.md#loginUser) | **GET** /user/login | Logs user into the system
|
|
||||||
*PFXUserApi* | [**logoutUser**](PFXUserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session
|
|
||||||
*PFXUserApi* | [**updateUser**](PFXUserApi.md#updateUser) | **PUT** /user/{username} | Updated user
|
|
||||||
|
|
||||||
|
|
||||||
## Documentation for Models
|
|
||||||
|
|
||||||
- [PFXApiResponse](PFXApiResponse.md)
|
|
||||||
- [PFXCategory](PFXCategory.md)
|
|
||||||
- [PFXOrder](PFXOrder.md)
|
|
||||||
- [PFXPet](PFXPet.md)
|
|
||||||
- [PFXTag](PFXTag.md)
|
|
||||||
- [PFXUser](PFXUser.md)
|
|
||||||
|
|
||||||
|
|
||||||
## Documentation for Servers
|
## Documentation for Servers
|
||||||
|
|
||||||
Parameterized Servers are supported. Define a server in the API for each endpoint with arbitrary numbers of variables:
|
Parameterized Servers are supported. Define a server in the API for each endpoint with arbitrary numbers of variables:
|
||||||
|
|
||||||
```
|
```yaml
|
||||||
servers:
|
servers:
|
||||||
- url: http://{server}:{port}/{basePath}
|
- url: http://{server}:{port}/{basePath}
|
||||||
description: Description of the Server
|
description: Description of the Server
|
||||||
@ -171,20 +98,20 @@ servers:
|
|||||||
default: v1
|
default: v1
|
||||||
```
|
```
|
||||||
To change the default variable, use this function in each Api:
|
To change the default variable, use this function in each Api:
|
||||||
```
|
```c++
|
||||||
int setDefaultServerValue(int serverIndex,const QString &operation, const QString &variable,const QString &val);
|
int setDefaultServerValue(int serverIndex,const QString &operation, const QString &variable,const QString &val);
|
||||||
```
|
```
|
||||||
The parameter "serverIndex" will choose a server from the server list for each endpoint. There is always at least one server with index 0. The Parameter "operation" should be the desired endpoint operationid.
|
The parameter "serverIndex" will choose a server from the server list for each endpoint. There is always at least one server with index 0. The Parameter "operation" should be the desired endpoint operationid.
|
||||||
Variable is the name of the variable you wish to change and the value is the new default Value.
|
Variable is the name of the variable you wish to change and the value is the new default Value.
|
||||||
The function will return -1 when the variable does not exists, -2 if value is not defined in the variable enum and -3 if the operation is not found.
|
The function will return -1 when the variable does not exists, -2 if value is not defined in the variable enum and -3 if the operation is not found.
|
||||||
|
|
||||||
If your endpoint has multiple server objects in the servers array, you can set the server that will be used with this function:
|
If your endpoint has multiple server objects in the servers array, you can set the server that will be used with this function:
|
||||||
```
|
```c++
|
||||||
void setServerIndex(const QString &operation, int serverIndex);
|
void setServerIndex(const QString &operation, int serverIndex);
|
||||||
```
|
```
|
||||||
Parameter "operation" should be your operationid. "serverIndex" is the index you want to set as your default server. The function will check if there is a server with your index.
|
Parameter "operation" should be your operationid. "serverIndex" is the index you want to set as your default server. The function will check if there is a server with your index.
|
||||||
Here is an example of multiple servers in the servers array. The first server will have index 0 and the second will have index 1.
|
Here is an example of multiple servers in the servers array. The first server will have index 0 and the second will have index 1.
|
||||||
```
|
```yaml
|
||||||
servers:
|
servers:
|
||||||
- url: http://{server}:8080/
|
- url: http://{server}:8080/
|
||||||
description: Description of the Server
|
description: Description of the Server
|
||||||
@ -198,7 +125,6 @@ servers:
|
|||||||
- url: https://localhost:8080/v1
|
- url: https://localhost:8080/v1
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## Documentation for Authorization
|
## Documentation for Authorization
|
||||||
|
|
||||||
Authentication schemes defined for the API:
|
Authentication schemes defined for the API:
|
||||||
@ -224,3 +150,7 @@ Authentication schemes defined for the API:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
Apache-2.0 for more information visit [Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0.html)
|
Loading…
x
Reference in New Issue
Block a user