[qt] update Qt client

This commit is contained in:
Martin Delille 2018-03-30 14:02:16 +02:00
parent 27404894d7
commit ee2eb74f75
11 changed files with 128 additions and 122 deletions

View File

@ -1 +1 @@
2.4.0-SNAPSHOT
3.0.0-SNAPSHOT

View File

@ -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);

View File

@ -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;

View File

@ -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<QString*>* 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<QString*>* 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);
}

View File

@ -36,14 +36,14 @@ public:
QString basePath;
QMap<QString, QString> 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<QString*>* status);
void findPetsByTags(QList<QString*>* 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);

View File

@ -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 <QObject>
namespace Swagger {
template <typename ObjectPtrT>
class SWGQObjectWrapper : public QObject {
public:
SWGQObjectWrapper(ObjectPtrT ptr){
data = ptr;
}
~SWGQObjectWrapper(){
delete data;
}
private :
ObjectPtrT data;
};
}
#endif // SWG_QOBJECT_WRAPPER_H

View File

@ -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);

View File

@ -37,8 +37,8 @@ public:
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);

View File

@ -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<SWGUser*>*& body) {
SWGUserApi::createUsersWithArrayInput(QList<SWGUser*>*& swg_user) {
QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/user/createWithArray");
@ -91,10 +91,10 @@ SWGUserApi::createUsersWithArrayInput(QList<SWGUser*>*& body) {
SWGHttpRequestInput input(fullPath, "POST");
QJsonObject body_jobj;
toJsonArray((QList<void*>*)body, body_jobj, QString("body"), QString("SWGUser*"));
QJsonObject swg_user_jobj;
toJsonArray((QList<void*>*)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<SWGUser*>*& body) {
SWGUserApi::createUsersWithListInput(QList<SWGUser*>*& swg_user) {
QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/user/createWithList");
@ -147,10 +147,10 @@ SWGUserApi::createUsersWithListInput(QList<SWGUser*>*& body) {
SWGHttpRequestInput input(fullPath, "POST");
QJsonObject body_jobj;
toJsonArray((QList<void*>*)body, body_jobj, QString("body"), QString("SWGUser*"));
QJsonObject swg_user_jobj;
toJsonArray((QList<void*>*)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);

View File

@ -15,7 +15,6 @@
#include "SWGHttpRequest.h"
#include <QList>
#include <QString>
#include "SWGUser.h"
@ -35,14 +34,14 @@ public:
QString basePath;
QMap<QString, QString> defaultHeaders;
void createUser(SWGUser& body);
void createUsersWithArrayInput(QList<SWGUser*>*& body);
void createUsersWithListInput(QList<SWGUser*>*& body);
void createUser(SWGUser& user);
void createUsersWithArrayInput(QList<SWGUser*>*& swg_user);
void createUsersWithListInput(QList<SWGUser*>*& 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);

View File

@ -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