forked from loafle/openapi-generator-original
[QT5] Support optional params using QVariant (#8733)
Use QVariant for optional parameters
This commit is contained in:
parent
d31875f505
commit
89b9802be3
@ -227,7 +227,7 @@ QString {{classname}}::getParamStyleDelimiter(QString style, QString name, bool
|
||||
|
||||
{{#operations}}
|
||||
{{#operation}}
|
||||
void {{classname}}::{{nickname}}({{#allParams}}const {{{dataType}}} &{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) {
|
||||
void {{classname}}::{{nickname}}({{#allParams}}{{#required}}const {{{dataType}}} &{{/required}}{{^required}}const QVariant &{{/required}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) {
|
||||
QString fullPath = QString(_serverConfigs["{{nickname}}"][_serverIndices.value("{{nickname}}")].URL()+"{{{path}}}");
|
||||
{{#authMethods}}{{#isApiKey}}{{#isKeyInHeader}}
|
||||
if(_apiKeys.contains("{{name}}")){
|
||||
@ -250,7 +250,10 @@ void {{classname}}::{{nickname}}({{#allParams}}const {{{dataType}}} &{{paramName
|
||||
b64.append(_username.toUtf8() + ":" + _password.toUtf8());
|
||||
addHeaders("Authorization","Basic " + b64.toBase64());
|
||||
}{{/isBasicBasic}}{{/authMethods}}
|
||||
|
||||
{{#pathParams}}
|
||||
{{^required}}if(!{{paramName}}.isNull()){{/required}}
|
||||
{
|
||||
QString {{paramName}}PathParam("{");
|
||||
{{paramName}}PathParam.append("{{baseName}}").append("}");
|
||||
QString pathPrefix, pathSuffix, pathDelimiter;
|
||||
@ -263,7 +266,7 @@ void {{classname}}::{{nickname}}({{#allParams}}const {{{dataType}}} &{{paramName
|
||||
{{^collectionFormat}}
|
||||
{{^isPrimitiveType}}
|
||||
QString paramString = (pathStyle == "matrix" && {{isExplode}}) ? pathPrefix : pathPrefix+"{{baseName}}"+pathSuffix;
|
||||
QJsonObject parameter = {{paramName}}.asJsonObject();
|
||||
QJsonObject parameter = {{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}.asJsonObject();
|
||||
qint32 count = 0;
|
||||
foreach(const QString& key, parameter.keys()) {
|
||||
if (count > 0) {
|
||||
@ -307,12 +310,14 @@ void {{classname}}::{{nickname}}({{#allParams}}const {{{dataType}}} &{{paramName
|
||||
{{/isPrimitiveType}}
|
||||
{{#isPrimitiveType}}
|
||||
QString paramString = (pathStyle == "matrix") ? pathPrefix+"{{baseName}}"+pathSuffix : pathPrefix;
|
||||
fullPath.replace({{paramName}}PathParam, paramString+QUrl::toPercentEncoding(::{{cppNamespace}}::toStringValue({{paramName}})));
|
||||
{{/isPrimitiveType}}{{/collectionFormat}}{{#collectionFormat}}
|
||||
if ({{{paramName}}}.size() > 0) {
|
||||
fullPath.replace({{paramName}}PathParam, paramString+QUrl::toPercentEncoding(::{{cppNamespace}}::toStringValue({{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}})));
|
||||
{{/isPrimitiveType}}
|
||||
{{/collectionFormat}}
|
||||
{{#collectionFormat}}
|
||||
if ({{{paramName}}}{{^required}}.value<{{{dataType}}}>(){{/required}}.size() > 0) {
|
||||
QString paramString = (pathStyle == "matrix") ? pathPrefix+"{{baseName}}"+pathSuffix : pathPrefix;
|
||||
qint32 count = 0;
|
||||
foreach ({{{baseType}}} t, {{paramName}}) {
|
||||
foreach ({{{baseType}}} t, {{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}) {
|
||||
if (count > 0) {
|
||||
fullPath.append(pathDelimiter);
|
||||
}
|
||||
@ -321,11 +326,16 @@ void {{classname}}::{{nickname}}({{#allParams}}const {{{dataType}}} &{{paramName
|
||||
}
|
||||
fullPath.replace({{paramName}}PathParam, paramString);
|
||||
}
|
||||
{{/collectionFormat}}{{/pathParams}}
|
||||
{{/collectionFormat}}
|
||||
}
|
||||
|
||||
{{/pathParams}}
|
||||
{{#hasQueryParams}}
|
||||
QString queryPrefix, querySuffix, queryDelimiter, queryStyle;
|
||||
{{/hasQueryParams}}
|
||||
{{#queryParams}}
|
||||
{{^required}}if(!{{paramName}}.isNull()){{/required}}
|
||||
{
|
||||
queryStyle = "{{style}}";
|
||||
if(queryStyle == "")
|
||||
queryStyle = "form";
|
||||
@ -339,7 +349,7 @@ void {{classname}}::{{nickname}}({{#allParams}}const {{{dataType}}} &{{paramName
|
||||
fullPath.append("?");
|
||||
{{^isPrimitiveType}}
|
||||
QString paramString = (queryStyle == "form" && {{isExplode}}) ? "" : (queryStyle == "form" && !({{isExplode}})) ? "{{baseName}}"+querySuffix : "";
|
||||
QJsonObject parameter = {{paramName}}.asJsonObject();
|
||||
QJsonObject parameter = {{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}.asJsonObject();
|
||||
qint32 count = 0;
|
||||
foreach(const QString& key, parameter.keys()) {
|
||||
if (count > 0) {
|
||||
@ -385,11 +395,13 @@ void {{classname}}::{{nickname}}({{#allParams}}const {{{dataType}}} &{{paramName
|
||||
}
|
||||
fullPath.append(paramString);
|
||||
{{/isPrimitiveType}}{{#isPrimitiveType}}
|
||||
fullPath.append(QUrl::toPercentEncoding("{{baseName}}")).append(querySuffix).append(QUrl::toPercentEncoding(::{{cppNamespace}}::toStringValue({{paramName}})));
|
||||
{{/isPrimitiveType}}{{/collectionFormat}}{{#collectionFormat}}
|
||||
if ({{{paramName}}}.size() > 0) {
|
||||
fullPath.append(QUrl::toPercentEncoding("{{baseName}}")).append(querySuffix).append(QUrl::toPercentEncoding(::{{cppNamespace}}::toStringValue({{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}})));
|
||||
{{/isPrimitiveType}}
|
||||
{{/collectionFormat}}
|
||||
{{#collectionFormat}}
|
||||
if ({{{paramName}}}{{^required}}.value<{{{dataType}}}>(){{/required}}.size() > 0) {
|
||||
if (QString("{{collectionFormat}}").indexOf("multi") == 0) {
|
||||
foreach ({{{baseType}}} t, {{paramName}}) {
|
||||
foreach ({{{baseType}}} t, {{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}) {
|
||||
if (fullPath.indexOf("?") > 0)
|
||||
fullPath.append(queryPrefix);
|
||||
else
|
||||
@ -402,7 +414,7 @@ void {{classname}}::{{nickname}}({{#allParams}}const {{{dataType}}} &{{paramName
|
||||
else
|
||||
fullPath.append("?").append(queryPrefix).append("{{baseName}}").append(querySuffix);
|
||||
qint32 count = 0;
|
||||
foreach ({{{baseType}}} t, {{paramName}}) {
|
||||
foreach ({{{baseType}}} t, {{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}) {
|
||||
if (count > 0) {
|
||||
fullPath.append(({{isExplode}})? queryDelimiter : QUrl::toPercentEncoding(queryDelimiter));
|
||||
}
|
||||
@ -415,7 +427,7 @@ void {{classname}}::{{nickname}}({{#allParams}}const {{{dataType}}} &{{paramName
|
||||
else
|
||||
fullPath.append("?").append(queryPrefix).append("{{baseName}}").append(querySuffix);
|
||||
qint32 count = 0;
|
||||
foreach ({{{baseType}}} t, {{paramName}}) {
|
||||
foreach ({{{baseType}}} t, {{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}) {
|
||||
if (count > 0) {
|
||||
fullPath.append("\t");
|
||||
}
|
||||
@ -428,7 +440,7 @@ void {{classname}}::{{nickname}}({{#allParams}}const {{{dataType}}} &{{paramName
|
||||
else
|
||||
fullPath.append("?").append(queryPrefix).append("{{baseName}}").append(querySuffix);
|
||||
qint32 count = 0;
|
||||
foreach ({{{baseType}}} t, {{paramName}}) {
|
||||
foreach ({{{baseType}}} t, {{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}) {
|
||||
if (count > 0) {
|
||||
fullPath.append(queryDelimiter);
|
||||
}
|
||||
@ -441,7 +453,7 @@ void {{classname}}::{{nickname}}({{#allParams}}const {{{dataType}}} &{{paramName
|
||||
else
|
||||
fullPath.append("?").append(queryPrefix).append("{{baseName}}").append(querySuffix);
|
||||
qint32 count = 0;
|
||||
foreach ({{{baseType}}} t, {{paramName}}) {
|
||||
foreach ({{{baseType}}} t, {{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}) {
|
||||
if (count > 0) {
|
||||
fullPath.append(queryDelimiter);
|
||||
}
|
||||
@ -454,7 +466,7 @@ void {{classname}}::{{nickname}}({{#allParams}}const {{{dataType}}} &{{paramName
|
||||
else
|
||||
fullPath.append("?").append(queryPrefix).append("{{baseName}}").append(querySuffix);
|
||||
qint32 count = 0;
|
||||
foreach ({{{baseType}}} t, {{paramName}}) {
|
||||
foreach ({{{baseType}}} t, {{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}) {
|
||||
if (count > 0) {
|
||||
fullPath.append(queryDelimiter);
|
||||
}
|
||||
@ -463,7 +475,10 @@ void {{classname}}::{{nickname}}({{#allParams}}const {{{dataType}}} &{{paramName
|
||||
}
|
||||
}
|
||||
}
|
||||
{{/collectionFormat}}{{/queryParams}}
|
||||
{{/collectionFormat}}
|
||||
}
|
||||
|
||||
{{/queryParams}}
|
||||
{{prefix}}HttpRequestWorker *worker = new {{prefix}}HttpRequestWorker(this, _manager);
|
||||
worker->setTimeOut(_timeOut);
|
||||
worker->setWorkingDirectory(_workingDirectory);{{#contentCompression}}
|
||||
@ -481,22 +496,39 @@ void {{classname}}::{{nickname}}({{#allParams}}const {{{dataType}}} &{{paramName
|
||||
formSuffix = getParamStyleSuffix(formStyle);
|
||||
formDelimiter = getParamStyleDelimiter(formStyle, "{{baseName}}", {{isExplode}});
|
||||
{{/first}}
|
||||
|
||||
{{^required}}if(!{{paramName}}.isNull()){{/required}}
|
||||
{
|
||||
{{^isFile}}
|
||||
input.add_var("{{baseName}}", ::{{cppNamespace}}::toStringValue({{paramName}}));{{/isFile}}{{#isFile}}
|
||||
input.add_file("{{baseName}}", {{paramName}}.local_filename, {{paramName}}.request_filename, {{paramName}}.mime_type);{{/isFile}}{{/formParams}}{{#bodyParams}}{{#isContainer}}{{#isArray}}
|
||||
QJsonDocument doc(::{{cppNamespace}}::toJsonValue({{paramName}}).toArray());{{/isArray}}{{#isMap}}
|
||||
QJsonDocument doc(::{{cppNamespace}}::toJsonValue({{paramName}}).toObject());{{/isMap}}
|
||||
input.add_var("{{baseName}}", ::{{cppNamespace}}::toStringValue({{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}));
|
||||
{{/isFile}}
|
||||
{{#isFile}}
|
||||
input.add_file("{{baseName}}", {{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}.local_filename, {{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}.request_filename, {{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}.mime_type);
|
||||
{{/isFile}}
|
||||
}
|
||||
|
||||
{{/formParams}}
|
||||
{{#bodyParams}}
|
||||
{{#isContainer}}
|
||||
{{#isArray}}
|
||||
QJsonDocument doc(::{{cppNamespace}}::toJsonValue({{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}).toArray());{{/isArray}}{{#isMap}}
|
||||
QJsonDocument doc(::{{cppNamespace}}::toJsonValue({{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}).toObject());{{/isMap}}
|
||||
QByteArray bytes = doc.toJson();
|
||||
input.request_body.append(bytes);
|
||||
{{/isContainer}}{{^isContainer}}{{#isString}}
|
||||
QByteArray output = {{paramName}}.toUtf8();{{/isString}}{{#isByteArray}}QByteArray output({{paramName}});{{/isByteArray}}{{^isString}}{{^isByteArray}}{{^isFile}}
|
||||
QByteArray output = {{paramName}}.asJson().toUtf8();{{/isFile}}{{/isByteArray}}{{/isString}}{{#isFile}}{{#hasConsumes}}input.headers.insert("Content-Type", {{#consumes}}{{^-first}}, {{/-first}}"{{mediaType}}"{{/consumes}});{{/hasConsumes}}
|
||||
QByteArray output = {{paramName}}.asByteArray();{{/isFile}}
|
||||
QByteArray output = {{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}.toUtf8();{{/isString}}{{#isByteArray}}QByteArray output({{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}});{{/isByteArray}}{{^isString}}{{^isByteArray}}{{^isFile}}
|
||||
QByteArray output = {{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}.asJson().toUtf8();{{/isFile}}{{/isByteArray}}{{/isString}}{{#isFile}}{{#hasConsumes}}input.headers.insert("Content-Type", {{#consumes}}{{^-first}}, {{/-first}}"{{mediaType}}"{{/consumes}});{{/hasConsumes}}
|
||||
QByteArray output = {{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}.asByteArray();{{/isFile}}
|
||||
input.request_body.append(output);
|
||||
{{/isContainer}}{{/bodyParams}}{{#headerParams}}
|
||||
{{^collectionFormat}}{{^isPrimitiveType}}
|
||||
{{/isContainer}}
|
||||
{{/bodyParams}}
|
||||
{{#headerParams}}
|
||||
{{^required}}if(!{{paramName}}.isNull()){{/required}}
|
||||
{
|
||||
{{^collectionFormat}}
|
||||
{{^isPrimitiveType}}
|
||||
QString headerString;
|
||||
QJsonObject parameter = {{paramName}}.asJsonObject();
|
||||
QJsonObject parameter = {{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}.asJsonObject();
|
||||
qint32 count = 0;
|
||||
foreach(const QString& key, parameter.keys()) {
|
||||
if (count > 0) {
|
||||
@ -536,15 +568,16 @@ void {{classname}}::{{nickname}}({{#allParams}}const {{{dataType}}} &{{paramName
|
||||
count++;
|
||||
}
|
||||
input.headers.insert("{{baseName}}", headerString);
|
||||
{{/isPrimitiveType}}{{#isPrimitiveType}}
|
||||
if (!::{{cppNamespace}}::toStringValue({{paramName}}).isEmpty()) {
|
||||
input.headers.insert("{{baseName}}", ::{{cppNamespace}}::toStringValue({{paramName}}));
|
||||
{{/isPrimitiveType}}
|
||||
{{#isPrimitiveType}}
|
||||
if (!::{{cppNamespace}}::toStringValue({{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}).isEmpty()) {
|
||||
input.headers.insert("{{baseName}}", ::{{cppNamespace}}::toStringValue({{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}));
|
||||
}
|
||||
{{/isPrimitiveType}}{{/collectionFormat}}{{#collectionFormat}}
|
||||
QString headerString;
|
||||
if ({{{paramName}}}.size() > 0) {
|
||||
if ({{{paramName}}}{{^required}}.value<{{{dataType}}}>(){{/required}}.size() > 0) {
|
||||
qint32 count = 0;
|
||||
foreach ({{{baseType}}} t, {{paramName}}) {
|
||||
foreach ({{{baseType}}} t, {{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}) {
|
||||
if (count > 0) {
|
||||
headerString.append(",");
|
||||
}
|
||||
@ -554,12 +587,17 @@ void {{classname}}::{{nickname}}({{#allParams}}const {{{dataType}}} &{{paramName
|
||||
input.headers.insert("{{baseName}}", headerString);
|
||||
}
|
||||
{{/collectionFormat}}
|
||||
}
|
||||
{{/headerParams}}
|
||||
{{#cookieParams}}
|
||||
{{^required}}if(!{{paramName}}.isNull()){{/required}}
|
||||
{
|
||||
if(QString("{{style}}").indexOf("form") == 0){
|
||||
{{^collectionFormat}}{{^isPrimitiveType}}{{^isExplode}}
|
||||
{{^collectionFormat}}
|
||||
{{^isPrimitiveType}}
|
||||
{{^isExplode}}
|
||||
QString cookieString = "{{baseName}}=";
|
||||
QJsonObject parameter = {{paramName}}.asJsonObject();
|
||||
QJsonObject parameter = {{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}.asJsonObject();
|
||||
qint32 count = 0;
|
||||
foreach(const QString& key, parameter.keys()) {
|
||||
if (count > 0) {
|
||||
@ -598,15 +636,20 @@ if(QString("{{style}}").indexOf("form") == 0){
|
||||
count++;
|
||||
}
|
||||
input.headers.insert("Cookie", cookieString);
|
||||
{{/isExplode}}{{/isPrimitiveType}}{{#isPrimitiveType}}
|
||||
if (!::{{cppNamespace}}::toStringValue({{paramName}}).isEmpty()) {
|
||||
input.headers.insert("Cookie", "{{baseName}}="+::{{cppNamespace}}::toStringValue({{paramName}}));
|
||||
{{/isExplode}}
|
||||
{{/isPrimitiveType}}
|
||||
{{#isPrimitiveType}}
|
||||
if (!::{{cppNamespace}}::toStringValue({{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}).isEmpty()) {
|
||||
input.headers.insert("Cookie", "{{baseName}}="+::{{cppNamespace}}::toStringValue({{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}));
|
||||
}
|
||||
{{/isPrimitiveType}}{{/collectionFormat}}{{#collectionFormat}}{{^isExplode}}
|
||||
{{/isPrimitiveType}}
|
||||
{{/collectionFormat}}
|
||||
{{#collectionFormat}}
|
||||
{{^isExplode}}
|
||||
QString cookieString = "{{baseName}}=";
|
||||
if ({{{paramName}}}.size() > 0) {
|
||||
qint32 count = 0;
|
||||
foreach ({{{baseType}}} t, {{paramName}}) {
|
||||
foreach ({{{baseType}}} t, {{paramName}}{{^required}}.value<{{{dataType}}}>(){{/required}}) {
|
||||
if (count > 0) {
|
||||
cookieString.append(",");
|
||||
}
|
||||
@ -617,6 +660,7 @@ if(QString("{{style}}").indexOf("form") == 0){
|
||||
}
|
||||
{{/isExplode}}{{/collectionFormat}}
|
||||
}
|
||||
}
|
||||
{{/cookieParams}}
|
||||
foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); }
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include <QStringList>
|
||||
#include <QList>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QVariant>
|
||||
|
||||
{{#cppNamespaceDeclarations}}
|
||||
namespace {{this}} {
|
||||
@ -46,7 +47,18 @@ public:
|
||||
QString getParamStyleSuffix(QString style);
|
||||
QString getParamStyleDelimiter(QString style, QString name, bool isExplode);
|
||||
{{#operations}}{{#operation}}
|
||||
{{#isDeprecated}}Q_DECL_DEPRECATED {{/isDeprecated}}void {{nickname}}({{#allParams}}const {{{dataType}}} &{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});{{/operation}}{{/operations}}
|
||||
{{#hasParams}} /**
|
||||
{{#allParams}}
|
||||
{{#required}}
|
||||
* @param[in] {{paramName}} {{{dataType}}} [required]
|
||||
{{/required}}
|
||||
{{^required}}
|
||||
* @param[in] {{paramName}} {{{dataType}}} [optional]
|
||||
{{/required}}
|
||||
{{/allParams}}
|
||||
*/{{/hasParams}}
|
||||
{{#isDeprecated}}Q_DECL_DEPRECATED {{/isDeprecated}}void {{nickname}}({{#allParams}}{{#required}}const {{{dataType}}} &{{/required}}{{^required}}const QVariant &{{/required}}{{paramName}}{{^required}} = QVariant(){{/required}}{{^-last}}, {{/-last}}{{/allParams}});
|
||||
{{/operation}}{{/operations}}
|
||||
|
||||
private:
|
||||
QMap<QString,int> _serverIndices;
|
||||
|
@ -235,7 +235,7 @@ void PetApiTests::updatePetWithFormTest() {
|
||||
});
|
||||
|
||||
QString name("gorilla");
|
||||
api.updatePetWithForm(id, name, nullptr);
|
||||
api.updatePetWithForm(id, name);
|
||||
QTimer::singleShot(5000, &loop, &QEventLoop::quit);
|
||||
loop.exec();
|
||||
QVERIFY2(petUpdated, "didn't finish within timeout");
|
||||
|
@ -235,7 +235,6 @@ void PFXPetApi::addPet(const PFXPet &body) {
|
||||
QString fullPath = QString(_serverConfigs["addPet"][_serverIndices.value("addPet")].URL()+"/pet");
|
||||
|
||||
|
||||
|
||||
PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this, _manager);
|
||||
worker->setTimeOut(_timeOut);
|
||||
worker->setWorkingDirectory(_workingDirectory);
|
||||
@ -273,9 +272,12 @@ void PFXPetApi::addPetCallback(PFXHttpRequestWorker *worker) {
|
||||
}
|
||||
}
|
||||
|
||||
void PFXPetApi::deletePet(const qint64 &pet_id, const QString &api_key) {
|
||||
void PFXPetApi::deletePet(const qint64 &pet_id, const QVariant &api_key) {
|
||||
QString fullPath = QString(_serverConfigs["deletePet"][_serverIndices.value("deletePet")].URL()+"/pet/{petId}");
|
||||
|
||||
|
||||
|
||||
{
|
||||
QString pet_idPathParam("{");
|
||||
pet_idPathParam.append("petId").append("}");
|
||||
QString pathPrefix, pathSuffix, pathDelimiter;
|
||||
@ -287,17 +289,18 @@ void PFXPetApi::deletePet(const qint64 &pet_id, const QString &api_key) {
|
||||
pathDelimiter = getParamStyleDelimiter(pathStyle, "petId", false);
|
||||
QString paramString = (pathStyle == "matrix") ? pathPrefix+"petId"+pathSuffix : pathPrefix;
|
||||
fullPath.replace(pet_idPathParam, paramString+QUrl::toPercentEncoding(::test_namespace::toStringValue(pet_id)));
|
||||
|
||||
}
|
||||
|
||||
PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this, _manager);
|
||||
worker->setTimeOut(_timeOut);
|
||||
worker->setWorkingDirectory(_workingDirectory);
|
||||
PFXHttpRequestInput input(fullPath, "DELETE");
|
||||
|
||||
|
||||
|
||||
if (!::test_namespace::toStringValue(api_key).isEmpty()) {
|
||||
input.headers.insert("api_key", ::test_namespace::toStringValue(api_key));
|
||||
if(!api_key.isNull())
|
||||
{
|
||||
if (!::test_namespace::toStringValue(api_key.value<QString>()).isEmpty()) {
|
||||
input.headers.insert("api_key", ::test_namespace::toStringValue(api_key.value<QString>()));
|
||||
}
|
||||
}
|
||||
foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); }
|
||||
|
||||
@ -333,13 +336,14 @@ void PFXPetApi::findPetsByStatus(const QList<QString> &status) {
|
||||
|
||||
|
||||
QString queryPrefix, querySuffix, queryDelimiter, queryStyle;
|
||||
|
||||
{
|
||||
queryStyle = "form";
|
||||
if(queryStyle == "")
|
||||
queryStyle = "form";
|
||||
queryPrefix = getParamStylePrefix(queryStyle);
|
||||
querySuffix = getParamStyleSuffix(queryStyle);
|
||||
queryDelimiter = getParamStyleDelimiter(queryStyle, "status", false);
|
||||
|
||||
if (status.size() > 0) {
|
||||
if (QString("csv").indexOf("multi") == 0) {
|
||||
foreach (QString t, status) {
|
||||
@ -416,6 +420,7 @@ void PFXPetApi::findPetsByStatus(const QList<QString> &status) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this, _manager);
|
||||
worker->setTimeOut(_timeOut);
|
||||
@ -466,13 +471,14 @@ void PFXPetApi::findPetsByTags(const QList<QString> &tags) {
|
||||
|
||||
|
||||
QString queryPrefix, querySuffix, queryDelimiter, queryStyle;
|
||||
|
||||
{
|
||||
queryStyle = "form";
|
||||
if(queryStyle == "")
|
||||
queryStyle = "form";
|
||||
queryPrefix = getParamStylePrefix(queryStyle);
|
||||
querySuffix = getParamStyleSuffix(queryStyle);
|
||||
queryDelimiter = getParamStyleDelimiter(queryStyle, "tags", false);
|
||||
|
||||
if (tags.size() > 0) {
|
||||
if (QString("csv").indexOf("multi") == 0) {
|
||||
foreach (QString t, tags) {
|
||||
@ -549,6 +555,7 @@ void PFXPetApi::findPetsByTags(const QList<QString> &tags) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this, _manager);
|
||||
worker->setTimeOut(_timeOut);
|
||||
@ -601,6 +608,9 @@ void PFXPetApi::getPetById(const qint64 &pet_id) {
|
||||
addHeaders("api_key",_apiKeys.find("api_key").value());
|
||||
}
|
||||
|
||||
|
||||
|
||||
{
|
||||
QString pet_idPathParam("{");
|
||||
pet_idPathParam.append("petId").append("}");
|
||||
QString pathPrefix, pathSuffix, pathDelimiter;
|
||||
@ -612,7 +622,7 @@ void PFXPetApi::getPetById(const qint64 &pet_id) {
|
||||
pathDelimiter = getParamStyleDelimiter(pathStyle, "petId", false);
|
||||
QString paramString = (pathStyle == "matrix") ? pathPrefix+"petId"+pathSuffix : pathPrefix;
|
||||
fullPath.replace(pet_idPathParam, paramString+QUrl::toPercentEncoding(::test_namespace::toStringValue(pet_id)));
|
||||
|
||||
}
|
||||
|
||||
PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this, _manager);
|
||||
worker->setTimeOut(_timeOut);
|
||||
@ -653,7 +663,6 @@ void PFXPetApi::updatePet(const PFXPet &body) {
|
||||
QString fullPath = QString(_serverConfigs["updatePet"][_serverIndices.value("updatePet")].URL()+"/pet");
|
||||
|
||||
|
||||
|
||||
PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this, _manager);
|
||||
worker->setTimeOut(_timeOut);
|
||||
worker->setWorkingDirectory(_workingDirectory);
|
||||
@ -691,9 +700,12 @@ void PFXPetApi::updatePetCallback(PFXHttpRequestWorker *worker) {
|
||||
}
|
||||
}
|
||||
|
||||
void PFXPetApi::updatePetWithForm(const qint64 &pet_id, const QString &name, const QString &status) {
|
||||
void PFXPetApi::updatePetWithForm(const qint64 &pet_id, const QVariant &name, const QVariant &status) {
|
||||
QString fullPath = QString(_serverConfigs["updatePetWithForm"][_serverIndices.value("updatePetWithForm")].URL()+"/pet/{petId}");
|
||||
|
||||
|
||||
|
||||
{
|
||||
QString pet_idPathParam("{");
|
||||
pet_idPathParam.append("petId").append("}");
|
||||
QString pathPrefix, pathSuffix, pathDelimiter;
|
||||
@ -705,14 +717,26 @@ void PFXPetApi::updatePetWithForm(const qint64 &pet_id, const QString &name, con
|
||||
pathDelimiter = getParamStyleDelimiter(pathStyle, "petId", false);
|
||||
QString paramString = (pathStyle == "matrix") ? pathPrefix+"petId"+pathSuffix : pathPrefix;
|
||||
fullPath.replace(pet_idPathParam, paramString+QUrl::toPercentEncoding(::test_namespace::toStringValue(pet_id)));
|
||||
|
||||
}
|
||||
|
||||
PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this, _manager);
|
||||
worker->setTimeOut(_timeOut);
|
||||
worker->setWorkingDirectory(_workingDirectory);
|
||||
PFXHttpRequestInput input(fullPath, "POST");
|
||||
|
||||
input.add_var("name", ::test_namespace::toStringValue(name)); input.add_var("status", ::test_namespace::toStringValue(status)); foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); }
|
||||
|
||||
if(!name.isNull())
|
||||
{
|
||||
input.add_var("name", ::test_namespace::toStringValue(name.value<QString>()));
|
||||
}
|
||||
|
||||
|
||||
if(!status.isNull())
|
||||
{
|
||||
input.add_var("status", ::test_namespace::toStringValue(status.value<QString>()));
|
||||
}
|
||||
|
||||
foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); }
|
||||
|
||||
connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::updatePetWithFormCallback);
|
||||
connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater);
|
||||
@ -741,9 +765,12 @@ void PFXPetApi::updatePetWithFormCallback(PFXHttpRequestWorker *worker) {
|
||||
}
|
||||
}
|
||||
|
||||
void PFXPetApi::uploadFile(const qint64 &pet_id, const QString &additional_metadata, const PFXHttpFileElement &file) {
|
||||
void PFXPetApi::uploadFile(const qint64 &pet_id, const QVariant &additional_metadata, const QVariant &file) {
|
||||
QString fullPath = QString(_serverConfigs["uploadFile"][_serverIndices.value("uploadFile")].URL()+"/pet/{petId}/uploadImage");
|
||||
|
||||
|
||||
|
||||
{
|
||||
QString pet_idPathParam("{");
|
||||
pet_idPathParam.append("petId").append("}");
|
||||
QString pathPrefix, pathSuffix, pathDelimiter;
|
||||
@ -755,15 +782,26 @@ void PFXPetApi::uploadFile(const qint64 &pet_id, const QString &additional_metad
|
||||
pathDelimiter = getParamStyleDelimiter(pathStyle, "petId", false);
|
||||
QString paramString = (pathStyle == "matrix") ? pathPrefix+"petId"+pathSuffix : pathPrefix;
|
||||
fullPath.replace(pet_idPathParam, paramString+QUrl::toPercentEncoding(::test_namespace::toStringValue(pet_id)));
|
||||
|
||||
}
|
||||
|
||||
PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this, _manager);
|
||||
worker->setTimeOut(_timeOut);
|
||||
worker->setWorkingDirectory(_workingDirectory);
|
||||
PFXHttpRequestInput input(fullPath, "POST");
|
||||
|
||||
input.add_var("additionalMetadata", ::test_namespace::toStringValue(additional_metadata));
|
||||
input.add_file("file", file.local_filename, file.request_filename, file.mime_type); foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); }
|
||||
|
||||
if(!additional_metadata.isNull())
|
||||
{
|
||||
input.add_var("additionalMetadata", ::test_namespace::toStringValue(additional_metadata.value<QString>()));
|
||||
}
|
||||
|
||||
|
||||
if(!file.isNull())
|
||||
{
|
||||
input.add_file("file", file.value<PFXHttpFileElement>().local_filename, file.value<PFXHttpFileElement>().request_filename, file.value<PFXHttpFileElement>().mime_type);
|
||||
}
|
||||
|
||||
foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); }
|
||||
|
||||
connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::uploadFileCallback);
|
||||
connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater);
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <QStringList>
|
||||
#include <QList>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QVariant>
|
||||
|
||||
namespace test_namespace {
|
||||
|
||||
@ -56,14 +57,51 @@ public:
|
||||
QString getParamStyleSuffix(QString style);
|
||||
QString getParamStyleDelimiter(QString style, QString name, bool isExplode);
|
||||
|
||||
/**
|
||||
* @param[in] body PFXPet [required]
|
||||
*/
|
||||
void addPet(const PFXPet &body);
|
||||
void deletePet(const qint64 &pet_id, const QString &api_key);
|
||||
|
||||
/**
|
||||
* @param[in] pet_id qint64 [required]
|
||||
* @param[in] api_key QString [optional]
|
||||
*/
|
||||
void deletePet(const qint64 &pet_id, const QVariant &api_key = QVariant());
|
||||
|
||||
/**
|
||||
* @param[in] status QList<QString> [required]
|
||||
*/
|
||||
void findPetsByStatus(const QList<QString> &status);
|
||||
|
||||
/**
|
||||
* @param[in] tags QList<QString> [required]
|
||||
*/
|
||||
Q_DECL_DEPRECATED void findPetsByTags(const QList<QString> &tags);
|
||||
|
||||
/**
|
||||
* @param[in] pet_id qint64 [required]
|
||||
*/
|
||||
void getPetById(const qint64 &pet_id);
|
||||
|
||||
/**
|
||||
* @param[in] body PFXPet [required]
|
||||
*/
|
||||
void updatePet(const PFXPet &body);
|
||||
void updatePetWithForm(const qint64 &pet_id, const QString &name, const QString &status);
|
||||
void uploadFile(const qint64 &pet_id, const QString &additional_metadata, const PFXHttpFileElement &file);
|
||||
|
||||
/**
|
||||
* @param[in] pet_id qint64 [required]
|
||||
* @param[in] name QString [optional]
|
||||
* @param[in] status QString [optional]
|
||||
*/
|
||||
void updatePetWithForm(const qint64 &pet_id, const QVariant &name = QVariant(), const QVariant &status = QVariant());
|
||||
|
||||
/**
|
||||
* @param[in] pet_id qint64 [required]
|
||||
* @param[in] additional_metadata QString [optional]
|
||||
* @param[in] file PFXHttpFileElement [optional]
|
||||
*/
|
||||
void uploadFile(const qint64 &pet_id, const QVariant &additional_metadata = QVariant(), const QVariant &file = QVariant());
|
||||
|
||||
|
||||
private:
|
||||
QMap<QString,int> _serverIndices;
|
||||
|
@ -222,6 +222,9 @@ QString PFXStoreApi::getParamStyleDelimiter(QString style, QString name, bool is
|
||||
void PFXStoreApi::deleteOrder(const QString &order_id) {
|
||||
QString fullPath = QString(_serverConfigs["deleteOrder"][_serverIndices.value("deleteOrder")].URL()+"/store/order/{orderId}");
|
||||
|
||||
|
||||
|
||||
{
|
||||
QString order_idPathParam("{");
|
||||
order_idPathParam.append("orderId").append("}");
|
||||
QString pathPrefix, pathSuffix, pathDelimiter;
|
||||
@ -233,7 +236,7 @@ void PFXStoreApi::deleteOrder(const QString &order_id) {
|
||||
pathDelimiter = getParamStyleDelimiter(pathStyle, "orderId", false);
|
||||
QString paramString = (pathStyle == "matrix") ? pathPrefix+"orderId"+pathSuffix : pathPrefix;
|
||||
fullPath.replace(order_idPathParam, paramString+QUrl::toPercentEncoding(::test_namespace::toStringValue(order_id)));
|
||||
|
||||
}
|
||||
|
||||
PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this, _manager);
|
||||
worker->setTimeOut(_timeOut);
|
||||
@ -277,7 +280,6 @@ void PFXStoreApi::getInventory() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this, _manager);
|
||||
worker->setTimeOut(_timeOut);
|
||||
worker->setWorkingDirectory(_workingDirectory);
|
||||
@ -325,6 +327,9 @@ void PFXStoreApi::getInventoryCallback(PFXHttpRequestWorker *worker) {
|
||||
void PFXStoreApi::getOrderById(const qint64 &order_id) {
|
||||
QString fullPath = QString(_serverConfigs["getOrderById"][_serverIndices.value("getOrderById")].URL()+"/store/order/{orderId}");
|
||||
|
||||
|
||||
|
||||
{
|
||||
QString order_idPathParam("{");
|
||||
order_idPathParam.append("orderId").append("}");
|
||||
QString pathPrefix, pathSuffix, pathDelimiter;
|
||||
@ -336,7 +341,7 @@ void PFXStoreApi::getOrderById(const qint64 &order_id) {
|
||||
pathDelimiter = getParamStyleDelimiter(pathStyle, "orderId", false);
|
||||
QString paramString = (pathStyle == "matrix") ? pathPrefix+"orderId"+pathSuffix : pathPrefix;
|
||||
fullPath.replace(order_idPathParam, paramString+QUrl::toPercentEncoding(::test_namespace::toStringValue(order_id)));
|
||||
|
||||
}
|
||||
|
||||
PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this, _manager);
|
||||
worker->setTimeOut(_timeOut);
|
||||
@ -377,7 +382,6 @@ void PFXStoreApi::placeOrder(const PFXOrder &body) {
|
||||
QString fullPath = QString(_serverConfigs["placeOrder"][_serverIndices.value("placeOrder")].URL()+"/store/order");
|
||||
|
||||
|
||||
|
||||
PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this, _manager);
|
||||
worker->setTimeOut(_timeOut);
|
||||
worker->setWorkingDirectory(_workingDirectory);
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include <QStringList>
|
||||
#include <QList>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QVariant>
|
||||
|
||||
namespace test_namespace {
|
||||
|
||||
@ -55,11 +56,25 @@ public:
|
||||
QString getParamStyleSuffix(QString style);
|
||||
QString getParamStyleDelimiter(QString style, QString name, bool isExplode);
|
||||
|
||||
/**
|
||||
* @param[in] order_id QString [required]
|
||||
*/
|
||||
void deleteOrder(const QString &order_id);
|
||||
|
||||
|
||||
void getInventory();
|
||||
|
||||
/**
|
||||
* @param[in] order_id qint64 [required]
|
||||
*/
|
||||
void getOrderById(const qint64 &order_id);
|
||||
|
||||
/**
|
||||
* @param[in] body PFXOrder [required]
|
||||
*/
|
||||
void placeOrder(const PFXOrder &body);
|
||||
|
||||
|
||||
private:
|
||||
QMap<QString,int> _serverIndices;
|
||||
QMap<QString,QList<PFXServerConfiguration>> _serverConfigs;
|
||||
|
@ -235,7 +235,6 @@ void PFXUserApi::createUser(const PFXUser &body) {
|
||||
QString fullPath = QString(_serverConfigs["createUser"][_serverIndices.value("createUser")].URL()+"/user");
|
||||
|
||||
|
||||
|
||||
PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this, _manager);
|
||||
worker->setTimeOut(_timeOut);
|
||||
worker->setWorkingDirectory(_workingDirectory);
|
||||
@ -277,13 +276,11 @@ void PFXUserApi::createUsersWithArrayInput(const QList<PFXUser> &body) {
|
||||
QString fullPath = QString(_serverConfigs["createUsersWithArrayInput"][_serverIndices.value("createUsersWithArrayInput")].URL()+"/user/createWithArray");
|
||||
|
||||
|
||||
|
||||
PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this, _manager);
|
||||
worker->setTimeOut(_timeOut);
|
||||
worker->setWorkingDirectory(_workingDirectory);
|
||||
PFXHttpRequestInput input(fullPath, "POST");
|
||||
|
||||
|
||||
QJsonDocument doc(::test_namespace::toJsonValue(body).toArray());
|
||||
QByteArray bytes = doc.toJson();
|
||||
input.request_body.append(bytes);
|
||||
@ -320,13 +317,11 @@ void PFXUserApi::createUsersWithListInput(const QList<PFXUser> &body) {
|
||||
QString fullPath = QString(_serverConfigs["createUsersWithListInput"][_serverIndices.value("createUsersWithListInput")].URL()+"/user/createWithList");
|
||||
|
||||
|
||||
|
||||
PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this, _manager);
|
||||
worker->setTimeOut(_timeOut);
|
||||
worker->setWorkingDirectory(_workingDirectory);
|
||||
PFXHttpRequestInput input(fullPath, "POST");
|
||||
|
||||
|
||||
QJsonDocument doc(::test_namespace::toJsonValue(body).toArray());
|
||||
QByteArray bytes = doc.toJson();
|
||||
input.request_body.append(bytes);
|
||||
@ -362,6 +357,9 @@ void PFXUserApi::createUsersWithListInputCallback(PFXHttpRequestWorker *worker)
|
||||
void PFXUserApi::deleteUser(const QString &username) {
|
||||
QString fullPath = QString(_serverConfigs["deleteUser"][_serverIndices.value("deleteUser")].URL()+"/user/{username}");
|
||||
|
||||
|
||||
|
||||
{
|
||||
QString usernamePathParam("{");
|
||||
usernamePathParam.append("username").append("}");
|
||||
QString pathPrefix, pathSuffix, pathDelimiter;
|
||||
@ -373,7 +371,7 @@ void PFXUserApi::deleteUser(const QString &username) {
|
||||
pathDelimiter = getParamStyleDelimiter(pathStyle, "username", false);
|
||||
QString paramString = (pathStyle == "matrix") ? pathPrefix+"username"+pathSuffix : pathPrefix;
|
||||
fullPath.replace(usernamePathParam, paramString+QUrl::toPercentEncoding(::test_namespace::toStringValue(username)));
|
||||
|
||||
}
|
||||
|
||||
PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this, _manager);
|
||||
worker->setTimeOut(_timeOut);
|
||||
@ -412,6 +410,9 @@ void PFXUserApi::deleteUserCallback(PFXHttpRequestWorker *worker) {
|
||||
void PFXUserApi::getUserByName(const QString &username) {
|
||||
QString fullPath = QString(_serverConfigs["getUserByName"][_serverIndices.value("getUserByName")].URL()+"/user/{username}");
|
||||
|
||||
|
||||
|
||||
{
|
||||
QString usernamePathParam("{");
|
||||
usernamePathParam.append("username").append("}");
|
||||
QString pathPrefix, pathSuffix, pathDelimiter;
|
||||
@ -423,7 +424,7 @@ void PFXUserApi::getUserByName(const QString &username) {
|
||||
pathDelimiter = getParamStyleDelimiter(pathStyle, "username", false);
|
||||
QString paramString = (pathStyle == "matrix") ? pathPrefix+"username"+pathSuffix : pathPrefix;
|
||||
fullPath.replace(usernamePathParam, paramString+QUrl::toPercentEncoding(::test_namespace::toStringValue(username)));
|
||||
|
||||
}
|
||||
|
||||
PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this, _manager);
|
||||
worker->setTimeOut(_timeOut);
|
||||
@ -465,6 +466,8 @@ void PFXUserApi::loginUser(const QString &username, const QString &password) {
|
||||
|
||||
|
||||
QString queryPrefix, querySuffix, queryDelimiter, queryStyle;
|
||||
|
||||
{
|
||||
queryStyle = "";
|
||||
if(queryStyle == "")
|
||||
queryStyle = "form";
|
||||
@ -477,6 +480,10 @@ void PFXUserApi::loginUser(const QString &username, const QString &password) {
|
||||
fullPath.append("?");
|
||||
|
||||
fullPath.append(QUrl::toPercentEncoding("username")).append(querySuffix).append(QUrl::toPercentEncoding(::test_namespace::toStringValue(username)));
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
queryStyle = "";
|
||||
if(queryStyle == "")
|
||||
queryStyle = "form";
|
||||
@ -489,6 +496,7 @@ void PFXUserApi::loginUser(const QString &username, const QString &password) {
|
||||
fullPath.append("?");
|
||||
|
||||
fullPath.append(QUrl::toPercentEncoding("password")).append(querySuffix).append(QUrl::toPercentEncoding(::test_namespace::toStringValue(password)));
|
||||
}
|
||||
|
||||
PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this, _manager);
|
||||
worker->setTimeOut(_timeOut);
|
||||
@ -530,7 +538,6 @@ void PFXUserApi::logoutUser() {
|
||||
QString fullPath = QString(_serverConfigs["logoutUser"][_serverIndices.value("logoutUser")].URL()+"/user/logout");
|
||||
|
||||
|
||||
|
||||
PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this, _manager);
|
||||
worker->setTimeOut(_timeOut);
|
||||
worker->setWorkingDirectory(_workingDirectory);
|
||||
@ -568,6 +575,9 @@ void PFXUserApi::logoutUserCallback(PFXHttpRequestWorker *worker) {
|
||||
void PFXUserApi::updateUser(const QString &username, const PFXUser &body) {
|
||||
QString fullPath = QString(_serverConfigs["updateUser"][_serverIndices.value("updateUser")].URL()+"/user/{username}");
|
||||
|
||||
|
||||
|
||||
{
|
||||
QString usernamePathParam("{");
|
||||
usernamePathParam.append("username").append("}");
|
||||
QString pathPrefix, pathSuffix, pathDelimiter;
|
||||
@ -579,7 +589,7 @@ void PFXUserApi::updateUser(const QString &username, const PFXUser &body) {
|
||||
pathDelimiter = getParamStyleDelimiter(pathStyle, "username", false);
|
||||
QString paramString = (pathStyle == "matrix") ? pathPrefix+"username"+pathSuffix : pathPrefix;
|
||||
fullPath.replace(usernamePathParam, paramString+QUrl::toPercentEncoding(::test_namespace::toStringValue(username)));
|
||||
|
||||
}
|
||||
|
||||
PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this, _manager);
|
||||
worker->setTimeOut(_timeOut);
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include <QStringList>
|
||||
#include <QList>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QVariant>
|
||||
|
||||
namespace test_namespace {
|
||||
|
||||
@ -55,15 +56,47 @@ public:
|
||||
QString getParamStyleSuffix(QString style);
|
||||
QString getParamStyleDelimiter(QString style, QString name, bool isExplode);
|
||||
|
||||
/**
|
||||
* @param[in] body PFXUser [required]
|
||||
*/
|
||||
void createUser(const PFXUser &body);
|
||||
|
||||
/**
|
||||
* @param[in] body QList<PFXUser> [required]
|
||||
*/
|
||||
void createUsersWithArrayInput(const QList<PFXUser> &body);
|
||||
|
||||
/**
|
||||
* @param[in] body QList<PFXUser> [required]
|
||||
*/
|
||||
void createUsersWithListInput(const QList<PFXUser> &body);
|
||||
|
||||
/**
|
||||
* @param[in] username QString [required]
|
||||
*/
|
||||
void deleteUser(const QString &username);
|
||||
|
||||
/**
|
||||
* @param[in] username QString [required]
|
||||
*/
|
||||
void getUserByName(const QString &username);
|
||||
|
||||
/**
|
||||
* @param[in] username QString [required]
|
||||
* @param[in] password QString [required]
|
||||
*/
|
||||
void loginUser(const QString &username, const QString &password);
|
||||
|
||||
|
||||
void logoutUser();
|
||||
|
||||
/**
|
||||
* @param[in] username QString [required]
|
||||
* @param[in] body PFXUser [required]
|
||||
*/
|
||||
void updateUser(const QString &username, const PFXUser &body);
|
||||
|
||||
|
||||
private:
|
||||
QMap<QString,int> _serverIndices;
|
||||
QMap<QString,QList<PFXServerConfiguration>> _serverConfigs;
|
||||
|
Loading…
x
Reference in New Issue
Block a user