Merge pull request #20 from wing328/qt-update-client

[qt] update client
This commit is contained in:
William Cheng 2018-04-08 16:55:33 +08:00 committed by GitHub
commit e447e7dfb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 16 additions and 477 deletions

View File

@ -1,126 +0,0 @@
/**
* 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.
*/
#include "SWGBody.h"
#include "SWGHelpers.h"
#include <QJsonDocument>
#include <QJsonArray>
#include <QObject>
#include <QDebug>
namespace Swagger {
SWGBody::SWGBody(QString json) {
init();
this->fromJson(json);
}
SWGBody::SWGBody() {
init();
}
SWGBody::~SWGBody() {
this->cleanup();
}
void
SWGBody::init() {
name = new QString("");
m_name_isSet = false;
status = new QString("");
m_status_isSet = false;
}
void
SWGBody::cleanup() {
if(name != nullptr) {
delete name;
}
if(status != nullptr) {
delete status;
}
}
SWGBody*
SWGBody::fromJson(QString json) {
QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object();
this->fromJsonObject(jsonObject);
return this;
}
void
SWGBody::fromJsonObject(QJsonObject pJson) {
::Swagger::setValue(&name, pJson["name"], "QString", "QString");
::Swagger::setValue(&status, pJson["status"], "QString", "QString");
}
QString
SWGBody::asJson ()
{
QJsonObject obj = this->asJsonObject();
QJsonDocument doc(obj);
QByteArray bytes = doc.toJson();
return QString(bytes);
}
QJsonObject
SWGBody::asJsonObject() {
QJsonObject obj;
if(name != nullptr && *name != QString("")){
toJsonValue(QString("name"), name, obj, QString("QString"));
}
if(status != nullptr && *status != QString("")){
toJsonValue(QString("status"), status, obj, QString("QString"));
}
return obj;
}
QString*
SWGBody::getName() {
return name;
}
void
SWGBody::setName(QString* name) {
this->name = name;
this->m_name_isSet = true;
}
QString*
SWGBody::getStatus() {
return status;
}
void
SWGBody::setStatus(QString* status) {
this->status = status;
this->m_status_isSet = true;
}
bool
SWGBody::isSet(){
bool isObjectUpdated = false;
do{
if(name != nullptr && *name != QString("")){ isObjectUpdated = true; break;}
if(status != nullptr && *status != QString("")){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}
}

View File

@ -1,64 +0,0 @@
/**
* 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.
*/
/*
* SWGBody.h
*
*
*/
#ifndef SWGBody_H_
#define SWGBody_H_
#include <QJsonObject>
#include <QString>
#include "SWGObject.h"
namespace Swagger {
class SWGBody: public SWGObject {
public:
SWGBody();
SWGBody(QString json);
~SWGBody();
void init();
void cleanup();
QString asJson () override;
QJsonObject asJsonObject() override;
void fromJsonObject(QJsonObject json) override;
SWGBody* fromJson(QString jsonString) override;
QString* getName();
void setName(QString* name);
QString* getStatus();
void setStatus(QString* status);
virtual bool isSet() override;
private:
QString* name;
bool m_name_isSet;
QString* status;
bool m_status_isSet;
};
}
#endif /* SWGBody_H_ */

View File

@ -1,126 +0,0 @@
/**
* 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.
*/
#include "SWGBody_1.h"
#include "SWGHelpers.h"
#include <QJsonDocument>
#include <QJsonArray>
#include <QObject>
#include <QDebug>
namespace Swagger {
SWGBody_1::SWGBody_1(QString json) {
init();
this->fromJson(json);
}
SWGBody_1::SWGBody_1() {
init();
}
SWGBody_1::~SWGBody_1() {
this->cleanup();
}
void
SWGBody_1::init() {
additional_metadata = new QString("");
m_additional_metadata_isSet = false;
file = NULL;
m_file_isSet = false;
}
void
SWGBody_1::cleanup() {
if(additional_metadata != nullptr) {
delete additional_metadata;
}
if(file != nullptr) {
delete file;
}
}
SWGBody_1*
SWGBody_1::fromJson(QString json) {
QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object();
this->fromJsonObject(jsonObject);
return this;
}
void
SWGBody_1::fromJsonObject(QJsonObject pJson) {
::Swagger::setValue(&additional_metadata, pJson["additionalMetadata"], "QString", "QString");
::Swagger::setValue(&file, pJson["file"], "SWGHttpRequestInputFileElement", "SWGHttpRequestInputFileElement");
}
QString
SWGBody_1::asJson ()
{
QJsonObject obj = this->asJsonObject();
QJsonDocument doc(obj);
QByteArray bytes = doc.toJson();
return QString(bytes);
}
QJsonObject
SWGBody_1::asJsonObject() {
QJsonObject obj;
if(additional_metadata != nullptr && *additional_metadata != QString("")){
toJsonValue(QString("additionalMetadata"), additional_metadata, obj, QString("QString"));
}
if((file != nullptr) && (file->isSet())){
toJsonValue(QString("file"), file, obj, QString("SWGHttpRequestInputFileElement"));
}
return obj;
}
QString*
SWGBody_1::getAdditionalMetadata() {
return additional_metadata;
}
void
SWGBody_1::setAdditionalMetadata(QString* additional_metadata) {
this->additional_metadata = additional_metadata;
this->m_additional_metadata_isSet = true;
}
SWGHttpRequestInputFileElement*
SWGBody_1::getFile() {
return file;
}
void
SWGBody_1::setFile(SWGHttpRequestInputFileElement* file) {
this->file = file;
this->m_file_isSet = true;
}
bool
SWGBody_1::isSet(){
bool isObjectUpdated = false;
do{
if(additional_metadata != nullptr && *additional_metadata != QString("")){ isObjectUpdated = true; break;}
if(file != nullptr && file->isSet()){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}
}

View File

@ -1,65 +0,0 @@
/**
* 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.
*/
/*
* SWGBody_1.h
*
*
*/
#ifndef SWGBody_1_H_
#define SWGBody_1_H_
#include <QJsonObject>
#include "SWGHttpRequest.h"
#include <QString>
#include "SWGObject.h"
namespace Swagger {
class SWGBody_1: public SWGObject {
public:
SWGBody_1();
SWGBody_1(QString json);
~SWGBody_1();
void init();
void cleanup();
QString asJson () override;
QJsonObject asJsonObject() override;
void fromJsonObject(QJsonObject json) override;
SWGBody_1* fromJson(QString jsonString) override;
QString* getAdditionalMetadata();
void setAdditionalMetadata(QString* additional_metadata);
SWGHttpRequestInputFileElement* getFile();
void setFile(SWGHttpRequestInputFileElement* file);
virtual bool isSet() override;
private:
QString* additional_metadata;
bool m_additional_metadata_isSet;
SWGHttpRequestInputFileElement* file;
bool m_file_isSet;
};
}
#endif /* SWGBody_1_H_ */

View File

@ -16,8 +16,6 @@
#include "SWGObject.h"
#include "SWGApiResponse.h"
#include "SWGBody.h"
#include "SWGBody_1.h"
#include "SWGCategory.h"
#include "SWGOrder.h"
#include "SWGPet.h"
@ -30,12 +28,6 @@ namespace Swagger {
if(QString("SWGApiResponse").compare(type) == 0) {
return new SWGApiResponse();
}
if(QString("SWGBody").compare(type) == 0) {
return new SWGBody();
}
if(QString("SWGBody_1").compare(type) == 0) {
return new SWGBody_1();
}
if(QString("SWGCategory").compare(type) == 0) {
return new SWGCategory();
}

View File

@ -141,47 +141,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();
@ -248,47 +214,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();

View File

@ -126,8 +126,8 @@ SWGStoreApi::getInventoryCallback(SWGHttpRequestWorker * worker) {
QJsonObject obj = doc.object();
foreach(QString key, obj.keys()) {
QMap val;
setValue(&val, obj[key], "QMap", QString());
qint32 val;
setValue(&val, obj[key], "qint32", QString());
output->insert(key, val);
}
worker->deleteLater();

View File

@ -3,8 +3,6 @@ QT += network
HEADERS += \
# Models
$${PWD}/SWGApiResponse.h \
$${PWD}/SWGBody.h \
$${PWD}/SWGBody_1.h \
$${PWD}/SWGCategory.h \
$${PWD}/SWGOrder.h \
$${PWD}/SWGPet.h \
@ -24,8 +22,6 @@ HEADERS += \
SOURCES += \
# Models
$${PWD}/SWGApiResponse.cpp \
$${PWD}/SWGBody.cpp \
$${PWD}/SWGBody_1.cpp \
$${PWD}/SWGCategory.cpp \
$${PWD}/SWGOrder.cpp \
$${PWD}/SWGPet.cpp \