forked from loafle/openapi-generator-original
[cpp-qt-client] Minor fixes (#12951)
* foreach => for * Fix PetStore.pro * Whitespace formatting
This commit is contained in:
parent
17c021df5b
commit
cf58ac0583
@ -196,7 +196,7 @@ void {{prefix}}HttpRequestWorker::execute({{prefix}}HttpRequestInput *input) {
|
|||||||
if (input->vars.count() > 0) {
|
if (input->vars.count() > 0) {
|
||||||
bool first = true;
|
bool first = true;
|
||||||
isFormData = true;
|
isFormData = true;
|
||||||
foreach (QString key, input->vars.keys()) {
|
for (QString key : input->vars.keys()) {
|
||||||
if (!first) {
|
if (!first) {
|
||||||
request_content.append("&");
|
request_content.append("&");
|
||||||
}
|
}
|
||||||
@ -227,7 +227,7 @@ void {{prefix}}HttpRequestWorker::execute({{prefix}}HttpRequestInput *input) {
|
|||||||
QString new_line = "\r\n";
|
QString new_line = "\r\n";
|
||||||
|
|
||||||
// add variables
|
// add variables
|
||||||
foreach (QString key, input->vars.keys()) {
|
for (QString key : input->vars.keys()) {
|
||||||
// add boundary
|
// add boundary
|
||||||
request_content.append(boundary_delimiter.toUtf8());
|
request_content.append(boundary_delimiter.toUtf8());
|
||||||
request_content.append(boundary.toUtf8());
|
request_content.append(boundary.toUtf8());
|
||||||
@ -329,7 +329,7 @@ void {{prefix}}HttpRequestWorker::execute({{prefix}}HttpRequestInput *input) {
|
|||||||
request.setSslConfiguration(*{{prefix}}HttpRequestWorker::sslDefaultConfiguration);
|
request.setSslConfiguration(*{{prefix}}HttpRequestWorker::sslDefaultConfiguration);
|
||||||
}
|
}
|
||||||
request.setRawHeader("User-Agent", "{{httpUserAgent}}{{^httpUserAgent}}OpenAPI-Generator/{{apiVersion}}/cpp-qt{{/httpUserAgent}}");
|
request.setRawHeader("User-Agent", "{{httpUserAgent}}{{^httpUserAgent}}OpenAPI-Generator/{{apiVersion}}/cpp-qt{{/httpUserAgent}}");
|
||||||
foreach (QString key, input->headers.keys()) { request.setRawHeader(key.toStdString().c_str(), input->headers.value(key).toStdString().c_str()); }
|
for (QString key : input->headers.keys()) { request.setRawHeader(key.toStdString().c_str(), input->headers.value(key).toStdString().c_str()); }
|
||||||
|
|
||||||
if (request_content.size() > 0 && !isFormData && (input->var_layout != MULTIPART)) {
|
if (request_content.size() > 0 && !isFormData && (input->var_layout != MULTIPART)) {
|
||||||
if (!input->headers.contains("Content-Type")) {
|
if (!input->headers.contains("Content-Type")) {
|
||||||
|
@ -74,7 +74,7 @@ void {{classname}}::setServerIndex(const QString &operation, int serverIndex) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void {{classname}}::setApiKey(const QString &apiKeyName, const QString &apiKey) {
|
void {{classname}}::setApiKey(const QString &apiKeyName, const QString &apiKey) {
|
||||||
_apiKeys.insert(apiKeyName,apiKey);
|
_apiKeys.insert(apiKeyName, apiKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
void {{classname}}::setBearerToken(const QString &token) {
|
void {{classname}}::setBearerToken(const QString &token) {
|
||||||
@ -271,7 +271,7 @@ void {{classname}}::{{nickname}}({{#allParams}}{{#required}}const {{{dataType}}}
|
|||||||
QString paramString = (pathStyle == "matrix" && {{isExplode}}) ? pathPrefix : pathPrefix+"{{baseName}}"+pathSuffix;
|
QString paramString = (pathStyle == "matrix" && {{isExplode}}) ? pathPrefix : pathPrefix+"{{baseName}}"+pathSuffix;
|
||||||
QJsonObject parameter = {{paramName}}{{^required}}.value(){{/required}}.asJsonObject();
|
QJsonObject parameter = {{paramName}}{{^required}}.value(){{/required}}.asJsonObject();
|
||||||
qint32 count = 0;
|
qint32 count = 0;
|
||||||
foreach(const QString& key, parameter.keys()) {
|
for(const QString& key : parameter.keys()) {
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
pathDelimiter = (pathStyle == "matrix" && {{isExplode}}) ? ";" : getParamStyleDelimiter(pathStyle, key, {{isExplode}});
|
pathDelimiter = (pathStyle == "matrix" && {{isExplode}}) ? ";" : getParamStyleDelimiter(pathStyle, key, {{isExplode}});
|
||||||
paramString.append(pathDelimiter);
|
paramString.append(pathDelimiter);
|
||||||
@ -320,7 +320,7 @@ void {{classname}}::{{nickname}}({{#allParams}}{{#required}}const {{{dataType}}}
|
|||||||
if ({{{paramName}}}{{^required}}.value(){{/required}}.size() > 0) {
|
if ({{{paramName}}}{{^required}}.value(){{/required}}.size() > 0) {
|
||||||
QString paramString = (pathStyle == "matrix") ? pathPrefix+"{{baseName}}"+pathSuffix : pathPrefix;
|
QString paramString = (pathStyle == "matrix") ? pathPrefix+"{{baseName}}"+pathSuffix : pathPrefix;
|
||||||
qint32 count = 0;
|
qint32 count = 0;
|
||||||
foreach ({{{baseType}}} t, {{paramName}}{{^required}}.value(){{/required}}) {
|
for ({{{baseType}}} t : {{paramName}}{{^required}}.value(){{/required}}) {
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
fullPath.append(pathDelimiter);
|
fullPath.append(pathDelimiter);
|
||||||
}
|
}
|
||||||
@ -353,7 +353,7 @@ void {{classname}}::{{nickname}}({{#allParams}}{{#required}}const {{{dataType}}}
|
|||||||
QString paramString = (queryStyle == "form" && {{isExplode}}) ? "" : (queryStyle == "form" && !({{isExplode}})) ? "{{baseName}}"+querySuffix : "";
|
QString paramString = (queryStyle == "form" && {{isExplode}}) ? "" : (queryStyle == "form" && !({{isExplode}})) ? "{{baseName}}"+querySuffix : "";
|
||||||
QJsonObject parameter = {{paramName}}{{^required}}.value(){{/required}}.asJsonObject();
|
QJsonObject parameter = {{paramName}}{{^required}}.value(){{/required}}.asJsonObject();
|
||||||
qint32 count = 0;
|
qint32 count = 0;
|
||||||
foreach(const QString& key, parameter.keys()) {
|
for(const QString& key : parameter.keys()) {
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
queryDelimiter = ((queryStyle == "form" || queryStyle == "deepObject") && {{isExplode}}) ? "&" : getParamStyleDelimiter(queryStyle, key, {{isExplode}});
|
queryDelimiter = ((queryStyle == "form" || queryStyle == "deepObject") && {{isExplode}}) ? "&" : getParamStyleDelimiter(queryStyle, key, {{isExplode}});
|
||||||
paramString.append(queryDelimiter);
|
paramString.append(queryDelimiter);
|
||||||
@ -403,7 +403,7 @@ void {{classname}}::{{nickname}}({{#allParams}}{{#required}}const {{{dataType}}}
|
|||||||
{{#collectionFormat}}
|
{{#collectionFormat}}
|
||||||
if ({{{paramName}}}{{^required}}.value(){{/required}}.size() > 0) {
|
if ({{{paramName}}}{{^required}}.value(){{/required}}.size() > 0) {
|
||||||
if (QString("{{collectionFormat}}").indexOf("multi") == 0) {
|
if (QString("{{collectionFormat}}").indexOf("multi") == 0) {
|
||||||
foreach ({{{baseType}}} t, {{paramName}}{{^required}}.value(){{/required}}) {
|
for ({{{baseType}}} t : {{paramName}}{{^required}}.value(){{/required}}) {
|
||||||
if (fullPath.indexOf("?") > 0)
|
if (fullPath.indexOf("?") > 0)
|
||||||
fullPath.append(queryPrefix);
|
fullPath.append(queryPrefix);
|
||||||
else
|
else
|
||||||
@ -416,7 +416,7 @@ void {{classname}}::{{nickname}}({{#allParams}}{{#required}}const {{{dataType}}}
|
|||||||
else
|
else
|
||||||
fullPath.append("?").append(queryPrefix).append("{{baseName}}").append(querySuffix);
|
fullPath.append("?").append(queryPrefix).append("{{baseName}}").append(querySuffix);
|
||||||
qint32 count = 0;
|
qint32 count = 0;
|
||||||
foreach ({{{baseType}}} t, {{paramName}}{{^required}}.value(){{/required}}) {
|
for ({{{baseType}}} t : {{paramName}}{{^required}}.value(){{/required}}) {
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
fullPath.append(({{isExplode}})? queryDelimiter : QUrl::toPercentEncoding(queryDelimiter));
|
fullPath.append(({{isExplode}})? queryDelimiter : QUrl::toPercentEncoding(queryDelimiter));
|
||||||
}
|
}
|
||||||
@ -429,7 +429,7 @@ void {{classname}}::{{nickname}}({{#allParams}}{{#required}}const {{{dataType}}}
|
|||||||
else
|
else
|
||||||
fullPath.append("?").append(queryPrefix).append("{{baseName}}").append(querySuffix);
|
fullPath.append("?").append(queryPrefix).append("{{baseName}}").append(querySuffix);
|
||||||
qint32 count = 0;
|
qint32 count = 0;
|
||||||
foreach ({{{baseType}}} t, {{paramName}}{{^required}}.value(){{/required}}) {
|
for ({{{baseType}}} t : {{paramName}}{{^required}}.value(){{/required}}) {
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
fullPath.append("\t");
|
fullPath.append("\t");
|
||||||
}
|
}
|
||||||
@ -442,7 +442,7 @@ void {{classname}}::{{nickname}}({{#allParams}}{{#required}}const {{{dataType}}}
|
|||||||
else
|
else
|
||||||
fullPath.append("?").append(queryPrefix).append("{{baseName}}").append(querySuffix);
|
fullPath.append("?").append(queryPrefix).append("{{baseName}}").append(querySuffix);
|
||||||
qint32 count = 0;
|
qint32 count = 0;
|
||||||
foreach ({{{baseType}}} t, {{paramName}}{{^required}}.value(){{/required}}) {
|
for ({{{baseType}}} t : {{paramName}}{{^required}}.value(){{/required}}) {
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
fullPath.append(queryDelimiter);
|
fullPath.append(queryDelimiter);
|
||||||
}
|
}
|
||||||
@ -455,7 +455,7 @@ void {{classname}}::{{nickname}}({{#allParams}}{{#required}}const {{{dataType}}}
|
|||||||
else
|
else
|
||||||
fullPath.append("?").append(queryPrefix).append("{{baseName}}").append(querySuffix);
|
fullPath.append("?").append(queryPrefix).append("{{baseName}}").append(querySuffix);
|
||||||
qint32 count = 0;
|
qint32 count = 0;
|
||||||
foreach ({{{baseType}}} t, {{paramName}}{{^required}}.value(){{/required}}) {
|
for ({{{baseType}}} t : {{paramName}}{{^required}}.value(){{/required}}) {
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
fullPath.append(queryDelimiter);
|
fullPath.append(queryDelimiter);
|
||||||
}
|
}
|
||||||
@ -468,7 +468,7 @@ void {{classname}}::{{nickname}}({{#allParams}}{{#required}}const {{{dataType}}}
|
|||||||
else
|
else
|
||||||
fullPath.append("?").append(queryPrefix).append("{{baseName}}").append(querySuffix);
|
fullPath.append("?").append(queryPrefix).append("{{baseName}}").append(querySuffix);
|
||||||
qint32 count = 0;
|
qint32 count = 0;
|
||||||
foreach ({{{baseType}}} t, {{paramName}}{{^required}}.value(){{/required}}) {
|
for ({{{baseType}}} t : {{paramName}}{{^required}}.value(){{/required}}) {
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
fullPath.append(queryDelimiter);
|
fullPath.append(queryDelimiter);
|
||||||
}
|
}
|
||||||
@ -530,7 +530,7 @@ void {{classname}}::{{nickname}}({{#allParams}}{{#required}}const {{{dataType}}}
|
|||||||
QString headerString;
|
QString headerString;
|
||||||
QJsonObject parameter = {{paramName}}{{^required}}.value(){{/required}}.asJsonObject();
|
QJsonObject parameter = {{paramName}}{{^required}}.value(){{/required}}.asJsonObject();
|
||||||
qint32 count = 0;
|
qint32 count = 0;
|
||||||
foreach(const QString& key, parameter.keys()) {
|
for (const QString& key : parameter.keys()) {
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
headerString.append(",");
|
headerString.append(",");
|
||||||
}
|
}
|
||||||
@ -577,7 +577,7 @@ void {{classname}}::{{nickname}}({{#allParams}}{{#required}}const {{{dataType}}}
|
|||||||
QString headerString;
|
QString headerString;
|
||||||
if ({{{paramName}}}{{^required}}.value(){{/required}}.size() > 0) {
|
if ({{{paramName}}}{{^required}}.value(){{/required}}.size() > 0) {
|
||||||
qint32 count = 0;
|
qint32 count = 0;
|
||||||
foreach ({{{baseType}}} t, {{paramName}}{{^required}}.value(){{/required}}) {
|
for ({{{baseType}}} t : {{paramName}}{{^required}}.value(){{/required}}) {
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
headerString.append(",");
|
headerString.append(",");
|
||||||
}
|
}
|
||||||
@ -599,7 +599,7 @@ void {{classname}}::{{nickname}}({{#allParams}}{{#required}}const {{{dataType}}}
|
|||||||
QString cookieString = "{{baseName}}=";
|
QString cookieString = "{{baseName}}=";
|
||||||
QJsonObject parameter = {{paramName}}{{^required}}.value(){{/required}}.asJsonObject();
|
QJsonObject parameter = {{paramName}}{{^required}}.value(){{/required}}.asJsonObject();
|
||||||
qint32 count = 0;
|
qint32 count = 0;
|
||||||
foreach(const QString& key, parameter.keys()) {
|
for (const QString& key : parameter.keys()) {
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
cookieString.append(",");
|
cookieString.append(",");
|
||||||
}
|
}
|
||||||
@ -649,7 +649,7 @@ void {{classname}}::{{nickname}}({{#allParams}}{{#required}}const {{{dataType}}}
|
|||||||
QString cookieString = "{{baseName}}=";
|
QString cookieString = "{{baseName}}=";
|
||||||
if ({{{paramName}}}.size() > 0) {
|
if ({{{paramName}}}.size() > 0) {
|
||||||
qint32 count = 0;
|
qint32 count = 0;
|
||||||
foreach ({{{baseType}}} t, {{paramName}}{{^required}}.value(){{/required}}) {
|
for ({{{baseType}}} t : {{paramName}}{{^required}}.value(){{/required}}) {
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
cookieString.append(",");
|
cookieString.append(",");
|
||||||
}
|
}
|
||||||
@ -817,7 +817,7 @@ void {{classname}}::{{nickname}}Callback({{prefix}}HttpRequestWorker *worker) {
|
|||||||
QByteArray array(json.toStdString().c_str());
|
QByteArray array(json.toStdString().c_str());
|
||||||
QJsonDocument doc = QJsonDocument::fromJson(array);
|
QJsonDocument doc = QJsonDocument::fromJson(array);
|
||||||
QJsonArray jsonArray = doc.array();
|
QJsonArray jsonArray = doc.array();
|
||||||
foreach (QJsonValue obj, jsonArray) {
|
for (QJsonValue obj : jsonArray) {
|
||||||
{{{returnBaseType}}} val;
|
{{{returnBaseType}}} val;
|
||||||
::{{cppNamespace}}::fromJsonValue(val, obj);
|
::{{cppNamespace}}::fromJsonValue(val, obj);
|
||||||
{{#uniqueItems}}
|
{{#uniqueItems}}
|
||||||
@ -841,7 +841,7 @@ void {{classname}}::{{nickname}}Callback({{prefix}}HttpRequestWorker *worker) {
|
|||||||
QByteArray array(json.toStdString().c_str());
|
QByteArray array(json.toStdString().c_str());
|
||||||
QJsonDocument doc = QJsonDocument::fromJson(array);
|
QJsonDocument doc = QJsonDocument::fromJson(array);
|
||||||
QJsonObject obj = doc.object();
|
QJsonObject obj = doc.object();
|
||||||
foreach (QString key, obj.keys()) {
|
for (QString key : obj.keys()) {
|
||||||
{{returnBaseType}} val;
|
{{returnBaseType}} val;
|
||||||
::{{cppNamespace}}::fromJsonValue(val, obj[key]);
|
::{{cppNamespace}}::fromJsonValue(val, obj[key]);
|
||||||
output.insert(key, val);
|
output.insert(key, val);
|
||||||
|
@ -329,8 +329,7 @@ void ReplyServer::read()
|
|||||||
|
|
||||||
|
|
||||||
QMap<QString, QString> queryParams;
|
QMap<QString, QString> queryParams;
|
||||||
QPair<QString, QString> tokenPair;
|
for (auto tokenPair : tokens) {
|
||||||
foreach (tokenPair, tokens) {
|
|
||||||
QString key = QUrl::fromPercentEncoding(QByteArray().append(tokenPair.first.trimmed().toLatin1()));
|
QString key = QUrl::fromPercentEncoding(QByteArray().append(tokenPair.first.trimmed().toLatin1()));
|
||||||
QString value = QUrl::fromPercentEncoding(QByteArray().append(tokenPair.second.trimmed().toLatin1()));
|
QString value = QUrl::fromPercentEncoding(QByteArray().append(tokenPair.second.trimmed().toLatin1()));
|
||||||
queryParams.insert(key, value);
|
queryParams.insert(key, value);
|
||||||
|
@ -6,8 +6,6 @@
|
|||||||
|
|
||||||
QT += core gui testlib network
|
QT += core gui testlib network
|
||||||
|
|
||||||
QT -= gui
|
|
||||||
|
|
||||||
TARGET = PetStore
|
TARGET = PetStore
|
||||||
CONFIG += console
|
CONFIG += console
|
||||||
CONFIG -= app_bundle
|
CONFIG -= app_bundle
|
||||||
|
@ -203,7 +203,7 @@ void PFXHttpRequestWorker::execute(PFXHttpRequestInput *input) {
|
|||||||
if (input->vars.count() > 0) {
|
if (input->vars.count() > 0) {
|
||||||
bool first = true;
|
bool first = true;
|
||||||
isFormData = true;
|
isFormData = true;
|
||||||
foreach (QString key, input->vars.keys()) {
|
for (QString key : input->vars.keys()) {
|
||||||
if (!first) {
|
if (!first) {
|
||||||
request_content.append("&");
|
request_content.append("&");
|
||||||
}
|
}
|
||||||
@ -234,7 +234,7 @@ void PFXHttpRequestWorker::execute(PFXHttpRequestInput *input) {
|
|||||||
QString new_line = "\r\n";
|
QString new_line = "\r\n";
|
||||||
|
|
||||||
// add variables
|
// add variables
|
||||||
foreach (QString key, input->vars.keys()) {
|
for (QString key : input->vars.keys()) {
|
||||||
// add boundary
|
// add boundary
|
||||||
request_content.append(boundary_delimiter.toUtf8());
|
request_content.append(boundary_delimiter.toUtf8());
|
||||||
request_content.append(boundary.toUtf8());
|
request_content.append(boundary.toUtf8());
|
||||||
@ -336,7 +336,7 @@ void PFXHttpRequestWorker::execute(PFXHttpRequestInput *input) {
|
|||||||
request.setSslConfiguration(*PFXHttpRequestWorker::sslDefaultConfiguration);
|
request.setSslConfiguration(*PFXHttpRequestWorker::sslDefaultConfiguration);
|
||||||
}
|
}
|
||||||
request.setRawHeader("User-Agent", "OpenAPI-Generator/1.0.0/cpp-qt");
|
request.setRawHeader("User-Agent", "OpenAPI-Generator/1.0.0/cpp-qt");
|
||||||
foreach (QString key, input->headers.keys()) { request.setRawHeader(key.toStdString().c_str(), input->headers.value(key).toStdString().c_str()); }
|
for (QString key : input->headers.keys()) { request.setRawHeader(key.toStdString().c_str(), input->headers.value(key).toStdString().c_str()); }
|
||||||
|
|
||||||
if (request_content.size() > 0 && !isFormData && (input->var_layout != MULTIPART)) {
|
if (request_content.size() > 0 && !isFormData && (input->var_layout != MULTIPART)) {
|
||||||
if (!input->headers.contains("Content-Type")) {
|
if (!input->headers.contains("Content-Type")) {
|
||||||
|
@ -327,8 +327,7 @@ void ReplyServer::read()
|
|||||||
|
|
||||||
|
|
||||||
QMap<QString, QString> queryParams;
|
QMap<QString, QString> queryParams;
|
||||||
QPair<QString, QString> tokenPair;
|
for (auto tokenPair : tokens) {
|
||||||
foreach (tokenPair, tokens) {
|
|
||||||
QString key = QUrl::fromPercentEncoding(QByteArray().append(tokenPair.first.trimmed().toLatin1()));
|
QString key = QUrl::fromPercentEncoding(QByteArray().append(tokenPair.first.trimmed().toLatin1()));
|
||||||
QString value = QUrl::fromPercentEncoding(QByteArray().append(tokenPair.second.trimmed().toLatin1()));
|
QString value = QUrl::fromPercentEncoding(QByteArray().append(tokenPair.second.trimmed().toLatin1()));
|
||||||
queryParams.insert(key, value);
|
queryParams.insert(key, value);
|
||||||
|
@ -73,7 +73,7 @@ void PFXPetApi::setServerIndex(const QString &operation, int serverIndex) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PFXPetApi::setApiKey(const QString &apiKeyName, const QString &apiKey) {
|
void PFXPetApi::setApiKey(const QString &apiKeyName, const QString &apiKey) {
|
||||||
_apiKeys.insert(apiKeyName,apiKey);
|
_apiKeys.insert(apiKeyName, apiKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PFXPetApi::setBearerToken(const QString &token) {
|
void PFXPetApi::setBearerToken(const QString &token) {
|
||||||
@ -363,7 +363,7 @@ void PFXPetApi::allPetsCallback(PFXHttpRequestWorker *worker) {
|
|||||||
QByteArray array(json.toStdString().c_str());
|
QByteArray array(json.toStdString().c_str());
|
||||||
QJsonDocument doc = QJsonDocument::fromJson(array);
|
QJsonDocument doc = QJsonDocument::fromJson(array);
|
||||||
QJsonArray jsonArray = doc.array();
|
QJsonArray jsonArray = doc.array();
|
||||||
foreach (QJsonValue obj, jsonArray) {
|
for (QJsonValue obj : jsonArray) {
|
||||||
PFXPet val;
|
PFXPet val;
|
||||||
::test_namespace::fromJsonValue(val, obj);
|
::test_namespace::fromJsonValue(val, obj);
|
||||||
output.insert(val);
|
output.insert(val);
|
||||||
@ -501,7 +501,7 @@ void PFXPetApi::findPetsByStatus(const QList<QString> &status) {
|
|||||||
queryDelimiter = getParamStyleDelimiter(queryStyle, "status", false);
|
queryDelimiter = getParamStyleDelimiter(queryStyle, "status", false);
|
||||||
if (status.size() > 0) {
|
if (status.size() > 0) {
|
||||||
if (QString("csv").indexOf("multi") == 0) {
|
if (QString("csv").indexOf("multi") == 0) {
|
||||||
foreach (QString t, status) {
|
for (QString t : status) {
|
||||||
if (fullPath.indexOf("?") > 0)
|
if (fullPath.indexOf("?") > 0)
|
||||||
fullPath.append(queryPrefix);
|
fullPath.append(queryPrefix);
|
||||||
else
|
else
|
||||||
@ -514,7 +514,7 @@ void PFXPetApi::findPetsByStatus(const QList<QString> &status) {
|
|||||||
else
|
else
|
||||||
fullPath.append("?").append(queryPrefix).append("status").append(querySuffix);
|
fullPath.append("?").append(queryPrefix).append("status").append(querySuffix);
|
||||||
qint32 count = 0;
|
qint32 count = 0;
|
||||||
foreach (QString t, status) {
|
for (QString t : status) {
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
fullPath.append((false)? queryDelimiter : QUrl::toPercentEncoding(queryDelimiter));
|
fullPath.append((false)? queryDelimiter : QUrl::toPercentEncoding(queryDelimiter));
|
||||||
}
|
}
|
||||||
@ -527,7 +527,7 @@ void PFXPetApi::findPetsByStatus(const QList<QString> &status) {
|
|||||||
else
|
else
|
||||||
fullPath.append("?").append(queryPrefix).append("status").append(querySuffix);
|
fullPath.append("?").append(queryPrefix).append("status").append(querySuffix);
|
||||||
qint32 count = 0;
|
qint32 count = 0;
|
||||||
foreach (QString t, status) {
|
for (QString t : status) {
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
fullPath.append("\t");
|
fullPath.append("\t");
|
||||||
}
|
}
|
||||||
@ -540,7 +540,7 @@ void PFXPetApi::findPetsByStatus(const QList<QString> &status) {
|
|||||||
else
|
else
|
||||||
fullPath.append("?").append(queryPrefix).append("status").append(querySuffix);
|
fullPath.append("?").append(queryPrefix).append("status").append(querySuffix);
|
||||||
qint32 count = 0;
|
qint32 count = 0;
|
||||||
foreach (QString t, status) {
|
for (QString t : status) {
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
fullPath.append(queryDelimiter);
|
fullPath.append(queryDelimiter);
|
||||||
}
|
}
|
||||||
@ -553,7 +553,7 @@ void PFXPetApi::findPetsByStatus(const QList<QString> &status) {
|
|||||||
else
|
else
|
||||||
fullPath.append("?").append(queryPrefix).append("status").append(querySuffix);
|
fullPath.append("?").append(queryPrefix).append("status").append(querySuffix);
|
||||||
qint32 count = 0;
|
qint32 count = 0;
|
||||||
foreach (QString t, status) {
|
for (QString t : status) {
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
fullPath.append(queryDelimiter);
|
fullPath.append(queryDelimiter);
|
||||||
}
|
}
|
||||||
@ -566,7 +566,7 @@ void PFXPetApi::findPetsByStatus(const QList<QString> &status) {
|
|||||||
else
|
else
|
||||||
fullPath.append("?").append(queryPrefix).append("status").append(querySuffix);
|
fullPath.append("?").append(queryPrefix).append("status").append(querySuffix);
|
||||||
qint32 count = 0;
|
qint32 count = 0;
|
||||||
foreach (QString t, status) {
|
for (QString t : status) {
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
fullPath.append(queryDelimiter);
|
fullPath.append(queryDelimiter);
|
||||||
}
|
}
|
||||||
@ -643,7 +643,7 @@ void PFXPetApi::findPetsByStatusCallback(PFXHttpRequestWorker *worker) {
|
|||||||
QByteArray array(json.toStdString().c_str());
|
QByteArray array(json.toStdString().c_str());
|
||||||
QJsonDocument doc = QJsonDocument::fromJson(array);
|
QJsonDocument doc = QJsonDocument::fromJson(array);
|
||||||
QJsonArray jsonArray = doc.array();
|
QJsonArray jsonArray = doc.array();
|
||||||
foreach (QJsonValue obj, jsonArray) {
|
for (QJsonValue obj : jsonArray) {
|
||||||
PFXPet val;
|
PFXPet val;
|
||||||
::test_namespace::fromJsonValue(val, obj);
|
::test_namespace::fromJsonValue(val, obj);
|
||||||
output.append(val);
|
output.append(val);
|
||||||
@ -685,7 +685,7 @@ void PFXPetApi::findPetsByTags(const QList<QString> &tags) {
|
|||||||
queryDelimiter = getParamStyleDelimiter(queryStyle, "tags", false);
|
queryDelimiter = getParamStyleDelimiter(queryStyle, "tags", false);
|
||||||
if (tags.size() > 0) {
|
if (tags.size() > 0) {
|
||||||
if (QString("csv").indexOf("multi") == 0) {
|
if (QString("csv").indexOf("multi") == 0) {
|
||||||
foreach (QString t, tags) {
|
for (QString t : tags) {
|
||||||
if (fullPath.indexOf("?") > 0)
|
if (fullPath.indexOf("?") > 0)
|
||||||
fullPath.append(queryPrefix);
|
fullPath.append(queryPrefix);
|
||||||
else
|
else
|
||||||
@ -698,7 +698,7 @@ void PFXPetApi::findPetsByTags(const QList<QString> &tags) {
|
|||||||
else
|
else
|
||||||
fullPath.append("?").append(queryPrefix).append("tags").append(querySuffix);
|
fullPath.append("?").append(queryPrefix).append("tags").append(querySuffix);
|
||||||
qint32 count = 0;
|
qint32 count = 0;
|
||||||
foreach (QString t, tags) {
|
for (QString t : tags) {
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
fullPath.append((false)? queryDelimiter : QUrl::toPercentEncoding(queryDelimiter));
|
fullPath.append((false)? queryDelimiter : QUrl::toPercentEncoding(queryDelimiter));
|
||||||
}
|
}
|
||||||
@ -711,7 +711,7 @@ void PFXPetApi::findPetsByTags(const QList<QString> &tags) {
|
|||||||
else
|
else
|
||||||
fullPath.append("?").append(queryPrefix).append("tags").append(querySuffix);
|
fullPath.append("?").append(queryPrefix).append("tags").append(querySuffix);
|
||||||
qint32 count = 0;
|
qint32 count = 0;
|
||||||
foreach (QString t, tags) {
|
for (QString t : tags) {
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
fullPath.append("\t");
|
fullPath.append("\t");
|
||||||
}
|
}
|
||||||
@ -724,7 +724,7 @@ void PFXPetApi::findPetsByTags(const QList<QString> &tags) {
|
|||||||
else
|
else
|
||||||
fullPath.append("?").append(queryPrefix).append("tags").append(querySuffix);
|
fullPath.append("?").append(queryPrefix).append("tags").append(querySuffix);
|
||||||
qint32 count = 0;
|
qint32 count = 0;
|
||||||
foreach (QString t, tags) {
|
for (QString t : tags) {
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
fullPath.append(queryDelimiter);
|
fullPath.append(queryDelimiter);
|
||||||
}
|
}
|
||||||
@ -737,7 +737,7 @@ void PFXPetApi::findPetsByTags(const QList<QString> &tags) {
|
|||||||
else
|
else
|
||||||
fullPath.append("?").append(queryPrefix).append("tags").append(querySuffix);
|
fullPath.append("?").append(queryPrefix).append("tags").append(querySuffix);
|
||||||
qint32 count = 0;
|
qint32 count = 0;
|
||||||
foreach (QString t, tags) {
|
for (QString t : tags) {
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
fullPath.append(queryDelimiter);
|
fullPath.append(queryDelimiter);
|
||||||
}
|
}
|
||||||
@ -750,7 +750,7 @@ void PFXPetApi::findPetsByTags(const QList<QString> &tags) {
|
|||||||
else
|
else
|
||||||
fullPath.append("?").append(queryPrefix).append("tags").append(querySuffix);
|
fullPath.append("?").append(queryPrefix).append("tags").append(querySuffix);
|
||||||
qint32 count = 0;
|
qint32 count = 0;
|
||||||
foreach (QString t, tags) {
|
for (QString t : tags) {
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
fullPath.append(queryDelimiter);
|
fullPath.append(queryDelimiter);
|
||||||
}
|
}
|
||||||
@ -827,7 +827,7 @@ void PFXPetApi::findPetsByTagsCallback(PFXHttpRequestWorker *worker) {
|
|||||||
QByteArray array(json.toStdString().c_str());
|
QByteArray array(json.toStdString().c_str());
|
||||||
QJsonDocument doc = QJsonDocument::fromJson(array);
|
QJsonDocument doc = QJsonDocument::fromJson(array);
|
||||||
QJsonArray jsonArray = doc.array();
|
QJsonArray jsonArray = doc.array();
|
||||||
foreach (QJsonValue obj, jsonArray) {
|
for (QJsonValue obj : jsonArray) {
|
||||||
PFXPet val;
|
PFXPet val;
|
||||||
::test_namespace::fromJsonValue(val, obj);
|
::test_namespace::fromJsonValue(val, obj);
|
||||||
output.append(val);
|
output.append(val);
|
||||||
|
@ -59,7 +59,7 @@ void PFXPrimitivesApi::setServerIndex(const QString &operation, int serverIndex)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PFXPrimitivesApi::setApiKey(const QString &apiKeyName, const QString &apiKey) {
|
void PFXPrimitivesApi::setApiKey(const QString &apiKeyName, const QString &apiKey) {
|
||||||
_apiKeys.insert(apiKeyName,apiKey);
|
_apiKeys.insert(apiKeyName, apiKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PFXPrimitivesApi::setBearerToken(const QString &token) {
|
void PFXPrimitivesApi::setBearerToken(const QString &token) {
|
||||||
|
@ -63,7 +63,7 @@ void PFXStoreApi::setServerIndex(const QString &operation, int serverIndex) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PFXStoreApi::setApiKey(const QString &apiKeyName, const QString &apiKey) {
|
void PFXStoreApi::setApiKey(const QString &apiKeyName, const QString &apiKey) {
|
||||||
_apiKeys.insert(apiKeyName,apiKey);
|
_apiKeys.insert(apiKeyName, apiKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PFXStoreApi::setBearerToken(const QString &token) {
|
void PFXStoreApi::setBearerToken(const QString &token) {
|
||||||
@ -326,7 +326,7 @@ void PFXStoreApi::getInventoryCallback(PFXHttpRequestWorker *worker) {
|
|||||||
QByteArray array(json.toStdString().c_str());
|
QByteArray array(json.toStdString().c_str());
|
||||||
QJsonDocument doc = QJsonDocument::fromJson(array);
|
QJsonDocument doc = QJsonDocument::fromJson(array);
|
||||||
QJsonObject obj = doc.object();
|
QJsonObject obj = doc.object();
|
||||||
foreach (QString key, obj.keys()) {
|
for (QString key : obj.keys()) {
|
||||||
qint32 val;
|
qint32 val;
|
||||||
::test_namespace::fromJsonValue(val, obj[key]);
|
::test_namespace::fromJsonValue(val, obj[key]);
|
||||||
output.insert(key, val);
|
output.insert(key, val);
|
||||||
|
@ -71,7 +71,7 @@ void PFXUserApi::setServerIndex(const QString &operation, int serverIndex) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PFXUserApi::setApiKey(const QString &apiKeyName, const QString &apiKey) {
|
void PFXUserApi::setApiKey(const QString &apiKeyName, const QString &apiKey) {
|
||||||
_apiKeys.insert(apiKeyName,apiKey);
|
_apiKeys.insert(apiKeyName, apiKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PFXUserApi::setBearerToken(const QString &token) {
|
void PFXUserApi::setBearerToken(const QString &token) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user