Revision control

+ # C++ Qt6API client
+
+ {{appName}}
+
+ - API version: {{appVersion}}
+ {{^hideGenerationTimestamp}}
+ - Build date: {{generatedDate}}
+ {{/hideGenerationTimestamp}}
+ - Generator version: {{generatorVersion}}
+
+ {{{appDescriptionWithNewLines}}}
+
+ {{#infoUrl}}
+ For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
+ {{/infoUrl}}
+
+ *Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)*
+
+
+ ## Requirements
+
+ Building the API client library requires:
+
+ 1. CMake 3.16+
+ 2. Qt 6.8+
+ 3. C++17 Compiler
+
+ ## Getting Started
+
+ # Documentation for {{#openAPI}}{{#info}}{{title}} {{version}} Qt6 Client Cpp{{/info}}{{/openAPI}}
+ All URIs are relative to {{{scheme}}}://{{{host}}}{{{basePath}}}
+ {{#apiInfo}}{{#apis}}{{#operations}}
+ ### {{classname}}
+ |Method | HTTP request | Description|
+ |------------- | ------------- | -------------|
+ {{#operation}}
+ |*{{operationId}}* | *{{httpMethod}}* {{{path}}} | {{{summary}}}.|
+ {{/operation}}
+ {{/operations}}{{/apis}}{{/apiInfo}}
+
+ ## What are the Model files for the data structures/objects?
+ |Class | Description|
+ |------------- | -------------|
+ {{#models}}{{#model}}|*{{classname}}* | {{{description}}}|
+ {{/model}}{{/models}}
+
+ main.cpp:
+ ```
+ {{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}
+ #include "../client/{{{classname}}}.h"
+
+ int main(int argc, char *argv[]) {
+ QCoreApplication a(argc, argv);
+ {{#allParams}}{{{dataType}}} {{{paramName}}};{{/allParams}}
+ {{{classname}}} apiInstance;
+ {{#hasAuthMethods}}{{#authMethods}}{{#isBasic}}{{#isBasicBasic}}
+ /* Configure HTTP basic authorization: {{{name}}} */
+ apiInstance.setUsername("YOUR USERNAME");
+ apiInstance.setPassword("YOUR PASSWORD");{{/isBasicBasic}}{{#isBasicBearer}}
+ /* Configure HTTP bearer authorization: {{{name}}} */
+ apiInstance.setBearerToken("BEARER TOKEN");{{/isBasicBearer}}{{#isHttpSignature}}
+ /*
+ No Http Signature Authentication supported right now{{/isHttpSignature}}{{/isBasic}}{{#isApiKey}}
+ Configure API key authorization: {{{name}}}
+ */
+ apiInstance.setApiKey("YOUR API KEY NAME","YOUR API KEY");
+ {{/isApiKey}}
+ {{/authMethods}}
+ {{/hasAuthMethods}}
+
+ {{#allParams}}
+
+ /*
+ Handle the '{{nickname}}()' operation response directly in the callback.
+ Note, the callback should always have the 'QRestReply &reply' as first parameter.
+ The second and subsequent parameters are defined by the 'response' field of operation in your yaml specification.
+ */
+ apiInstance.{{nickname}}({{{paramName}}}, nullptr, [&](QRestReply &reply{{#returnType}}, {{{.}}} summary{{/returnType}}) {
+ if (reply.isSuccess())
+ {{#returnType}}qDebug() << "The server response is: " << summary.asJson();{{/returnType}}
+ // Proceed with handling the user logic.
+ else
+ qWarning() << "There is an error occurred: " << reply.error();
+ });
+
+ /*
+ Or connect to the operation response '{{nickname}}Finished()/{{nickname}}ErrorOccurred()' signals
+ And call the operation '{{nickname}}()'
+ */
+ connect(&apiInstance, &{{{classname}}}::{{nickname}}Finished, [&]({{#returnType}}{{{.}}} summary{{/returnType}}) {
+ // handling the user logic
+ });
+ connect(&apiInstance, &{{{classname}}}::{{nickname}}ErrorOccurred, [&](QNetworkReply::NetworkError errorType, const QString &errorStr) {
+ qWarning() << "There is an error occurred: " << errorType << errorStr;
+ });
+ apiInstance.{{nickname}}({{{paramName}}});
+ {{/allParams}}
+ return a.exec();
+ }
+ {{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
+ ```{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}{{#enableQmlCode}}main.qml:
+ ```qml
+ import QtQuick
+ import client
+
+ Item {
+ id: root
+ {{#allParams}}property data{{{dataType}}} {{{paramName}}};{{/allParams}}
+ {{{classname}}} {
+ id: apiInstance
+ {{#hasAuthMethods}}{{#authMethods}}{{#isBasic}}{{#isBasicBasic}}
+ Component.onCompleted: {
+ // Configure HTTP basic authorization: {{{name}}}
+ apiInstance.setUsername("YOUR USERNAME");
+ apiInstance.setPassword("YOUR PASSWORD");{{/isBasicBasic}}{{#isBasicBearer}}
+ // Configure HTTP bearer authorization: {{{name}}}
+ apiInstance.setBearerToken("BEARER TOKEN");{{/isBasicBearer}}{{#isHttpSignature}}
+ //No Http Signature Authentication supported right now
+ {{/isHttpSignature}}{{/isBasic}}
+ {{#isApiKey}}
+ // Configure API key authorization: {{{name}}}
+ apiInstance.setApiKey("YOUR API KEY NAME","YOUR API KEY");{{/isApiKey}}
+ }
+ {{/authMethods}}{{/hasAuthMethods}}
+ }
+ Button {
+ onClicked:{{#allParams}}
+ apiInstance.{{nickname}}({{{paramName}}});
+ }{{/allParams}}
+ {{#allParams}}Connections {
+ target: apiInstance
+ function onAddPetFinished(summary) {
+ // do user logic
+ }
+ function onAddPetErrorOccurred(errorCode, errorString) {
+ console.log("The error occured. Code:" + errorCode + " error string is " + errorString)
+ }
+ }{{/allParams}}
+ }
+ ```{{/enableQmlCode}}{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
+
+ ## Documentation for Servers
+
+ Parameterized Servers are supported. Define a server in the API for each endpoint with arbitrary numbers of variables:
+
+ ```
+ *.yaml:
+
+ servers:
+ description: Description of the Server
+ variables:
+ server:
+ enum:
+ - 'main-server'
+ - 'qa-server'
+ - 'dev-server'
+ default: 'main-server'
+ port:
+ enum:
+ - '3000'
+ - '1000'
+ default: '3000'
+ basePath:
+ default: v1
+ ```
+ To change the default variable, use this function in each Api:
+ ```
+ 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.
+ 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.
+
+ If your endpoint has multiple server objects in the servers array, you can set the server that will be used with this function:
+ ```
+ 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.
+ 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:
+ description: Description of the Server
+ variables:
+ server:
+ enum:
+ - 'main-server'
+ - 'qa-server'
+ - 'dev-server'
+ default: 'main-server'
+ ```
+
+ ## Documentation for Authorization
+
+ {{^authMethods}}All endpoints do not require authorization.
+ {{/authMethods}}Authentication schemes defined for the API:
+ {{#authMethods}}### {{name}}
+
+ {{#isApiKey}}
+
+ - **Type**: API key
+ - **API key parameter name**: {{keyParamName}}
+ - **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
+ {{/isApiKey}}
+ {{#isBasicBasic}}
+
+ - **Type**: HTTP basic authentication
+ {{/isBasicBasic}}
+ {{#isBasicBearer}}
+
+ - **Type**: HTTP Bearer Token authentication{{#bearerFormat}} ({{{.}}}){{/bearerFormat}}
+ {{/isBasicBearer}}
+ {{#isHttpSignature}}
+
+ - **Type**: HTTP signature authentication
+ {{/isHttpSignature}}
+ {{#isOAuth}}
+
+ - **Type**: OAuth
+ - **Flow**: {{flow}}
+ - **Authorization URL**: {{authorizationUrl}}
+ - **Scopes**: {{^scopes}}N/A{{/scopes}}
+ {{#scopes}} - {{scope}}: {{description}}
+ {{/scopes}}
+ {{/isOAuth}}
+
+ {{/authMethods}}
+
+ ## Author
+
+ {{#apiInfo}}{{#apis}}{{#-last}}{{infoEmail}}
+ {{/-last}}{{/apis}}{{/apiInfo}}
+
+ ## License
+
+ {{licenseInfo}} for more information visit [{{licenseInfo}}]({{licenseUrl}})