diff --git a/modules/swagger-codegen/src/main/resources/qt5cpp/api-body.mustache b/modules/swagger-codegen/src/main/resources/qt5cpp/api-body.mustache index 592c4158aeb9..b63411041881 100644 --- a/modules/swagger-codegen/src/main/resources/qt5cpp/api-body.mustache +++ b/modules/swagger-codegen/src/main/resources/qt5cpp/api-body.mustache @@ -22,20 +22,11 @@ void QString fullPath; fullPath.append(this->host).append(this->basePath).append("{{path}}"); - HttpRequestWorker *worker = new HttpRequestWorker(); - HttpRequestInput input(fullPath, "{{httpMethod}}"); - {{#pathParams}} QString {{paramName}}PathParam("{"); {{paramName}}PathParam.append("{{paramName}}").append("}"); fullPath.replace({{paramName}}PathParam, stringValue({{paramName}})); {{/pathParams}} - {{#formParams}}{{^isFile}} - if({{paramName}} != NULL) { - input.add_var("{{paramName}}", *{{paramName}}); - } - {{/isFile}}{{/formParams}} - {{#queryParams}} {{^collectionFormat}} if(fullPath.indexOf("?") > 0) @@ -91,6 +82,16 @@ void {{/collectionFormat}} {{/queryParams}} + + HttpRequestWorker *worker = new HttpRequestWorker(); + HttpRequestInput input(fullPath, "{{httpMethod}}"); + + {{#formParams}}{{^isFile}} + if({{paramName}} != NULL) { + input.add_var("{{paramName}}", *{{paramName}}); + } + {{/isFile}}{{/formParams}} + {{#bodyParams}} {{#isContainer}} QJsonArray* {{paramName}}Array = new QJsonArray(); @@ -104,7 +105,6 @@ void {{^isContainer}} QString output = {{paramName}}.asJson(); input.request_body.append(output); - {{/isContainer}}{{/bodyParams}} {{#headerParams}} diff --git a/samples/client/petstore/qt5cpp/client/SWGPet.h b/samples/client/petstore/qt5cpp/client/SWGPet.h index e9cb4d082331..3f9320f15074 100644 --- a/samples/client/petstore/qt5cpp/client/SWGPet.h +++ b/samples/client/petstore/qt5cpp/client/SWGPet.h @@ -10,10 +10,10 @@ #include -#include "SWGTag.h" -#include -#include "SWGCategory.h" #include +#include "SWGCategory.h" +#include +#include "SWGTag.h" #include "SWGObject.h" diff --git a/samples/client/petstore/qt5cpp/client/SWGPetApi.cpp b/samples/client/petstore/qt5cpp/client/SWGPetApi.cpp index eae6eb4e760b..af7b2371ebcc 100644 --- a/samples/client/petstore/qt5cpp/client/SWGPetApi.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGPetApi.cpp @@ -20,20 +20,20 @@ SWGPetApi::updatePet(SWGPet body) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/pet"); + + + + HttpRequestWorker *worker = new HttpRequestWorker(); HttpRequestInput input(fullPath, "PUT"); - - - QString output = body.asJson(); input.request_body.append(output); - @@ -68,20 +68,20 @@ SWGPetApi::addPet(SWGPet body) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/pet"); + + + + HttpRequestWorker *worker = new HttpRequestWorker(); HttpRequestInput input(fullPath, "POST"); - - - QString output = body.asJson(); input.request_body.append(output); - @@ -116,11 +116,6 @@ SWGPetApi::findPetsByStatus(QList* status) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/pet/findByStatus"); - HttpRequestWorker *worker = new HttpRequestWorker(); - HttpRequestInput input(fullPath, "GET"); - - - @@ -170,6 +165,12 @@ SWGPetApi::findPetsByStatus(QList* status) { + + HttpRequestWorker *worker = new HttpRequestWorker(); + HttpRequestInput input(fullPath, "GET"); + + + @@ -220,11 +221,6 @@ SWGPetApi::findPetsByTags(QList* tags) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/pet/findByTags"); - HttpRequestWorker *worker = new HttpRequestWorker(); - HttpRequestInput input(fullPath, "GET"); - - - @@ -274,6 +270,12 @@ SWGPetApi::findPetsByTags(QList* tags) { + + HttpRequestWorker *worker = new HttpRequestWorker(); + HttpRequestInput input(fullPath, "GET"); + + + @@ -324,9 +326,6 @@ SWGPetApi::getPetById(qint64 petId) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/pet/{petId}"); - HttpRequestWorker *worker = new HttpRequestWorker(); - HttpRequestInput input(fullPath, "GET"); - QString petIdPathParam("{"); petIdPathParam.append("petId").append("}"); fullPath.replace(petIdPathParam, stringValue(petId)); @@ -334,7 +333,11 @@ SWGPetApi::getPetById(qint64 petId) { + HttpRequestWorker *worker = new HttpRequestWorker(); + HttpRequestInput input(fullPath, "GET"); + + @@ -378,15 +381,17 @@ SWGPetApi::updatePetWithForm(QString* petId, QString* name, QString* status) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/pet/{petId}"); - HttpRequestWorker *worker = new HttpRequestWorker(); - HttpRequestInput input(fullPath, "POST"); - QString petIdPathParam("{"); petIdPathParam.append("petId").append("}"); fullPath.replace(petIdPathParam, stringValue(petId)); + + HttpRequestWorker *worker = new HttpRequestWorker(); + HttpRequestInput input(fullPath, "POST"); + + if(name != NULL) { input.add_var("name", *name); } @@ -397,7 +402,6 @@ SWGPetApi::updatePetWithForm(QString* petId, QString* name, QString* status) { - @@ -431,9 +435,6 @@ SWGPetApi::deletePet(QString* api_key, qint64 petId) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/pet/{petId}"); - HttpRequestWorker *worker = new HttpRequestWorker(); - HttpRequestInput input(fullPath, "DELETE"); - QString petIdPathParam("{"); petIdPathParam.append("petId").append("}"); fullPath.replace(petIdPathParam, stringValue(petId)); @@ -441,7 +442,11 @@ SWGPetApi::deletePet(QString* api_key, qint64 petId) { + HttpRequestWorker *worker = new HttpRequestWorker(); + HttpRequestInput input(fullPath, "DELETE"); + + @@ -478,22 +483,23 @@ SWGPetApi::uploadFile(qint64 petId, QString* additionalMetadata, SWGHttpRequestI QString fullPath; fullPath.append(this->host).append(this->basePath).append("/pet/{petId}/uploadImage"); - HttpRequestWorker *worker = new HttpRequestWorker(); - HttpRequestInput input(fullPath, "POST"); - QString petIdPathParam("{"); petIdPathParam.append("petId").append("}"); fullPath.replace(petIdPathParam, stringValue(petId)); + + HttpRequestWorker *worker = new HttpRequestWorker(); + HttpRequestInput input(fullPath, "POST"); + + if(additionalMetadata != NULL) { input.add_var("additionalMetadata", *additionalMetadata); } - diff --git a/samples/client/petstore/qt5cpp/client/SWGStoreApi.cpp b/samples/client/petstore/qt5cpp/client/SWGStoreApi.cpp index 49906842199e..be603573f621 100644 --- a/samples/client/petstore/qt5cpp/client/SWGStoreApi.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGStoreApi.cpp @@ -20,6 +20,10 @@ SWGStoreApi::getInventory() { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/store/inventory"); + + + + HttpRequestWorker *worker = new HttpRequestWorker(); HttpRequestInput input(fullPath, "GET"); @@ -28,9 +32,6 @@ SWGStoreApi::getInventory() { - - - connect(worker, &HttpRequestWorker::on_execution_finished, @@ -82,20 +83,20 @@ SWGStoreApi::placeOrder(SWGOrder body) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/store/order"); + + + + HttpRequestWorker *worker = new HttpRequestWorker(); HttpRequestInput input(fullPath, "POST"); - - - QString output = body.asJson(); input.request_body.append(output); - @@ -139,9 +140,6 @@ SWGStoreApi::getOrderById(QString* orderId) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/store/order/{orderId}"); - HttpRequestWorker *worker = new HttpRequestWorker(); - HttpRequestInput input(fullPath, "GET"); - QString orderIdPathParam("{"); orderIdPathParam.append("orderId").append("}"); fullPath.replace(orderIdPathParam, stringValue(orderId)); @@ -149,7 +147,11 @@ SWGStoreApi::getOrderById(QString* orderId) { + HttpRequestWorker *worker = new HttpRequestWorker(); + HttpRequestInput input(fullPath, "GET"); + + @@ -193,9 +195,6 @@ SWGStoreApi::deleteOrder(QString* orderId) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/store/order/{orderId}"); - HttpRequestWorker *worker = new HttpRequestWorker(); - HttpRequestInput input(fullPath, "DELETE"); - QString orderIdPathParam("{"); orderIdPathParam.append("orderId").append("}"); fullPath.replace(orderIdPathParam, stringValue(orderId)); @@ -203,7 +202,11 @@ SWGStoreApi::deleteOrder(QString* orderId) { + HttpRequestWorker *worker = new HttpRequestWorker(); + HttpRequestInput input(fullPath, "DELETE"); + + diff --git a/samples/client/petstore/qt5cpp/client/SWGUserApi.cpp b/samples/client/petstore/qt5cpp/client/SWGUserApi.cpp index 6f56ef2ebbbb..6341231a8840 100644 --- a/samples/client/petstore/qt5cpp/client/SWGUserApi.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGUserApi.cpp @@ -20,20 +20,20 @@ SWGUserApi::createUser(SWGUser body) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/user"); + + + + HttpRequestWorker *worker = new HttpRequestWorker(); HttpRequestInput input(fullPath, "POST"); - - - QString output = body.asJson(); input.request_body.append(output); - @@ -68,15 +68,16 @@ SWGUserApi::createUsersWithArrayInput(QList* body) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/user/createWithArray"); + + + + HttpRequestWorker *worker = new HttpRequestWorker(); HttpRequestInput input(fullPath, "POST"); - - - QJsonArray* bodyArray = new QJsonArray(); toJsonArray((QList*)body, bodyArray, QString("body"), QString("SWGUser*")); @@ -120,15 +121,16 @@ SWGUserApi::createUsersWithListInput(QList* body) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/user/createWithList"); + + + + HttpRequestWorker *worker = new HttpRequestWorker(); HttpRequestInput input(fullPath, "POST"); - - - QJsonArray* bodyArray = new QJsonArray(); toJsonArray((QList*)body, bodyArray, QString("body"), QString("SWGUser*")); @@ -172,11 +174,6 @@ SWGUserApi::loginUser(QString* username, QString* password) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/user/login"); - HttpRequestWorker *worker = new HttpRequestWorker(); - HttpRequestInput input(fullPath, "GET"); - - - @@ -204,6 +201,12 @@ SWGUserApi::loginUser(QString* username, QString* password) { + + HttpRequestWorker *worker = new HttpRequestWorker(); + HttpRequestInput input(fullPath, "GET"); + + + @@ -247,6 +250,10 @@ SWGUserApi::logoutUser() { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/user/logout"); + + + + HttpRequestWorker *worker = new HttpRequestWorker(); HttpRequestInput input(fullPath, "GET"); @@ -255,9 +262,6 @@ SWGUserApi::logoutUser() { - - - connect(worker, &HttpRequestWorker::on_execution_finished, @@ -289,9 +293,6 @@ SWGUserApi::getUserByName(QString* username) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/user/{username}"); - HttpRequestWorker *worker = new HttpRequestWorker(); - HttpRequestInput input(fullPath, "GET"); - QString usernamePathParam("{"); usernamePathParam.append("username").append("}"); fullPath.replace(usernamePathParam, stringValue(username)); @@ -299,7 +300,11 @@ SWGUserApi::getUserByName(QString* username) { + HttpRequestWorker *worker = new HttpRequestWorker(); + HttpRequestInput input(fullPath, "GET"); + + @@ -343,9 +348,6 @@ SWGUserApi::updateUser(QString* username, SWGUser body) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/user/{username}"); - HttpRequestWorker *worker = new HttpRequestWorker(); - HttpRequestInput input(fullPath, "PUT"); - QString usernamePathParam("{"); usernamePathParam.append("username").append("}"); fullPath.replace(usernamePathParam, stringValue(username)); @@ -353,13 +355,16 @@ SWGUserApi::updateUser(QString* username, SWGUser body) { + HttpRequestWorker *worker = new HttpRequestWorker(); + HttpRequestInput input(fullPath, "PUT"); + + QString output = body.asJson(); input.request_body.append(output); - @@ -394,9 +399,6 @@ SWGUserApi::deleteUser(QString* username) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/user/{username}"); - HttpRequestWorker *worker = new HttpRequestWorker(); - HttpRequestInput input(fullPath, "DELETE"); - QString usernamePathParam("{"); usernamePathParam.append("username").append("}"); fullPath.replace(usernamePathParam, stringValue(username)); @@ -404,7 +406,11 @@ SWGUserApi::deleteUser(QString* username) { + HttpRequestWorker *worker = new HttpRequestWorker(); + HttpRequestInput input(fullPath, "DELETE"); + +