mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-07 10:58:55 +00:00
[QT5CPP] General Improvements (#6315)
* - check C++ keywords - setter for SSL configuration * recreate example QT5CPP * only emit error signal if error happens * provide more error information * regenerate example QT5CPP * * use reserved words in abstract cpp generator * update CppRest examples * remove tabs
This commit is contained in:
parent
1b05960a74
commit
6c8bd6b83e
@ -5,8 +5,94 @@ import io.swagger.codegen.CodegenProperty;
|
||||
import io.swagger.codegen.DefaultCodegen;
|
||||
import io.swagger.models.properties.Property;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
abstract public class AbstractCppCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
|
||||
public AbstractCppCodegen() {
|
||||
super();
|
||||
|
||||
/*
|
||||
* Reserved words. Override this with reserved words specific to your language
|
||||
*/
|
||||
setReservedWordsLowerCase(
|
||||
Arrays.asList(
|
||||
"auto",
|
||||
"break",
|
||||
"case",
|
||||
"char",
|
||||
"const",
|
||||
"continue",
|
||||
"default",
|
||||
"do",
|
||||
"double",
|
||||
"else",
|
||||
"enum",
|
||||
"extern",
|
||||
"float",
|
||||
"for",
|
||||
"goto",
|
||||
"if",
|
||||
"int",
|
||||
"long",
|
||||
"register",
|
||||
"return",
|
||||
"short",
|
||||
"signed",
|
||||
"sizeof",
|
||||
"static",
|
||||
"struct",
|
||||
"switch",
|
||||
"typedef",
|
||||
"union",
|
||||
"unsigned",
|
||||
"void",
|
||||
"volatile",
|
||||
"while",
|
||||
"asm",
|
||||
"bool",
|
||||
"catch",
|
||||
"class",
|
||||
"const_cast",
|
||||
"delete",
|
||||
"dynamic_cast",
|
||||
"explicit",
|
||||
"false",
|
||||
"friend",
|
||||
"inline",
|
||||
"mutable",
|
||||
"namespace",
|
||||
"new",
|
||||
"operator",
|
||||
"private",
|
||||
"public",
|
||||
"protected",
|
||||
"reinterpret_cast",
|
||||
"static_cast",
|
||||
"template",
|
||||
"this",
|
||||
"throw",
|
||||
"true",
|
||||
"try",
|
||||
"typeid",
|
||||
"typename",
|
||||
"using",
|
||||
"virtual",
|
||||
"wchar_t",
|
||||
"and",
|
||||
"and_eq",
|
||||
"bitand",
|
||||
"bitor",
|
||||
"compl",
|
||||
"not",
|
||||
"not_eq",
|
||||
"or",
|
||||
"or_eq",
|
||||
"xor",
|
||||
"xor_eq")
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toVarName(String name) {
|
||||
if (typeMapping.keySet().contains(name) || typeMapping.values().contains(name)
|
||||
|
@ -23,7 +23,7 @@ import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class Qt5CPPGenerator extends DefaultCodegen implements CodegenConfig {
|
||||
public class Qt5CPPGenerator extends AbstractCppCodegen implements CodegenConfig {
|
||||
public static final String CPP_NAMESPACE = "cppNamespace";
|
||||
public static final String CPP_NAMESPACE_DESC = "C++ namespace (convention: name::space::for::api).";
|
||||
|
||||
@ -42,6 +42,11 @@ public class Qt5CPPGenerator extends DefaultCodegen implements CodegenConfig {
|
||||
// set the output folder here
|
||||
outputFolder = "generated-code/qt5cpp";
|
||||
|
||||
// set modelNamePrefix as default for QT5CPP
|
||||
if (modelNamePrefix == "") {
|
||||
modelNamePrefix = PREFIX;
|
||||
}
|
||||
|
||||
/*
|
||||
* Models. You can write model files using the modelTemplateFiles map.
|
||||
* if you want to create one template for file, you can do so here.
|
||||
@ -78,15 +83,6 @@ public class Qt5CPPGenerator extends DefaultCodegen implements CodegenConfig {
|
||||
// CLI options
|
||||
addOption(CPP_NAMESPACE, CPP_NAMESPACE_DESC, this.cppNamespace);
|
||||
|
||||
/*
|
||||
* Reserved words. Override this with reserved words specific to your language
|
||||
*/
|
||||
setReservedWordsLowerCase(
|
||||
Arrays.asList(
|
||||
"sample1", // replace with static values
|
||||
"sample2")
|
||||
);
|
||||
|
||||
/*
|
||||
* Additional Properties. These values can be passed to the templates and
|
||||
* are available in models, apis, and supporting files
|
||||
|
@ -253,6 +253,9 @@ void HttpRequestWorker::execute(HttpRequestInput *input) {
|
||||
// prepare connection
|
||||
|
||||
QNetworkRequest request = QNetworkRequest(QUrl(input->url_str));
|
||||
if (HttpRequestWorker::sslDefaultConfiguration != nullptr) {
|
||||
request.setSslConfiguration(*HttpRequestWorker::sslDefaultConfiguration);
|
||||
}
|
||||
request.setRawHeader("User-Agent", "Swagger-Client");
|
||||
foreach(QString key, input->headers.keys()) {
|
||||
request.setRawHeader(key.toStdString().c_str(), input->headers.value(key).toStdString().c_str());
|
||||
@ -300,17 +303,15 @@ void HttpRequestWorker::execute(HttpRequestInput *input) {
|
||||
|
||||
void HttpRequestWorker::on_manager_finished(QNetworkReply *reply) {
|
||||
error_type = reply->error();
|
||||
if (error_type == QNetworkReply::NoError) {
|
||||
response = reply->readAll();
|
||||
}
|
||||
else {
|
||||
error_str = reply->errorString();
|
||||
}
|
||||
response = reply->readAll();
|
||||
error_str = reply->errorString();
|
||||
|
||||
reply->deleteLater();
|
||||
|
||||
emit on_execution_finished(this);
|
||||
}
|
||||
QSslConfiguration* HttpRequestWorker::sslDefaultConfiguration;
|
||||
|
||||
|
||||
{{#cppNamespaceDeclarations}}
|
||||
}
|
||||
|
@ -64,6 +64,7 @@ public:
|
||||
|
||||
QString http_attribute_encode(QString attribute_name, QString input);
|
||||
void execute(HttpRequestInput *input);
|
||||
static QSslConfiguration* sslDefaultConfiguration;
|
||||
|
||||
signals:
|
||||
void on_execution_finished(HttpRequestWorker *worker);
|
||||
|
@ -186,8 +186,12 @@ void
|
||||
{{/returnType}}
|
||||
worker->deleteLater();
|
||||
|
||||
emit {{nickname}}Signal({{#returnType}}output{{/returnType}});
|
||||
emit {{nickname}}SignalE({{#returnType}}output, {{/returnType}}error_type, error_str);
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
emit {{nickname}}Signal({{#returnType}}output{{/returnType}});
|
||||
} else {
|
||||
emit {{nickname}}SignalE({{#returnType}}output, {{/returnType}}error_type, error_str);
|
||||
emit {{nickname}}SignalEFull(worker, error_type, error_str);
|
||||
}
|
||||
}
|
||||
|
||||
{{/operation}}
|
||||
|
@ -35,6 +35,8 @@ signals:
|
||||
{{/operation}}{{/operations}}
|
||||
{{#operations}}{{#operation}}void {{nickname}}SignalE({{#returnType}}{{{returnType}}} summary, {{/returnType}}QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
{{/operation}}{{/operations}}
|
||||
{{#operations}}{{#operation}}void {{nickname}}SignalEFull(HttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
{{/operation}}{{/operations}}
|
||||
};
|
||||
|
||||
{{#cppNamespaceDeclarations}}
|
||||
|
@ -1 +1 @@
|
||||
2.2.3-SNAPSHOT
|
||||
2.3.0-SNAPSHOT
|
@ -5,7 +5,7 @@
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT.
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
@ -5,7 +5,7 @@
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT.
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
@ -5,7 +5,7 @@
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT.
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
@ -5,7 +5,7 @@
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT.
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
@ -5,7 +5,7 @@
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT.
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
@ -5,7 +5,7 @@
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT.
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
@ -5,7 +5,7 @@
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT.
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
@ -5,7 +5,7 @@
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT.
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
@ -5,7 +5,7 @@
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT.
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
@ -5,7 +5,7 @@
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT.
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
@ -5,7 +5,7 @@
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT.
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
@ -5,7 +5,7 @@
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT.
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
@ -5,7 +5,7 @@
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT.
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
@ -5,7 +5,7 @@
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT.
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
@ -5,7 +5,7 @@
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT.
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
@ -5,7 +5,7 @@
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT.
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
@ -5,7 +5,7 @@
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT.
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
@ -5,7 +5,7 @@
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT.
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
@ -5,7 +5,7 @@
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT.
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
@ -5,7 +5,7 @@
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT.
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
@ -5,7 +5,7 @@
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT.
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
@ -5,7 +5,7 @@
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT.
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
@ -5,7 +5,7 @@
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT.
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
@ -5,7 +5,7 @@
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT.
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
@ -5,7 +5,7 @@
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT.
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
@ -5,7 +5,7 @@
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT.
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
@ -5,7 +5,7 @@
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT.
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
@ -5,7 +5,7 @@
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT.
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
@ -5,7 +5,7 @@
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT.
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
@ -5,7 +5,7 @@
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT.
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
@ -5,7 +5,7 @@
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT.
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
@ -5,7 +5,7 @@
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT.
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
@ -5,7 +5,7 @@
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.2.3-SNAPSHOT.
|
||||
* NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
@ -1 +1 @@
|
||||
2.2.3
|
||||
2.3.0-SNAPSHOT
|
@ -11,7 +11,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "ApiResponse.h"
|
||||
#include "SWGApiResponse.h"
|
||||
|
||||
#include "SWGHelpers.h"
|
||||
|
||||
@ -22,28 +22,28 @@
|
||||
|
||||
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("");
|
||||
}
|
||||
|
||||
void
|
||||
ApiResponse::cleanup() {
|
||||
SWGApiResponse::cleanup() {
|
||||
|
||||
|
||||
if(type != nullptr) {
|
||||
@ -55,8 +55,8 @@ ApiResponse::cleanup() {
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
@ -65,14 +65,14 @@ ApiResponse::fromJson(QString &json) {
|
||||
}
|
||||
|
||||
void
|
||||
ApiResponse::fromJsonObject(QJsonObject &pJson) {
|
||||
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();
|
||||
|
||||
@ -82,7 +82,7 @@ ApiResponse::asJson ()
|
||||
}
|
||||
|
||||
QJsonObject*
|
||||
ApiResponse::asJsonObject() {
|
||||
SWGApiResponse::asJsonObject() {
|
||||
QJsonObject* obj = new QJsonObject();
|
||||
|
||||
obj->insert("code", QJsonValue(code));
|
||||
@ -95,29 +95,29 @@ ApiResponse::asJsonObject() {
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -11,13 +11,13 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* ApiResponse.h
|
||||
* SWGApiResponse.h
|
||||
*
|
||||
* Describes the result of uploading an image resource
|
||||
*/
|
||||
|
||||
#ifndef ApiResponse_H_
|
||||
#define ApiResponse_H_
|
||||
#ifndef SWGApiResponse_H_
|
||||
#define SWGApiResponse_H_
|
||||
|
||||
#include <QJsonObject>
|
||||
|
||||
@ -29,18 +29,18 @@
|
||||
|
||||
namespace Swagger {
|
||||
|
||||
class ApiResponse: public SWGObject {
|
||||
class SWGApiResponse: public SWGObject {
|
||||
public:
|
||||
ApiResponse();
|
||||
ApiResponse(QString* json);
|
||||
virtual ~ApiResponse();
|
||||
SWGApiResponse();
|
||||
SWGApiResponse(QString* json);
|
||||
virtual ~SWGApiResponse();
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
QString asJson ();
|
||||
QJsonObject* asJsonObject();
|
||||
void fromJsonObject(QJsonObject &json);
|
||||
ApiResponse* fromJson(QString &jsonString);
|
||||
SWGApiResponse* fromJson(QString &jsonString);
|
||||
|
||||
qint32 getCode();
|
||||
void setCode(qint32 code);
|
||||
@ -60,4 +60,4 @@ private:
|
||||
|
||||
}
|
||||
|
||||
#endif /* ApiResponse_H_ */
|
||||
#endif /* SWGApiResponse_H_ */
|
@ -11,7 +11,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "Category.h"
|
||||
#include "SWGCategory.h"
|
||||
|
||||
#include "SWGHelpers.h"
|
||||
|
||||
@ -22,27 +22,27 @@
|
||||
|
||||
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("");
|
||||
}
|
||||
|
||||
void
|
||||
Category::cleanup() {
|
||||
SWGCategory::cleanup() {
|
||||
|
||||
|
||||
if(name != nullptr) {
|
||||
@ -50,8 +50,8 @@ Category::cleanup() {
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
@ -60,13 +60,13 @@ Category::fromJson(QString &json) {
|
||||
}
|
||||
|
||||
void
|
||||
Category::fromJsonObject(QJsonObject &pJson) {
|
||||
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();
|
||||
|
||||
@ -76,7 +76,7 @@ Category::asJson ()
|
||||
}
|
||||
|
||||
QJsonObject*
|
||||
Category::asJsonObject() {
|
||||
SWGCategory::asJsonObject() {
|
||||
QJsonObject* obj = new QJsonObject();
|
||||
|
||||
obj->insert("id", QJsonValue(id));
|
||||
@ -87,20 +87,20 @@ Category::asJsonObject() {
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -11,13 +11,13 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Category.h
|
||||
* SWGCategory.h
|
||||
*
|
||||
* A category for a pet
|
||||
*/
|
||||
|
||||
#ifndef Category_H_
|
||||
#define Category_H_
|
||||
#ifndef SWGCategory_H_
|
||||
#define SWGCategory_H_
|
||||
|
||||
#include <QJsonObject>
|
||||
|
||||
@ -29,18 +29,18 @@
|
||||
|
||||
namespace Swagger {
|
||||
|
||||
class Category: public SWGObject {
|
||||
class SWGCategory: public SWGObject {
|
||||
public:
|
||||
Category();
|
||||
Category(QString* json);
|
||||
virtual ~Category();
|
||||
SWGCategory();
|
||||
SWGCategory(QString* json);
|
||||
virtual ~SWGCategory();
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
QString asJson ();
|
||||
QJsonObject* asJsonObject();
|
||||
void fromJsonObject(QJsonObject &json);
|
||||
Category* fromJson(QString &jsonString);
|
||||
SWGCategory* fromJson(QString &jsonString);
|
||||
|
||||
qint64 getId();
|
||||
void setId(qint64 id);
|
||||
@ -56,4 +56,4 @@ private:
|
||||
|
||||
}
|
||||
|
||||
#endif /* Category_H_ */
|
||||
#endif /* SWGCategory_H_ */
|
@ -262,6 +262,9 @@ void HttpRequestWorker::execute(HttpRequestInput *input) {
|
||||
// prepare connection
|
||||
|
||||
QNetworkRequest request = QNetworkRequest(QUrl(input->url_str));
|
||||
if (HttpRequestWorker::sslDefaultConfiguration != nullptr) {
|
||||
request.setSslConfiguration(*HttpRequestWorker::sslDefaultConfiguration);
|
||||
}
|
||||
request.setRawHeader("User-Agent", "Swagger-Client");
|
||||
foreach(QString key, input->headers.keys()) {
|
||||
request.setRawHeader(key.toStdString().c_str(), input->headers.value(key).toStdString().c_str());
|
||||
@ -309,16 +312,14 @@ void HttpRequestWorker::execute(HttpRequestInput *input) {
|
||||
|
||||
void HttpRequestWorker::on_manager_finished(QNetworkReply *reply) {
|
||||
error_type = reply->error();
|
||||
if (error_type == QNetworkReply::NoError) {
|
||||
response = reply->readAll();
|
||||
}
|
||||
else {
|
||||
error_str = reply->errorString();
|
||||
}
|
||||
response = reply->readAll();
|
||||
error_str = reply->errorString();
|
||||
|
||||
reply->deleteLater();
|
||||
|
||||
emit on_execution_finished(this);
|
||||
}
|
||||
QSslConfiguration* HttpRequestWorker::sslDefaultConfiguration;
|
||||
|
||||
|
||||
}
|
||||
|
@ -73,6 +73,7 @@ public:
|
||||
|
||||
QString http_attribute_encode(QString attribute_name, QString input);
|
||||
void execute(HttpRequestInput *input);
|
||||
static QSslConfiguration* sslDefaultConfiguration;
|
||||
|
||||
signals:
|
||||
void on_execution_finished(HttpRequestWorker *worker);
|
||||
|
@ -14,33 +14,33 @@
|
||||
#define ModelFactory_H_
|
||||
|
||||
|
||||
#include "ApiResponse.h"
|
||||
#include "Category.h"
|
||||
#include "Order.h"
|
||||
#include "Pet.h"
|
||||
#include "Tag.h"
|
||||
#include "User.h"
|
||||
#include "SWGApiResponse.h"
|
||||
#include "SWGCategory.h"
|
||||
#include "SWGOrder.h"
|
||||
#include "SWGPet.h"
|
||||
#include "SWGTag.h"
|
||||
#include "SWGUser.h"
|
||||
|
||||
namespace Swagger {
|
||||
|
||||
inline void* create(QString type) {
|
||||
if(QString("ApiResponse").compare(type) == 0) {
|
||||
return new ApiResponse();
|
||||
if(QString("SWGApiResponse").compare(type) == 0) {
|
||||
return new SWGApiResponse();
|
||||
}
|
||||
if(QString("Category").compare(type) == 0) {
|
||||
return new Category();
|
||||
if(QString("SWGCategory").compare(type) == 0) {
|
||||
return new SWGCategory();
|
||||
}
|
||||
if(QString("Order").compare(type) == 0) {
|
||||
return new Order();
|
||||
if(QString("SWGOrder").compare(type) == 0) {
|
||||
return new SWGOrder();
|
||||
}
|
||||
if(QString("Pet").compare(type) == 0) {
|
||||
return new Pet();
|
||||
if(QString("SWGPet").compare(type) == 0) {
|
||||
return new SWGPet();
|
||||
}
|
||||
if(QString("Tag").compare(type) == 0) {
|
||||
return new Tag();
|
||||
if(QString("SWGTag").compare(type) == 0) {
|
||||
return new SWGTag();
|
||||
}
|
||||
if(QString("User").compare(type) == 0) {
|
||||
return new User();
|
||||
if(QString("SWGUser").compare(type) == 0) {
|
||||
return new SWGUser();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
|
@ -11,7 +11,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "Order.h"
|
||||
#include "SWGOrder.h"
|
||||
|
||||
#include "SWGHelpers.h"
|
||||
|
||||
@ -22,21 +22,21 @@
|
||||
|
||||
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;
|
||||
pet_id = 0L;
|
||||
quantity = 0;
|
||||
@ -46,7 +46,7 @@ Order::init() {
|
||||
}
|
||||
|
||||
void
|
||||
Order::cleanup() {
|
||||
SWGOrder::cleanup() {
|
||||
|
||||
|
||||
|
||||
@ -61,8 +61,8 @@ Order::cleanup() {
|
||||
|
||||
}
|
||||
|
||||
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();
|
||||
@ -71,7 +71,7 @@ Order::fromJson(QString &json) {
|
||||
}
|
||||
|
||||
void
|
||||
Order::fromJsonObject(QJsonObject &pJson) {
|
||||
SWGOrder::fromJsonObject(QJsonObject &pJson) {
|
||||
::Swagger::setValue(&id, pJson["id"], "qint64", "");
|
||||
::Swagger::setValue(&pet_id, pJson["petId"], "qint64", "");
|
||||
::Swagger::setValue(&quantity, pJson["quantity"], "qint32", "");
|
||||
@ -81,7 +81,7 @@ Order::fromJsonObject(QJsonObject &pJson) {
|
||||
}
|
||||
|
||||
QString
|
||||
Order::asJson ()
|
||||
SWGOrder::asJson ()
|
||||
{
|
||||
QJsonObject* obj = this->asJsonObject();
|
||||
|
||||
@ -91,7 +91,7 @@ Order::asJson ()
|
||||
}
|
||||
|
||||
QJsonObject*
|
||||
Order::asJsonObject() {
|
||||
SWGOrder::asJsonObject() {
|
||||
QJsonObject* obj = new QJsonObject();
|
||||
|
||||
obj->insert("id", QJsonValue(id));
|
||||
@ -110,56 +110,56 @@ Order::asJsonObject() {
|
||||
}
|
||||
|
||||
qint64
|
||||
Order::getId() {
|
||||
SWGOrder::getId() {
|
||||
return id;
|
||||
}
|
||||
void
|
||||
Order::setId(qint64 id) {
|
||||
SWGOrder::setId(qint64 id) {
|
||||
this->id = id;
|
||||
}
|
||||
|
||||
qint64
|
||||
Order::getPetId() {
|
||||
SWGOrder::getPetId() {
|
||||
return pet_id;
|
||||
}
|
||||
void
|
||||
Order::setPetId(qint64 pet_id) {
|
||||
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() {
|
||||
SWGOrder::getShipDate() {
|
||||
return ship_date;
|
||||
}
|
||||
void
|
||||
Order::setShipDate(QDateTime* ship_date) {
|
||||
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;
|
||||
}
|
||||
|
@ -11,13 +11,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>
|
||||
|
||||
@ -30,18 +30,18 @@
|
||||
|
||||
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);
|
||||
@ -73,4 +73,4 @@ private:
|
||||
|
||||
}
|
||||
|
||||
#endif /* Order_H_ */
|
||||
#endif /* SWGOrder_H_ */
|
@ -11,7 +11,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "Pet.h"
|
||||
#include "SWGPet.h"
|
||||
|
||||
#include "SWGHelpers.h"
|
||||
|
||||
@ -22,31 +22,31 @@
|
||||
|
||||
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();
|
||||
category = new SWGCategory();
|
||||
name = new QString("");
|
||||
photo_urls = new QList<QString*>();
|
||||
tags = new QList<Tag*>();
|
||||
tags = new QList<SWGTag*>();
|
||||
status = new QString("");
|
||||
}
|
||||
|
||||
void
|
||||
Pet::cleanup() {
|
||||
SWGPet::cleanup() {
|
||||
|
||||
|
||||
if(category != nullptr) {
|
||||
@ -66,8 +66,8 @@ Pet::cleanup() {
|
||||
}
|
||||
|
||||
if(tags != nullptr) {
|
||||
QList<Tag*>* arr = tags;
|
||||
foreach(Tag* o, *arr) {
|
||||
QList<SWGTag*>* arr = tags;
|
||||
foreach(SWGTag* o, *arr) {
|
||||
delete o;
|
||||
}
|
||||
delete tags;
|
||||
@ -78,8 +78,8 @@ Pet::cleanup() {
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
@ -88,21 +88,21 @@ Pet::fromJson(QString &json) {
|
||||
}
|
||||
|
||||
void
|
||||
Pet::fromJsonObject(QJsonObject &pJson) {
|
||||
SWGPet::fromJsonObject(QJsonObject &pJson) {
|
||||
::Swagger::setValue(&id, pJson["id"], "qint64", "");
|
||||
::Swagger::setValue(&category, pJson["category"], "Category", "Category");
|
||||
::Swagger::setValue(&category, pJson["category"], "SWGCategory", "SWGCategory");
|
||||
::Swagger::setValue(&name, pJson["name"], "QString", "QString");
|
||||
|
||||
::Swagger::setValue(&photo_urls, pJson["photoUrls"], "QList", "QString");
|
||||
|
||||
|
||||
::Swagger::setValue(&tags, pJson["tags"], "QList", "Tag");
|
||||
::Swagger::setValue(&tags, pJson["tags"], "QList", "SWGTag");
|
||||
|
||||
::Swagger::setValue(&status, pJson["status"], "QString", "QString");
|
||||
}
|
||||
|
||||
QString
|
||||
Pet::asJson ()
|
||||
SWGPet::asJson ()
|
||||
{
|
||||
QJsonObject* obj = this->asJsonObject();
|
||||
|
||||
@ -112,12 +112,12 @@ 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"));
|
||||
|
||||
@ -126,7 +126,7 @@ Pet::asJsonObject() {
|
||||
obj->insert("photoUrls", photo_urlsJsonArray);
|
||||
|
||||
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"));
|
||||
@ -135,56 +135,56 @@ Pet::asJsonObject() {
|
||||
}
|
||||
|
||||
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() {
|
||||
SWGPet::getPhotoUrls() {
|
||||
return photo_urls;
|
||||
}
|
||||
void
|
||||
Pet::setPhotoUrls(QList<QString*>* photo_urls) {
|
||||
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;
|
||||
}
|
||||
|
@ -11,19 +11,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>
|
||||
|
||||
@ -32,24 +32,24 @@
|
||||
|
||||
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);
|
||||
SWGCategory* getCategory();
|
||||
void setCategory(SWGCategory* category);
|
||||
|
||||
QString* getName();
|
||||
void setName(QString* name);
|
||||
@ -57,8 +57,8 @@ public:
|
||||
QList<QString*>* getPhotoUrls();
|
||||
void setPhotoUrls(QList<QString*>* photo_urls);
|
||||
|
||||
QList<Tag*>* getTags();
|
||||
void setTags(QList<Tag*>* tags);
|
||||
QList<SWGTag*>* getTags();
|
||||
void setTags(QList<SWGTag*>* tags);
|
||||
|
||||
QString* getStatus();
|
||||
void setStatus(QString* status);
|
||||
@ -66,13 +66,13 @@ public:
|
||||
|
||||
private:
|
||||
qint64 id;
|
||||
Category* category;
|
||||
SWGCategory* category;
|
||||
QString* name;
|
||||
QList<QString*>* photo_urls;
|
||||
QList<Tag*>* tags;
|
||||
QList<SWGTag*>* tags;
|
||||
QString* status;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* Pet_H_ */
|
||||
#endif /* SWGPet_H_ */
|
@ -29,7 +29,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");
|
||||
|
||||
@ -71,8 +71,12 @@ SWGPetApi::addPetCallback(HttpRequestWorker * worker) {
|
||||
|
||||
worker->deleteLater();
|
||||
|
||||
emit addPetSignal();
|
||||
emit addPetSignalE(error_type, error_str);
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
emit addPetSignal();
|
||||
} else {
|
||||
emit addPetSignalE(error_type, error_str);
|
||||
emit addPetSignalEFull(worker, error_type, error_str);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -121,8 +125,12 @@ SWGPetApi::deletePetCallback(HttpRequestWorker * worker) {
|
||||
|
||||
worker->deleteLater();
|
||||
|
||||
emit deletePetSignal();
|
||||
emit deletePetSignalE(error_type, error_str);
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
emit deletePetSignal();
|
||||
} else {
|
||||
emit deletePetSignalE(error_type, error_str);
|
||||
emit deletePetSignalEFull(worker, error_type, error_str);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -206,14 +214,14 @@ SWGPetApi::findPetsByStatusCallback(HttpRequestWorker * worker) {
|
||||
msg = "Error: " + worker->error_str;
|
||||
}
|
||||
|
||||
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);
|
||||
@ -222,8 +230,12 @@ SWGPetApi::findPetsByStatusCallback(HttpRequestWorker * worker) {
|
||||
|
||||
worker->deleteLater();
|
||||
|
||||
emit findPetsByStatusSignal(output);
|
||||
emit findPetsByStatusSignalE(output, error_type, error_str);
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
emit findPetsByStatusSignal(output);
|
||||
} else {
|
||||
emit findPetsByStatusSignalE(output, error_type, error_str);
|
||||
emit findPetsByStatusSignalEFull(worker, error_type, error_str);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -307,14 +319,14 @@ SWGPetApi::findPetsByTagsCallback(HttpRequestWorker * worker) {
|
||||
msg = "Error: " + worker->error_str;
|
||||
}
|
||||
|
||||
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);
|
||||
@ -323,8 +335,12 @@ SWGPetApi::findPetsByTagsCallback(HttpRequestWorker * worker) {
|
||||
|
||||
worker->deleteLater();
|
||||
|
||||
emit findPetsByTagsSignal(output);
|
||||
emit findPetsByTagsSignalE(output, error_type, error_str);
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
emit findPetsByTagsSignal(output);
|
||||
} else {
|
||||
emit findPetsByTagsSignalE(output, error_type, error_str);
|
||||
emit findPetsByTagsSignalEFull(worker, error_type, error_str);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -370,15 +386,19 @@ 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();
|
||||
|
||||
emit getPetByIdSignal(output);
|
||||
emit getPetByIdSignalE(output, error_type, error_str);
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
emit getPetByIdSignal(output);
|
||||
} else {
|
||||
emit getPetByIdSignalE(output, error_type, error_str);
|
||||
emit getPetByIdSignalEFull(worker, error_type, error_str);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SWGPetApi::updatePet(Pet body) {
|
||||
SWGPetApi::updatePet(SWGPet body) {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/pet");
|
||||
|
||||
@ -420,8 +440,12 @@ SWGPetApi::updatePetCallback(HttpRequestWorker * worker) {
|
||||
|
||||
worker->deleteLater();
|
||||
|
||||
emit updatePetSignal();
|
||||
emit updatePetSignalE(error_type, error_str);
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
emit updatePetSignal();
|
||||
} else {
|
||||
emit updatePetSignalE(error_type, error_str);
|
||||
emit updatePetSignalEFull(worker, error_type, error_str);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -473,8 +497,12 @@ SWGPetApi::updatePetWithFormCallback(HttpRequestWorker * worker) {
|
||||
|
||||
worker->deleteLater();
|
||||
|
||||
emit updatePetWithFormSignal();
|
||||
emit updatePetWithFormSignalE(error_type, error_str);
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
emit updatePetWithFormSignal();
|
||||
} else {
|
||||
emit updatePetWithFormSignalE(error_type, error_str);
|
||||
emit updatePetWithFormSignalEFull(worker, error_type, error_str);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -526,11 +554,15 @@ 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();
|
||||
|
||||
emit uploadFileSignal(output);
|
||||
emit uploadFileSignalE(output, error_type, error_str);
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
emit uploadFileSignal(output);
|
||||
} else {
|
||||
emit uploadFileSignalE(output, error_type, error_str);
|
||||
emit uploadFileSignalEFull(worker, error_type, error_str);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -15,10 +15,10 @@
|
||||
|
||||
#include "SWGHttpRequest.h"
|
||||
|
||||
#include "ApiResponse.h"
|
||||
#include "Pet.h"
|
||||
#include <QString>
|
||||
#include "SWGApiResponse.h"
|
||||
#include "SWGHttpRequest.h"
|
||||
#include "SWGPet.h"
|
||||
|
||||
#include <QObject>
|
||||
|
||||
@ -36,12 +36,12 @@ public:
|
||||
QString basePath;
|
||||
QMap<QString, QString> defaultHeaders;
|
||||
|
||||
void addPet(Pet body);
|
||||
void addPet(SWGPet body);
|
||||
void deletePet(qint64 pet_id, QString* api_key);
|
||||
void findPetsByStatus(QList<QString*>* status);
|
||||
void findPetsByTags(QList<QString*>* tags);
|
||||
void getPetById(qint64 pet_id);
|
||||
void updatePet(Pet body);
|
||||
void updatePet(SWGPet body);
|
||||
void updatePetWithForm(qint64 pet_id, QString* name, QString* status);
|
||||
void uploadFile(qint64 pet_id, QString* additional_metadata, SWGHttpRequestInputFileElement* file);
|
||||
|
||||
@ -58,21 +58,30 @@ private:
|
||||
signals:
|
||||
void addPetSignal();
|
||||
void deletePetSignal();
|
||||
void findPetsByStatusSignal(QList<Pet*>* summary);
|
||||
void findPetsByTagsSignal(QList<Pet*>* summary);
|
||||
void getPetByIdSignal(Pet* summary);
|
||||
void findPetsByStatusSignal(QList<SWGPet*>* summary);
|
||||
void findPetsByTagsSignal(QList<SWGPet*>* summary);
|
||||
void getPetByIdSignal(SWGPet* summary);
|
||||
void updatePetSignal();
|
||||
void updatePetWithFormSignal();
|
||||
void uploadFileSignal(ApiResponse* summary);
|
||||
void uploadFileSignal(SWGApiResponse* summary);
|
||||
|
||||
void addPetSignalE(QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void deletePetSignalE(QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void findPetsByStatusSignalE(QList<Pet*>* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void findPetsByTagsSignalE(QList<Pet*>* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void getPetByIdSignalE(Pet* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void findPetsByStatusSignalE(QList<SWGPet*>* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void findPetsByTagsSignalE(QList<SWGPet*>* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void getPetByIdSignalE(SWGPet* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void updatePetSignalE(QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void updatePetWithFormSignalE(QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void uploadFileSignalE(ApiResponse* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void uploadFileSignalE(SWGApiResponse* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
|
||||
void addPetSignalEFull(HttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void deletePetSignalEFull(HttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void findPetsByStatusSignalEFull(HttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void findPetsByTagsSignalEFull(HttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void getPetByIdSignalEFull(HttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void updatePetSignalEFull(HttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void updatePetWithFormSignalEFull(HttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void uploadFileSignalEFull(HttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
|
||||
};
|
||||
|
||||
|
@ -71,8 +71,12 @@ SWGStoreApi::deleteOrderCallback(HttpRequestWorker * worker) {
|
||||
|
||||
worker->deleteLater();
|
||||
|
||||
emit deleteOrderSignal();
|
||||
emit deleteOrderSignalE(error_type, error_str);
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
emit deleteOrderSignal();
|
||||
} else {
|
||||
emit deleteOrderSignalE(error_type, error_str);
|
||||
emit deleteOrderSignalEFull(worker, error_type, error_str);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -115,6 +119,7 @@ SWGStoreApi::getInventoryCallback(HttpRequestWorker * worker) {
|
||||
}
|
||||
|
||||
|
||||
QMap<QString, qint32>* output; // TODO add primitive output support
|
||||
QMap<QString, qint32>* output = new QMap<QString, qint32>();
|
||||
QString json(worker->response);
|
||||
QByteArray array (json.toStdString().c_str());
|
||||
@ -123,13 +128,17 @@ SWGStoreApi::getInventoryCallback(HttpRequestWorker * worker) {
|
||||
|
||||
foreach(QString key, obj.keys()) {
|
||||
qint32* val;
|
||||
setValue(&val, obj[key], "QMap", "");
|
||||
setValue(&val, obj[key], "qint32", "");
|
||||
output->insert(key, *val);
|
||||
}
|
||||
worker->deleteLater();
|
||||
|
||||
emit getInventorySignal(output);
|
||||
emit getInventorySignalE(output, error_type, error_str);
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
emit getInventorySignal(output);
|
||||
} else {
|
||||
emit getInventorySignalE(output, error_type, error_str);
|
||||
emit getInventorySignalEFull(worker, error_type, error_str);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -175,15 +184,19 @@ SWGStoreApi::getOrderByIdCallback(HttpRequestWorker * worker) {
|
||||
|
||||
|
||||
QString json(worker->response);
|
||||
Order* output = static_cast<Order*>(create(json, QString("Order")));
|
||||
SWGOrder* output = static_cast<SWGOrder*>(create(json, QString("SWGOrder")));
|
||||
worker->deleteLater();
|
||||
|
||||
emit getOrderByIdSignal(output);
|
||||
emit getOrderByIdSignalE(output, error_type, error_str);
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
emit getOrderByIdSignal(output);
|
||||
} else {
|
||||
emit getOrderByIdSignalE(output, error_type, error_str);
|
||||
emit getOrderByIdSignalEFull(worker, error_type, error_str);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SWGStoreApi::placeOrder(Order body) {
|
||||
SWGStoreApi::placeOrder(SWGOrder body) {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/store/order");
|
||||
|
||||
@ -225,11 +238,15 @@ SWGStoreApi::placeOrderCallback(HttpRequestWorker * worker) {
|
||||
|
||||
|
||||
QString json(worker->response);
|
||||
Order* output = static_cast<Order*>(create(json, QString("Order")));
|
||||
SWGOrder* output = static_cast<SWGOrder*>(create(json, QString("SWGOrder")));
|
||||
worker->deleteLater();
|
||||
|
||||
emit placeOrderSignal(output);
|
||||
emit placeOrderSignalE(output, error_type, error_str);
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
emit placeOrderSignal(output);
|
||||
} else {
|
||||
emit placeOrderSignalE(output, error_type, error_str);
|
||||
emit placeOrderSignalEFull(worker, error_type, error_str);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -15,9 +15,9 @@
|
||||
|
||||
#include "SWGHttpRequest.h"
|
||||
|
||||
#include "Order.h"
|
||||
#include <QMap>
|
||||
#include <QString>
|
||||
#include "SWGOrder.h"
|
||||
|
||||
#include <QObject>
|
||||
|
||||
@ -38,7 +38,7 @@ public:
|
||||
void deleteOrder(QString* order_id);
|
||||
void getInventory();
|
||||
void getOrderById(qint64 order_id);
|
||||
void placeOrder(Order body);
|
||||
void placeOrder(SWGOrder body);
|
||||
|
||||
private:
|
||||
void deleteOrderCallback (HttpRequestWorker * worker);
|
||||
@ -49,13 +49,18 @@ private:
|
||||
signals:
|
||||
void deleteOrderSignal();
|
||||
void getInventorySignal(QMap<QString, qint32>* summary);
|
||||
void getOrderByIdSignal(Order* summary);
|
||||
void placeOrderSignal(Order* summary);
|
||||
void getOrderByIdSignal(SWGOrder* summary);
|
||||
void placeOrderSignal(SWGOrder* summary);
|
||||
|
||||
void deleteOrderSignalE(QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void getInventorySignalE(QMap<QString, qint32>* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void getOrderByIdSignalE(Order* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void placeOrderSignalE(Order* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void getOrderByIdSignalE(SWGOrder* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void placeOrderSignalE(SWGOrder* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
|
||||
void deleteOrderSignalEFull(HttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void getInventorySignalEFull(HttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void getOrderByIdSignalEFull(HttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void placeOrderSignalEFull(HttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
|
||||
};
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "Tag.h"
|
||||
#include "SWGTag.h"
|
||||
|
||||
#include "SWGHelpers.h"
|
||||
|
||||
@ -22,27 +22,27 @@
|
||||
|
||||
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("");
|
||||
}
|
||||
|
||||
void
|
||||
Tag::cleanup() {
|
||||
SWGTag::cleanup() {
|
||||
|
||||
|
||||
if(name != nullptr) {
|
||||
@ -50,8 +50,8 @@ Tag::cleanup() {
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
@ -60,13 +60,13 @@ Tag::fromJson(QString &json) {
|
||||
}
|
||||
|
||||
void
|
||||
Tag::fromJsonObject(QJsonObject &pJson) {
|
||||
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();
|
||||
|
||||
@ -76,7 +76,7 @@ Tag::asJson ()
|
||||
}
|
||||
|
||||
QJsonObject*
|
||||
Tag::asJsonObject() {
|
||||
SWGTag::asJsonObject() {
|
||||
QJsonObject* obj = new QJsonObject();
|
||||
|
||||
obj->insert("id", QJsonValue(id));
|
||||
@ -87,20 +87,20 @@ Tag::asJsonObject() {
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -11,13 +11,13 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Tag.h
|
||||
* SWGTag.h
|
||||
*
|
||||
* A tag for a pet
|
||||
*/
|
||||
|
||||
#ifndef Tag_H_
|
||||
#define Tag_H_
|
||||
#ifndef SWGTag_H_
|
||||
#define SWGTag_H_
|
||||
|
||||
#include <QJsonObject>
|
||||
|
||||
@ -29,18 +29,18 @@
|
||||
|
||||
namespace Swagger {
|
||||
|
||||
class Tag: public SWGObject {
|
||||
class SWGTag: public SWGObject {
|
||||
public:
|
||||
Tag();
|
||||
Tag(QString* json);
|
||||
virtual ~Tag();
|
||||
SWGTag();
|
||||
SWGTag(QString* json);
|
||||
virtual ~SWGTag();
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
QString asJson ();
|
||||
QJsonObject* asJsonObject();
|
||||
void fromJsonObject(QJsonObject &json);
|
||||
Tag* fromJson(QString &jsonString);
|
||||
SWGTag* fromJson(QString &jsonString);
|
||||
|
||||
qint64 getId();
|
||||
void setId(qint64 id);
|
||||
@ -56,4 +56,4 @@ private:
|
||||
|
||||
}
|
||||
|
||||
#endif /* Tag_H_ */
|
||||
#endif /* SWGTag_H_ */
|
@ -11,7 +11,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "User.h"
|
||||
#include "SWGUser.h"
|
||||
|
||||
#include "SWGHelpers.h"
|
||||
|
||||
@ -22,21 +22,21 @@
|
||||
|
||||
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("");
|
||||
first_name = new QString("");
|
||||
@ -48,7 +48,7 @@ User::init() {
|
||||
}
|
||||
|
||||
void
|
||||
User::cleanup() {
|
||||
SWGUser::cleanup() {
|
||||
|
||||
|
||||
if(username != nullptr) {
|
||||
@ -77,8 +77,8 @@ User::cleanup() {
|
||||
|
||||
}
|
||||
|
||||
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();
|
||||
@ -87,7 +87,7 @@ User::fromJson(QString &json) {
|
||||
}
|
||||
|
||||
void
|
||||
User::fromJsonObject(QJsonObject &pJson) {
|
||||
SWGUser::fromJsonObject(QJsonObject &pJson) {
|
||||
::Swagger::setValue(&id, pJson["id"], "qint64", "");
|
||||
::Swagger::setValue(&username, pJson["username"], "QString", "QString");
|
||||
::Swagger::setValue(&first_name, pJson["firstName"], "QString", "QString");
|
||||
@ -99,7 +99,7 @@ User::fromJsonObject(QJsonObject &pJson) {
|
||||
}
|
||||
|
||||
QString
|
||||
User::asJson ()
|
||||
SWGUser::asJson ()
|
||||
{
|
||||
QJsonObject* obj = this->asJsonObject();
|
||||
|
||||
@ -109,7 +109,7 @@ User::asJson ()
|
||||
}
|
||||
|
||||
QJsonObject*
|
||||
User::asJsonObject() {
|
||||
SWGUser::asJsonObject() {
|
||||
QJsonObject* obj = new QJsonObject();
|
||||
|
||||
obj->insert("id", QJsonValue(id));
|
||||
@ -132,74 +132,74 @@ User::asJsonObject() {
|
||||
}
|
||||
|
||||
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() {
|
||||
SWGUser::getFirstName() {
|
||||
return first_name;
|
||||
}
|
||||
void
|
||||
User::setFirstName(QString* first_name) {
|
||||
SWGUser::setFirstName(QString* first_name) {
|
||||
this->first_name = first_name;
|
||||
}
|
||||
|
||||
QString*
|
||||
User::getLastName() {
|
||||
SWGUser::getLastName() {
|
||||
return last_name;
|
||||
}
|
||||
void
|
||||
User::setLastName(QString* last_name) {
|
||||
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() {
|
||||
SWGUser::getUserStatus() {
|
||||
return user_status;
|
||||
}
|
||||
void
|
||||
User::setUserStatus(qint32 user_status) {
|
||||
SWGUser::setUserStatus(qint32 user_status) {
|
||||
this->user_status = user_status;
|
||||
}
|
||||
|
@ -11,13 +11,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>
|
||||
|
||||
@ -29,18 +29,18 @@
|
||||
|
||||
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);
|
||||
@ -80,4 +80,4 @@ private:
|
||||
|
||||
}
|
||||
|
||||
#endif /* User_H_ */
|
||||
#endif /* SWGUser_H_ */
|
@ -29,7 +29,7 @@ SWGUserApi::SWGUserApi(QString host, QString basePath) {
|
||||
}
|
||||
|
||||
void
|
||||
SWGUserApi::createUser(User body) {
|
||||
SWGUserApi::createUser(SWGUser body) {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/user");
|
||||
|
||||
@ -71,12 +71,16 @@ SWGUserApi::createUserCallback(HttpRequestWorker * worker) {
|
||||
|
||||
worker->deleteLater();
|
||||
|
||||
emit createUserSignal();
|
||||
emit createUserSignalE(error_type, error_str);
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
emit createUserSignal();
|
||||
} else {
|
||||
emit createUserSignalE(error_type, error_str);
|
||||
emit createUserSignalEFull(worker, error_type, error_str);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SWGUserApi::createUsersWithArrayInput(QList<User*>* body) {
|
||||
SWGUserApi::createUsersWithArrayInput(QList<SWGUser*>* body) {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/user/createWithArray");
|
||||
|
||||
@ -123,12 +127,16 @@ SWGUserApi::createUsersWithArrayInputCallback(HttpRequestWorker * worker) {
|
||||
|
||||
worker->deleteLater();
|
||||
|
||||
emit createUsersWithArrayInputSignal();
|
||||
emit createUsersWithArrayInputSignalE(error_type, error_str);
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
emit createUsersWithArrayInputSignal();
|
||||
} else {
|
||||
emit createUsersWithArrayInputSignalE(error_type, error_str);
|
||||
emit createUsersWithArrayInputSignalEFull(worker, error_type, error_str);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SWGUserApi::createUsersWithListInput(QList<User*>* body) {
|
||||
SWGUserApi::createUsersWithListInput(QList<SWGUser*>* body) {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/user/createWithList");
|
||||
|
||||
@ -175,8 +183,12 @@ SWGUserApi::createUsersWithListInputCallback(HttpRequestWorker * worker) {
|
||||
|
||||
worker->deleteLater();
|
||||
|
||||
emit createUsersWithListInputSignal();
|
||||
emit createUsersWithListInputSignalE(error_type, error_str);
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
emit createUsersWithListInputSignal();
|
||||
} else {
|
||||
emit createUsersWithListInputSignalE(error_type, error_str);
|
||||
emit createUsersWithListInputSignalEFull(worker, error_type, error_str);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -222,8 +234,12 @@ SWGUserApi::deleteUserCallback(HttpRequestWorker * worker) {
|
||||
|
||||
worker->deleteLater();
|
||||
|
||||
emit deleteUserSignal();
|
||||
emit deleteUserSignalE(error_type, error_str);
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
emit deleteUserSignal();
|
||||
} else {
|
||||
emit deleteUserSignalE(error_type, error_str);
|
||||
emit deleteUserSignalEFull(worker, error_type, error_str);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -269,11 +285,15 @@ SWGUserApi::getUserByNameCallback(HttpRequestWorker * worker) {
|
||||
|
||||
|
||||
QString json(worker->response);
|
||||
User* output = static_cast<User*>(create(json, QString("User")));
|
||||
SWGUser* output = static_cast<SWGUser*>(create(json, QString("SWGUser")));
|
||||
worker->deleteLater();
|
||||
|
||||
emit getUserByNameSignal(output);
|
||||
emit getUserByNameSignalE(output, error_type, error_str);
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
emit getUserByNameSignal(output);
|
||||
} else {
|
||||
emit getUserByNameSignalE(output, error_type, error_str);
|
||||
emit getUserByNameSignalEFull(worker, error_type, error_str);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -336,8 +356,12 @@ SWGUserApi::loginUserCallback(HttpRequestWorker * worker) {
|
||||
QString* output = static_cast<QString*>(create(json, QString("QString")));
|
||||
worker->deleteLater();
|
||||
|
||||
emit loginUserSignal(output);
|
||||
emit loginUserSignalE(output, error_type, error_str);
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
emit loginUserSignal(output);
|
||||
} else {
|
||||
emit loginUserSignalE(output, error_type, error_str);
|
||||
emit loginUserSignalEFull(worker, error_type, error_str);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -381,12 +405,16 @@ SWGUserApi::logoutUserCallback(HttpRequestWorker * worker) {
|
||||
|
||||
worker->deleteLater();
|
||||
|
||||
emit logoutUserSignal();
|
||||
emit logoutUserSignalE(error_type, error_str);
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
emit logoutUserSignal();
|
||||
} else {
|
||||
emit logoutUserSignalE(error_type, error_str);
|
||||
emit logoutUserSignalEFull(worker, error_type, error_str);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SWGUserApi::updateUser(QString* username, User body) {
|
||||
SWGUserApi::updateUser(QString* username, SWGUser body) {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/user/{username}");
|
||||
|
||||
@ -430,8 +458,12 @@ SWGUserApi::updateUserCallback(HttpRequestWorker * worker) {
|
||||
|
||||
worker->deleteLater();
|
||||
|
||||
emit updateUserSignal();
|
||||
emit updateUserSignalE(error_type, error_str);
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
emit updateUserSignal();
|
||||
} else {
|
||||
emit updateUserSignalE(error_type, error_str);
|
||||
emit updateUserSignalEFull(worker, error_type, error_str);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
#include "User.h"
|
||||
#include "SWGUser.h"
|
||||
|
||||
#include <QObject>
|
||||
|
||||
@ -35,14 +35,14 @@ public:
|
||||
QString basePath;
|
||||
QMap<QString, QString> defaultHeaders;
|
||||
|
||||
void createUser(User body);
|
||||
void createUsersWithArrayInput(QList<User*>* body);
|
||||
void createUsersWithListInput(QList<User*>* body);
|
||||
void createUser(SWGUser body);
|
||||
void createUsersWithArrayInput(QList<SWGUser*>* body);
|
||||
void createUsersWithListInput(QList<SWGUser*>* body);
|
||||
void deleteUser(QString* username);
|
||||
void getUserByName(QString* username);
|
||||
void loginUser(QString* username, QString* password);
|
||||
void logoutUser();
|
||||
void updateUser(QString* username, User body);
|
||||
void updateUser(QString* username, SWGUser body);
|
||||
|
||||
private:
|
||||
void createUserCallback (HttpRequestWorker * worker);
|
||||
@ -59,7 +59,7 @@ signals:
|
||||
void createUsersWithArrayInputSignal();
|
||||
void createUsersWithListInputSignal();
|
||||
void deleteUserSignal();
|
||||
void getUserByNameSignal(User* summary);
|
||||
void getUserByNameSignal(SWGUser* summary);
|
||||
void loginUserSignal(QString* summary);
|
||||
void logoutUserSignal();
|
||||
void updateUserSignal();
|
||||
@ -68,11 +68,20 @@ signals:
|
||||
void createUsersWithArrayInputSignalE(QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void createUsersWithListInputSignalE(QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void deleteUserSignalE(QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void getUserByNameSignalE(User* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void getUserByNameSignalE(SWGUser* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void loginUserSignalE(QString* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void logoutUserSignalE(QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void updateUserSignalE(QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
|
||||
void createUserSignalEFull(HttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void createUsersWithArrayInputSignalEFull(HttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void createUsersWithListInputSignalEFull(HttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void deleteUserSignalEFull(HttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void getUserByNameSignalEFull(HttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void loginUserSignalEFull(HttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void logoutUserSignalEFull(HttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void updateUserSignalEFull(HttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user