diff --git a/samples/client/petstore/qt5cpp/.swagger-codegen/VERSION b/samples/client/petstore/qt5cpp/.swagger-codegen/VERSION index 855ff9501eb8..096bf47efe31 100644 --- a/samples/client/petstore/qt5cpp/.swagger-codegen/VERSION +++ b/samples/client/petstore/qt5cpp/.swagger-codegen/VERSION @@ -1 +1 @@ -2.4.0-SNAPSHOT \ No newline at end of file +3.0.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/qt5cpp/client/SWGOrder.cpp b/samples/client/petstore/qt5cpp/client/SWGOrder.cpp index 59184cbc12b2..184856cdeb69 100644 --- a/samples/client/petstore/qt5cpp/client/SWGOrder.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGOrder.cpp @@ -111,6 +111,9 @@ SWGOrder::asJsonObject() { if(m_quantity_isSet){ obj.insert("quantity", QJsonValue(quantity)); } + if(ship_date != nullptr && *ship_date != QString("")){ + toJsonValue(QString("shipDate"), ship_date, obj, QString("QDateTime")); + } if(ship_date != nullptr) { toJsonValue(QString("shipDate"), ship_date, obj, QString("QDateTime")); } @@ -192,7 +195,7 @@ SWGOrder::isSet(){ if(m_id_isSet){ isObjectUpdated = true; break;} if(m_pet_id_isSet){ isObjectUpdated = true; break;} if(m_quantity_isSet){ isObjectUpdated = true; break;} - + if(ship_date != nullptr && *ship_date != QString("")){ isObjectUpdated = true; break;} if(status != nullptr && *status != QString("")){ isObjectUpdated = true; break;} if(m_complete_isSet){ isObjectUpdated = true; break;} }while(false); diff --git a/samples/client/petstore/qt5cpp/client/SWGPet.cpp b/samples/client/petstore/qt5cpp/client/SWGPet.cpp index e98abbd431cb..04d33927df5e 100644 --- a/samples/client/petstore/qt5cpp/client/SWGPet.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGPet.cpp @@ -39,7 +39,7 @@ void SWGPet::init() { id = 0L; m_id_isSet = false; - category = new SWGCategory(); + category = new SWG#/components/schemas/Category(); m_category_isSet = false; name = new QString(""); m_name_isSet = false; diff --git a/samples/client/petstore/qt5cpp/client/SWGPetApi.cpp b/samples/client/petstore/qt5cpp/client/SWGPetApi.cpp index 3dffe9c0695b..056a023231de 100644 --- a/samples/client/petstore/qt5cpp/client/SWGPetApi.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGPetApi.cpp @@ -29,7 +29,7 @@ SWGPetApi::SWGPetApi(QString host, QString basePath) { } void -SWGPetApi::addPet(SWGPet& body) { +SWGPetApi::addPet(SWGPet& pet) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/pet"); @@ -40,7 +40,7 @@ SWGPetApi::addPet(SWGPet& body) { - QString output = body.asJson(); + QString output = pet.asJson(); input.request_body.append(output); @@ -81,7 +81,7 @@ SWGPetApi::addPetCallback(SWGHttpRequestWorker * worker) { } void -SWGPetApi::deletePet(qint64 pet_id, QString* api_key) { +SWGPetApi::deletePet(qint32 pet_id, QString* api_key) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/pet/{petId}"); @@ -140,47 +140,13 @@ SWGPetApi::findPetsByStatus(QList* status) { fullPath.append(this->host).append(this->basePath).append("/pet/findByStatus"); - - - if (status->size() > 0) { - if (QString("csv").indexOf("multi") == 0) { - foreach(QString* t, *status) { - if (fullPath.indexOf("?") > 0) - fullPath.append("&"); - else - fullPath.append("?"); - fullPath.append("status=").append(stringValue(t)); - } - } - else if (QString("csv").indexOf("ssv") == 0) { - if (fullPath.indexOf("?") > 0) - fullPath.append("&"); - else - fullPath.append("?"); - fullPath.append("status="); - qint32 count = 0; - foreach(QString* t, *status) { - if (count > 0) { - fullPath.append(" "); - } - fullPath.append(stringValue(t)); - } - } - else if (QString("csv").indexOf("tsv") == 0) { - if (fullPath.indexOf("?") > 0) - fullPath.append("&"); - else - fullPath.append("?"); - fullPath.append("status="); - qint32 count = 0; - foreach(QString* t, *status) { - if (count > 0) { - fullPath.append("\t"); - } - fullPath.append(stringValue(t)); - } - } - } + if (fullPath.indexOf("?") > 0) + fullPath.append("&"); + else + fullPath.append("?"); + fullPath.append(QUrl::toPercentEncoding("status")) + .append("=") + .append(QUrl::toPercentEncoding(stringValue(status))); SWGHttpRequestWorker *worker = new SWGHttpRequestWorker(); @@ -245,47 +211,13 @@ SWGPetApi::findPetsByTags(QList* tags) { fullPath.append(this->host).append(this->basePath).append("/pet/findByTags"); - - - if (tags->size() > 0) { - if (QString("csv").indexOf("multi") == 0) { - foreach(QString* t, *tags) { - if (fullPath.indexOf("?") > 0) - fullPath.append("&"); - else - fullPath.append("?"); - fullPath.append("tags=").append(stringValue(t)); - } - } - else if (QString("csv").indexOf("ssv") == 0) { - if (fullPath.indexOf("?") > 0) - fullPath.append("&"); - else - fullPath.append("?"); - fullPath.append("tags="); - qint32 count = 0; - foreach(QString* t, *tags) { - if (count > 0) { - fullPath.append(" "); - } - fullPath.append(stringValue(t)); - } - } - else if (QString("csv").indexOf("tsv") == 0) { - if (fullPath.indexOf("?") > 0) - fullPath.append("&"); - else - fullPath.append("?"); - fullPath.append("tags="); - qint32 count = 0; - foreach(QString* t, *tags) { - if (count > 0) { - fullPath.append("\t"); - } - fullPath.append(stringValue(t)); - } - } - } + if (fullPath.indexOf("?") > 0) + fullPath.append("&"); + else + fullPath.append("?"); + fullPath.append(QUrl::toPercentEncoding("tags")) + .append("=") + .append(QUrl::toPercentEncoding(stringValue(tags))); SWGHttpRequestWorker *worker = new SWGHttpRequestWorker(); @@ -345,7 +277,7 @@ SWGPetApi::findPetsByTagsCallback(SWGHttpRequestWorker * worker) { } void -SWGPetApi::getPetById(qint64 pet_id) { +SWGPetApi::getPetById(qint32 pet_id) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/pet/{petId}"); @@ -399,7 +331,7 @@ SWGPetApi::getPetByIdCallback(SWGHttpRequestWorker * worker) { } void -SWGPetApi::updatePet(SWGPet& body) { +SWGPetApi::updatePet(SWGPet& pet) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/pet"); @@ -410,7 +342,7 @@ SWGPetApi::updatePet(SWGPet& body) { - QString output = body.asJson(); + QString output = pet.asJson(); input.request_body.append(output); @@ -451,7 +383,7 @@ SWGPetApi::updatePetCallback(SWGHttpRequestWorker * worker) { } void -SWGPetApi::updatePetWithForm(qint64 pet_id, QString* name, QString* status) { +SWGPetApi::updatePetWithForm(qint32 pet_id, QString* name, QString* status) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/pet/{petId}"); @@ -508,7 +440,7 @@ SWGPetApi::updatePetWithFormCallback(SWGHttpRequestWorker * worker) { } void -SWGPetApi::uploadFile(qint64 pet_id, QString* additional_metadata, SWGHttpRequestInputFileElement* file) { +SWGPetApi::uploadFile(qint32 pet_id, QString* additional_metadata, SWGHttpRequestInputFileElement* file) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/pet/{petId}/uploadImage"); @@ -523,7 +455,7 @@ SWGPetApi::uploadFile(qint64 pet_id, QString* additional_metadata, SWGHttpReques input.add_var("additionalMetadata", *additional_metadata); } if (file != nullptr) { - input.add_file("file", (*file).local_filename, (*file).request_filename, (*file).mime_type); + input.add_var("file", *file); } diff --git a/samples/client/petstore/qt5cpp/client/SWGPetApi.h b/samples/client/petstore/qt5cpp/client/SWGPetApi.h index ad40b90a8794..cb856bc423c8 100644 --- a/samples/client/petstore/qt5cpp/client/SWGPetApi.h +++ b/samples/client/petstore/qt5cpp/client/SWGPetApi.h @@ -36,14 +36,14 @@ class SWGPetApi: public QObject { QString basePath; QMap defaultHeaders; - void addPet(SWGPet& body); - void deletePet(qint64 pet_id, QString* api_key); + void addPet(SWGPet& pet); + void deletePet(qint32 pet_id, QString* api_key); void findPetsByStatus(QList* status); void findPetsByTags(QList* tags); - void getPetById(qint64 pet_id); - void updatePet(SWGPet& body); - void updatePetWithForm(qint64 pet_id, QString* name, QString* status); - void uploadFile(qint64 pet_id, QString* additional_metadata, SWGHttpRequestInputFileElement* file); + void getPetById(qint32 pet_id); + void updatePet(SWGPet& pet); + void updatePetWithForm(qint32 pet_id, QString* name, QString* status); + void uploadFile(qint32 pet_id, QString* additional_metadata, SWGHttpRequestInputFileElement* file); private: void addPetCallback (SWGHttpRequestWorker * worker); diff --git a/samples/client/petstore/qt5cpp/client/SWGQObjectWrapper.h b/samples/client/petstore/qt5cpp/client/SWGQObjectWrapper.h new file mode 100644 index 000000000000..9252b5db2e2e --- /dev/null +++ b/samples/client/petstore/qt5cpp/client/SWGQObjectWrapper.h @@ -0,0 +1,35 @@ +/** + * Swagger Petstore + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +#ifndef SWG_QOBJECT_WRAPPER_H +#define SWG_QOBJECT_WRAPPER_H + +#include + +namespace Swagger { + + template + class SWGQObjectWrapper : public QObject { + public: + SWGQObjectWrapper(ObjectPtrT ptr){ + data = ptr; + } + ~SWGQObjectWrapper(){ + delete data; + } + private : + ObjectPtrT data; + }; + +} + +#endif // SWG_QOBJECT_WRAPPER_H \ No newline at end of file diff --git a/samples/client/petstore/qt5cpp/client/SWGStoreApi.cpp b/samples/client/petstore/qt5cpp/client/SWGStoreApi.cpp index 3b38f5710a25..4bf85da1c000 100644 --- a/samples/client/petstore/qt5cpp/client/SWGStoreApi.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGStoreApi.cpp @@ -141,7 +141,7 @@ SWGStoreApi::getInventoryCallback(SWGHttpRequestWorker * worker) { } void -SWGStoreApi::getOrderById(qint64 order_id) { +SWGStoreApi::getOrderById(qint32 order_id) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/store/order/{orderId}"); @@ -195,7 +195,7 @@ SWGStoreApi::getOrderByIdCallback(SWGHttpRequestWorker * worker) { } void -SWGStoreApi::placeOrder(SWGOrder& body) { +SWGStoreApi::placeOrder(SWGOrder& order) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/store/order"); @@ -206,7 +206,7 @@ SWGStoreApi::placeOrder(SWGOrder& body) { - QString output = body.asJson(); + QString output = order.asJson(); input.request_body.append(output); diff --git a/samples/client/petstore/qt5cpp/client/SWGStoreApi.h b/samples/client/petstore/qt5cpp/client/SWGStoreApi.h index c6d9acc5a26e..cc4a8e5cde08 100644 --- a/samples/client/petstore/qt5cpp/client/SWGStoreApi.h +++ b/samples/client/petstore/qt5cpp/client/SWGStoreApi.h @@ -37,8 +37,8 @@ class SWGStoreApi: public QObject { void deleteOrder(QString* order_id); void getInventory(); - void getOrderById(qint64 order_id); - void placeOrder(SWGOrder& body); + void getOrderById(qint32 order_id); + void placeOrder(SWGOrder& order); private: void deleteOrderCallback (SWGHttpRequestWorker * worker); diff --git a/samples/client/petstore/qt5cpp/client/SWGUserApi.cpp b/samples/client/petstore/qt5cpp/client/SWGUserApi.cpp index 328e1e82d3a0..37f35551b00b 100644 --- a/samples/client/petstore/qt5cpp/client/SWGUserApi.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGUserApi.cpp @@ -29,7 +29,7 @@ SWGUserApi::SWGUserApi(QString host, QString basePath) { } void -SWGUserApi::createUser(SWGUser& body) { +SWGUserApi::createUser(SWGUser& user) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/user"); @@ -40,7 +40,7 @@ SWGUserApi::createUser(SWGUser& body) { - QString output = body.asJson(); + QString output = user.asJson(); input.request_body.append(output); @@ -81,7 +81,7 @@ SWGUserApi::createUserCallback(SWGHttpRequestWorker * worker) { } void -SWGUserApi::createUsersWithArrayInput(QList*& body) { +SWGUserApi::createUsersWithArrayInput(QList*& swg_user) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/user/createWithArray"); @@ -91,10 +91,10 @@ SWGUserApi::createUsersWithArrayInput(QList*& body) { SWGHttpRequestInput input(fullPath, "POST"); - QJsonObject body_jobj; - toJsonArray((QList*)body, body_jobj, QString("body"), QString("SWGUser*")); + QJsonObject swg_user_jobj; + toJsonArray((QList*)swg_user, swg_user_jobj, QString("body"), QString("SWGUser*")); - QJsonDocument doc(body_jobj); + QJsonDocument doc(swg_user_jobj); QByteArray bytes = doc.toJson(); input.request_body.append(bytes); @@ -137,7 +137,7 @@ SWGUserApi::createUsersWithArrayInputCallback(SWGHttpRequestWorker * worker) { } void -SWGUserApi::createUsersWithListInput(QList*& body) { +SWGUserApi::createUsersWithListInput(QList*& swg_user) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/user/createWithList"); @@ -147,10 +147,10 @@ SWGUserApi::createUsersWithListInput(QList*& body) { SWGHttpRequestInput input(fullPath, "POST"); - QJsonObject body_jobj; - toJsonArray((QList*)body, body_jobj, QString("body"), QString("SWGUser*")); + QJsonObject swg_user_jobj; + toJsonArray((QList*)swg_user, swg_user_jobj, QString("body"), QString("SWGUser*")); - QJsonDocument doc(body_jobj); + QJsonDocument doc(swg_user_jobj); QByteArray bytes = doc.toJson(); input.request_body.append(bytes); @@ -415,7 +415,7 @@ SWGUserApi::logoutUserCallback(SWGHttpRequestWorker * worker) { } void -SWGUserApi::updateUser(QString* username, SWGUser& body) { +SWGUserApi::updateUser(QString* username, SWGUser& user) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/user/{username}"); @@ -428,7 +428,7 @@ SWGUserApi::updateUser(QString* username, SWGUser& body) { - QString output = body.asJson(); + QString output = user.asJson(); input.request_body.append(output); diff --git a/samples/client/petstore/qt5cpp/client/SWGUserApi.h b/samples/client/petstore/qt5cpp/client/SWGUserApi.h index a667e85dee74..e4fbd4a4b6a6 100644 --- a/samples/client/petstore/qt5cpp/client/SWGUserApi.h +++ b/samples/client/petstore/qt5cpp/client/SWGUserApi.h @@ -15,7 +15,6 @@ #include "SWGHttpRequest.h" -#include #include #include "SWGUser.h" @@ -35,14 +34,14 @@ class SWGUserApi: public QObject { QString basePath; QMap defaultHeaders; - void createUser(SWGUser& body); - void createUsersWithArrayInput(QList*& body); - void createUsersWithListInput(QList*& body); + void createUser(SWGUser& user); + void createUsersWithArrayInput(QList*& swg_user); + void createUsersWithListInput(QList*& swg_user); void deleteUser(QString* username); void getUserByName(QString* username); void loginUser(QString* username, QString* password); void logoutUser(); - void updateUser(QString* username, SWGUser& body); + void updateUser(QString* username, SWGUser& user); private: void createUserCallback (SWGHttpRequestWorker * worker); diff --git a/samples/client/petstore/qt5cpp/client/client.pri b/samples/client/petstore/qt5cpp/client/client.pri new file mode 100644 index 000000000000..c4202c44aee0 --- /dev/null +++ b/samples/client/petstore/qt5cpp/client/client.pri @@ -0,0 +1,37 @@ +QT += network + +HEADERS += \ +# Models + $${PWD}/SWGApiResponse.h \ + $${PWD}/SWGCategory.h \ + $${PWD}/SWGOrder.h \ + $${PWD}/SWGPet.h \ + $${PWD}/SWGTag.h \ + $${PWD}/SWGUser.h \ +# APIs + $${PWD}/SWGPetApi.h \ + $${PWD}/SWGStoreApi.h \ + $${PWD}/SWGUserApi.h \ +# Others + $${PWD}/SWGHelpers.h \ + $${PWD}/SWGHttpRequest.h \ + $${PWD}/SWGModelFactory.h \ + $${PWD}/SWGObject.h \ + $${PWD}/SWGQObjectWrapper.h + +SOURCES += \ +# Models + $${PWD}/SWGApiResponse.cpp \ + $${PWD}/SWGCategory.cpp \ + $${PWD}/SWGOrder.cpp \ + $${PWD}/SWGPet.cpp \ + $${PWD}/SWGTag.cpp \ + $${PWD}/SWGUser.cpp \ +# APIs + $${PWD}/SWGPetApi.cpp \ + $${PWD}/SWGStoreApi.cpp \ + $${PWD}/SWGUserApi.cpp \ +# Others + $${PWD}/SWGHelpers.cpp \ + $${PWD}/SWGHttpRequest.cpp +