Revision control

+ /**
+ * OpenAPI Petstore
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * Do not edit the class manually.
+ */
+
+ #include "OAIUserApi.h"
+ #include "OAIServerConfiguration.h"
+
+ #include <QtCore/qanystringview.h>
+ #include <QtCore/qjsonarray.h>
+ #include <QtCore/qjsondocument.h>
+ #include <QtNetwork/qnetworkaccessmanager.h>
+ #include <QtNetwork/qnetworkreply.h>
+ #include <QtNetwork/qnetworkrequestfactory.h>
+ #include <QtNetwork/qrestaccessmanager.h>
+
+ using namespace Qt::StringLiterals;
+
+ namespace OpenAPI {
+
+ OAIUserApi::OAIUserApi(QObject *parent)
+ : OAIBaseApi(parent)
+ {
+ initializeServerConfigs();
+ }
+
+ OAIUserApi::~OAIUserApi()
+ {
+ }
+
+ void OAIUserApi::initializeServerConfigs()
+ {
+ //Default server
+ QList<OAIServerConfiguration> defaultConf = QList<OAIServerConfiguration>();
+ //varying endpoint server
+ defaultConf.append(OAIServerConfiguration(
+ "No description provided",
+ QMap<QString, OAIServerVariable>()));
+ m_serverConfigs.insert("createInQueryMap", defaultConf);
+ m_serverIndices.insert("createInQueryMap", 0);
+ m_serverConfigs.insert("createUser", defaultConf);
+ m_serverIndices.insert("createUser", 0);
+ m_serverConfigs.insert("createUsersWithArrayInput", defaultConf);
+ m_serverIndices.insert("createUsersWithArrayInput", 0);
+ m_serverConfigs.insert("createUsersWithListInput", defaultConf);
+ m_serverIndices.insert("createUsersWithListInput", 0);
+ m_serverConfigs.insert("deleteUser", defaultConf);
+ m_serverIndices.insert("deleteUser", 0);
+ m_serverConfigs.insert("getUserByName", defaultConf);
+ m_serverIndices.insert("getUserByName", 0);
+ m_serverConfigs.insert("loginUser", defaultConf);
+ m_serverIndices.insert("loginUser", 0);
+ m_serverConfigs.insert("logoutUser", defaultConf);
+ m_serverIndices.insert("logoutUser", 0);
+ m_serverConfigs.insert("updateUser", defaultConf);
+ m_serverIndices.insert("updateUser", 0);
+ }
+
+ /**
+ * \fn virtual void OAIUserApi::createInQueryMap(const QMap<QString, QString> &username)
+ * 'createInQueryMap' operation sends the request to a server.
+ * The request parameters are defined by a specification file.
+
+ * @param[in] username QMap<QString, QString> [required]
+ */
+
+ /**
+ * \fn template < Functor, > void OAIUserApi::createInQueryMap(const QMap<QString, QString> &username, const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
+ * 'createInQueryMap' operation sends the request to a server.
+ * The request parameters are defined by a specification file.
+ *
+ * \attention Use the operation with following parameters in the callback:
+ * \code {c++}
+ * createInQueryMap(username, this, [&](QRestReply &reply) { if (reply.isSuccess()) ... });
+ * \endcode
+ * \note The template function can not be virtual in C++17.
+ * If you want to use 'makeOperationsVirtual' option for mocking API,
+ * please override virtual createInQueryMapWithDataImpl() in derived class.
+ * The virtual createInQueryMapWithDataImpl() is being called by the template
+ * function.
+
+ * @param[in] username QMap<QString, QString> [required]
+ * @param[in] context const ContextTypeForFunctor< Functor > * [optional]
+ * @param[in] callback Functor && [optional]
+ */
+
+ /**
+ * \fn void OAIUserApi::createInQueryMapCallback(const QRestReply &reply)
+ * Processes a \a reply response from a server.
+ * The result of processed data is emitted by createInQueryMapFinished() or
+ * being returned as a callback parameter of createInQueryMap() request.
+ * @param[in] reply const QRestReply &
+ */
+
+ /**
+ * \fn virtual void OAIUserApi::createInQueryMapWithDataImpl(const QMap<QString, QString> &username, const QObject *context, QtPrivate::QSlotObjectBase *slot)
+ * Implements the createInQueryMap() operation request.
+ * \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
+ * and can be overloaded for mocking createInQueryMap() operation calls.
+
+ * @param[in] username QMap<QString, QString> [required]
+ * @param[in] context const QObject * [optional]
+ * @param[in] slot QtPrivate::QSlotObjectBase * [optional]
+ */
+ void OAIUserApi::createInQueryMapWithDataImpl(const QMap<QString, QString> &username, const QObject *context, QtPrivate::QSlotObjectBase *slot)
+ {
+ const QUrl serverUrl = m_serverConfigs["createInQueryMap"][m_serverIndices.value("createInQueryMap")].serverUrl();
+ QString fullPath = "/user/createInQueryMap";
+ m_networkFactory->setBaseUrl(serverUrl);
+ QString queryPrefix, querySuffix, queryDelimiter, queryStyle;
+ queryStyle = "form";
+ if (queryStyle == "")
+ queryStyle = "form";
+ queryPrefix = getParamStylePrefix(queryStyle);
+ querySuffix = getParamStyleSuffix(queryStyle);
+ {
+ if (fullPath.indexOf("?") > 0)
+ fullPath.append(queryPrefix);
+ else
+ fullPath.append("?");
+ QString paramString = (queryStyle == "form" && true) ? "" : "username" + querySuffix;
+ QString assignOperator;
+ if (queryStyle == "form")
+ assignOperator = (true) ? "=" : ",";
+ else if (queryStyle == "deepObject")
+ assignOperator = (true) ? "=" : "none";
+ queryDelimiter = ((queryStyle == "form" || queryStyle == "deepObject") && true) ? "&" : ",";
+
+ paramString.append(::OpenAPI::toStringValue(username, assignOperator, queryDelimiter));
+ fullPath.append(QUrl::toPercentEncoding(paramString));
+
+ }
+ OAIHttpRequestInput input(fullPath, "POST");
+ QByteArray requestContent;
+ QNetworkRequest request
+ = OAIHttpRequestWorker::getNetworkRequest(input, requestContent, m_networkFactory,
+ m_isResponseCompressionEnabled, m_isRequestCompressionEnabled);
+ QNetworkReply *reply = execute(input, request, requestContent);
+ if (reply != nullptr) {
+ reply->setParent(this);
+ m_callerData.insert(reply, OAICallerInfo{context, slot});
+ connect(reply, &QNetworkReply::finished, this, [this, reply] {
+ createInQueryMapCallback(QRestReply(reply));
+ });
+ connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
+ if (reply) {
+ emit createInQueryMapErrorOccurred(reply->error(), reply->errorString());
+ OAICallerInfo callerInfo = m_callerData.take(reply);
+ if (callerInfo.slot) {
+ QRestReply restRepl(reply);
+ void *argv[] = { nullptr, &restRepl };
+ QObject *context = callerInfo.contextObject ? const_cast<QObject*>(callerInfo.contextObject) : nullptr;
+ callerInfo.slot->call(context, argv);
+ }
+ }
+ });
+ }
+ }
+
+ void OAIUserApi::createInQueryMapCallback(const QRestReply &reply)
+ {
+ auto netReply = reply.networkReply();
+ if (netReply)
+ disconnect(netReply, nullptr, nullptr, nullptr);
+ if (!reply.isSuccess())
+ return;
+
+ // Check if callback is provided
+ OAICallerInfo callerInfo = m_callerData.take(netReply);
+ if (callerInfo.slot) {
+ void *argv[] = { nullptr, const_cast<QRestReply*>(&reply) };
+ QObject *context = callerInfo.contextObject
+ ? const_cast<QObject*>(callerInfo.contextObject) : nullptr;
+ callerInfo.slot->call(context, argv);
+ }
+ emit createInQueryMapFinished();
+ }
+
+ /**
+ * \fn virtual void OAIUserApi::createUser(const OAIUser &oAIUser)
+ * 'createUser' operation sends the request to a server.
+ * The request parameters are defined by a specification file.
+
+ * @param[in] oAIUser OAIUser [required]
+ */
+
+ /**
+ * \fn template < Functor, > void OAIUserApi::createUser(const OAIUser &oAIUser, const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
+ * 'createUser' operation sends the request to a server.
+ * The request parameters are defined by a specification file.
+ *
+ * \attention Use the operation with following parameters in the callback:
+ * \code {c++}
+ * createUser(oAIUser, this, [&](QRestReply &reply) { if (reply.isSuccess()) ... });
+ * \endcode
+ * \note The template function can not be virtual in C++17.
+ * If you want to use 'makeOperationsVirtual' option for mocking API,
+ * please override virtual createUserWithDataImpl() in derived class.
+ * The virtual createUserWithDataImpl() is being called by the template
+ * function.
+
+ * @param[in] oAIUser OAIUser [required]
+ * @param[in] context const ContextTypeForFunctor< Functor > * [optional]
+ * @param[in] callback Functor && [optional]
+ */
+
+ /**
+ * \fn void OAIUserApi::createUserCallback(const QRestReply &reply)
+ * Processes a \a reply response from a server.
+ * The result of processed data is emitted by createUserFinished() or
+ * being returned as a callback parameter of createUser() request.
+ * @param[in] reply const QRestReply &
+ */
+
+ /**
+ * \fn virtual void OAIUserApi::createUserWithDataImpl(const OAIUser &oAIUser, const QObject *context, QtPrivate::QSlotObjectBase *slot)
+ * Implements the createUser() operation request.
+ * \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
+ * and can be overloaded for mocking createUser() operation calls.
+
+ * @param[in] oAIUser OAIUser [required]
+ * @param[in] context const QObject * [optional]
+ * @param[in] slot QtPrivate::QSlotObjectBase * [optional]
+ */
+ void OAIUserApi::createUserWithDataImpl(const OAIUser &oAIUser, const QObject *context, QtPrivate::QSlotObjectBase *slot)
+ {
+ const QUrl serverUrl = m_serverConfigs["createUser"][m_serverIndices.value("createUser")].serverUrl();
+ QString fullPath = "/user";
+ m_networkFactory->setBaseUrl(serverUrl);
+ if (m_apiKeys.contains("api_key"_L1)) {
+ setHeader("api_key"_L1, QAnyStringView(m_apiKeys.find("api_key"_L1).value()));
+ }
+
+
+ OAIHttpRequestInput input(fullPath, "POST");
+ {
+
+ QByteArray output = oAIUser.asJson().toUtf8();
+ input.m_requestBody.append(output);
+ }
+ QByteArray requestContent;
+ QNetworkRequest request
+ = OAIHttpRequestWorker::getNetworkRequest(input, requestContent, m_networkFactory,
+ m_isResponseCompressionEnabled, m_isRequestCompressionEnabled);
+ QNetworkReply *reply = execute(input, request, requestContent);
+ if (reply != nullptr) {
+ reply->setParent(this);
+ m_callerData.insert(reply, OAICallerInfo{context, slot});
+ connect(reply, &QNetworkReply::finished, this, [this, reply] {
+ createUserCallback(QRestReply(reply));
+ });
+ connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
+ if (reply) {
+ emit createUserErrorOccurred(reply->error(), reply->errorString());
+ OAICallerInfo callerInfo = m_callerData.take(reply);
+ if (callerInfo.slot) {
+ QRestReply restRepl(reply);
+ void *argv[] = { nullptr, &restRepl };
+ QObject *context = callerInfo.contextObject ? const_cast<QObject*>(callerInfo.contextObject) : nullptr;
+ callerInfo.slot->call(context, argv);
+ }
+ }
+ });
+ }
+ }
+
+ void OAIUserApi::createUserCallback(const QRestReply &reply)
+ {
+ auto netReply = reply.networkReply();
+ if (netReply)
+ disconnect(netReply, nullptr, nullptr, nullptr);
+ if (!reply.isSuccess())
+ return;
+
+ // Check if callback is provided
+ OAICallerInfo callerInfo = m_callerData.take(netReply);
+ if (callerInfo.slot) {
+ void *argv[] = { nullptr, const_cast<QRestReply*>(&reply) };
+ QObject *context = callerInfo.contextObject
+ ? const_cast<QObject*>(callerInfo.contextObject) : nullptr;
+ callerInfo.slot->call(context, argv);
+ }
+ emit createUserFinished();
+ }
+
+ /**
+ * \fn virtual void OAIUserApi::createUsersWithArrayInput(const QList<OAIUser> &oAIUser)
+ * 'createUsersWithArrayInput' operation sends the request to a server.
+ * The request parameters are defined by a specification file.
+
+ * @param[in] oAIUser QList<OAIUser> [required]
+ */
+
+ /**
+ * \fn template < Functor, > void OAIUserApi::createUsersWithArrayInput(const QList<OAIUser> &oAIUser, const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
+ * 'createUsersWithArrayInput' operation sends the request to a server.
+ * The request parameters are defined by a specification file.
+ *
+ * \attention Use the operation with following parameters in the callback:
+ * \code {c++}
+ * createUsersWithArrayInput(oAIUser, this, [&](QRestReply &reply) { if (reply.isSuccess()) ... });
+ * \endcode
+ * \note The template function can not be virtual in C++17.
+ * If you want to use 'makeOperationsVirtual' option for mocking API,
+ * please override virtual createUsersWithArrayInputWithDataImpl() in derived class.
+ * The virtual createUsersWithArrayInputWithDataImpl() is being called by the template
+ * function.
+
+ * @param[in] oAIUser QList<OAIUser> [required]
+ * @param[in] context const ContextTypeForFunctor< Functor > * [optional]
+ * @param[in] callback Functor && [optional]
+ */
+
+ /**
+ * \fn void OAIUserApi::createUsersWithArrayInputCallback(const QRestReply &reply)
+ * Processes a \a reply response from a server.
+ * The result of processed data is emitted by createUsersWithArrayInputFinished() or
+ * being returned as a callback parameter of createUsersWithArrayInput() request.
+ * @param[in] reply const QRestReply &
+ */
+
+ /**
+ * \fn virtual void OAIUserApi::createUsersWithArrayInputWithDataImpl(const QList<OAIUser> &oAIUser, const QObject *context, QtPrivate::QSlotObjectBase *slot)
+ * Implements the createUsersWithArrayInput() operation request.
+ * \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
+ * and can be overloaded for mocking createUsersWithArrayInput() operation calls.
+
+ * @param[in] oAIUser QList<OAIUser> [required]
+ * @param[in] context const QObject * [optional]
+ * @param[in] slot QtPrivate::QSlotObjectBase * [optional]
+ */
+ void OAIUserApi::createUsersWithArrayInputWithDataImpl(const QList<OAIUser> &oAIUser, const QObject *context, QtPrivate::QSlotObjectBase *slot)
+ {
+ const QUrl serverUrl = m_serverConfigs["createUsersWithArrayInput"][m_serverIndices.value("createUsersWithArrayInput")].serverUrl();
+ QString fullPath = "/user/createWithArray";
+ m_networkFactory->setBaseUrl(serverUrl);
+ if (m_apiKeys.contains("api_key"_L1)) {
+ setHeader("api_key"_L1, QAnyStringView(m_apiKeys.find("api_key"_L1).value()));
+ }
+
+
+ OAIHttpRequestInput input(fullPath, "POST");
+ {
+
+ QJsonDocument doc(::OpenAPI::toJsonValue(oAIUser).toArray());
+ QByteArray bytes = doc.toJson();
+ input.m_requestBody.append(bytes);
+ }
+ QByteArray requestContent;
+ QNetworkRequest request
+ = OAIHttpRequestWorker::getNetworkRequest(input, requestContent, m_networkFactory,
+ m_isResponseCompressionEnabled, m_isRequestCompressionEnabled);
+ QNetworkReply *reply = execute(input, request, requestContent);
+ if (reply != nullptr) {
+ reply->setParent(this);
+ m_callerData.insert(reply, OAICallerInfo{context, slot});
+ connect(reply, &QNetworkReply::finished, this, [this, reply] {
+ createUsersWithArrayInputCallback(QRestReply(reply));
+ });
+ connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
+ if (reply) {
+ emit createUsersWithArrayInputErrorOccurred(reply->error(), reply->errorString());
+ OAICallerInfo callerInfo = m_callerData.take(reply);
+ if (callerInfo.slot) {
+ QRestReply restRepl(reply);
+ void *argv[] = { nullptr, &restRepl };
+ QObject *context = callerInfo.contextObject ? const_cast<QObject*>(callerInfo.contextObject) : nullptr;
+ callerInfo.slot->call(context, argv);
+ }
+ }
+ });
+ }
+ }
+
+ void OAIUserApi::createUsersWithArrayInputCallback(const QRestReply &reply)
+ {
+ auto netReply = reply.networkReply();
+ if (netReply)
+ disconnect(netReply, nullptr, nullptr, nullptr);
+ if (!reply.isSuccess())
+ return;
+
+ // Check if callback is provided
+ OAICallerInfo callerInfo = m_callerData.take(netReply);
+ if (callerInfo.slot) {
+ void *argv[] = { nullptr, const_cast<QRestReply*>(&reply) };
+ QObject *context = callerInfo.contextObject
+ ? const_cast<QObject*>(callerInfo.contextObject) : nullptr;
+ callerInfo.slot->call(context, argv);
+ }
+ emit createUsersWithArrayInputFinished();
+ }
+
+ /**
+ * \fn virtual void OAIUserApi::createUsersWithListInput(const QList<OAIUser> &oAIUser)
+ * 'createUsersWithListInput' operation sends the request to a server.
+ * The request parameters are defined by a specification file.
+
+ * @param[in] oAIUser QList<OAIUser> [required]
+ */
+
+ /**
+ * \fn template < Functor, > void OAIUserApi::createUsersWithListInput(const QList<OAIUser> &oAIUser, const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
+ * 'createUsersWithListInput' operation sends the request to a server.
+ * The request parameters are defined by a specification file.
+ *
+ * \attention Use the operation with following parameters in the callback:
+ * \code {c++}
+ * createUsersWithListInput(oAIUser, this, [&](QRestReply &reply) { if (reply.isSuccess()) ... });
+ * \endcode
+ * \note The template function can not be virtual in C++17.
+ * If you want to use 'makeOperationsVirtual' option for mocking API,
+ * please override virtual createUsersWithListInputWithDataImpl() in derived class.
+ * The virtual createUsersWithListInputWithDataImpl() is being called by the template
+ * function.
+
+ * @param[in] oAIUser QList<OAIUser> [required]
+ * @param[in] context const ContextTypeForFunctor< Functor > * [optional]
+ * @param[in] callback Functor && [optional]
+ */
+
+ /**
+ * \fn void OAIUserApi::createUsersWithListInputCallback(const QRestReply &reply)
+ * Processes a \a reply response from a server.
+ * The result of processed data is emitted by createUsersWithListInputFinished() or
+ * being returned as a callback parameter of createUsersWithListInput() request.
+ * @param[in] reply const QRestReply &
+ */
+
+ /**
+ * \fn virtual void OAIUserApi::createUsersWithListInputWithDataImpl(const QList<OAIUser> &oAIUser, const QObject *context, QtPrivate::QSlotObjectBase *slot)
+ * Implements the createUsersWithListInput() operation request.
+ * \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
+ * and can be overloaded for mocking createUsersWithListInput() operation calls.
+
+ * @param[in] oAIUser QList<OAIUser> [required]
+ * @param[in] context const QObject * [optional]
+ * @param[in] slot QtPrivate::QSlotObjectBase * [optional]
+ */
+ void OAIUserApi::createUsersWithListInputWithDataImpl(const QList<OAIUser> &oAIUser, const QObject *context, QtPrivate::QSlotObjectBase *slot)
+ {
+ const QUrl serverUrl = m_serverConfigs["createUsersWithListInput"][m_serverIndices.value("createUsersWithListInput")].serverUrl();
+ QString fullPath = "/user/createWithList";
+ m_networkFactory->setBaseUrl(serverUrl);
+ if (m_apiKeys.contains("api_key"_L1)) {
+ setHeader("api_key"_L1, QAnyStringView(m_apiKeys.find("api_key"_L1).value()));
+ }
+
+
+ OAIHttpRequestInput input(fullPath, "POST");
+ {
+
+ QJsonDocument doc(::OpenAPI::toJsonValue(oAIUser).toArray());
+ QByteArray bytes = doc.toJson();
+ input.m_requestBody.append(bytes);
+ }
+ QByteArray requestContent;
+ QNetworkRequest request
+ = OAIHttpRequestWorker::getNetworkRequest(input, requestContent, m_networkFactory,
+ m_isResponseCompressionEnabled, m_isRequestCompressionEnabled);
+ QNetworkReply *reply = execute(input, request, requestContent);
+ if (reply != nullptr) {
+ reply->setParent(this);
+ m_callerData.insert(reply, OAICallerInfo{context, slot});
+ connect(reply, &QNetworkReply::finished, this, [this, reply] {
+ createUsersWithListInputCallback(QRestReply(reply));
+ });
+ connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
+ if (reply) {
+ emit createUsersWithListInputErrorOccurred(reply->error(), reply->errorString());
+ OAICallerInfo callerInfo = m_callerData.take(reply);
+ if (callerInfo.slot) {
+ QRestReply restRepl(reply);
+ void *argv[] = { nullptr, &restRepl };
+ QObject *context = callerInfo.contextObject ? const_cast<QObject*>(callerInfo.contextObject) : nullptr;
+ callerInfo.slot->call(context, argv);
+ }
+ }
+ });
+ }
+ }
+
+ void OAIUserApi::createUsersWithListInputCallback(const QRestReply &reply)
+ {
+ auto netReply = reply.networkReply();
+ if (netReply)
+ disconnect(netReply, nullptr, nullptr, nullptr);
+ if (!reply.isSuccess())
+ return;
+
+ // Check if callback is provided
+ OAICallerInfo callerInfo = m_callerData.take(netReply);
+ if (callerInfo.slot) {
+ void *argv[] = { nullptr, const_cast<QRestReply*>(&reply) };
+ QObject *context = callerInfo.contextObject
+ ? const_cast<QObject*>(callerInfo.contextObject) : nullptr;
+ callerInfo.slot->call(context, argv);
+ }
+ emit createUsersWithListInputFinished();
+ }
+
+ /**
+ * \fn virtual void OAIUserApi::deleteUser(const OAIUser &username)
+ * 'deleteUser' operation sends the request to a server.
+ * The request parameters are defined by a specification file.
+
+ * @param[in] username OAIUser [required]
+ */
+
+ /**
+ * \fn template < Functor, > void OAIUserApi::deleteUser(const OAIUser &username, const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
+ * 'deleteUser' operation sends the request to a server.
+ * The request parameters are defined by a specification file.
+ *
+ * \attention Use the operation with following parameters in the callback:
+ * \code {c++}
+ * deleteUser(username, this, [&](QRestReply &reply) { if (reply.isSuccess()) ... });
+ * \endcode
+ * \note The template function can not be virtual in C++17.
+ * If you want to use 'makeOperationsVirtual' option for mocking API,
+ * please override virtual deleteUserWithDataImpl() in derived class.
+ * The virtual deleteUserWithDataImpl() is being called by the template
+ * function.
+
+ * @param[in] username OAIUser [required]
+ * @param[in] context const ContextTypeForFunctor< Functor > * [optional]
+ * @param[in] callback Functor && [optional]
+ */
+
+ /**
+ * \fn void OAIUserApi::deleteUserCallback(const QRestReply &reply)
+ * Processes a \a reply response from a server.
+ * The result of processed data is emitted by deleteUserFinished() or
+ * being returned as a callback parameter of deleteUser() request.
+ * @param[in] reply const QRestReply &
+ */
+
+ /**
+ * \fn virtual void OAIUserApi::deleteUserWithDataImpl(const OAIUser &username, const QObject *context, QtPrivate::QSlotObjectBase *slot)
+ * Implements the deleteUser() operation request.
+ * \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
+ * and can be overloaded for mocking deleteUser() operation calls.
+
+ * @param[in] username OAIUser [required]
+ * @param[in] context const QObject * [optional]
+ * @param[in] slot QtPrivate::QSlotObjectBase * [optional]
+ */
+ void OAIUserApi::deleteUserWithDataImpl(const OAIUser &username, const QObject *context, QtPrivate::QSlotObjectBase *slot)
+ {
+ const QUrl serverUrl = m_serverConfigs["deleteUser"][m_serverIndices.value("deleteUser")].serverUrl();
+ QString fullPath = "/user/{username}";
+ m_networkFactory->setBaseUrl(serverUrl);
+ if (m_apiKeys.contains("api_key"_L1)) {
+ setHeader("api_key"_L1, QAnyStringView(m_apiKeys.find("api_key"_L1).value()));
+ }
+
+ QString usernamePathParam("{");
+ usernamePathParam.append("username").append("}");
+ QString pathPrefix, pathSuffix, pathDelimiter;
+ QString pathStyle = "simple";
+ if (pathStyle == "")
+ pathStyle = "simple";
+ pathPrefix = getParamStylePrefix(pathStyle);
+ pathSuffix = getParamStyleSuffix(pathStyle);
+ pathDelimiter = getParamStyleDelimiter(pathStyle, "username", false);
+ QString paramString = (pathStyle == "matrix" && !false) ? pathPrefix + "username" + pathSuffix : pathPrefix;
+ const QString assignOperator = (false) ? "=" : ",";
+ const QJsonObject parameter = username.asJsonObject();
+ qint32 count = 0;
+ for(const QString& key : parameter.keys()) {
+ if (count > 0) {
+ pathDelimiter = (pathStyle == "matrix" && false) ? ";" : getParamStyleDelimiter(pathStyle, key, false);
+ paramString.append(pathDelimiter);
+ }
+ paramString.append(::OpenAPI::parameterToString(key, assignOperator, parameter.value(key)));
+ count++;
+ }
+ fullPath.replace(usernamePathParam, QUrl::toPercentEncoding(paramString));
+
+ OAIHttpRequestInput input(fullPath, "DELETE");
+ QByteArray requestContent;
+ QNetworkRequest request
+ = OAIHttpRequestWorker::getNetworkRequest(input, requestContent, m_networkFactory,
+ m_isResponseCompressionEnabled, m_isRequestCompressionEnabled);
+ QNetworkReply *reply = execute(input, request, requestContent);
+ if (reply != nullptr) {
+ reply->setParent(this);
+ m_callerData.insert(reply, OAICallerInfo{context, slot});
+ connect(reply, &QNetworkReply::finished, this, [this, reply] {
+ deleteUserCallback(QRestReply(reply));
+ });
+ connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
+ if (reply) {
+ emit deleteUserErrorOccurred(reply->error(), reply->errorString());
+ OAICallerInfo callerInfo = m_callerData.take(reply);
+ if (callerInfo.slot) {
+ QRestReply restRepl(reply);
+ void *argv[] = { nullptr, &restRepl };
+ QObject *context = callerInfo.contextObject ? const_cast<QObject*>(callerInfo.contextObject) : nullptr;
+ callerInfo.slot->call(context, argv);
+ }
+ }
+ });
+ }
+ }
+
+ void OAIUserApi::deleteUserCallback(const QRestReply &reply)
+ {
+ auto netReply = reply.networkReply();
+ if (netReply)
+ disconnect(netReply, nullptr, nullptr, nullptr);
+ if (!reply.isSuccess())
+ return;
+
+ // Check if callback is provided
+ OAICallerInfo callerInfo = m_callerData.take(netReply);
+ if (callerInfo.slot) {
+ void *argv[] = { nullptr, const_cast<QRestReply*>(&reply) };
+ QObject *context = callerInfo.contextObject
+ ? const_cast<QObject*>(callerInfo.contextObject) : nullptr;
+ callerInfo.slot->call(context, argv);
+ }
+ emit deleteUserFinished();
+ }
+
+ /**
+ * \fn virtual void OAIUserApi::getUserByName(const QMap<QString, qint32> &username)
+ * 'getUserByName' operation sends the request to a server.
+ * The request parameters are defined by a specification file.
+
+ * @param[in] username QMap<QString, qint32> [required]
+ */
+
+ /**
+ * \fn template < Functor, > void OAIUserApi::getUserByName(const QMap<QString, qint32> &username, const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
+ * 'getUserByName' operation sends the request to a server.
+ * The request parameters are defined by a specification file.
+ *
+ * \attention Use the operation with following parameters in the callback:
+ * \code {c++}
+ * getUserByName(username, this, [&](QRestReply &reply, OAIUser &summary) { if (reply.isSuccess()) ... });
+ * \endcode
+ * \note The template function can not be virtual in C++17.
+ * If you want to use 'makeOperationsVirtual' option for mocking API,
+ * please override virtual getUserByNameWithDataImpl() in derived class.
+ * The virtual getUserByNameWithDataImpl() is being called by the template
+ * function.
+
+ * @param[in] username QMap<QString, qint32> [required]
+ * @param[in] context const ContextTypeForFunctor< Functor > * [optional]
+ * @param[in] callback Functor && [optional]
+ */
+
+ /**
+ * \fn void OAIUserApi::getUserByNameCallback(const QRestReply &reply)
+ * Processes a \a reply response from a server.
+ * The result of processed data is emitted by getUserByNameFinished() or
+ * being returned as a callback parameter of getUserByName() request.
+ * @param[in] reply const QRestReply &
+ */
+
+ /**
+ * \fn virtual void OAIUserApi::getUserByNameWithDataImpl(const QMap<QString, qint32> &username, const QObject *context, QtPrivate::QSlotObjectBase *slot)
+ * Implements the getUserByName() operation request.
+ * \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
+ * and can be overloaded for mocking getUserByName() operation calls.
+
+ * @param[in] username QMap<QString, qint32> [required]
+ * @param[in] context const QObject * [optional]
+ * @param[in] slot QtPrivate::QSlotObjectBase * [optional]
+ */
+ void OAIUserApi::getUserByNameWithDataImpl(const QMap<QString, qint32> &username, const QObject *context, QtPrivate::QSlotObjectBase *slot)
+ {
+ const QUrl serverUrl = m_serverConfigs["getUserByName"][m_serverIndices.value("getUserByName")].serverUrl();
+ QString fullPath = "/user/{username}";
+ m_networkFactory->setBaseUrl(serverUrl);
+ QString usernamePathParam("{");
+ usernamePathParam.append("username").append("}");
+ QString pathPrefix, pathSuffix, pathDelimiter;
+ QString pathStyle = "simple";
+ if (pathStyle == "")
+ pathStyle = "simple";
+ pathPrefix = getParamStylePrefix(pathStyle);
+ pathSuffix = getParamStyleSuffix(pathStyle);
+ pathDelimiter = getParamStyleDelimiter(pathStyle, "username", false);
+ QString paramString = (pathStyle == "matrix" && !false) ? pathPrefix + "username" + pathSuffix : pathPrefix;
+ const QString assignOperator = (false) ? "=" : ",";
+
+ pathDelimiter = (pathStyle == "matrix" && false) ? ";" : getParamStyleDelimiter(pathStyle, "username", false);
+ paramString.append(::OpenAPI::toStringValue(username, assignOperator, pathDelimiter));
+ fullPath.replace(usernamePathParam, QUrl::toPercentEncoding(paramString));
+
+ OAIHttpRequestInput input(fullPath, "GET");
+ QByteArray requestContent;
+ QNetworkRequest request
+ = OAIHttpRequestWorker::getNetworkRequest(input, requestContent, m_networkFactory,
+ m_isResponseCompressionEnabled, m_isRequestCompressionEnabled);
+ QNetworkReply *reply = execute(input, request, requestContent);
+ if (reply != nullptr) {
+ reply->setParent(this);
+ m_callerData.insert(reply, OAICallerInfo{context, slot});
+ connect(reply, &QNetworkReply::finished, this, [this, reply] {
+ getUserByNameCallback(QRestReply(reply));
+ });
+ connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
+ if (reply) {
+ emit getUserByNameErrorOccurred(reply->error(), reply->errorString());
+ OAICallerInfo callerInfo = m_callerData.take(reply);
+ if (callerInfo.slot) {
+ OAIUser empty;
+ QRestReply restRepl(reply);
+ void *argv[] = { nullptr, &restRepl, &empty };
+ QObject *context = callerInfo.contextObject ? const_cast<QObject*>(callerInfo.contextObject) : nullptr;
+ callerInfo.slot->call(context, argv);
+ }
+ }
+ });
+ }
+ }
+
+ void OAIUserApi::getUserByNameCallback(const QRestReply &reply)
+ {
+ auto netReply = reply.networkReply();
+ if (netReply)
+ disconnect(netReply, nullptr, nullptr, nullptr);
+ if (!reply.isSuccess())
+ return;
+
+ const QByteArray &response = OAIHttpRequestWorker::parseResponse(reply, m_workingDirectory);
+ OAIUser output(response);
+ // Check if callback is provided
+ OAICallerInfo callerInfo = m_callerData.take(netReply);
+ if (callerInfo.slot) {
+ void *argv[] = { nullptr, const_cast<QRestReply*>(&reply), &output };
+ QObject *context = callerInfo.contextObject
+ ? const_cast<QObject*>(callerInfo.contextObject) : nullptr;
+ callerInfo.slot->call(context, argv);
+ }
+ emit getUserByNameFinished(output);
+ }
+
+ /**
+ * \fn virtual void OAIUserApi::loginUser(const ::OpenAPI::OptionalParam<QString> &username = ::OpenAPI::OptionalParam<QString>(), const ::OpenAPI::OptionalParam<QString> &password = ::OpenAPI::OptionalParam<QString>())
+ * 'loginUser' operation sends the request to a server.
+ * The request parameters are defined by a specification file.
+
+ * @param[in] username QString [optional]
+ * @param[in] password QString [optional]
+ */
+
+ /**
+ * \fn template < Functor, > void OAIUserApi::loginUser(const ::OpenAPI::OptionalParam<QString> &username = ::OpenAPI::OptionalParam<QString>(), const ::OpenAPI::OptionalParam<QString> &password = ::OpenAPI::OptionalParam<QString>(), const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
+ * 'loginUser' operation sends the request to a server.
+ * The request parameters are defined by a specification file.
+ *
+ * \attention Use the operation with following parameters in the callback:
+ * \code {c++}
+ * loginUser(username, password, this, [&](QRestReply &reply, QString &summary) { if (reply.isSuccess()) ... });
+ * \endcode
+ * \note The template function can not be virtual in C++17.
+ * If you want to use 'makeOperationsVirtual' option for mocking API,
+ * please override virtual loginUserWithDataImpl() in derived class.
+ * The virtual loginUserWithDataImpl() is being called by the template
+ * function.
+
+ * @param[in] username QString [optional]
+ * @param[in] password QString [optional]
+ * @param[in] context const ContextTypeForFunctor< Functor > * [optional]
+ * @param[in] callback Functor && [optional]
+ */
+
+ /**
+ * \fn void OAIUserApi::loginUserCallback(const QRestReply &reply)
+ * Processes a \a reply response from a server.
+ * The result of processed data is emitted by loginUserFinished() or
+ * being returned as a callback parameter of loginUser() request.
+ * @param[in] reply const QRestReply &
+ */
+
+ /**
+ * \fn virtual void OAIUserApi::loginUserWithDataImpl(const ::OpenAPI::OptionalParam<QString> &username, const ::OpenAPI::OptionalParam<QString> &password, const QObject *context, QtPrivate::QSlotObjectBase *slot)
+ * Implements the loginUser() operation request.
+ * \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
+ * and can be overloaded for mocking loginUser() operation calls.
+
+ * @param[in] username QString [optional]
+ * @param[in] password QString [optional]
+ * @param[in] context const QObject * [optional]
+ * @param[in] slot QtPrivate::QSlotObjectBase * [optional]
+ */
+ void OAIUserApi::loginUserWithDataImpl(const ::OpenAPI::OptionalParam<QString> &username, const ::OpenAPI::OptionalParam<QString> &password, const QObject *context, QtPrivate::QSlotObjectBase *slot)
+ {
+ const QUrl serverUrl = m_serverConfigs["loginUser"][m_serverIndices.value("loginUser")].serverUrl();
+ QString fullPath = "/user/login";
+ m_networkFactory->setBaseUrl(serverUrl);
+ QString queryPrefix, querySuffix, queryDelimiter, queryStyle;
+ queryStyle = "form";
+ if (queryStyle == "")
+ queryStyle = "form";
+ queryPrefix = getParamStylePrefix(queryStyle);
+ querySuffix = getParamStyleSuffix(queryStyle);
+ if (username.hasValue()) {
+ if (fullPath.indexOf("?") > 0)
+ fullPath.append(queryPrefix);
+ else
+ fullPath.append("?");
+ fullPath.append(QUrl::toPercentEncoding("username") + querySuffix + QUrl::toPercentEncoding(::OpenAPI::toStringValue(username.value())));
+
+ } else if (username.isNull()) {
+ if (fullPath.indexOf("?") > 0)
+ fullPath.append(queryPrefix);
+ else
+ fullPath.append("?");
+
+ fullPath.append(QUrl::toPercentEncoding("username")).append(querySuffix).append(QUrl::toPercentEncoding(QString("null")));
+ }
+ queryStyle = "form";
+ if (queryStyle == "")
+ queryStyle = "form";
+ queryPrefix = getParamStylePrefix(queryStyle);
+ querySuffix = getParamStyleSuffix(queryStyle);
+ if (password.hasValue()) {
+ if (fullPath.indexOf("?") > 0)
+ fullPath.append(queryPrefix);
+ else
+ fullPath.append("?");
+ fullPath.append(QUrl::toPercentEncoding("password") + querySuffix + QUrl::toPercentEncoding(::OpenAPI::toStringValue(password.value())));
+
+ } else if (password.isNull()) {
+ if (fullPath.indexOf("?") > 0)
+ fullPath.append(queryPrefix);
+ else
+ fullPath.append("?");
+
+ fullPath.append(QUrl::toPercentEncoding("password")).append(querySuffix).append(QUrl::toPercentEncoding(QString("null")));
+ }
+ OAIHttpRequestInput input(fullPath, "GET");
+ QByteArray requestContent;
+ QNetworkRequest request
+ = OAIHttpRequestWorker::getNetworkRequest(input, requestContent, m_networkFactory,
+ m_isResponseCompressionEnabled, m_isRequestCompressionEnabled);
+ QNetworkReply *reply = execute(input, request, requestContent);
+ if (reply != nullptr) {
+ reply->setParent(this);
+ m_callerData.insert(reply, OAICallerInfo{context, slot});
+ connect(reply, &QNetworkReply::finished, this, [this, reply] {
+ loginUserCallback(QRestReply(reply));
+ });
+ connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
+ if (reply) {
+ emit loginUserErrorOccurred(reply->error(), reply->errorString());
+ OAICallerInfo callerInfo = m_callerData.take(reply);
+ if (callerInfo.slot) {
+ QString empty;
+ QRestReply restRepl(reply);
+ void *argv[] = { nullptr, &restRepl, &empty };
+ QObject *context = callerInfo.contextObject ? const_cast<QObject*>(callerInfo.contextObject) : nullptr;
+ callerInfo.slot->call(context, argv);
+ }
+ }
+ });
+ }
+ }
+
+ void OAIUserApi::loginUserCallback(const QRestReply &reply)
+ {
+ auto netReply = reply.networkReply();
+ if (netReply)
+ disconnect(netReply, nullptr, nullptr, nullptr);
+ if (!reply.isSuccess())
+ return;
+
+ const QByteArray &response = OAIHttpRequestWorker::parseResponse(reply, m_workingDirectory);
+ QString output;
+ ::OpenAPI::fromStringValue(response, output);
+ // Check if callback is provided
+ OAICallerInfo callerInfo = m_callerData.take(netReply);
+ if (callerInfo.slot) {
+ void *argv[] = { nullptr, const_cast<QRestReply*>(&reply), &output };
+ QObject *context = callerInfo.contextObject
+ ? const_cast<QObject*>(callerInfo.contextObject) : nullptr;
+ callerInfo.slot->call(context, argv);
+ }
+ emit loginUserFinished(output);
+ }
+
+ /**
+ * \fn virtual void OAIUserApi::logoutUser(const QJsonValue &username)
+ * 'logoutUser' operation sends the request to a server.
+ * The request parameters are defined by a specification file.
+
+ * @param[in] username QJsonValue [required]
+ */
+
+ /**
+ * \fn template < Functor, > void OAIUserApi::logoutUser(const QJsonValue &username, const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
+ * 'logoutUser' operation sends the request to a server.
+ * The request parameters are defined by a specification file.
+ *
+ * \attention Use the operation with following parameters in the callback:
+ * \code {c++}
+ * logoutUser(username, this, [&](QRestReply &reply) { if (reply.isSuccess()) ... });
+ * \endcode
+ * \note The template function can not be virtual in C++17.
+ * If you want to use 'makeOperationsVirtual' option for mocking API,
+ * please override virtual logoutUserWithDataImpl() in derived class.
+ * The virtual logoutUserWithDataImpl() is being called by the template
+ * function.
+
+ * @param[in] username QJsonValue [required]
+ * @param[in] context const ContextTypeForFunctor< Functor > * [optional]
+ * @param[in] callback Functor && [optional]
+ */
+
+ /**
+ * \fn void OAIUserApi::logoutUserCallback(const QRestReply &reply)
+ * Processes a \a reply response from a server.
+ * The result of processed data is emitted by logoutUserFinished() or
+ * being returned as a callback parameter of logoutUser() request.
+ * @param[in] reply const QRestReply &
+ */
+
+ /**
+ * \fn virtual void OAIUserApi::logoutUserWithDataImpl(const QJsonValue &username, const QObject *context, QtPrivate::QSlotObjectBase *slot)
+ * Implements the logoutUser() operation request.
+ * \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
+ * and can be overloaded for mocking logoutUser() operation calls.
+
+ * @param[in] username QJsonValue [required]
+ * @param[in] context const QObject * [optional]
+ * @param[in] slot QtPrivate::QSlotObjectBase * [optional]
+ */
+ void OAIUserApi::logoutUserWithDataImpl(const QJsonValue &username, const QObject *context, QtPrivate::QSlotObjectBase *slot)
+ {
+ const QUrl serverUrl = m_serverConfigs["logoutUser"][m_serverIndices.value("logoutUser")].serverUrl();
+ QString fullPath = "/user/logout";
+ m_networkFactory->setBaseUrl(serverUrl);
+ if (m_apiKeys.contains("api_key"_L1)) {
+ setHeader("api_key"_L1, QAnyStringView(m_apiKeys.find("api_key"_L1).value()));
+ }
+
+ QString queryPrefix, querySuffix, queryDelimiter, queryStyle;
+ queryStyle = "form";
+ if (queryStyle == "")
+ queryStyle = "form";
+ queryPrefix = getParamStylePrefix(queryStyle);
+ querySuffix = getParamStyleSuffix(queryStyle);
+ {
+ if (fullPath.indexOf("?") > 0)
+ fullPath.append(queryPrefix);
+ else
+ fullPath.append("?");
+ QString paramString = (queryStyle == "form" && true) ? "" : "username" + querySuffix;
+ QString assignOperator;
+ if (queryStyle == "form")
+ assignOperator = (true) ? "=" : ",";
+ else if (queryStyle == "deepObject")
+ assignOperator = (true) ? "=" : "none";
+ queryDelimiter = ((queryStyle == "form" || queryStyle == "deepObject") && true) ? "&" : ",";
+
+ switch(username.type()) {
+ case QJsonValue::String:
+ case QJsonValue::Bool:
+ case QJsonValue::Double:
+ {
+ paramString.append(::OpenAPI::toStringValue(username.toVariant()));
+ } break;
+ case QJsonValue::Array:
+ {
+ queryDelimiter = getParamStyleDelimiter(queryStyle, "username", true);
+ QVariantList array = username.toArray().toVariantList();
+ if (array.size() > 0) {
+ paramString = "username" + querySuffix;
+ if (true) {
+ for (const auto &value: array)
+ paramString.append(::OpenAPI::toStringValue(value) + queryDelimiter);
+ paramString.chop(queryDelimiter.size());
+ } else {
+ paramString.append(::OpenAPI::toStringValue(array, queryDelimiter));
+ }
+ }
+ } break;
+ case QJsonValue::Object:
+ {
+ QVariantMap map = username.toObject().toVariantMap();
+ if (map.size() > 0)
+ paramString.append(::OpenAPI::toStringValue(map, assignOperator, queryDelimiter));
+ } break;
+ case QJsonValue::Null:
+ {
+ paramString.append(QString("username") + assignOperator + QString("null"));
+ } break;
+ case QJsonValue::Undefined:
+ {
+ paramString = "";
+ qWarning() << "Query parameter serialization is not supported for the value: " << username;
+ } break;
+ }
+
+ fullPath.append(QUrl::toPercentEncoding(paramString));
+
+ }
+ OAIHttpRequestInput input(fullPath, "GET");
+ QByteArray requestContent;
+ QNetworkRequest request
+ = OAIHttpRequestWorker::getNetworkRequest(input, requestContent, m_networkFactory,
+ m_isResponseCompressionEnabled, m_isRequestCompressionEnabled);
+ QNetworkReply *reply = execute(input, request, requestContent);
+ if (reply != nullptr) {
+ reply->setParent(this);
+ m_callerData.insert(reply, OAICallerInfo{context, slot});
+ connect(reply, &QNetworkReply::finished, this, [this, reply] {
+ logoutUserCallback(QRestReply(reply));
+ });
+ connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
+ if (reply) {
+ emit logoutUserErrorOccurred(reply->error(), reply->errorString());
+ OAICallerInfo callerInfo = m_callerData.take(reply);
+ if (callerInfo.slot) {
+ QRestReply restRepl(reply);
+ void *argv[] = { nullptr, &restRepl };
+ QObject *context = callerInfo.contextObject ? const_cast<QObject*>(callerInfo.contextObject) : nullptr;
+ callerInfo.slot->call(context, argv);
+ }
+ }
+ });
+ }
+ }
+
+ void OAIUserApi::logoutUserCallback(const QRestReply &reply)
+ {
+ auto netReply = reply.networkReply();
+ if (netReply)
+ disconnect(netReply, nullptr, nullptr, nullptr);
+ if (!reply.isSuccess())
+ return;
+
+ // Check if callback is provided
+ OAICallerInfo callerInfo = m_callerData.take(netReply);
+ if (callerInfo.slot) {
+ void *argv[] = { nullptr, const_cast<QRestReply*>(&reply) };
+ QObject *context = callerInfo.contextObject
+ ? const_cast<QObject*>(callerInfo.contextObject) : nullptr;
+ callerInfo.slot->call(context, argv);
+ }
+ emit logoutUserFinished();
+ }
+
+ /**
+ * \fn virtual void OAIUserApi::updateUser(const QString &username, const OAIUser &body)
+ * 'updateUser' operation sends the request to a server.
+ * The request parameters are defined by a specification file.
+
+ * @param[in] username QString [required]
+ * @param[in] body OAIUser [required]
+ */
+
+ /**
+ * \fn template < Functor, > void OAIUserApi::updateUser(const QString &username, const OAIUser &body, const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
+ * 'updateUser' operation sends the request to a server.
+ * The request parameters are defined by a specification file.
+ *
+ * \attention Use the operation with following parameters in the callback:
+ * \code {c++}
+ * updateUser(username, body, this, [&](QRestReply &reply, OAIUser &summary) { if (reply.isSuccess()) ... });
+ * \endcode
+ * \note The template function can not be virtual in C++17.
+ * If you want to use 'makeOperationsVirtual' option for mocking API,
+ * please override virtual updateUserWithDataImpl() in derived class.
+ * The virtual updateUserWithDataImpl() is being called by the template
+ * function.
+
+ * @param[in] username QString [required]
+ * @param[in] body OAIUser [required]
+ * @param[in] context const ContextTypeForFunctor< Functor > * [optional]
+ * @param[in] callback Functor && [optional]
+ */
+
+ /**
+ * \fn void OAIUserApi::updateUserCallback(const QRestReply &reply)
+ * Processes a \a reply response from a server.
+ * The result of processed data is emitted by updateUserFinished() or
+ * being returned as a callback parameter of updateUser() request.
+ * @param[in] reply const QRestReply &
+ */
+
+ /**
+ * \fn virtual void OAIUserApi::updateUserWithDataImpl(const QString &username, const OAIUser &body, const QObject *context, QtPrivate::QSlotObjectBase *slot)
+ * Implements the updateUser() operation request.
+ * \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
+ * and can be overloaded for mocking updateUser() operation calls.
+
+ * @param[in] username QString [required]
+ * @param[in] body OAIUser [required]
+ * @param[in] context const QObject * [optional]
+ * @param[in] slot QtPrivate::QSlotObjectBase * [optional]
+ */
+ void OAIUserApi::updateUserWithDataImpl(const QString &username, const OAIUser &body, const QObject *context, QtPrivate::QSlotObjectBase *slot)
+ {
+ const QUrl serverUrl = m_serverConfigs["updateUser"][m_serverIndices.value("updateUser")].serverUrl();
+ QString fullPath = "/user/{username}";
+ m_networkFactory->setBaseUrl(serverUrl);
+ if (m_apiKeys.contains("api_key"_L1)) {
+ setHeader("api_key"_L1, QAnyStringView(m_apiKeys.find("api_key"_L1).value()));
+ }
+
+ QString usernamePathParam("{");
+ usernamePathParam.append("username").append("}");
+ QString pathPrefix, pathSuffix, pathDelimiter;
+ QString pathStyle = "simple";
+ if (pathStyle == "")
+ pathStyle = "simple";
+ pathPrefix = getParamStylePrefix(pathStyle);
+ pathSuffix = getParamStyleSuffix(pathStyle);
+ pathDelimiter = getParamStyleDelimiter(pathStyle, "username", false);
+
+ QString paramString = (pathStyle == "matrix") ? pathPrefix + "username" + pathSuffix : pathPrefix;
+ fullPath.replace(usernamePathParam, QUrl::toPercentEncoding(paramString + ::OpenAPI::toStringValue(username)));
+ QString queryPrefix, querySuffix, queryDelimiter, queryStyle;
+ queryStyle = "form";
+ if (queryStyle == "")
+ queryStyle = "form";
+ queryPrefix = getParamStylePrefix(queryStyle);
+ querySuffix = getParamStyleSuffix(queryStyle);
+ {
+ if (fullPath.indexOf("?") > 0)
+ fullPath.append(queryPrefix);
+ else
+ fullPath.append("?");
+ QString paramString = (queryStyle == "form" && true) ? "" : "body" + querySuffix;
+ QString assignOperator;
+ if (queryStyle == "form")
+ assignOperator = (true) ? "=" : ",";
+ else if (queryStyle == "deepObject")
+ assignOperator = (true) ? "=" : "none";
+ queryDelimiter = ((queryStyle == "form" || queryStyle == "deepObject") && true) ? "&" : ",";
+ const QJsonObject parameter = body.asJsonObject();
+ qint32 count = 0;
+ for(const QString& key : parameter.keys()) {
+ if (count > 0)
+ paramString.append(queryDelimiter);
+ paramString.append(::OpenAPI::optionParameterToString(((queryStyle == "form") ? key
+ : QString("body") + QString("[") + key + QString("]")), assignOperator, parameter.value(key)));
+ count++;
+ }
+
+
+ fullPath.append(QUrl::toPercentEncoding(paramString));
+
+ }
+ OAIHttpRequestInput input(fullPath, "PUT");
+ QByteArray requestContent;
+ QNetworkRequest request
+ = OAIHttpRequestWorker::getNetworkRequest(input, requestContent, m_networkFactory,
+ m_isResponseCompressionEnabled, m_isRequestCompressionEnabled);
+ QNetworkReply *reply = execute(input, request, requestContent);
+ if (reply != nullptr) {
+ reply->setParent(this);
+ m_callerData.insert(reply, OAICallerInfo{context, slot});
+ connect(reply, &QNetworkReply::finished, this, [this, reply] {
+ updateUserCallback(QRestReply(reply));
+ });
+ connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
+ if (reply) {
+ emit updateUserErrorOccurred(reply->error(), reply->errorString());
+ OAICallerInfo callerInfo = m_callerData.take(reply);
+ if (callerInfo.slot) {
+ OAIUser empty;
+ QRestReply restRepl(reply);
+ void *argv[] = { nullptr, &restRepl, &empty };
+ QObject *context = callerInfo.contextObject ? const_cast<QObject*>(callerInfo.contextObject) : nullptr;
+ callerInfo.slot->call(context, argv);
+ }
+ }
+ });
+ }
+ }
+
+ void OAIUserApi::updateUserCallback(const QRestReply &reply)
+ {
+ auto netReply = reply.networkReply();
+ if (netReply)
+ disconnect(netReply, nullptr, nullptr, nullptr);
+ if (!reply.isSuccess())
+ return;
+
+ const QByteArray &response = OAIHttpRequestWorker::parseResponse(reply, m_workingDirectory);
+ OAIUser output(response);
+ // Check if callback is provided
+ OAICallerInfo callerInfo = m_callerData.take(netReply);
+ if (callerInfo.slot) {
+ void *argv[] = { nullptr, const_cast<QRestReply*>(&reply), &output };
+ QObject *context = callerInfo.contextObject
+ ? const_cast<QObject*>(callerInfo.contextObject) : nullptr;
+ callerInfo.slot->call(context, argv);
+ }
+ emit updateUserFinished(output);
+ }
+
+ } // namespace OpenAPI