mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-07 19:08:52 +00:00
Merge remote-tracking branch 'origin/master' into 2.3.0
This commit is contained in:
commit
af16601654
@ -3171,7 +3171,12 @@ public class DefaultCodegen {
|
||||
buf.append(StringUtils.capitalize(part));
|
||||
}
|
||||
}
|
||||
return buf.toString().replaceAll("[^a-zA-Z ]", "");
|
||||
String returnTag = buf.toString().replaceAll("[^a-zA-Z0-9_]", "");
|
||||
if (returnTag.matches("\\d.*")) {
|
||||
return "_" + returnTag;
|
||||
} else {
|
||||
return returnTag;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -134,7 +134,7 @@ namespace {{packageName}}.{{packageContext}}.Utils
|
||||
private static IDictionary<Type, Func<Parameter, object>> CreateParsers()
|
||||
{
|
||||
var parsers = ImmutableDictionary.CreateBuilder<Type, Func<Parameter, object>>();
|
||||
parsers.Put(typeof(string), value => value);
|
||||
parsers.Put(typeof(string), value => value.Value);
|
||||
parsers.Put(typeof(bool), SafeParse(bool.Parse));
|
||||
parsers.Put(typeof(bool?), SafeParse(bool.Parse));
|
||||
parsers.Put(typeof(byte), SafeParse(byte.Parse));
|
||||
@ -411,4 +411,4 @@ namespace {{packageName}}.{{packageContext}}.Utils
|
||||
Path,
|
||||
Header
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ void HttpRequestInput::add_file(QString variable_name, QString local_filename, Q
|
||||
|
||||
|
||||
HttpRequestWorker::HttpRequestWorker(QObject *parent)
|
||||
: QObject(parent), manager(NULL)
|
||||
: QObject(parent), manager(nullptr)
|
||||
{
|
||||
qsrand(QDateTime::currentDateTime().toTime_t());
|
||||
|
||||
@ -181,8 +181,8 @@ void HttpRequestWorker::execute(HttpRequestInput *input) {
|
||||
|
||||
// ensure necessary variables are available
|
||||
if (
|
||||
file_info->local_filename == NULL || file_info->local_filename.isEmpty()
|
||||
|| file_info->variable_name == NULL || file_info->variable_name.isEmpty()
|
||||
file_info->local_filename == nullptr || file_info->local_filename.isEmpty()
|
||||
|| file_info->variable_name == nullptr || file_info->variable_name.isEmpty()
|
||||
|| !fi.exists() || !fi.isFile() || !fi.isReadable()
|
||||
) {
|
||||
// silent abort for the current file
|
||||
@ -196,7 +196,7 @@ void HttpRequestWorker::execute(HttpRequestInput *input) {
|
||||
}
|
||||
|
||||
// ensure filename for the request
|
||||
if (file_info->request_filename == NULL || file_info->request_filename.isEmpty()) {
|
||||
if (file_info->request_filename == nullptr || file_info->request_filename.isEmpty()) {
|
||||
file_info->request_filename = fi.fileName();
|
||||
if (file_info->request_filename.isEmpty()) {
|
||||
file_info->request_filename = "file";
|
||||
@ -215,7 +215,7 @@ void HttpRequestWorker::execute(HttpRequestInput *input) {
|
||||
));
|
||||
request_content.append(new_line);
|
||||
|
||||
if (file_info->mime_type != NULL && !file_info->mime_type.isEmpty()) {
|
||||
if (file_info->mime_type != nullptr && !file_info->mime_type.isEmpty()) {
|
||||
request_content.append("Content-Type: ");
|
||||
request_content.append(file_info->mime_type);
|
||||
request_content.append(new_line);
|
||||
|
@ -87,7 +87,7 @@ void
|
||||
HttpRequestWorker *worker = new HttpRequestWorker();
|
||||
HttpRequestInput input(fullPath, "{{httpMethod}}");
|
||||
|
||||
{{#formParams}}if ({{paramName}} != NULL) {
|
||||
{{#formParams}}if ({{paramName}} != nullptr) {
|
||||
{{^isFile}}input.add_var("{{baseName}}", *{{paramName}});{{/isFile}}{{#isFile}}input.add_file("{{baseName}}", (*{{paramName}}).local_filename, (*{{paramName}}).request_filename, (*{{paramName}}).mime_type);{{/isFile}}
|
||||
}
|
||||
{{/formParams}}
|
||||
|
@ -10,7 +10,7 @@ namespace Swagger {
|
||||
|
||||
void
|
||||
setValue(void* value, QJsonValue obj, QString type, QString complexType) {
|
||||
if(value == NULL) {
|
||||
if(value == nullptr) {
|
||||
// can't set value with a null pointer
|
||||
return;
|
||||
}
|
||||
@ -37,7 +37,7 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) {
|
||||
else if (QStringLiteral("QString").compare(type) == 0) {
|
||||
QString **val = static_cast<QString**>(value);
|
||||
|
||||
if(val != NULL) {
|
||||
if(val != nullptr) {
|
||||
if(!obj.isNull()) {
|
||||
// create a new value and return
|
||||
delete *val;
|
||||
@ -45,19 +45,19 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
// set target to NULL
|
||||
// set target to nullptr
|
||||
delete *val;
|
||||
*val = NULL;
|
||||
*val = nullptr;
|
||||
}
|
||||
}
|
||||
else {
|
||||
qDebug() << "Can't set value because the target pointer is NULL";
|
||||
qDebug() << "Can't set value because the target pointer is nullptr";
|
||||
}
|
||||
}
|
||||
else if (QStringLiteral("QDateTime").compare(type) == 0) {
|
||||
QDateTime **val = static_cast<QDateTime**>(value);
|
||||
|
||||
if(val != NULL) {
|
||||
if(val != nullptr) {
|
||||
if(!obj.isNull()) {
|
||||
// create a new value and return
|
||||
delete *val;
|
||||
@ -65,19 +65,19 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
// set target to NULL
|
||||
// set target to nullptr
|
||||
delete *val;
|
||||
*val = NULL;
|
||||
*val = nullptr;
|
||||
}
|
||||
}
|
||||
else {
|
||||
qDebug() << "Can't set value because the target pointer is NULL";
|
||||
qDebug() << "Can't set value because the target pointer is nullptr";
|
||||
}
|
||||
}
|
||||
else if (QStringLiteral("QDate").compare(type) == 0) {
|
||||
QDate **val = static_cast<QDate**>(value);
|
||||
|
||||
if(val != NULL) {
|
||||
if(val != nullptr) {
|
||||
if(!obj.isNull()) {
|
||||
// create a new value and return
|
||||
delete *val;
|
||||
@ -85,19 +85,19 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
// set target to NULL
|
||||
// set target to nullptr
|
||||
delete *val;
|
||||
*val = NULL;
|
||||
*val = nullptr;
|
||||
}
|
||||
}
|
||||
else {
|
||||
qDebug() << "Can't set value because the target pointer is NULL";
|
||||
qDebug() << "Can't set value because the target pointer is nullptr";
|
||||
}
|
||||
}
|
||||
else if (QStringLiteral("QByteArray").compare(type) == 0) {
|
||||
QByteArray **val = static_cast<QByteArray**>(value);
|
||||
|
||||
if(val != NULL) {
|
||||
if(val != nullptr) {
|
||||
if(!obj.isNull()) {
|
||||
// create a new value and return
|
||||
delete *val;
|
||||
@ -106,20 +106,20 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
// set target to NULL
|
||||
// set target to nullptr
|
||||
delete *val;
|
||||
*val = NULL;
|
||||
*val = nullptr;
|
||||
}
|
||||
}
|
||||
else {
|
||||
qDebug() << "Can't set value because the target pointer is NULL";
|
||||
qDebug() << "Can't set value because the target pointer is nullptr";
|
||||
}
|
||||
}
|
||||
else if(type.startsWith("SWG") && obj.isObject()) {
|
||||
// complex type
|
||||
QJsonObject jsonObj = obj.toObject();
|
||||
SWGObject * so = (SWGObject*)Swagger::create(type);
|
||||
if(so != NULL) {
|
||||
if(so != nullptr) {
|
||||
so->fromJsonObject(jsonObj);
|
||||
SWGObject **val = static_cast<SWGObject**>(value);
|
||||
delete *val;
|
||||
@ -167,19 +167,19 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) {
|
||||
output->append((void*)&val);
|
||||
}
|
||||
else if(QStringLiteral("QString").compare(complexType) == 0) {
|
||||
QString val;
|
||||
QString * val = new QString();
|
||||
setValue(&val, jval, QStringLiteral("QString"), QStringLiteral(""));
|
||||
output->append((void*)&val);
|
||||
output->append((void*)val);
|
||||
}
|
||||
else if(QStringLiteral("QDate").compare(complexType) == 0) {
|
||||
QDate val;
|
||||
QDate * val = new QDate();
|
||||
setValue(&val, jval, QStringLiteral("QDate"), QStringLiteral(""));
|
||||
output->append((void*)&val);
|
||||
output->append((void*)val);
|
||||
}
|
||||
else if(QStringLiteral("QDateTime").compare(complexType) == 0) {
|
||||
QDateTime val;
|
||||
QDateTime * val = new QDateTime();
|
||||
setValue(&val, jval, QStringLiteral("QDateTime"), QStringLiteral(""));
|
||||
output->append((void*)&val);
|
||||
output->append((void*)val);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -191,14 +191,14 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) {
|
||||
|
||||
void
|
||||
toJsonValue(QString name, void* value, QJsonObject* output, QString type) {
|
||||
if(value == NULL) {
|
||||
if(value == nullptr) {
|
||||
return;
|
||||
}
|
||||
if(type.startsWith("SWG")) {
|
||||
SWGObject *swgObject = reinterpret_cast<SWGObject *>(value);
|
||||
if(swgObject != NULL) {
|
||||
if(swgObject != nullptr) {
|
||||
QJsonObject* o = (*swgObject).asJsonObject();
|
||||
if(name != NULL) {
|
||||
if(name != nullptr) {
|
||||
output->insert(name, *o);
|
||||
delete o;
|
||||
}
|
||||
@ -253,7 +253,7 @@ toJsonArray(QList<void*>* value, QJsonArray* output, QString innerName, QString
|
||||
foreach(void* obj, *value) {
|
||||
QJsonObject element;
|
||||
|
||||
toJsonValue(NULL, obj, &element, innerType);
|
||||
toJsonValue(nullptr, obj, &element, innerType);
|
||||
output->append(element);
|
||||
}
|
||||
}
|
||||
|
@ -27,13 +27,15 @@ namespace Swagger {
|
||||
|
||||
void
|
||||
{{classname}}::init() {
|
||||
{{#vars}}{{name}} = {{{defaultValue}}};
|
||||
{{#vars}}
|
||||
{{name}} = {{{defaultValue}}};
|
||||
{{/vars}}
|
||||
}
|
||||
|
||||
void
|
||||
{{classname}}::cleanup() {
|
||||
{{#vars}}{{#complexType}}if({{name}} != NULL) {
|
||||
{{#vars}}{{#complexType}}
|
||||
if({{name}} != nullptr) {
|
||||
{{#isContainer}}QList<{{complexType}}*>* arr = {{name}};
|
||||
foreach({{complexType}}* o, *arr) {
|
||||
delete o;
|
||||
@ -54,7 +56,12 @@ void
|
||||
|
||||
void
|
||||
{{classname}}::fromJsonObject(QJsonObject &pJson) {
|
||||
{{#vars}}setValue(&{{name}}, pJson["{{name}}"], "{{baseType}}", "{{complexType}}");
|
||||
{{#vars}}
|
||||
{{^isContainer}}::Swagger::setValue(&{{name}}, pJson["{{name}}"], "{{baseType}}", "{{complexType}}");{{/isContainer}}
|
||||
{{#isContainer}}
|
||||
{{#complexType}}::Swagger::setValue(&{{name}}, pJson["{{name}}"], "{{baseType}}", "{{complexType}}");{{/complexType}}
|
||||
{{^complexType}}::Swagger::setValue(&{{name}}, pJson["{{name}}"], "{{baseType}}", "{{items.baseType}}");{{/complexType}}
|
||||
{{/isContainer}}
|
||||
{{/vars}}
|
||||
}
|
||||
|
||||
@ -71,21 +78,18 @@ QString
|
||||
QJsonObject*
|
||||
{{classname}}::asJsonObject() {
|
||||
QJsonObject* obj = new QJsonObject();
|
||||
{{#vars}}{{#complexType}}
|
||||
{{^isContainer}}{{#complexType}}
|
||||
toJsonValue(QString("{{name}}"), {{name}}, obj, QString("{{complexType}}"));
|
||||
{{/complexType}}{{^complexType}}
|
||||
else if({{name}} != NULL && *{{name}} != NULL) {
|
||||
obj->insert("{{name}}", QJsonValue(*{{name}}));
|
||||
}{{/complexType}}
|
||||
{{/isContainer}}{{#isContainer}}
|
||||
QList<{{complexType}}*>* {{name}}List = {{name}};
|
||||
{{#vars}}{{#complexType}}{{^isContainer}}{{#complexType}}
|
||||
toJsonValue(QString("{{name}}"), {{name}}, obj, QString("{{complexType}}"));{{/complexType}}{{^complexType}}
|
||||
if({{name}} != nullptr && *{{name}} != nullptr) {
|
||||
obj->insert("{{name}}", QJsonValue(*{{name}}));
|
||||
}{{/complexType}}{{/isContainer}}{{#isContainer}}
|
||||
QJsonArray {{name}}JsonArray;
|
||||
toJsonArray((QList<void*>*){{name}}, &{{name}}JsonArray, "{{name}}", "{{complexType}}");
|
||||
|
||||
obj->insert("{{name}}", {{name}}JsonArray);
|
||||
{{/isContainer}}
|
||||
{{/complexType}}{{^complexType}}obj->insert("{{name}}", QJsonValue({{name}}));{{/complexType}}
|
||||
obj->insert("{{name}}", {{name}}JsonArray);{{/isContainer}}{{/complexType}}{{^complexType}}{{^isContainer}}
|
||||
obj->insert("{{name}}", QJsonValue({{name}}));{{/isContainer}}{{#isContainer}}
|
||||
QJsonArray {{name}}JsonArray;
|
||||
toJsonArray((QList<void*>*){{name}}, &{{name}}JsonArray, "{{name}}", "{{items.baseType}}");
|
||||
obj->insert("{{name}}", {{name}}JsonArray);{{/isContainer}}{{/complexType}}
|
||||
{{/vars}}
|
||||
|
||||
return obj;
|
||||
|
@ -32,12 +32,15 @@ public:
|
||||
void fromJsonObject(QJsonObject &json);
|
||||
{{classname}}* fromJson(QString &jsonString);
|
||||
|
||||
{{#vars}}{{{datatype}}} {{getter}}();
|
||||
{{#vars}}
|
||||
{{{datatype}}} {{getter}}();
|
||||
void {{setter}}({{{datatype}}} {{name}});
|
||||
|
||||
{{/vars}}
|
||||
|
||||
private:
|
||||
{{#vars}}{{{datatype}}} {{name}};
|
||||
{{#vars}}
|
||||
{{{datatype}}} {{name}};
|
||||
{{/vars}}
|
||||
};
|
||||
|
||||
|
@ -11,19 +11,19 @@ namespace Swagger {
|
||||
return new {{classname}}();
|
||||
}
|
||||
{{/model}}{{/models}}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
inline void* create(QString json, QString type) {
|
||||
void* val = create(type);
|
||||
if(val != NULL) {
|
||||
if(val != nullptr) {
|
||||
SWGObject* obj = static_cast<SWGObject*>(val);
|
||||
return obj->fromJson(json);
|
||||
}
|
||||
if(type.startsWith("QString")) {
|
||||
return new QString();
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
} /* namespace Swagger */
|
||||
|
||||
|
@ -7,12 +7,12 @@
|
||||
class {{prefix}}Object {
|
||||
public:
|
||||
virtual QJsonObject* asJsonObject() {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
virtual ~SWGObject() {}
|
||||
virtual SWGObject* fromJson(QString &jsonString) {
|
||||
Q_UNUSED(jsonString);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
virtual void fromJsonObject(QJsonObject &json) {
|
||||
Q_UNUSED(json);
|
||||
|
@ -20,9 +20,5 @@ oauth2 server [undertow-server-oauth2](https://github.com/networknt/undertow-ser
|
||||
Bearer eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJ1cm46Y29tOm5ldHdvcmtudDpvYXV0aDI6djEiLCJhdWQiOiJ1cm46Y29tLm5ldHdvcmtudCIsImV4cCI6MTc4ODEzMjczNSwianRpIjoiNWtyM2ZWOHJaelBZNEJrSnNYZzFpQSIsImlhdCI6MTQ3Mjc3MjczNSwibmJmIjoxNDcyNzcyNjE1LCJ2ZXJzaW9uIjoiMS4wIiwidXNlcl9pZCI6InN0ZXZlIiwidXNlcl90eXBlIjoiRU1QTE9ZRUUiLCJjbGllbnRfaWQiOiJkZGNhZjBiYS0xMTMxLTIyMzItMzMxMy1kNmYyNzUzZjI1ZGMiLCJzY29wZSI6WyJhcGkuciIsImFwaS53Il19.gteJiy1uao8HLeWRljpZxHWUgQfofwmnFP-zv3EPUyXjyCOy3xclnfeTnTE39j8PgBwdFASPcDLLk1YfZJbsU6pLlmYXLtdpHDBsVmIRuch6LFPCVQ3JdqSQVci59OhSK0bBThGWqCD3UzDI_OnX4IVCAahcT9Bu94m5u_H_JNmwDf1XaP3Lt4I34buYMuRD9stchsnZi-tuIRkL13FARm1XA9aPZUMUXFdedBWDXo1zMREQ_qCJXOpaZDJM9Im0rIkq9wTEVU00pbRp_Vcdya3dfkFteBMHiwFVt6VNQaco5BXURDAIzXidwQxNEbX1ek03wra8AIani65ZK7fy_w
|
||||
```
|
||||
|
||||
Postman is the best tool to test REST APIs
|
||||
|
||||
Add "Authorization" header with value as above token and a dummy message will return from the generated stub.
|
||||
|
||||
|
||||
|
||||
|
@ -13,6 +13,17 @@ import java.util.List;
|
||||
|
||||
public class CodegenTest {
|
||||
|
||||
@Test(description = "test sanitizeTag")
|
||||
public void sanitizeTagTest() {
|
||||
final DefaultCodegen codegen = new DefaultCodegen();
|
||||
Assert.assertEquals(codegen.sanitizeTag("foo"), "Foo");
|
||||
Assert.assertEquals(codegen.sanitizeTag("foo bar"), "FooBar");
|
||||
Assert.assertEquals(codegen.sanitizeTag("foo_bar"), "Foo_bar");
|
||||
Assert.assertEquals(codegen.sanitizeTag("foo1 bar2"), "Foo1Bar2");
|
||||
Assert.assertEquals(codegen.sanitizeTag("foo bar 1"), "FooBar1");
|
||||
Assert.assertEquals(codegen.sanitizeTag("1foo"), "_1foo");
|
||||
}
|
||||
|
||||
@Test(description = "read a file upload param from a 2.0 spec")
|
||||
public void fileUploadParamTest() {
|
||||
final Swagger model = parseAndPrepareSwagger("src/test/resources/2_0/petstore.json");
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 4.1.0, 2016-10-19T16:38:58. -->
|
||||
<!-- Written by QtCreator 4.1.0, 2016-10-22T23:06:06. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
|
@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "ApiResponse.h"
|
||||
#include "SWGApiResponse.h"
|
||||
|
||||
#include "SWGHelpers.h"
|
||||
|
||||
@ -35,39 +35,41 @@
|
||||
namespace Swagger {
|
||||
|
||||
|
||||
ApiResponse::ApiResponse(QString* json) {
|
||||
SWGApiResponse::SWGApiResponse(QString* json) {
|
||||
init();
|
||||
this->fromJson(*json);
|
||||
}
|
||||
|
||||
ApiResponse::ApiResponse() {
|
||||
SWGApiResponse::SWGApiResponse() {
|
||||
init();
|
||||
}
|
||||
|
||||
ApiResponse::~ApiResponse() {
|
||||
SWGApiResponse::~SWGApiResponse() {
|
||||
this->cleanup();
|
||||
}
|
||||
|
||||
void
|
||||
ApiResponse::init() {
|
||||
SWGApiResponse::init() {
|
||||
code = 0;
|
||||
type = new QString("");
|
||||
message = new QString("");
|
||||
type = new QString("");
|
||||
message = new QString("");
|
||||
}
|
||||
|
||||
void
|
||||
ApiResponse::cleanup() {
|
||||
SWGApiResponse::cleanup() {
|
||||
|
||||
if(type != NULL) {
|
||||
|
||||
if(type != nullptr) {
|
||||
delete type;
|
||||
}
|
||||
if(message != NULL) {
|
||||
|
||||
if(message != nullptr) {
|
||||
delete message;
|
||||
}
|
||||
}
|
||||
|
||||
ApiResponse*
|
||||
ApiResponse::fromJson(QString &json) {
|
||||
SWGApiResponse*
|
||||
SWGApiResponse::fromJson(QString &json) {
|
||||
QByteArray array (json.toStdString().c_str());
|
||||
QJsonDocument doc = QJsonDocument::fromJson(array);
|
||||
QJsonObject jsonObject = doc.object();
|
||||
@ -76,14 +78,14 @@ ApiResponse::fromJson(QString &json) {
|
||||
}
|
||||
|
||||
void
|
||||
ApiResponse::fromJsonObject(QJsonObject &pJson) {
|
||||
setValue(&code, pJson["code"], "qint32", "");
|
||||
setValue(&type, pJson["type"], "QString", "QString");
|
||||
setValue(&message, pJson["message"], "QString", "QString");
|
||||
SWGApiResponse::fromJsonObject(QJsonObject &pJson) {
|
||||
::Swagger::setValue(&code, pJson["code"], "qint32", "");
|
||||
::Swagger::setValue(&type, pJson["type"], "QString", "QString");
|
||||
::Swagger::setValue(&message, pJson["message"], "QString", "QString");
|
||||
}
|
||||
|
||||
QString
|
||||
ApiResponse::asJson ()
|
||||
SWGApiResponse::asJson ()
|
||||
{
|
||||
QJsonObject* obj = this->asJsonObject();
|
||||
|
||||
@ -93,47 +95,42 @@ ApiResponse::asJson ()
|
||||
}
|
||||
|
||||
QJsonObject*
|
||||
ApiResponse::asJsonObject() {
|
||||
SWGApiResponse::asJsonObject() {
|
||||
QJsonObject* obj = new QJsonObject();
|
||||
|
||||
obj->insert("code", QJsonValue(code));
|
||||
|
||||
|
||||
toJsonValue(QString("type"), type, obj, QString("QString"));
|
||||
|
||||
|
||||
|
||||
|
||||
toJsonValue(QString("message"), message, obj, QString("QString"));
|
||||
|
||||
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
qint32
|
||||
ApiResponse::getCode() {
|
||||
SWGApiResponse::getCode() {
|
||||
return code;
|
||||
}
|
||||
void
|
||||
ApiResponse::setCode(qint32 code) {
|
||||
SWGApiResponse::setCode(qint32 code) {
|
||||
this->code = code;
|
||||
}
|
||||
|
||||
QString*
|
||||
ApiResponse::getType() {
|
||||
SWGApiResponse::getType() {
|
||||
return type;
|
||||
}
|
||||
void
|
||||
ApiResponse::setType(QString* type) {
|
||||
SWGApiResponse::setType(QString* type) {
|
||||
this->type = type;
|
||||
}
|
||||
|
||||
QString*
|
||||
ApiResponse::getMessage() {
|
||||
SWGApiResponse::getMessage() {
|
||||
return message;
|
||||
}
|
||||
void
|
||||
ApiResponse::setMessage(QString* message) {
|
||||
SWGApiResponse::setMessage(QString* message) {
|
||||
this->message = message;
|
||||
}
|
||||
|
||||
|
@ -56,15 +56,18 @@ public:
|
||||
|
||||
qint32 getCode();
|
||||
void setCode(qint32 code);
|
||||
QString* getType();
|
||||
|
||||
QString* getType();
|
||||
void setType(QString* type);
|
||||
QString* getMessage();
|
||||
|
||||
QString* getMessage();
|
||||
void setMessage(QString* message);
|
||||
|
||||
|
||||
private:
|
||||
qint32 code;
|
||||
QString* type;
|
||||
QString* message;
|
||||
QString* type;
|
||||
QString* message;
|
||||
};
|
||||
|
||||
} /* namespace Swagger */
|
||||
|
@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "Category.h"
|
||||
#include "SWGCategory.h"
|
||||
|
||||
#include "SWGHelpers.h"
|
||||
|
||||
@ -35,35 +35,36 @@
|
||||
namespace Swagger {
|
||||
|
||||
|
||||
Category::Category(QString* json) {
|
||||
SWGCategory::SWGCategory(QString* json) {
|
||||
init();
|
||||
this->fromJson(*json);
|
||||
}
|
||||
|
||||
Category::Category() {
|
||||
SWGCategory::SWGCategory() {
|
||||
init();
|
||||
}
|
||||
|
||||
Category::~Category() {
|
||||
SWGCategory::~SWGCategory() {
|
||||
this->cleanup();
|
||||
}
|
||||
|
||||
void
|
||||
Category::init() {
|
||||
SWGCategory::init() {
|
||||
id = 0L;
|
||||
name = new QString("");
|
||||
name = new QString("");
|
||||
}
|
||||
|
||||
void
|
||||
Category::cleanup() {
|
||||
SWGCategory::cleanup() {
|
||||
|
||||
if(name != NULL) {
|
||||
|
||||
if(name != nullptr) {
|
||||
delete name;
|
||||
}
|
||||
}
|
||||
|
||||
Category*
|
||||
Category::fromJson(QString &json) {
|
||||
SWGCategory*
|
||||
SWGCategory::fromJson(QString &json) {
|
||||
QByteArray array (json.toStdString().c_str());
|
||||
QJsonDocument doc = QJsonDocument::fromJson(array);
|
||||
QJsonObject jsonObject = doc.object();
|
||||
@ -72,13 +73,13 @@ Category::fromJson(QString &json) {
|
||||
}
|
||||
|
||||
void
|
||||
Category::fromJsonObject(QJsonObject &pJson) {
|
||||
setValue(&id, pJson["id"], "qint64", "");
|
||||
setValue(&name, pJson["name"], "QString", "QString");
|
||||
SWGCategory::fromJsonObject(QJsonObject &pJson) {
|
||||
::Swagger::setValue(&id, pJson["id"], "qint64", "");
|
||||
::Swagger::setValue(&name, pJson["name"], "QString", "QString");
|
||||
}
|
||||
|
||||
QString
|
||||
Category::asJson ()
|
||||
SWGCategory::asJson ()
|
||||
{
|
||||
QJsonObject* obj = this->asJsonObject();
|
||||
|
||||
@ -88,33 +89,31 @@ Category::asJson ()
|
||||
}
|
||||
|
||||
QJsonObject*
|
||||
Category::asJsonObject() {
|
||||
SWGCategory::asJsonObject() {
|
||||
QJsonObject* obj = new QJsonObject();
|
||||
|
||||
obj->insert("id", QJsonValue(id));
|
||||
|
||||
|
||||
toJsonValue(QString("name"), name, obj, QString("QString"));
|
||||
|
||||
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
qint64
|
||||
Category::getId() {
|
||||
SWGCategory::getId() {
|
||||
return id;
|
||||
}
|
||||
void
|
||||
Category::setId(qint64 id) {
|
||||
SWGCategory::setId(qint64 id) {
|
||||
this->id = id;
|
||||
}
|
||||
|
||||
QString*
|
||||
Category::getName() {
|
||||
SWGCategory::getName() {
|
||||
return name;
|
||||
}
|
||||
void
|
||||
Category::setName(QString* name) {
|
||||
SWGCategory::setName(QString* name) {
|
||||
this->name = name;
|
||||
}
|
||||
|
||||
|
@ -56,12 +56,14 @@ public:
|
||||
|
||||
qint64 getId();
|
||||
void setId(qint64 id);
|
||||
QString* getName();
|
||||
|
||||
QString* getName();
|
||||
void setName(QString* name);
|
||||
|
||||
|
||||
private:
|
||||
qint64 id;
|
||||
QString* name;
|
||||
QString* name;
|
||||
};
|
||||
|
||||
} /* namespace Swagger */
|
||||
|
@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "Order.h"
|
||||
#include "SWGOrder.h"
|
||||
|
||||
#include "SWGHelpers.h"
|
||||
|
||||
@ -35,45 +35,47 @@
|
||||
namespace Swagger {
|
||||
|
||||
|
||||
Order::Order(QString* json) {
|
||||
SWGOrder::SWGOrder(QString* json) {
|
||||
init();
|
||||
this->fromJson(*json);
|
||||
}
|
||||
|
||||
Order::Order() {
|
||||
SWGOrder::SWGOrder() {
|
||||
init();
|
||||
}
|
||||
|
||||
Order::~Order() {
|
||||
SWGOrder::~SWGOrder() {
|
||||
this->cleanup();
|
||||
}
|
||||
|
||||
void
|
||||
Order::init() {
|
||||
SWGOrder::init() {
|
||||
id = 0L;
|
||||
petId = 0L;
|
||||
quantity = 0;
|
||||
shipDate = NULL;
|
||||
status = new QString("");
|
||||
complete = false;
|
||||
pet_id = 0L;
|
||||
quantity = 0;
|
||||
ship_date = NULL;
|
||||
status = new QString("");
|
||||
complete = false;
|
||||
}
|
||||
|
||||
void
|
||||
Order::cleanup() {
|
||||
SWGOrder::cleanup() {
|
||||
|
||||
|
||||
|
||||
if(shipDate != NULL) {
|
||||
delete shipDate;
|
||||
|
||||
if(ship_date != nullptr) {
|
||||
delete ship_date;
|
||||
}
|
||||
if(status != NULL) {
|
||||
|
||||
if(status != nullptr) {
|
||||
delete status;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Order*
|
||||
Order::fromJson(QString &json) {
|
||||
SWGOrder*
|
||||
SWGOrder::fromJson(QString &json) {
|
||||
QByteArray array (json.toStdString().c_str());
|
||||
QJsonDocument doc = QJsonDocument::fromJson(array);
|
||||
QJsonObject jsonObject = doc.object();
|
||||
@ -82,17 +84,17 @@ Order::fromJson(QString &json) {
|
||||
}
|
||||
|
||||
void
|
||||
Order::fromJsonObject(QJsonObject &pJson) {
|
||||
setValue(&id, pJson["id"], "qint64", "");
|
||||
setValue(&petId, pJson["petId"], "qint64", "");
|
||||
setValue(&quantity, pJson["quantity"], "qint32", "");
|
||||
setValue(&shipDate, pJson["shipDate"], "QDateTime", "QDateTime");
|
||||
setValue(&status, pJson["status"], "QString", "QString");
|
||||
setValue(&complete, pJson["complete"], "bool", "");
|
||||
SWGOrder::fromJsonObject(QJsonObject &pJson) {
|
||||
::Swagger::setValue(&id, pJson["id"], "qint64", "");
|
||||
::Swagger::setValue(&pet_id, pJson["pet_id"], "qint64", "");
|
||||
::Swagger::setValue(&quantity, pJson["quantity"], "qint32", "");
|
||||
::Swagger::setValue(&ship_date, pJson["ship_date"], "QDateTime", "QDateTime");
|
||||
::Swagger::setValue(&status, pJson["status"], "QString", "QString");
|
||||
::Swagger::setValue(&complete, pJson["complete"], "bool", "");
|
||||
}
|
||||
|
||||
QString
|
||||
Order::asJson ()
|
||||
SWGOrder::asJson ()
|
||||
{
|
||||
QJsonObject* obj = this->asJsonObject();
|
||||
|
||||
@ -102,77 +104,75 @@ Order::asJson ()
|
||||
}
|
||||
|
||||
QJsonObject*
|
||||
Order::asJsonObject() {
|
||||
SWGOrder::asJsonObject() {
|
||||
QJsonObject* obj = new QJsonObject();
|
||||
|
||||
obj->insert("id", QJsonValue(id));
|
||||
obj->insert("petId", QJsonValue(petId));
|
||||
obj->insert("quantity", QJsonValue(quantity));
|
||||
|
||||
|
||||
toJsonValue(QString("shipDate"), shipDate, obj, QString("QDateTime"));
|
||||
|
||||
|
||||
obj->insert("pet_id", QJsonValue(pet_id));
|
||||
|
||||
obj->insert("quantity", QJsonValue(quantity));
|
||||
|
||||
toJsonValue(QString("ship_date"), ship_date, obj, QString("QDateTime"));
|
||||
|
||||
|
||||
toJsonValue(QString("status"), status, obj, QString("QString"));
|
||||
|
||||
|
||||
obj->insert("complete", QJsonValue(complete));
|
||||
|
||||
obj->insert("complete", QJsonValue(complete));
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
qint64
|
||||
Order::getId() {
|
||||
SWGOrder::getId() {
|
||||
return id;
|
||||
}
|
||||
void
|
||||
Order::setId(qint64 id) {
|
||||
SWGOrder::setId(qint64 id) {
|
||||
this->id = id;
|
||||
}
|
||||
|
||||
qint64
|
||||
Order::getPetId() {
|
||||
return petId;
|
||||
SWGOrder::getPetId() {
|
||||
return pet_id;
|
||||
}
|
||||
void
|
||||
Order::setPetId(qint64 petId) {
|
||||
this->petId = petId;
|
||||
SWGOrder::setPetId(qint64 pet_id) {
|
||||
this->pet_id = pet_id;
|
||||
}
|
||||
|
||||
qint32
|
||||
Order::getQuantity() {
|
||||
SWGOrder::getQuantity() {
|
||||
return quantity;
|
||||
}
|
||||
void
|
||||
Order::setQuantity(qint32 quantity) {
|
||||
SWGOrder::setQuantity(qint32 quantity) {
|
||||
this->quantity = quantity;
|
||||
}
|
||||
|
||||
QDateTime*
|
||||
Order::getShipDate() {
|
||||
return shipDate;
|
||||
SWGOrder::getShipDate() {
|
||||
return ship_date;
|
||||
}
|
||||
void
|
||||
Order::setShipDate(QDateTime* shipDate) {
|
||||
this->shipDate = shipDate;
|
||||
SWGOrder::setShipDate(QDateTime* ship_date) {
|
||||
this->ship_date = ship_date;
|
||||
}
|
||||
|
||||
QString*
|
||||
Order::getStatus() {
|
||||
SWGOrder::getStatus() {
|
||||
return status;
|
||||
}
|
||||
void
|
||||
Order::setStatus(QString* status) {
|
||||
SWGOrder::setStatus(QString* status) {
|
||||
this->status = status;
|
||||
}
|
||||
|
||||
bool
|
||||
Order::getComplete() {
|
||||
SWGOrder::getComplete() {
|
||||
return complete;
|
||||
}
|
||||
void
|
||||
Order::setComplete(bool complete) {
|
||||
SWGOrder::setComplete(bool complete) {
|
||||
this->complete = complete;
|
||||
}
|
||||
|
||||
|
@ -23,13 +23,13 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Order.h
|
||||
* SWGOrder.h
|
||||
*
|
||||
* An order for a pets from the pet store
|
||||
*/
|
||||
|
||||
#ifndef Order_H_
|
||||
#define Order_H_
|
||||
#ifndef SWGOrder_H_
|
||||
#define SWGOrder_H_
|
||||
|
||||
#include <QJsonObject>
|
||||
|
||||
@ -42,41 +42,47 @@
|
||||
|
||||
namespace Swagger {
|
||||
|
||||
class Order: public SWGObject {
|
||||
class SWGOrder: public SWGObject {
|
||||
public:
|
||||
Order();
|
||||
Order(QString* json);
|
||||
virtual ~Order();
|
||||
SWGOrder();
|
||||
SWGOrder(QString* json);
|
||||
virtual ~SWGOrder();
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
QString asJson ();
|
||||
QJsonObject* asJsonObject();
|
||||
void fromJsonObject(QJsonObject &json);
|
||||
Order* fromJson(QString &jsonString);
|
||||
SWGOrder* fromJson(QString &jsonString);
|
||||
|
||||
qint64 getId();
|
||||
void setId(qint64 id);
|
||||
qint64 getPetId();
|
||||
void setPetId(qint64 petId);
|
||||
qint32 getQuantity();
|
||||
|
||||
qint64 getPetId();
|
||||
void setPetId(qint64 pet_id);
|
||||
|
||||
qint32 getQuantity();
|
||||
void setQuantity(qint32 quantity);
|
||||
QDateTime* getShipDate();
|
||||
void setShipDate(QDateTime* shipDate);
|
||||
QString* getStatus();
|
||||
|
||||
QDateTime* getShipDate();
|
||||
void setShipDate(QDateTime* ship_date);
|
||||
|
||||
QString* getStatus();
|
||||
void setStatus(QString* status);
|
||||
bool getComplete();
|
||||
|
||||
bool getComplete();
|
||||
void setComplete(bool complete);
|
||||
|
||||
|
||||
private:
|
||||
qint64 id;
|
||||
qint64 petId;
|
||||
qint32 quantity;
|
||||
QDateTime* shipDate;
|
||||
QString* status;
|
||||
bool complete;
|
||||
qint64 pet_id;
|
||||
qint32 quantity;
|
||||
QDateTime* ship_date;
|
||||
QString* status;
|
||||
bool complete;
|
||||
};
|
||||
|
||||
} /* namespace Swagger */
|
||||
|
||||
#endif /* Order_H_ */
|
||||
#endif /* SWGOrder_H_ */
|
||||
|
@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "Pet.h"
|
||||
#include "SWGPet.h"
|
||||
|
||||
#include "SWGHelpers.h"
|
||||
|
||||
@ -35,59 +35,64 @@
|
||||
namespace Swagger {
|
||||
|
||||
|
||||
Pet::Pet(QString* json) {
|
||||
SWGPet::SWGPet(QString* json) {
|
||||
init();
|
||||
this->fromJson(*json);
|
||||
}
|
||||
|
||||
Pet::Pet() {
|
||||
SWGPet::SWGPet() {
|
||||
init();
|
||||
}
|
||||
|
||||
Pet::~Pet() {
|
||||
SWGPet::~SWGPet() {
|
||||
this->cleanup();
|
||||
}
|
||||
|
||||
void
|
||||
Pet::init() {
|
||||
SWGPet::init() {
|
||||
id = 0L;
|
||||
category = new Category();
|
||||
name = new QString("");
|
||||
photoUrls = new QList<QString*>();
|
||||
tags = new QList<Tag*>();
|
||||
status = new QString("");
|
||||
category = new SWGCategory();
|
||||
name = new QString("");
|
||||
photo_urls = new QList<QString*>();
|
||||
tags = new QList<SWGTag*>();
|
||||
status = new QString("");
|
||||
}
|
||||
|
||||
void
|
||||
Pet::cleanup() {
|
||||
SWGPet::cleanup() {
|
||||
|
||||
if(category != NULL) {
|
||||
|
||||
if(category != nullptr) {
|
||||
delete category;
|
||||
}
|
||||
if(name != NULL) {
|
||||
|
||||
if(name != nullptr) {
|
||||
delete name;
|
||||
}
|
||||
if(photoUrls != NULL) {
|
||||
QList<QString*>* arr = photoUrls;
|
||||
|
||||
if(photo_urls != nullptr) {
|
||||
QList<QString*>* arr = photo_urls;
|
||||
foreach(QString* o, *arr) {
|
||||
delete o;
|
||||
}
|
||||
delete photoUrls;
|
||||
delete photo_urls;
|
||||
}
|
||||
if(tags != NULL) {
|
||||
QList<Tag*>* arr = tags;
|
||||
foreach(Tag* o, *arr) {
|
||||
|
||||
if(tags != nullptr) {
|
||||
QList<SWGTag*>* arr = tags;
|
||||
foreach(SWGTag* o, *arr) {
|
||||
delete o;
|
||||
}
|
||||
delete tags;
|
||||
}
|
||||
if(status != NULL) {
|
||||
|
||||
if(status != nullptr) {
|
||||
delete status;
|
||||
}
|
||||
}
|
||||
|
||||
Pet*
|
||||
Pet::fromJson(QString &json) {
|
||||
SWGPet*
|
||||
SWGPet::fromJson(QString &json) {
|
||||
QByteArray array (json.toStdString().c_str());
|
||||
QJsonDocument doc = QJsonDocument::fromJson(array);
|
||||
QJsonObject jsonObject = doc.object();
|
||||
@ -96,17 +101,21 @@ Pet::fromJson(QString &json) {
|
||||
}
|
||||
|
||||
void
|
||||
Pet::fromJsonObject(QJsonObject &pJson) {
|
||||
setValue(&id, pJson["id"], "qint64", "");
|
||||
setValue(&category, pJson["category"], "Category", "Category");
|
||||
setValue(&name, pJson["name"], "QString", "QString");
|
||||
setValue(&photoUrls, pJson["photoUrls"], "QList", "QString");
|
||||
setValue(&tags, pJson["tags"], "QList", "Tag");
|
||||
setValue(&status, pJson["status"], "QString", "QString");
|
||||
SWGPet::fromJsonObject(QJsonObject &pJson) {
|
||||
::Swagger::setValue(&id, pJson["id"], "qint64", "");
|
||||
::Swagger::setValue(&category, pJson["category"], "SWGCategory", "SWGCategory");
|
||||
::Swagger::setValue(&name, pJson["name"], "QString", "QString");
|
||||
|
||||
::Swagger::setValue(&photo_urls, pJson["photo_urls"], "QList", "QString");
|
||||
|
||||
|
||||
::Swagger::setValue(&tags, pJson["tags"], "QList", "SWGTag");
|
||||
|
||||
::Swagger::setValue(&status, pJson["status"], "QString", "QString");
|
||||
}
|
||||
|
||||
QString
|
||||
Pet::asJson ()
|
||||
SWGPet::asJson ()
|
||||
{
|
||||
QJsonObject* obj = this->asJsonObject();
|
||||
|
||||
@ -116,95 +125,79 @@ Pet::asJson ()
|
||||
}
|
||||
|
||||
QJsonObject*
|
||||
Pet::asJsonObject() {
|
||||
SWGPet::asJsonObject() {
|
||||
QJsonObject* obj = new QJsonObject();
|
||||
|
||||
obj->insert("id", QJsonValue(id));
|
||||
|
||||
|
||||
toJsonValue(QString("category"), category, obj, QString("Category"));
|
||||
|
||||
|
||||
toJsonValue(QString("category"), category, obj, QString("SWGCategory"));
|
||||
|
||||
|
||||
toJsonValue(QString("name"), name, obj, QString("QString"));
|
||||
|
||||
|
||||
|
||||
|
||||
QList<QString*>* photoUrlsList = photoUrls;
|
||||
QJsonArray photoUrlsJsonArray;
|
||||
toJsonArray((QList<void*>*)photoUrls, &photoUrlsJsonArray, "photoUrls", "QString");
|
||||
QJsonArray photo_urlsJsonArray;
|
||||
toJsonArray((QList<void*>*)photo_urls, &photo_urlsJsonArray, "photo_urls", "QString");
|
||||
obj->insert("photo_urls", photo_urlsJsonArray);
|
||||
|
||||
obj->insert("photoUrls", photoUrlsJsonArray);
|
||||
|
||||
|
||||
|
||||
QList<Tag*>* tagsList = tags;
|
||||
QJsonArray tagsJsonArray;
|
||||
toJsonArray((QList<void*>*)tags, &tagsJsonArray, "tags", "Tag");
|
||||
|
||||
toJsonArray((QList<void*>*)tags, &tagsJsonArray, "tags", "SWGTag");
|
||||
obj->insert("tags", tagsJsonArray);
|
||||
|
||||
|
||||
|
||||
toJsonValue(QString("status"), status, obj, QString("QString"));
|
||||
|
||||
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
qint64
|
||||
Pet::getId() {
|
||||
SWGPet::getId() {
|
||||
return id;
|
||||
}
|
||||
void
|
||||
Pet::setId(qint64 id) {
|
||||
SWGPet::setId(qint64 id) {
|
||||
this->id = id;
|
||||
}
|
||||
|
||||
Category*
|
||||
Pet::getCategory() {
|
||||
SWGCategory*
|
||||
SWGPet::getCategory() {
|
||||
return category;
|
||||
}
|
||||
void
|
||||
Pet::setCategory(Category* category) {
|
||||
SWGPet::setCategory(SWGCategory* category) {
|
||||
this->category = category;
|
||||
}
|
||||
|
||||
QString*
|
||||
Pet::getName() {
|
||||
SWGPet::getName() {
|
||||
return name;
|
||||
}
|
||||
void
|
||||
Pet::setName(QString* name) {
|
||||
SWGPet::setName(QString* name) {
|
||||
this->name = name;
|
||||
}
|
||||
|
||||
QList<QString*>*
|
||||
Pet::getPhotoUrls() {
|
||||
return photoUrls;
|
||||
SWGPet::getPhotoUrls() {
|
||||
return photo_urls;
|
||||
}
|
||||
void
|
||||
Pet::setPhotoUrls(QList<QString*>* photoUrls) {
|
||||
this->photoUrls = photoUrls;
|
||||
SWGPet::setPhotoUrls(QList<QString*>* photo_urls) {
|
||||
this->photo_urls = photo_urls;
|
||||
}
|
||||
|
||||
QList<Tag*>*
|
||||
Pet::getTags() {
|
||||
QList<SWGTag*>*
|
||||
SWGPet::getTags() {
|
||||
return tags;
|
||||
}
|
||||
void
|
||||
Pet::setTags(QList<Tag*>* tags) {
|
||||
SWGPet::setTags(QList<SWGTag*>* tags) {
|
||||
this->tags = tags;
|
||||
}
|
||||
|
||||
QString*
|
||||
Pet::getStatus() {
|
||||
SWGPet::getStatus() {
|
||||
return status;
|
||||
}
|
||||
void
|
||||
Pet::setStatus(QString* status) {
|
||||
SWGPet::setStatus(QString* status) {
|
||||
this->status = status;
|
||||
}
|
||||
|
||||
|
@ -23,19 +23,19 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pet.h
|
||||
* SWGPet.h
|
||||
*
|
||||
* A pet for sale in the pet store
|
||||
*/
|
||||
|
||||
#ifndef Pet_H_
|
||||
#define Pet_H_
|
||||
#ifndef SWGPet_H_
|
||||
#define SWGPet_H_
|
||||
|
||||
#include <QJsonObject>
|
||||
|
||||
|
||||
#include "Category.h"
|
||||
#include "Tag.h"
|
||||
#include "SWGCategory.h"
|
||||
#include "SWGTag.h"
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
|
||||
@ -44,41 +44,47 @@
|
||||
|
||||
namespace Swagger {
|
||||
|
||||
class Pet: public SWGObject {
|
||||
class SWGPet: public SWGObject {
|
||||
public:
|
||||
Pet();
|
||||
Pet(QString* json);
|
||||
virtual ~Pet();
|
||||
SWGPet();
|
||||
SWGPet(QString* json);
|
||||
virtual ~SWGPet();
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
QString asJson ();
|
||||
QJsonObject* asJsonObject();
|
||||
void fromJsonObject(QJsonObject &json);
|
||||
Pet* fromJson(QString &jsonString);
|
||||
SWGPet* fromJson(QString &jsonString);
|
||||
|
||||
qint64 getId();
|
||||
void setId(qint64 id);
|
||||
Category* getCategory();
|
||||
void setCategory(Category* category);
|
||||
QString* getName();
|
||||
|
||||
SWGCategory* getCategory();
|
||||
void setCategory(SWGCategory* category);
|
||||
|
||||
QString* getName();
|
||||
void setName(QString* name);
|
||||
QList<QString*>* getPhotoUrls();
|
||||
void setPhotoUrls(QList<QString*>* photoUrls);
|
||||
QList<Tag*>* getTags();
|
||||
void setTags(QList<Tag*>* tags);
|
||||
QString* getStatus();
|
||||
|
||||
QList<QString*>* getPhotoUrls();
|
||||
void setPhotoUrls(QList<QString*>* photo_urls);
|
||||
|
||||
QList<SWGTag*>* getTags();
|
||||
void setTags(QList<SWGTag*>* tags);
|
||||
|
||||
QString* getStatus();
|
||||
void setStatus(QString* status);
|
||||
|
||||
|
||||
private:
|
||||
qint64 id;
|
||||
Category* category;
|
||||
QString* name;
|
||||
QList<QString*>* photoUrls;
|
||||
QList<Tag*>* tags;
|
||||
QString* status;
|
||||
SWGCategory* category;
|
||||
QString* name;
|
||||
QList<QString*>* photo_urls;
|
||||
QList<SWGTag*>* tags;
|
||||
QString* status;
|
||||
};
|
||||
|
||||
} /* namespace Swagger */
|
||||
|
||||
#endif /* Pet_H_ */
|
||||
#endif /* SWGPet_H_ */
|
||||
|
@ -33,7 +33,7 @@ namespace Swagger {
|
||||
|
||||
void
|
||||
setValue(void* value, QJsonValue obj, QString type, QString complexType) {
|
||||
if(value == NULL) {
|
||||
if(value == nullptr) {
|
||||
// can't set value with a null pointer
|
||||
return;
|
||||
}
|
||||
@ -60,7 +60,7 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) {
|
||||
else if (QStringLiteral("QString").compare(type) == 0) {
|
||||
QString **val = static_cast<QString**>(value);
|
||||
|
||||
if(val != NULL) {
|
||||
if(val != nullptr) {
|
||||
if(!obj.isNull()) {
|
||||
// create a new value and return
|
||||
delete *val;
|
||||
@ -68,19 +68,19 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
// set target to NULL
|
||||
// set target to nullptr
|
||||
delete *val;
|
||||
*val = NULL;
|
||||
*val = nullptr;
|
||||
}
|
||||
}
|
||||
else {
|
||||
qDebug() << "Can't set value because the target pointer is NULL";
|
||||
qDebug() << "Can't set value because the target pointer is nullptr";
|
||||
}
|
||||
}
|
||||
else if (QStringLiteral("QDateTime").compare(type) == 0) {
|
||||
QDateTime **val = static_cast<QDateTime**>(value);
|
||||
|
||||
if(val != NULL) {
|
||||
if(val != nullptr) {
|
||||
if(!obj.isNull()) {
|
||||
// create a new value and return
|
||||
delete *val;
|
||||
@ -88,19 +88,19 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
// set target to NULL
|
||||
// set target to nullptr
|
||||
delete *val;
|
||||
*val = NULL;
|
||||
*val = nullptr;
|
||||
}
|
||||
}
|
||||
else {
|
||||
qDebug() << "Can't set value because the target pointer is NULL";
|
||||
qDebug() << "Can't set value because the target pointer is nullptr";
|
||||
}
|
||||
}
|
||||
else if (QStringLiteral("QDate").compare(type) == 0) {
|
||||
QDate **val = static_cast<QDate**>(value);
|
||||
|
||||
if(val != NULL) {
|
||||
if(val != nullptr) {
|
||||
if(!obj.isNull()) {
|
||||
// create a new value and return
|
||||
delete *val;
|
||||
@ -108,19 +108,19 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
// set target to NULL
|
||||
// set target to nullptr
|
||||
delete *val;
|
||||
*val = NULL;
|
||||
*val = nullptr;
|
||||
}
|
||||
}
|
||||
else {
|
||||
qDebug() << "Can't set value because the target pointer is NULL";
|
||||
qDebug() << "Can't set value because the target pointer is nullptr";
|
||||
}
|
||||
}
|
||||
else if (QStringLiteral("QByteArray").compare(type) == 0) {
|
||||
QByteArray **val = static_cast<QByteArray**>(value);
|
||||
|
||||
if(val != NULL) {
|
||||
if(val != nullptr) {
|
||||
if(!obj.isNull()) {
|
||||
// create a new value and return
|
||||
delete *val;
|
||||
@ -129,20 +129,20 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
// set target to NULL
|
||||
// set target to nullptr
|
||||
delete *val;
|
||||
*val = NULL;
|
||||
*val = nullptr;
|
||||
}
|
||||
}
|
||||
else {
|
||||
qDebug() << "Can't set value because the target pointer is NULL";
|
||||
qDebug() << "Can't set value because the target pointer is nullptr";
|
||||
}
|
||||
}
|
||||
else if(type.startsWith("SWG") && obj.isObject()) {
|
||||
// complex type
|
||||
QJsonObject jsonObj = obj.toObject();
|
||||
SWGObject * so = (SWGObject*)Swagger::create(type);
|
||||
if(so != NULL) {
|
||||
if(so != nullptr) {
|
||||
so->fromJsonObject(jsonObj);
|
||||
SWGObject **val = static_cast<SWGObject**>(value);
|
||||
delete *val;
|
||||
@ -190,19 +190,19 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) {
|
||||
output->append((void*)&val);
|
||||
}
|
||||
else if(QStringLiteral("QString").compare(complexType) == 0) {
|
||||
QString val;
|
||||
QString * val = new QString();
|
||||
setValue(&val, jval, QStringLiteral("QString"), QStringLiteral(""));
|
||||
output->append((void*)&val);
|
||||
output->append((void*)val);
|
||||
}
|
||||
else if(QStringLiteral("QDate").compare(complexType) == 0) {
|
||||
QDate val;
|
||||
QDate * val = new QDate();
|
||||
setValue(&val, jval, QStringLiteral("QDate"), QStringLiteral(""));
|
||||
output->append((void*)&val);
|
||||
output->append((void*)val);
|
||||
}
|
||||
else if(QStringLiteral("QDateTime").compare(complexType) == 0) {
|
||||
QDateTime val;
|
||||
QDateTime * val = new QDateTime();
|
||||
setValue(&val, jval, QStringLiteral("QDateTime"), QStringLiteral(""));
|
||||
output->append((void*)&val);
|
||||
output->append((void*)val);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -214,14 +214,14 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) {
|
||||
|
||||
void
|
||||
toJsonValue(QString name, void* value, QJsonObject* output, QString type) {
|
||||
if(value == NULL) {
|
||||
if(value == nullptr) {
|
||||
return;
|
||||
}
|
||||
if(type.startsWith("SWG")) {
|
||||
SWGObject *swgObject = reinterpret_cast<SWGObject *>(value);
|
||||
if(swgObject != NULL) {
|
||||
if(swgObject != nullptr) {
|
||||
QJsonObject* o = (*swgObject).asJsonObject();
|
||||
if(name != NULL) {
|
||||
if(name != nullptr) {
|
||||
output->insert(name, *o);
|
||||
delete o;
|
||||
}
|
||||
@ -276,7 +276,7 @@ toJsonArray(QList<void*>* value, QJsonArray* output, QString innerName, QString
|
||||
foreach(void* obj, *value) {
|
||||
QJsonObject element;
|
||||
|
||||
toJsonValue(NULL, obj, &element, innerType);
|
||||
toJsonValue(nullptr, obj, &element, innerType);
|
||||
output->append(element);
|
||||
}
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ void HttpRequestInput::add_file(QString variable_name, QString local_filename, Q
|
||||
|
||||
|
||||
HttpRequestWorker::HttpRequestWorker(QObject *parent)
|
||||
: QObject(parent), manager(NULL)
|
||||
: QObject(parent), manager(nullptr)
|
||||
{
|
||||
qsrand(QDateTime::currentDateTime().toTime_t());
|
||||
|
||||
@ -204,8 +204,8 @@ void HttpRequestWorker::execute(HttpRequestInput *input) {
|
||||
|
||||
// ensure necessary variables are available
|
||||
if (
|
||||
file_info->local_filename == NULL || file_info->local_filename.isEmpty()
|
||||
|| file_info->variable_name == NULL || file_info->variable_name.isEmpty()
|
||||
file_info->local_filename == nullptr || file_info->local_filename.isEmpty()
|
||||
|| file_info->variable_name == nullptr || file_info->variable_name.isEmpty()
|
||||
|| !fi.exists() || !fi.isFile() || !fi.isReadable()
|
||||
) {
|
||||
// silent abort for the current file
|
||||
@ -219,7 +219,7 @@ void HttpRequestWorker::execute(HttpRequestInput *input) {
|
||||
}
|
||||
|
||||
// ensure filename for the request
|
||||
if (file_info->request_filename == NULL || file_info->request_filename.isEmpty()) {
|
||||
if (file_info->request_filename == nullptr || file_info->request_filename.isEmpty()) {
|
||||
file_info->request_filename = fi.fileName();
|
||||
if (file_info->request_filename.isEmpty()) {
|
||||
file_info->request_filename = "file";
|
||||
@ -238,7 +238,7 @@ void HttpRequestWorker::execute(HttpRequestInput *input) {
|
||||
));
|
||||
request_content.append(new_line);
|
||||
|
||||
if (file_info->mime_type != NULL && !file_info->mime_type.isEmpty()) {
|
||||
if (file_info->mime_type != nullptr && !file_info->mime_type.isEmpty()) {
|
||||
request_content.append("Content-Type: ");
|
||||
request_content.append(file_info->mime_type);
|
||||
request_content.append(new_line);
|
||||
|
@ -54,19 +54,19 @@ namespace Swagger {
|
||||
return new User();
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
inline void* create(QString json, QString type) {
|
||||
void* val = create(type);
|
||||
if(val != NULL) {
|
||||
if(val != nullptr) {
|
||||
SWGObject* obj = static_cast<SWGObject*>(val);
|
||||
return obj->fromJson(json);
|
||||
}
|
||||
if(type.startsWith("QString")) {
|
||||
return new QString();
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
} /* namespace Swagger */
|
||||
|
||||
|
@ -30,12 +30,12 @@
|
||||
class SWGObject {
|
||||
public:
|
||||
virtual QJsonObject* asJsonObject() {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
virtual ~SWGObject() {}
|
||||
virtual SWGObject* fromJson(QString &jsonString) {
|
||||
Q_UNUSED(jsonString);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
virtual void fromJsonObject(QJsonObject &json) {
|
||||
Q_UNUSED(json);
|
||||
|
@ -40,7 +40,7 @@ SWGPetApi::SWGPetApi(QString host, QString basePath) {
|
||||
}
|
||||
|
||||
void
|
||||
SWGPetApi::addPet(Pet body) {
|
||||
SWGPetApi::addPet(SWGPet body) {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/pet");
|
||||
|
||||
@ -81,12 +81,12 @@ SWGPetApi::addPetCallback(HttpRequestWorker * worker) {
|
||||
emit addPetSignal();
|
||||
}
|
||||
void
|
||||
SWGPetApi::deletePet(qint64 petId, QString* apiKey) {
|
||||
SWGPetApi::deletePet(qint64 pet_id, QString* api_key) {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/pet/{petId}");
|
||||
|
||||
QString petIdPathParam("{"); petIdPathParam.append("petId").append("}");
|
||||
fullPath.replace(petIdPathParam, stringValue(petId));
|
||||
QString pet_idPathParam("{"); pet_idPathParam.append("petId").append("}");
|
||||
fullPath.replace(pet_idPathParam, stringValue(pet_id));
|
||||
|
||||
|
||||
HttpRequestWorker *worker = new HttpRequestWorker();
|
||||
@ -197,14 +197,14 @@ SWGPetApi::findPetsByStatusCallback(HttpRequestWorker * worker) {
|
||||
}
|
||||
|
||||
|
||||
QList<Pet*>* output = new QList<Pet*>();
|
||||
QList<SWGPet*>* output = new QList<SWGPet*>();
|
||||
QString json(worker->response);
|
||||
QByteArray array (json.toStdString().c_str());
|
||||
QJsonDocument doc = QJsonDocument::fromJson(array);
|
||||
QJsonArray jsonArray = doc.array();
|
||||
|
||||
foreach(QJsonValue obj, jsonArray) {
|
||||
Pet* o = new Pet();
|
||||
SWGPet* o = new SWGPet();
|
||||
QJsonObject jv = obj.toObject();
|
||||
QJsonObject * ptr = (QJsonObject*)&jv;
|
||||
o->fromJsonObject(*ptr);
|
||||
@ -293,14 +293,14 @@ SWGPetApi::findPetsByTagsCallback(HttpRequestWorker * worker) {
|
||||
}
|
||||
|
||||
|
||||
QList<Pet*>* output = new QList<Pet*>();
|
||||
QList<SWGPet*>* output = new QList<SWGPet*>();
|
||||
QString json(worker->response);
|
||||
QByteArray array (json.toStdString().c_str());
|
||||
QJsonDocument doc = QJsonDocument::fromJson(array);
|
||||
QJsonArray jsonArray = doc.array();
|
||||
|
||||
foreach(QJsonValue obj, jsonArray) {
|
||||
Pet* o = new Pet();
|
||||
SWGPet* o = new SWGPet();
|
||||
QJsonObject jv = obj.toObject();
|
||||
QJsonObject * ptr = (QJsonObject*)&jv;
|
||||
o->fromJsonObject(*ptr);
|
||||
@ -315,12 +315,12 @@ SWGPetApi::findPetsByTagsCallback(HttpRequestWorker * worker) {
|
||||
|
||||
}
|
||||
void
|
||||
SWGPetApi::getPetById(qint64 petId) {
|
||||
SWGPetApi::getPetById(qint64 pet_id) {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/pet/{petId}");
|
||||
|
||||
QString petIdPathParam("{"); petIdPathParam.append("petId").append("}");
|
||||
fullPath.replace(petIdPathParam, stringValue(petId));
|
||||
QString pet_idPathParam("{"); pet_idPathParam.append("petId").append("}");
|
||||
fullPath.replace(pet_idPathParam, stringValue(pet_id));
|
||||
|
||||
|
||||
HttpRequestWorker *worker = new HttpRequestWorker();
|
||||
@ -350,7 +350,7 @@ SWGPetApi::getPetByIdCallback(HttpRequestWorker * worker) {
|
||||
|
||||
|
||||
QString json(worker->response);
|
||||
Pet* output = static_cast<Pet*>(create(json, QString("Pet")));
|
||||
SWGPet* output = static_cast<SWGPet*>(create(json, QString("SWGPet")));
|
||||
|
||||
|
||||
worker->deleteLater();
|
||||
@ -359,7 +359,7 @@ SWGPetApi::getPetByIdCallback(HttpRequestWorker * worker) {
|
||||
|
||||
}
|
||||
void
|
||||
SWGPetApi::updatePet(Pet body) {
|
||||
SWGPetApi::updatePet(SWGPet body) {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/pet");
|
||||
|
||||
@ -400,21 +400,21 @@ SWGPetApi::updatePetCallback(HttpRequestWorker * worker) {
|
||||
emit updatePetSignal();
|
||||
}
|
||||
void
|
||||
SWGPetApi::updatePetWithForm(qint64 petId, QString* name, QString* status) {
|
||||
SWGPetApi::updatePetWithForm(qint64 pet_id, QString* name, QString* status) {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/pet/{petId}");
|
||||
|
||||
QString petIdPathParam("{"); petIdPathParam.append("petId").append("}");
|
||||
fullPath.replace(petIdPathParam, stringValue(petId));
|
||||
QString pet_idPathParam("{"); pet_idPathParam.append("petId").append("}");
|
||||
fullPath.replace(pet_idPathParam, stringValue(pet_id));
|
||||
|
||||
|
||||
HttpRequestWorker *worker = new HttpRequestWorker();
|
||||
HttpRequestInput input(fullPath, "POST");
|
||||
|
||||
if (name != NULL) {
|
||||
if (name != nullptr) {
|
||||
input.add_var("name", *name);
|
||||
}
|
||||
if (status != NULL) {
|
||||
if (status != nullptr) {
|
||||
input.add_var("status", *status);
|
||||
}
|
||||
|
||||
@ -447,21 +447,21 @@ SWGPetApi::updatePetWithFormCallback(HttpRequestWorker * worker) {
|
||||
emit updatePetWithFormSignal();
|
||||
}
|
||||
void
|
||||
SWGPetApi::uploadFile(qint64 petId, QString* additionalMetadata, SWGHttpRequestInputFileElement* file) {
|
||||
SWGPetApi::uploadFile(qint64 pet_id, QString* additional_metadata, SWGHttpRequestInputFileElement* file) {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/pet/{petId}/uploadImage");
|
||||
|
||||
QString petIdPathParam("{"); petIdPathParam.append("petId").append("}");
|
||||
fullPath.replace(petIdPathParam, stringValue(petId));
|
||||
QString pet_idPathParam("{"); pet_idPathParam.append("petId").append("}");
|
||||
fullPath.replace(pet_idPathParam, stringValue(pet_id));
|
||||
|
||||
|
||||
HttpRequestWorker *worker = new HttpRequestWorker();
|
||||
HttpRequestInput input(fullPath, "POST");
|
||||
|
||||
if (additionalMetadata != NULL) {
|
||||
input.add_var("additionalMetadata", *additionalMetadata);
|
||||
if (additional_metadata != nullptr) {
|
||||
input.add_var("additionalMetadata", *additional_metadata);
|
||||
}
|
||||
if (file != NULL) {
|
||||
if (file != nullptr) {
|
||||
input.add_file("file", (*file).local_filename, (*file).request_filename, (*file).mime_type);
|
||||
}
|
||||
|
||||
@ -488,7 +488,7 @@ SWGPetApi::uploadFileCallback(HttpRequestWorker * worker) {
|
||||
|
||||
|
||||
QString json(worker->response);
|
||||
ApiResponse* output = static_cast<ApiResponse*>(create(json, QString("ApiResponse")));
|
||||
SWGApiResponse* output = static_cast<SWGApiResponse*>(create(json, QString("SWGApiResponse")));
|
||||
|
||||
|
||||
worker->deleteLater();
|
||||
|
@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "Tag.h"
|
||||
#include "SWGTag.h"
|
||||
|
||||
#include "SWGHelpers.h"
|
||||
|
||||
@ -35,35 +35,36 @@
|
||||
namespace Swagger {
|
||||
|
||||
|
||||
Tag::Tag(QString* json) {
|
||||
SWGTag::SWGTag(QString* json) {
|
||||
init();
|
||||
this->fromJson(*json);
|
||||
}
|
||||
|
||||
Tag::Tag() {
|
||||
SWGTag::SWGTag() {
|
||||
init();
|
||||
}
|
||||
|
||||
Tag::~Tag() {
|
||||
SWGTag::~SWGTag() {
|
||||
this->cleanup();
|
||||
}
|
||||
|
||||
void
|
||||
Tag::init() {
|
||||
SWGTag::init() {
|
||||
id = 0L;
|
||||
name = new QString("");
|
||||
name = new QString("");
|
||||
}
|
||||
|
||||
void
|
||||
Tag::cleanup() {
|
||||
SWGTag::cleanup() {
|
||||
|
||||
if(name != NULL) {
|
||||
|
||||
if(name != nullptr) {
|
||||
delete name;
|
||||
}
|
||||
}
|
||||
|
||||
Tag*
|
||||
Tag::fromJson(QString &json) {
|
||||
SWGTag*
|
||||
SWGTag::fromJson(QString &json) {
|
||||
QByteArray array (json.toStdString().c_str());
|
||||
QJsonDocument doc = QJsonDocument::fromJson(array);
|
||||
QJsonObject jsonObject = doc.object();
|
||||
@ -72,13 +73,13 @@ Tag::fromJson(QString &json) {
|
||||
}
|
||||
|
||||
void
|
||||
Tag::fromJsonObject(QJsonObject &pJson) {
|
||||
setValue(&id, pJson["id"], "qint64", "");
|
||||
setValue(&name, pJson["name"], "QString", "QString");
|
||||
SWGTag::fromJsonObject(QJsonObject &pJson) {
|
||||
::Swagger::setValue(&id, pJson["id"], "qint64", "");
|
||||
::Swagger::setValue(&name, pJson["name"], "QString", "QString");
|
||||
}
|
||||
|
||||
QString
|
||||
Tag::asJson ()
|
||||
SWGTag::asJson ()
|
||||
{
|
||||
QJsonObject* obj = this->asJsonObject();
|
||||
|
||||
@ -88,33 +89,31 @@ Tag::asJson ()
|
||||
}
|
||||
|
||||
QJsonObject*
|
||||
Tag::asJsonObject() {
|
||||
SWGTag::asJsonObject() {
|
||||
QJsonObject* obj = new QJsonObject();
|
||||
|
||||
obj->insert("id", QJsonValue(id));
|
||||
|
||||
|
||||
toJsonValue(QString("name"), name, obj, QString("QString"));
|
||||
|
||||
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
qint64
|
||||
Tag::getId() {
|
||||
SWGTag::getId() {
|
||||
return id;
|
||||
}
|
||||
void
|
||||
Tag::setId(qint64 id) {
|
||||
SWGTag::setId(qint64 id) {
|
||||
this->id = id;
|
||||
}
|
||||
|
||||
QString*
|
||||
Tag::getName() {
|
||||
SWGTag::getName() {
|
||||
return name;
|
||||
}
|
||||
void
|
||||
Tag::setName(QString* name) {
|
||||
SWGTag::setName(QString* name) {
|
||||
this->name = name;
|
||||
}
|
||||
|
||||
|
@ -56,12 +56,14 @@ public:
|
||||
|
||||
qint64 getId();
|
||||
void setId(qint64 id);
|
||||
QString* getName();
|
||||
|
||||
QString* getName();
|
||||
void setName(QString* name);
|
||||
|
||||
|
||||
private:
|
||||
qint64 id;
|
||||
QString* name;
|
||||
QString* name;
|
||||
};
|
||||
|
||||
} /* namespace Swagger */
|
||||
|
@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "User.h"
|
||||
#include "SWGUser.h"
|
||||
|
||||
#include "SWGHelpers.h"
|
||||
|
||||
@ -35,57 +35,63 @@
|
||||
namespace Swagger {
|
||||
|
||||
|
||||
User::User(QString* json) {
|
||||
SWGUser::SWGUser(QString* json) {
|
||||
init();
|
||||
this->fromJson(*json);
|
||||
}
|
||||
|
||||
User::User() {
|
||||
SWGUser::SWGUser() {
|
||||
init();
|
||||
}
|
||||
|
||||
User::~User() {
|
||||
SWGUser::~SWGUser() {
|
||||
this->cleanup();
|
||||
}
|
||||
|
||||
void
|
||||
User::init() {
|
||||
SWGUser::init() {
|
||||
id = 0L;
|
||||
username = new QString("");
|
||||
firstName = new QString("");
|
||||
lastName = new QString("");
|
||||
email = new QString("");
|
||||
password = new QString("");
|
||||
phone = new QString("");
|
||||
userStatus = 0;
|
||||
username = new QString("");
|
||||
first_name = new QString("");
|
||||
last_name = new QString("");
|
||||
email = new QString("");
|
||||
password = new QString("");
|
||||
phone = new QString("");
|
||||
user_status = 0;
|
||||
}
|
||||
|
||||
void
|
||||
User::cleanup() {
|
||||
SWGUser::cleanup() {
|
||||
|
||||
if(username != NULL) {
|
||||
|
||||
if(username != nullptr) {
|
||||
delete username;
|
||||
}
|
||||
if(firstName != NULL) {
|
||||
delete firstName;
|
||||
|
||||
if(first_name != nullptr) {
|
||||
delete first_name;
|
||||
}
|
||||
if(lastName != NULL) {
|
||||
delete lastName;
|
||||
|
||||
if(last_name != nullptr) {
|
||||
delete last_name;
|
||||
}
|
||||
if(email != NULL) {
|
||||
|
||||
if(email != nullptr) {
|
||||
delete email;
|
||||
}
|
||||
if(password != NULL) {
|
||||
|
||||
if(password != nullptr) {
|
||||
delete password;
|
||||
}
|
||||
if(phone != NULL) {
|
||||
|
||||
if(phone != nullptr) {
|
||||
delete phone;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
User*
|
||||
User::fromJson(QString &json) {
|
||||
SWGUser*
|
||||
SWGUser::fromJson(QString &json) {
|
||||
QByteArray array (json.toStdString().c_str());
|
||||
QJsonDocument doc = QJsonDocument::fromJson(array);
|
||||
QJsonObject jsonObject = doc.object();
|
||||
@ -94,19 +100,19 @@ User::fromJson(QString &json) {
|
||||
}
|
||||
|
||||
void
|
||||
User::fromJsonObject(QJsonObject &pJson) {
|
||||
setValue(&id, pJson["id"], "qint64", "");
|
||||
setValue(&username, pJson["username"], "QString", "QString");
|
||||
setValue(&firstName, pJson["firstName"], "QString", "QString");
|
||||
setValue(&lastName, pJson["lastName"], "QString", "QString");
|
||||
setValue(&email, pJson["email"], "QString", "QString");
|
||||
setValue(&password, pJson["password"], "QString", "QString");
|
||||
setValue(&phone, pJson["phone"], "QString", "QString");
|
||||
setValue(&userStatus, pJson["userStatus"], "qint32", "");
|
||||
SWGUser::fromJsonObject(QJsonObject &pJson) {
|
||||
::Swagger::setValue(&id, pJson["id"], "qint64", "");
|
||||
::Swagger::setValue(&username, pJson["username"], "QString", "QString");
|
||||
::Swagger::setValue(&first_name, pJson["first_name"], "QString", "QString");
|
||||
::Swagger::setValue(&last_name, pJson["last_name"], "QString", "QString");
|
||||
::Swagger::setValue(&email, pJson["email"], "QString", "QString");
|
||||
::Swagger::setValue(&password, pJson["password"], "QString", "QString");
|
||||
::Swagger::setValue(&phone, pJson["phone"], "QString", "QString");
|
||||
::Swagger::setValue(&user_status, pJson["user_status"], "qint32", "");
|
||||
}
|
||||
|
||||
QString
|
||||
User::asJson ()
|
||||
SWGUser::asJson ()
|
||||
{
|
||||
QJsonObject* obj = this->asJsonObject();
|
||||
|
||||
@ -116,114 +122,98 @@ User::asJson ()
|
||||
}
|
||||
|
||||
QJsonObject*
|
||||
User::asJsonObject() {
|
||||
SWGUser::asJsonObject() {
|
||||
QJsonObject* obj = new QJsonObject();
|
||||
|
||||
obj->insert("id", QJsonValue(id));
|
||||
|
||||
|
||||
toJsonValue(QString("username"), username, obj, QString("QString"));
|
||||
|
||||
|
||||
|
||||
|
||||
toJsonValue(QString("firstName"), firstName, obj, QString("QString"));
|
||||
|
||||
|
||||
toJsonValue(QString("first_name"), first_name, obj, QString("QString"));
|
||||
|
||||
|
||||
toJsonValue(QString("lastName"), lastName, obj, QString("QString"));
|
||||
|
||||
|
||||
toJsonValue(QString("last_name"), last_name, obj, QString("QString"));
|
||||
|
||||
|
||||
toJsonValue(QString("email"), email, obj, QString("QString"));
|
||||
|
||||
|
||||
|
||||
|
||||
toJsonValue(QString("password"), password, obj, QString("QString"));
|
||||
|
||||
|
||||
|
||||
|
||||
toJsonValue(QString("phone"), phone, obj, QString("QString"));
|
||||
|
||||
|
||||
obj->insert("userStatus", QJsonValue(userStatus));
|
||||
|
||||
obj->insert("user_status", QJsonValue(user_status));
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
qint64
|
||||
User::getId() {
|
||||
SWGUser::getId() {
|
||||
return id;
|
||||
}
|
||||
void
|
||||
User::setId(qint64 id) {
|
||||
SWGUser::setId(qint64 id) {
|
||||
this->id = id;
|
||||
}
|
||||
|
||||
QString*
|
||||
User::getUsername() {
|
||||
SWGUser::getUsername() {
|
||||
return username;
|
||||
}
|
||||
void
|
||||
User::setUsername(QString* username) {
|
||||
SWGUser::setUsername(QString* username) {
|
||||
this->username = username;
|
||||
}
|
||||
|
||||
QString*
|
||||
User::getFirstName() {
|
||||
return firstName;
|
||||
SWGUser::getFirstName() {
|
||||
return first_name;
|
||||
}
|
||||
void
|
||||
User::setFirstName(QString* firstName) {
|
||||
this->firstName = firstName;
|
||||
SWGUser::setFirstName(QString* first_name) {
|
||||
this->first_name = first_name;
|
||||
}
|
||||
|
||||
QString*
|
||||
User::getLastName() {
|
||||
return lastName;
|
||||
SWGUser::getLastName() {
|
||||
return last_name;
|
||||
}
|
||||
void
|
||||
User::setLastName(QString* lastName) {
|
||||
this->lastName = lastName;
|
||||
SWGUser::setLastName(QString* last_name) {
|
||||
this->last_name = last_name;
|
||||
}
|
||||
|
||||
QString*
|
||||
User::getEmail() {
|
||||
SWGUser::getEmail() {
|
||||
return email;
|
||||
}
|
||||
void
|
||||
User::setEmail(QString* email) {
|
||||
SWGUser::setEmail(QString* email) {
|
||||
this->email = email;
|
||||
}
|
||||
|
||||
QString*
|
||||
User::getPassword() {
|
||||
SWGUser::getPassword() {
|
||||
return password;
|
||||
}
|
||||
void
|
||||
User::setPassword(QString* password) {
|
||||
SWGUser::setPassword(QString* password) {
|
||||
this->password = password;
|
||||
}
|
||||
|
||||
QString*
|
||||
User::getPhone() {
|
||||
SWGUser::getPhone() {
|
||||
return phone;
|
||||
}
|
||||
void
|
||||
User::setPhone(QString* phone) {
|
||||
SWGUser::setPhone(QString* phone) {
|
||||
this->phone = phone;
|
||||
}
|
||||
|
||||
qint32
|
||||
User::getUserStatus() {
|
||||
return userStatus;
|
||||
SWGUser::getUserStatus() {
|
||||
return user_status;
|
||||
}
|
||||
void
|
||||
User::setUserStatus(qint32 userStatus) {
|
||||
this->userStatus = userStatus;
|
||||
SWGUser::setUserStatus(qint32 user_status) {
|
||||
this->user_status = user_status;
|
||||
}
|
||||
|
||||
|
||||
|
@ -23,13 +23,13 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* User.h
|
||||
* SWGUser.h
|
||||
*
|
||||
* A User who is purchasing from the pet store
|
||||
*/
|
||||
|
||||
#ifndef User_H_
|
||||
#define User_H_
|
||||
#ifndef SWGUser_H_
|
||||
#define SWGUser_H_
|
||||
|
||||
#include <QJsonObject>
|
||||
|
||||
@ -41,47 +41,55 @@
|
||||
|
||||
namespace Swagger {
|
||||
|
||||
class User: public SWGObject {
|
||||
class SWGUser: public SWGObject {
|
||||
public:
|
||||
User();
|
||||
User(QString* json);
|
||||
virtual ~User();
|
||||
SWGUser();
|
||||
SWGUser(QString* json);
|
||||
virtual ~SWGUser();
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
QString asJson ();
|
||||
QJsonObject* asJsonObject();
|
||||
void fromJsonObject(QJsonObject &json);
|
||||
User* fromJson(QString &jsonString);
|
||||
SWGUser* fromJson(QString &jsonString);
|
||||
|
||||
qint64 getId();
|
||||
void setId(qint64 id);
|
||||
QString* getUsername();
|
||||
|
||||
QString* getUsername();
|
||||
void setUsername(QString* username);
|
||||
QString* getFirstName();
|
||||
void setFirstName(QString* firstName);
|
||||
QString* getLastName();
|
||||
void setLastName(QString* lastName);
|
||||
QString* getEmail();
|
||||
|
||||
QString* getFirstName();
|
||||
void setFirstName(QString* first_name);
|
||||
|
||||
QString* getLastName();
|
||||
void setLastName(QString* last_name);
|
||||
|
||||
QString* getEmail();
|
||||
void setEmail(QString* email);
|
||||
QString* getPassword();
|
||||
|
||||
QString* getPassword();
|
||||
void setPassword(QString* password);
|
||||
QString* getPhone();
|
||||
|
||||
QString* getPhone();
|
||||
void setPhone(QString* phone);
|
||||
qint32 getUserStatus();
|
||||
void setUserStatus(qint32 userStatus);
|
||||
|
||||
qint32 getUserStatus();
|
||||
void setUserStatus(qint32 user_status);
|
||||
|
||||
|
||||
private:
|
||||
qint64 id;
|
||||
QString* username;
|
||||
QString* firstName;
|
||||
QString* lastName;
|
||||
QString* email;
|
||||
QString* password;
|
||||
QString* phone;
|
||||
qint32 userStatus;
|
||||
QString* username;
|
||||
QString* first_name;
|
||||
QString* last_name;
|
||||
QString* email;
|
||||
QString* password;
|
||||
QString* phone;
|
||||
qint32 user_status;
|
||||
};
|
||||
|
||||
} /* namespace Swagger */
|
||||
|
||||
#endif /* User_H_ */
|
||||
#endif /* SWGUser_H_ */
|
||||
|
@ -2,7 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2012
|
||||
VisualStudioVersion = 12.0.0.0
|
||||
MinimumVisualStudioVersion = 10.0.0.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{D198220E-91F6-402F-966F-8EF6105B1B75}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{1CE943E7-586D-4D9C-BE8B-3E005FDC39D1}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@ -10,10 +10,10 @@ Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{D198220E-91F6-402F-966F-8EF6105B1B75}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D198220E-91F6-402F-966F-8EF6105B1B75}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D198220E-91F6-402F-966F-8EF6105B1B75}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D198220E-91F6-402F-966F-8EF6105B1B75}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1CE943E7-586D-4D9C-BE8B-3E005FDC39D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1CE943E7-586D-4D9C-BE8B-3E005FDC39D1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1CE943E7-586D-4D9C-BE8B-3E005FDC39D1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1CE943E7-586D-4D9C-BE8B-3E005FDC39D1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
|
@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{D198220E-91F6-402F-966F-8EF6105B1B75}</ProjectGuid>
|
||||
<ProjectGuid>{1CE943E7-586D-4D9C-BE8B-3E005FDC39D1}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>IO.Swagger.v2</RootNamespace>
|
||||
|
@ -8,7 +8,7 @@ using NodaTime;
|
||||
namespace IO.Swagger.v2.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// ApiResponse
|
||||
/// Describes the result of uploading an image resource
|
||||
/// </summary>
|
||||
public sealed class ApiResponse: IEquatable<ApiResponse>
|
||||
{
|
||||
|
@ -8,7 +8,7 @@ using NodaTime;
|
||||
namespace IO.Swagger.v2.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Category
|
||||
/// A category for a pet
|
||||
/// </summary>
|
||||
public sealed class Category: IEquatable<Category>
|
||||
{
|
||||
|
@ -8,7 +8,7 @@ using NodaTime;
|
||||
namespace IO.Swagger.v2.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Order
|
||||
/// An order for a pets from the pet store
|
||||
/// </summary>
|
||||
public sealed class Order: IEquatable<Order>
|
||||
{
|
||||
|
@ -8,7 +8,7 @@ using NodaTime;
|
||||
namespace IO.Swagger.v2.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Pet
|
||||
/// A pet for sale in the pet store
|
||||
/// </summary>
|
||||
public sealed class Pet: IEquatable<Pet>
|
||||
{
|
||||
|
@ -8,7 +8,7 @@ using NodaTime;
|
||||
namespace IO.Swagger.v2.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Tag
|
||||
/// A tag for a pet
|
||||
/// </summary>
|
||||
public sealed class Tag: IEquatable<Tag>
|
||||
{
|
||||
|
@ -8,7 +8,7 @@ using NodaTime;
|
||||
namespace IO.Swagger.v2.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// User
|
||||
/// A User who is purchasing from the pet store
|
||||
/// </summary>
|
||||
public sealed class User: IEquatable<User>
|
||||
{
|
||||
|
@ -134,7 +134,7 @@ namespace IO.Swagger.v2.Utils
|
||||
private static IDictionary<Type, Func<Parameter, object>> CreateParsers()
|
||||
{
|
||||
var parsers = ImmutableDictionary.CreateBuilder<Type, Func<Parameter, object>>();
|
||||
parsers.Put(typeof(string), value => value);
|
||||
parsers.Put(typeof(string), value => value.Value);
|
||||
parsers.Put(typeof(bool), SafeParse(bool.Parse));
|
||||
parsers.Put(typeof(bool?), SafeParse(bool.Parse));
|
||||
parsers.Put(typeof(byte), SafeParse(byte.Parse));
|
||||
@ -411,4 +411,4 @@ namespace IO.Swagger.v2.Utils
|
||||
Path,
|
||||
Header
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
**/
|
||||
|
||||
@ApiModel(description = "A category for a pet")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.UndertowCodegen", date = "2016-09-26T16:15:27.984+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.UndertowCodegen", date = "2016-10-19T16:19:58.109+08:00")
|
||||
public class Category {
|
||||
|
||||
private Long id = null;
|
||||
|
@ -13,7 +13,7 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
**/
|
||||
|
||||
@ApiModel(description = "Describes the result of uploading an image resource")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.UndertowCodegen", date = "2016-09-26T16:15:27.984+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.UndertowCodegen", date = "2016-10-19T16:19:58.109+08:00")
|
||||
public class ModelApiResponse {
|
||||
|
||||
private Integer code = null;
|
||||
|
@ -15,7 +15,7 @@ import java.util.Date;
|
||||
**/
|
||||
|
||||
@ApiModel(description = "An order for a pets from the pet store")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.UndertowCodegen", date = "2016-09-26T16:15:27.984+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.UndertowCodegen", date = "2016-10-19T16:19:58.109+08:00")
|
||||
public class Order {
|
||||
|
||||
private Long id = null;
|
||||
|
@ -18,7 +18,7 @@ import java.util.List;
|
||||
**/
|
||||
|
||||
@ApiModel(description = "A pet for sale in the pet store")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.UndertowCodegen", date = "2016-09-26T16:15:27.984+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.UndertowCodegen", date = "2016-10-19T16:19:58.109+08:00")
|
||||
public class Pet {
|
||||
|
||||
private Long id = null;
|
||||
|
@ -13,7 +13,7 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
**/
|
||||
|
||||
@ApiModel(description = "A tag for a pet")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.UndertowCodegen", date = "2016-09-26T16:15:27.984+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.UndertowCodegen", date = "2016-10-19T16:19:58.109+08:00")
|
||||
public class Tag {
|
||||
|
||||
private Long id = null;
|
||||
|
@ -13,7 +13,7 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
**/
|
||||
|
||||
@ApiModel(description = "A User who is purchasing from the pet store")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.UndertowCodegen", date = "2016-09-26T16:15:27.984+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.UndertowCodegen", date = "2016-10-19T16:19:58.109+08:00")
|
||||
public class User {
|
||||
|
||||
private Long id = null;
|
||||
|
Loading…
Reference in New Issue
Block a user