273 lines
11 KiB
Diff
273 lines
11 KiB
Diff
diff -ruN ./openapi-cpp-qt-client.origin/api-body.mustache ./openapi-cpp-qt-client/api-body.mustache
|
|
--- ./openapi-cpp-qt-client.origin/api-body.mustache 2023-11-20 15:58:57.557083772 +0800
|
|
+++ ./openapi-cpp-qt-client/api-body.mustache 2023-11-20 16:00:09.746095636 +0800
|
|
@@ -163,7 +163,7 @@
|
|
}
|
|
|
|
void {{classname}}::abortRequests() {
|
|
- emit abortRequestsSignal();
|
|
+ Q_EMIT abortRequestsSignal();
|
|
}
|
|
|
|
QString {{classname}}::getParamStylePrefix(const QString &style) {
|
|
@@ -676,7 +676,7 @@
|
|
connect(this, &{{classname}}::abortRequestsSignal, worker, &QObject::deleteLater);
|
|
connect(worker, &QObject::destroyed, this, [this]() {
|
|
if (findChildren<{{prefix}}HttpRequestWorker*>().count() == 0) {
|
|
- emit allPendingRequestsCompleted();
|
|
+ Q_EMIT allPendingRequestsCompleted();
|
|
}
|
|
});{{#authMethods}}{{#isOAuth}}{{#isCode}}
|
|
_OauthMethod = 2;
|
|
@@ -702,7 +702,7 @@
|
|
connect(this, &{{classname}}::abortRequestsSignal, _latestWorker, &QObject::deleteLater);
|
|
connect(_latestWorker, &QObject::destroyed, [this](){
|
|
if(findChildren<{{prefix}}HttpRequestWorker*>().count() == 0){
|
|
- emit allPendingRequestsCompleted();
|
|
+ Q_EMIT allPendingRequestsCompleted();
|
|
}
|
|
});
|
|
|
|
@@ -732,7 +732,7 @@
|
|
connect(this, &{{classname}}::abortRequestsSignal, _latestWorker, &QObject::deleteLater);
|
|
connect(_latestWorker, &QObject::destroyed, [this](){
|
|
if(findChildren<{{prefix}}HttpRequestWorker*>().count() == 0){
|
|
- emit allPendingRequestsCompleted();
|
|
+ Q_EMIT allPendingRequestsCompleted();
|
|
}
|
|
});
|
|
|
|
@@ -762,7 +762,7 @@
|
|
connect(this, &{{classname}}::abortRequestsSignal, _latestWorker, &QObject::deleteLater);
|
|
connect(_latestWorker, &QObject::destroyed, [this](){
|
|
if(findChildren<{{prefix}}HttpRequestWorker*>().count() == 0){
|
|
- emit allPendingRequestsCompleted();
|
|
+ Q_EMIT allPendingRequestsCompleted();
|
|
}
|
|
});
|
|
|
|
@@ -792,7 +792,7 @@
|
|
connect(this, &{{classname}}::abortRequestsSignal, _latestWorker, &QObject::deleteLater);
|
|
connect(_latestWorker, &QObject::destroyed, [this](){
|
|
if(findChildren<{{prefix}}HttpRequestWorker*>().count() == 0){
|
|
- emit allPendingRequestsCompleted();
|
|
+ Q_EMIT allPendingRequestsCompleted();
|
|
}
|
|
});
|
|
|
|
@@ -857,8 +857,8 @@
|
|
worker->deleteLater();
|
|
|
|
if (worker->error_type == QNetworkReply::NoError) {
|
|
- emit {{nickname}}Signal({{#returnType}}output{{/returnType}});
|
|
- emit {{nickname}}SignalFull(worker{{#returnType}}, output{{/returnType}});{{#authMethods}}{{#isOAuth}}{{#isCode}}
|
|
+ Q_EMIT {{nickname}}Signal({{#returnType}}output{{/returnType}});
|
|
+ Q_EMIT {{nickname}}SignalFull(worker{{#returnType}}, output{{/returnType}});{{#authMethods}}{{#isOAuth}}{{#isCode}}
|
|
} else if(worker->error_type == QNetworkReply::AuthenticationRequiredError){
|
|
connect(&_authFlow, SIGNAL(tokenReceived()), this, SLOT(tokenAvailable()));
|
|
QStringList scope;
|
|
@@ -870,7 +870,7 @@
|
|
QString tokenUrl("{{tokenUrl}}");
|
|
//TODO get clientID and Secret and state in the config? https://swagger.io/docs/specification/authentication/oauth2/ states that you should do as you like
|
|
_authFlow.setVariables(authorizationUrl, tokenUrl, scopeStr, "state" , "http://127.0.0.1:9999", "clientId", "clientSecret");
|
|
- emit _authFlow.authenticationNeeded();{{/isCode}}
|
|
+ Q_EMIT _authFlow.authenticationNeeded();{{/isCode}}
|
|
{{#isImplicit}}
|
|
} else if(worker->error_type == QNetworkReply::AuthenticationRequiredError){
|
|
connect(&_implicitFlow, SIGNAL(tokenReceived()), this, SLOT(tokenAvailable()));
|
|
@@ -882,7 +882,7 @@
|
|
QString authorizationUrl("{{authorizationUrl}}");
|
|
//TODO get clientID and Secret and state in the config? https://swagger.io/docs/specification/authentication/oauth2/ states that you should do as you like
|
|
_implicitFlow.setVariables(authorizationUrl, scopeStr, "state" , "http://127.0.0.1:9999", "clientId");
|
|
- emit _implicitFlow.authenticationNeeded();{{/isImplicit}}
|
|
+ Q_EMIT _implicitFlow.authenticationNeeded();{{/isImplicit}}
|
|
{{#isApplication}}
|
|
} else if(worker->error_type == QNetworkReply::AuthenticationRequiredError){
|
|
connect(&_credentialFlow, SIGNAL(tokenReceived()), this, SLOT(tokenAvailable()));
|
|
@@ -894,7 +894,7 @@
|
|
QString tokenUrl("{{tokenUrl}}");
|
|
//TODO get clientID and Secret and state in the config? https://swagger.io/docs/specification/authentication/oauth2/ states that you should do as you like
|
|
_credentialFlow.setVariables(tokenUrl , scopeStr, "clientId", "clientSecret");
|
|
- emit _credentialFlow.authenticationNeeded();{{/isApplication}}
|
|
+ Q_EMIT _credentialFlow.authenticationNeeded();{{/isApplication}}
|
|
{{#isPassword}}
|
|
} else if(worker->error_type == QNetworkReply::AuthenticationRequiredError){
|
|
connect(&_passwordFlow, SIGNAL(tokenReceived()), this, SLOT(tokenAvailable()));
|
|
@@ -906,11 +906,11 @@
|
|
QString tokenUrl("{{tokenUrl}}");
|
|
//TODO get clientID and Secret and state in the config? https://swagger.io/docs/specification/authentication/oauth2/ states that you should do as you like
|
|
_passwordFlow.setVariables(tokenUrl , scopeStr ,"clientId", "clientSecret", "username", "password");
|
|
- emit _passwordFlow.authenticationNeeded();
|
|
+ Q_EMIT _passwordFlow.authenticationNeeded();
|
|
{{/isPassword}}{{/isOAuth}}{{/authMethods}}
|
|
} else {
|
|
- emit {{nickname}}SignalE({{#returnType}}output, {{/returnType}}error_type, error_str);
|
|
- emit {{nickname}}SignalEFull(worker, error_type, error_str);
|
|
+ Q_EMIT {{nickname}}SignalE({{#returnType}}output, {{/returnType}}error_type, error_str);
|
|
+ Q_EMIT {{nickname}}SignalEFull(worker, error_type, error_str);
|
|
}
|
|
}
|
|
|
|
diff -ruN ./openapi-cpp-qt-client.origin/api-header.mustache ./openapi-cpp-qt-client/api-header.mustache
|
|
--- ./openapi-cpp-qt-client.origin/api-header.mustache 2023-11-20 15:58:57.557083772 +0800
|
|
+++ ./openapi-cpp-qt-client/api-header.mustache 2023-11-20 16:00:25.718319009 +0800
|
|
@@ -85,7 +85,7 @@
|
|
{{#operations}}{{#operation}}
|
|
void {{nickname}}Callback({{prefix}}HttpRequestWorker *worker);{{/operation}}{{/operations}}
|
|
|
|
-signals:
|
|
+Q_SIGNALS:
|
|
{{#operations}}{{#operation}}
|
|
void {{nickname}}Signal({{#returnType}}{{{.}}} summary{{/returnType}});{{/operation}}{{/operations}}
|
|
{{#operations}}{{#operation}}
|
|
@@ -98,7 +98,7 @@
|
|
void abortRequestsSignal();
|
|
void allPendingRequestsCompleted();
|
|
|
|
-public slots:
|
|
+public Q_SLOTS:
|
|
void tokenAvailable();
|
|
|
|
};
|
|
diff -ruN ./openapi-cpp-qt-client.origin/HttpRequest.cpp.mustache ./openapi-cpp-qt-client/HttpRequest.cpp.mustache
|
|
--- ./openapi-cpp-qt-client.origin/HttpRequest.cpp.mustache 2023-11-20 15:58:57.557083772 +0800
|
|
+++ ./openapi-cpp-qt-client/HttpRequest.cpp.mustache 2023-11-20 16:00:09.746095636 +0800
|
|
@@ -409,7 +409,7 @@
|
|
}
|
|
process_response(reply);
|
|
reply->deleteLater();
|
|
- emit on_execution_finished(this);
|
|
+ Q_EMIT on_execution_finished(this);
|
|
}
|
|
|
|
void {{prefix}}HttpRequestWorker::on_reply_timeout(QNetworkReply *reply) {
|
|
@@ -419,7 +419,7 @@
|
|
disconnect(reply, nullptr, nullptr, nullptr);
|
|
reply->abort();
|
|
reply->deleteLater();
|
|
- emit on_execution_finished(this);
|
|
+ Q_EMIT on_execution_finished(this);
|
|
}
|
|
|
|
void {{prefix}}HttpRequestWorker::process_response(QNetworkReply *reply) {
|
|
diff -ruN ./openapi-cpp-qt-client.origin/HttpRequest.h.mustache ./openapi-cpp-qt-client/HttpRequest.h.mustache
|
|
--- ./openapi-cpp-qt-client.origin/HttpRequest.h.mustache 2023-11-20 15:58:57.557083772 +0800
|
|
+++ ./openapi-cpp-qt-client/HttpRequest.h.mustache 2023-11-20 15:59:59.305949534 +0800
|
|
@@ -72,7 +72,7 @@
|
|
void setRequestCompressionEnabled(bool enable);
|
|
int getHttpResponseCode() const;
|
|
|
|
-signals:
|
|
+Q_SIGNALS:
|
|
void on_execution_finished({{prefix}}HttpRequestWorker *worker);
|
|
|
|
private:
|
|
diff -ruN ./openapi-cpp-qt-client.origin/oauth.cpp.mustache ./openapi-cpp-qt-client/oauth.cpp.mustache
|
|
--- ./openapi-cpp-qt-client.origin/oauth.cpp.mustache 2023-11-20 15:58:57.557083772 +0800
|
|
+++ ./openapi-cpp-qt-client/oauth.cpp.mustache 2023-11-20 16:00:09.742095580 +0800
|
|
@@ -12,7 +12,7 @@
|
|
|
|
void OauthBase::onFinish(QNetworkReply *rep)
|
|
{
|
|
- //TODO emit error signal when token is wrong
|
|
+ //TODO Q_EMIT error signal when token is wrong
|
|
QJsonDocument document = QJsonDocument::fromJson(rep->readAll());
|
|
QJsonObject rootObj = document.object();
|
|
QString token = rootObj.find("access_token").value().toString();
|
|
@@ -31,7 +31,7 @@
|
|
void OauthBase::addToken(oauthToken token)
|
|
{
|
|
m_oauthTokenMap.insert(token.getScope(),token);
|
|
- emit tokenReceived();
|
|
+ Q_EMIT tokenReceived();
|
|
|
|
}
|
|
|
|
@@ -341,7 +341,7 @@
|
|
}
|
|
socket->close();
|
|
|
|
- emit dataReceived(queryParams);
|
|
+ Q_EMIT dataReceived(queryParams);
|
|
}
|
|
|
|
{{#cppNamespaceDeclarations}}
|
|
diff -ruN ./openapi-cpp-qt-client.origin/oauth.h.mustache ./openapi-cpp-qt-client/oauth.h.mustache
|
|
--- ./openapi-cpp-qt-client.origin/oauth.h.mustache 2023-11-20 15:58:57.557083772 +0800
|
|
+++ ./openapi-cpp-qt-client/oauth.h.mustache 2023-11-20 16:00:25.718319009 +0800
|
|
@@ -58,10 +58,10 @@
|
|
private:
|
|
QByteArray m_reply;
|
|
|
|
-signals:
|
|
+Q_SIGNALS:
|
|
void dataReceived(QMap<QString, QString>);
|
|
|
|
-public slots:
|
|
+public Q_SLOTS:
|
|
void onConnected();
|
|
void read();
|
|
void start();
|
|
@@ -88,11 +88,11 @@
|
|
QString m_scope, m_accessType, m_state, m_redirectUri, m_clientId, m_clientSecret;
|
|
bool m_linked;
|
|
|
|
-public slots:
|
|
+public Q_SLOTS:
|
|
virtual void authenticationNeededCallback()=0;
|
|
void onFinish(QNetworkReply *rep);
|
|
|
|
-signals:
|
|
+Q_SIGNALS:
|
|
void authenticationNeeded();
|
|
void tokenReceived();
|
|
};
|
|
@@ -110,7 +110,7 @@
|
|
private:
|
|
ReplyServer m_server;
|
|
|
|
-public slots:
|
|
+public Q_SLOTS:
|
|
void authenticationNeededCallback() override;
|
|
void onVerificationReceived(const QMap<QString, QString> response);
|
|
|
|
@@ -129,7 +129,7 @@
|
|
private:
|
|
ReplyServer m_server;
|
|
|
|
-public slots:
|
|
+public Q_SLOTS:
|
|
void authenticationNeededCallback() override;
|
|
void ImplicitTokenReceived(const QMap<QString, QString> response);
|
|
};
|
|
@@ -144,7 +144,7 @@
|
|
void unlink() override;
|
|
void setVariables(QString tokenUrl, QString scope, QString clientId, QString clientSecret);
|
|
|
|
-public slots:
|
|
+public Q_SLOTS:
|
|
void authenticationNeededCallback() override;
|
|
|
|
};
|
|
@@ -162,7 +162,7 @@
|
|
private:
|
|
QString m_username, m_password;
|
|
|
|
-public slots:
|
|
+public Q_SLOTS:
|
|
void authenticationNeededCallback() override;
|
|
|
|
};
|
|
diff -ruN ./openapi-cpp-qt-client.origin/README.mustache ./openapi-cpp-qt-client/README.mustache
|
|
--- ./openapi-cpp-qt-client.origin/README.mustache 2023-11-20 15:58:57.557083772 +0800
|
|
+++ ./openapi-cpp-qt-client/README.mustache 2023-11-20 16:00:25.718319009 +0800
|
|
@@ -42,7 +42,7 @@
|
|
{{#allParams}}
|
|
{{{dataType}}} create();
|
|
{{/allParams}}
|
|
-public slots:
|
|
+public Q_SLOTS:
|
|
void exampleFunction1();
|
|
};
|
|
{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
|