diff --git a/bin/cpp-qt5-petstore.sh b/bin/cpp-qt5-petstore.sh index ee4f3111997..68760f66505 100755 --- a/bin/cpp-qt5-petstore.sh +++ b/bin/cpp-qt5-petstore.sh @@ -27,6 +27,11 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/cpp-qt5-client -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g cpp-qt5-client -o samples/client/petstore/cpp-qt5 $@" +args="generate -t modules/openapi-generator/src/main/resources/cpp-qt5-client \ + -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml \ + -g cpp-qt5-client \ + --additional-properties=cppNamespace=test_namespace \ + --additional-properties=modelNamePrefix=PFX \ + -o samples/client/petstore/cpp-qt5 $@" -java $JAVA_OPTS -jar $executable $ags +java $JAVA_OPTS -jar $executable $args diff --git a/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpRequest.cpp.mustache b/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpRequest.cpp.mustache index 58f2398dfeb..1d219fa67e8 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpRequest.cpp.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpRequest.cpp.mustache @@ -83,7 +83,7 @@ QMap {{prefix}}HttpRequestWorker::getResponseHeaders() const { return files[fieldname]; } } - return OAIHttpFileElement(); + return {{prefix}}HttpFileElement(); } QByteArray *{{prefix}}HttpRequestWorker::getMultiPartField(const QString &fieldname){ diff --git a/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpRequest.h.mustache b/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpRequest.h.mustache index 5138113d7dc..28e5f519a29 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpRequest.h.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpRequest.h.mustache @@ -70,7 +70,7 @@ signals: private: QNetworkAccessManager *manager; QMap headers; - QMap files; + QMap files; QMap multiPartFields; QString workingDirectory; int timeout; diff --git a/modules/openapi-generator/src/main/resources/cpp-qt5-client/helpers-header.mustache b/modules/openapi-generator/src/main/resources/cpp-qt5-client/helpers-header.mustache index 88122014373..d68d1d23a89 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt5-client/helpers-header.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt5-client/helpers-header.mustache @@ -51,8 +51,8 @@ namespace {{this}} { QString toStringValue(const float &value); QString toStringValue(const double &value); QString toStringValue(const {{prefix}}Object &value); - QString toStringValue(const {{prefix}}Enum &value); - QString toStringValue(const {{prefix}}HttpFileElement &value); + QString toStringValue(const {{prefix}}Enum &value); + QString toStringValue(const {{prefix}}HttpFileElement &value); template QString toStringValue(const QList &val) { @@ -77,7 +77,7 @@ namespace {{this}} { QJsonValue toJsonValue(const double &value); QJsonValue toJsonValue(const {{prefix}}Object &value); QJsonValue toJsonValue(const {{prefix}}Enum &value); - QJsonValue toJsonValue(const {{prefix}}HttpFileElement &value); + QJsonValue toJsonValue(const {{prefix}}HttpFileElement &value); template QJsonValue toJsonValue(const QList &val) { @@ -107,8 +107,8 @@ namespace {{this}} { bool fromStringValue(const QString &inStr, float &value); bool fromStringValue(const QString &inStr, double &value); bool fromStringValue(const QString &inStr, {{prefix}}Object &value); - bool fromStringValue(const QString &inStr, {{prefix}}Enum &value); - bool fromStringValue(const QString &inStr, {{prefix}}HttpFileElement &value); + bool fromStringValue(const QString &inStr, {{prefix}}Enum &value); + bool fromStringValue(const QString &inStr, {{prefix}}HttpFileElement &value); template bool fromStringValue(const QList &inStr, QList &val) { @@ -143,7 +143,7 @@ namespace {{this}} { bool fromJsonValue(double &value, const QJsonValue &jval); bool fromJsonValue({{prefix}}Object &value, const QJsonValue &jval); bool fromJsonValue({{prefix}}Enum &value, const QJsonValue &jval); - bool fromJsonValue({{prefix}}HttpFileElement &value, const QJsonValue &jval); + bool fromJsonValue({{prefix}}HttpFileElement &value, const QJsonValue &jval); template bool fromJsonValue(QList &val, const QJsonValue &jval) { diff --git a/samples/client/petstore/cpp-qt5/PetStore/PetApiTests.cpp b/samples/client/petstore/cpp-qt5/PetStore/PetApiTests.cpp index 72f68c1dbd6..38cf77fd20c 100644 --- a/samples/client/petstore/cpp-qt5/PetStore/PetApiTests.cpp +++ b/samples/client/petstore/cpp-qt5/PetStore/PetApiTests.cpp @@ -3,8 +3,8 @@ #include #include -OAIPet PetApiTests::createRandomPet() { - OAIPet pet; +PFXPet PetApiTests::createRandomPet() { + PFXPet pet; qint64 id = QDateTime::currentMSecsSinceEpoch(); pet.setName("monster"); pet.setId(id); @@ -13,14 +13,14 @@ OAIPet PetApiTests::createRandomPet() { } void PetApiTests::findPetsByStatusTest() { - OAIPetApi api; + PFXPetApi api; api.setHost(PetStoreHost); QEventLoop loop; bool petFound = false; - connect(&api, &OAIPetApi::findPetsByStatusSignal, [&](QList pets) { + connect(&api, &PFXPetApi::findPetsByStatusSignal, [&](QList pets) { petFound = true; - foreach(OAIPet pet, pets) { + foreach(PFXPet pet, pets) { QVERIFY(pet.getStatus().startsWith("available") || pet.getStatus().startsWith("sold")); } loop.quit(); @@ -33,18 +33,18 @@ void PetApiTests::findPetsByStatusTest() { } void PetApiTests::createAndGetPetTest() { - OAIPetApi api; + PFXPetApi api; api.setHost(PetStoreHost); QEventLoop loop; bool petCreated = false; - connect(&api, &OAIPetApi::addPetSignal, [&]() { + connect(&api, &PFXPetApi::addPetSignal, [&]() { // pet created petCreated = true; loop.quit(); }); - OAIPet pet = createRandomPet(); + PFXPet pet = createRandomPet(); qint64 id = pet.getId(); api.addPet(pet); @@ -54,7 +54,7 @@ void PetApiTests::createAndGetPetTest() { bool petFetched = false; - connect(&api, &OAIPetApi::getPetByIdSignal, [&](OAIPet pet) { + connect(&api, &PFXPetApi::getPetByIdSignal, [&](PFXPet pet) { QVERIFY(pet.getId() > 0); QVERIFY(pet.getStatus().compare("freaky") == 0); loop.quit(); @@ -69,16 +69,16 @@ void PetApiTests::createAndGetPetTest() { } void PetApiTests::updatePetTest() { - OAIPetApi api; + PFXPetApi api; api.setHost(PetStoreHost); - OAIPet pet = createRandomPet(); - OAIPet petToCheck; + PFXPet pet = createRandomPet(); + PFXPet petToCheck; qint64 id = pet.getId(); QEventLoop loop; bool petAdded = false; - connect(&api, &OAIPetApi::addPetSignal, [&](){ + connect(&api, &PFXPetApi::addPetSignal, [&](){ petAdded = true; loop.quit(); }); @@ -92,7 +92,7 @@ void PetApiTests::updatePetTest() { // fetch it bool petFetched = false; - connect(&api, &OAIPetApi::getPetByIdSignal, this, [&](OAIPet pet) { + connect(&api, &PFXPetApi::getPetByIdSignal, this, [&](PFXPet pet) { petFetched = true; petToCheck = pet; loop.quit(); @@ -106,7 +106,7 @@ void PetApiTests::updatePetTest() { // update it bool petUpdated = false; - connect(&api, &OAIPetApi::updatePetSignal, [&]() { + connect(&api, &PFXPetApi::updatePetSignal, [&]() { petUpdated = true; loop.quit(); }); @@ -120,7 +120,7 @@ void PetApiTests::updatePetTest() { // check it bool petFetched2 = false; - connect(&api, &OAIPetApi::getPetByIdSignal, [&](OAIPet pet) { + connect(&api, &PFXPetApi::getPetByIdSignal, [&](PFXPet pet) { petFetched2 = true; QVERIFY(pet.getId() == petToCheck.getId()); QVERIFY(pet.getStatus().compare(petToCheck.getStatus()) == 0); @@ -133,17 +133,17 @@ void PetApiTests::updatePetTest() { } void PetApiTests::updatePetWithFormTest() { - OAIPetApi api; + PFXPetApi api; api.setHost(PetStoreHost); - OAIPet pet = createRandomPet(); - OAIPet petToCheck; + PFXPet pet = createRandomPet(); + PFXPet petToCheck; qint64 id = pet.getId(); QEventLoop loop; // create pet bool petAdded = false; - connect(&api, &OAIPetApi::addPetSignal, [&](){ + connect(&api, &PFXPetApi::addPetSignal, [&](){ petAdded = true; loop.quit(); }); @@ -155,7 +155,7 @@ void PetApiTests::updatePetWithFormTest() { // fetch it bool petFetched = false; - connect(&api, &OAIPetApi::getPetByIdSignal, [&](OAIPet pet) { + connect(&api, &PFXPetApi::getPetByIdSignal, [&](PFXPet pet) { petFetched = true; petToCheck = pet; loop.quit(); @@ -168,7 +168,7 @@ void PetApiTests::updatePetWithFormTest() { // update it bool petUpdated = false; - connect(&api, &OAIPetApi::updatePetWithFormSignal, [&](){ + connect(&api, &PFXPetApi::updatePetWithFormSignal, [&](){ petUpdated = true; loop.quit(); }); @@ -181,7 +181,7 @@ void PetApiTests::updatePetWithFormTest() { // fetch it bool petUpdated2 = false; - connect(&api, &OAIPetApi::getPetByIdSignal, [&](OAIPet pet) { + connect(&api, &PFXPetApi::getPetByIdSignal, [&](PFXPet pet) { petUpdated2 = true; QVERIFY(pet.getName().compare(QString("gorilla")) == 0); loop.quit(); diff --git a/samples/client/petstore/cpp-qt5/PetStore/PetApiTests.h b/samples/client/petstore/cpp-qt5/PetStore/PetApiTests.h index 3f1a68f4b14..1046bb664e5 100644 --- a/samples/client/petstore/cpp-qt5/PetStore/PetApiTests.h +++ b/samples/client/petstore/cpp-qt5/PetStore/PetApiTests.h @@ -1,13 +1,13 @@ #pragma once -#include "../client/OAIPetApi.h" +#include "../client/PFXPetApi.h" -using namespace OpenAPI; +using namespace test_namespace; class PetApiTests: public QObject { Q_OBJECT - OAIPet createRandomPet(); + PFXPet createRandomPet(); private slots: void findPetsByStatusTest(); diff --git a/samples/client/petstore/cpp-qt5/PetStore/PetStore.pro b/samples/client/petstore/cpp-qt5/PetStore/PetStore.pro index 2e43c3f7dc8..88d64d63958 100644 --- a/samples/client/petstore/cpp-qt5/PetStore/PetStore.pro +++ b/samples/client/petstore/cpp-qt5/PetStore/PetStore.pro @@ -16,12 +16,12 @@ CONFIG += c++11 TEMPLATE = app -include(../client/client.pri) +include(../client/PFXclient.pri) SOURCES += main.cpp \ - PetApiTests.cpp \ - StoreApiTests.cpp \ - UserApiTests.cpp + PetApiTests.cpp \ + StoreApiTests.cpp \ + UserApiTests.cpp HEADERS += PetApiTests.h \ StoreApiTests.h \ diff --git a/samples/client/petstore/cpp-qt5/PetStore/StoreApiTests.cpp b/samples/client/petstore/cpp-qt5/PetStore/StoreApiTests.cpp index 9433d5be957..24ed8e66270 100644 --- a/samples/client/petstore/cpp-qt5/PetStore/StoreApiTests.cpp +++ b/samples/client/petstore/cpp-qt5/PetStore/StoreApiTests.cpp @@ -5,24 +5,24 @@ #include void StoreApiTests::placeOrderTest() { - OAIStoreApi api; + PFXStoreApi api; api.setHost(PetStoreHost); QEventLoop loop; bool orderPlaced = false; - connect(&api, &OAIStoreApi::placeOrderSignal, [&](OAIOrder order) { + connect(&api, &PFXStoreApi::placeOrderSignal, [&](PFXOrder order) { orderPlaced = true; QVERIFY(order.getPetId() == 10000); QVERIFY((order.getId() == 500)); qDebug() << order.getShipDate(); loop.quit(); }); - connect(&api, &OAIStoreApi::placeOrderSignalE, [&](){ + connect(&api, &PFXStoreApi::placeOrderSignalE, [&](){ QFAIL("shouldn't trigger error"); loop.quit(); }); - OAIOrder order; + PFXOrder order; order.setId(500); order.setQuantity(10); order.setPetId(10000); @@ -37,12 +37,12 @@ void StoreApiTests::placeOrderTest() { } void StoreApiTests::getOrderByIdTest() { - OAIStoreApi api; + PFXStoreApi api; api.setHost(PetStoreHost); QEventLoop loop; bool orderFetched = false; - connect(&api, &OAIStoreApi::getOrderByIdSignal, [&](OAIOrder order) { + connect(&api, &PFXStoreApi::getOrderByIdSignal, [&](PFXOrder order) { orderFetched = true; QVERIFY(order.getPetId() == 10000); QVERIFY((order.getId() == 500)); @@ -58,12 +58,12 @@ void StoreApiTests::getOrderByIdTest() { } void StoreApiTests::getInventoryTest() { - OAIStoreApi api; + PFXStoreApi api; api.setHost(PetStoreHost); QEventLoop loop; bool inventoryFetched = false; - connect(&api, &OAIStoreApi::getInventorySignal, [&](QMap status) { + connect(&api, &PFXStoreApi::getInventorySignal, [&](QMap status) { inventoryFetched = true; for(const auto& key : status.keys()) { qDebug() << (key) << " Quantities " << status.value(key); diff --git a/samples/client/petstore/cpp-qt5/PetStore/StoreApiTests.h b/samples/client/petstore/cpp-qt5/PetStore/StoreApiTests.h index 40023ae6b87..cff9defa249 100644 --- a/samples/client/petstore/cpp-qt5/PetStore/StoreApiTests.h +++ b/samples/client/petstore/cpp-qt5/PetStore/StoreApiTests.h @@ -1,8 +1,8 @@ #pragma once -#include "../client/OAIStoreApi.h" +#include "../client/PFXStoreApi.h" -using namespace OpenAPI; +using namespace test_namespace; class StoreApiTests: public QObject { Q_OBJECT diff --git a/samples/client/petstore/cpp-qt5/PetStore/UserApiTests.cpp b/samples/client/petstore/cpp-qt5/PetStore/UserApiTests.cpp index 68a28f40156..d2196a0deb6 100644 --- a/samples/client/petstore/cpp-qt5/PetStore/UserApiTests.cpp +++ b/samples/client/petstore/cpp-qt5/PetStore/UserApiTests.cpp @@ -4,8 +4,8 @@ #include #include -OAIUser UserApiTests::createRandomUser() { - OAIUser user; +PFXUser UserApiTests::createRandomUser() { + PFXUser user; user.setId(QDateTime::currentMSecsSinceEpoch()); user.setEmail("Jane.Doe@openapitools.io"); user.setFirstName("Jane"); @@ -18,12 +18,12 @@ OAIUser UserApiTests::createRandomUser() { } void UserApiTests::createUserTest(){ - OAIUserApi api; + PFXUserApi api; api.setHost(PetStoreHost); QEventLoop loop; bool userCreated = false; - connect(&api, &OAIUserApi::createUserSignal, [&](){ + connect(&api, &PFXUserApi::createUserSignal, [&](){ userCreated = true; loop.quit(); }); @@ -35,17 +35,17 @@ void UserApiTests::createUserTest(){ } void UserApiTests::createUsersWithArrayInputTest(){ - OAIUserApi api; + PFXUserApi api; api.setHost(PetStoreHost); QEventLoop loop; bool usersCreated = false; - connect(&api, &OAIUserApi::createUsersWithArrayInputSignal, [&](){ + connect(&api, &PFXUserApi::createUsersWithArrayInputSignal, [&](){ usersCreated = true; loop.quit(); }); - QList users; + QList users; users.append(createRandomUser()); users.append(createRandomUser()); users.append(createRandomUser()); @@ -56,17 +56,17 @@ void UserApiTests::createUsersWithArrayInputTest(){ } void UserApiTests::createUsersWithListInputTest(){ - OAIUserApi api; + PFXUserApi api; api.setHost(PetStoreHost); QEventLoop loop; bool usersCreated = false; - connect(&api, &OAIUserApi::createUsersWithListInputSignal, [&](){ + connect(&api, &PFXUserApi::createUsersWithListInputSignal, [&](){ usersCreated = true; loop.quit(); }); - QList users; + QList users; auto johndoe = createRandomUser(); johndoe.setUsername("johndoe"); auto rambo = createRandomUser(); @@ -81,12 +81,12 @@ void UserApiTests::createUsersWithListInputTest(){ } void UserApiTests::deleteUserTest(){ - OAIUserApi api; + PFXUserApi api; api.setHost(PetStoreHost); QEventLoop loop; bool userDeleted = false; - connect(&api, &OAIUserApi::deleteUserSignal, [&](){ + connect(&api, &PFXUserApi::deleteUserSignal, [&](){ userDeleted = true; loop.quit(); }); @@ -98,12 +98,12 @@ void UserApiTests::deleteUserTest(){ } void UserApiTests::getUserByNameTest(){ - OAIUserApi api; + PFXUserApi api; api.setHost(PetStoreHost); QEventLoop loop; bool userFetched = false; - connect(&api, &OAIUserApi::getUserByNameSignal, [&](OAIUser summary) { + connect(&api, &PFXUserApi::getUserByNameSignal, [&](PFXUser summary) { userFetched = true; qDebug() << summary.getUsername(); QVERIFY(summary.getUsername() == "johndoe"); @@ -117,12 +117,12 @@ void UserApiTests::getUserByNameTest(){ } void UserApiTests::loginUserTest(){ - OAIUserApi api; + PFXUserApi api; api.setHost(PetStoreHost); QEventLoop loop; bool userLogged = false; - connect(&api, &OAIUserApi::loginUserSignal, [&](QString summary) { + connect(&api, &PFXUserApi::loginUserSignal, [&](QString summary) { userLogged = true; qDebug() << summary; loop.quit(); @@ -135,12 +135,12 @@ void UserApiTests::loginUserTest(){ } void UserApiTests::logoutUserTest(){ - OAIUserApi api; + PFXUserApi api; api.setHost(PetStoreHost); QEventLoop loop; bool userLoggedOut = false; - connect(&api, &OAIUserApi::logoutUserSignal, [&](){ + connect(&api, &PFXUserApi::logoutUserSignal, [&](){ userLoggedOut = true; loop.quit(); }); @@ -152,12 +152,12 @@ void UserApiTests::logoutUserTest(){ } void UserApiTests::updateUserTest(){ - OAIUserApi api; + PFXUserApi api; api.setHost(PetStoreHost); QEventLoop loop; bool userUpdated = false; - connect(&api, &OAIUserApi::updateUserSignal, [&]() { + connect(&api, &PFXUserApi::updateUserSignal, [&]() { userUpdated = true; loop.quit(); }); diff --git a/samples/client/petstore/cpp-qt5/PetStore/UserApiTests.h b/samples/client/petstore/cpp-qt5/PetStore/UserApiTests.h index 04dfcabd853..c866512d066 100644 --- a/samples/client/petstore/cpp-qt5/PetStore/UserApiTests.h +++ b/samples/client/petstore/cpp-qt5/PetStore/UserApiTests.h @@ -1,13 +1,13 @@ #pragma once -#include "../client/OAIUserApi.h" +#include "../client/PFXUserApi.h" -using namespace OpenAPI; +using namespace test_namespace; class UserApiTests: public QObject { Q_OBJECT - OAIUser createRandomUser(); + PFXUser createRandomUser(); private slots: void createUserTest(); diff --git a/samples/client/petstore/cpp-qt5/client/OAIPetApi.h b/samples/client/petstore/cpp-qt5/client/OAIPetApi.h deleted file mode 100644 index 56e8eecce31..00000000000 --- a/samples/client/petstore/cpp-qt5/client/OAIPetApi.h +++ /dev/null @@ -1,105 +0,0 @@ -/** - * OpenAPI Petstore - * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. - * - * The version of the OpenAPI document: 1.0.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -#ifndef OAI_OAIPetApi_H -#define OAI_OAIPetApi_H - -#include "OAIHttpRequest.h" - -#include "OAIApiResponse.h" -#include "OAIHttpFileElement.h" -#include "OAIPet.h" -#include - -#include - -namespace OpenAPI { - -class OAIPetApi: public QObject { - Q_OBJECT - -public: - OAIPetApi(); - OAIPetApi(const QString& host, const QString& basePath, const int toutMs = 0); - ~OAIPetApi(); - - void setBasePath(const QString& basePath); - void setHost(const QString& host); - void setApiTimeOutMs(const int tout); - void setWorkingDirectory(const QString& path); - void addHeaders(const QString& key, const QString& value); - - void addPet(const OAIPet& body); - void deletePet(const qint64& pet_id, const QString& api_key); - void findPetsByStatus(const QList& status); - void findPetsByTags(const QList& tags); - void getPetById(const qint64& pet_id); - void updatePet(const OAIPet& body); - void updatePetWithForm(const qint64& pet_id, const QString& name, const QString& status); - void uploadFile(const qint64& pet_id, const QString& additional_metadata, const OAIHttpFileElement& file); - -private: - QString basePath; - QString host; - QString workingDirectory; - int timeout; - QMap defaultHeaders; - void addPetCallback (OAIHttpRequestWorker * worker); - void deletePetCallback (OAIHttpRequestWorker * worker); - void findPetsByStatusCallback (OAIHttpRequestWorker * worker); - void findPetsByTagsCallback (OAIHttpRequestWorker * worker); - void getPetByIdCallback (OAIHttpRequestWorker * worker); - void updatePetCallback (OAIHttpRequestWorker * worker); - void updatePetWithFormCallback (OAIHttpRequestWorker * worker); - void uploadFileCallback (OAIHttpRequestWorker * worker); - -signals: - void addPetSignal(); - void deletePetSignal(); - void findPetsByStatusSignal(QList summary); - void findPetsByTagsSignal(QList summary); - void getPetByIdSignal(OAIPet summary); - void updatePetSignal(); - void updatePetWithFormSignal(); - void uploadFileSignal(OAIApiResponse summary); - - void addPetSignalFull(OAIHttpRequestWorker* worker); - void deletePetSignalFull(OAIHttpRequestWorker* worker); - void findPetsByStatusSignalFull(OAIHttpRequestWorker* worker, QList summary); - void findPetsByTagsSignalFull(OAIHttpRequestWorker* worker, QList summary); - void getPetByIdSignalFull(OAIHttpRequestWorker* worker, OAIPet summary); - void updatePetSignalFull(OAIHttpRequestWorker* worker); - void updatePetWithFormSignalFull(OAIHttpRequestWorker* worker); - void uploadFileSignalFull(OAIHttpRequestWorker* worker, OAIApiResponse summary); - - void addPetSignalE(QNetworkReply::NetworkError error_type, QString error_str); - void deletePetSignalE(QNetworkReply::NetworkError error_type, QString error_str); - void findPetsByStatusSignalE(QList summary, QNetworkReply::NetworkError error_type, QString error_str); - void findPetsByTagsSignalE(QList summary, QNetworkReply::NetworkError error_type, QString error_str); - void getPetByIdSignalE(OAIPet summary, QNetworkReply::NetworkError error_type, QString error_str); - void updatePetSignalE(QNetworkReply::NetworkError error_type, QString error_str); - void updatePetWithFormSignalE(QNetworkReply::NetworkError error_type, QString error_str); - void uploadFileSignalE(OAIApiResponse summary, QNetworkReply::NetworkError error_type, QString error_str); - - void addPetSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); - void deletePetSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); - void findPetsByStatusSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); - void findPetsByTagsSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); - void getPetByIdSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); - void updatePetSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); - void updatePetWithFormSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); - void uploadFileSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); - -}; - -} -#endif diff --git a/samples/client/petstore/cpp-qt5/client/OAIApiResponse.cpp b/samples/client/petstore/cpp-qt5/client/PFXApiResponse.cpp similarity index 65% rename from samples/client/petstore/cpp-qt5/client/OAIApiResponse.cpp rename to samples/client/petstore/cpp-qt5/client/PFXApiResponse.cpp index d284b568e68..81438054c73 100644 --- a/samples/client/petstore/cpp-qt5/client/OAIApiResponse.cpp +++ b/samples/client/petstore/cpp-qt5/client/PFXApiResponse.cpp @@ -11,32 +11,32 @@ */ -#include "OAIApiResponse.h" +#include "PFXApiResponse.h" #include #include #include #include -#include "OAIHelpers.h" +#include "PFXHelpers.h" -namespace OpenAPI { +namespace test_namespace { -OAIApiResponse::OAIApiResponse(QString json) { +PFXApiResponse::PFXApiResponse(QString json) { this->initializeModel(); this->fromJson(json); } -OAIApiResponse::OAIApiResponse() { +PFXApiResponse::PFXApiResponse() { this->initializeModel(); } -OAIApiResponse::~OAIApiResponse() { +PFXApiResponse::~PFXApiResponse() { } void -OAIApiResponse::initializeModel() { +PFXApiResponse::initializeModel() { m_code_isSet = false; m_code_isValid = false; @@ -50,7 +50,7 @@ OAIApiResponse::initializeModel() { } void -OAIApiResponse::fromJson(QString jsonString) { +PFXApiResponse::fromJson(QString jsonString) { QByteArray array (jsonString.toStdString().c_str()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); @@ -58,21 +58,21 @@ OAIApiResponse::fromJson(QString jsonString) { } void -OAIApiResponse::fromJsonObject(QJsonObject json) { +PFXApiResponse::fromJsonObject(QJsonObject json) { - m_code_isValid = ::OpenAPI::fromJsonValue(code, json[QString("code")]); + m_code_isValid = ::test_namespace::fromJsonValue(code, json[QString("code")]); m_code_isSet = !json[QString("code")].isNull() && m_code_isValid; - m_type_isValid = ::OpenAPI::fromJsonValue(type, json[QString("type")]); + m_type_isValid = ::test_namespace::fromJsonValue(type, json[QString("type")]); m_type_isSet = !json[QString("type")].isNull() && m_type_isValid; - m_message_isValid = ::OpenAPI::fromJsonValue(message, json[QString("message")]); + m_message_isValid = ::test_namespace::fromJsonValue(message, json[QString("message")]); m_message_isSet = !json[QString("message")].isNull() && m_message_isValid; } QString -OAIApiResponse::asJson () const { +PFXApiResponse::asJson () const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); @@ -80,55 +80,55 @@ OAIApiResponse::asJson () const { } QJsonObject -OAIApiResponse::asJsonObject() const { +PFXApiResponse::asJsonObject() const { QJsonObject obj; if(m_code_isSet){ - obj.insert(QString("code"), ::OpenAPI::toJsonValue(code)); + obj.insert(QString("code"), ::test_namespace::toJsonValue(code)); } if(m_type_isSet){ - obj.insert(QString("type"), ::OpenAPI::toJsonValue(type)); + obj.insert(QString("type"), ::test_namespace::toJsonValue(type)); } if(m_message_isSet){ - obj.insert(QString("message"), ::OpenAPI::toJsonValue(message)); + obj.insert(QString("message"), ::test_namespace::toJsonValue(message)); } return obj; } qint32 -OAIApiResponse::getCode() const { +PFXApiResponse::getCode() const { return code; } void -OAIApiResponse::setCode(const qint32 &code) { +PFXApiResponse::setCode(const qint32 &code) { this->code = code; this->m_code_isSet = true; } QString -OAIApiResponse::getType() const { +PFXApiResponse::getType() const { return type; } void -OAIApiResponse::setType(const QString &type) { +PFXApiResponse::setType(const QString &type) { this->type = type; this->m_type_isSet = true; } QString -OAIApiResponse::getMessage() const { +PFXApiResponse::getMessage() const { return message; } void -OAIApiResponse::setMessage(const QString &message) { +PFXApiResponse::setMessage(const QString &message) { this->message = message; this->m_message_isSet = true; } bool -OAIApiResponse::isSet() const { +PFXApiResponse::isSet() const { bool isObjectUpdated = false; do{ if(m_code_isSet){ isObjectUpdated = true; break;} @@ -141,7 +141,7 @@ OAIApiResponse::isSet() const { } bool -OAIApiResponse::isValid() const { +PFXApiResponse::isValid() const { // only required properties are required for the object to be considered valid return true; } diff --git a/samples/client/petstore/cpp-qt5/client/OAIApiResponse.h b/samples/client/petstore/cpp-qt5/client/PFXApiResponse.h similarity index 78% rename from samples/client/petstore/cpp-qt5/client/OAIApiResponse.h rename to samples/client/petstore/cpp-qt5/client/PFXApiResponse.h index c227094882c..77f5765b2a8 100644 --- a/samples/client/petstore/cpp-qt5/client/OAIApiResponse.h +++ b/samples/client/petstore/cpp-qt5/client/PFXApiResponse.h @@ -11,30 +11,30 @@ */ /* - * OAIApiResponse.h + * PFXApiResponse.h * * Describes the result of uploading an image resource */ -#ifndef OAIApiResponse_H -#define OAIApiResponse_H +#ifndef PFXApiResponse_H +#define PFXApiResponse_H #include #include -#include "OAIObject.h" -#include "OAIEnum.h" +#include "PFXObject.h" +#include "PFXEnum.h" -namespace OpenAPI { +namespace test_namespace { -class OAIApiResponse: public OAIObject { +class PFXApiResponse: public PFXObject { public: - OAIApiResponse(); - OAIApiResponse(QString json); - ~OAIApiResponse() override; + PFXApiResponse(); + PFXApiResponse(QString json); + ~PFXApiResponse() override; QString asJson () const override; QJsonObject asJsonObject() const override; @@ -77,6 +77,6 @@ private: } -Q_DECLARE_METATYPE(OpenAPI::OAIApiResponse) +Q_DECLARE_METATYPE(test_namespace::PFXApiResponse) -#endif // OAIApiResponse_H +#endif // PFXApiResponse_H diff --git a/samples/client/petstore/cpp-qt5/client/OAICategory.cpp b/samples/client/petstore/cpp-qt5/client/PFXCategory.cpp similarity index 67% rename from samples/client/petstore/cpp-qt5/client/OAICategory.cpp rename to samples/client/petstore/cpp-qt5/client/PFXCategory.cpp index 4e77a5a6601..5b1404cd7dc 100644 --- a/samples/client/petstore/cpp-qt5/client/OAICategory.cpp +++ b/samples/client/petstore/cpp-qt5/client/PFXCategory.cpp @@ -11,32 +11,32 @@ */ -#include "OAICategory.h" +#include "PFXCategory.h" #include #include #include #include -#include "OAIHelpers.h" +#include "PFXHelpers.h" -namespace OpenAPI { +namespace test_namespace { -OAICategory::OAICategory(QString json) { +PFXCategory::PFXCategory(QString json) { this->initializeModel(); this->fromJson(json); } -OAICategory::OAICategory() { +PFXCategory::PFXCategory() { this->initializeModel(); } -OAICategory::~OAICategory() { +PFXCategory::~PFXCategory() { } void -OAICategory::initializeModel() { +PFXCategory::initializeModel() { m_id_isSet = false; m_id_isValid = false; @@ -47,7 +47,7 @@ OAICategory::initializeModel() { } void -OAICategory::fromJson(QString jsonString) { +PFXCategory::fromJson(QString jsonString) { QByteArray array (jsonString.toStdString().c_str()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); @@ -55,18 +55,18 @@ OAICategory::fromJson(QString jsonString) { } void -OAICategory::fromJsonObject(QJsonObject json) { +PFXCategory::fromJsonObject(QJsonObject json) { - m_id_isValid = ::OpenAPI::fromJsonValue(id, json[QString("id")]); + m_id_isValid = ::test_namespace::fromJsonValue(id, json[QString("id")]); m_id_isSet = !json[QString("id")].isNull() && m_id_isValid; - m_name_isValid = ::OpenAPI::fromJsonValue(name, json[QString("name")]); + m_name_isValid = ::test_namespace::fromJsonValue(name, json[QString("name")]); m_name_isSet = !json[QString("name")].isNull() && m_name_isValid; } QString -OAICategory::asJson () const { +PFXCategory::asJson () const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); @@ -74,41 +74,41 @@ OAICategory::asJson () const { } QJsonObject -OAICategory::asJsonObject() const { +PFXCategory::asJsonObject() const { QJsonObject obj; if(m_id_isSet){ - obj.insert(QString("id"), ::OpenAPI::toJsonValue(id)); + obj.insert(QString("id"), ::test_namespace::toJsonValue(id)); } if(m_name_isSet){ - obj.insert(QString("name"), ::OpenAPI::toJsonValue(name)); + obj.insert(QString("name"), ::test_namespace::toJsonValue(name)); } return obj; } qint64 -OAICategory::getId() const { +PFXCategory::getId() const { return id; } void -OAICategory::setId(const qint64 &id) { +PFXCategory::setId(const qint64 &id) { this->id = id; this->m_id_isSet = true; } QString -OAICategory::getName() const { +PFXCategory::getName() const { return name; } void -OAICategory::setName(const QString &name) { +PFXCategory::setName(const QString &name) { this->name = name; this->m_name_isSet = true; } bool -OAICategory::isSet() const { +PFXCategory::isSet() const { bool isObjectUpdated = false; do{ if(m_id_isSet){ isObjectUpdated = true; break;} @@ -119,7 +119,7 @@ OAICategory::isSet() const { } bool -OAICategory::isValid() const { +PFXCategory::isValid() const { // only required properties are required for the object to be considered valid return true; } diff --git a/samples/client/petstore/cpp-qt5/client/OAICategory.h b/samples/client/petstore/cpp-qt5/client/PFXCategory.h similarity index 77% rename from samples/client/petstore/cpp-qt5/client/OAICategory.h rename to samples/client/petstore/cpp-qt5/client/PFXCategory.h index 180533007c6..6bfe71d7a74 100644 --- a/samples/client/petstore/cpp-qt5/client/OAICategory.h +++ b/samples/client/petstore/cpp-qt5/client/PFXCategory.h @@ -11,30 +11,30 @@ */ /* - * OAICategory.h + * PFXCategory.h * * A category for a pet */ -#ifndef OAICategory_H -#define OAICategory_H +#ifndef PFXCategory_H +#define PFXCategory_H #include #include -#include "OAIObject.h" -#include "OAIEnum.h" +#include "PFXObject.h" +#include "PFXEnum.h" -namespace OpenAPI { +namespace test_namespace { -class OAICategory: public OAIObject { +class PFXCategory: public PFXObject { public: - OAICategory(); - OAICategory(QString json); - ~OAICategory() override; + PFXCategory(); + PFXCategory(QString json); + ~PFXCategory() override; QString asJson () const override; QJsonObject asJsonObject() const override; @@ -69,6 +69,6 @@ private: } -Q_DECLARE_METATYPE(OpenAPI::OAICategory) +Q_DECLARE_METATYPE(test_namespace::PFXCategory) -#endif // OAICategory_H +#endif // PFXCategory_H diff --git a/samples/client/petstore/cpp-qt5/client/OAIEnum.h b/samples/client/petstore/cpp-qt5/client/PFXEnum.h similarity index 81% rename from samples/client/petstore/cpp-qt5/client/OAIEnum.h rename to samples/client/petstore/cpp-qt5/client/PFXEnum.h index 66625c43b63..9f3c9328255 100644 --- a/samples/client/petstore/cpp-qt5/client/OAIEnum.h +++ b/samples/client/petstore/cpp-qt5/client/PFXEnum.h @@ -10,26 +10,26 @@ * Do not edit the class manually. */ -#ifndef OAI_ENUM_H -#define OAI_ENUM_H +#ifndef PFX_ENUM_H +#define PFX_ENUM_H #include #include #include -namespace OpenAPI { +namespace test_namespace { -class OAIEnum { +class PFXEnum { public: - OAIEnum() { + PFXEnum() { } - OAIEnum(QString jsonString) { + PFXEnum(QString jsonString) { fromJson(jsonString); } - virtual ~OAIEnum(){ + virtual ~PFXEnum(){ } @@ -62,6 +62,6 @@ private : } -Q_DECLARE_METATYPE(OpenAPI::OAIEnum) +Q_DECLARE_METATYPE(test_namespace::PFXEnum) -#endif // OAI_ENUM_H +#endif // PFX_ENUM_H diff --git a/samples/client/petstore/cpp-qt5/client/OAIHelpers.cpp b/samples/client/petstore/cpp-qt5/client/PFXHelpers.cpp similarity index 92% rename from samples/client/petstore/cpp-qt5/client/OAIHelpers.cpp rename to samples/client/petstore/cpp-qt5/client/PFXHelpers.cpp index e4138649b5a..15ed5d0c1bf 100644 --- a/samples/client/petstore/cpp-qt5/client/OAIHelpers.cpp +++ b/samples/client/petstore/cpp-qt5/client/PFXHelpers.cpp @@ -11,10 +11,10 @@ */ #include -#include "OAIHelpers.h" +#include "PFXHelpers.h" -namespace OpenAPI { +namespace test_namespace { QString @@ -65,18 +65,18 @@ toStringValue(const double &value){ } QString -toStringValue(const OAIObject &value){ +toStringValue(const PFXObject &value){ return value.asJson(); } QString -toStringValue(const OAIEnum &value){ +toStringValue(const PFXEnum &value){ return value.asJson(); } QString -toStringValue(const OAIHttpFileElement &value){ +toStringValue(const PFXHttpFileElement &value){ return value.asJson(); } @@ -127,17 +127,17 @@ toJsonValue(const double &value){ } QJsonValue -toJsonValue(const OAIObject &value){ +toJsonValue(const PFXObject &value){ return value.asJsonObject(); } QJsonValue -toJsonValue(const OAIEnum &value){ +toJsonValue(const PFXEnum &value){ return value.asJsonValue(); } QJsonValue -toJsonValue(const OAIHttpFileElement &value){ +toJsonValue(const PFXHttpFileElement &value){ return value.asJsonValue(); } @@ -231,13 +231,13 @@ fromStringValue(const QString &inStr, double &value){ } bool -fromStringValue(const QString &inStr, OAIEnum &value){ +fromStringValue(const QString &inStr, PFXEnum &value){ value.fromJson(inStr); return true; } bool -fromStringValue(const QString &inStr, OAIHttpFileElement &value){ +fromStringValue(const QString &inStr, PFXHttpFileElement &value){ return value.fromStringValue(inStr); } @@ -352,7 +352,7 @@ fromJsonValue(double &value, const QJsonValue &jval){ } bool -fromJsonValue(OAIObject &value, const QJsonValue &jval){ +fromJsonValue(PFXObject &value, const QJsonValue &jval){ bool ok = true; if(jval.isObject()){ value.fromJsonObject(jval.toObject()); @@ -364,13 +364,13 @@ fromJsonValue(OAIObject &value, const QJsonValue &jval){ } bool -fromJsonValue(OAIEnum &value, const QJsonValue &jval){ +fromJsonValue(PFXEnum &value, const QJsonValue &jval){ value.fromJsonValue(jval); return true; } bool -fromJsonValue(OAIHttpFileElement &value, const QJsonValue &jval){ +fromJsonValue(PFXHttpFileElement &value, const QJsonValue &jval){ return value.fromJsonValue(jval); } diff --git a/samples/client/petstore/cpp-qt5/client/OAIHelpers.h b/samples/client/petstore/cpp-qt5/client/PFXHelpers.h similarity index 86% rename from samples/client/petstore/cpp-qt5/client/OAIHelpers.h rename to samples/client/petstore/cpp-qt5/client/PFXHelpers.h index a96955f2423..13b15dabdb2 100644 --- a/samples/client/petstore/cpp-qt5/client/OAIHelpers.h +++ b/samples/client/petstore/cpp-qt5/client/PFXHelpers.h @@ -10,8 +10,8 @@ * Do not edit the class manually. */ -#ifndef OAI_HELPERS_H -#define OAI_HELPERS_H +#ifndef PFX_HELPERS_H +#define PFX_HELPERS_H #include #include @@ -23,11 +23,11 @@ #include #include -#include "OAIObject.h" -#include "OAIEnum.h" -#include "OAIHttpFileElement.h" +#include "PFXObject.h" +#include "PFXEnum.h" +#include "PFXHttpFileElement.h" -namespace OpenAPI { +namespace test_namespace { template QString toStringValue(const QList &val); @@ -59,9 +59,9 @@ namespace OpenAPI { QString toStringValue(const bool &value); QString toStringValue(const float &value); QString toStringValue(const double &value); - QString toStringValue(const OAIObject &value); - QString toStringValue(const OAIEnum &value); - QString toStringValue(const OAIHttpFileElement &value); + QString toStringValue(const PFXObject &value); + QString toStringValue(const PFXEnum &value); + QString toStringValue(const PFXHttpFileElement &value); template QString toStringValue(const QList &val) { @@ -84,9 +84,9 @@ namespace OpenAPI { QJsonValue toJsonValue(const bool &value); QJsonValue toJsonValue(const float &value); QJsonValue toJsonValue(const double &value); - QJsonValue toJsonValue(const OAIObject &value); - QJsonValue toJsonValue(const OAIEnum &value); - QJsonValue toJsonValue(const OAIHttpFileElement &value); + QJsonValue toJsonValue(const PFXObject &value); + QJsonValue toJsonValue(const PFXEnum &value); + QJsonValue toJsonValue(const PFXHttpFileElement &value); template QJsonValue toJsonValue(const QList &val) { @@ -115,9 +115,9 @@ namespace OpenAPI { bool fromStringValue(const QString &inStr, bool &value); bool fromStringValue(const QString &inStr, float &value); bool fromStringValue(const QString &inStr, double &value); - bool fromStringValue(const QString &inStr, OAIObject &value); - bool fromStringValue(const QString &inStr, OAIEnum &value); - bool fromStringValue(const QString &inStr, OAIHttpFileElement &value); + bool fromStringValue(const QString &inStr, PFXObject &value); + bool fromStringValue(const QString &inStr, PFXEnum &value); + bool fromStringValue(const QString &inStr, PFXHttpFileElement &value); template bool fromStringValue(const QList &inStr, QList &val) { @@ -150,9 +150,9 @@ namespace OpenAPI { bool fromJsonValue(bool &value, const QJsonValue &jval); bool fromJsonValue(float &value, const QJsonValue &jval); bool fromJsonValue(double &value, const QJsonValue &jval); - bool fromJsonValue(OAIObject &value, const QJsonValue &jval); - bool fromJsonValue(OAIEnum &value, const QJsonValue &jval); - bool fromJsonValue(OAIHttpFileElement &value, const QJsonValue &jval); + bool fromJsonValue(PFXObject &value, const QJsonValue &jval); + bool fromJsonValue(PFXEnum &value, const QJsonValue &jval); + bool fromJsonValue(PFXHttpFileElement &value, const QJsonValue &jval); template bool fromJsonValue(QList &val, const QJsonValue &jval) { @@ -189,4 +189,4 @@ namespace OpenAPI { } -#endif // OAI_HELPERS_H +#endif // PFX_HELPERS_H diff --git a/samples/client/petstore/cpp-qt5/client/OAIHttpFileElement.cpp b/samples/client/petstore/cpp-qt5/client/PFXHttpFileElement.cpp similarity index 81% rename from samples/client/petstore/cpp-qt5/client/OAIHttpFileElement.cpp rename to samples/client/petstore/cpp-qt5/client/PFXHttpFileElement.cpp index ef627144b1e..c2616877958 100644 --- a/samples/client/petstore/cpp-qt5/client/OAIHttpFileElement.cpp +++ b/samples/client/petstore/cpp-qt5/client/PFXHttpFileElement.cpp @@ -16,37 +16,37 @@ #include #include -#include "OAIHttpFileElement.h" +#include "PFXHttpFileElement.h" -namespace OpenAPI { +namespace test_namespace { void -OAIHttpFileElement::setMimeType(const QString &mime){ +PFXHttpFileElement::setMimeType(const QString &mime){ mime_type = mime; } void -OAIHttpFileElement::setFileName(const QString &name){ +PFXHttpFileElement::setFileName(const QString &name){ local_filename = name; } void -OAIHttpFileElement::setVariableName(const QString &name){ +PFXHttpFileElement::setVariableName(const QString &name){ variable_name = name; } void -OAIHttpFileElement::setRequestFileName(const QString &name){ +PFXHttpFileElement::setRequestFileName(const QString &name){ request_filename = name; } bool -OAIHttpFileElement::isSet() const { +PFXHttpFileElement::isSet() const { return !local_filename.isEmpty() || !request_filename.isEmpty(); } QString -OAIHttpFileElement::asJson() const{ +PFXHttpFileElement::asJson() const{ QFile file(local_filename); QByteArray bArray; bool result = false; @@ -62,7 +62,7 @@ OAIHttpFileElement::asJson() const{ } QJsonValue -OAIHttpFileElement::asJsonValue() const{ +PFXHttpFileElement::asJsonValue() const{ QFile file(local_filename); QByteArray bArray; bool result = false; @@ -78,7 +78,7 @@ OAIHttpFileElement::asJsonValue() const{ } bool -OAIHttpFileElement::fromStringValue(const QString &instr){ +PFXHttpFileElement::fromStringValue(const QString &instr){ QFile file(local_filename); bool result = false; if(file.exists()) { @@ -94,7 +94,7 @@ OAIHttpFileElement::fromStringValue(const QString &instr){ } bool -OAIHttpFileElement::fromJsonValue(const QJsonValue &jval) { +PFXHttpFileElement::fromJsonValue(const QJsonValue &jval) { QFile file(local_filename); bool result = false; if(file.exists()) { @@ -110,7 +110,7 @@ OAIHttpFileElement::fromJsonValue(const QJsonValue &jval) { } QByteArray -OAIHttpFileElement::asByteArray() const { +PFXHttpFileElement::asByteArray() const { QFile file(local_filename); QByteArray bArray; bool result = false; @@ -126,7 +126,7 @@ OAIHttpFileElement::asByteArray() const { } bool -OAIHttpFileElement::fromByteArray(const QByteArray& bytes){ +PFXHttpFileElement::fromByteArray(const QByteArray& bytes){ QFile file(local_filename); bool result = false; if(file.exists()){ @@ -142,7 +142,7 @@ OAIHttpFileElement::fromByteArray(const QByteArray& bytes){ } bool -OAIHttpFileElement::saveToFile(const QString &varName, const QString &localFName, const QString &reqFname, const QString &mime, const QByteArray& bytes){ +PFXHttpFileElement::saveToFile(const QString &varName, const QString &localFName, const QString &reqFname, const QString &mime, const QByteArray& bytes){ setMimeType(mime); setFileName(localFName); setVariableName(varName); @@ -151,7 +151,7 @@ OAIHttpFileElement::saveToFile(const QString &varName, const QString &localFName } QByteArray -OAIHttpFileElement::loadFromFile(const QString &varName, const QString &localFName, const QString &reqFname, const QString &mime){ +PFXHttpFileElement::loadFromFile(const QString &varName, const QString &localFName, const QString &reqFname, const QString &mime){ setMimeType(mime); setFileName(localFName); setVariableName(varName); diff --git a/samples/client/petstore/cpp-qt5/client/OAIHttpFileElement.h b/samples/client/petstore/cpp-qt5/client/PFXHttpFileElement.h similarity index 86% rename from samples/client/petstore/cpp-qt5/client/OAIHttpFileElement.h rename to samples/client/petstore/cpp-qt5/client/PFXHttpFileElement.h index b5d189b3440..af819aff761 100644 --- a/samples/client/petstore/cpp-qt5/client/OAIHttpFileElement.h +++ b/samples/client/petstore/cpp-qt5/client/PFXHttpFileElement.h @@ -10,17 +10,17 @@ * Do not edit the class manually. */ -#ifndef OAI_HTTP_FILE_ELEMENT_H -#define OAI_HTTP_FILE_ELEMENT_H +#ifndef PFX_HTTP_FILE_ELEMENT_H +#define PFX_HTTP_FILE_ELEMENT_H #include #include #include -namespace OpenAPI { +namespace test_namespace { -class OAIHttpFileElement { +class PFXHttpFileElement { public: QString variable_name; @@ -44,6 +44,6 @@ public: } -Q_DECLARE_METATYPE(OpenAPI::OAIHttpFileElement) +Q_DECLARE_METATYPE(test_namespace::PFXHttpFileElement) -#endif // OAI_HTTP_FILE_ELEMENT_H +#endif // PFX_HTTP_FILE_ELEMENT_H diff --git a/samples/client/petstore/cpp-qt5/client/OAIHttpRequest.cpp b/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.cpp similarity index 89% rename from samples/client/petstore/cpp-qt5/client/OAIHttpRequest.cpp rename to samples/client/petstore/cpp-qt5/client/PFXHttpRequest.cpp index ef06abdf289..547b2e52129 100644 --- a/samples/client/petstore/cpp-qt5/client/OAIHttpRequest.cpp +++ b/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.cpp @@ -20,33 +20,33 @@ #include #include -#include "OAIHttpRequest.h" +#include "PFXHttpRequest.h" -namespace OpenAPI { +namespace test_namespace { -OAIHttpRequestInput::OAIHttpRequestInput() { +PFXHttpRequestInput::PFXHttpRequestInput() { initialize(); } -OAIHttpRequestInput::OAIHttpRequestInput(QString v_url_str, QString v_http_method) { +PFXHttpRequestInput::PFXHttpRequestInput(QString v_url_str, QString v_http_method) { initialize(); url_str = v_url_str; http_method = v_http_method; } -void OAIHttpRequestInput::initialize() { +void PFXHttpRequestInput::initialize() { var_layout = NOT_SET; url_str = ""; http_method = "GET"; } -void OAIHttpRequestInput::add_var(QString key, QString value) { +void PFXHttpRequestInput::add_var(QString key, QString value) { vars[key] = value; } -void OAIHttpRequestInput::add_file(QString variable_name, QString local_filename, QString request_filename, QString mime_type) { - OAIHttpFileElement file; +void PFXHttpRequestInput::add_file(QString variable_name, QString local_filename, QString request_filename, QString mime_type) { + PFXHttpFileElement file; file.variable_name = variable_name; file.local_filename = local_filename; file.request_filename = request_filename; @@ -55,7 +55,7 @@ void OAIHttpRequestInput::add_file(QString variable_name, QString local_filename } -OAIHttpRequestWorker::OAIHttpRequestWorker(QObject *parent) +PFXHttpRequestWorker::PFXHttpRequestWorker(QObject *parent) : QObject(parent), manager(nullptr) { qsrand(QDateTime::currentDateTime().toTime_t()); @@ -63,10 +63,10 @@ OAIHttpRequestWorker::OAIHttpRequestWorker(QObject *parent) timer = new QTimer(); manager = new QNetworkAccessManager(this); workingDirectory = QDir::currentPath(); - connect(manager, &QNetworkAccessManager::finished, this, &OAIHttpRequestWorker::on_manager_finished); + connect(manager, &QNetworkAccessManager::finished, this, &PFXHttpRequestWorker::on_manager_finished); } -OAIHttpRequestWorker::~OAIHttpRequestWorker() { +PFXHttpRequestWorker::~PFXHttpRequestWorker() { if(timer != nullptr){ if(timer->isActive()){ timer->stop(); @@ -80,11 +80,11 @@ OAIHttpRequestWorker::~OAIHttpRequestWorker() { } } -QMap OAIHttpRequestWorker::getResponseHeaders() const { +QMap PFXHttpRequestWorker::getResponseHeaders() const { return headers; } -OAIHttpFileElement OAIHttpRequestWorker::getHttpFileElement(const QString &fieldname){ +PFXHttpFileElement PFXHttpRequestWorker::getHttpFileElement(const QString &fieldname){ if(!files.isEmpty()){ if(fieldname.isEmpty()){ return files.first(); @@ -92,10 +92,10 @@ OAIHttpFileElement OAIHttpRequestWorker::getHttpFileElement(const QString &field return files[fieldname]; } } - return OAIHttpFileElement(); + return PFXHttpFileElement(); } -QByteArray *OAIHttpRequestWorker::getMultiPartField(const QString &fieldname){ +QByteArray *PFXHttpRequestWorker::getMultiPartField(const QString &fieldname){ if(!multiPartFields.isEmpty()){ if(fieldname.isEmpty()){ return multiPartFields.first(); @@ -106,18 +106,18 @@ QByteArray *OAIHttpRequestWorker::getMultiPartField(const QString &fieldname){ return nullptr; } -void OAIHttpRequestWorker::setTimeOut(int tout){ +void PFXHttpRequestWorker::setTimeOut(int tout){ timeout = tout; } -void OAIHttpRequestWorker::setWorkingDirectory(const QString &path){ +void PFXHttpRequestWorker::setWorkingDirectory(const QString &path){ if(!path.isEmpty()){ workingDirectory = path; } } -QString OAIHttpRequestWorker::http_attribute_encode(QString attribute_name, QString input) { +QString PFXHttpRequestWorker::http_attribute_encode(QString attribute_name, QString input) { // result structure follows RFC 5987 bool need_utf_encoding = false; QString result = ""; @@ -165,7 +165,7 @@ QString OAIHttpRequestWorker::http_attribute_encode(QString attribute_name, QStr return QString("%1=\"%2\"; %1*=utf-8''%3").arg(attribute_name, result, result_utf8); } -void OAIHttpRequestWorker::execute(OAIHttpRequestInput *input) { +void PFXHttpRequestWorker::execute(PFXHttpRequestInput *input) { // reset variables QNetworkReply* reply = nullptr; @@ -245,7 +245,7 @@ void OAIHttpRequestWorker::execute(OAIHttpRequestInput *input) { } // add files - for (QList::iterator file_info = input->files.begin(); file_info != input->files.end(); file_info++) { + for (QList::iterator file_info = input->files.begin(); file_info != input->files.end(); file_info++) { QFileInfo fi(file_info->local_filename); // ensure necessary variables are available @@ -317,8 +317,8 @@ void OAIHttpRequestWorker::execute(OAIHttpRequestInput *input) { // prepare connection QNetworkRequest request = QNetworkRequest(QUrl(input->url_str)); - if (OAIHttpRequestWorker::sslDefaultConfiguration != nullptr) { - request.setSslConfiguration(*OAIHttpRequestWorker::sslDefaultConfiguration); + if (PFXHttpRequestWorker::sslDefaultConfiguration != nullptr) { + request.setSslConfiguration(*PFXHttpRequestWorker::sslDefaultConfiguration); } request.setRawHeader("User-Agent", "OpenAPI-Generator/1.0.0/cpp-qt5"); foreach(QString key, input->headers.keys()) { @@ -375,7 +375,7 @@ void OAIHttpRequestWorker::execute(OAIHttpRequestInput *input) { } } -void OAIHttpRequestWorker::on_manager_finished(QNetworkReply *reply) { +void PFXHttpRequestWorker::on_manager_finished(QNetworkReply *reply) { error_type = reply->error(); response = reply->readAll(); error_str = reply->errorString(); @@ -389,7 +389,7 @@ void OAIHttpRequestWorker::on_manager_finished(QNetworkReply *reply) { emit on_execution_finished(this); } -void OAIHttpRequestWorker::on_manager_timeout(QNetworkReply *reply) { +void PFXHttpRequestWorker::on_manager_timeout(QNetworkReply *reply) { error_type = QNetworkReply::TimeoutError; response = ""; error_str = "Timed out waiting for response"; @@ -399,7 +399,7 @@ void OAIHttpRequestWorker::on_manager_timeout(QNetworkReply *reply) { emit on_execution_finished(this); } -void OAIHttpRequestWorker::process_form_response() { +void PFXHttpRequestWorker::process_form_response() { if(getResponseHeaders().contains(QString("Content-Disposition")) ) { auto contentDisposition = getResponseHeaders().value(QString("Content-Disposition").toUtf8()).split(QString(";"), QString::SkipEmptyParts); auto contentType = getResponseHeaders().contains(QString("Content-Type")) ? getResponseHeaders().value(QString("Content-Type").toUtf8()).split(QString(";"), QString::SkipEmptyParts).first() : QString(); @@ -411,7 +411,7 @@ void OAIHttpRequestWorker::process_form_response() { break; } } - OAIHttpFileElement felement; + PFXHttpFileElement felement; felement.saveToFile(QString(), workingDirectory + QDir::separator() + filename, filename, contentType, response.data()); files.insert(filename, felement); } @@ -427,7 +427,7 @@ void OAIHttpRequestWorker::process_form_response() { } } -QSslConfiguration* OAIHttpRequestWorker::sslDefaultConfiguration; +QSslConfiguration* PFXHttpRequestWorker::sslDefaultConfiguration; } diff --git a/samples/client/petstore/cpp-qt5/client/OAIHttpRequest.h b/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.h similarity index 70% rename from samples/client/petstore/cpp-qt5/client/OAIHttpRequest.h rename to samples/client/petstore/cpp-qt5/client/PFXHttpRequest.h index 021f05d6d89..c747c7c49d2 100644 --- a/samples/client/petstore/cpp-qt5/client/OAIHttpRequest.h +++ b/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.h @@ -16,8 +16,8 @@ * **/ -#ifndef OAI_HTTPREQUESTWORKER_H -#define OAI_HTTPREQUESTWORKER_H +#ifndef PFX_HTTPREQUESTWORKER_H +#define PFX_HTTPREQUESTWORKER_H #include #include @@ -27,26 +27,26 @@ #include -#include "OAIHttpFileElement.h" +#include "PFXHttpFileElement.h" -namespace OpenAPI { +namespace test_namespace { -enum OAIHttpRequestVarLayout {NOT_SET, ADDRESS, URL_ENCODED, MULTIPART}; +enum PFXHttpRequestVarLayout {NOT_SET, ADDRESS, URL_ENCODED, MULTIPART}; -class OAIHttpRequestInput { +class PFXHttpRequestInput { public: QString url_str; QString http_method; - OAIHttpRequestVarLayout var_layout; + PFXHttpRequestVarLayout var_layout; QMap vars; QMap headers; - QList files; + QList files; QByteArray request_body; - OAIHttpRequestInput(); - OAIHttpRequestInput(QString v_url_str, QString v_http_method); + PFXHttpRequestInput(); + PFXHttpRequestInput(QString v_url_str, QString v_http_method); void initialize(); void add_var(QString key, QString value); void add_file(QString variable_name, QString local_filename, QString request_filename, QString mime_type); @@ -54,7 +54,7 @@ public: }; -class OAIHttpRequestWorker : public QObject { +class PFXHttpRequestWorker : public QObject { Q_OBJECT public: @@ -62,24 +62,24 @@ public: QNetworkReply::NetworkError error_type; QString error_str; QTimer *timer; - explicit OAIHttpRequestWorker(QObject *parent = nullptr); - virtual ~OAIHttpRequestWorker(); + explicit PFXHttpRequestWorker(QObject *parent = nullptr); + virtual ~PFXHttpRequestWorker(); QMap getResponseHeaders() const; QString http_attribute_encode(QString attribute_name, QString input); - void execute(OAIHttpRequestInput *input); + void execute(PFXHttpRequestInput *input); static QSslConfiguration* sslDefaultConfiguration; void setTimeOut(int tout); void setWorkingDirectory(const QString &path); - OAIHttpFileElement getHttpFileElement(const QString &fieldname = QString()); + PFXHttpFileElement getHttpFileElement(const QString &fieldname = QString()); QByteArray* getMultiPartField(const QString &fieldname = QString()); signals: - void on_execution_finished(OAIHttpRequestWorker *worker); + void on_execution_finished(PFXHttpRequestWorker *worker); private: QNetworkAccessManager *manager; QMap headers; - QMap files; + QMap files; QMap multiPartFields; QString workingDirectory; int timeout; @@ -91,4 +91,4 @@ private slots: } -#endif // OAI_HTTPREQUESTWORKER_H +#endif // PFX_HTTPREQUESTWORKER_H diff --git a/samples/client/petstore/cpp-qt5/client/OAIObject.h b/samples/client/petstore/cpp-qt5/client/PFXObject.h similarity index 82% rename from samples/client/petstore/cpp-qt5/client/OAIObject.h rename to samples/client/petstore/cpp-qt5/client/PFXObject.h index 83757b56717..fb6004bbbc3 100644 --- a/samples/client/petstore/cpp-qt5/client/OAIObject.h +++ b/samples/client/petstore/cpp-qt5/client/PFXObject.h @@ -10,26 +10,26 @@ * Do not edit the class manually. */ -#ifndef OAI_OBJECT_H -#define OAI_OBJECT_H +#ifndef PFX_OBJECT_H +#define PFX_OBJECT_H #include #include #include -namespace OpenAPI { +namespace test_namespace { -class OAIObject { +class PFXObject { public: - OAIObject() { + PFXObject() { } - OAIObject(QString jsonString) { + PFXObject(QString jsonString) { fromJson(jsonString); } - virtual ~OAIObject(){ + virtual ~PFXObject(){ } @@ -64,6 +64,6 @@ private : } -Q_DECLARE_METATYPE(OpenAPI::OAIObject) +Q_DECLARE_METATYPE(test_namespace::PFXObject) -#endif // OAI_OBJECT_H +#endif // PFX_OBJECT_H diff --git a/samples/client/petstore/cpp-qt5/client/OAIOrder.cpp b/samples/client/petstore/cpp-qt5/client/PFXOrder.cpp similarity index 63% rename from samples/client/petstore/cpp-qt5/client/OAIOrder.cpp rename to samples/client/petstore/cpp-qt5/client/PFXOrder.cpp index d0b69d326c4..5887591617c 100644 --- a/samples/client/petstore/cpp-qt5/client/OAIOrder.cpp +++ b/samples/client/petstore/cpp-qt5/client/PFXOrder.cpp @@ -11,32 +11,32 @@ */ -#include "OAIOrder.h" +#include "PFXOrder.h" #include #include #include #include -#include "OAIHelpers.h" +#include "PFXHelpers.h" -namespace OpenAPI { +namespace test_namespace { -OAIOrder::OAIOrder(QString json) { +PFXOrder::PFXOrder(QString json) { this->initializeModel(); this->fromJson(json); } -OAIOrder::OAIOrder() { +PFXOrder::PFXOrder() { this->initializeModel(); } -OAIOrder::~OAIOrder() { +PFXOrder::~PFXOrder() { } void -OAIOrder::initializeModel() { +PFXOrder::initializeModel() { m_id_isSet = false; m_id_isValid = false; @@ -59,7 +59,7 @@ OAIOrder::initializeModel() { } void -OAIOrder::fromJson(QString jsonString) { +PFXOrder::fromJson(QString jsonString) { QByteArray array (jsonString.toStdString().c_str()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); @@ -67,30 +67,30 @@ OAIOrder::fromJson(QString jsonString) { } void -OAIOrder::fromJsonObject(QJsonObject json) { +PFXOrder::fromJsonObject(QJsonObject json) { - m_id_isValid = ::OpenAPI::fromJsonValue(id, json[QString("id")]); + m_id_isValid = ::test_namespace::fromJsonValue(id, json[QString("id")]); m_id_isSet = !json[QString("id")].isNull() && m_id_isValid; - m_pet_id_isValid = ::OpenAPI::fromJsonValue(pet_id, json[QString("petId")]); + m_pet_id_isValid = ::test_namespace::fromJsonValue(pet_id, json[QString("petId")]); m_pet_id_isSet = !json[QString("petId")].isNull() && m_pet_id_isValid; - m_quantity_isValid = ::OpenAPI::fromJsonValue(quantity, json[QString("quantity")]); + m_quantity_isValid = ::test_namespace::fromJsonValue(quantity, json[QString("quantity")]); m_quantity_isSet = !json[QString("quantity")].isNull() && m_quantity_isValid; - m_ship_date_isValid = ::OpenAPI::fromJsonValue(ship_date, json[QString("shipDate")]); + m_ship_date_isValid = ::test_namespace::fromJsonValue(ship_date, json[QString("shipDate")]); m_ship_date_isSet = !json[QString("shipDate")].isNull() && m_ship_date_isValid; - m_status_isValid = ::OpenAPI::fromJsonValue(status, json[QString("status")]); + m_status_isValid = ::test_namespace::fromJsonValue(status, json[QString("status")]); m_status_isSet = !json[QString("status")].isNull() && m_status_isValid; - m_complete_isValid = ::OpenAPI::fromJsonValue(complete, json[QString("complete")]); + m_complete_isValid = ::test_namespace::fromJsonValue(complete, json[QString("complete")]); m_complete_isSet = !json[QString("complete")].isNull() && m_complete_isValid; } QString -OAIOrder::asJson () const { +PFXOrder::asJson () const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); @@ -98,97 +98,97 @@ OAIOrder::asJson () const { } QJsonObject -OAIOrder::asJsonObject() const { +PFXOrder::asJsonObject() const { QJsonObject obj; if(m_id_isSet){ - obj.insert(QString("id"), ::OpenAPI::toJsonValue(id)); + obj.insert(QString("id"), ::test_namespace::toJsonValue(id)); } if(m_pet_id_isSet){ - obj.insert(QString("petId"), ::OpenAPI::toJsonValue(pet_id)); + obj.insert(QString("petId"), ::test_namespace::toJsonValue(pet_id)); } if(m_quantity_isSet){ - obj.insert(QString("quantity"), ::OpenAPI::toJsonValue(quantity)); + obj.insert(QString("quantity"), ::test_namespace::toJsonValue(quantity)); } if(m_ship_date_isSet){ - obj.insert(QString("shipDate"), ::OpenAPI::toJsonValue(ship_date)); + obj.insert(QString("shipDate"), ::test_namespace::toJsonValue(ship_date)); } if(m_status_isSet){ - obj.insert(QString("status"), ::OpenAPI::toJsonValue(status)); + obj.insert(QString("status"), ::test_namespace::toJsonValue(status)); } if(m_complete_isSet){ - obj.insert(QString("complete"), ::OpenAPI::toJsonValue(complete)); + obj.insert(QString("complete"), ::test_namespace::toJsonValue(complete)); } return obj; } qint64 -OAIOrder::getId() const { +PFXOrder::getId() const { return id; } void -OAIOrder::setId(const qint64 &id) { +PFXOrder::setId(const qint64 &id) { this->id = id; this->m_id_isSet = true; } qint64 -OAIOrder::getPetId() const { +PFXOrder::getPetId() const { return pet_id; } void -OAIOrder::setPetId(const qint64 &pet_id) { +PFXOrder::setPetId(const qint64 &pet_id) { this->pet_id = pet_id; this->m_pet_id_isSet = true; } qint32 -OAIOrder::getQuantity() const { +PFXOrder::getQuantity() const { return quantity; } void -OAIOrder::setQuantity(const qint32 &quantity) { +PFXOrder::setQuantity(const qint32 &quantity) { this->quantity = quantity; this->m_quantity_isSet = true; } QDateTime -OAIOrder::getShipDate() const { +PFXOrder::getShipDate() const { return ship_date; } void -OAIOrder::setShipDate(const QDateTime &ship_date) { +PFXOrder::setShipDate(const QDateTime &ship_date) { this->ship_date = ship_date; this->m_ship_date_isSet = true; } QString -OAIOrder::getStatus() const { +PFXOrder::getStatus() const { return status; } void -OAIOrder::setStatus(const QString &status) { +PFXOrder::setStatus(const QString &status) { this->status = status; this->m_status_isSet = true; } bool -OAIOrder::isComplete() const { +PFXOrder::isComplete() const { return complete; } void -OAIOrder::setComplete(const bool &complete) { +PFXOrder::setComplete(const bool &complete) { this->complete = complete; this->m_complete_isSet = true; } bool -OAIOrder::isSet() const { +PFXOrder::isSet() const { bool isObjectUpdated = false; do{ if(m_id_isSet){ isObjectUpdated = true; break;} @@ -207,7 +207,7 @@ OAIOrder::isSet() const { } bool -OAIOrder::isValid() const { +PFXOrder::isValid() const { // only required properties are required for the object to be considered valid return true; } diff --git a/samples/client/petstore/cpp-qt5/client/OAIOrder.h b/samples/client/petstore/cpp-qt5/client/PFXOrder.h similarity index 85% rename from samples/client/petstore/cpp-qt5/client/OAIOrder.h rename to samples/client/petstore/cpp-qt5/client/PFXOrder.h index e6a1ef1899d..34fc7eb1f55 100644 --- a/samples/client/petstore/cpp-qt5/client/OAIOrder.h +++ b/samples/client/petstore/cpp-qt5/client/PFXOrder.h @@ -11,13 +11,13 @@ */ /* - * OAIOrder.h + * PFXOrder.h * * An order for a pets from the pet store */ -#ifndef OAIOrder_H -#define OAIOrder_H +#ifndef PFXOrder_H +#define PFXOrder_H #include @@ -25,17 +25,17 @@ #include #include -#include "OAIObject.h" -#include "OAIEnum.h" +#include "PFXObject.h" +#include "PFXEnum.h" -namespace OpenAPI { +namespace test_namespace { -class OAIOrder: public OAIObject { +class PFXOrder: public PFXObject { public: - OAIOrder(); - OAIOrder(QString json); - ~OAIOrder() override; + PFXOrder(); + PFXOrder(QString json); + ~PFXOrder() override; QString asJson () const override; QJsonObject asJsonObject() const override; @@ -102,6 +102,6 @@ private: } -Q_DECLARE_METATYPE(OpenAPI::OAIOrder) +Q_DECLARE_METATYPE(test_namespace::PFXOrder) -#endif // OAIOrder_H +#endif // PFXOrder_H diff --git a/samples/client/petstore/cpp-qt5/client/OAIPet.cpp b/samples/client/petstore/cpp-qt5/client/PFXPet.cpp similarity index 64% rename from samples/client/petstore/cpp-qt5/client/OAIPet.cpp rename to samples/client/petstore/cpp-qt5/client/PFXPet.cpp index cac23646094..955fc9166ac 100644 --- a/samples/client/petstore/cpp-qt5/client/OAIPet.cpp +++ b/samples/client/petstore/cpp-qt5/client/PFXPet.cpp @@ -11,32 +11,32 @@ */ -#include "OAIPet.h" +#include "PFXPet.h" #include #include #include #include -#include "OAIHelpers.h" +#include "PFXHelpers.h" -namespace OpenAPI { +namespace test_namespace { -OAIPet::OAIPet(QString json) { +PFXPet::PFXPet(QString json) { this->initializeModel(); this->fromJson(json); } -OAIPet::OAIPet() { +PFXPet::PFXPet() { this->initializeModel(); } -OAIPet::~OAIPet() { +PFXPet::~PFXPet() { } void -OAIPet::initializeModel() { +PFXPet::initializeModel() { m_id_isSet = false; m_id_isValid = false; @@ -59,7 +59,7 @@ OAIPet::initializeModel() { } void -OAIPet::fromJson(QString jsonString) { +PFXPet::fromJson(QString jsonString) { QByteArray array (jsonString.toStdString().c_str()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); @@ -67,30 +67,30 @@ OAIPet::fromJson(QString jsonString) { } void -OAIPet::fromJsonObject(QJsonObject json) { +PFXPet::fromJsonObject(QJsonObject json) { - m_id_isValid = ::OpenAPI::fromJsonValue(id, json[QString("id")]); + m_id_isValid = ::test_namespace::fromJsonValue(id, json[QString("id")]); m_id_isSet = !json[QString("id")].isNull() && m_id_isValid; - m_category_isValid = ::OpenAPI::fromJsonValue(category, json[QString("category")]); + m_category_isValid = ::test_namespace::fromJsonValue(category, json[QString("category")]); m_category_isSet = !json[QString("category")].isNull() && m_category_isValid; - m_name_isValid = ::OpenAPI::fromJsonValue(name, json[QString("name")]); + m_name_isValid = ::test_namespace::fromJsonValue(name, json[QString("name")]); m_name_isSet = !json[QString("name")].isNull() && m_name_isValid; - m_photo_urls_isValid = ::OpenAPI::fromJsonValue(photo_urls, json[QString("photoUrls")]); + m_photo_urls_isValid = ::test_namespace::fromJsonValue(photo_urls, json[QString("photoUrls")]); m_photo_urls_isSet = !json[QString("photoUrls")].isNull() && m_photo_urls_isValid; - m_tags_isValid = ::OpenAPI::fromJsonValue(tags, json[QString("tags")]); + m_tags_isValid = ::test_namespace::fromJsonValue(tags, json[QString("tags")]); m_tags_isSet = !json[QString("tags")].isNull() && m_tags_isValid; - m_status_isValid = ::OpenAPI::fromJsonValue(status, json[QString("status")]); + m_status_isValid = ::test_namespace::fromJsonValue(status, json[QString("status")]); m_status_isSet = !json[QString("status")].isNull() && m_status_isValid; } QString -OAIPet::asJson () const { +PFXPet::asJson () const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); @@ -98,99 +98,99 @@ OAIPet::asJson () const { } QJsonObject -OAIPet::asJsonObject() const { +PFXPet::asJsonObject() const { QJsonObject obj; if(m_id_isSet){ - obj.insert(QString("id"), ::OpenAPI::toJsonValue(id)); + obj.insert(QString("id"), ::test_namespace::toJsonValue(id)); } if(category.isSet()){ - obj.insert(QString("category"), ::OpenAPI::toJsonValue(category)); + obj.insert(QString("category"), ::test_namespace::toJsonValue(category)); } if(m_name_isSet){ - obj.insert(QString("name"), ::OpenAPI::toJsonValue(name)); + obj.insert(QString("name"), ::test_namespace::toJsonValue(name)); } if(photo_urls.size() > 0){ - obj.insert(QString("photoUrls"), ::OpenAPI::toJsonValue(photo_urls)); + obj.insert(QString("photoUrls"), ::test_namespace::toJsonValue(photo_urls)); } if(tags.size() > 0){ - obj.insert(QString("tags"), ::OpenAPI::toJsonValue(tags)); + obj.insert(QString("tags"), ::test_namespace::toJsonValue(tags)); } if(m_status_isSet){ - obj.insert(QString("status"), ::OpenAPI::toJsonValue(status)); + obj.insert(QString("status"), ::test_namespace::toJsonValue(status)); } return obj; } qint64 -OAIPet::getId() const { +PFXPet::getId() const { return id; } void -OAIPet::setId(const qint64 &id) { +PFXPet::setId(const qint64 &id) { this->id = id; this->m_id_isSet = true; } -OAICategory -OAIPet::getCategory() const { +PFXCategory +PFXPet::getCategory() const { return category; } void -OAIPet::setCategory(const OAICategory &category) { +PFXPet::setCategory(const PFXCategory &category) { this->category = category; this->m_category_isSet = true; } QString -OAIPet::getName() const { +PFXPet::getName() const { return name; } void -OAIPet::setName(const QString &name) { +PFXPet::setName(const QString &name) { this->name = name; this->m_name_isSet = true; } QList -OAIPet::getPhotoUrls() const { +PFXPet::getPhotoUrls() const { return photo_urls; } void -OAIPet::setPhotoUrls(const QList &photo_urls) { +PFXPet::setPhotoUrls(const QList &photo_urls) { this->photo_urls = photo_urls; this->m_photo_urls_isSet = true; } -QList -OAIPet::getTags() const { +QList +PFXPet::getTags() const { return tags; } void -OAIPet::setTags(const QList &tags) { +PFXPet::setTags(const QList &tags) { this->tags = tags; this->m_tags_isSet = true; } QString -OAIPet::getStatus() const { +PFXPet::getStatus() const { return status; } void -OAIPet::setStatus(const QString &status) { +PFXPet::setStatus(const QString &status) { this->status = status; this->m_status_isSet = true; } bool -OAIPet::isSet() const { +PFXPet::isSet() const { bool isObjectUpdated = false; do{ if(m_id_isSet){ isObjectUpdated = true; break;} @@ -209,7 +209,7 @@ OAIPet::isSet() const { } bool -OAIPet::isValid() const { +PFXPet::isValid() const { // only required properties are required for the object to be considered valid return m_name_isValid && m_photo_urls_isValid && true; } diff --git a/samples/client/petstore/cpp-qt5/client/OAIPet.h b/samples/client/petstore/cpp-qt5/client/PFXPet.h similarity index 74% rename from samples/client/petstore/cpp-qt5/client/OAIPet.h rename to samples/client/petstore/cpp-qt5/client/PFXPet.h index 13825cf706b..ad5d035e995 100644 --- a/samples/client/petstore/cpp-qt5/client/OAIPet.h +++ b/samples/client/petstore/cpp-qt5/client/PFXPet.h @@ -11,33 +11,33 @@ */ /* - * OAIPet.h + * PFXPet.h * * A pet for sale in the pet store */ -#ifndef OAIPet_H -#define OAIPet_H +#ifndef PFXPet_H +#define PFXPet_H #include -#include "OAICategory.h" -#include "OAITag.h" +#include "PFXCategory.h" +#include "PFXTag.h" #include #include -#include "OAIObject.h" -#include "OAIEnum.h" +#include "PFXObject.h" +#include "PFXEnum.h" -namespace OpenAPI { +namespace test_namespace { -class OAIPet: public OAIObject { +class PFXPet: public PFXObject { public: - OAIPet(); - OAIPet(QString json); - ~OAIPet() override; + PFXPet(); + PFXPet(QString json); + ~PFXPet() override; QString asJson () const override; QJsonObject asJsonObject() const override; @@ -49,8 +49,8 @@ public: void setId(const qint64 &id); - OAICategory getCategory() const; - void setCategory(const OAICategory &category); + PFXCategory getCategory() const; + void setCategory(const PFXCategory &category); QString getName() const; @@ -61,8 +61,8 @@ public: void setPhotoUrls(const QList &photo_urls); - QList getTags() const; - void setTags(const QList &tags); + QList getTags() const; + void setTags(const QList &tags); QString getStatus() const; @@ -80,7 +80,7 @@ private: bool m_id_isSet; bool m_id_isValid; - OAICategory category; + PFXCategory category; bool m_category_isSet; bool m_category_isValid; @@ -92,7 +92,7 @@ private: bool m_photo_urls_isSet; bool m_photo_urls_isValid; - QList tags; + QList tags; bool m_tags_isSet; bool m_tags_isValid; @@ -104,6 +104,6 @@ private: } -Q_DECLARE_METATYPE(OpenAPI::OAIPet) +Q_DECLARE_METATYPE(test_namespace::PFXPet) -#endif // OAIPet_H +#endif // PFXPet_H diff --git a/samples/client/petstore/cpp-qt5/client/OAIPetApi.cpp b/samples/client/petstore/cpp-qt5/client/PFXPetApi.cpp similarity index 74% rename from samples/client/petstore/cpp-qt5/client/OAIPetApi.cpp rename to samples/client/petstore/cpp-qt5/client/PFXPetApi.cpp index 8cb7352341d..616cd2f81aa 100644 --- a/samples/client/petstore/cpp-qt5/client/OAIPetApi.cpp +++ b/samples/client/petstore/cpp-qt5/client/PFXPetApi.cpp @@ -10,60 +10,60 @@ * Do not edit the class manually. */ -#include "OAIPetApi.h" -#include "OAIHelpers.h" +#include "PFXPetApi.h" +#include "PFXHelpers.h" #include #include -namespace OpenAPI { +namespace test_namespace { -OAIPetApi::OAIPetApi() : basePath("/v2"), +PFXPetApi::PFXPetApi() : basePath("/v2"), host("petstore.swagger.io"), timeout(0){ } -OAIPetApi::~OAIPetApi() { +PFXPetApi::~PFXPetApi() { } -OAIPetApi::OAIPetApi(const QString& host, const QString& basePath, const int tout) { +PFXPetApi::PFXPetApi(const QString& host, const QString& basePath, const int tout) { this->host = host; this->basePath = basePath; this->timeout = tout; } -void OAIPetApi::setBasePath(const QString& basePath){ +void PFXPetApi::setBasePath(const QString& basePath){ this->basePath = basePath; } -void OAIPetApi::setHost(const QString& host){ +void PFXPetApi::setHost(const QString& host){ this->host = host; } -void OAIPetApi::setApiTimeOutMs(const int tout){ +void PFXPetApi::setApiTimeOutMs(const int tout){ timeout = tout; } -void OAIPetApi::setWorkingDirectory(const QString& path){ +void PFXPetApi::setWorkingDirectory(const QString& path){ workingDirectory = path; } -void OAIPetApi::addHeaders(const QString& key, const QString& value){ +void PFXPetApi::addHeaders(const QString& key, const QString& value){ defaultHeaders.insert(key, value); } void -OAIPetApi::addPet(const OAIPet& body) { +PFXPetApi::addPet(const PFXPet& body) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/pet"); - OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this); + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); worker->setTimeOut(timeout); worker->setWorkingDirectory(workingDirectory); - OAIHttpRequestInput input(fullPath, "POST"); + PFXHttpRequestInput input(fullPath, "POST"); QString output = body.asJson(); @@ -75,15 +75,15 @@ OAIPetApi::addPet(const OAIPet& body) { } connect(worker, - &OAIHttpRequestWorker::on_execution_finished, + &PFXHttpRequestWorker::on_execution_finished, this, - &OAIPetApi::addPetCallback); + &PFXPetApi::addPetCallback); worker->execute(&input); } void -OAIPetApi::addPetCallback(OAIHttpRequestWorker * worker) { +PFXPetApi::addPetCallback(PFXHttpRequestWorker * worker) { QString msg; QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; @@ -106,17 +106,17 @@ OAIPetApi::addPetCallback(OAIHttpRequestWorker * worker) { } void -OAIPetApi::deletePet(const qint64& pet_id, const QString& api_key) { +PFXPetApi::deletePet(const qint64& pet_id, const QString& api_key) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/pet/{petId}"); QString pet_idPathParam("{"); pet_idPathParam.append("petId").append("}"); - fullPath.replace(pet_idPathParam, QUrl::toPercentEncoding(::OpenAPI::toStringValue(pet_id))); + fullPath.replace(pet_idPathParam, QUrl::toPercentEncoding(::test_namespace::toStringValue(pet_id))); - OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this); + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); worker->setTimeOut(timeout); worker->setWorkingDirectory(workingDirectory); - OAIHttpRequestInput input(fullPath, "DELETE"); + PFXHttpRequestInput input(fullPath, "DELETE"); if (api_key != nullptr) { @@ -128,15 +128,15 @@ OAIPetApi::deletePet(const qint64& pet_id, const QString& api_key) { } connect(worker, - &OAIHttpRequestWorker::on_execution_finished, + &PFXHttpRequestWorker::on_execution_finished, this, - &OAIPetApi::deletePetCallback); + &PFXPetApi::deletePetCallback); worker->execute(&input); } void -OAIPetApi::deletePetCallback(OAIHttpRequestWorker * worker) { +PFXPetApi::deletePetCallback(PFXHttpRequestWorker * worker) { QString msg; QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; @@ -159,7 +159,7 @@ OAIPetApi::deletePetCallback(OAIHttpRequestWorker * worker) { } void -OAIPetApi::findPetsByStatus(const QList& status) { +PFXPetApi::findPetsByStatus(const QList& status) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/pet/findByStatus"); @@ -170,7 +170,7 @@ OAIPetApi::findPetsByStatus(const QList& status) { fullPath.append("&"); else fullPath.append("?"); - fullPath.append("status=").append(::OpenAPI::toStringValue(t)); + fullPath.append("status=").append(::test_namespace::toStringValue(t)); } } else if (QString("csv").indexOf("ssv") == 0) { @@ -184,7 +184,7 @@ OAIPetApi::findPetsByStatus(const QList& status) { if (count > 0) { fullPath.append(" "); } - fullPath.append(::OpenAPI::toStringValue(t)); + fullPath.append(::test_namespace::toStringValue(t)); } } else if (QString("csv").indexOf("tsv") == 0) { @@ -198,15 +198,15 @@ OAIPetApi::findPetsByStatus(const QList& status) { if (count > 0) { fullPath.append("\t"); } - fullPath.append(::OpenAPI::toStringValue(t)); + fullPath.append(::test_namespace::toStringValue(t)); } } } - OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this); + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); worker->setTimeOut(timeout); worker->setWorkingDirectory(workingDirectory); - OAIHttpRequestInput input(fullPath, "GET"); + PFXHttpRequestInput input(fullPath, "GET"); @@ -215,15 +215,15 @@ OAIPetApi::findPetsByStatus(const QList& status) { } connect(worker, - &OAIHttpRequestWorker::on_execution_finished, + &PFXHttpRequestWorker::on_execution_finished, this, - &OAIPetApi::findPetsByStatusCallback); + &PFXPetApi::findPetsByStatusCallback); worker->execute(&input); } void -OAIPetApi::findPetsByStatusCallback(OAIHttpRequestWorker * worker) { +PFXPetApi::findPetsByStatusCallback(PFXHttpRequestWorker * worker) { QString msg; QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; @@ -234,14 +234,14 @@ OAIPetApi::findPetsByStatusCallback(OAIHttpRequestWorker * worker) { else { msg = "Error: " + worker->error_str; } - QList output; + QList output; QString json(worker->response); QByteArray array (json.toStdString().c_str()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonArray jsonArray = doc.array(); foreach(QJsonValue obj, jsonArray) { - OAIPet val; - ::OpenAPI::fromJsonValue(val, obj); + PFXPet val; + ::test_namespace::fromJsonValue(val, obj); output.append(val); } worker->deleteLater(); @@ -256,7 +256,7 @@ OAIPetApi::findPetsByStatusCallback(OAIHttpRequestWorker * worker) { } void -OAIPetApi::findPetsByTags(const QList& tags) { +PFXPetApi::findPetsByTags(const QList& tags) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/pet/findByTags"); @@ -267,7 +267,7 @@ OAIPetApi::findPetsByTags(const QList& tags) { fullPath.append("&"); else fullPath.append("?"); - fullPath.append("tags=").append(::OpenAPI::toStringValue(t)); + fullPath.append("tags=").append(::test_namespace::toStringValue(t)); } } else if (QString("csv").indexOf("ssv") == 0) { @@ -281,7 +281,7 @@ OAIPetApi::findPetsByTags(const QList& tags) { if (count > 0) { fullPath.append(" "); } - fullPath.append(::OpenAPI::toStringValue(t)); + fullPath.append(::test_namespace::toStringValue(t)); } } else if (QString("csv").indexOf("tsv") == 0) { @@ -295,15 +295,15 @@ OAIPetApi::findPetsByTags(const QList& tags) { if (count > 0) { fullPath.append("\t"); } - fullPath.append(::OpenAPI::toStringValue(t)); + fullPath.append(::test_namespace::toStringValue(t)); } } } - OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this); + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); worker->setTimeOut(timeout); worker->setWorkingDirectory(workingDirectory); - OAIHttpRequestInput input(fullPath, "GET"); + PFXHttpRequestInput input(fullPath, "GET"); @@ -312,15 +312,15 @@ OAIPetApi::findPetsByTags(const QList& tags) { } connect(worker, - &OAIHttpRequestWorker::on_execution_finished, + &PFXHttpRequestWorker::on_execution_finished, this, - &OAIPetApi::findPetsByTagsCallback); + &PFXPetApi::findPetsByTagsCallback); worker->execute(&input); } void -OAIPetApi::findPetsByTagsCallback(OAIHttpRequestWorker * worker) { +PFXPetApi::findPetsByTagsCallback(PFXHttpRequestWorker * worker) { QString msg; QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; @@ -331,14 +331,14 @@ OAIPetApi::findPetsByTagsCallback(OAIHttpRequestWorker * worker) { else { msg = "Error: " + worker->error_str; } - QList output; + QList output; QString json(worker->response); QByteArray array (json.toStdString().c_str()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonArray jsonArray = doc.array(); foreach(QJsonValue obj, jsonArray) { - OAIPet val; - ::OpenAPI::fromJsonValue(val, obj); + PFXPet val; + ::test_namespace::fromJsonValue(val, obj); output.append(val); } worker->deleteLater(); @@ -353,17 +353,17 @@ OAIPetApi::findPetsByTagsCallback(OAIHttpRequestWorker * worker) { } void -OAIPetApi::getPetById(const qint64& pet_id) { +PFXPetApi::getPetById(const qint64& pet_id) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/pet/{petId}"); QString pet_idPathParam("{"); pet_idPathParam.append("petId").append("}"); - fullPath.replace(pet_idPathParam, QUrl::toPercentEncoding(::OpenAPI::toStringValue(pet_id))); + fullPath.replace(pet_idPathParam, QUrl::toPercentEncoding(::test_namespace::toStringValue(pet_id))); - OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this); + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); worker->setTimeOut(timeout); worker->setWorkingDirectory(workingDirectory); - OAIHttpRequestInput input(fullPath, "GET"); + PFXHttpRequestInput input(fullPath, "GET"); @@ -372,15 +372,15 @@ OAIPetApi::getPetById(const qint64& pet_id) { } connect(worker, - &OAIHttpRequestWorker::on_execution_finished, + &PFXHttpRequestWorker::on_execution_finished, this, - &OAIPetApi::getPetByIdCallback); + &PFXPetApi::getPetByIdCallback); worker->execute(&input); } void -OAIPetApi::getPetByIdCallback(OAIHttpRequestWorker * worker) { +PFXPetApi::getPetByIdCallback(PFXHttpRequestWorker * worker) { QString msg; QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; @@ -391,7 +391,7 @@ OAIPetApi::getPetByIdCallback(OAIHttpRequestWorker * worker) { else { msg = "Error: " + worker->error_str; } - OAIPet output(QString(worker->response)); + PFXPet output(QString(worker->response)); worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { @@ -404,14 +404,14 @@ OAIPetApi::getPetByIdCallback(OAIHttpRequestWorker * worker) { } void -OAIPetApi::updatePet(const OAIPet& body) { +PFXPetApi::updatePet(const PFXPet& body) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/pet"); - OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this); + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); worker->setTimeOut(timeout); worker->setWorkingDirectory(workingDirectory); - OAIHttpRequestInput input(fullPath, "PUT"); + PFXHttpRequestInput input(fullPath, "PUT"); QString output = body.asJson(); @@ -423,15 +423,15 @@ OAIPetApi::updatePet(const OAIPet& body) { } connect(worker, - &OAIHttpRequestWorker::on_execution_finished, + &PFXHttpRequestWorker::on_execution_finished, this, - &OAIPetApi::updatePetCallback); + &PFXPetApi::updatePetCallback); worker->execute(&input); } void -OAIPetApi::updatePetCallback(OAIHttpRequestWorker * worker) { +PFXPetApi::updatePetCallback(PFXHttpRequestWorker * worker) { QString msg; QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; @@ -454,20 +454,20 @@ OAIPetApi::updatePetCallback(OAIHttpRequestWorker * worker) { } void -OAIPetApi::updatePetWithForm(const qint64& pet_id, const QString& name, const QString& status) { +PFXPetApi::updatePetWithForm(const qint64& pet_id, const QString& name, const QString& status) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/pet/{petId}"); QString pet_idPathParam("{"); pet_idPathParam.append("petId").append("}"); - fullPath.replace(pet_idPathParam, QUrl::toPercentEncoding(::OpenAPI::toStringValue(pet_id))); + fullPath.replace(pet_idPathParam, QUrl::toPercentEncoding(::test_namespace::toStringValue(pet_id))); - OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this); + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); worker->setTimeOut(timeout); worker->setWorkingDirectory(workingDirectory); - OAIHttpRequestInput input(fullPath, "POST"); + PFXHttpRequestInput input(fullPath, "POST"); - input.add_var("name", ::OpenAPI::toStringValue(name)); - input.add_var("status", ::OpenAPI::toStringValue(status)); + input.add_var("name", ::test_namespace::toStringValue(name)); + input.add_var("status", ::test_namespace::toStringValue(status)); foreach(QString key, this->defaultHeaders.keys()) { @@ -475,15 +475,15 @@ OAIPetApi::updatePetWithForm(const qint64& pet_id, const QString& name, const QS } connect(worker, - &OAIHttpRequestWorker::on_execution_finished, + &PFXHttpRequestWorker::on_execution_finished, this, - &OAIPetApi::updatePetWithFormCallback); + &PFXPetApi::updatePetWithFormCallback); worker->execute(&input); } void -OAIPetApi::updatePetWithFormCallback(OAIHttpRequestWorker * worker) { +PFXPetApi::updatePetWithFormCallback(PFXHttpRequestWorker * worker) { QString msg; QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; @@ -506,19 +506,19 @@ OAIPetApi::updatePetWithFormCallback(OAIHttpRequestWorker * worker) { } void -OAIPetApi::uploadFile(const qint64& pet_id, const QString& additional_metadata, const OAIHttpFileElement& file) { +PFXPetApi::uploadFile(const qint64& pet_id, const QString& additional_metadata, const PFXHttpFileElement& file) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/pet/{petId}/uploadImage"); QString pet_idPathParam("{"); pet_idPathParam.append("petId").append("}"); - fullPath.replace(pet_idPathParam, QUrl::toPercentEncoding(::OpenAPI::toStringValue(pet_id))); + fullPath.replace(pet_idPathParam, QUrl::toPercentEncoding(::test_namespace::toStringValue(pet_id))); - OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this); + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); worker->setTimeOut(timeout); worker->setWorkingDirectory(workingDirectory); - OAIHttpRequestInput input(fullPath, "POST"); + PFXHttpRequestInput input(fullPath, "POST"); - input.add_var("additionalMetadata", ::OpenAPI::toStringValue(additional_metadata)); + input.add_var("additionalMetadata", ::test_namespace::toStringValue(additional_metadata)); input.add_file("file", file.local_filename, file.request_filename, file.mime_type); @@ -527,15 +527,15 @@ OAIPetApi::uploadFile(const qint64& pet_id, const QString& additional_metadata, } connect(worker, - &OAIHttpRequestWorker::on_execution_finished, + &PFXHttpRequestWorker::on_execution_finished, this, - &OAIPetApi::uploadFileCallback); + &PFXPetApi::uploadFileCallback); worker->execute(&input); } void -OAIPetApi::uploadFileCallback(OAIHttpRequestWorker * worker) { +PFXPetApi::uploadFileCallback(PFXHttpRequestWorker * worker) { QString msg; QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; @@ -546,7 +546,7 @@ OAIPetApi::uploadFileCallback(OAIHttpRequestWorker * worker) { else { msg = "Error: " + worker->error_str; } - OAIApiResponse output(QString(worker->response)); + PFXApiResponse output(QString(worker->response)); worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { diff --git a/samples/client/petstore/cpp-qt5/client/PFXPetApi.h b/samples/client/petstore/cpp-qt5/client/PFXPetApi.h new file mode 100644 index 00000000000..b7089a07ec8 --- /dev/null +++ b/samples/client/petstore/cpp-qt5/client/PFXPetApi.h @@ -0,0 +1,105 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +#ifndef PFX_PFXPetApi_H +#define PFX_PFXPetApi_H + +#include "PFXHttpRequest.h" + +#include "PFXApiResponse.h" +#include "PFXHttpFileElement.h" +#include "PFXPet.h" +#include + +#include + +namespace test_namespace { + +class PFXPetApi: public QObject { + Q_OBJECT + +public: + PFXPetApi(); + PFXPetApi(const QString& host, const QString& basePath, const int toutMs = 0); + ~PFXPetApi(); + + void setBasePath(const QString& basePath); + void setHost(const QString& host); + void setApiTimeOutMs(const int tout); + void setWorkingDirectory(const QString& path); + void addHeaders(const QString& key, const QString& value); + + void addPet(const PFXPet& body); + void deletePet(const qint64& pet_id, const QString& api_key); + void findPetsByStatus(const QList& status); + void findPetsByTags(const QList& tags); + void getPetById(const qint64& pet_id); + void updatePet(const PFXPet& body); + void updatePetWithForm(const qint64& pet_id, const QString& name, const QString& status); + void uploadFile(const qint64& pet_id, const QString& additional_metadata, const PFXHttpFileElement& file); + +private: + QString basePath; + QString host; + QString workingDirectory; + int timeout; + QMap defaultHeaders; + void addPetCallback (PFXHttpRequestWorker * worker); + void deletePetCallback (PFXHttpRequestWorker * worker); + void findPetsByStatusCallback (PFXHttpRequestWorker * worker); + void findPetsByTagsCallback (PFXHttpRequestWorker * worker); + void getPetByIdCallback (PFXHttpRequestWorker * worker); + void updatePetCallback (PFXHttpRequestWorker * worker); + void updatePetWithFormCallback (PFXHttpRequestWorker * worker); + void uploadFileCallback (PFXHttpRequestWorker * worker); + +signals: + void addPetSignal(); + void deletePetSignal(); + void findPetsByStatusSignal(QList summary); + void findPetsByTagsSignal(QList summary); + void getPetByIdSignal(PFXPet summary); + void updatePetSignal(); + void updatePetWithFormSignal(); + void uploadFileSignal(PFXApiResponse summary); + + void addPetSignalFull(PFXHttpRequestWorker* worker); + void deletePetSignalFull(PFXHttpRequestWorker* worker); + void findPetsByStatusSignalFull(PFXHttpRequestWorker* worker, QList summary); + void findPetsByTagsSignalFull(PFXHttpRequestWorker* worker, QList summary); + void getPetByIdSignalFull(PFXHttpRequestWorker* worker, PFXPet summary); + void updatePetSignalFull(PFXHttpRequestWorker* worker); + void updatePetWithFormSignalFull(PFXHttpRequestWorker* worker); + void uploadFileSignalFull(PFXHttpRequestWorker* worker, PFXApiResponse summary); + + void addPetSignalE(QNetworkReply::NetworkError error_type, QString error_str); + void deletePetSignalE(QNetworkReply::NetworkError error_type, QString error_str); + void findPetsByStatusSignalE(QList summary, QNetworkReply::NetworkError error_type, QString error_str); + void findPetsByTagsSignalE(QList summary, QNetworkReply::NetworkError error_type, QString error_str); + void getPetByIdSignalE(PFXPet summary, QNetworkReply::NetworkError error_type, QString error_str); + void updatePetSignalE(QNetworkReply::NetworkError error_type, QString error_str); + void updatePetWithFormSignalE(QNetworkReply::NetworkError error_type, QString error_str); + void uploadFileSignalE(PFXApiResponse summary, QNetworkReply::NetworkError error_type, QString error_str); + + void addPetSignalEFull(PFXHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); + void deletePetSignalEFull(PFXHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); + void findPetsByStatusSignalEFull(PFXHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); + void findPetsByTagsSignalEFull(PFXHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); + void getPetByIdSignalEFull(PFXHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); + void updatePetSignalEFull(PFXHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); + void updatePetWithFormSignalEFull(PFXHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); + void uploadFileSignalEFull(PFXHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); + +}; + +} +#endif diff --git a/samples/client/petstore/cpp-qt5/client/OAIStoreApi.cpp b/samples/client/petstore/cpp-qt5/client/PFXStoreApi.cpp similarity index 73% rename from samples/client/petstore/cpp-qt5/client/OAIStoreApi.cpp rename to samples/client/petstore/cpp-qt5/client/PFXStoreApi.cpp index eaff088e585..814a60221ba 100644 --- a/samples/client/petstore/cpp-qt5/client/OAIStoreApi.cpp +++ b/samples/client/petstore/cpp-qt5/client/PFXStoreApi.cpp @@ -10,63 +10,63 @@ * Do not edit the class manually. */ -#include "OAIStoreApi.h" -#include "OAIHelpers.h" +#include "PFXStoreApi.h" +#include "PFXHelpers.h" #include #include -namespace OpenAPI { +namespace test_namespace { -OAIStoreApi::OAIStoreApi() : basePath("/v2"), +PFXStoreApi::PFXStoreApi() : basePath("/v2"), host("petstore.swagger.io"), timeout(0){ } -OAIStoreApi::~OAIStoreApi() { +PFXStoreApi::~PFXStoreApi() { } -OAIStoreApi::OAIStoreApi(const QString& host, const QString& basePath, const int tout) { +PFXStoreApi::PFXStoreApi(const QString& host, const QString& basePath, const int tout) { this->host = host; this->basePath = basePath; this->timeout = tout; } -void OAIStoreApi::setBasePath(const QString& basePath){ +void PFXStoreApi::setBasePath(const QString& basePath){ this->basePath = basePath; } -void OAIStoreApi::setHost(const QString& host){ +void PFXStoreApi::setHost(const QString& host){ this->host = host; } -void OAIStoreApi::setApiTimeOutMs(const int tout){ +void PFXStoreApi::setApiTimeOutMs(const int tout){ timeout = tout; } -void OAIStoreApi::setWorkingDirectory(const QString& path){ +void PFXStoreApi::setWorkingDirectory(const QString& path){ workingDirectory = path; } -void OAIStoreApi::addHeaders(const QString& key, const QString& value){ +void PFXStoreApi::addHeaders(const QString& key, const QString& value){ defaultHeaders.insert(key, value); } void -OAIStoreApi::deleteOrder(const QString& order_id) { +PFXStoreApi::deleteOrder(const QString& order_id) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/store/order/{orderId}"); QString order_idPathParam("{"); order_idPathParam.append("orderId").append("}"); - fullPath.replace(order_idPathParam, QUrl::toPercentEncoding(::OpenAPI::toStringValue(order_id))); + fullPath.replace(order_idPathParam, QUrl::toPercentEncoding(::test_namespace::toStringValue(order_id))); - OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this); + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); worker->setTimeOut(timeout); worker->setWorkingDirectory(workingDirectory); - OAIHttpRequestInput input(fullPath, "DELETE"); + PFXHttpRequestInput input(fullPath, "DELETE"); @@ -75,15 +75,15 @@ OAIStoreApi::deleteOrder(const QString& order_id) { } connect(worker, - &OAIHttpRequestWorker::on_execution_finished, + &PFXHttpRequestWorker::on_execution_finished, this, - &OAIStoreApi::deleteOrderCallback); + &PFXStoreApi::deleteOrderCallback); worker->execute(&input); } void -OAIStoreApi::deleteOrderCallback(OAIHttpRequestWorker * worker) { +PFXStoreApi::deleteOrderCallback(PFXHttpRequestWorker * worker) { QString msg; QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; @@ -106,14 +106,14 @@ OAIStoreApi::deleteOrderCallback(OAIHttpRequestWorker * worker) { } void -OAIStoreApi::getInventory() { +PFXStoreApi::getInventory() { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/store/inventory"); - OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this); + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); worker->setTimeOut(timeout); worker->setWorkingDirectory(workingDirectory); - OAIHttpRequestInput input(fullPath, "GET"); + PFXHttpRequestInput input(fullPath, "GET"); @@ -122,15 +122,15 @@ OAIStoreApi::getInventory() { } connect(worker, - &OAIHttpRequestWorker::on_execution_finished, + &PFXHttpRequestWorker::on_execution_finished, this, - &OAIStoreApi::getInventoryCallback); + &PFXStoreApi::getInventoryCallback); worker->execute(&input); } void -OAIStoreApi::getInventoryCallback(OAIHttpRequestWorker * worker) { +PFXStoreApi::getInventoryCallback(PFXHttpRequestWorker * worker) { QString msg; QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; @@ -148,7 +148,7 @@ OAIStoreApi::getInventoryCallback(OAIHttpRequestWorker * worker) { QJsonObject obj = doc.object(); foreach(QString key, obj.keys()) { qint32 val; - ::OpenAPI::fromJsonValue(val, obj[key]); + ::test_namespace::fromJsonValue(val, obj[key]); output.insert(key, val); } worker->deleteLater(); @@ -163,17 +163,17 @@ OAIStoreApi::getInventoryCallback(OAIHttpRequestWorker * worker) { } void -OAIStoreApi::getOrderById(const qint64& order_id) { +PFXStoreApi::getOrderById(const qint64& order_id) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/store/order/{orderId}"); QString order_idPathParam("{"); order_idPathParam.append("orderId").append("}"); - fullPath.replace(order_idPathParam, QUrl::toPercentEncoding(::OpenAPI::toStringValue(order_id))); + fullPath.replace(order_idPathParam, QUrl::toPercentEncoding(::test_namespace::toStringValue(order_id))); - OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this); + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); worker->setTimeOut(timeout); worker->setWorkingDirectory(workingDirectory); - OAIHttpRequestInput input(fullPath, "GET"); + PFXHttpRequestInput input(fullPath, "GET"); @@ -182,15 +182,15 @@ OAIStoreApi::getOrderById(const qint64& order_id) { } connect(worker, - &OAIHttpRequestWorker::on_execution_finished, + &PFXHttpRequestWorker::on_execution_finished, this, - &OAIStoreApi::getOrderByIdCallback); + &PFXStoreApi::getOrderByIdCallback); worker->execute(&input); } void -OAIStoreApi::getOrderByIdCallback(OAIHttpRequestWorker * worker) { +PFXStoreApi::getOrderByIdCallback(PFXHttpRequestWorker * worker) { QString msg; QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; @@ -201,7 +201,7 @@ OAIStoreApi::getOrderByIdCallback(OAIHttpRequestWorker * worker) { else { msg = "Error: " + worker->error_str; } - OAIOrder output(QString(worker->response)); + PFXOrder output(QString(worker->response)); worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { @@ -214,14 +214,14 @@ OAIStoreApi::getOrderByIdCallback(OAIHttpRequestWorker * worker) { } void -OAIStoreApi::placeOrder(const OAIOrder& body) { +PFXStoreApi::placeOrder(const PFXOrder& body) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/store/order"); - OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this); + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); worker->setTimeOut(timeout); worker->setWorkingDirectory(workingDirectory); - OAIHttpRequestInput input(fullPath, "POST"); + PFXHttpRequestInput input(fullPath, "POST"); QString output = body.asJson(); @@ -233,15 +233,15 @@ OAIStoreApi::placeOrder(const OAIOrder& body) { } connect(worker, - &OAIHttpRequestWorker::on_execution_finished, + &PFXHttpRequestWorker::on_execution_finished, this, - &OAIStoreApi::placeOrderCallback); + &PFXStoreApi::placeOrderCallback); worker->execute(&input); } void -OAIStoreApi::placeOrderCallback(OAIHttpRequestWorker * worker) { +PFXStoreApi::placeOrderCallback(PFXHttpRequestWorker * worker) { QString msg; QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; @@ -252,7 +252,7 @@ OAIStoreApi::placeOrderCallback(OAIHttpRequestWorker * worker) { else { msg = "Error: " + worker->error_str; } - OAIOrder output(QString(worker->response)); + PFXOrder output(QString(worker->response)); worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { diff --git a/samples/client/petstore/cpp-qt5/client/OAIStoreApi.h b/samples/client/petstore/cpp-qt5/client/PFXStoreApi.h similarity index 56% rename from samples/client/petstore/cpp-qt5/client/OAIStoreApi.h rename to samples/client/petstore/cpp-qt5/client/PFXStoreApi.h index 317550ec170..fd48165e5a4 100644 --- a/samples/client/petstore/cpp-qt5/client/OAIStoreApi.h +++ b/samples/client/petstore/cpp-qt5/client/PFXStoreApi.h @@ -10,26 +10,26 @@ * Do not edit the class manually. */ -#ifndef OAI_OAIStoreApi_H -#define OAI_OAIStoreApi_H +#ifndef PFX_PFXStoreApi_H +#define PFX_PFXStoreApi_H -#include "OAIHttpRequest.h" +#include "PFXHttpRequest.h" -#include "OAIOrder.h" +#include "PFXOrder.h" #include #include #include -namespace OpenAPI { +namespace test_namespace { -class OAIStoreApi: public QObject { +class PFXStoreApi: public QObject { Q_OBJECT public: - OAIStoreApi(); - OAIStoreApi(const QString& host, const QString& basePath, const int toutMs = 0); - ~OAIStoreApi(); + PFXStoreApi(); + PFXStoreApi(const QString& host, const QString& basePath, const int toutMs = 0); + ~PFXStoreApi(); void setBasePath(const QString& basePath); void setHost(const QString& host); @@ -40,7 +40,7 @@ public: void deleteOrder(const QString& order_id); void getInventory(); void getOrderById(const qint64& order_id); - void placeOrder(const OAIOrder& body); + void placeOrder(const PFXOrder& body); private: QString basePath; @@ -48,31 +48,31 @@ private: QString workingDirectory; int timeout; QMap defaultHeaders; - void deleteOrderCallback (OAIHttpRequestWorker * worker); - void getInventoryCallback (OAIHttpRequestWorker * worker); - void getOrderByIdCallback (OAIHttpRequestWorker * worker); - void placeOrderCallback (OAIHttpRequestWorker * worker); + void deleteOrderCallback (PFXHttpRequestWorker * worker); + void getInventoryCallback (PFXHttpRequestWorker * worker); + void getOrderByIdCallback (PFXHttpRequestWorker * worker); + void placeOrderCallback (PFXHttpRequestWorker * worker); signals: void deleteOrderSignal(); void getInventorySignal(QMap summary); - void getOrderByIdSignal(OAIOrder summary); - void placeOrderSignal(OAIOrder summary); + void getOrderByIdSignal(PFXOrder summary); + void placeOrderSignal(PFXOrder summary); - void deleteOrderSignalFull(OAIHttpRequestWorker* worker); - void getInventorySignalFull(OAIHttpRequestWorker* worker, QMap summary); - void getOrderByIdSignalFull(OAIHttpRequestWorker* worker, OAIOrder summary); - void placeOrderSignalFull(OAIHttpRequestWorker* worker, OAIOrder summary); + void deleteOrderSignalFull(PFXHttpRequestWorker* worker); + void getInventorySignalFull(PFXHttpRequestWorker* worker, QMap summary); + void getOrderByIdSignalFull(PFXHttpRequestWorker* worker, PFXOrder summary); + void placeOrderSignalFull(PFXHttpRequestWorker* worker, PFXOrder summary); void deleteOrderSignalE(QNetworkReply::NetworkError error_type, QString error_str); void getInventorySignalE(QMap summary, QNetworkReply::NetworkError error_type, QString error_str); - void getOrderByIdSignalE(OAIOrder summary, QNetworkReply::NetworkError error_type, QString error_str); - void placeOrderSignalE(OAIOrder summary, QNetworkReply::NetworkError error_type, QString error_str); + void getOrderByIdSignalE(PFXOrder summary, QNetworkReply::NetworkError error_type, QString error_str); + void placeOrderSignalE(PFXOrder summary, QNetworkReply::NetworkError error_type, QString error_str); - void deleteOrderSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); - void getInventorySignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); - void getOrderByIdSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); - void placeOrderSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); + void deleteOrderSignalEFull(PFXHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); + void getInventorySignalEFull(PFXHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); + void getOrderByIdSignalEFull(PFXHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); + void placeOrderSignalEFull(PFXHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); }; diff --git a/samples/client/petstore/cpp-qt5/client/OAITag.cpp b/samples/client/petstore/cpp-qt5/client/PFXTag.cpp similarity index 69% rename from samples/client/petstore/cpp-qt5/client/OAITag.cpp rename to samples/client/petstore/cpp-qt5/client/PFXTag.cpp index ee39ccf585c..b4fa9007879 100644 --- a/samples/client/petstore/cpp-qt5/client/OAITag.cpp +++ b/samples/client/petstore/cpp-qt5/client/PFXTag.cpp @@ -11,32 +11,32 @@ */ -#include "OAITag.h" +#include "PFXTag.h" #include #include #include #include -#include "OAIHelpers.h" +#include "PFXHelpers.h" -namespace OpenAPI { +namespace test_namespace { -OAITag::OAITag(QString json) { +PFXTag::PFXTag(QString json) { this->initializeModel(); this->fromJson(json); } -OAITag::OAITag() { +PFXTag::PFXTag() { this->initializeModel(); } -OAITag::~OAITag() { +PFXTag::~PFXTag() { } void -OAITag::initializeModel() { +PFXTag::initializeModel() { m_id_isSet = false; m_id_isValid = false; @@ -47,7 +47,7 @@ OAITag::initializeModel() { } void -OAITag::fromJson(QString jsonString) { +PFXTag::fromJson(QString jsonString) { QByteArray array (jsonString.toStdString().c_str()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); @@ -55,18 +55,18 @@ OAITag::fromJson(QString jsonString) { } void -OAITag::fromJsonObject(QJsonObject json) { +PFXTag::fromJsonObject(QJsonObject json) { - m_id_isValid = ::OpenAPI::fromJsonValue(id, json[QString("id")]); + m_id_isValid = ::test_namespace::fromJsonValue(id, json[QString("id")]); m_id_isSet = !json[QString("id")].isNull() && m_id_isValid; - m_name_isValid = ::OpenAPI::fromJsonValue(name, json[QString("name")]); + m_name_isValid = ::test_namespace::fromJsonValue(name, json[QString("name")]); m_name_isSet = !json[QString("name")].isNull() && m_name_isValid; } QString -OAITag::asJson () const { +PFXTag::asJson () const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); @@ -74,41 +74,41 @@ OAITag::asJson () const { } QJsonObject -OAITag::asJsonObject() const { +PFXTag::asJsonObject() const { QJsonObject obj; if(m_id_isSet){ - obj.insert(QString("id"), ::OpenAPI::toJsonValue(id)); + obj.insert(QString("id"), ::test_namespace::toJsonValue(id)); } if(m_name_isSet){ - obj.insert(QString("name"), ::OpenAPI::toJsonValue(name)); + obj.insert(QString("name"), ::test_namespace::toJsonValue(name)); } return obj; } qint64 -OAITag::getId() const { +PFXTag::getId() const { return id; } void -OAITag::setId(const qint64 &id) { +PFXTag::setId(const qint64 &id) { this->id = id; this->m_id_isSet = true; } QString -OAITag::getName() const { +PFXTag::getName() const { return name; } void -OAITag::setName(const QString &name) { +PFXTag::setName(const QString &name) { this->name = name; this->m_name_isSet = true; } bool -OAITag::isSet() const { +PFXTag::isSet() const { bool isObjectUpdated = false; do{ if(m_id_isSet){ isObjectUpdated = true; break;} @@ -119,7 +119,7 @@ OAITag::isSet() const { } bool -OAITag::isValid() const { +PFXTag::isValid() const { // only required properties are required for the object to be considered valid return true; } diff --git a/samples/client/petstore/cpp-qt5/client/OAITag.h b/samples/client/petstore/cpp-qt5/client/PFXTag.h similarity index 79% rename from samples/client/petstore/cpp-qt5/client/OAITag.h rename to samples/client/petstore/cpp-qt5/client/PFXTag.h index fbb5c6a7555..0ac8fe37085 100644 --- a/samples/client/petstore/cpp-qt5/client/OAITag.h +++ b/samples/client/petstore/cpp-qt5/client/PFXTag.h @@ -11,30 +11,30 @@ */ /* - * OAITag.h + * PFXTag.h * * A tag for a pet */ -#ifndef OAITag_H -#define OAITag_H +#ifndef PFXTag_H +#define PFXTag_H #include #include -#include "OAIObject.h" -#include "OAIEnum.h" +#include "PFXObject.h" +#include "PFXEnum.h" -namespace OpenAPI { +namespace test_namespace { -class OAITag: public OAIObject { +class PFXTag: public PFXObject { public: - OAITag(); - OAITag(QString json); - ~OAITag() override; + PFXTag(); + PFXTag(QString json); + ~PFXTag() override; QString asJson () const override; QJsonObject asJsonObject() const override; @@ -69,6 +69,6 @@ private: } -Q_DECLARE_METATYPE(OpenAPI::OAITag) +Q_DECLARE_METATYPE(test_namespace::PFXTag) -#endif // OAITag_H +#endif // PFXTag_H diff --git a/samples/client/petstore/cpp-qt5/client/OAIUser.cpp b/samples/client/petstore/cpp-qt5/client/PFXUser.cpp similarity index 62% rename from samples/client/petstore/cpp-qt5/client/OAIUser.cpp rename to samples/client/petstore/cpp-qt5/client/PFXUser.cpp index 12fc195f83d..d77213bfd86 100644 --- a/samples/client/petstore/cpp-qt5/client/OAIUser.cpp +++ b/samples/client/petstore/cpp-qt5/client/PFXUser.cpp @@ -11,32 +11,32 @@ */ -#include "OAIUser.h" +#include "PFXUser.h" #include #include #include #include -#include "OAIHelpers.h" +#include "PFXHelpers.h" -namespace OpenAPI { +namespace test_namespace { -OAIUser::OAIUser(QString json) { +PFXUser::PFXUser(QString json) { this->initializeModel(); this->fromJson(json); } -OAIUser::OAIUser() { +PFXUser::PFXUser() { this->initializeModel(); } -OAIUser::~OAIUser() { +PFXUser::~PFXUser() { } void -OAIUser::initializeModel() { +PFXUser::initializeModel() { m_id_isSet = false; m_id_isValid = false; @@ -65,7 +65,7 @@ OAIUser::initializeModel() { } void -OAIUser::fromJson(QString jsonString) { +PFXUser::fromJson(QString jsonString) { QByteArray array (jsonString.toStdString().c_str()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); @@ -73,36 +73,36 @@ OAIUser::fromJson(QString jsonString) { } void -OAIUser::fromJsonObject(QJsonObject json) { +PFXUser::fromJsonObject(QJsonObject json) { - m_id_isValid = ::OpenAPI::fromJsonValue(id, json[QString("id")]); + m_id_isValid = ::test_namespace::fromJsonValue(id, json[QString("id")]); m_id_isSet = !json[QString("id")].isNull() && m_id_isValid; - m_username_isValid = ::OpenAPI::fromJsonValue(username, json[QString("username")]); + m_username_isValid = ::test_namespace::fromJsonValue(username, json[QString("username")]); m_username_isSet = !json[QString("username")].isNull() && m_username_isValid; - m_first_name_isValid = ::OpenAPI::fromJsonValue(first_name, json[QString("firstName")]); + m_first_name_isValid = ::test_namespace::fromJsonValue(first_name, json[QString("firstName")]); m_first_name_isSet = !json[QString("firstName")].isNull() && m_first_name_isValid; - m_last_name_isValid = ::OpenAPI::fromJsonValue(last_name, json[QString("lastName")]); + m_last_name_isValid = ::test_namespace::fromJsonValue(last_name, json[QString("lastName")]); m_last_name_isSet = !json[QString("lastName")].isNull() && m_last_name_isValid; - m_email_isValid = ::OpenAPI::fromJsonValue(email, json[QString("email")]); + m_email_isValid = ::test_namespace::fromJsonValue(email, json[QString("email")]); m_email_isSet = !json[QString("email")].isNull() && m_email_isValid; - m_password_isValid = ::OpenAPI::fromJsonValue(password, json[QString("password")]); + m_password_isValid = ::test_namespace::fromJsonValue(password, json[QString("password")]); m_password_isSet = !json[QString("password")].isNull() && m_password_isValid; - m_phone_isValid = ::OpenAPI::fromJsonValue(phone, json[QString("phone")]); + m_phone_isValid = ::test_namespace::fromJsonValue(phone, json[QString("phone")]); m_phone_isSet = !json[QString("phone")].isNull() && m_phone_isValid; - m_user_status_isValid = ::OpenAPI::fromJsonValue(user_status, json[QString("userStatus")]); + m_user_status_isValid = ::test_namespace::fromJsonValue(user_status, json[QString("userStatus")]); m_user_status_isSet = !json[QString("userStatus")].isNull() && m_user_status_isValid; } QString -OAIUser::asJson () const { +PFXUser::asJson () const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); @@ -110,125 +110,125 @@ OAIUser::asJson () const { } QJsonObject -OAIUser::asJsonObject() const { +PFXUser::asJsonObject() const { QJsonObject obj; if(m_id_isSet){ - obj.insert(QString("id"), ::OpenAPI::toJsonValue(id)); + obj.insert(QString("id"), ::test_namespace::toJsonValue(id)); } if(m_username_isSet){ - obj.insert(QString("username"), ::OpenAPI::toJsonValue(username)); + obj.insert(QString("username"), ::test_namespace::toJsonValue(username)); } if(m_first_name_isSet){ - obj.insert(QString("firstName"), ::OpenAPI::toJsonValue(first_name)); + obj.insert(QString("firstName"), ::test_namespace::toJsonValue(first_name)); } if(m_last_name_isSet){ - obj.insert(QString("lastName"), ::OpenAPI::toJsonValue(last_name)); + obj.insert(QString("lastName"), ::test_namespace::toJsonValue(last_name)); } if(m_email_isSet){ - obj.insert(QString("email"), ::OpenAPI::toJsonValue(email)); + obj.insert(QString("email"), ::test_namespace::toJsonValue(email)); } if(m_password_isSet){ - obj.insert(QString("password"), ::OpenAPI::toJsonValue(password)); + obj.insert(QString("password"), ::test_namespace::toJsonValue(password)); } if(m_phone_isSet){ - obj.insert(QString("phone"), ::OpenAPI::toJsonValue(phone)); + obj.insert(QString("phone"), ::test_namespace::toJsonValue(phone)); } if(m_user_status_isSet){ - obj.insert(QString("userStatus"), ::OpenAPI::toJsonValue(user_status)); + obj.insert(QString("userStatus"), ::test_namespace::toJsonValue(user_status)); } return obj; } qint64 -OAIUser::getId() const { +PFXUser::getId() const { return id; } void -OAIUser::setId(const qint64 &id) { +PFXUser::setId(const qint64 &id) { this->id = id; this->m_id_isSet = true; } QString -OAIUser::getUsername() const { +PFXUser::getUsername() const { return username; } void -OAIUser::setUsername(const QString &username) { +PFXUser::setUsername(const QString &username) { this->username = username; this->m_username_isSet = true; } QString -OAIUser::getFirstName() const { +PFXUser::getFirstName() const { return first_name; } void -OAIUser::setFirstName(const QString &first_name) { +PFXUser::setFirstName(const QString &first_name) { this->first_name = first_name; this->m_first_name_isSet = true; } QString -OAIUser::getLastName() const { +PFXUser::getLastName() const { return last_name; } void -OAIUser::setLastName(const QString &last_name) { +PFXUser::setLastName(const QString &last_name) { this->last_name = last_name; this->m_last_name_isSet = true; } QString -OAIUser::getEmail() const { +PFXUser::getEmail() const { return email; } void -OAIUser::setEmail(const QString &email) { +PFXUser::setEmail(const QString &email) { this->email = email; this->m_email_isSet = true; } QString -OAIUser::getPassword() const { +PFXUser::getPassword() const { return password; } void -OAIUser::setPassword(const QString &password) { +PFXUser::setPassword(const QString &password) { this->password = password; this->m_password_isSet = true; } QString -OAIUser::getPhone() const { +PFXUser::getPhone() const { return phone; } void -OAIUser::setPhone(const QString &phone) { +PFXUser::setPhone(const QString &phone) { this->phone = phone; this->m_phone_isSet = true; } qint32 -OAIUser::getUserStatus() const { +PFXUser::getUserStatus() const { return user_status; } void -OAIUser::setUserStatus(const qint32 &user_status) { +PFXUser::setUserStatus(const qint32 &user_status) { this->user_status = user_status; this->m_user_status_isSet = true; } bool -OAIUser::isSet() const { +PFXUser::isSet() const { bool isObjectUpdated = false; do{ if(m_id_isSet){ isObjectUpdated = true; break;} @@ -251,7 +251,7 @@ OAIUser::isSet() const { } bool -OAIUser::isValid() const { +PFXUser::isValid() const { // only required properties are required for the object to be considered valid return true; } diff --git a/samples/client/petstore/cpp-qt5/client/OAIUser.h b/samples/client/petstore/cpp-qt5/client/PFXUser.h similarity index 88% rename from samples/client/petstore/cpp-qt5/client/OAIUser.h rename to samples/client/petstore/cpp-qt5/client/PFXUser.h index b28f8474aa9..bfda4d5e4e0 100644 --- a/samples/client/petstore/cpp-qt5/client/OAIUser.h +++ b/samples/client/petstore/cpp-qt5/client/PFXUser.h @@ -11,30 +11,30 @@ */ /* - * OAIUser.h + * PFXUser.h * * A User who is purchasing from the pet store */ -#ifndef OAIUser_H -#define OAIUser_H +#ifndef PFXUser_H +#define PFXUser_H #include #include -#include "OAIObject.h" -#include "OAIEnum.h" +#include "PFXObject.h" +#include "PFXEnum.h" -namespace OpenAPI { +namespace test_namespace { -class OAIUser: public OAIObject { +class PFXUser: public PFXObject { public: - OAIUser(); - OAIUser(QString json); - ~OAIUser() override; + PFXUser(); + PFXUser(QString json); + ~PFXUser() override; QString asJson () const override; QJsonObject asJsonObject() const override; @@ -117,6 +117,6 @@ private: } -Q_DECLARE_METATYPE(OpenAPI::OAIUser) +Q_DECLARE_METATYPE(test_namespace::PFXUser) -#endif // OAIUser_H +#endif // PFXUser_H diff --git a/samples/client/petstore/cpp-qt5/client/OAIUserApi.cpp b/samples/client/petstore/cpp-qt5/client/PFXUserApi.cpp similarity index 73% rename from samples/client/petstore/cpp-qt5/client/OAIUserApi.cpp rename to samples/client/petstore/cpp-qt5/client/PFXUserApi.cpp index 05391dc93d3..b47e5a16d38 100644 --- a/samples/client/petstore/cpp-qt5/client/OAIUserApi.cpp +++ b/samples/client/petstore/cpp-qt5/client/PFXUserApi.cpp @@ -10,60 +10,60 @@ * Do not edit the class manually. */ -#include "OAIUserApi.h" -#include "OAIHelpers.h" +#include "PFXUserApi.h" +#include "PFXHelpers.h" #include #include -namespace OpenAPI { +namespace test_namespace { -OAIUserApi::OAIUserApi() : basePath("/v2"), +PFXUserApi::PFXUserApi() : basePath("/v2"), host("petstore.swagger.io"), timeout(0){ } -OAIUserApi::~OAIUserApi() { +PFXUserApi::~PFXUserApi() { } -OAIUserApi::OAIUserApi(const QString& host, const QString& basePath, const int tout) { +PFXUserApi::PFXUserApi(const QString& host, const QString& basePath, const int tout) { this->host = host; this->basePath = basePath; this->timeout = tout; } -void OAIUserApi::setBasePath(const QString& basePath){ +void PFXUserApi::setBasePath(const QString& basePath){ this->basePath = basePath; } -void OAIUserApi::setHost(const QString& host){ +void PFXUserApi::setHost(const QString& host){ this->host = host; } -void OAIUserApi::setApiTimeOutMs(const int tout){ +void PFXUserApi::setApiTimeOutMs(const int tout){ timeout = tout; } -void OAIUserApi::setWorkingDirectory(const QString& path){ +void PFXUserApi::setWorkingDirectory(const QString& path){ workingDirectory = path; } -void OAIUserApi::addHeaders(const QString& key, const QString& value){ +void PFXUserApi::addHeaders(const QString& key, const QString& value){ defaultHeaders.insert(key, value); } void -OAIUserApi::createUser(const OAIUser& body) { +PFXUserApi::createUser(const PFXUser& body) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/user"); - OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this); + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); worker->setTimeOut(timeout); worker->setWorkingDirectory(workingDirectory); - OAIHttpRequestInput input(fullPath, "POST"); + PFXHttpRequestInput input(fullPath, "POST"); QString output = body.asJson(); @@ -75,15 +75,15 @@ OAIUserApi::createUser(const OAIUser& body) { } connect(worker, - &OAIHttpRequestWorker::on_execution_finished, + &PFXHttpRequestWorker::on_execution_finished, this, - &OAIUserApi::createUserCallback); + &PFXUserApi::createUserCallback); worker->execute(&input); } void -OAIUserApi::createUserCallback(OAIHttpRequestWorker * worker) { +PFXUserApi::createUserCallback(PFXHttpRequestWorker * worker) { QString msg; QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; @@ -106,17 +106,17 @@ OAIUserApi::createUserCallback(OAIHttpRequestWorker * worker) { } void -OAIUserApi::createUsersWithArrayInput(const QList& body) { +PFXUserApi::createUsersWithArrayInput(const QList& body) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/user/createWithArray"); - OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this); + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); worker->setTimeOut(timeout); worker->setWorkingDirectory(workingDirectory); - OAIHttpRequestInput input(fullPath, "POST"); + PFXHttpRequestInput input(fullPath, "POST"); - QJsonDocument doc(::OpenAPI::toJsonValue(body).toArray()); + QJsonDocument doc(::test_namespace::toJsonValue(body).toArray()); QByteArray bytes = doc.toJson(); input.request_body.append(bytes); @@ -126,15 +126,15 @@ OAIUserApi::createUsersWithArrayInput(const QList& body) { } connect(worker, - &OAIHttpRequestWorker::on_execution_finished, + &PFXHttpRequestWorker::on_execution_finished, this, - &OAIUserApi::createUsersWithArrayInputCallback); + &PFXUserApi::createUsersWithArrayInputCallback); worker->execute(&input); } void -OAIUserApi::createUsersWithArrayInputCallback(OAIHttpRequestWorker * worker) { +PFXUserApi::createUsersWithArrayInputCallback(PFXHttpRequestWorker * worker) { QString msg; QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; @@ -157,17 +157,17 @@ OAIUserApi::createUsersWithArrayInputCallback(OAIHttpRequestWorker * worker) { } void -OAIUserApi::createUsersWithListInput(const QList& body) { +PFXUserApi::createUsersWithListInput(const QList& body) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/user/createWithList"); - OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this); + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); worker->setTimeOut(timeout); worker->setWorkingDirectory(workingDirectory); - OAIHttpRequestInput input(fullPath, "POST"); + PFXHttpRequestInput input(fullPath, "POST"); - QJsonDocument doc(::OpenAPI::toJsonValue(body).toArray()); + QJsonDocument doc(::test_namespace::toJsonValue(body).toArray()); QByteArray bytes = doc.toJson(); input.request_body.append(bytes); @@ -177,15 +177,15 @@ OAIUserApi::createUsersWithListInput(const QList& body) { } connect(worker, - &OAIHttpRequestWorker::on_execution_finished, + &PFXHttpRequestWorker::on_execution_finished, this, - &OAIUserApi::createUsersWithListInputCallback); + &PFXUserApi::createUsersWithListInputCallback); worker->execute(&input); } void -OAIUserApi::createUsersWithListInputCallback(OAIHttpRequestWorker * worker) { +PFXUserApi::createUsersWithListInputCallback(PFXHttpRequestWorker * worker) { QString msg; QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; @@ -208,17 +208,17 @@ OAIUserApi::createUsersWithListInputCallback(OAIHttpRequestWorker * worker) { } void -OAIUserApi::deleteUser(const QString& username) { +PFXUserApi::deleteUser(const QString& username) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/user/{username}"); QString usernamePathParam("{"); usernamePathParam.append("username").append("}"); - fullPath.replace(usernamePathParam, QUrl::toPercentEncoding(::OpenAPI::toStringValue(username))); + fullPath.replace(usernamePathParam, QUrl::toPercentEncoding(::test_namespace::toStringValue(username))); - OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this); + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); worker->setTimeOut(timeout); worker->setWorkingDirectory(workingDirectory); - OAIHttpRequestInput input(fullPath, "DELETE"); + PFXHttpRequestInput input(fullPath, "DELETE"); @@ -227,15 +227,15 @@ OAIUserApi::deleteUser(const QString& username) { } connect(worker, - &OAIHttpRequestWorker::on_execution_finished, + &PFXHttpRequestWorker::on_execution_finished, this, - &OAIUserApi::deleteUserCallback); + &PFXUserApi::deleteUserCallback); worker->execute(&input); } void -OAIUserApi::deleteUserCallback(OAIHttpRequestWorker * worker) { +PFXUserApi::deleteUserCallback(PFXHttpRequestWorker * worker) { QString msg; QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; @@ -258,17 +258,17 @@ OAIUserApi::deleteUserCallback(OAIHttpRequestWorker * worker) { } void -OAIUserApi::getUserByName(const QString& username) { +PFXUserApi::getUserByName(const QString& username) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/user/{username}"); QString usernamePathParam("{"); usernamePathParam.append("username").append("}"); - fullPath.replace(usernamePathParam, QUrl::toPercentEncoding(::OpenAPI::toStringValue(username))); + fullPath.replace(usernamePathParam, QUrl::toPercentEncoding(::test_namespace::toStringValue(username))); - OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this); + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); worker->setTimeOut(timeout); worker->setWorkingDirectory(workingDirectory); - OAIHttpRequestInput input(fullPath, "GET"); + PFXHttpRequestInput input(fullPath, "GET"); @@ -277,15 +277,15 @@ OAIUserApi::getUserByName(const QString& username) { } connect(worker, - &OAIHttpRequestWorker::on_execution_finished, + &PFXHttpRequestWorker::on_execution_finished, this, - &OAIUserApi::getUserByNameCallback); + &PFXUserApi::getUserByNameCallback); worker->execute(&input); } void -OAIUserApi::getUserByNameCallback(OAIHttpRequestWorker * worker) { +PFXUserApi::getUserByNameCallback(PFXHttpRequestWorker * worker) { QString msg; QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; @@ -296,7 +296,7 @@ OAIUserApi::getUserByNameCallback(OAIHttpRequestWorker * worker) { else { msg = "Error: " + worker->error_str; } - OAIUser output(QString(worker->response)); + PFXUser output(QString(worker->response)); worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { @@ -309,7 +309,7 @@ OAIUserApi::getUserByNameCallback(OAIHttpRequestWorker * worker) { } void -OAIUserApi::loginUser(const QString& username, const QString& password) { +PFXUserApi::loginUser(const QString& username, const QString& password) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/user/login"); @@ -319,7 +319,7 @@ OAIUserApi::loginUser(const QString& username, const QString& password) { fullPath.append("?"); fullPath.append(QUrl::toPercentEncoding("username")) .append("=") - .append(QUrl::toPercentEncoding(::OpenAPI::toStringValue(username))); + .append(QUrl::toPercentEncoding(::test_namespace::toStringValue(username))); if (fullPath.indexOf("?") > 0) fullPath.append("&"); @@ -327,12 +327,12 @@ OAIUserApi::loginUser(const QString& username, const QString& password) { fullPath.append("?"); fullPath.append(QUrl::toPercentEncoding("password")) .append("=") - .append(QUrl::toPercentEncoding(::OpenAPI::toStringValue(password))); + .append(QUrl::toPercentEncoding(::test_namespace::toStringValue(password))); - OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this); + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); worker->setTimeOut(timeout); worker->setWorkingDirectory(workingDirectory); - OAIHttpRequestInput input(fullPath, "GET"); + PFXHttpRequestInput input(fullPath, "GET"); @@ -341,15 +341,15 @@ OAIUserApi::loginUser(const QString& username, const QString& password) { } connect(worker, - &OAIHttpRequestWorker::on_execution_finished, + &PFXHttpRequestWorker::on_execution_finished, this, - &OAIUserApi::loginUserCallback); + &PFXUserApi::loginUserCallback); worker->execute(&input); } void -OAIUserApi::loginUserCallback(OAIHttpRequestWorker * worker) { +PFXUserApi::loginUserCallback(PFXHttpRequestWorker * worker) { QString msg; QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; @@ -361,7 +361,7 @@ OAIUserApi::loginUserCallback(OAIHttpRequestWorker * worker) { msg = "Error: " + worker->error_str; } QString output; - ::OpenAPI::fromStringValue(QString(worker->response), output); + ::test_namespace::fromStringValue(QString(worker->response), output); worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { @@ -374,14 +374,14 @@ OAIUserApi::loginUserCallback(OAIHttpRequestWorker * worker) { } void -OAIUserApi::logoutUser() { +PFXUserApi::logoutUser() { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/user/logout"); - OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this); + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); worker->setTimeOut(timeout); worker->setWorkingDirectory(workingDirectory); - OAIHttpRequestInput input(fullPath, "GET"); + PFXHttpRequestInput input(fullPath, "GET"); @@ -390,15 +390,15 @@ OAIUserApi::logoutUser() { } connect(worker, - &OAIHttpRequestWorker::on_execution_finished, + &PFXHttpRequestWorker::on_execution_finished, this, - &OAIUserApi::logoutUserCallback); + &PFXUserApi::logoutUserCallback); worker->execute(&input); } void -OAIUserApi::logoutUserCallback(OAIHttpRequestWorker * worker) { +PFXUserApi::logoutUserCallback(PFXHttpRequestWorker * worker) { QString msg; QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; @@ -421,17 +421,17 @@ OAIUserApi::logoutUserCallback(OAIHttpRequestWorker * worker) { } void -OAIUserApi::updateUser(const QString& username, const OAIUser& body) { +PFXUserApi::updateUser(const QString& username, const PFXUser& body) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/user/{username}"); QString usernamePathParam("{"); usernamePathParam.append("username").append("}"); - fullPath.replace(usernamePathParam, QUrl::toPercentEncoding(::OpenAPI::toStringValue(username))); + fullPath.replace(usernamePathParam, QUrl::toPercentEncoding(::test_namespace::toStringValue(username))); - OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this); + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); worker->setTimeOut(timeout); worker->setWorkingDirectory(workingDirectory); - OAIHttpRequestInput input(fullPath, "PUT"); + PFXHttpRequestInput input(fullPath, "PUT"); QString output = body.asJson(); @@ -443,15 +443,15 @@ OAIUserApi::updateUser(const QString& username, const OAIUser& body) { } connect(worker, - &OAIHttpRequestWorker::on_execution_finished, + &PFXHttpRequestWorker::on_execution_finished, this, - &OAIUserApi::updateUserCallback); + &PFXUserApi::updateUserCallback); worker->execute(&input); } void -OAIUserApi::updateUserCallback(OAIHttpRequestWorker * worker) { +PFXUserApi::updateUserCallback(PFXHttpRequestWorker * worker) { QString msg; QString error_str = worker->error_str; QNetworkReply::NetworkError error_type = worker->error_type; diff --git a/samples/client/petstore/cpp-qt5/client/OAIUserApi.h b/samples/client/petstore/cpp-qt5/client/PFXUserApi.h similarity index 54% rename from samples/client/petstore/cpp-qt5/client/OAIUserApi.h rename to samples/client/petstore/cpp-qt5/client/PFXUserApi.h index 7a3ab027155..b736ab22fc2 100644 --- a/samples/client/petstore/cpp-qt5/client/OAIUserApi.h +++ b/samples/client/petstore/cpp-qt5/client/PFXUserApi.h @@ -10,26 +10,26 @@ * Do not edit the class manually. */ -#ifndef OAI_OAIUserApi_H -#define OAI_OAIUserApi_H +#ifndef PFX_PFXUserApi_H +#define PFX_PFXUserApi_H -#include "OAIHttpRequest.h" +#include "PFXHttpRequest.h" -#include "OAIUser.h" +#include "PFXUser.h" #include #include #include -namespace OpenAPI { +namespace test_namespace { -class OAIUserApi: public QObject { +class PFXUserApi: public QObject { Q_OBJECT public: - OAIUserApi(); - OAIUserApi(const QString& host, const QString& basePath, const int toutMs = 0); - ~OAIUserApi(); + PFXUserApi(); + PFXUserApi(const QString& host, const QString& basePath, const int toutMs = 0); + ~PFXUserApi(); void setBasePath(const QString& basePath); void setHost(const QString& host); @@ -37,14 +37,14 @@ public: void setWorkingDirectory(const QString& path); void addHeaders(const QString& key, const QString& value); - void createUser(const OAIUser& body); - void createUsersWithArrayInput(const QList& body); - void createUsersWithListInput(const QList& body); + void createUser(const PFXUser& body); + void createUsersWithArrayInput(const QList& body); + void createUsersWithListInput(const QList& body); void deleteUser(const QString& username); void getUserByName(const QString& username); void loginUser(const QString& username, const QString& password); void logoutUser(); - void updateUser(const QString& username, const OAIUser& body); + void updateUser(const QString& username, const PFXUser& body); private: QString basePath; @@ -52,51 +52,51 @@ private: QString workingDirectory; int timeout; QMap defaultHeaders; - void createUserCallback (OAIHttpRequestWorker * worker); - void createUsersWithArrayInputCallback (OAIHttpRequestWorker * worker); - void createUsersWithListInputCallback (OAIHttpRequestWorker * worker); - void deleteUserCallback (OAIHttpRequestWorker * worker); - void getUserByNameCallback (OAIHttpRequestWorker * worker); - void loginUserCallback (OAIHttpRequestWorker * worker); - void logoutUserCallback (OAIHttpRequestWorker * worker); - void updateUserCallback (OAIHttpRequestWorker * worker); + void createUserCallback (PFXHttpRequestWorker * worker); + void createUsersWithArrayInputCallback (PFXHttpRequestWorker * worker); + void createUsersWithListInputCallback (PFXHttpRequestWorker * worker); + void deleteUserCallback (PFXHttpRequestWorker * worker); + void getUserByNameCallback (PFXHttpRequestWorker * worker); + void loginUserCallback (PFXHttpRequestWorker * worker); + void logoutUserCallback (PFXHttpRequestWorker * worker); + void updateUserCallback (PFXHttpRequestWorker * worker); signals: void createUserSignal(); void createUsersWithArrayInputSignal(); void createUsersWithListInputSignal(); void deleteUserSignal(); - void getUserByNameSignal(OAIUser summary); + void getUserByNameSignal(PFXUser summary); void loginUserSignal(QString summary); void logoutUserSignal(); void updateUserSignal(); - void createUserSignalFull(OAIHttpRequestWorker* worker); - void createUsersWithArrayInputSignalFull(OAIHttpRequestWorker* worker); - void createUsersWithListInputSignalFull(OAIHttpRequestWorker* worker); - void deleteUserSignalFull(OAIHttpRequestWorker* worker); - void getUserByNameSignalFull(OAIHttpRequestWorker* worker, OAIUser summary); - void loginUserSignalFull(OAIHttpRequestWorker* worker, QString summary); - void logoutUserSignalFull(OAIHttpRequestWorker* worker); - void updateUserSignalFull(OAIHttpRequestWorker* worker); + void createUserSignalFull(PFXHttpRequestWorker* worker); + void createUsersWithArrayInputSignalFull(PFXHttpRequestWorker* worker); + void createUsersWithListInputSignalFull(PFXHttpRequestWorker* worker); + void deleteUserSignalFull(PFXHttpRequestWorker* worker); + void getUserByNameSignalFull(PFXHttpRequestWorker* worker, PFXUser summary); + void loginUserSignalFull(PFXHttpRequestWorker* worker, QString summary); + void logoutUserSignalFull(PFXHttpRequestWorker* worker); + void updateUserSignalFull(PFXHttpRequestWorker* worker); void createUserSignalE(QNetworkReply::NetworkError error_type, QString error_str); void createUsersWithArrayInputSignalE(QNetworkReply::NetworkError error_type, QString error_str); void createUsersWithListInputSignalE(QNetworkReply::NetworkError error_type, QString error_str); void deleteUserSignalE(QNetworkReply::NetworkError error_type, QString error_str); - void getUserByNameSignalE(OAIUser summary, QNetworkReply::NetworkError error_type, QString error_str); + void getUserByNameSignalE(PFXUser summary, QNetworkReply::NetworkError error_type, QString error_str); void loginUserSignalE(QString summary, QNetworkReply::NetworkError error_type, QString error_str); void logoutUserSignalE(QNetworkReply::NetworkError error_type, QString error_str); void updateUserSignalE(QNetworkReply::NetworkError error_type, QString error_str); - void createUserSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); - void createUsersWithArrayInputSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); - void createUsersWithListInputSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); - void deleteUserSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); - void getUserByNameSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); - void loginUserSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); - void logoutUserSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); - void updateUserSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); + void createUserSignalEFull(PFXHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); + void createUsersWithArrayInputSignalEFull(PFXHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); + void createUsersWithListInputSignalEFull(PFXHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); + void deleteUserSignalEFull(PFXHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); + void getUserByNameSignalEFull(PFXHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); + void loginUserSignalEFull(PFXHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); + void logoutUserSignalEFull(PFXHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); + void updateUserSignalEFull(PFXHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); }; diff --git a/samples/client/petstore/cpp-qt5/client/PFXclient.pri b/samples/client/petstore/cpp-qt5/client/PFXclient.pri new file mode 100644 index 00000000000..e86f90006a1 --- /dev/null +++ b/samples/client/petstore/cpp-qt5/client/PFXclient.pri @@ -0,0 +1,38 @@ +QT += network + +HEADERS += \ +# Models + $${PWD}/PFXApiResponse.h \ + $${PWD}/PFXCategory.h \ + $${PWD}/PFXOrder.h \ + $${PWD}/PFXPet.h \ + $${PWD}/PFXTag.h \ + $${PWD}/PFXUser.h \ +# APIs + $${PWD}/PFXPetApi.h \ + $${PWD}/PFXStoreApi.h \ + $${PWD}/PFXUserApi.h \ +# Others + $${PWD}/PFXHelpers.h \ + $${PWD}/PFXHttpRequest.h \ + $${PWD}/PFXObject.h \ + $${PWD}/PFXEnum.h \ + $${PWD}/PFXHttpFileElement.h + +SOURCES += \ +# Models + $${PWD}/PFXApiResponse.cpp \ + $${PWD}/PFXCategory.cpp \ + $${PWD}/PFXOrder.cpp \ + $${PWD}/PFXPet.cpp \ + $${PWD}/PFXTag.cpp \ + $${PWD}/PFXUser.cpp \ +# APIs + $${PWD}/PFXPetApi.cpp \ + $${PWD}/PFXStoreApi.cpp \ + $${PWD}/PFXUserApi.cpp \ +# Others + $${PWD}/PFXHelpers.cpp \ + $${PWD}/PFXHttpRequest.cpp \ + $${PWD}/PFXHttpFileElement.cpp + diff --git a/samples/client/petstore/cpp-qt5/client/client.pri b/samples/client/petstore/cpp-qt5/client/client.pri deleted file mode 100644 index 3e98ae6c8d2..00000000000 --- a/samples/client/petstore/cpp-qt5/client/client.pri +++ /dev/null @@ -1,38 +0,0 @@ -QT += network - -HEADERS += \ -# Models - $${PWD}/OAIApiResponse.h \ - $${PWD}/OAICategory.h \ - $${PWD}/OAIOrder.h \ - $${PWD}/OAIPet.h \ - $${PWD}/OAITag.h \ - $${PWD}/OAIUser.h \ -# APIs - $${PWD}/OAIPetApi.h \ - $${PWD}/OAIStoreApi.h \ - $${PWD}/OAIUserApi.h \ -# Others - $${PWD}/OAIHelpers.h \ - $${PWD}/OAIHttpRequest.h \ - $${PWD}/OAIObject.h \ - $${PWD}/OAIEnum.h \ - $${PWD}/OAIHttpFileElement.h - -SOURCES += \ -# Models - $${PWD}/OAIApiResponse.cpp \ - $${PWD}/OAICategory.cpp \ - $${PWD}/OAIOrder.cpp \ - $${PWD}/OAIPet.cpp \ - $${PWD}/OAITag.cpp \ - $${PWD}/OAIUser.cpp \ -# APIs - $${PWD}/OAIPetApi.cpp \ - $${PWD}/OAIStoreApi.cpp \ - $${PWD}/OAIUserApi.cpp \ -# Others - $${PWD}/OAIHelpers.cpp \ - $${PWD}/OAIHttpRequest.cpp \ - $${PWD}/OAIHttpFileElement.cpp -