Revision control
Copy as Markdown
/**
* Operation Parameters Test
*
* Do not edit the class manually.
*/
#include "OAITestApi.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 {
OAITestApi::OAITestApi(QObject *parent)
: OAIBaseApi(parent)
{
initializeServerConfigs();
}
OAITestApi::~OAITestApi()
{
}
void OAITestApi::initializeServerConfigs()
{
//Default server
QList<OAIServerConfiguration> defaultConf = QList<OAIServerConfiguration>();
//varying endpoint server
defaultConf.append(OAIServerConfiguration(
"No description provided",
QMap<QString, OAIServerVariable>()));
m_serverConfigs.insert("deepObjectExplodeObject", defaultConf);
m_serverIndices.insert("deepObjectExplodeObject", 0);
m_serverConfigs.insert("deepObjectNotExplodeObject", defaultConf);
m_serverIndices.insert("deepObjectNotExplodeObject", 0);
m_serverConfigs.insert("formExplodeAnytype", defaultConf);
m_serverIndices.insert("formExplodeAnytype", 0);
m_serverConfigs.insert("formExplodeArray", defaultConf);
m_serverIndices.insert("formExplodeArray", 0);
m_serverConfigs.insert("formExplodeDifferentOptions", defaultConf);
m_serverIndices.insert("formExplodeDifferentOptions", 0);
m_serverConfigs.insert("formExplodeObject", defaultConf);
m_serverIndices.insert("formExplodeObject", 0);
m_serverConfigs.insert("formExplodeString", defaultConf);
m_serverIndices.insert("formExplodeString", 0);
m_serverConfigs.insert("formExplodeStringOptions", defaultConf);
m_serverIndices.insert("formExplodeStringOptions", 0);
m_serverConfigs.insert("formNotExplodeAnytype", defaultConf);
m_serverIndices.insert("formNotExplodeAnytype", 0);
m_serverConfigs.insert("formNotExplodeArray", defaultConf);
m_serverIndices.insert("formNotExplodeArray", 0);
m_serverConfigs.insert("formNotExplodeObject", defaultConf);
m_serverIndices.insert("formNotExplodeObject", 0);
m_serverConfigs.insert("formNotExplodeString", defaultConf);
m_serverIndices.insert("formNotExplodeString", 0);
m_serverConfigs.insert("labelExplodeAnytype", defaultConf);
m_serverIndices.insert("labelExplodeAnytype", 0);
m_serverConfigs.insert("labelExplodeArray", defaultConf);
m_serverIndices.insert("labelExplodeArray", 0);
m_serverConfigs.insert("labelExplodeObject", defaultConf);
m_serverIndices.insert("labelExplodeObject", 0);
m_serverConfigs.insert("labelExplodeString", defaultConf);
m_serverIndices.insert("labelExplodeString", 0);
m_serverConfigs.insert("labelNotExplodeAnytype", defaultConf);
m_serverIndices.insert("labelNotExplodeAnytype", 0);
m_serverConfigs.insert("labelNotExplodeArray", defaultConf);
m_serverIndices.insert("labelNotExplodeArray", 0);
m_serverConfigs.insert("labelNotExplodeObject", defaultConf);
m_serverIndices.insert("labelNotExplodeObject", 0);
m_serverConfigs.insert("labelNotExplodeString", defaultConf);
m_serverIndices.insert("labelNotExplodeString", 0);
m_serverConfigs.insert("matrixExplodeAnytype", defaultConf);
m_serverIndices.insert("matrixExplodeAnytype", 0);
m_serverConfigs.insert("matrixExplodeArray", defaultConf);
m_serverIndices.insert("matrixExplodeArray", 0);
m_serverConfigs.insert("matrixExplodeObject", defaultConf);
m_serverIndices.insert("matrixExplodeObject", 0);
m_serverConfigs.insert("matrixExplodeString", defaultConf);
m_serverIndices.insert("matrixExplodeString", 0);
m_serverConfigs.insert("matrixNotExplodeAnytype", defaultConf);
m_serverIndices.insert("matrixNotExplodeAnytype", 0);
m_serverConfigs.insert("matrixNotExplodeArray", defaultConf);
m_serverIndices.insert("matrixNotExplodeArray", 0);
m_serverConfigs.insert("matrixNotExplodeObject", defaultConf);
m_serverIndices.insert("matrixNotExplodeObject", 0);
m_serverConfigs.insert("matrixNotExplodeString", defaultConf);
m_serverIndices.insert("matrixNotExplodeString", 0);
m_serverConfigs.insert("pipeDelimitedExplodeAnytype", defaultConf);
m_serverIndices.insert("pipeDelimitedExplodeAnytype", 0);
m_serverConfigs.insert("pipeDelimitedExplodeArray", defaultConf);
m_serverIndices.insert("pipeDelimitedExplodeArray", 0);
m_serverConfigs.insert("pipeDelimitedExplodeObject", defaultConf);
m_serverIndices.insert("pipeDelimitedExplodeObject", 0);
m_serverConfigs.insert("pipeDelimitedNotExplodeAnytype", defaultConf);
m_serverIndices.insert("pipeDelimitedNotExplodeAnytype", 0);
m_serverConfigs.insert("pipeDelimitedNotExplodeArray", defaultConf);
m_serverIndices.insert("pipeDelimitedNotExplodeArray", 0);
m_serverConfigs.insert("pipeDelimitedNotExplodeObject", defaultConf);
m_serverIndices.insert("pipeDelimitedNotExplodeObject", 0);
m_serverConfigs.insert("simpleExplodeAnytype", defaultConf);
m_serverIndices.insert("simpleExplodeAnytype", 0);
m_serverConfigs.insert("simpleExplodeArray", defaultConf);
m_serverIndices.insert("simpleExplodeArray", 0);
m_serverConfigs.insert("simpleExplodeObject", defaultConf);
m_serverIndices.insert("simpleExplodeObject", 0);
m_serverConfigs.insert("simpleExplodeString", defaultConf);
m_serverIndices.insert("simpleExplodeString", 0);
m_serverConfigs.insert("simpleNotExplodeAnytype", defaultConf);
m_serverIndices.insert("simpleNotExplodeAnytype", 0);
m_serverConfigs.insert("simpleNotExplodeArray", defaultConf);
m_serverIndices.insert("simpleNotExplodeArray", 0);
m_serverConfigs.insert("simpleNotExplodeObject", defaultConf);
m_serverIndices.insert("simpleNotExplodeObject", 0);
m_serverConfigs.insert("simpleNotExplodeString", defaultConf);
m_serverIndices.insert("simpleNotExplodeString", 0);
m_serverConfigs.insert("spaceDelimitedExplodeAnytype", defaultConf);
m_serverIndices.insert("spaceDelimitedExplodeAnytype", 0);
m_serverConfigs.insert("spaceDelimitedExplodeArray", defaultConf);
m_serverIndices.insert("spaceDelimitedExplodeArray", 0);
m_serverConfigs.insert("spaceDelimitedExplodeObject", defaultConf);
m_serverIndices.insert("spaceDelimitedExplodeObject", 0);
m_serverConfigs.insert("spaceDelimitedNotExplodeAnytype", defaultConf);
m_serverIndices.insert("spaceDelimitedNotExplodeAnytype", 0);
m_serverConfigs.insert("spaceDelimitedNotExplodeArray", defaultConf);
m_serverIndices.insert("spaceDelimitedNotExplodeArray", 0);
m_serverConfigs.insert("spaceDelimitedNotExplodeObject", defaultConf);
m_serverIndices.insert("spaceDelimitedNotExplodeObject", 0);
}
/**
* \fn virtual void OAITestApi::deepObjectExplodeObject(const OAITestObject &objectParameter)
* 'deepObjectExplodeObject' operation sends the request to a server.
* The request parameters are defined by a specification file.
* @param[in] objectParameter OAITestObject [required]
*/
/**
* \fn template < Functor, > void OAITestApi::deepObjectExplodeObject(const OAITestObject &objectParameter, const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
* 'deepObjectExplodeObject' 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++}
* deepObjectExplodeObject(objectParameter, this, [&](const QRestReply &reply, const 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 deepObjectExplodeObjectWithDataImpl() in derived class.
* The virtual deepObjectExplodeObjectWithDataImpl() is being called by the template
* function.
* @param[in] objectParameter OAITestObject [required]
* @param[in] context const ContextTypeForFunctor< Functor > * [optional]
* @param[in] callback Functor && [optional]
*/
/**
* \fn void OAITestApi::deepObjectExplodeObjectCallback(const QRestReply &reply)
* Processes a \a reply response from a server.
* The result of processed data is emitted by deepObjectExplodeObjectFinished() or
* being returned as a callback parameter of deepObjectExplodeObject() request.
* @param[in] reply const QRestReply &
*/
/**
* \fn virtual void OAITestApi::deepObjectExplodeObjectWithDataImpl(const OAITestObject &objectParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
* Implements the deepObjectExplodeObject() operation request.
* \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
* and can be overloaded for mocking deepObjectExplodeObject() operation calls.
* @param[in] objectParameter OAITestObject [required]
* @param[in] context const QObject * [optional]
* @param[in] slot QtPrivate::QSlotObjectBase * [optional]
*/
void OAITestApi::deepObjectExplodeObjectWithDataImpl(const OAITestObject &objectParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
{
const QUrl serverUrl = m_serverConfigs["deepObjectExplodeObject"][m_serverIndices.value("deepObjectExplodeObject")].serverUrl();
QString fullPath = "/query/object/deepObject-explode/deepObjectExplodeObject";
m_networkFactory->setBaseUrl(serverUrl);
int queryParamCounter = 0;
{
[[maybe_unused]] QString paramString;
QString queryStyle = "deepObject";
if (queryStyle.isEmpty())
queryStyle = "form";
const QString queryPrefix = getParamStylePrefix(queryStyle);
[[maybe_unused]] const QString queryDelimiter = getParamStyleDelimiter(queryStyle, true);
const QString querySuffix = getParamStyleSuffix(queryStyle, u"objectParameter"_s, true, (!false && !false));
[[maybe_unused]] const QString queryAssignOperator = getParamStyleAssignOperator(queryStyle, true, (!false && !false));
paramString = querySuffix;
if ((fullPath.indexOf("?") != fullPath.size() - 1) && (queryParamCounter == 0))
fullPath.append(queryPrefix);
{
if (queryParamCounter > 0)
fullPath.append("&");
const QJsonObject parameter = objectParameter.asJsonObject();
if (queryStyle == "deepObject") {
qint32 index = 0;
if (parameter.isEmpty())
qWarning() << "Serialized QJsonValue::Object is empty!";
for (const QString& key : parameter.keys()) {
if (index > 0)
paramString.append(queryDelimiter);
paramString.append(::OpenAPI::optionParameterToString(QString("objectParameter") + QString("[") + key + QString("]"), queryAssignOperator, parameter.value(key)));
index++;
}
} else {
paramString = serializeJsonValue(QJsonValue(parameter), queryStyle, true, querySuffix, queryAssignOperator, queryDelimiter);
}
// style=form && explode=true && non-object => 'objectParameter' isn't used in serialization
// style=form && explode=true && empty object => need to be 'objectParameter='
if (paramString.isEmpty() && queryStyle == "form")
paramString = u"objectParameter="_s;
fullPath.append(paramString);
queryParamCounter++;
}
}
// set m_testOperationPath for serialization tests
m_testOperationPath = fullPath;
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] {
deepObjectExplodeObjectCallback(QRestReply(reply));
});
connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
if (reply) {
emit deepObjectExplodeObjectErrorOccurred(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 OAITestApi::deepObjectExplodeObjectCallback(const QRestReply &reply)
{
auto netReply = reply.networkReply();
if (netReply)
netReply->disconnect(this);
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 deepObjectExplodeObjectFinished(output);
}
/**
* \fn virtual void OAITestApi::deepObjectNotExplodeObject(const ::OpenAPI::OptionalParam<OAITestObject> &objectParameter = ::OpenAPI::OptionalParam<OAITestObject>())
* 'deepObjectNotExplodeObject' operation sends the request to a server.
* The request parameters are defined by a specification file.
* @param[in] objectParameter OAITestObject [optional]
*/
/**
* \fn template < Functor, > void OAITestApi::deepObjectNotExplodeObject(const ::OpenAPI::OptionalParam<OAITestObject> &objectParameter = ::OpenAPI::OptionalParam<OAITestObject>(), const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
* 'deepObjectNotExplodeObject' 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++}
* deepObjectNotExplodeObject(objectParameter, this, [&](const QRestReply &reply, const 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 deepObjectNotExplodeObjectWithDataImpl() in derived class.
* The virtual deepObjectNotExplodeObjectWithDataImpl() is being called by the template
* function.
* @param[in] objectParameter OAITestObject [optional]
* @param[in] context const ContextTypeForFunctor< Functor > * [optional]
* @param[in] callback Functor && [optional]
*/
/**
* \fn void OAITestApi::deepObjectNotExplodeObjectCallback(const QRestReply &reply)
* Processes a \a reply response from a server.
* The result of processed data is emitted by deepObjectNotExplodeObjectFinished() or
* being returned as a callback parameter of deepObjectNotExplodeObject() request.
* @param[in] reply const QRestReply &
*/
/**
* \fn virtual void OAITestApi::deepObjectNotExplodeObjectWithDataImpl(const ::OpenAPI::OptionalParam<OAITestObject> &objectParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
* Implements the deepObjectNotExplodeObject() operation request.
* \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
* and can be overloaded for mocking deepObjectNotExplodeObject() operation calls.
* @param[in] objectParameter OAITestObject [optional]
* @param[in] context const QObject * [optional]
* @param[in] slot QtPrivate::QSlotObjectBase * [optional]
*/
void OAITestApi::deepObjectNotExplodeObjectWithDataImpl(const ::OpenAPI::OptionalParam<OAITestObject> &objectParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
{
const QUrl serverUrl = m_serverConfigs["deepObjectNotExplodeObject"][m_serverIndices.value("deepObjectNotExplodeObject")].serverUrl();
QString fullPath = "/query/object/deepObject-not-explode/deepObjectNotExplodeObject";
m_networkFactory->setBaseUrl(serverUrl);
int queryParamCounter = 0;
{
[[maybe_unused]] QString paramString;
QString queryStyle = "deepObject";
if (queryStyle.isEmpty())
queryStyle = "form";
const QString queryPrefix = getParamStylePrefix(queryStyle);
[[maybe_unused]] const QString queryDelimiter = getParamStyleDelimiter(queryStyle, false);
const QString querySuffix = getParamStyleSuffix(queryStyle, u"objectParameter"_s, false, (!false && !false));
[[maybe_unused]] const QString queryAssignOperator = getParamStyleAssignOperator(queryStyle, false, (!false && !false));
paramString = querySuffix;
if ((fullPath.indexOf("?") != fullPath.size() - 1) && (queryParamCounter == 0))
fullPath.append(queryPrefix);
if (objectParameter.hasValue()) {
if (queryParamCounter > 0)
fullPath.append("&");
const QJsonObject parameter = objectParameter.value().asJsonObject();
if (queryStyle == "deepObject") {
qint32 index = 0;
if (parameter.isEmpty())
qWarning() << "Serialized QJsonValue::Object is empty!";
for (const QString& key : parameter.keys()) {
if (index > 0)
paramString.append(queryDelimiter);
paramString.append(::OpenAPI::optionParameterToString(QString("objectParameter") + QString("[") + key + QString("]"), queryAssignOperator, parameter.value(key)));
index++;
}
} else {
paramString = serializeJsonValue(QJsonValue(parameter), queryStyle, false, querySuffix, queryAssignOperator, queryDelimiter);
}
// style=form && explode=true && non-object => 'objectParameter' isn't used in serialization
// style=form && explode=true && empty object => need to be 'objectParameter='
if (paramString.isEmpty() && queryStyle == "form")
paramString = u"objectParameter="_s;
fullPath.append(paramString);
queryParamCounter++;
}
}
// set m_testOperationPath for serialization tests
m_testOperationPath = fullPath;
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] {
deepObjectNotExplodeObjectCallback(QRestReply(reply));
});
connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
if (reply) {
emit deepObjectNotExplodeObjectErrorOccurred(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 OAITestApi::deepObjectNotExplodeObjectCallback(const QRestReply &reply)
{
auto netReply = reply.networkReply();
if (netReply)
netReply->disconnect(this);
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 deepObjectNotExplodeObjectFinished(output);
}
/**
* \fn virtual void OAITestApi::formExplodeAnytype(const QJsonValue &anytypeParameter)
* 'formExplodeAnytype' operation sends the request to a server.
* The request parameters are defined by a specification file.
* @param[in] anytypeParameter QJsonValue [required]
*/
/**
* \fn template < Functor, > void OAITestApi::formExplodeAnytype(const QJsonValue &anytypeParameter, const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
* 'formExplodeAnytype' 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++}
* formExplodeAnytype(anytypeParameter, this, [&](const QRestReply &reply, const 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 formExplodeAnytypeWithDataImpl() in derived class.
* The virtual formExplodeAnytypeWithDataImpl() is being called by the template
* function.
* @param[in] anytypeParameter QJsonValue [required]
* @param[in] context const ContextTypeForFunctor< Functor > * [optional]
* @param[in] callback Functor && [optional]
*/
/**
* \fn void OAITestApi::formExplodeAnytypeCallback(const QRestReply &reply)
* Processes a \a reply response from a server.
* The result of processed data is emitted by formExplodeAnytypeFinished() or
* being returned as a callback parameter of formExplodeAnytype() request.
* @param[in] reply const QRestReply &
*/
/**
* \fn virtual void OAITestApi::formExplodeAnytypeWithDataImpl(const QJsonValue &anytypeParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
* Implements the formExplodeAnytype() operation request.
* \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
* and can be overloaded for mocking formExplodeAnytype() operation calls.
* @param[in] anytypeParameter QJsonValue [required]
* @param[in] context const QObject * [optional]
* @param[in] slot QtPrivate::QSlotObjectBase * [optional]
*/
void OAITestApi::formExplodeAnytypeWithDataImpl(const QJsonValue &anytypeParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
{
const QUrl serverUrl = m_serverConfigs["formExplodeAnytype"][m_serverIndices.value("formExplodeAnytype")].serverUrl();
QString fullPath = "/query/anytype/form-explode/formExplodeAnytype";
m_networkFactory->setBaseUrl(serverUrl);
int queryParamCounter = 0;
{
[[maybe_unused]] QString paramString;
QString queryStyle = "form";
if (queryStyle.isEmpty())
queryStyle = "form";
const QString queryPrefix = getParamStylePrefix(queryStyle);
[[maybe_unused]] const QString queryDelimiter = getParamStyleDelimiter(queryStyle, true);
const QString querySuffix = getParamStyleSuffix(queryStyle, u"anytypeParameter"_s, true, anytypeParameter.type() == QJsonValue::Object);
const QString queryAssignOperator = getParamStyleAssignOperator(queryStyle, true, anytypeParameter.type() == QJsonValue::Object);
if ((fullPath.indexOf("?") != fullPath.size() - 1) && (queryParamCounter == 0))
fullPath.append(queryPrefix);
{
if (queryParamCounter > 0)
fullPath.append("&");
paramString = serializeJsonValue(anytypeParameter, queryStyle, true, querySuffix, queryAssignOperator, queryDelimiter);
fullPath.append(paramString);
queryParamCounter++;
}
}
// set m_testOperationPath for serialization tests
m_testOperationPath = fullPath;
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] {
formExplodeAnytypeCallback(QRestReply(reply));
});
connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
if (reply) {
emit formExplodeAnytypeErrorOccurred(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 OAITestApi::formExplodeAnytypeCallback(const QRestReply &reply)
{
auto netReply = reply.networkReply();
if (netReply)
netReply->disconnect(this);
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 formExplodeAnytypeFinished(output);
}
/**
* \fn virtual void OAITestApi::formExplodeArray(const QList<qint32> &arrayParameter)
* 'formExplodeArray' operation sends the request to a server.
* The request parameters are defined by a specification file.
* @param[in] arrayParameter QList<qint32> [required]
*/
/**
* \fn template < Functor, > void OAITestApi::formExplodeArray(const QList<qint32> &arrayParameter, const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
* 'formExplodeArray' 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++}
* formExplodeArray(arrayParameter, this, [&](const QRestReply &reply, const 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 formExplodeArrayWithDataImpl() in derived class.
* The virtual formExplodeArrayWithDataImpl() is being called by the template
* function.
* @param[in] arrayParameter QList<qint32> [required]
* @param[in] context const ContextTypeForFunctor< Functor > * [optional]
* @param[in] callback Functor && [optional]
*/
/**
* \fn void OAITestApi::formExplodeArrayCallback(const QRestReply &reply)
* Processes a \a reply response from a server.
* The result of processed data is emitted by formExplodeArrayFinished() or
* being returned as a callback parameter of formExplodeArray() request.
* @param[in] reply const QRestReply &
*/
/**
* \fn virtual void OAITestApi::formExplodeArrayWithDataImpl(const QList<qint32> &arrayParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
* Implements the formExplodeArray() operation request.
* \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
* and can be overloaded for mocking formExplodeArray() operation calls.
* @param[in] arrayParameter QList<qint32> [required]
* @param[in] context const QObject * [optional]
* @param[in] slot QtPrivate::QSlotObjectBase * [optional]
*/
void OAITestApi::formExplodeArrayWithDataImpl(const QList<qint32> &arrayParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
{
const QUrl serverUrl = m_serverConfigs["formExplodeArray"][m_serverIndices.value("formExplodeArray")].serverUrl();
QString fullPath = "/query/array/form-explode/formExplodeArray";
m_networkFactory->setBaseUrl(serverUrl);
int queryParamCounter = 0;
{
[[maybe_unused]] QString paramString;
QString queryStyle = "form";
if (queryStyle.isEmpty())
queryStyle = "form";
const QString queryPrefix = getParamStylePrefix(queryStyle);
[[maybe_unused]] const QString queryDelimiter = getParamStyleDelimiter(queryStyle, true);
const QString querySuffix = getParamStyleSuffix(queryStyle, u"arrayParameter"_s, true, (!false && !true));
[[maybe_unused]] const QString queryAssignOperator = getParamStyleAssignOperator(queryStyle, true, (!false && !true));
if ((fullPath.indexOf("?") != fullPath.size() - 1) && (queryParamCounter == 0))
fullPath.append(queryPrefix);
{
if (queryParamCounter > 0)
fullPath.append("&");
fullPath.append(serializeArrayValue(arrayParameter, queryStyle, true, querySuffix, queryDelimiter));
queryParamCounter++;
}
}
// set m_testOperationPath for serialization tests
m_testOperationPath = fullPath;
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] {
formExplodeArrayCallback(QRestReply(reply));
});
connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
if (reply) {
emit formExplodeArrayErrorOccurred(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 OAITestApi::formExplodeArrayCallback(const QRestReply &reply)
{
auto netReply = reply.networkReply();
if (netReply)
netReply->disconnect(this);
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 formExplodeArrayFinished(output);
}
/**
* \fn virtual void OAITestApi::formExplodeDifferentOptions(const qint32 &stringParameterB, const ::OpenAPI::OptionalParam<OAITestObject> &objectParameter = ::OpenAPI::OptionalParam<OAITestObject>())
* 'formExplodeDifferentOptions' operation sends the request to a server.
* The request parameters are defined by a specification file.
* @param[in] stringParameterB qint32 [required]
* @param[in] objectParameter OAITestObject [optional]
*/
/**
* \fn template < Functor, > void OAITestApi::formExplodeDifferentOptions(const qint32 &stringParameterB, const ::OpenAPI::OptionalParam<OAITestObject> &objectParameter = ::OpenAPI::OptionalParam<OAITestObject>(), const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
* 'formExplodeDifferentOptions' 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++}
* formExplodeDifferentOptions(stringParameterB, objectParameter, this, [&](const QRestReply &reply, const 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 formExplodeDifferentOptionsWithDataImpl() in derived class.
* The virtual formExplodeDifferentOptionsWithDataImpl() is being called by the template
* function.
* @param[in] stringParameterB qint32 [required]
* @param[in] objectParameter OAITestObject [optional]
* @param[in] context const ContextTypeForFunctor< Functor > * [optional]
* @param[in] callback Functor && [optional]
*/
/**
* \fn void OAITestApi::formExplodeDifferentOptionsCallback(const QRestReply &reply)
* Processes a \a reply response from a server.
* The result of processed data is emitted by formExplodeDifferentOptionsFinished() or
* being returned as a callback parameter of formExplodeDifferentOptions() request.
* @param[in] reply const QRestReply &
*/
/**
* \fn virtual void OAITestApi::formExplodeDifferentOptionsWithDataImpl(const qint32 &stringParameterB, const ::OpenAPI::OptionalParam<OAITestObject> &objectParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
* Implements the formExplodeDifferentOptions() operation request.
* \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
* and can be overloaded for mocking formExplodeDifferentOptions() operation calls.
* @param[in] stringParameterB qint32 [required]
* @param[in] objectParameter OAITestObject [optional]
* @param[in] context const QObject * [optional]
* @param[in] slot QtPrivate::QSlotObjectBase * [optional]
*/
void OAITestApi::formExplodeDifferentOptionsWithDataImpl(const qint32 &stringParameterB, const ::OpenAPI::OptionalParam<OAITestObject> &objectParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
{
const QUrl serverUrl = m_serverConfigs["formExplodeDifferentOptions"][m_serverIndices.value("formExplodeDifferentOptions")].serverUrl();
QString fullPath = "/query/strings/form-explode/formExplodeDifferentOptions";
m_networkFactory->setBaseUrl(serverUrl);
int queryParamCounter = 0;
{
[[maybe_unused]] QString paramString;
QString queryStyle = "form";
if (queryStyle.isEmpty())
queryStyle = "form";
const QString queryPrefix = getParamStylePrefix(queryStyle);
[[maybe_unused]] const QString queryDelimiter = getParamStyleDelimiter(queryStyle, true);
const QString querySuffix = getParamStyleSuffix(queryStyle, u"objectParameter"_s, true, (!false && !false));
[[maybe_unused]] const QString queryAssignOperator = getParamStyleAssignOperator(queryStyle, true, (!false && !false));
paramString = querySuffix;
if ((fullPath.indexOf("?") != fullPath.size() - 1) && (queryParamCounter == 0))
fullPath.append(queryPrefix);
if (objectParameter.hasValue()) {
if (queryParamCounter > 0)
fullPath.append("&");
const QJsonObject parameter = objectParameter.value().asJsonObject();
if (queryStyle == "deepObject") {
qint32 index = 0;
if (parameter.isEmpty())
qWarning() << "Serialized QJsonValue::Object is empty!";
for (const QString& key : parameter.keys()) {
if (index > 0)
paramString.append(queryDelimiter);
paramString.append(::OpenAPI::optionParameterToString(QString("objectParameter") + QString("[") + key + QString("]"), queryAssignOperator, parameter.value(key)));
index++;
}
} else {
paramString = serializeJsonValue(QJsonValue(parameter), queryStyle, true, querySuffix, queryAssignOperator, queryDelimiter);
}
// style=form && explode=true && non-object => 'objectParameter' isn't used in serialization
// style=form && explode=true && empty object => need to be 'objectParameter='
if (paramString.isEmpty() && queryStyle == "form")
paramString = u"objectParameter="_s;
fullPath.append(paramString);
queryParamCounter++;
}
}
{
[[maybe_unused]] QString paramString;
QString queryStyle = "form";
if (queryStyle.isEmpty())
queryStyle = "form";
const QString queryPrefix = getParamStylePrefix(queryStyle);
[[maybe_unused]] const QString queryDelimiter = getParamStyleDelimiter(queryStyle, true);
const QString querySuffix = getParamStyleSuffix(queryStyle, u"stringParameterB"_s, true, (!true && !false));
[[maybe_unused]] const QString queryAssignOperator = getParamStyleAssignOperator(queryStyle, true, (!true && !false));
paramString = querySuffix;
if ((fullPath.indexOf("?") != fullPath.size() - 1) && (queryParamCounter == 0))
fullPath.append(queryPrefix);
{
if (queryParamCounter > 0)
fullPath.append("&");
fullPath.append(querySuffix + QUrl::toPercentEncoding(::OpenAPI::toStringValue(stringParameterB)));
queryParamCounter++;
}
}
// set m_testOperationPath for serialization tests
m_testOperationPath = fullPath;
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] {
formExplodeDifferentOptionsCallback(QRestReply(reply));
});
connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
if (reply) {
emit formExplodeDifferentOptionsErrorOccurred(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 OAITestApi::formExplodeDifferentOptionsCallback(const QRestReply &reply)
{
auto netReply = reply.networkReply();
if (netReply)
netReply->disconnect(this);
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 formExplodeDifferentOptionsFinished(output);
}
/**
* \fn virtual void OAITestApi::formExplodeObject(const OAITestObject &objectParameter)
* 'formExplodeObject' operation sends the request to a server.
* The request parameters are defined by a specification file.
* @param[in] objectParameter OAITestObject [required]
*/
/**
* \fn template < Functor, > void OAITestApi::formExplodeObject(const OAITestObject &objectParameter, const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
* 'formExplodeObject' 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++}
* formExplodeObject(objectParameter, this, [&](const QRestReply &reply, const 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 formExplodeObjectWithDataImpl() in derived class.
* The virtual formExplodeObjectWithDataImpl() is being called by the template
* function.
* @param[in] objectParameter OAITestObject [required]
* @param[in] context const ContextTypeForFunctor< Functor > * [optional]
* @param[in] callback Functor && [optional]
*/
/**
* \fn void OAITestApi::formExplodeObjectCallback(const QRestReply &reply)
* Processes a \a reply response from a server.
* The result of processed data is emitted by formExplodeObjectFinished() or
* being returned as a callback parameter of formExplodeObject() request.
* @param[in] reply const QRestReply &
*/
/**
* \fn virtual void OAITestApi::formExplodeObjectWithDataImpl(const OAITestObject &objectParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
* Implements the formExplodeObject() operation request.
* \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
* and can be overloaded for mocking formExplodeObject() operation calls.
* @param[in] objectParameter OAITestObject [required]
* @param[in] context const QObject * [optional]
* @param[in] slot QtPrivate::QSlotObjectBase * [optional]
*/
void OAITestApi::formExplodeObjectWithDataImpl(const OAITestObject &objectParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
{
const QUrl serverUrl = m_serverConfigs["formExplodeObject"][m_serverIndices.value("formExplodeObject")].serverUrl();
QString fullPath = "/query/object/form-explode/formExplodeObject";
m_networkFactory->setBaseUrl(serverUrl);
int queryParamCounter = 0;
{
[[maybe_unused]] QString paramString;
QString queryStyle = "form";
if (queryStyle.isEmpty())
queryStyle = "form";
const QString queryPrefix = getParamStylePrefix(queryStyle);
[[maybe_unused]] const QString queryDelimiter = getParamStyleDelimiter(queryStyle, true);
const QString querySuffix = getParamStyleSuffix(queryStyle, u"objectParameter"_s, true, (!false && !false));
[[maybe_unused]] const QString queryAssignOperator = getParamStyleAssignOperator(queryStyle, true, (!false && !false));
paramString = querySuffix;
if ((fullPath.indexOf("?") != fullPath.size() - 1) && (queryParamCounter == 0))
fullPath.append(queryPrefix);
{
if (queryParamCounter > 0)
fullPath.append("&");
const QJsonObject parameter = objectParameter.asJsonObject();
if (queryStyle == "deepObject") {
qint32 index = 0;
if (parameter.isEmpty())
qWarning() << "Serialized QJsonValue::Object is empty!";
for (const QString& key : parameter.keys()) {
if (index > 0)
paramString.append(queryDelimiter);
paramString.append(::OpenAPI::optionParameterToString(QString("objectParameter") + QString("[") + key + QString("]"), queryAssignOperator, parameter.value(key)));
index++;
}
} else {
paramString = serializeJsonValue(QJsonValue(parameter), queryStyle, true, querySuffix, queryAssignOperator, queryDelimiter);
}
// style=form && explode=true && non-object => 'objectParameter' isn't used in serialization
// style=form && explode=true && empty object => need to be 'objectParameter='
if (paramString.isEmpty() && queryStyle == "form")
paramString = u"objectParameter="_s;
fullPath.append(paramString);
queryParamCounter++;
}
}
// set m_testOperationPath for serialization tests
m_testOperationPath = fullPath;
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] {
formExplodeObjectCallback(QRestReply(reply));
});
connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
if (reply) {
emit formExplodeObjectErrorOccurred(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 OAITestApi::formExplodeObjectCallback(const QRestReply &reply)
{
auto netReply = reply.networkReply();
if (netReply)
netReply->disconnect(this);
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 formExplodeObjectFinished(output);
}
/**
* \fn virtual void OAITestApi::formExplodeString(const ::OpenAPI::OptionalParam<QString> &stringParameter = ::OpenAPI::OptionalParam<QString>())
* 'formExplodeString' operation sends the request to a server.
* The request parameters are defined by a specification file.
* @param[in] stringParameter QString [optional]
*/
/**
* \fn template < Functor, > void OAITestApi::formExplodeString(const ::OpenAPI::OptionalParam<QString> &stringParameter = ::OpenAPI::OptionalParam<QString>(), const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
* 'formExplodeString' 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++}
* formExplodeString(stringParameter, this, [&](const QRestReply &reply, const 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 formExplodeStringWithDataImpl() in derived class.
* The virtual formExplodeStringWithDataImpl() is being called by the template
* function.
* @param[in] stringParameter QString [optional]
* @param[in] context const ContextTypeForFunctor< Functor > * [optional]
* @param[in] callback Functor && [optional]
*/
/**
* \fn void OAITestApi::formExplodeStringCallback(const QRestReply &reply)
* Processes a \a reply response from a server.
* The result of processed data is emitted by formExplodeStringFinished() or
* being returned as a callback parameter of formExplodeString() request.
* @param[in] reply const QRestReply &
*/
/**
* \fn virtual void OAITestApi::formExplodeStringWithDataImpl(const ::OpenAPI::OptionalParam<QString> &stringParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
* Implements the formExplodeString() operation request.
* \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
* and can be overloaded for mocking formExplodeString() operation calls.
* @param[in] stringParameter QString [optional]
* @param[in] context const QObject * [optional]
* @param[in] slot QtPrivate::QSlotObjectBase * [optional]
*/
void OAITestApi::formExplodeStringWithDataImpl(const ::OpenAPI::OptionalParam<QString> &stringParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
{
const QUrl serverUrl = m_serverConfigs["formExplodeString"][m_serverIndices.value("formExplodeString")].serverUrl();
QString fullPath = "/query/string/form-explode/formExplodeString";
m_networkFactory->setBaseUrl(serverUrl);
int queryParamCounter = 0;
{
[[maybe_unused]] QString paramString;
QString queryStyle = "form";
if (queryStyle.isEmpty())
queryStyle = "form";
const QString queryPrefix = getParamStylePrefix(queryStyle);
[[maybe_unused]] const QString queryDelimiter = getParamStyleDelimiter(queryStyle, true);
const QString querySuffix = getParamStyleSuffix(queryStyle, u"stringParameter"_s, true, (!true && !false));
[[maybe_unused]] const QString queryAssignOperator = getParamStyleAssignOperator(queryStyle, true, (!true && !false));
paramString = querySuffix;
if ((fullPath.indexOf("?") != fullPath.size() - 1) && (queryParamCounter == 0))
fullPath.append(queryPrefix);
if (stringParameter.hasValue()) {
if (queryParamCounter > 0)
fullPath.append("&");
fullPath.append(querySuffix + QUrl::toPercentEncoding(::OpenAPI::toStringValue(stringParameter.value())));
queryParamCounter++;
}
}
// set m_testOperationPath for serialization tests
m_testOperationPath = fullPath;
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] {
formExplodeStringCallback(QRestReply(reply));
});
connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
if (reply) {
emit formExplodeStringErrorOccurred(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 OAITestApi::formExplodeStringCallback(const QRestReply &reply)
{
auto netReply = reply.networkReply();
if (netReply)
netReply->disconnect(this);
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 formExplodeStringFinished(output);
}
/**
* \fn virtual void OAITestApi::formExplodeStringOptions(const QString &stringParameterB, const ::OpenAPI::OptionalParam<QString> &stringParameterA = ::OpenAPI::OptionalParam<QString>(), const ::OpenAPI::OptionalParam<qint32> &stringParameterC = ::OpenAPI::OptionalParam<qint32>())
* 'formExplodeStringOptions' operation sends the request to a server.
* The request parameters are defined by a specification file.
* @param[in] stringParameterB QString [required]
* @param[in] stringParameterA QString [optional]
* @param[in] stringParameterC qint32 [optional]
*/
/**
* \fn template < Functor, > void OAITestApi::formExplodeStringOptions(const QString &stringParameterB, const ::OpenAPI::OptionalParam<QString> &stringParameterA = ::OpenAPI::OptionalParam<QString>(), const ::OpenAPI::OptionalParam<qint32> &stringParameterC = ::OpenAPI::OptionalParam<qint32>(), const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
* 'formExplodeStringOptions' 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++}
* formExplodeStringOptions(stringParameterB, stringParameterA, stringParameterC, this, [&](const QRestReply &reply, const 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 formExplodeStringOptionsWithDataImpl() in derived class.
* The virtual formExplodeStringOptionsWithDataImpl() is being called by the template
* function.
* @param[in] stringParameterB QString [required]
* @param[in] stringParameterA QString [optional]
* @param[in] stringParameterC qint32 [optional]
* @param[in] context const ContextTypeForFunctor< Functor > * [optional]
* @param[in] callback Functor && [optional]
*/
/**
* \fn void OAITestApi::formExplodeStringOptionsCallback(const QRestReply &reply)
* Processes a \a reply response from a server.
* The result of processed data is emitted by formExplodeStringOptionsFinished() or
* being returned as a callback parameter of formExplodeStringOptions() request.
* @param[in] reply const QRestReply &
*/
/**
* \fn virtual void OAITestApi::formExplodeStringOptionsWithDataImpl(const QString &stringParameterB, const ::OpenAPI::OptionalParam<QString> &stringParameterA, const ::OpenAPI::OptionalParam<qint32> &stringParameterC, const QObject *context, QtPrivate::QSlotObjectBase *slot)
* Implements the formExplodeStringOptions() operation request.
* \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
* and can be overloaded for mocking formExplodeStringOptions() operation calls.
* @param[in] stringParameterB QString [required]
* @param[in] stringParameterA QString [optional]
* @param[in] stringParameterC qint32 [optional]
* @param[in] context const QObject * [optional]
* @param[in] slot QtPrivate::QSlotObjectBase * [optional]
*/
void OAITestApi::formExplodeStringOptionsWithDataImpl(const QString &stringParameterB, const ::OpenAPI::OptionalParam<QString> &stringParameterA, const ::OpenAPI::OptionalParam<qint32> &stringParameterC, const QObject *context, QtPrivate::QSlotObjectBase *slot)
{
const QUrl serverUrl = m_serverConfigs["formExplodeStringOptions"][m_serverIndices.value("formExplodeStringOptions")].serverUrl();
QString fullPath = "/query/strings/form-explode/formExplodeStringOptions";
m_networkFactory->setBaseUrl(serverUrl);
int queryParamCounter = 0;
{
[[maybe_unused]] QString paramString;
QString queryStyle = "form";
if (queryStyle.isEmpty())
queryStyle = "form";
const QString queryPrefix = getParamStylePrefix(queryStyle);
[[maybe_unused]] const QString queryDelimiter = getParamStyleDelimiter(queryStyle, true);
const QString querySuffix = getParamStyleSuffix(queryStyle, u"stringParameterA"_s, true, (!true && !false));
[[maybe_unused]] const QString queryAssignOperator = getParamStyleAssignOperator(queryStyle, true, (!true && !false));
paramString = querySuffix;
if ((fullPath.indexOf("?") != fullPath.size() - 1) && (queryParamCounter == 0))
fullPath.append(queryPrefix);
if (stringParameterA.hasValue()) {
if (queryParamCounter > 0)
fullPath.append("&");
fullPath.append(querySuffix + QUrl::toPercentEncoding(::OpenAPI::toStringValue(stringParameterA.value())));
queryParamCounter++;
} else if (stringParameterA.isNull()) {
if (queryParamCounter > 0)
fullPath.append("&");
// style=form && explode=true && non-object => 'stringParameterA' isn't used in serialization
// style=form && explode=true && empty object => need to be 'stringParameterA='
if (queryStyle == "form")
fullPath.append(u"stringParameterA="_s);
else
fullPath.append(querySuffix);
queryParamCounter++;
}
}
{
[[maybe_unused]] QString paramString;
QString queryStyle = "form";
if (queryStyle.isEmpty())
queryStyle = "form";
const QString queryPrefix = getParamStylePrefix(queryStyle);
[[maybe_unused]] const QString queryDelimiter = getParamStyleDelimiter(queryStyle, true);
const QString querySuffix = getParamStyleSuffix(queryStyle, u"stringParameterB"_s, true, (!true && !false));
[[maybe_unused]] const QString queryAssignOperator = getParamStyleAssignOperator(queryStyle, true, (!true && !false));
paramString = querySuffix;
if ((fullPath.indexOf("?") != fullPath.size() - 1) && (queryParamCounter == 0))
fullPath.append(queryPrefix);
{
if (queryParamCounter > 0)
fullPath.append("&");
fullPath.append(querySuffix + QUrl::toPercentEncoding(::OpenAPI::toStringValue(stringParameterB)));
queryParamCounter++;
}
}
{
[[maybe_unused]] QString paramString;
QString queryStyle = "form";
if (queryStyle.isEmpty())
queryStyle = "form";
const QString queryPrefix = getParamStylePrefix(queryStyle);
[[maybe_unused]] const QString queryDelimiter = getParamStyleDelimiter(queryStyle, true);
const QString querySuffix = getParamStyleSuffix(queryStyle, u"stringParameterC"_s, true, (!true && !false));
[[maybe_unused]] const QString queryAssignOperator = getParamStyleAssignOperator(queryStyle, true, (!true && !false));
paramString = querySuffix;
if ((fullPath.indexOf("?") != fullPath.size() - 1) && (queryParamCounter == 0))
fullPath.append(queryPrefix);
if (stringParameterC.hasValue()) {
if (queryParamCounter > 0)
fullPath.append("&");
fullPath.append(querySuffix + QUrl::toPercentEncoding(::OpenAPI::toStringValue(stringParameterC.value())));
queryParamCounter++;
} else if (stringParameterC.isNull()) {
if (queryParamCounter > 0)
fullPath.append("&");
// style=form && explode=true && non-object => 'stringParameterC' isn't used in serialization
// style=form && explode=true && empty object => need to be 'stringParameterC='
if (queryStyle == "form")
fullPath.append(u"stringParameterC="_s);
else
fullPath.append(querySuffix);
queryParamCounter++;
}
}
// set m_testOperationPath for serialization tests
m_testOperationPath = fullPath;
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] {
formExplodeStringOptionsCallback(QRestReply(reply));
});
connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
if (reply) {
emit formExplodeStringOptionsErrorOccurred(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 OAITestApi::formExplodeStringOptionsCallback(const QRestReply &reply)
{
auto netReply = reply.networkReply();
if (netReply)
netReply->disconnect(this);
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 formExplodeStringOptionsFinished(output);
}
/**
* \fn virtual void OAITestApi::formNotExplodeAnytype(const ::OpenAPI::OptionalParam<QJsonValue> &anytypeParameter = ::OpenAPI::OptionalParam<QJsonValue>())
* 'formNotExplodeAnytype' operation sends the request to a server.
* The request parameters are defined by a specification file.
* @param[in] anytypeParameter QJsonValue [optional]
*/
/**
* \fn template < Functor, > void OAITestApi::formNotExplodeAnytype(const ::OpenAPI::OptionalParam<QJsonValue> &anytypeParameter = ::OpenAPI::OptionalParam<QJsonValue>(), const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
* 'formNotExplodeAnytype' 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++}
* formNotExplodeAnytype(anytypeParameter, this, [&](const QRestReply &reply, const 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 formNotExplodeAnytypeWithDataImpl() in derived class.
* The virtual formNotExplodeAnytypeWithDataImpl() is being called by the template
* function.
* @param[in] anytypeParameter QJsonValue [optional]
* @param[in] context const ContextTypeForFunctor< Functor > * [optional]
* @param[in] callback Functor && [optional]
*/
/**
* \fn void OAITestApi::formNotExplodeAnytypeCallback(const QRestReply &reply)
* Processes a \a reply response from a server.
* The result of processed data is emitted by formNotExplodeAnytypeFinished() or
* being returned as a callback parameter of formNotExplodeAnytype() request.
* @param[in] reply const QRestReply &
*/
/**
* \fn virtual void OAITestApi::formNotExplodeAnytypeWithDataImpl(const ::OpenAPI::OptionalParam<QJsonValue> &anytypeParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
* Implements the formNotExplodeAnytype() operation request.
* \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
* and can be overloaded for mocking formNotExplodeAnytype() operation calls.
* @param[in] anytypeParameter QJsonValue [optional]
* @param[in] context const QObject * [optional]
* @param[in] slot QtPrivate::QSlotObjectBase * [optional]
*/
void OAITestApi::formNotExplodeAnytypeWithDataImpl(const ::OpenAPI::OptionalParam<QJsonValue> &anytypeParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
{
const QUrl serverUrl = m_serverConfigs["formNotExplodeAnytype"][m_serverIndices.value("formNotExplodeAnytype")].serverUrl();
QString fullPath = "/query/anytype/form-not-explode/formNotExplodeAnytype";
m_networkFactory->setBaseUrl(serverUrl);
int queryParamCounter = 0;
{
[[maybe_unused]] QString paramString;
QString queryStyle = "form";
if (queryStyle.isEmpty())
queryStyle = "form";
const QString queryPrefix = getParamStylePrefix(queryStyle);
[[maybe_unused]] const QString queryDelimiter = getParamStyleDelimiter(queryStyle, false);
const QString querySuffix = getParamStyleSuffix(queryStyle, u"anytypeParameter"_s, false, anytypeParameter.value().type() == QJsonValue::Object);
const QString queryAssignOperator = getParamStyleAssignOperator(queryStyle, false, anytypeParameter.value().type() == QJsonValue::Object);
if ((fullPath.indexOf("?") != fullPath.size() - 1) && (queryParamCounter == 0))
fullPath.append(queryPrefix);
if (anytypeParameter.hasValue()) {
if (queryParamCounter > 0)
fullPath.append("&");
paramString = serializeJsonValue(anytypeParameter.value(), queryStyle, false, querySuffix, queryAssignOperator, queryDelimiter);
fullPath.append(paramString);
queryParamCounter++;
}
}
// set m_testOperationPath for serialization tests
m_testOperationPath = fullPath;
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] {
formNotExplodeAnytypeCallback(QRestReply(reply));
});
connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
if (reply) {
emit formNotExplodeAnytypeErrorOccurred(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 OAITestApi::formNotExplodeAnytypeCallback(const QRestReply &reply)
{
auto netReply = reply.networkReply();
if (netReply)
netReply->disconnect(this);
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 formNotExplodeAnytypeFinished(output);
}
/**
* \fn virtual void OAITestApi::formNotExplodeArray(const ::OpenAPI::OptionalParam<QList<qint32>> &arrayParameter = ::OpenAPI::OptionalParam<QList<qint32>>())
* 'formNotExplodeArray' operation sends the request to a server.
* The request parameters are defined by a specification file.
* @param[in] arrayParameter QList<qint32> [optional]
*/
/**
* \fn template < Functor, > void OAITestApi::formNotExplodeArray(const ::OpenAPI::OptionalParam<QList<qint32>> &arrayParameter = ::OpenAPI::OptionalParam<QList<qint32>>(), const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
* 'formNotExplodeArray' 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++}
* formNotExplodeArray(arrayParameter, this, [&](const QRestReply &reply, const 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 formNotExplodeArrayWithDataImpl() in derived class.
* The virtual formNotExplodeArrayWithDataImpl() is being called by the template
* function.
* @param[in] arrayParameter QList<qint32> [optional]
* @param[in] context const ContextTypeForFunctor< Functor > * [optional]
* @param[in] callback Functor && [optional]
*/
/**
* \fn void OAITestApi::formNotExplodeArrayCallback(const QRestReply &reply)
* Processes a \a reply response from a server.
* The result of processed data is emitted by formNotExplodeArrayFinished() or
* being returned as a callback parameter of formNotExplodeArray() request.
* @param[in] reply const QRestReply &
*/
/**
* \fn virtual void OAITestApi::formNotExplodeArrayWithDataImpl(const ::OpenAPI::OptionalParam<QList<qint32>> &arrayParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
* Implements the formNotExplodeArray() operation request.
* \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
* and can be overloaded for mocking formNotExplodeArray() operation calls.
* @param[in] arrayParameter QList<qint32> [optional]
* @param[in] context const QObject * [optional]
* @param[in] slot QtPrivate::QSlotObjectBase * [optional]
*/
void OAITestApi::formNotExplodeArrayWithDataImpl(const ::OpenAPI::OptionalParam<QList<qint32>> &arrayParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
{
const QUrl serverUrl = m_serverConfigs["formNotExplodeArray"][m_serverIndices.value("formNotExplodeArray")].serverUrl();
QString fullPath = "/query/array/form-not-explode/formNotExplodeArray";
m_networkFactory->setBaseUrl(serverUrl);
int queryParamCounter = 0;
{
[[maybe_unused]] QString paramString;
QString queryStyle = "form";
if (queryStyle.isEmpty())
queryStyle = "form";
const QString queryPrefix = getParamStylePrefix(queryStyle);
[[maybe_unused]] const QString queryDelimiter = getParamStyleDelimiter(queryStyle, false);
const QString querySuffix = getParamStyleSuffix(queryStyle, u"arrayParameter"_s, false, (!false && !true));
[[maybe_unused]] const QString queryAssignOperator = getParamStyleAssignOperator(queryStyle, false, (!false && !true));
if ((fullPath.indexOf("?") != fullPath.size() - 1) && (queryParamCounter == 0))
fullPath.append(queryPrefix);
if (arrayParameter.hasValue()) {
if (queryParamCounter > 0)
fullPath.append("&");
fullPath.append(serializeArrayValue(arrayParameter.value(), queryStyle, false, querySuffix, queryDelimiter));
queryParamCounter++;
}
}
// set m_testOperationPath for serialization tests
m_testOperationPath = fullPath;
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] {
formNotExplodeArrayCallback(QRestReply(reply));
});
connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
if (reply) {
emit formNotExplodeArrayErrorOccurred(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 OAITestApi::formNotExplodeArrayCallback(const QRestReply &reply)
{
auto netReply = reply.networkReply();
if (netReply)
netReply->disconnect(this);
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 formNotExplodeArrayFinished(output);
}
/**
* \fn virtual void OAITestApi::formNotExplodeObject(const ::OpenAPI::OptionalParam<OAITestObject> &objectParameter = ::OpenAPI::OptionalParam<OAITestObject>())
* 'formNotExplodeObject' operation sends the request to a server.
* The request parameters are defined by a specification file.
* @param[in] objectParameter OAITestObject [optional]
*/
/**
* \fn template < Functor, > void OAITestApi::formNotExplodeObject(const ::OpenAPI::OptionalParam<OAITestObject> &objectParameter = ::OpenAPI::OptionalParam<OAITestObject>(), const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
* 'formNotExplodeObject' 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++}
* formNotExplodeObject(objectParameter, this, [&](const QRestReply &reply, const 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 formNotExplodeObjectWithDataImpl() in derived class.
* The virtual formNotExplodeObjectWithDataImpl() is being called by the template
* function.
* @param[in] objectParameter OAITestObject [optional]
* @param[in] context const ContextTypeForFunctor< Functor > * [optional]
* @param[in] callback Functor && [optional]
*/
/**
* \fn void OAITestApi::formNotExplodeObjectCallback(const QRestReply &reply)
* Processes a \a reply response from a server.
* The result of processed data is emitted by formNotExplodeObjectFinished() or
* being returned as a callback parameter of formNotExplodeObject() request.
* @param[in] reply const QRestReply &
*/
/**
* \fn virtual void OAITestApi::formNotExplodeObjectWithDataImpl(const ::OpenAPI::OptionalParam<OAITestObject> &objectParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
* Implements the formNotExplodeObject() operation request.
* \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
* and can be overloaded for mocking formNotExplodeObject() operation calls.
* @param[in] objectParameter OAITestObject [optional]
* @param[in] context const QObject * [optional]
* @param[in] slot QtPrivate::QSlotObjectBase * [optional]
*/
void OAITestApi::formNotExplodeObjectWithDataImpl(const ::OpenAPI::OptionalParam<OAITestObject> &objectParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
{
const QUrl serverUrl = m_serverConfigs["formNotExplodeObject"][m_serverIndices.value("formNotExplodeObject")].serverUrl();
QString fullPath = "/query/object/form-not-explode/formNotExplodeObject";
m_networkFactory->setBaseUrl(serverUrl);
int queryParamCounter = 0;
{
[[maybe_unused]] QString paramString;
QString queryStyle = "form";
if (queryStyle.isEmpty())
queryStyle = "form";
const QString queryPrefix = getParamStylePrefix(queryStyle);
[[maybe_unused]] const QString queryDelimiter = getParamStyleDelimiter(queryStyle, false);
const QString querySuffix = getParamStyleSuffix(queryStyle, u"objectParameter"_s, false, (!false && !false));
[[maybe_unused]] const QString queryAssignOperator = getParamStyleAssignOperator(queryStyle, false, (!false && !false));
paramString = querySuffix;
if ((fullPath.indexOf("?") != fullPath.size() - 1) && (queryParamCounter == 0))
fullPath.append(queryPrefix);
if (objectParameter.hasValue()) {
if (queryParamCounter > 0)
fullPath.append("&");
const QJsonObject parameter = objectParameter.value().asJsonObject();
if (queryStyle == "deepObject") {
qint32 index = 0;
if (parameter.isEmpty())
qWarning() << "Serialized QJsonValue::Object is empty!";
for (const QString& key : parameter.keys()) {
if (index > 0)
paramString.append(queryDelimiter);
paramString.append(::OpenAPI::optionParameterToString(QString("objectParameter") + QString("[") + key + QString("]"), queryAssignOperator, parameter.value(key)));
index++;
}
} else {
paramString = serializeJsonValue(QJsonValue(parameter), queryStyle, false, querySuffix, queryAssignOperator, queryDelimiter);
}
// style=form && explode=true && non-object => 'objectParameter' isn't used in serialization
// style=form && explode=true && empty object => need to be 'objectParameter='
if (paramString.isEmpty() && queryStyle == "form")
paramString = u"objectParameter="_s;
fullPath.append(paramString);
queryParamCounter++;
}
}
// set m_testOperationPath for serialization tests
m_testOperationPath = fullPath;
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] {
formNotExplodeObjectCallback(QRestReply(reply));
});
connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
if (reply) {
emit formNotExplodeObjectErrorOccurred(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 OAITestApi::formNotExplodeObjectCallback(const QRestReply &reply)
{
auto netReply = reply.networkReply();
if (netReply)
netReply->disconnect(this);
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 formNotExplodeObjectFinished(output);
}
/**
* \fn virtual void OAITestApi::formNotExplodeString(const ::OpenAPI::OptionalParam<QString> &stringParameter = ::OpenAPI::OptionalParam<QString>())
* 'formNotExplodeString' operation sends the request to a server.
* The request parameters are defined by a specification file.
* @param[in] stringParameter QString [optional]
*/
/**
* \fn template < Functor, > void OAITestApi::formNotExplodeString(const ::OpenAPI::OptionalParam<QString> &stringParameter = ::OpenAPI::OptionalParam<QString>(), const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
* 'formNotExplodeString' 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++}
* formNotExplodeString(stringParameter, this, [&](const QRestReply &reply, const 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 formNotExplodeStringWithDataImpl() in derived class.
* The virtual formNotExplodeStringWithDataImpl() is being called by the template
* function.
* @param[in] stringParameter QString [optional]
* @param[in] context const ContextTypeForFunctor< Functor > * [optional]
* @param[in] callback Functor && [optional]
*/
/**
* \fn void OAITestApi::formNotExplodeStringCallback(const QRestReply &reply)
* Processes a \a reply response from a server.
* The result of processed data is emitted by formNotExplodeStringFinished() or
* being returned as a callback parameter of formNotExplodeString() request.
* @param[in] reply const QRestReply &
*/
/**
* \fn virtual void OAITestApi::formNotExplodeStringWithDataImpl(const ::OpenAPI::OptionalParam<QString> &stringParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
* Implements the formNotExplodeString() operation request.
* \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
* and can be overloaded for mocking formNotExplodeString() operation calls.
* @param[in] stringParameter QString [optional]
* @param[in] context const QObject * [optional]
* @param[in] slot QtPrivate::QSlotObjectBase * [optional]
*/
void OAITestApi::formNotExplodeStringWithDataImpl(const ::OpenAPI::OptionalParam<QString> &stringParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
{
const QUrl serverUrl = m_serverConfigs["formNotExplodeString"][m_serverIndices.value("formNotExplodeString")].serverUrl();
QString fullPath = "/query/string/form-not-explode/formNotExplodeString";
m_networkFactory->setBaseUrl(serverUrl);
int queryParamCounter = 0;
{
[[maybe_unused]] QString paramString;
QString queryStyle = "form";
if (queryStyle.isEmpty())
queryStyle = "form";
const QString queryPrefix = getParamStylePrefix(queryStyle);
[[maybe_unused]] const QString queryDelimiter = getParamStyleDelimiter(queryStyle, false);
const QString querySuffix = getParamStyleSuffix(queryStyle, u"stringParameter"_s, false, (!true && !false));
[[maybe_unused]] const QString queryAssignOperator = getParamStyleAssignOperator(queryStyle, false, (!true && !false));
paramString = querySuffix;
if ((fullPath.indexOf("?") != fullPath.size() - 1) && (queryParamCounter == 0))
fullPath.append(queryPrefix);
if (stringParameter.hasValue()) {
if (queryParamCounter > 0)
fullPath.append("&");
fullPath.append(querySuffix + QUrl::toPercentEncoding(::OpenAPI::toStringValue(stringParameter.value())));
queryParamCounter++;
}
}
// set m_testOperationPath for serialization tests
m_testOperationPath = fullPath;
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] {
formNotExplodeStringCallback(QRestReply(reply));
});
connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
if (reply) {
emit formNotExplodeStringErrorOccurred(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 OAITestApi::formNotExplodeStringCallback(const QRestReply &reply)
{
auto netReply = reply.networkReply();
if (netReply)
netReply->disconnect(this);
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 formNotExplodeStringFinished(output);
}
/**
* \fn virtual void OAITestApi::labelExplodeAnytype(const QJsonValue &anytypeParameter)
* 'labelExplodeAnytype' operation sends the request to a server.
* The request parameters are defined by a specification file.
* @param[in] anytypeParameter QJsonValue [required]
*/
/**
* \fn template < Functor, > void OAITestApi::labelExplodeAnytype(const QJsonValue &anytypeParameter, const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
* 'labelExplodeAnytype' 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++}
* labelExplodeAnytype(anytypeParameter, this, [&](const QRestReply &reply, const 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 labelExplodeAnytypeWithDataImpl() in derived class.
* The virtual labelExplodeAnytypeWithDataImpl() is being called by the template
* function.
* @param[in] anytypeParameter QJsonValue [required]
* @param[in] context const ContextTypeForFunctor< Functor > * [optional]
* @param[in] callback Functor && [optional]
*/
/**
* \fn void OAITestApi::labelExplodeAnytypeCallback(const QRestReply &reply)
* Processes a \a reply response from a server.
* The result of processed data is emitted by labelExplodeAnytypeFinished() or
* being returned as a callback parameter of labelExplodeAnytype() request.
* @param[in] reply const QRestReply &
*/
/**
* \fn virtual void OAITestApi::labelExplodeAnytypeWithDataImpl(const QJsonValue &anytypeParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
* Implements the labelExplodeAnytype() operation request.
* \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
* and can be overloaded for mocking labelExplodeAnytype() operation calls.
* @param[in] anytypeParameter QJsonValue [required]
* @param[in] context const QObject * [optional]
* @param[in] slot QtPrivate::QSlotObjectBase * [optional]
*/
void OAITestApi::labelExplodeAnytypeWithDataImpl(const QJsonValue &anytypeParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
{
const QUrl serverUrl = m_serverConfigs["labelExplodeAnytype"][m_serverIndices.value("labelExplodeAnytype")].serverUrl();
QString fullPath = "/path/anytype/label-explode/{anytypeParameter}";
m_networkFactory->setBaseUrl(serverUrl);
{
QString anytypeParameterPathParam = QString("{%1}").arg("anytypeParameter");
QString pathStyle = "label";
if (pathStyle.isEmpty())
pathStyle = "simple";
const QString pathPrefix = getParamStylePrefix(pathStyle);
const QString pathDelimiter = getParamStyleDelimiter(pathStyle, true);
const QString assignOperator = getParamStyleAssignOperator(pathStyle, true, anytypeParameter.type() == QJsonValue::Object);
const QString pathSuffix = getParamStyleSuffix(pathStyle, u"anytypeParameter"_s, true, anytypeParameter.type() == QJsonValue::Object);
QString paramString = pathPrefix + serializeJsonValue(anytypeParameter, pathStyle, true, pathSuffix, assignOperator, pathDelimiter);
// In case style=matrix and paramString is empty due to any reasons,
// we serialize it like undefined value and delete '='.
if ((paramString == pathPrefix + pathSuffix) && QString("label") == "matrix"_L1)
paramString.chop(1);
fullPath.replace(anytypeParameterPathParam, paramString);
}
// set m_testOperationPath for serialization tests
m_testOperationPath = fullPath;
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] {
labelExplodeAnytypeCallback(QRestReply(reply));
});
connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
if (reply) {
emit labelExplodeAnytypeErrorOccurred(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 OAITestApi::labelExplodeAnytypeCallback(const QRestReply &reply)
{
auto netReply = reply.networkReply();
if (netReply)
netReply->disconnect(this);
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 labelExplodeAnytypeFinished(output);
}
/**
* \fn virtual void OAITestApi::labelExplodeArray(const QList<qint32> &arrayParameter)
* 'labelExplodeArray' operation sends the request to a server.
* The request parameters are defined by a specification file.
* @param[in] arrayParameter QList<qint32> [required]
*/
/**
* \fn template < Functor, > void OAITestApi::labelExplodeArray(const QList<qint32> &arrayParameter, const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
* 'labelExplodeArray' 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++}
* labelExplodeArray(arrayParameter, this, [&](const QRestReply &reply, const 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 labelExplodeArrayWithDataImpl() in derived class.
* The virtual labelExplodeArrayWithDataImpl() is being called by the template
* function.
* @param[in] arrayParameter QList<qint32> [required]
* @param[in] context const ContextTypeForFunctor< Functor > * [optional]
* @param[in] callback Functor && [optional]
*/
/**
* \fn void OAITestApi::labelExplodeArrayCallback(const QRestReply &reply)
* Processes a \a reply response from a server.
* The result of processed data is emitted by labelExplodeArrayFinished() or
* being returned as a callback parameter of labelExplodeArray() request.
* @param[in] reply const QRestReply &
*/
/**
* \fn virtual void OAITestApi::labelExplodeArrayWithDataImpl(const QList<qint32> &arrayParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
* Implements the labelExplodeArray() operation request.
* \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
* and can be overloaded for mocking labelExplodeArray() operation calls.
* @param[in] arrayParameter QList<qint32> [required]
* @param[in] context const QObject * [optional]
* @param[in] slot QtPrivate::QSlotObjectBase * [optional]
*/
void OAITestApi::labelExplodeArrayWithDataImpl(const QList<qint32> &arrayParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
{
const QUrl serverUrl = m_serverConfigs["labelExplodeArray"][m_serverIndices.value("labelExplodeArray")].serverUrl();
QString fullPath = "/path/array/label-explode/{arrayParameter}";
m_networkFactory->setBaseUrl(serverUrl);
{
QString arrayParameterPathParam = QString("{%1}").arg("arrayParameter");
QString pathStyle = "label";
if (pathStyle.isEmpty())
pathStyle = "simple";
const QString pathPrefix = getParamStylePrefix(pathStyle);
const QString pathDelimiter = getParamStyleDelimiter(pathStyle, true);
[[maybe_unused]] const QString assignOperator = getParamStyleAssignOperator(pathStyle, true, (!false && !true));
const QString pathSuffix = getParamStyleSuffix(pathStyle, u"arrayParameter"_s, true, (!false && !true));
QString paramString = pathPrefix + pathSuffix;
paramString = pathPrefix + serializeArrayValue(arrayParameter, pathStyle, true, pathSuffix, pathDelimiter);
// In case style=matrix and paramString is empty due to any reasons,
// we serialize it like undefined value and delete '='.
if ((paramString == pathPrefix + pathSuffix) && QString("label") == "matrix"_L1)
paramString.chop(1);
fullPath.replace(arrayParameterPathParam, paramString);
}
// set m_testOperationPath for serialization tests
m_testOperationPath = fullPath;
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] {
labelExplodeArrayCallback(QRestReply(reply));
});
connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
if (reply) {
emit labelExplodeArrayErrorOccurred(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 OAITestApi::labelExplodeArrayCallback(const QRestReply &reply)
{
auto netReply = reply.networkReply();
if (netReply)
netReply->disconnect(this);
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 labelExplodeArrayFinished(output);
}
/**
* \fn virtual void OAITestApi::labelExplodeObject(const OAITestObject &objectParameter)
* 'labelExplodeObject' operation sends the request to a server.
* The request parameters are defined by a specification file.
* @param[in] objectParameter OAITestObject [required]
*/
/**
* \fn template < Functor, > void OAITestApi::labelExplodeObject(const OAITestObject &objectParameter, const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
* 'labelExplodeObject' 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++}
* labelExplodeObject(objectParameter, this, [&](const QRestReply &reply, const 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 labelExplodeObjectWithDataImpl() in derived class.
* The virtual labelExplodeObjectWithDataImpl() is being called by the template
* function.
* @param[in] objectParameter OAITestObject [required]
* @param[in] context const ContextTypeForFunctor< Functor > * [optional]
* @param[in] callback Functor && [optional]
*/
/**
* \fn void OAITestApi::labelExplodeObjectCallback(const QRestReply &reply)
* Processes a \a reply response from a server.
* The result of processed data is emitted by labelExplodeObjectFinished() or
* being returned as a callback parameter of labelExplodeObject() request.
* @param[in] reply const QRestReply &
*/
/**
* \fn virtual void OAITestApi::labelExplodeObjectWithDataImpl(const OAITestObject &objectParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
* Implements the labelExplodeObject() operation request.
* \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
* and can be overloaded for mocking labelExplodeObject() operation calls.
* @param[in] objectParameter OAITestObject [required]
* @param[in] context const QObject * [optional]
* @param[in] slot QtPrivate::QSlotObjectBase * [optional]
*/
void OAITestApi::labelExplodeObjectWithDataImpl(const OAITestObject &objectParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
{
const QUrl serverUrl = m_serverConfigs["labelExplodeObject"][m_serverIndices.value("labelExplodeObject")].serverUrl();
QString fullPath = "/path/object/label-explode/{objectParameter}";
m_networkFactory->setBaseUrl(serverUrl);
{
QString objectParameterPathParam = QString("{%1}").arg("objectParameter");
QString pathStyle = "label";
if (pathStyle.isEmpty())
pathStyle = "simple";
const QString pathPrefix = getParamStylePrefix(pathStyle);
const QString pathDelimiter = getParamStyleDelimiter(pathStyle, true);
[[maybe_unused]] const QString assignOperator = getParamStyleAssignOperator(pathStyle, true, (!false && !false));
const QString pathSuffix = getParamStyleSuffix(pathStyle, u"objectParameter"_s, true, (!false && !false));
QString paramString = pathPrefix + pathSuffix;
paramString = pathPrefix + serializeJsonValue(QJsonValue(objectParameter.asJsonObject()), pathStyle, true, pathSuffix, assignOperator, pathDelimiter);
// In case style=matrix and paramString is empty due to any reasons,
// we serialize it like undefined value and delete '='.
if ((paramString == pathPrefix + pathSuffix) && QString("label") == "matrix"_L1)
paramString.chop(1);
fullPath.replace(objectParameterPathParam, paramString);
}
// set m_testOperationPath for serialization tests
m_testOperationPath = fullPath;
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] {
labelExplodeObjectCallback(QRestReply(reply));
});
connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
if (reply) {
emit labelExplodeObjectErrorOccurred(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 OAITestApi::labelExplodeObjectCallback(const QRestReply &reply)
{
auto netReply = reply.networkReply();
if (netReply)
netReply->disconnect(this);
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 labelExplodeObjectFinished(output);
}
/**
* \fn virtual void OAITestApi::labelExplodeString(const QString &stringParameter)
* 'labelExplodeString' operation sends the request to a server.
* The request parameters are defined by a specification file.
* @param[in] stringParameter QString [required]
*/
/**
* \fn template < Functor, > void OAITestApi::labelExplodeString(const QString &stringParameter, const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
* 'labelExplodeString' 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++}
* labelExplodeString(stringParameter, this, [&](const QRestReply &reply, const 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 labelExplodeStringWithDataImpl() in derived class.
* The virtual labelExplodeStringWithDataImpl() is being called by the template
* function.
* @param[in] stringParameter QString [required]
* @param[in] context const ContextTypeForFunctor< Functor > * [optional]
* @param[in] callback Functor && [optional]
*/
/**
* \fn void OAITestApi::labelExplodeStringCallback(const QRestReply &reply)
* Processes a \a reply response from a server.
* The result of processed data is emitted by labelExplodeStringFinished() or
* being returned as a callback parameter of labelExplodeString() request.
* @param[in] reply const QRestReply &
*/
/**
* \fn virtual void OAITestApi::labelExplodeStringWithDataImpl(const QString &stringParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
* Implements the labelExplodeString() operation request.
* \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
* and can be overloaded for mocking labelExplodeString() operation calls.
* @param[in] stringParameter QString [required]
* @param[in] context const QObject * [optional]
* @param[in] slot QtPrivate::QSlotObjectBase * [optional]
*/
void OAITestApi::labelExplodeStringWithDataImpl(const QString &stringParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
{
const QUrl serverUrl = m_serverConfigs["labelExplodeString"][m_serverIndices.value("labelExplodeString")].serverUrl();
QString fullPath = "/path/string/label-explode/{stringParameter}";
m_networkFactory->setBaseUrl(serverUrl);
{
QString stringParameterPathParam = QString("{%1}").arg("stringParameter");
QString pathStyle = "label";
if (pathStyle.isEmpty())
pathStyle = "simple";
const QString pathPrefix = getParamStylePrefix(pathStyle);
const QString pathDelimiter = getParamStyleDelimiter(pathStyle, true);
[[maybe_unused]] const QString assignOperator = getParamStyleAssignOperator(pathStyle, true, (!true && !false));
const QString pathSuffix = getParamStyleSuffix(pathStyle, u"stringParameter"_s, true, (!true && !false));
QString paramString = pathPrefix + pathSuffix;
paramString += QUrl::toPercentEncoding(::OpenAPI::toStringValue(stringParameter));
// In case style=matrix and paramString is empty due to any reasons,
// we serialize it like undefined value and delete '='.
if ((paramString == pathPrefix + pathSuffix) && QString("label") == "matrix"_L1)
paramString.chop(1);
fullPath.replace(stringParameterPathParam, paramString);
}
// set m_testOperationPath for serialization tests
m_testOperationPath = fullPath;
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] {
labelExplodeStringCallback(QRestReply(reply));
});
connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
if (reply) {
emit labelExplodeStringErrorOccurred(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 OAITestApi::labelExplodeStringCallback(const QRestReply &reply)
{
auto netReply = reply.networkReply();
if (netReply)
netReply->disconnect(this);
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 labelExplodeStringFinished(output);
}
/**
* \fn virtual void OAITestApi::labelNotExplodeAnytype(const QJsonValue &anytypeParameter)
* 'labelNotExplodeAnytype' operation sends the request to a server.
* The request parameters are defined by a specification file.
* @param[in] anytypeParameter QJsonValue [required]
*/
/**
* \fn template < Functor, > void OAITestApi::labelNotExplodeAnytype(const QJsonValue &anytypeParameter, const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
* 'labelNotExplodeAnytype' 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++}
* labelNotExplodeAnytype(anytypeParameter, this, [&](const QRestReply &reply, const 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 labelNotExplodeAnytypeWithDataImpl() in derived class.
* The virtual labelNotExplodeAnytypeWithDataImpl() is being called by the template
* function.
* @param[in] anytypeParameter QJsonValue [required]
* @param[in] context const ContextTypeForFunctor< Functor > * [optional]
* @param[in] callback Functor && [optional]
*/
/**
* \fn void OAITestApi::labelNotExplodeAnytypeCallback(const QRestReply &reply)
* Processes a \a reply response from a server.
* The result of processed data is emitted by labelNotExplodeAnytypeFinished() or
* being returned as a callback parameter of labelNotExplodeAnytype() request.
* @param[in] reply const QRestReply &
*/
/**
* \fn virtual void OAITestApi::labelNotExplodeAnytypeWithDataImpl(const QJsonValue &anytypeParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
* Implements the labelNotExplodeAnytype() operation request.
* \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
* and can be overloaded for mocking labelNotExplodeAnytype() operation calls.
* @param[in] anytypeParameter QJsonValue [required]
* @param[in] context const QObject * [optional]
* @param[in] slot QtPrivate::QSlotObjectBase * [optional]
*/
void OAITestApi::labelNotExplodeAnytypeWithDataImpl(const QJsonValue &anytypeParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
{
const QUrl serverUrl = m_serverConfigs["labelNotExplodeAnytype"][m_serverIndices.value("labelNotExplodeAnytype")].serverUrl();
QString fullPath = "/path/anytype/label-not-explode/{anytypeParameter}";
m_networkFactory->setBaseUrl(serverUrl);
{
QString anytypeParameterPathParam = QString("{%1}").arg("anytypeParameter");
QString pathStyle = "label";
if (pathStyle.isEmpty())
pathStyle = "simple";
const QString pathPrefix = getParamStylePrefix(pathStyle);
const QString pathDelimiter = getParamStyleDelimiter(pathStyle, false);
const QString assignOperator = getParamStyleAssignOperator(pathStyle, false, anytypeParameter.type() == QJsonValue::Object);
const QString pathSuffix = getParamStyleSuffix(pathStyle, u"anytypeParameter"_s, false, anytypeParameter.type() == QJsonValue::Object);
QString paramString = pathPrefix + serializeJsonValue(anytypeParameter, pathStyle, false, pathSuffix, assignOperator, pathDelimiter);
// In case style=matrix and paramString is empty due to any reasons,
// we serialize it like undefined value and delete '='.
if ((paramString == pathPrefix + pathSuffix) && QString("label") == "matrix"_L1)
paramString.chop(1);
fullPath.replace(anytypeParameterPathParam, paramString);
}
// set m_testOperationPath for serialization tests
m_testOperationPath = fullPath;
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] {
labelNotExplodeAnytypeCallback(QRestReply(reply));
});
connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
if (reply) {
emit labelNotExplodeAnytypeErrorOccurred(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 OAITestApi::labelNotExplodeAnytypeCallback(const QRestReply &reply)
{
auto netReply = reply.networkReply();
if (netReply)
netReply->disconnect(this);
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 labelNotExplodeAnytypeFinished(output);
}
/**
* \fn virtual void OAITestApi::labelNotExplodeArray(const QList<qint32> &arrayParameter)
* 'labelNotExplodeArray' operation sends the request to a server.
* The request parameters are defined by a specification file.
* @param[in] arrayParameter QList<qint32> [required]
*/
/**
* \fn template < Functor, > void OAITestApi::labelNotExplodeArray(const QList<qint32> &arrayParameter, const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
* 'labelNotExplodeArray' 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++}
* labelNotExplodeArray(arrayParameter, this, [&](const QRestReply &reply, const 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 labelNotExplodeArrayWithDataImpl() in derived class.
* The virtual labelNotExplodeArrayWithDataImpl() is being called by the template
* function.
* @param[in] arrayParameter QList<qint32> [required]
* @param[in] context const ContextTypeForFunctor< Functor > * [optional]
* @param[in] callback Functor && [optional]
*/
/**
* \fn void OAITestApi::labelNotExplodeArrayCallback(const QRestReply &reply)
* Processes a \a reply response from a server.
* The result of processed data is emitted by labelNotExplodeArrayFinished() or
* being returned as a callback parameter of labelNotExplodeArray() request.
* @param[in] reply const QRestReply &
*/
/**
* \fn virtual void OAITestApi::labelNotExplodeArrayWithDataImpl(const QList<qint32> &arrayParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
* Implements the labelNotExplodeArray() operation request.
* \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
* and can be overloaded for mocking labelNotExplodeArray() operation calls.
* @param[in] arrayParameter QList<qint32> [required]
* @param[in] context const QObject * [optional]
* @param[in] slot QtPrivate::QSlotObjectBase * [optional]
*/
void OAITestApi::labelNotExplodeArrayWithDataImpl(const QList<qint32> &arrayParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
{
const QUrl serverUrl = m_serverConfigs["labelNotExplodeArray"][m_serverIndices.value("labelNotExplodeArray")].serverUrl();
QString fullPath = "/path/array/label-not-explode/{arrayParameter}";
m_networkFactory->setBaseUrl(serverUrl);
{
QString arrayParameterPathParam = QString("{%1}").arg("arrayParameter");
QString pathStyle = "label";
if (pathStyle.isEmpty())
pathStyle = "simple";
const QString pathPrefix = getParamStylePrefix(pathStyle);
const QString pathDelimiter = getParamStyleDelimiter(pathStyle, false);
[[maybe_unused]] const QString assignOperator = getParamStyleAssignOperator(pathStyle, false, (!false && !true));
const QString pathSuffix = getParamStyleSuffix(pathStyle, u"arrayParameter"_s, false, (!false && !true));
QString paramString = pathPrefix + pathSuffix;
paramString = pathPrefix + serializeArrayValue(arrayParameter, pathStyle, false, pathSuffix, pathDelimiter);
// In case style=matrix and paramString is empty due to any reasons,
// we serialize it like undefined value and delete '='.
if ((paramString == pathPrefix + pathSuffix) && QString("label") == "matrix"_L1)
paramString.chop(1);
fullPath.replace(arrayParameterPathParam, paramString);
}
// set m_testOperationPath for serialization tests
m_testOperationPath = fullPath;
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] {
labelNotExplodeArrayCallback(QRestReply(reply));
});
connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
if (reply) {
emit labelNotExplodeArrayErrorOccurred(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 OAITestApi::labelNotExplodeArrayCallback(const QRestReply &reply)
{
auto netReply = reply.networkReply();
if (netReply)
netReply->disconnect(this);
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 labelNotExplodeArrayFinished(output);
}
/**
* \fn virtual void OAITestApi::labelNotExplodeObject(const OAITestObject &objectParameter)
* 'labelNotExplodeObject' operation sends the request to a server.
* The request parameters are defined by a specification file.
* @param[in] objectParameter OAITestObject [required]
*/
/**
* \fn template < Functor, > void OAITestApi::labelNotExplodeObject(const OAITestObject &objectParameter, const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
* 'labelNotExplodeObject' 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++}
* labelNotExplodeObject(objectParameter, this, [&](const QRestReply &reply, const 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 labelNotExplodeObjectWithDataImpl() in derived class.
* The virtual labelNotExplodeObjectWithDataImpl() is being called by the template
* function.
* @param[in] objectParameter OAITestObject [required]
* @param[in] context const ContextTypeForFunctor< Functor > * [optional]
* @param[in] callback Functor && [optional]
*/
/**
* \fn void OAITestApi::labelNotExplodeObjectCallback(const QRestReply &reply)
* Processes a \a reply response from a server.
* The result of processed data is emitted by labelNotExplodeObjectFinished() or
* being returned as a callback parameter of labelNotExplodeObject() request.
* @param[in] reply const QRestReply &
*/
/**
* \fn virtual void OAITestApi::labelNotExplodeObjectWithDataImpl(const OAITestObject &objectParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
* Implements the labelNotExplodeObject() operation request.
* \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
* and can be overloaded for mocking labelNotExplodeObject() operation calls.
* @param[in] objectParameter OAITestObject [required]
* @param[in] context const QObject * [optional]
* @param[in] slot QtPrivate::QSlotObjectBase * [optional]
*/
void OAITestApi::labelNotExplodeObjectWithDataImpl(const OAITestObject &objectParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
{
const QUrl serverUrl = m_serverConfigs["labelNotExplodeObject"][m_serverIndices.value("labelNotExplodeObject")].serverUrl();
QString fullPath = "/path/object/label-not-explode/{objectParameter}";
m_networkFactory->setBaseUrl(serverUrl);
{
QString objectParameterPathParam = QString("{%1}").arg("objectParameter");
QString pathStyle = "label";
if (pathStyle.isEmpty())
pathStyle = "simple";
const QString pathPrefix = getParamStylePrefix(pathStyle);
const QString pathDelimiter = getParamStyleDelimiter(pathStyle, false);
[[maybe_unused]] const QString assignOperator = getParamStyleAssignOperator(pathStyle, false, (!false && !false));
const QString pathSuffix = getParamStyleSuffix(pathStyle, u"objectParameter"_s, false, (!false && !false));
QString paramString = pathPrefix + pathSuffix;
paramString = pathPrefix + serializeJsonValue(QJsonValue(objectParameter.asJsonObject()), pathStyle, false, pathSuffix, assignOperator, pathDelimiter);
// In case style=matrix and paramString is empty due to any reasons,
// we serialize it like undefined value and delete '='.
if ((paramString == pathPrefix + pathSuffix) && QString("label") == "matrix"_L1)
paramString.chop(1);
fullPath.replace(objectParameterPathParam, paramString);
}
// set m_testOperationPath for serialization tests
m_testOperationPath = fullPath;
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] {
labelNotExplodeObjectCallback(QRestReply(reply));
});
connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
if (reply) {
emit labelNotExplodeObjectErrorOccurred(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 OAITestApi::labelNotExplodeObjectCallback(const QRestReply &reply)
{
auto netReply = reply.networkReply();
if (netReply)
netReply->disconnect(this);
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 labelNotExplodeObjectFinished(output);
}
/**
* \fn virtual void OAITestApi::labelNotExplodeString(const QString &stringParameter)
* 'labelNotExplodeString' operation sends the request to a server.
* The request parameters are defined by a specification file.
* @param[in] stringParameter QString [required]
*/
/**
* \fn template < Functor, > void OAITestApi::labelNotExplodeString(const QString &stringParameter, const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
* 'labelNotExplodeString' 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++}
* labelNotExplodeString(stringParameter, this, [&](const QRestReply &reply, const 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 labelNotExplodeStringWithDataImpl() in derived class.
* The virtual labelNotExplodeStringWithDataImpl() is being called by the template
* function.
* @param[in] stringParameter QString [required]
* @param[in] context const ContextTypeForFunctor< Functor > * [optional]
* @param[in] callback Functor && [optional]
*/
/**
* \fn void OAITestApi::labelNotExplodeStringCallback(const QRestReply &reply)
* Processes a \a reply response from a server.
* The result of processed data is emitted by labelNotExplodeStringFinished() or
* being returned as a callback parameter of labelNotExplodeString() request.
* @param[in] reply const QRestReply &
*/
/**
* \fn virtual void OAITestApi::labelNotExplodeStringWithDataImpl(const QString &stringParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
* Implements the labelNotExplodeString() operation request.
* \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
* and can be overloaded for mocking labelNotExplodeString() operation calls.
* @param[in] stringParameter QString [required]
* @param[in] context const QObject * [optional]
* @param[in] slot QtPrivate::QSlotObjectBase * [optional]
*/
void OAITestApi::labelNotExplodeStringWithDataImpl(const QString &stringParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
{
const QUrl serverUrl = m_serverConfigs["labelNotExplodeString"][m_serverIndices.value("labelNotExplodeString")].serverUrl();
QString fullPath = "/path/string/label-not-explode/{stringParameter}";
m_networkFactory->setBaseUrl(serverUrl);
{
QString stringParameterPathParam = QString("{%1}").arg("stringParameter");
QString pathStyle = "label";
if (pathStyle.isEmpty())
pathStyle = "simple";
const QString pathPrefix = getParamStylePrefix(pathStyle);
const QString pathDelimiter = getParamStyleDelimiter(pathStyle, false);
[[maybe_unused]] const QString assignOperator = getParamStyleAssignOperator(pathStyle, false, (!true && !false));
const QString pathSuffix = getParamStyleSuffix(pathStyle, u"stringParameter"_s, false, (!true && !false));
QString paramString = pathPrefix + pathSuffix;
paramString += QUrl::toPercentEncoding(::OpenAPI::toStringValue(stringParameter));
// In case style=matrix and paramString is empty due to any reasons,
// we serialize it like undefined value and delete '='.
if ((paramString == pathPrefix + pathSuffix) && QString("label") == "matrix"_L1)
paramString.chop(1);
fullPath.replace(stringParameterPathParam, paramString);
}
// set m_testOperationPath for serialization tests
m_testOperationPath = fullPath;
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] {
labelNotExplodeStringCallback(QRestReply(reply));
});
connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
if (reply) {
emit labelNotExplodeStringErrorOccurred(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 OAITestApi::labelNotExplodeStringCallback(const QRestReply &reply)
{
auto netReply = reply.networkReply();
if (netReply)
netReply->disconnect(this);
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 labelNotExplodeStringFinished(output);
}
/**
* \fn virtual void OAITestApi::matrixExplodeAnytype(const QJsonValue &anytypeParameter)
* 'matrixExplodeAnytype' operation sends the request to a server.
* The request parameters are defined by a specification file.
* @param[in] anytypeParameter QJsonValue [required]
*/
/**
* \fn template < Functor, > void OAITestApi::matrixExplodeAnytype(const QJsonValue &anytypeParameter, const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
* 'matrixExplodeAnytype' 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++}
* matrixExplodeAnytype(anytypeParameter, this, [&](const QRestReply &reply, const 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 matrixExplodeAnytypeWithDataImpl() in derived class.
* The virtual matrixExplodeAnytypeWithDataImpl() is being called by the template
* function.
* @param[in] anytypeParameter QJsonValue [required]
* @param[in] context const ContextTypeForFunctor< Functor > * [optional]
* @param[in] callback Functor && [optional]
*/
/**
* \fn void OAITestApi::matrixExplodeAnytypeCallback(const QRestReply &reply)
* Processes a \a reply response from a server.
* The result of processed data is emitted by matrixExplodeAnytypeFinished() or
* being returned as a callback parameter of matrixExplodeAnytype() request.
* @param[in] reply const QRestReply &
*/
/**
* \fn virtual void OAITestApi::matrixExplodeAnytypeWithDataImpl(const QJsonValue &anytypeParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
* Implements the matrixExplodeAnytype() operation request.
* \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
* and can be overloaded for mocking matrixExplodeAnytype() operation calls.
* @param[in] anytypeParameter QJsonValue [required]
* @param[in] context const QObject * [optional]
* @param[in] slot QtPrivate::QSlotObjectBase * [optional]
*/
void OAITestApi::matrixExplodeAnytypeWithDataImpl(const QJsonValue &anytypeParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
{
const QUrl serverUrl = m_serverConfigs["matrixExplodeAnytype"][m_serverIndices.value("matrixExplodeAnytype")].serverUrl();
QString fullPath = "/path/anytype/matrix-explode/{anytypeParameter}";
m_networkFactory->setBaseUrl(serverUrl);
{
QString anytypeParameterPathParam = QString("{%1}").arg("anytypeParameter");
QString pathStyle = "matrix";
if (pathStyle.isEmpty())
pathStyle = "simple";
const QString pathPrefix = getParamStylePrefix(pathStyle);
const QString pathDelimiter = getParamStyleDelimiter(pathStyle, true);
const QString assignOperator = getParamStyleAssignOperator(pathStyle, true, anytypeParameter.type() == QJsonValue::Object);
const QString pathSuffix = getParamStyleSuffix(pathStyle, u"anytypeParameter"_s, true, anytypeParameter.type() == QJsonValue::Object);
QString paramString = pathPrefix + serializeJsonValue(anytypeParameter, pathStyle, true, pathSuffix, assignOperator, pathDelimiter);
// In case style=matrix and paramString is empty due to any reasons,
// we serialize it like undefined value and delete '='.
if ((paramString == pathPrefix + pathSuffix) && QString("matrix") == "matrix"_L1)
paramString.chop(1);
fullPath.replace(anytypeParameterPathParam, paramString);
}
// set m_testOperationPath for serialization tests
m_testOperationPath = fullPath;
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] {
matrixExplodeAnytypeCallback(QRestReply(reply));
});
connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
if (reply) {
emit matrixExplodeAnytypeErrorOccurred(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 OAITestApi::matrixExplodeAnytypeCallback(const QRestReply &reply)
{
auto netReply = reply.networkReply();
if (netReply)
netReply->disconnect(this);
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 matrixExplodeAnytypeFinished(output);
}
/**
* \fn virtual void OAITestApi::matrixExplodeArray(const QList<qint32> &arrayParameter)
* 'matrixExplodeArray' operation sends the request to a server.
* The request parameters are defined by a specification file.
* @param[in] arrayParameter QList<qint32> [required]
*/
/**
* \fn template < Functor, > void OAITestApi::matrixExplodeArray(const QList<qint32> &arrayParameter, const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
* 'matrixExplodeArray' 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++}
* matrixExplodeArray(arrayParameter, this, [&](const QRestReply &reply, const 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 matrixExplodeArrayWithDataImpl() in derived class.
* The virtual matrixExplodeArrayWithDataImpl() is being called by the template
* function.
* @param[in] arrayParameter QList<qint32> [required]
* @param[in] context const ContextTypeForFunctor< Functor > * [optional]
* @param[in] callback Functor && [optional]
*/
/**
* \fn void OAITestApi::matrixExplodeArrayCallback(const QRestReply &reply)
* Processes a \a reply response from a server.
* The result of processed data is emitted by matrixExplodeArrayFinished() or
* being returned as a callback parameter of matrixExplodeArray() request.
* @param[in] reply const QRestReply &
*/
/**
* \fn virtual void OAITestApi::matrixExplodeArrayWithDataImpl(const QList<qint32> &arrayParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
* Implements the matrixExplodeArray() operation request.
* \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
* and can be overloaded for mocking matrixExplodeArray() operation calls.
* @param[in] arrayParameter QList<qint32> [required]
* @param[in] context const QObject * [optional]
* @param[in] slot QtPrivate::QSlotObjectBase * [optional]
*/
void OAITestApi::matrixExplodeArrayWithDataImpl(const QList<qint32> &arrayParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
{
const QUrl serverUrl = m_serverConfigs["matrixExplodeArray"][m_serverIndices.value("matrixExplodeArray")].serverUrl();
QString fullPath = "/path/array/matrix-explode/{arrayParameter}";
m_networkFactory->setBaseUrl(serverUrl);
{
QString arrayParameterPathParam = QString("{%1}").arg("arrayParameter");
QString pathStyle = "matrix";
if (pathStyle.isEmpty())
pathStyle = "simple";
const QString pathPrefix = getParamStylePrefix(pathStyle);
const QString pathDelimiter = getParamStyleDelimiter(pathStyle, true);
[[maybe_unused]] const QString assignOperator = getParamStyleAssignOperator(pathStyle, true, (!false && !true));
const QString pathSuffix = getParamStyleSuffix(pathStyle, u"arrayParameter"_s, true, (!false && !true));
QString paramString = pathPrefix + pathSuffix;
paramString = pathPrefix + serializeArrayValue(arrayParameter, pathStyle, true, pathSuffix, pathDelimiter);
// In case style=matrix and paramString is empty due to any reasons,
// we serialize it like undefined value and delete '='.
if ((paramString == pathPrefix + pathSuffix) && QString("matrix") == "matrix"_L1)
paramString.chop(1);
fullPath.replace(arrayParameterPathParam, paramString);
}
// set m_testOperationPath for serialization tests
m_testOperationPath = fullPath;
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] {
matrixExplodeArrayCallback(QRestReply(reply));
});
connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
if (reply) {
emit matrixExplodeArrayErrorOccurred(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 OAITestApi::matrixExplodeArrayCallback(const QRestReply &reply)
{
auto netReply = reply.networkReply();
if (netReply)
netReply->disconnect(this);
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 matrixExplodeArrayFinished(output);
}
/**
* \fn virtual void OAITestApi::matrixExplodeObject(const OAITestObject &objectParameter)
* 'matrixExplodeObject' operation sends the request to a server.
* The request parameters are defined by a specification file.
* @param[in] objectParameter OAITestObject [required]
*/
/**
* \fn template < Functor, > void OAITestApi::matrixExplodeObject(const OAITestObject &objectParameter, const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
* 'matrixExplodeObject' 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++}
* matrixExplodeObject(objectParameter, this, [&](const QRestReply &reply, const 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 matrixExplodeObjectWithDataImpl() in derived class.
* The virtual matrixExplodeObjectWithDataImpl() is being called by the template
* function.
* @param[in] objectParameter OAITestObject [required]
* @param[in] context const ContextTypeForFunctor< Functor > * [optional]
* @param[in] callback Functor && [optional]
*/
/**
* \fn void OAITestApi::matrixExplodeObjectCallback(const QRestReply &reply)
* Processes a \a reply response from a server.
* The result of processed data is emitted by matrixExplodeObjectFinished() or
* being returned as a callback parameter of matrixExplodeObject() request.
* @param[in] reply const QRestReply &
*/
/**
* \fn virtual void OAITestApi::matrixExplodeObjectWithDataImpl(const OAITestObject &objectParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
* Implements the matrixExplodeObject() operation request.
* \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
* and can be overloaded for mocking matrixExplodeObject() operation calls.
* @param[in] objectParameter OAITestObject [required]
* @param[in] context const QObject * [optional]
* @param[in] slot QtPrivate::QSlotObjectBase * [optional]
*/
void OAITestApi::matrixExplodeObjectWithDataImpl(const OAITestObject &objectParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
{
const QUrl serverUrl = m_serverConfigs["matrixExplodeObject"][m_serverIndices.value("matrixExplodeObject")].serverUrl();
QString fullPath = "/path/object/matrix-explode/{objectParameter}";
m_networkFactory->setBaseUrl(serverUrl);
{
QString objectParameterPathParam = QString("{%1}").arg("objectParameter");
QString pathStyle = "matrix";
if (pathStyle.isEmpty())
pathStyle = "simple";
const QString pathPrefix = getParamStylePrefix(pathStyle);
const QString pathDelimiter = getParamStyleDelimiter(pathStyle, true);
[[maybe_unused]] const QString assignOperator = getParamStyleAssignOperator(pathStyle, true, (!false && !false));
const QString pathSuffix = getParamStyleSuffix(pathStyle, u"objectParameter"_s, true, (!false && !false));
QString paramString = pathPrefix + pathSuffix;
paramString = pathPrefix + serializeJsonValue(QJsonValue(objectParameter.asJsonObject()), pathStyle, true, pathSuffix, assignOperator, pathDelimiter);
// In case style=matrix and paramString is empty due to any reasons,
// we serialize it like undefined value and delete '='.
if ((paramString == pathPrefix + pathSuffix) && QString("matrix") == "matrix"_L1)
paramString.chop(1);
fullPath.replace(objectParameterPathParam, paramString);
}
// set m_testOperationPath for serialization tests
m_testOperationPath = fullPath;
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] {
matrixExplodeObjectCallback(QRestReply(reply));
});
connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
if (reply) {
emit matrixExplodeObjectErrorOccurred(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 OAITestApi::matrixExplodeObjectCallback(const QRestReply &reply)
{
auto netReply = reply.networkReply();
if (netReply)
netReply->disconnect(this);
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 matrixExplodeObjectFinished(output);
}
/**
* \fn virtual void OAITestApi::matrixExplodeString(const QString &stringParameter)
* 'matrixExplodeString' operation sends the request to a server.
* The request parameters are defined by a specification file.
* @param[in] stringParameter QString [required]
*/
/**
* \fn template < Functor, > void OAITestApi::matrixExplodeString(const QString &stringParameter, const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
* 'matrixExplodeString' 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++}
* matrixExplodeString(stringParameter, this, [&](const QRestReply &reply, const 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 matrixExplodeStringWithDataImpl() in derived class.
* The virtual matrixExplodeStringWithDataImpl() is being called by the template
* function.
* @param[in] stringParameter QString [required]
* @param[in] context const ContextTypeForFunctor< Functor > * [optional]
* @param[in] callback Functor && [optional]
*/
/**
* \fn void OAITestApi::matrixExplodeStringCallback(const QRestReply &reply)
* Processes a \a reply response from a server.
* The result of processed data is emitted by matrixExplodeStringFinished() or
* being returned as a callback parameter of matrixExplodeString() request.
* @param[in] reply const QRestReply &
*/
/**
* \fn virtual void OAITestApi::matrixExplodeStringWithDataImpl(const QString &stringParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
* Implements the matrixExplodeString() operation request.
* \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
* and can be overloaded for mocking matrixExplodeString() operation calls.
* @param[in] stringParameter QString [required]
* @param[in] context const QObject * [optional]
* @param[in] slot QtPrivate::QSlotObjectBase * [optional]
*/
void OAITestApi::matrixExplodeStringWithDataImpl(const QString &stringParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
{
const QUrl serverUrl = m_serverConfigs["matrixExplodeString"][m_serverIndices.value("matrixExplodeString")].serverUrl();
QString fullPath = "/path/string/matrix-explode/{stringParameter}";
m_networkFactory->setBaseUrl(serverUrl);
{
QString stringParameterPathParam = QString("{%1}").arg("stringParameter");
QString pathStyle = "matrix";
if (pathStyle.isEmpty())
pathStyle = "simple";
const QString pathPrefix = getParamStylePrefix(pathStyle);
const QString pathDelimiter = getParamStyleDelimiter(pathStyle, true);
[[maybe_unused]] const QString assignOperator = getParamStyleAssignOperator(pathStyle, true, (!true && !false));
const QString pathSuffix = getParamStyleSuffix(pathStyle, u"stringParameter"_s, true, (!true && !false));
QString paramString = pathPrefix + pathSuffix;
paramString += QUrl::toPercentEncoding(::OpenAPI::toStringValue(stringParameter));
// In case style=matrix and paramString is empty due to any reasons,
// we serialize it like undefined value and delete '='.
if ((paramString == pathPrefix + pathSuffix) && QString("matrix") == "matrix"_L1)
paramString.chop(1);
fullPath.replace(stringParameterPathParam, paramString);
}
// set m_testOperationPath for serialization tests
m_testOperationPath = fullPath;
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] {
matrixExplodeStringCallback(QRestReply(reply));
});
connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
if (reply) {
emit matrixExplodeStringErrorOccurred(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 OAITestApi::matrixExplodeStringCallback(const QRestReply &reply)
{
auto netReply = reply.networkReply();
if (netReply)
netReply->disconnect(this);
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 matrixExplodeStringFinished(output);
}
/**
* \fn virtual void OAITestApi::matrixNotExplodeAnytype(const QJsonValue &anytypeParameter)
* 'matrixNotExplodeAnytype' operation sends the request to a server.
* The request parameters are defined by a specification file.
* @param[in] anytypeParameter QJsonValue [required]
*/
/**
* \fn template < Functor, > void OAITestApi::matrixNotExplodeAnytype(const QJsonValue &anytypeParameter, const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
* 'matrixNotExplodeAnytype' 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++}
* matrixNotExplodeAnytype(anytypeParameter, this, [&](const QRestReply &reply, const 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 matrixNotExplodeAnytypeWithDataImpl() in derived class.
* The virtual matrixNotExplodeAnytypeWithDataImpl() is being called by the template
* function.
* @param[in] anytypeParameter QJsonValue [required]
* @param[in] context const ContextTypeForFunctor< Functor > * [optional]
* @param[in] callback Functor && [optional]
*/
/**
* \fn void OAITestApi::matrixNotExplodeAnytypeCallback(const QRestReply &reply)
* Processes a \a reply response from a server.
* The result of processed data is emitted by matrixNotExplodeAnytypeFinished() or
* being returned as a callback parameter of matrixNotExplodeAnytype() request.
* @param[in] reply const QRestReply &
*/
/**
* \fn virtual void OAITestApi::matrixNotExplodeAnytypeWithDataImpl(const QJsonValue &anytypeParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
* Implements the matrixNotExplodeAnytype() operation request.
* \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
* and can be overloaded for mocking matrixNotExplodeAnytype() operation calls.
* @param[in] anytypeParameter QJsonValue [required]
* @param[in] context const QObject * [optional]
* @param[in] slot QtPrivate::QSlotObjectBase * [optional]
*/
void OAITestApi::matrixNotExplodeAnytypeWithDataImpl(const QJsonValue &anytypeParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
{
const QUrl serverUrl = m_serverConfigs["matrixNotExplodeAnytype"][m_serverIndices.value("matrixNotExplodeAnytype")].serverUrl();
QString fullPath = "/path/anytype/matrix-not-explode/{anytypeParameter}";
m_networkFactory->setBaseUrl(serverUrl);
{
QString anytypeParameterPathParam = QString("{%1}").arg("anytypeParameter");
QString pathStyle = "matrix";
if (pathStyle.isEmpty())
pathStyle = "simple";
const QString pathPrefix = getParamStylePrefix(pathStyle);
const QString pathDelimiter = getParamStyleDelimiter(pathStyle, false);
const QString assignOperator = getParamStyleAssignOperator(pathStyle, false, anytypeParameter.type() == QJsonValue::Object);
const QString pathSuffix = getParamStyleSuffix(pathStyle, u"anytypeParameter"_s, false, anytypeParameter.type() == QJsonValue::Object);
QString paramString = pathPrefix + serializeJsonValue(anytypeParameter, pathStyle, false, pathSuffix, assignOperator, pathDelimiter);
// In case style=matrix and paramString is empty due to any reasons,
// we serialize it like undefined value and delete '='.
if ((paramString == pathPrefix + pathSuffix) && QString("matrix") == "matrix"_L1)
paramString.chop(1);
fullPath.replace(anytypeParameterPathParam, paramString);
}
// set m_testOperationPath for serialization tests
m_testOperationPath = fullPath;
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] {
matrixNotExplodeAnytypeCallback(QRestReply(reply));
});
connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
if (reply) {
emit matrixNotExplodeAnytypeErrorOccurred(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 OAITestApi::matrixNotExplodeAnytypeCallback(const QRestReply &reply)
{
auto netReply = reply.networkReply();
if (netReply)
netReply->disconnect(this);
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 matrixNotExplodeAnytypeFinished(output);
}
/**
* \fn virtual void OAITestApi::matrixNotExplodeArray(const QList<qint32> &arrayParameter)
* 'matrixNotExplodeArray' operation sends the request to a server.
* The request parameters are defined by a specification file.
* @param[in] arrayParameter QList<qint32> [required]
*/
/**
* \fn template < Functor, > void OAITestApi::matrixNotExplodeArray(const QList<qint32> &arrayParameter, const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
* 'matrixNotExplodeArray' 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++}
* matrixNotExplodeArray(arrayParameter, this, [&](const QRestReply &reply, const 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 matrixNotExplodeArrayWithDataImpl() in derived class.
* The virtual matrixNotExplodeArrayWithDataImpl() is being called by the template
* function.
* @param[in] arrayParameter QList<qint32> [required]
* @param[in] context const ContextTypeForFunctor< Functor > * [optional]
* @param[in] callback Functor && [optional]
*/
/**
* \fn void OAITestApi::matrixNotExplodeArrayCallback(const QRestReply &reply)
* Processes a \a reply response from a server.
* The result of processed data is emitted by matrixNotExplodeArrayFinished() or
* being returned as a callback parameter of matrixNotExplodeArray() request.
* @param[in] reply const QRestReply &
*/
/**
* \fn virtual void OAITestApi::matrixNotExplodeArrayWithDataImpl(const QList<qint32> &arrayParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
* Implements the matrixNotExplodeArray() operation request.
* \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
* and can be overloaded for mocking matrixNotExplodeArray() operation calls.
* @param[in] arrayParameter QList<qint32> [required]
* @param[in] context const QObject * [optional]
* @param[in] slot QtPrivate::QSlotObjectBase * [optional]
*/
void OAITestApi::matrixNotExplodeArrayWithDataImpl(const QList<qint32> &arrayParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
{
const QUrl serverUrl = m_serverConfigs["matrixNotExplodeArray"][m_serverIndices.value("matrixNotExplodeArray")].serverUrl();
QString fullPath = "/path/array/matrix-not-explode/{arrayParameter}";
m_networkFactory->setBaseUrl(serverUrl);
{
QString arrayParameterPathParam = QString("{%1}").arg("arrayParameter");
QString pathStyle = "matrix";
if (pathStyle.isEmpty())
pathStyle = "simple";
const QString pathPrefix = getParamStylePrefix(pathStyle);
const QString pathDelimiter = getParamStyleDelimiter(pathStyle, false);
[[maybe_unused]] const QString assignOperator = getParamStyleAssignOperator(pathStyle, false, (!false && !true));
const QString pathSuffix = getParamStyleSuffix(pathStyle, u"arrayParameter"_s, false, (!false && !true));
QString paramString = pathPrefix + pathSuffix;
paramString = pathPrefix + serializeArrayValue(arrayParameter, pathStyle, false, pathSuffix, pathDelimiter);
// In case style=matrix and paramString is empty due to any reasons,
// we serialize it like undefined value and delete '='.
if ((paramString == pathPrefix + pathSuffix) && QString("matrix") == "matrix"_L1)
paramString.chop(1);
fullPath.replace(arrayParameterPathParam, paramString);
}
// set m_testOperationPath for serialization tests
m_testOperationPath = fullPath;
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] {
matrixNotExplodeArrayCallback(QRestReply(reply));
});
connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
if (reply) {
emit matrixNotExplodeArrayErrorOccurred(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 OAITestApi::matrixNotExplodeArrayCallback(const QRestReply &reply)
{
auto netReply = reply.networkReply();
if (netReply)
netReply->disconnect(this);
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 matrixNotExplodeArrayFinished(output);
}
/**
* \fn virtual void OAITestApi::matrixNotExplodeObject(const OAITestObject &objectParameter)
* 'matrixNotExplodeObject' operation sends the request to a server.
* The request parameters are defined by a specification file.
* @param[in] objectParameter OAITestObject [required]
*/
/**
* \fn template < Functor, > void OAITestApi::matrixNotExplodeObject(const OAITestObject &objectParameter, const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
* 'matrixNotExplodeObject' 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++}
* matrixNotExplodeObject(objectParameter, this, [&](const QRestReply &reply, const 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 matrixNotExplodeObjectWithDataImpl() in derived class.
* The virtual matrixNotExplodeObjectWithDataImpl() is being called by the template
* function.
* @param[in] objectParameter OAITestObject [required]
* @param[in] context const ContextTypeForFunctor< Functor > * [optional]
* @param[in] callback Functor && [optional]
*/
/**
* \fn void OAITestApi::matrixNotExplodeObjectCallback(const QRestReply &reply)
* Processes a \a reply response from a server.
* The result of processed data is emitted by matrixNotExplodeObjectFinished() or
* being returned as a callback parameter of matrixNotExplodeObject() request.
* @param[in] reply const QRestReply &
*/
/**
* \fn virtual void OAITestApi::matrixNotExplodeObjectWithDataImpl(const OAITestObject &objectParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
* Implements the matrixNotExplodeObject() operation request.
* \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
* and can be overloaded for mocking matrixNotExplodeObject() operation calls.
* @param[in] objectParameter OAITestObject [required]
* @param[in] context const QObject * [optional]
* @param[in] slot QtPrivate::QSlotObjectBase * [optional]
*/
void OAITestApi::matrixNotExplodeObjectWithDataImpl(const OAITestObject &objectParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
{
const QUrl serverUrl = m_serverConfigs["matrixNotExplodeObject"][m_serverIndices.value("matrixNotExplodeObject")].serverUrl();
QString fullPath = "/path/object/matrix-not-explode/{objectParameter}";
m_networkFactory->setBaseUrl(serverUrl);
{
QString objectParameterPathParam = QString("{%1}").arg("objectParameter");
QString pathStyle = "matrix";
if (pathStyle.isEmpty())
pathStyle = "simple";
const QString pathPrefix = getParamStylePrefix(pathStyle);
const QString pathDelimiter = getParamStyleDelimiter(pathStyle, false);
[[maybe_unused]] const QString assignOperator = getParamStyleAssignOperator(pathStyle, false, (!false && !false));
const QString pathSuffix = getParamStyleSuffix(pathStyle, u"objectParameter"_s, false, (!false && !false));
QString paramString = pathPrefix + pathSuffix;
paramString = pathPrefix + serializeJsonValue(QJsonValue(objectParameter.asJsonObject()), pathStyle, false, pathSuffix, assignOperator, pathDelimiter);
// In case style=matrix and paramString is empty due to any reasons,
// we serialize it like undefined value and delete '='.
if ((paramString == pathPrefix + pathSuffix) && QString("matrix") == "matrix"_L1)
paramString.chop(1);
fullPath.replace(objectParameterPathParam, paramString);
}
// set m_testOperationPath for serialization tests
m_testOperationPath = fullPath;
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] {
matrixNotExplodeObjectCallback(QRestReply(reply));
});
connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
if (reply) {
emit matrixNotExplodeObjectErrorOccurred(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 OAITestApi::matrixNotExplodeObjectCallback(const QRestReply &reply)
{
auto netReply = reply.networkReply();
if (netReply)
netReply->disconnect(this);
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 matrixNotExplodeObjectFinished(output);
}
/**
* \fn virtual void OAITestApi::matrixNotExplodeString(const QString &stringParameter)
* 'matrixNotExplodeString' operation sends the request to a server.
* The request parameters are defined by a specification file.
* @param[in] stringParameter QString [required]
*/
/**
* \fn template < Functor, > void OAITestApi::matrixNotExplodeString(const QString &stringParameter, const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
* 'matrixNotExplodeString' 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++}
* matrixNotExplodeString(stringParameter, this, [&](const QRestReply &reply, const 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 matrixNotExplodeStringWithDataImpl() in derived class.
* The virtual matrixNotExplodeStringWithDataImpl() is being called by the template
* function.
* @param[in] stringParameter QString [required]
* @param[in] context const ContextTypeForFunctor< Functor > * [optional]
* @param[in] callback Functor && [optional]
*/
/**
* \fn void OAITestApi::matrixNotExplodeStringCallback(const QRestReply &reply)
* Processes a \a reply response from a server.
* The result of processed data is emitted by matrixNotExplodeStringFinished() or
* being returned as a callback parameter of matrixNotExplodeString() request.
* @param[in] reply const QRestReply &
*/
/**
* \fn virtual void OAITestApi::matrixNotExplodeStringWithDataImpl(const QString &stringParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
* Implements the matrixNotExplodeString() operation request.
* \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
* and can be overloaded for mocking matrixNotExplodeString() operation calls.
* @param[in] stringParameter QString [required]
* @param[in] context const QObject * [optional]
* @param[in] slot QtPrivate::QSlotObjectBase * [optional]
*/
void OAITestApi::matrixNotExplodeStringWithDataImpl(const QString &stringParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
{
const QUrl serverUrl = m_serverConfigs["matrixNotExplodeString"][m_serverIndices.value("matrixNotExplodeString")].serverUrl();
QString fullPath = "/path/string/matrix-not-explode/{stringParameter}";
m_networkFactory->setBaseUrl(serverUrl);
{
QString stringParameterPathParam = QString("{%1}").arg("stringParameter");
QString pathStyle = "matrix";
if (pathStyle.isEmpty())
pathStyle = "simple";
const QString pathPrefix = getParamStylePrefix(pathStyle);
const QString pathDelimiter = getParamStyleDelimiter(pathStyle, false);
[[maybe_unused]] const QString assignOperator = getParamStyleAssignOperator(pathStyle, false, (!true && !false));
const QString pathSuffix = getParamStyleSuffix(pathStyle, u"stringParameter"_s, false, (!true && !false));
QString paramString = pathPrefix + pathSuffix;
paramString += QUrl::toPercentEncoding(::OpenAPI::toStringValue(stringParameter));
// In case style=matrix and paramString is empty due to any reasons,
// we serialize it like undefined value and delete '='.
if ((paramString == pathPrefix + pathSuffix) && QString("matrix") == "matrix"_L1)
paramString.chop(1);
fullPath.replace(stringParameterPathParam, paramString);
}
// set m_testOperationPath for serialization tests
m_testOperationPath = fullPath;
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] {
matrixNotExplodeStringCallback(QRestReply(reply));
});
connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
if (reply) {
emit matrixNotExplodeStringErrorOccurred(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 OAITestApi::matrixNotExplodeStringCallback(const QRestReply &reply)
{
auto netReply = reply.networkReply();
if (netReply)
netReply->disconnect(this);
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 matrixNotExplodeStringFinished(output);
}
/**
* \fn virtual void OAITestApi::pipeDelimitedExplodeAnytype(const QJsonValue &anytypeParameter)
* 'pipeDelimitedExplodeAnytype' operation sends the request to a server.
* The request parameters are defined by a specification file.
* @param[in] anytypeParameter QJsonValue [required]
*/
/**
* \fn template < Functor, > void OAITestApi::pipeDelimitedExplodeAnytype(const QJsonValue &anytypeParameter, const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
* 'pipeDelimitedExplodeAnytype' 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++}
* pipeDelimitedExplodeAnytype(anytypeParameter, this, [&](const QRestReply &reply, const 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 pipeDelimitedExplodeAnytypeWithDataImpl() in derived class.
* The virtual pipeDelimitedExplodeAnytypeWithDataImpl() is being called by the template
* function.
* @param[in] anytypeParameter QJsonValue [required]
* @param[in] context const ContextTypeForFunctor< Functor > * [optional]
* @param[in] callback Functor && [optional]
*/
/**
* \fn void OAITestApi::pipeDelimitedExplodeAnytypeCallback(const QRestReply &reply)
* Processes a \a reply response from a server.
* The result of processed data is emitted by pipeDelimitedExplodeAnytypeFinished() or
* being returned as a callback parameter of pipeDelimitedExplodeAnytype() request.
* @param[in] reply const QRestReply &
*/
/**
* \fn virtual void OAITestApi::pipeDelimitedExplodeAnytypeWithDataImpl(const QJsonValue &anytypeParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
* Implements the pipeDelimitedExplodeAnytype() operation request.
* \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
* and can be overloaded for mocking pipeDelimitedExplodeAnytype() operation calls.
* @param[in] anytypeParameter QJsonValue [required]
* @param[in] context const QObject * [optional]
* @param[in] slot QtPrivate::QSlotObjectBase * [optional]
*/
void OAITestApi::pipeDelimitedExplodeAnytypeWithDataImpl(const QJsonValue &anytypeParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
{
const QUrl serverUrl = m_serverConfigs["pipeDelimitedExplodeAnytype"][m_serverIndices.value("pipeDelimitedExplodeAnytype")].serverUrl();
QString fullPath = "/query/anytype/pipeDelimited-explode/pipeDelimitedExplodeAnytype";
m_networkFactory->setBaseUrl(serverUrl);
int queryParamCounter = 0;
{
[[maybe_unused]] QString paramString;
QString queryStyle = "pipeDelimited";
if (queryStyle.isEmpty())
queryStyle = "form";
const QString queryPrefix = getParamStylePrefix(queryStyle);
[[maybe_unused]] const QString queryDelimiter = getParamStyleDelimiter(queryStyle, true);
const QString querySuffix = getParamStyleSuffix(queryStyle, u"anytypeParameter"_s, true, anytypeParameter.type() == QJsonValue::Object);
const QString queryAssignOperator = getParamStyleAssignOperator(queryStyle, true, anytypeParameter.type() == QJsonValue::Object);
if ((fullPath.indexOf("?") != fullPath.size() - 1) && (queryParamCounter == 0))
fullPath.append(queryPrefix);
{
if (queryParamCounter > 0)
fullPath.append("&");
paramString = serializeJsonValue(anytypeParameter, queryStyle, true, querySuffix, queryAssignOperator, queryDelimiter);
fullPath.append(paramString);
queryParamCounter++;
}
}
// set m_testOperationPath for serialization tests
m_testOperationPath = fullPath;
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] {
pipeDelimitedExplodeAnytypeCallback(QRestReply(reply));
});
connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
if (reply) {
emit pipeDelimitedExplodeAnytypeErrorOccurred(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 OAITestApi::pipeDelimitedExplodeAnytypeCallback(const QRestReply &reply)
{
auto netReply = reply.networkReply();
if (netReply)
netReply->disconnect(this);
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 pipeDelimitedExplodeAnytypeFinished(output);
}
/**
* \fn virtual void OAITestApi::pipeDelimitedExplodeArray(const QList<qint32> &arrayParameter)
* 'pipeDelimitedExplodeArray' operation sends the request to a server.
* The request parameters are defined by a specification file.
* @param[in] arrayParameter QList<qint32> [required]
*/
/**
* \fn template < Functor, > void OAITestApi::pipeDelimitedExplodeArray(const QList<qint32> &arrayParameter, const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
* 'pipeDelimitedExplodeArray' 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++}
* pipeDelimitedExplodeArray(arrayParameter, this, [&](const QRestReply &reply, const 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 pipeDelimitedExplodeArrayWithDataImpl() in derived class.
* The virtual pipeDelimitedExplodeArrayWithDataImpl() is being called by the template
* function.
* @param[in] arrayParameter QList<qint32> [required]
* @param[in] context const ContextTypeForFunctor< Functor > * [optional]
* @param[in] callback Functor && [optional]
*/
/**
* \fn void OAITestApi::pipeDelimitedExplodeArrayCallback(const QRestReply &reply)
* Processes a \a reply response from a server.
* The result of processed data is emitted by pipeDelimitedExplodeArrayFinished() or
* being returned as a callback parameter of pipeDelimitedExplodeArray() request.
* @param[in] reply const QRestReply &
*/
/**
* \fn virtual void OAITestApi::pipeDelimitedExplodeArrayWithDataImpl(const QList<qint32> &arrayParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
* Implements the pipeDelimitedExplodeArray() operation request.
* \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
* and can be overloaded for mocking pipeDelimitedExplodeArray() operation calls.
* @param[in] arrayParameter QList<qint32> [required]
* @param[in] context const QObject * [optional]
* @param[in] slot QtPrivate::QSlotObjectBase * [optional]
*/
void OAITestApi::pipeDelimitedExplodeArrayWithDataImpl(const QList<qint32> &arrayParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
{
const QUrl serverUrl = m_serverConfigs["pipeDelimitedExplodeArray"][m_serverIndices.value("pipeDelimitedExplodeArray")].serverUrl();
QString fullPath = "/query/array/pipeDelimited-explode/pipeDelimitedExplodeArray";
m_networkFactory->setBaseUrl(serverUrl);
int queryParamCounter = 0;
{
[[maybe_unused]] QString paramString;
QString queryStyle = "pipeDelimited";
if (queryStyle.isEmpty())
queryStyle = "form";
const QString queryPrefix = getParamStylePrefix(queryStyle);
[[maybe_unused]] const QString queryDelimiter = getParamStyleDelimiter(queryStyle, true);
const QString querySuffix = getParamStyleSuffix(queryStyle, u"arrayParameter"_s, true, (!false && !true));
[[maybe_unused]] const QString queryAssignOperator = getParamStyleAssignOperator(queryStyle, true, (!false && !true));
if ((fullPath.indexOf("?") != fullPath.size() - 1) && (queryParamCounter == 0))
fullPath.append(queryPrefix);
{
if (queryParamCounter > 0)
fullPath.append("&");
fullPath.append(serializeArrayValue(arrayParameter, queryStyle, true, querySuffix, queryDelimiter));
queryParamCounter++;
}
}
// set m_testOperationPath for serialization tests
m_testOperationPath = fullPath;
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] {
pipeDelimitedExplodeArrayCallback(QRestReply(reply));
});
connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
if (reply) {
emit pipeDelimitedExplodeArrayErrorOccurred(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 OAITestApi::pipeDelimitedExplodeArrayCallback(const QRestReply &reply)
{
auto netReply = reply.networkReply();
if (netReply)
netReply->disconnect(this);
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 pipeDelimitedExplodeArrayFinished(output);
}
/**
* \fn virtual void OAITestApi::pipeDelimitedExplodeObject(const OAITestObject &objectParameter)
* 'pipeDelimitedExplodeObject' operation sends the request to a server.
* The request parameters are defined by a specification file.
* @param[in] objectParameter OAITestObject [required]
*/
/**
* \fn template < Functor, > void OAITestApi::pipeDelimitedExplodeObject(const OAITestObject &objectParameter, const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
* 'pipeDelimitedExplodeObject' 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++}
* pipeDelimitedExplodeObject(objectParameter, this, [&](const QRestReply &reply, const 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 pipeDelimitedExplodeObjectWithDataImpl() in derived class.
* The virtual pipeDelimitedExplodeObjectWithDataImpl() is being called by the template
* function.
* @param[in] objectParameter OAITestObject [required]
* @param[in] context const ContextTypeForFunctor< Functor > * [optional]
* @param[in] callback Functor && [optional]
*/
/**
* \fn void OAITestApi::pipeDelimitedExplodeObjectCallback(const QRestReply &reply)
* Processes a \a reply response from a server.
* The result of processed data is emitted by pipeDelimitedExplodeObjectFinished() or
* being returned as a callback parameter of pipeDelimitedExplodeObject() request.
* @param[in] reply const QRestReply &
*/
/**
* \fn virtual void OAITestApi::pipeDelimitedExplodeObjectWithDataImpl(const OAITestObject &objectParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
* Implements the pipeDelimitedExplodeObject() operation request.
* \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
* and can be overloaded for mocking pipeDelimitedExplodeObject() operation calls.
* @param[in] objectParameter OAITestObject [required]
* @param[in] context const QObject * [optional]
* @param[in] slot QtPrivate::QSlotObjectBase * [optional]
*/
void OAITestApi::pipeDelimitedExplodeObjectWithDataImpl(const OAITestObject &objectParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
{
const QUrl serverUrl = m_serverConfigs["pipeDelimitedExplodeObject"][m_serverIndices.value("pipeDelimitedExplodeObject")].serverUrl();
QString fullPath = "/query/object/pipeDelimited-explode/pipeDelimitedExplodeObject";
m_networkFactory->setBaseUrl(serverUrl);
int queryParamCounter = 0;
{
[[maybe_unused]] QString paramString;
QString queryStyle = "pipeDelimited";
if (queryStyle.isEmpty())
queryStyle = "form";
const QString queryPrefix = getParamStylePrefix(queryStyle);
[[maybe_unused]] const QString queryDelimiter = getParamStyleDelimiter(queryStyle, true);
const QString querySuffix = getParamStyleSuffix(queryStyle, u"objectParameter"_s, true, (!false && !false));
[[maybe_unused]] const QString queryAssignOperator = getParamStyleAssignOperator(queryStyle, true, (!false && !false));
paramString = querySuffix;
if ((fullPath.indexOf("?") != fullPath.size() - 1) && (queryParamCounter == 0))
fullPath.append(queryPrefix);
{
if (queryParamCounter > 0)
fullPath.append("&");
const QJsonObject parameter = objectParameter.asJsonObject();
if (queryStyle == "deepObject") {
qint32 index = 0;
if (parameter.isEmpty())
qWarning() << "Serialized QJsonValue::Object is empty!";
for (const QString& key : parameter.keys()) {
if (index > 0)
paramString.append(queryDelimiter);
paramString.append(::OpenAPI::optionParameterToString(QString("objectParameter") + QString("[") + key + QString("]"), queryAssignOperator, parameter.value(key)));
index++;
}
} else {
paramString = serializeJsonValue(QJsonValue(parameter), queryStyle, true, querySuffix, queryAssignOperator, queryDelimiter);
}
// style=form && explode=true && non-object => 'objectParameter' isn't used in serialization
// style=form && explode=true && empty object => need to be 'objectParameter='
if (paramString.isEmpty() && queryStyle == "form")
paramString = u"objectParameter="_s;
fullPath.append(paramString);
queryParamCounter++;
}
}
// set m_testOperationPath for serialization tests
m_testOperationPath = fullPath;
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] {
pipeDelimitedExplodeObjectCallback(QRestReply(reply));
});
connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
if (reply) {
emit pipeDelimitedExplodeObjectErrorOccurred(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 OAITestApi::pipeDelimitedExplodeObjectCallback(const QRestReply &reply)
{
auto netReply = reply.networkReply();
if (netReply)
netReply->disconnect(this);
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 pipeDelimitedExplodeObjectFinished(output);
}
/**
* \fn virtual void OAITestApi::pipeDelimitedNotExplodeAnytype(const ::OpenAPI::OptionalParam<QJsonValue> &anytypeParameter = ::OpenAPI::OptionalParam<QJsonValue>())
* 'pipeDelimitedNotExplodeAnytype' operation sends the request to a server.
* The request parameters are defined by a specification file.
* @param[in] anytypeParameter QJsonValue [optional]
*/
/**
* \fn template < Functor, > void OAITestApi::pipeDelimitedNotExplodeAnytype(const ::OpenAPI::OptionalParam<QJsonValue> &anytypeParameter = ::OpenAPI::OptionalParam<QJsonValue>(), const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
* 'pipeDelimitedNotExplodeAnytype' 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++}
* pipeDelimitedNotExplodeAnytype(anytypeParameter, this, [&](const QRestReply &reply, const 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 pipeDelimitedNotExplodeAnytypeWithDataImpl() in derived class.
* The virtual pipeDelimitedNotExplodeAnytypeWithDataImpl() is being called by the template
* function.
* @param[in] anytypeParameter QJsonValue [optional]
* @param[in] context const ContextTypeForFunctor< Functor > * [optional]
* @param[in] callback Functor && [optional]
*/
/**
* \fn void OAITestApi::pipeDelimitedNotExplodeAnytypeCallback(const QRestReply &reply)
* Processes a \a reply response from a server.
* The result of processed data is emitted by pipeDelimitedNotExplodeAnytypeFinished() or
* being returned as a callback parameter of pipeDelimitedNotExplodeAnytype() request.
* @param[in] reply const QRestReply &
*/
/**
* \fn virtual void OAITestApi::pipeDelimitedNotExplodeAnytypeWithDataImpl(const ::OpenAPI::OptionalParam<QJsonValue> &anytypeParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
* Implements the pipeDelimitedNotExplodeAnytype() operation request.
* \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
* and can be overloaded for mocking pipeDelimitedNotExplodeAnytype() operation calls.
* @param[in] anytypeParameter QJsonValue [optional]
* @param[in] context const QObject * [optional]
* @param[in] slot QtPrivate::QSlotObjectBase * [optional]
*/
void OAITestApi::pipeDelimitedNotExplodeAnytypeWithDataImpl(const ::OpenAPI::OptionalParam<QJsonValue> &anytypeParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
{
const QUrl serverUrl = m_serverConfigs["pipeDelimitedNotExplodeAnytype"][m_serverIndices.value("pipeDelimitedNotExplodeAnytype")].serverUrl();
QString fullPath = "/query/anytype/pipeDelimited-not-explode/pipeDelimitedNotExplodeAnytype";
m_networkFactory->setBaseUrl(serverUrl);
int queryParamCounter = 0;
{
[[maybe_unused]] QString paramString;
QString queryStyle = "pipeDelimited";
if (queryStyle.isEmpty())
queryStyle = "form";
const QString queryPrefix = getParamStylePrefix(queryStyle);
[[maybe_unused]] const QString queryDelimiter = getParamStyleDelimiter(queryStyle, false);
const QString querySuffix = getParamStyleSuffix(queryStyle, u"anytypeParameter"_s, false, anytypeParameter.value().type() == QJsonValue::Object);
const QString queryAssignOperator = getParamStyleAssignOperator(queryStyle, false, anytypeParameter.value().type() == QJsonValue::Object);
if ((fullPath.indexOf("?") != fullPath.size() - 1) && (queryParamCounter == 0))
fullPath.append(queryPrefix);
if (anytypeParameter.hasValue()) {
if (queryParamCounter > 0)
fullPath.append("&");
paramString = serializeJsonValue(anytypeParameter.value(), queryStyle, false, querySuffix, queryAssignOperator, queryDelimiter);
fullPath.append(paramString);
queryParamCounter++;
}
}
// set m_testOperationPath for serialization tests
m_testOperationPath = fullPath;
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] {
pipeDelimitedNotExplodeAnytypeCallback(QRestReply(reply));
});
connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
if (reply) {
emit pipeDelimitedNotExplodeAnytypeErrorOccurred(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 OAITestApi::pipeDelimitedNotExplodeAnytypeCallback(const QRestReply &reply)
{
auto netReply = reply.networkReply();
if (netReply)
netReply->disconnect(this);
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 pipeDelimitedNotExplodeAnytypeFinished(output);
}
/**
* \fn virtual void OAITestApi::pipeDelimitedNotExplodeArray(const ::OpenAPI::OptionalParam<QList<qint32>> &arrayParameter = ::OpenAPI::OptionalParam<QList<qint32>>())
* 'pipeDelimitedNotExplodeArray' operation sends the request to a server.
* The request parameters are defined by a specification file.
* @param[in] arrayParameter QList<qint32> [optional]
*/
/**
* \fn template < Functor, > void OAITestApi::pipeDelimitedNotExplodeArray(const ::OpenAPI::OptionalParam<QList<qint32>> &arrayParameter = ::OpenAPI::OptionalParam<QList<qint32>>(), const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
* 'pipeDelimitedNotExplodeArray' 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++}
* pipeDelimitedNotExplodeArray(arrayParameter, this, [&](const QRestReply &reply, const 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 pipeDelimitedNotExplodeArrayWithDataImpl() in derived class.
* The virtual pipeDelimitedNotExplodeArrayWithDataImpl() is being called by the template
* function.
* @param[in] arrayParameter QList<qint32> [optional]
* @param[in] context const ContextTypeForFunctor< Functor > * [optional]
* @param[in] callback Functor && [optional]
*/
/**
* \fn void OAITestApi::pipeDelimitedNotExplodeArrayCallback(const QRestReply &reply)
* Processes a \a reply response from a server.
* The result of processed data is emitted by pipeDelimitedNotExplodeArrayFinished() or
* being returned as a callback parameter of pipeDelimitedNotExplodeArray() request.
* @param[in] reply const QRestReply &
*/
/**
* \fn virtual void OAITestApi::pipeDelimitedNotExplodeArrayWithDataImpl(const ::OpenAPI::OptionalParam<QList<qint32>> &arrayParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
* Implements the pipeDelimitedNotExplodeArray() operation request.
* \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
* and can be overloaded for mocking pipeDelimitedNotExplodeArray() operation calls.
* @param[in] arrayParameter QList<qint32> [optional]
* @param[in] context const QObject * [optional]
* @param[in] slot QtPrivate::QSlotObjectBase * [optional]
*/
void OAITestApi::pipeDelimitedNotExplodeArrayWithDataImpl(const ::OpenAPI::OptionalParam<QList<qint32>> &arrayParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
{
const QUrl serverUrl = m_serverConfigs["pipeDelimitedNotExplodeArray"][m_serverIndices.value("pipeDelimitedNotExplodeArray")].serverUrl();
QString fullPath = "/query/array/pipeDelimited-not-explode/pipeDelimitedNotExplodeArray";
m_networkFactory->setBaseUrl(serverUrl);
int queryParamCounter = 0;
{
[[maybe_unused]] QString paramString;
QString queryStyle = "pipeDelimited";
if (queryStyle.isEmpty())
queryStyle = "form";
const QString queryPrefix = getParamStylePrefix(queryStyle);
[[maybe_unused]] const QString queryDelimiter = getParamStyleDelimiter(queryStyle, false);
const QString querySuffix = getParamStyleSuffix(queryStyle, u"arrayParameter"_s, false, (!false && !true));
[[maybe_unused]] const QString queryAssignOperator = getParamStyleAssignOperator(queryStyle, false, (!false && !true));
if ((fullPath.indexOf("?") != fullPath.size() - 1) && (queryParamCounter == 0))
fullPath.append(queryPrefix);
if (arrayParameter.hasValue()) {
if (queryParamCounter > 0)
fullPath.append("&");
fullPath.append(serializeArrayValue(arrayParameter.value(), queryStyle, false, querySuffix, queryDelimiter));
queryParamCounter++;
}
}
// set m_testOperationPath for serialization tests
m_testOperationPath = fullPath;
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] {
pipeDelimitedNotExplodeArrayCallback(QRestReply(reply));
});
connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
if (reply) {
emit pipeDelimitedNotExplodeArrayErrorOccurred(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 OAITestApi::pipeDelimitedNotExplodeArrayCallback(const QRestReply &reply)
{
auto netReply = reply.networkReply();
if (netReply)
netReply->disconnect(this);
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 pipeDelimitedNotExplodeArrayFinished(output);
}
/**
* \fn virtual void OAITestApi::pipeDelimitedNotExplodeObject(const ::OpenAPI::OptionalParam<OAITestObject> &objectParameter = ::OpenAPI::OptionalParam<OAITestObject>())
* 'pipeDelimitedNotExplodeObject' operation sends the request to a server.
* The request parameters are defined by a specification file.
* @param[in] objectParameter OAITestObject [optional]
*/
/**
* \fn template < Functor, > void OAITestApi::pipeDelimitedNotExplodeObject(const ::OpenAPI::OptionalParam<OAITestObject> &objectParameter = ::OpenAPI::OptionalParam<OAITestObject>(), const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
* 'pipeDelimitedNotExplodeObject' 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++}
* pipeDelimitedNotExplodeObject(objectParameter, this, [&](const QRestReply &reply, const 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 pipeDelimitedNotExplodeObjectWithDataImpl() in derived class.
* The virtual pipeDelimitedNotExplodeObjectWithDataImpl() is being called by the template
* function.
* @param[in] objectParameter OAITestObject [optional]
* @param[in] context const ContextTypeForFunctor< Functor > * [optional]
* @param[in] callback Functor && [optional]
*/
/**
* \fn void OAITestApi::pipeDelimitedNotExplodeObjectCallback(const QRestReply &reply)
* Processes a \a reply response from a server.
* The result of processed data is emitted by pipeDelimitedNotExplodeObjectFinished() or
* being returned as a callback parameter of pipeDelimitedNotExplodeObject() request.
* @param[in] reply const QRestReply &
*/
/**
* \fn virtual void OAITestApi::pipeDelimitedNotExplodeObjectWithDataImpl(const ::OpenAPI::OptionalParam<OAITestObject> &objectParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
* Implements the pipeDelimitedNotExplodeObject() operation request.
* \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
* and can be overloaded for mocking pipeDelimitedNotExplodeObject() operation calls.
* @param[in] objectParameter OAITestObject [optional]
* @param[in] context const QObject * [optional]
* @param[in] slot QtPrivate::QSlotObjectBase * [optional]
*/
void OAITestApi::pipeDelimitedNotExplodeObjectWithDataImpl(const ::OpenAPI::OptionalParam<OAITestObject> &objectParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
{
const QUrl serverUrl = m_serverConfigs["pipeDelimitedNotExplodeObject"][m_serverIndices.value("pipeDelimitedNotExplodeObject")].serverUrl();
QString fullPath = "/query/object/pipeDelimited-not-explode/pipeDelimitedNotExplodeObject";
m_networkFactory->setBaseUrl(serverUrl);
int queryParamCounter = 0;
{
[[maybe_unused]] QString paramString;
QString queryStyle = "pipeDelimited";
if (queryStyle.isEmpty())
queryStyle = "form";
const QString queryPrefix = getParamStylePrefix(queryStyle);
[[maybe_unused]] const QString queryDelimiter = getParamStyleDelimiter(queryStyle, false);
const QString querySuffix = getParamStyleSuffix(queryStyle, u"objectParameter"_s, false, (!false && !false));
[[maybe_unused]] const QString queryAssignOperator = getParamStyleAssignOperator(queryStyle, false, (!false && !false));
paramString = querySuffix;
if ((fullPath.indexOf("?") != fullPath.size() - 1) && (queryParamCounter == 0))
fullPath.append(queryPrefix);
if (objectParameter.hasValue()) {
if (queryParamCounter > 0)
fullPath.append("&");
const QJsonObject parameter = objectParameter.value().asJsonObject();
if (queryStyle == "deepObject") {
qint32 index = 0;
if (parameter.isEmpty())
qWarning() << "Serialized QJsonValue::Object is empty!";
for (const QString& key : parameter.keys()) {
if (index > 0)
paramString.append(queryDelimiter);
paramString.append(::OpenAPI::optionParameterToString(QString("objectParameter") + QString("[") + key + QString("]"), queryAssignOperator, parameter.value(key)));
index++;
}
} else {
paramString = serializeJsonValue(QJsonValue(parameter), queryStyle, false, querySuffix, queryAssignOperator, queryDelimiter);
}
// style=form && explode=true && non-object => 'objectParameter' isn't used in serialization
// style=form && explode=true && empty object => need to be 'objectParameter='
if (paramString.isEmpty() && queryStyle == "form")
paramString = u"objectParameter="_s;
fullPath.append(paramString);
queryParamCounter++;
}
}
// set m_testOperationPath for serialization tests
m_testOperationPath = fullPath;
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] {
pipeDelimitedNotExplodeObjectCallback(QRestReply(reply));
});
connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
if (reply) {
emit pipeDelimitedNotExplodeObjectErrorOccurred(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 OAITestApi::pipeDelimitedNotExplodeObjectCallback(const QRestReply &reply)
{
auto netReply = reply.networkReply();
if (netReply)
netReply->disconnect(this);
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 pipeDelimitedNotExplodeObjectFinished(output);
}
/**
* \fn virtual void OAITestApi::simpleExplodeAnytype(const QJsonValue &anytypeParameter)
* 'simpleExplodeAnytype' operation sends the request to a server.
* The request parameters are defined by a specification file.
* @param[in] anytypeParameter QJsonValue [required]
*/
/**
* \fn template < Functor, > void OAITestApi::simpleExplodeAnytype(const QJsonValue &anytypeParameter, const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
* 'simpleExplodeAnytype' 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++}
* simpleExplodeAnytype(anytypeParameter, this, [&](const QRestReply &reply, const 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 simpleExplodeAnytypeWithDataImpl() in derived class.
* The virtual simpleExplodeAnytypeWithDataImpl() is being called by the template
* function.
* @param[in] anytypeParameter QJsonValue [required]
* @param[in] context const ContextTypeForFunctor< Functor > * [optional]
* @param[in] callback Functor && [optional]
*/
/**
* \fn void OAITestApi::simpleExplodeAnytypeCallback(const QRestReply &reply)
* Processes a \a reply response from a server.
* The result of processed data is emitted by simpleExplodeAnytypeFinished() or
* being returned as a callback parameter of simpleExplodeAnytype() request.
* @param[in] reply const QRestReply &
*/
/**
* \fn virtual void OAITestApi::simpleExplodeAnytypeWithDataImpl(const QJsonValue &anytypeParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
* Implements the simpleExplodeAnytype() operation request.
* \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
* and can be overloaded for mocking simpleExplodeAnytype() operation calls.
* @param[in] anytypeParameter QJsonValue [required]
* @param[in] context const QObject * [optional]
* @param[in] slot QtPrivate::QSlotObjectBase * [optional]
*/
void OAITestApi::simpleExplodeAnytypeWithDataImpl(const QJsonValue &anytypeParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
{
const QUrl serverUrl = m_serverConfigs["simpleExplodeAnytype"][m_serverIndices.value("simpleExplodeAnytype")].serverUrl();
QString fullPath = "/path/anytype/simple-explode/{anytypeParameter}";
m_networkFactory->setBaseUrl(serverUrl);
{
QString anytypeParameterPathParam = QString("{%1}").arg("anytypeParameter");
QString pathStyle = "simple";
if (pathStyle.isEmpty())
pathStyle = "simple";
const QString pathPrefix = getParamStylePrefix(pathStyle);
const QString pathDelimiter = getParamStyleDelimiter(pathStyle, true);
const QString assignOperator = getParamStyleAssignOperator(pathStyle, true, anytypeParameter.type() == QJsonValue::Object);
const QString pathSuffix = getParamStyleSuffix(pathStyle, u"anytypeParameter"_s, true, anytypeParameter.type() == QJsonValue::Object);
QString paramString = pathPrefix + serializeJsonValue(anytypeParameter, pathStyle, true, pathSuffix, assignOperator, pathDelimiter);
// In case style=matrix and paramString is empty due to any reasons,
// we serialize it like undefined value and delete '='.
if ((paramString == pathPrefix + pathSuffix) && QString("simple") == "matrix"_L1)
paramString.chop(1);
fullPath.replace(anytypeParameterPathParam, paramString);
}
// set m_testOperationPath for serialization tests
m_testOperationPath = fullPath;
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] {
simpleExplodeAnytypeCallback(QRestReply(reply));
});
connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
if (reply) {
emit simpleExplodeAnytypeErrorOccurred(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 OAITestApi::simpleExplodeAnytypeCallback(const QRestReply &reply)
{
auto netReply = reply.networkReply();
if (netReply)
netReply->disconnect(this);
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 simpleExplodeAnytypeFinished(output);
}
/**
* \fn virtual void OAITestApi::simpleExplodeArray(const QList<qint32> &arrayParameter)
* 'simpleExplodeArray' operation sends the request to a server.
* The request parameters are defined by a specification file.
* @param[in] arrayParameter QList<qint32> [required]
*/
/**
* \fn template < Functor, > void OAITestApi::simpleExplodeArray(const QList<qint32> &arrayParameter, const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
* 'simpleExplodeArray' 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++}
* simpleExplodeArray(arrayParameter, this, [&](const QRestReply &reply, const 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 simpleExplodeArrayWithDataImpl() in derived class.
* The virtual simpleExplodeArrayWithDataImpl() is being called by the template
* function.
* @param[in] arrayParameter QList<qint32> [required]
* @param[in] context const ContextTypeForFunctor< Functor > * [optional]
* @param[in] callback Functor && [optional]
*/
/**
* \fn void OAITestApi::simpleExplodeArrayCallback(const QRestReply &reply)
* Processes a \a reply response from a server.
* The result of processed data is emitted by simpleExplodeArrayFinished() or
* being returned as a callback parameter of simpleExplodeArray() request.
* @param[in] reply const QRestReply &
*/
/**
* \fn virtual void OAITestApi::simpleExplodeArrayWithDataImpl(const QList<qint32> &arrayParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
* Implements the simpleExplodeArray() operation request.
* \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
* and can be overloaded for mocking simpleExplodeArray() operation calls.
* @param[in] arrayParameter QList<qint32> [required]
* @param[in] context const QObject * [optional]
* @param[in] slot QtPrivate::QSlotObjectBase * [optional]
*/
void OAITestApi::simpleExplodeArrayWithDataImpl(const QList<qint32> &arrayParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
{
const QUrl serverUrl = m_serverConfigs["simpleExplodeArray"][m_serverIndices.value("simpleExplodeArray")].serverUrl();
QString fullPath = "/path/array/simple-explode/{arrayParameter}";
m_networkFactory->setBaseUrl(serverUrl);
{
QString arrayParameterPathParam = QString("{%1}").arg("arrayParameter");
QString pathStyle = "simple";
if (pathStyle.isEmpty())
pathStyle = "simple";
const QString pathPrefix = getParamStylePrefix(pathStyle);
const QString pathDelimiter = getParamStyleDelimiter(pathStyle, true);
[[maybe_unused]] const QString assignOperator = getParamStyleAssignOperator(pathStyle, true, (!false && !true));
const QString pathSuffix = getParamStyleSuffix(pathStyle, u"arrayParameter"_s, true, (!false && !true));
QString paramString = pathPrefix + pathSuffix;
paramString = pathPrefix + serializeArrayValue(arrayParameter, pathStyle, true, pathSuffix, pathDelimiter);
// In case style=matrix and paramString is empty due to any reasons,
// we serialize it like undefined value and delete '='.
if ((paramString == pathPrefix + pathSuffix) && QString("simple") == "matrix"_L1)
paramString.chop(1);
fullPath.replace(arrayParameterPathParam, paramString);
}
// set m_testOperationPath for serialization tests
m_testOperationPath = fullPath;
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] {
simpleExplodeArrayCallback(QRestReply(reply));
});
connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
if (reply) {
emit simpleExplodeArrayErrorOccurred(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 OAITestApi::simpleExplodeArrayCallback(const QRestReply &reply)
{
auto netReply = reply.networkReply();
if (netReply)
netReply->disconnect(this);
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 simpleExplodeArrayFinished(output);
}
/**
* \fn virtual void OAITestApi::simpleExplodeObject(const OAITestObject &objectParameter)
* 'simpleExplodeObject' operation sends the request to a server.
* The request parameters are defined by a specification file.
* @param[in] objectParameter OAITestObject [required]
*/
/**
* \fn template < Functor, > void OAITestApi::simpleExplodeObject(const OAITestObject &objectParameter, const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
* 'simpleExplodeObject' 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++}
* simpleExplodeObject(objectParameter, this, [&](const QRestReply &reply, const 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 simpleExplodeObjectWithDataImpl() in derived class.
* The virtual simpleExplodeObjectWithDataImpl() is being called by the template
* function.
* @param[in] objectParameter OAITestObject [required]
* @param[in] context const ContextTypeForFunctor< Functor > * [optional]
* @param[in] callback Functor && [optional]
*/
/**
* \fn void OAITestApi::simpleExplodeObjectCallback(const QRestReply &reply)
* Processes a \a reply response from a server.
* The result of processed data is emitted by simpleExplodeObjectFinished() or
* being returned as a callback parameter of simpleExplodeObject() request.
* @param[in] reply const QRestReply &
*/
/**
* \fn virtual void OAITestApi::simpleExplodeObjectWithDataImpl(const OAITestObject &objectParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
* Implements the simpleExplodeObject() operation request.
* \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
* and can be overloaded for mocking simpleExplodeObject() operation calls.
* @param[in] objectParameter OAITestObject [required]
* @param[in] context const QObject * [optional]
* @param[in] slot QtPrivate::QSlotObjectBase * [optional]
*/
void OAITestApi::simpleExplodeObjectWithDataImpl(const OAITestObject &objectParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
{
const QUrl serverUrl = m_serverConfigs["simpleExplodeObject"][m_serverIndices.value("simpleExplodeObject")].serverUrl();
QString fullPath = "/path/object/simple-explode/{objectParameter}";
m_networkFactory->setBaseUrl(serverUrl);
{
QString objectParameterPathParam = QString("{%1}").arg("objectParameter");
QString pathStyle = "simple";
if (pathStyle.isEmpty())
pathStyle = "simple";
const QString pathPrefix = getParamStylePrefix(pathStyle);
const QString pathDelimiter = getParamStyleDelimiter(pathStyle, true);
[[maybe_unused]] const QString assignOperator = getParamStyleAssignOperator(pathStyle, true, (!false && !false));
const QString pathSuffix = getParamStyleSuffix(pathStyle, u"objectParameter"_s, true, (!false && !false));
QString paramString = pathPrefix + pathSuffix;
paramString = pathPrefix + serializeJsonValue(QJsonValue(objectParameter.asJsonObject()), pathStyle, true, pathSuffix, assignOperator, pathDelimiter);
// In case style=matrix and paramString is empty due to any reasons,
// we serialize it like undefined value and delete '='.
if ((paramString == pathPrefix + pathSuffix) && QString("simple") == "matrix"_L1)
paramString.chop(1);
fullPath.replace(objectParameterPathParam, paramString);
}
// set m_testOperationPath for serialization tests
m_testOperationPath = fullPath;
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] {
simpleExplodeObjectCallback(QRestReply(reply));
});
connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
if (reply) {
emit simpleExplodeObjectErrorOccurred(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 OAITestApi::simpleExplodeObjectCallback(const QRestReply &reply)
{
auto netReply = reply.networkReply();
if (netReply)
netReply->disconnect(this);
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 simpleExplodeObjectFinished(output);
}
/**
* \fn virtual void OAITestApi::simpleExplodeString(const QString &stringParameter)
* 'simpleExplodeString' operation sends the request to a server.
* The request parameters are defined by a specification file.
* @param[in] stringParameter QString [required]
*/
/**
* \fn template < Functor, > void OAITestApi::simpleExplodeString(const QString &stringParameter, const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
* 'simpleExplodeString' 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++}
* simpleExplodeString(stringParameter, this, [&](const QRestReply &reply, const 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 simpleExplodeStringWithDataImpl() in derived class.
* The virtual simpleExplodeStringWithDataImpl() is being called by the template
* function.
* @param[in] stringParameter QString [required]
* @param[in] context const ContextTypeForFunctor< Functor > * [optional]
* @param[in] callback Functor && [optional]
*/
/**
* \fn void OAITestApi::simpleExplodeStringCallback(const QRestReply &reply)
* Processes a \a reply response from a server.
* The result of processed data is emitted by simpleExplodeStringFinished() or
* being returned as a callback parameter of simpleExplodeString() request.
* @param[in] reply const QRestReply &
*/
/**
* \fn virtual void OAITestApi::simpleExplodeStringWithDataImpl(const QString &stringParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
* Implements the simpleExplodeString() operation request.
* \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
* and can be overloaded for mocking simpleExplodeString() operation calls.
* @param[in] stringParameter QString [required]
* @param[in] context const QObject * [optional]
* @param[in] slot QtPrivate::QSlotObjectBase * [optional]
*/
void OAITestApi::simpleExplodeStringWithDataImpl(const QString &stringParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
{
const QUrl serverUrl = m_serverConfigs["simpleExplodeString"][m_serverIndices.value("simpleExplodeString")].serverUrl();
QString fullPath = "/path/string/simple-explode/{stringParameter}";
m_networkFactory->setBaseUrl(serverUrl);
{
QString stringParameterPathParam = QString("{%1}").arg("stringParameter");
QString pathStyle = "simple";
if (pathStyle.isEmpty())
pathStyle = "simple";
const QString pathPrefix = getParamStylePrefix(pathStyle);
const QString pathDelimiter = getParamStyleDelimiter(pathStyle, true);
[[maybe_unused]] const QString assignOperator = getParamStyleAssignOperator(pathStyle, true, (!true && !false));
const QString pathSuffix = getParamStyleSuffix(pathStyle, u"stringParameter"_s, true, (!true && !false));
QString paramString = pathPrefix + pathSuffix;
paramString += QUrl::toPercentEncoding(::OpenAPI::toStringValue(stringParameter));
// In case style=matrix and paramString is empty due to any reasons,
// we serialize it like undefined value and delete '='.
if ((paramString == pathPrefix + pathSuffix) && QString("simple") == "matrix"_L1)
paramString.chop(1);
fullPath.replace(stringParameterPathParam, paramString);
}
// set m_testOperationPath for serialization tests
m_testOperationPath = fullPath;
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] {
simpleExplodeStringCallback(QRestReply(reply));
});
connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
if (reply) {
emit simpleExplodeStringErrorOccurred(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 OAITestApi::simpleExplodeStringCallback(const QRestReply &reply)
{
auto netReply = reply.networkReply();
if (netReply)
netReply->disconnect(this);
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 simpleExplodeStringFinished(output);
}
/**
* \fn virtual void OAITestApi::simpleNotExplodeAnytype(const QJsonValue &anytypeParameter)
* 'simpleNotExplodeAnytype' operation sends the request to a server.
* The request parameters are defined by a specification file.
* @param[in] anytypeParameter QJsonValue [required]
*/
/**
* \fn template < Functor, > void OAITestApi::simpleNotExplodeAnytype(const QJsonValue &anytypeParameter, const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
* 'simpleNotExplodeAnytype' 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++}
* simpleNotExplodeAnytype(anytypeParameter, this, [&](const QRestReply &reply, const 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 simpleNotExplodeAnytypeWithDataImpl() in derived class.
* The virtual simpleNotExplodeAnytypeWithDataImpl() is being called by the template
* function.
* @param[in] anytypeParameter QJsonValue [required]
* @param[in] context const ContextTypeForFunctor< Functor > * [optional]
* @param[in] callback Functor && [optional]
*/
/**
* \fn void OAITestApi::simpleNotExplodeAnytypeCallback(const QRestReply &reply)
* Processes a \a reply response from a server.
* The result of processed data is emitted by simpleNotExplodeAnytypeFinished() or
* being returned as a callback parameter of simpleNotExplodeAnytype() request.
* @param[in] reply const QRestReply &
*/
/**
* \fn virtual void OAITestApi::simpleNotExplodeAnytypeWithDataImpl(const QJsonValue &anytypeParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
* Implements the simpleNotExplodeAnytype() operation request.
* \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
* and can be overloaded for mocking simpleNotExplodeAnytype() operation calls.
* @param[in] anytypeParameter QJsonValue [required]
* @param[in] context const QObject * [optional]
* @param[in] slot QtPrivate::QSlotObjectBase * [optional]
*/
void OAITestApi::simpleNotExplodeAnytypeWithDataImpl(const QJsonValue &anytypeParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
{
const QUrl serverUrl = m_serverConfigs["simpleNotExplodeAnytype"][m_serverIndices.value("simpleNotExplodeAnytype")].serverUrl();
QString fullPath = "/path/anytype/simple-not-explode/{anytypeParameter}";
m_networkFactory->setBaseUrl(serverUrl);
{
QString anytypeParameterPathParam = QString("{%1}").arg("anytypeParameter");
QString pathStyle = "simple";
if (pathStyle.isEmpty())
pathStyle = "simple";
const QString pathPrefix = getParamStylePrefix(pathStyle);
const QString pathDelimiter = getParamStyleDelimiter(pathStyle, false);
const QString assignOperator = getParamStyleAssignOperator(pathStyle, false, anytypeParameter.type() == QJsonValue::Object);
const QString pathSuffix = getParamStyleSuffix(pathStyle, u"anytypeParameter"_s, false, anytypeParameter.type() == QJsonValue::Object);
QString paramString = pathPrefix + serializeJsonValue(anytypeParameter, pathStyle, false, pathSuffix, assignOperator, pathDelimiter);
// In case style=matrix and paramString is empty due to any reasons,
// we serialize it like undefined value and delete '='.
if ((paramString == pathPrefix + pathSuffix) && QString("simple") == "matrix"_L1)
paramString.chop(1);
fullPath.replace(anytypeParameterPathParam, paramString);
}
// set m_testOperationPath for serialization tests
m_testOperationPath = fullPath;
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] {
simpleNotExplodeAnytypeCallback(QRestReply(reply));
});
connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
if (reply) {
emit simpleNotExplodeAnytypeErrorOccurred(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 OAITestApi::simpleNotExplodeAnytypeCallback(const QRestReply &reply)
{
auto netReply = reply.networkReply();
if (netReply)
netReply->disconnect(this);
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 simpleNotExplodeAnytypeFinished(output);
}
/**
* \fn virtual void OAITestApi::simpleNotExplodeArray(const QList<qint32> &arrayParameter)
* 'simpleNotExplodeArray' operation sends the request to a server.
* The request parameters are defined by a specification file.
* @param[in] arrayParameter QList<qint32> [required]
*/
/**
* \fn template < Functor, > void OAITestApi::simpleNotExplodeArray(const QList<qint32> &arrayParameter, const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
* 'simpleNotExplodeArray' 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++}
* simpleNotExplodeArray(arrayParameter, this, [&](const QRestReply &reply, const 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 simpleNotExplodeArrayWithDataImpl() in derived class.
* The virtual simpleNotExplodeArrayWithDataImpl() is being called by the template
* function.
* @param[in] arrayParameter QList<qint32> [required]
* @param[in] context const ContextTypeForFunctor< Functor > * [optional]
* @param[in] callback Functor && [optional]
*/
/**
* \fn void OAITestApi::simpleNotExplodeArrayCallback(const QRestReply &reply)
* Processes a \a reply response from a server.
* The result of processed data is emitted by simpleNotExplodeArrayFinished() or
* being returned as a callback parameter of simpleNotExplodeArray() request.
* @param[in] reply const QRestReply &
*/
/**
* \fn virtual void OAITestApi::simpleNotExplodeArrayWithDataImpl(const QList<qint32> &arrayParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
* Implements the simpleNotExplodeArray() operation request.
* \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
* and can be overloaded for mocking simpleNotExplodeArray() operation calls.
* @param[in] arrayParameter QList<qint32> [required]
* @param[in] context const QObject * [optional]
* @param[in] slot QtPrivate::QSlotObjectBase * [optional]
*/
void OAITestApi::simpleNotExplodeArrayWithDataImpl(const QList<qint32> &arrayParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
{
const QUrl serverUrl = m_serverConfigs["simpleNotExplodeArray"][m_serverIndices.value("simpleNotExplodeArray")].serverUrl();
QString fullPath = "/path/array/simple-not-explode/{arrayParameter}";
m_networkFactory->setBaseUrl(serverUrl);
{
QString arrayParameterPathParam = QString("{%1}").arg("arrayParameter");
QString pathStyle = "simple";
if (pathStyle.isEmpty())
pathStyle = "simple";
const QString pathPrefix = getParamStylePrefix(pathStyle);
const QString pathDelimiter = getParamStyleDelimiter(pathStyle, false);
[[maybe_unused]] const QString assignOperator = getParamStyleAssignOperator(pathStyle, false, (!false && !true));
const QString pathSuffix = getParamStyleSuffix(pathStyle, u"arrayParameter"_s, false, (!false && !true));
QString paramString = pathPrefix + pathSuffix;
paramString = pathPrefix + serializeArrayValue(arrayParameter, pathStyle, false, pathSuffix, pathDelimiter);
// In case style=matrix and paramString is empty due to any reasons,
// we serialize it like undefined value and delete '='.
if ((paramString == pathPrefix + pathSuffix) && QString("simple") == "matrix"_L1)
paramString.chop(1);
fullPath.replace(arrayParameterPathParam, paramString);
}
// set m_testOperationPath for serialization tests
m_testOperationPath = fullPath;
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] {
simpleNotExplodeArrayCallback(QRestReply(reply));
});
connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
if (reply) {
emit simpleNotExplodeArrayErrorOccurred(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 OAITestApi::simpleNotExplodeArrayCallback(const QRestReply &reply)
{
auto netReply = reply.networkReply();
if (netReply)
netReply->disconnect(this);
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 simpleNotExplodeArrayFinished(output);
}
/**
* \fn virtual void OAITestApi::simpleNotExplodeObject(const OAITestObject &objectParameter)
* 'simpleNotExplodeObject' operation sends the request to a server.
* The request parameters are defined by a specification file.
* @param[in] objectParameter OAITestObject [required]
*/
/**
* \fn template < Functor, > void OAITestApi::simpleNotExplodeObject(const OAITestObject &objectParameter, const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
* 'simpleNotExplodeObject' 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++}
* simpleNotExplodeObject(objectParameter, this, [&](const QRestReply &reply, const 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 simpleNotExplodeObjectWithDataImpl() in derived class.
* The virtual simpleNotExplodeObjectWithDataImpl() is being called by the template
* function.
* @param[in] objectParameter OAITestObject [required]
* @param[in] context const ContextTypeForFunctor< Functor > * [optional]
* @param[in] callback Functor && [optional]
*/
/**
* \fn void OAITestApi::simpleNotExplodeObjectCallback(const QRestReply &reply)
* Processes a \a reply response from a server.
* The result of processed data is emitted by simpleNotExplodeObjectFinished() or
* being returned as a callback parameter of simpleNotExplodeObject() request.
* @param[in] reply const QRestReply &
*/
/**
* \fn virtual void OAITestApi::simpleNotExplodeObjectWithDataImpl(const OAITestObject &objectParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
* Implements the simpleNotExplodeObject() operation request.
* \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
* and can be overloaded for mocking simpleNotExplodeObject() operation calls.
* @param[in] objectParameter OAITestObject [required]
* @param[in] context const QObject * [optional]
* @param[in] slot QtPrivate::QSlotObjectBase * [optional]
*/
void OAITestApi::simpleNotExplodeObjectWithDataImpl(const OAITestObject &objectParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
{
const QUrl serverUrl = m_serverConfigs["simpleNotExplodeObject"][m_serverIndices.value("simpleNotExplodeObject")].serverUrl();
QString fullPath = "/path/object/simple-not-explode/{objectParameter}";
m_networkFactory->setBaseUrl(serverUrl);
{
QString objectParameterPathParam = QString("{%1}").arg("objectParameter");
QString pathStyle = "simple";
if (pathStyle.isEmpty())
pathStyle = "simple";
const QString pathPrefix = getParamStylePrefix(pathStyle);
const QString pathDelimiter = getParamStyleDelimiter(pathStyle, false);
[[maybe_unused]] const QString assignOperator = getParamStyleAssignOperator(pathStyle, false, (!false && !false));
const QString pathSuffix = getParamStyleSuffix(pathStyle, u"objectParameter"_s, false, (!false && !false));
QString paramString = pathPrefix + pathSuffix;
paramString = pathPrefix + serializeJsonValue(QJsonValue(objectParameter.asJsonObject()), pathStyle, false, pathSuffix, assignOperator, pathDelimiter);
// In case style=matrix and paramString is empty due to any reasons,
// we serialize it like undefined value and delete '='.
if ((paramString == pathPrefix + pathSuffix) && QString("simple") == "matrix"_L1)
paramString.chop(1);
fullPath.replace(objectParameterPathParam, paramString);
}
// set m_testOperationPath for serialization tests
m_testOperationPath = fullPath;
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] {
simpleNotExplodeObjectCallback(QRestReply(reply));
});
connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
if (reply) {
emit simpleNotExplodeObjectErrorOccurred(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 OAITestApi::simpleNotExplodeObjectCallback(const QRestReply &reply)
{
auto netReply = reply.networkReply();
if (netReply)
netReply->disconnect(this);
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 simpleNotExplodeObjectFinished(output);
}
/**
* \fn virtual void OAITestApi::simpleNotExplodeString(const QString &stringParameter)
* 'simpleNotExplodeString' operation sends the request to a server.
* The request parameters are defined by a specification file.
* @param[in] stringParameter QString [required]
*/
/**
* \fn template < Functor, > void OAITestApi::simpleNotExplodeString(const QString &stringParameter, const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
* 'simpleNotExplodeString' 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++}
* simpleNotExplodeString(stringParameter, this, [&](const QRestReply &reply, const 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 simpleNotExplodeStringWithDataImpl() in derived class.
* The virtual simpleNotExplodeStringWithDataImpl() is being called by the template
* function.
* @param[in] stringParameter QString [required]
* @param[in] context const ContextTypeForFunctor< Functor > * [optional]
* @param[in] callback Functor && [optional]
*/
/**
* \fn void OAITestApi::simpleNotExplodeStringCallback(const QRestReply &reply)
* Processes a \a reply response from a server.
* The result of processed data is emitted by simpleNotExplodeStringFinished() or
* being returned as a callback parameter of simpleNotExplodeString() request.
* @param[in] reply const QRestReply &
*/
/**
* \fn virtual void OAITestApi::simpleNotExplodeStringWithDataImpl(const QString &stringParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
* Implements the simpleNotExplodeString() operation request.
* \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
* and can be overloaded for mocking simpleNotExplodeString() operation calls.
* @param[in] stringParameter QString [required]
* @param[in] context const QObject * [optional]
* @param[in] slot QtPrivate::QSlotObjectBase * [optional]
*/
void OAITestApi::simpleNotExplodeStringWithDataImpl(const QString &stringParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
{
const QUrl serverUrl = m_serverConfigs["simpleNotExplodeString"][m_serverIndices.value("simpleNotExplodeString")].serverUrl();
QString fullPath = "/path/string/simple-not-explode/{stringParameter}";
m_networkFactory->setBaseUrl(serverUrl);
{
QString stringParameterPathParam = QString("{%1}").arg("stringParameter");
QString pathStyle = "simple";
if (pathStyle.isEmpty())
pathStyle = "simple";
const QString pathPrefix = getParamStylePrefix(pathStyle);
const QString pathDelimiter = getParamStyleDelimiter(pathStyle, false);
[[maybe_unused]] const QString assignOperator = getParamStyleAssignOperator(pathStyle, false, (!true && !false));
const QString pathSuffix = getParamStyleSuffix(pathStyle, u"stringParameter"_s, false, (!true && !false));
QString paramString = pathPrefix + pathSuffix;
paramString += QUrl::toPercentEncoding(::OpenAPI::toStringValue(stringParameter));
// In case style=matrix and paramString is empty due to any reasons,
// we serialize it like undefined value and delete '='.
if ((paramString == pathPrefix + pathSuffix) && QString("simple") == "matrix"_L1)
paramString.chop(1);
fullPath.replace(stringParameterPathParam, paramString);
}
// set m_testOperationPath for serialization tests
m_testOperationPath = fullPath;
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] {
simpleNotExplodeStringCallback(QRestReply(reply));
});
connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
if (reply) {
emit simpleNotExplodeStringErrorOccurred(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 OAITestApi::simpleNotExplodeStringCallback(const QRestReply &reply)
{
auto netReply = reply.networkReply();
if (netReply)
netReply->disconnect(this);
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 simpleNotExplodeStringFinished(output);
}
/**
* \fn virtual void OAITestApi::spaceDelimitedExplodeAnytype(const QJsonValue &anytypeParameter)
* 'spaceDelimitedExplodeAnytype' operation sends the request to a server.
* The request parameters are defined by a specification file.
* @param[in] anytypeParameter QJsonValue [required]
*/
/**
* \fn template < Functor, > void OAITestApi::spaceDelimitedExplodeAnytype(const QJsonValue &anytypeParameter, const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
* 'spaceDelimitedExplodeAnytype' 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++}
* spaceDelimitedExplodeAnytype(anytypeParameter, this, [&](const QRestReply &reply, const 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 spaceDelimitedExplodeAnytypeWithDataImpl() in derived class.
* The virtual spaceDelimitedExplodeAnytypeWithDataImpl() is being called by the template
* function.
* @param[in] anytypeParameter QJsonValue [required]
* @param[in] context const ContextTypeForFunctor< Functor > * [optional]
* @param[in] callback Functor && [optional]
*/
/**
* \fn void OAITestApi::spaceDelimitedExplodeAnytypeCallback(const QRestReply &reply)
* Processes a \a reply response from a server.
* The result of processed data is emitted by spaceDelimitedExplodeAnytypeFinished() or
* being returned as a callback parameter of spaceDelimitedExplodeAnytype() request.
* @param[in] reply const QRestReply &
*/
/**
* \fn virtual void OAITestApi::spaceDelimitedExplodeAnytypeWithDataImpl(const QJsonValue &anytypeParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
* Implements the spaceDelimitedExplodeAnytype() operation request.
* \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
* and can be overloaded for mocking spaceDelimitedExplodeAnytype() operation calls.
* @param[in] anytypeParameter QJsonValue [required]
* @param[in] context const QObject * [optional]
* @param[in] slot QtPrivate::QSlotObjectBase * [optional]
*/
void OAITestApi::spaceDelimitedExplodeAnytypeWithDataImpl(const QJsonValue &anytypeParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
{
const QUrl serverUrl = m_serverConfigs["spaceDelimitedExplodeAnytype"][m_serverIndices.value("spaceDelimitedExplodeAnytype")].serverUrl();
QString fullPath = "/query/anytype/spaceDelimited-explode/spaceDelimitedExplodeAnytype";
m_networkFactory->setBaseUrl(serverUrl);
int queryParamCounter = 0;
{
[[maybe_unused]] QString paramString;
QString queryStyle = "spaceDelimited";
if (queryStyle.isEmpty())
queryStyle = "form";
const QString queryPrefix = getParamStylePrefix(queryStyle);
[[maybe_unused]] const QString queryDelimiter = getParamStyleDelimiter(queryStyle, true);
const QString querySuffix = getParamStyleSuffix(queryStyle, u"anytypeParameter"_s, true, anytypeParameter.type() == QJsonValue::Object);
const QString queryAssignOperator = getParamStyleAssignOperator(queryStyle, true, anytypeParameter.type() == QJsonValue::Object);
if ((fullPath.indexOf("?") != fullPath.size() - 1) && (queryParamCounter == 0))
fullPath.append(queryPrefix);
{
if (queryParamCounter > 0)
fullPath.append("&");
paramString = serializeJsonValue(anytypeParameter, queryStyle, true, querySuffix, queryAssignOperator, queryDelimiter);
fullPath.append(paramString);
queryParamCounter++;
}
}
// set m_testOperationPath for serialization tests
m_testOperationPath = fullPath;
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] {
spaceDelimitedExplodeAnytypeCallback(QRestReply(reply));
});
connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
if (reply) {
emit spaceDelimitedExplodeAnytypeErrorOccurred(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 OAITestApi::spaceDelimitedExplodeAnytypeCallback(const QRestReply &reply)
{
auto netReply = reply.networkReply();
if (netReply)
netReply->disconnect(this);
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 spaceDelimitedExplodeAnytypeFinished(output);
}
/**
* \fn virtual void OAITestApi::spaceDelimitedExplodeArray(const QList<qint32> &arrayParameter)
* 'spaceDelimitedExplodeArray' operation sends the request to a server.
* The request parameters are defined by a specification file.
* @param[in] arrayParameter QList<qint32> [required]
*/
/**
* \fn template < Functor, > void OAITestApi::spaceDelimitedExplodeArray(const QList<qint32> &arrayParameter, const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
* 'spaceDelimitedExplodeArray' 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++}
* spaceDelimitedExplodeArray(arrayParameter, this, [&](const QRestReply &reply, const 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 spaceDelimitedExplodeArrayWithDataImpl() in derived class.
* The virtual spaceDelimitedExplodeArrayWithDataImpl() is being called by the template
* function.
* @param[in] arrayParameter QList<qint32> [required]
* @param[in] context const ContextTypeForFunctor< Functor > * [optional]
* @param[in] callback Functor && [optional]
*/
/**
* \fn void OAITestApi::spaceDelimitedExplodeArrayCallback(const QRestReply &reply)
* Processes a \a reply response from a server.
* The result of processed data is emitted by spaceDelimitedExplodeArrayFinished() or
* being returned as a callback parameter of spaceDelimitedExplodeArray() request.
* @param[in] reply const QRestReply &
*/
/**
* \fn virtual void OAITestApi::spaceDelimitedExplodeArrayWithDataImpl(const QList<qint32> &arrayParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
* Implements the spaceDelimitedExplodeArray() operation request.
* \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
* and can be overloaded for mocking spaceDelimitedExplodeArray() operation calls.
* @param[in] arrayParameter QList<qint32> [required]
* @param[in] context const QObject * [optional]
* @param[in] slot QtPrivate::QSlotObjectBase * [optional]
*/
void OAITestApi::spaceDelimitedExplodeArrayWithDataImpl(const QList<qint32> &arrayParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
{
const QUrl serverUrl = m_serverConfigs["spaceDelimitedExplodeArray"][m_serverIndices.value("spaceDelimitedExplodeArray")].serverUrl();
QString fullPath = "/query/array/spaceDelimited-explode/spaceDelimitedExplodeArray";
m_networkFactory->setBaseUrl(serverUrl);
int queryParamCounter = 0;
{
[[maybe_unused]] QString paramString;
QString queryStyle = "spaceDelimited";
if (queryStyle.isEmpty())
queryStyle = "form";
const QString queryPrefix = getParamStylePrefix(queryStyle);
[[maybe_unused]] const QString queryDelimiter = getParamStyleDelimiter(queryStyle, true);
const QString querySuffix = getParamStyleSuffix(queryStyle, u"arrayParameter"_s, true, (!false && !true));
[[maybe_unused]] const QString queryAssignOperator = getParamStyleAssignOperator(queryStyle, true, (!false && !true));
if ((fullPath.indexOf("?") != fullPath.size() - 1) && (queryParamCounter == 0))
fullPath.append(queryPrefix);
{
if (queryParamCounter > 0)
fullPath.append("&");
fullPath.append(serializeArrayValue(arrayParameter, queryStyle, true, querySuffix, queryDelimiter));
queryParamCounter++;
}
}
// set m_testOperationPath for serialization tests
m_testOperationPath = fullPath;
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] {
spaceDelimitedExplodeArrayCallback(QRestReply(reply));
});
connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
if (reply) {
emit spaceDelimitedExplodeArrayErrorOccurred(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 OAITestApi::spaceDelimitedExplodeArrayCallback(const QRestReply &reply)
{
auto netReply = reply.networkReply();
if (netReply)
netReply->disconnect(this);
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 spaceDelimitedExplodeArrayFinished(output);
}
/**
* \fn virtual void OAITestApi::spaceDelimitedExplodeObject(const OAITestObject &objectParameter)
* 'spaceDelimitedExplodeObject' operation sends the request to a server.
* The request parameters are defined by a specification file.
* @param[in] objectParameter OAITestObject [required]
*/
/**
* \fn template < Functor, > void OAITestApi::spaceDelimitedExplodeObject(const OAITestObject &objectParameter, const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
* 'spaceDelimitedExplodeObject' 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++}
* spaceDelimitedExplodeObject(objectParameter, this, [&](const QRestReply &reply, const 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 spaceDelimitedExplodeObjectWithDataImpl() in derived class.
* The virtual spaceDelimitedExplodeObjectWithDataImpl() is being called by the template
* function.
* @param[in] objectParameter OAITestObject [required]
* @param[in] context const ContextTypeForFunctor< Functor > * [optional]
* @param[in] callback Functor && [optional]
*/
/**
* \fn void OAITestApi::spaceDelimitedExplodeObjectCallback(const QRestReply &reply)
* Processes a \a reply response from a server.
* The result of processed data is emitted by spaceDelimitedExplodeObjectFinished() or
* being returned as a callback parameter of spaceDelimitedExplodeObject() request.
* @param[in] reply const QRestReply &
*/
/**
* \fn virtual void OAITestApi::spaceDelimitedExplodeObjectWithDataImpl(const OAITestObject &objectParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
* Implements the spaceDelimitedExplodeObject() operation request.
* \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
* and can be overloaded for mocking spaceDelimitedExplodeObject() operation calls.
* @param[in] objectParameter OAITestObject [required]
* @param[in] context const QObject * [optional]
* @param[in] slot QtPrivate::QSlotObjectBase * [optional]
*/
void OAITestApi::spaceDelimitedExplodeObjectWithDataImpl(const OAITestObject &objectParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
{
const QUrl serverUrl = m_serverConfigs["spaceDelimitedExplodeObject"][m_serverIndices.value("spaceDelimitedExplodeObject")].serverUrl();
QString fullPath = "/query/object/spaceDelimited-explode/spaceDelimitedExplodeObject";
m_networkFactory->setBaseUrl(serverUrl);
int queryParamCounter = 0;
{
[[maybe_unused]] QString paramString;
QString queryStyle = "spaceDelimited";
if (queryStyle.isEmpty())
queryStyle = "form";
const QString queryPrefix = getParamStylePrefix(queryStyle);
[[maybe_unused]] const QString queryDelimiter = getParamStyleDelimiter(queryStyle, true);
const QString querySuffix = getParamStyleSuffix(queryStyle, u"objectParameter"_s, true, (!false && !false));
[[maybe_unused]] const QString queryAssignOperator = getParamStyleAssignOperator(queryStyle, true, (!false && !false));
paramString = querySuffix;
if ((fullPath.indexOf("?") != fullPath.size() - 1) && (queryParamCounter == 0))
fullPath.append(queryPrefix);
{
if (queryParamCounter > 0)
fullPath.append("&");
const QJsonObject parameter = objectParameter.asJsonObject();
if (queryStyle == "deepObject") {
qint32 index = 0;
if (parameter.isEmpty())
qWarning() << "Serialized QJsonValue::Object is empty!";
for (const QString& key : parameter.keys()) {
if (index > 0)
paramString.append(queryDelimiter);
paramString.append(::OpenAPI::optionParameterToString(QString("objectParameter") + QString("[") + key + QString("]"), queryAssignOperator, parameter.value(key)));
index++;
}
} else {
paramString = serializeJsonValue(QJsonValue(parameter), queryStyle, true, querySuffix, queryAssignOperator, queryDelimiter);
}
// style=form && explode=true && non-object => 'objectParameter' isn't used in serialization
// style=form && explode=true && empty object => need to be 'objectParameter='
if (paramString.isEmpty() && queryStyle == "form")
paramString = u"objectParameter="_s;
fullPath.append(paramString);
queryParamCounter++;
}
}
// set m_testOperationPath for serialization tests
m_testOperationPath = fullPath;
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] {
spaceDelimitedExplodeObjectCallback(QRestReply(reply));
});
connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
if (reply) {
emit spaceDelimitedExplodeObjectErrorOccurred(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 OAITestApi::spaceDelimitedExplodeObjectCallback(const QRestReply &reply)
{
auto netReply = reply.networkReply();
if (netReply)
netReply->disconnect(this);
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 spaceDelimitedExplodeObjectFinished(output);
}
/**
* \fn virtual void OAITestApi::spaceDelimitedNotExplodeAnytype(const ::OpenAPI::OptionalParam<QJsonValue> &anytypeParameter = ::OpenAPI::OptionalParam<QJsonValue>())
* 'spaceDelimitedNotExplodeAnytype' operation sends the request to a server.
* The request parameters are defined by a specification file.
* @param[in] anytypeParameter QJsonValue [optional]
*/
/**
* \fn template < Functor, > void OAITestApi::spaceDelimitedNotExplodeAnytype(const ::OpenAPI::OptionalParam<QJsonValue> &anytypeParameter = ::OpenAPI::OptionalParam<QJsonValue>(), const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
* 'spaceDelimitedNotExplodeAnytype' 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++}
* spaceDelimitedNotExplodeAnytype(anytypeParameter, this, [&](const QRestReply &reply, const 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 spaceDelimitedNotExplodeAnytypeWithDataImpl() in derived class.
* The virtual spaceDelimitedNotExplodeAnytypeWithDataImpl() is being called by the template
* function.
* @param[in] anytypeParameter QJsonValue [optional]
* @param[in] context const ContextTypeForFunctor< Functor > * [optional]
* @param[in] callback Functor && [optional]
*/
/**
* \fn void OAITestApi::spaceDelimitedNotExplodeAnytypeCallback(const QRestReply &reply)
* Processes a \a reply response from a server.
* The result of processed data is emitted by spaceDelimitedNotExplodeAnytypeFinished() or
* being returned as a callback parameter of spaceDelimitedNotExplodeAnytype() request.
* @param[in] reply const QRestReply &
*/
/**
* \fn virtual void OAITestApi::spaceDelimitedNotExplodeAnytypeWithDataImpl(const ::OpenAPI::OptionalParam<QJsonValue> &anytypeParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
* Implements the spaceDelimitedNotExplodeAnytype() operation request.
* \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
* and can be overloaded for mocking spaceDelimitedNotExplodeAnytype() operation calls.
* @param[in] anytypeParameter QJsonValue [optional]
* @param[in] context const QObject * [optional]
* @param[in] slot QtPrivate::QSlotObjectBase * [optional]
*/
void OAITestApi::spaceDelimitedNotExplodeAnytypeWithDataImpl(const ::OpenAPI::OptionalParam<QJsonValue> &anytypeParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
{
const QUrl serverUrl = m_serverConfigs["spaceDelimitedNotExplodeAnytype"][m_serverIndices.value("spaceDelimitedNotExplodeAnytype")].serverUrl();
QString fullPath = "/query/anytype/spaceDelimited-not-explode/spaceDelimitedNotExplodeAnytype";
m_networkFactory->setBaseUrl(serverUrl);
int queryParamCounter = 0;
{
[[maybe_unused]] QString paramString;
QString queryStyle = "spaceDelimited";
if (queryStyle.isEmpty())
queryStyle = "form";
const QString queryPrefix = getParamStylePrefix(queryStyle);
[[maybe_unused]] const QString queryDelimiter = getParamStyleDelimiter(queryStyle, false);
const QString querySuffix = getParamStyleSuffix(queryStyle, u"anytypeParameter"_s, false, anytypeParameter.value().type() == QJsonValue::Object);
const QString queryAssignOperator = getParamStyleAssignOperator(queryStyle, false, anytypeParameter.value().type() == QJsonValue::Object);
if ((fullPath.indexOf("?") != fullPath.size() - 1) && (queryParamCounter == 0))
fullPath.append(queryPrefix);
if (anytypeParameter.hasValue()) {
if (queryParamCounter > 0)
fullPath.append("&");
paramString = serializeJsonValue(anytypeParameter.value(), queryStyle, false, querySuffix, queryAssignOperator, queryDelimiter);
fullPath.append(paramString);
queryParamCounter++;
}
}
// set m_testOperationPath for serialization tests
m_testOperationPath = fullPath;
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] {
spaceDelimitedNotExplodeAnytypeCallback(QRestReply(reply));
});
connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
if (reply) {
emit spaceDelimitedNotExplodeAnytypeErrorOccurred(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 OAITestApi::spaceDelimitedNotExplodeAnytypeCallback(const QRestReply &reply)
{
auto netReply = reply.networkReply();
if (netReply)
netReply->disconnect(this);
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 spaceDelimitedNotExplodeAnytypeFinished(output);
}
/**
* \fn virtual void OAITestApi::spaceDelimitedNotExplodeArray(const ::OpenAPI::OptionalParam<QList<qint32>> &arrayParameter = ::OpenAPI::OptionalParam<QList<qint32>>())
* 'spaceDelimitedNotExplodeArray' operation sends the request to a server.
* The request parameters are defined by a specification file.
* @param[in] arrayParameter QList<qint32> [optional]
*/
/**
* \fn template < Functor, > void OAITestApi::spaceDelimitedNotExplodeArray(const ::OpenAPI::OptionalParam<QList<qint32>> &arrayParameter = ::OpenAPI::OptionalParam<QList<qint32>>(), const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
* 'spaceDelimitedNotExplodeArray' 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++}
* spaceDelimitedNotExplodeArray(arrayParameter, this, [&](const QRestReply &reply, const 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 spaceDelimitedNotExplodeArrayWithDataImpl() in derived class.
* The virtual spaceDelimitedNotExplodeArrayWithDataImpl() is being called by the template
* function.
* @param[in] arrayParameter QList<qint32> [optional]
* @param[in] context const ContextTypeForFunctor< Functor > * [optional]
* @param[in] callback Functor && [optional]
*/
/**
* \fn void OAITestApi::spaceDelimitedNotExplodeArrayCallback(const QRestReply &reply)
* Processes a \a reply response from a server.
* The result of processed data is emitted by spaceDelimitedNotExplodeArrayFinished() or
* being returned as a callback parameter of spaceDelimitedNotExplodeArray() request.
* @param[in] reply const QRestReply &
*/
/**
* \fn virtual void OAITestApi::spaceDelimitedNotExplodeArrayWithDataImpl(const ::OpenAPI::OptionalParam<QList<qint32>> &arrayParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
* Implements the spaceDelimitedNotExplodeArray() operation request.
* \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
* and can be overloaded for mocking spaceDelimitedNotExplodeArray() operation calls.
* @param[in] arrayParameter QList<qint32> [optional]
* @param[in] context const QObject * [optional]
* @param[in] slot QtPrivate::QSlotObjectBase * [optional]
*/
void OAITestApi::spaceDelimitedNotExplodeArrayWithDataImpl(const ::OpenAPI::OptionalParam<QList<qint32>> &arrayParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
{
const QUrl serverUrl = m_serverConfigs["spaceDelimitedNotExplodeArray"][m_serverIndices.value("spaceDelimitedNotExplodeArray")].serverUrl();
QString fullPath = "/query/array/spaceDelimited-not-explode/spaceDelimitedNotExplodeArray";
m_networkFactory->setBaseUrl(serverUrl);
int queryParamCounter = 0;
{
[[maybe_unused]] QString paramString;
QString queryStyle = "spaceDelimited";
if (queryStyle.isEmpty())
queryStyle = "form";
const QString queryPrefix = getParamStylePrefix(queryStyle);
[[maybe_unused]] const QString queryDelimiter = getParamStyleDelimiter(queryStyle, false);
const QString querySuffix = getParamStyleSuffix(queryStyle, u"arrayParameter"_s, false, (!false && !true));
[[maybe_unused]] const QString queryAssignOperator = getParamStyleAssignOperator(queryStyle, false, (!false && !true));
if ((fullPath.indexOf("?") != fullPath.size() - 1) && (queryParamCounter == 0))
fullPath.append(queryPrefix);
if (arrayParameter.hasValue()) {
if (queryParamCounter > 0)
fullPath.append("&");
fullPath.append(serializeArrayValue(arrayParameter.value(), queryStyle, false, querySuffix, queryDelimiter));
queryParamCounter++;
}
}
// set m_testOperationPath for serialization tests
m_testOperationPath = fullPath;
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] {
spaceDelimitedNotExplodeArrayCallback(QRestReply(reply));
});
connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
if (reply) {
emit spaceDelimitedNotExplodeArrayErrorOccurred(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 OAITestApi::spaceDelimitedNotExplodeArrayCallback(const QRestReply &reply)
{
auto netReply = reply.networkReply();
if (netReply)
netReply->disconnect(this);
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 spaceDelimitedNotExplodeArrayFinished(output);
}
/**
* \fn virtual void OAITestApi::spaceDelimitedNotExplodeObject(const ::OpenAPI::OptionalParam<OAITestObject> &objectParameter = ::OpenAPI::OptionalParam<OAITestObject>())
* 'spaceDelimitedNotExplodeObject' operation sends the request to a server.
* The request parameters are defined by a specification file.
* @param[in] objectParameter OAITestObject [optional]
*/
/**
* \fn template < Functor, > void OAITestApi::spaceDelimitedNotExplodeObject(const ::OpenAPI::OptionalParam<OAITestObject> &objectParameter = ::OpenAPI::OptionalParam<OAITestObject>(), const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
* 'spaceDelimitedNotExplodeObject' 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++}
* spaceDelimitedNotExplodeObject(objectParameter, this, [&](const QRestReply &reply, const 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 spaceDelimitedNotExplodeObjectWithDataImpl() in derived class.
* The virtual spaceDelimitedNotExplodeObjectWithDataImpl() is being called by the template
* function.
* @param[in] objectParameter OAITestObject [optional]
* @param[in] context const ContextTypeForFunctor< Functor > * [optional]
* @param[in] callback Functor && [optional]
*/
/**
* \fn void OAITestApi::spaceDelimitedNotExplodeObjectCallback(const QRestReply &reply)
* Processes a \a reply response from a server.
* The result of processed data is emitted by spaceDelimitedNotExplodeObjectFinished() or
* being returned as a callback parameter of spaceDelimitedNotExplodeObject() request.
* @param[in] reply const QRestReply &
*/
/**
* \fn virtual void OAITestApi::spaceDelimitedNotExplodeObjectWithDataImpl(const ::OpenAPI::OptionalParam<OAITestObject> &objectParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
* Implements the spaceDelimitedNotExplodeObject() operation request.
* \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
* and can be overloaded for mocking spaceDelimitedNotExplodeObject() operation calls.
* @param[in] objectParameter OAITestObject [optional]
* @param[in] context const QObject * [optional]
* @param[in] slot QtPrivate::QSlotObjectBase * [optional]
*/
void OAITestApi::spaceDelimitedNotExplodeObjectWithDataImpl(const ::OpenAPI::OptionalParam<OAITestObject> &objectParameter, const QObject *context, QtPrivate::QSlotObjectBase *slot)
{
const QUrl serverUrl = m_serverConfigs["spaceDelimitedNotExplodeObject"][m_serverIndices.value("spaceDelimitedNotExplodeObject")].serverUrl();
QString fullPath = "/query/object/spaceDelimited-not-explode/spaceDelimitedNotExplodeObject";
m_networkFactory->setBaseUrl(serverUrl);
int queryParamCounter = 0;
{
[[maybe_unused]] QString paramString;
QString queryStyle = "spaceDelimited";
if (queryStyle.isEmpty())
queryStyle = "form";
const QString queryPrefix = getParamStylePrefix(queryStyle);
[[maybe_unused]] const QString queryDelimiter = getParamStyleDelimiter(queryStyle, false);
const QString querySuffix = getParamStyleSuffix(queryStyle, u"objectParameter"_s, false, (!false && !false));
[[maybe_unused]] const QString queryAssignOperator = getParamStyleAssignOperator(queryStyle, false, (!false && !false));
paramString = querySuffix;
if ((fullPath.indexOf("?") != fullPath.size() - 1) && (queryParamCounter == 0))
fullPath.append(queryPrefix);
if (objectParameter.hasValue()) {
if (queryParamCounter > 0)
fullPath.append("&");
const QJsonObject parameter = objectParameter.value().asJsonObject();
if (queryStyle == "deepObject") {
qint32 index = 0;
if (parameter.isEmpty())
qWarning() << "Serialized QJsonValue::Object is empty!";
for (const QString& key : parameter.keys()) {
if (index > 0)
paramString.append(queryDelimiter);
paramString.append(::OpenAPI::optionParameterToString(QString("objectParameter") + QString("[") + key + QString("]"), queryAssignOperator, parameter.value(key)));
index++;
}
} else {
paramString = serializeJsonValue(QJsonValue(parameter), queryStyle, false, querySuffix, queryAssignOperator, queryDelimiter);
}
// style=form && explode=true && non-object => 'objectParameter' isn't used in serialization
// style=form && explode=true && empty object => need to be 'objectParameter='
if (paramString.isEmpty() && queryStyle == "form")
paramString = u"objectParameter="_s;
fullPath.append(paramString);
queryParamCounter++;
}
}
// set m_testOperationPath for serialization tests
m_testOperationPath = fullPath;
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] {
spaceDelimitedNotExplodeObjectCallback(QRestReply(reply));
});
connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
if (reply) {
emit spaceDelimitedNotExplodeObjectErrorOccurred(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 OAITestApi::spaceDelimitedNotExplodeObjectCallback(const QRestReply &reply)
{
auto netReply = reply.networkReply();
if (netReply)
netReply->disconnect(this);
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 spaceDelimitedNotExplodeObjectFinished(output);
}
} // namespace OpenAPI