Revision control
/**
* OpenAPI 2.0 test
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* Do not edit the class manually.
*/
#include "QtOAIFakeApi.h"
#include "QtOAIServerConfiguration.h"
#include <QtCore/qanystringview.h>
#include <QtCore/qjsonarray.h>
#include <QtCore/qjsondocument.h>
#include <QtNetwork/qhttpmultipart.h>
#include <QtNetwork/qnetworkaccessmanager.h>
#include <QtNetwork/qnetworkreply.h>
#include <QtNetwork/qnetworkrequestfactory.h>
#include <QtNetwork/qrestaccessmanager.h>
using namespace Qt::StringLiterals;
namespace QtOpenAPI {
QtOAIFakeApi::QtOAIFakeApi(QObject *parent)
: QtOAIBaseApi(parent)
{
initializeServerConfigs();
}
QtOAIFakeApi::~QtOAIFakeApi()
{
}
void QtOAIFakeApi::initializeServerConfigs()
{
//Default server
QList<QtOAIServerConfiguration> defaultConf = QList<QtOAIServerConfiguration>();
//varying endpoint server
defaultConf.append(QtOAIServerConfiguration(
QUrl("http://127.0.0.1:10300/v2"),
"No description provided",
QMap<QString, QtOAIServerVariable>()));
m_serverConfigs.insert("testPathParameterCollectionFormat", defaultConf);
m_serverIndices.insert("testPathParameterCollectionFormat", 0);
m_serverConfigs.insert("testQueryParameterCollectionFormat", defaultConf);
m_serverIndices.insert("testQueryParameterCollectionFormat", 0);
}
/**
* \fn virtual void QtOAIFakeApi::testPathParameterCollectionFormat(const QList<QString> &pipeId, const QList<QString> &ioutilId, const QList<QString> &httpId, const QList<QString> &urlId, const QList<QString> &multiContextId)
* 'testPathParameterCollectionFormat' operation sends the request to a server.
* The request parameters are defined by a specification file.
* @param[in] pipeId QList<QString> [required]
* @param[in] ioutilId QList<QString> [required]
* @param[in] httpId QList<QString> [required]
* @param[in] urlId QList<QString> [required]
* @param[in] multiContextId QList<QString> [required]
*/
/**
* \fn template < Functor, > void QtOAIFakeApi::testPathParameterCollectionFormat(const QList<QString> &pipeId, const QList<QString> &ioutilId, const QList<QString> &httpId, const QList<QString> &urlId, const QList<QString> &multiContextId, const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
* 'testPathParameterCollectionFormat' 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++}
* testPathParameterCollectionFormat(pipeId, ioutilId, httpId, urlId, multiContextId, 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 testPathParameterCollectionFormatWithDataImpl() in derived class.
* The virtual testPathParameterCollectionFormatWithDataImpl() is being called by the template
* function.
* @param[in] pipeId QList<QString> [required]
* @param[in] ioutilId QList<QString> [required]
* @param[in] httpId QList<QString> [required]
* @param[in] urlId QList<QString> [required]
* @param[in] multiContextId QList<QString> [required]
* @param[in] context const ContextTypeForFunctor< Functor > * [optional]
* @param[in] callback Functor && [optional]
*/
/**
* \fn void QtOAIFakeApi::testPathParameterCollectionFormatCallback(const QRestReply &reply)
* Processes a \a reply response from a server.
* The result of processed data is emitted by testPathParameterCollectionFormatFinished() or
* being returned as a callback parameter of testPathParameterCollectionFormat() request.
* @param[in] reply const QRestReply &
*/
/**
* \fn virtual void QtOAIFakeApi::testPathParameterCollectionFormatWithDataImpl(const QList<QString> &pipeId, const QList<QString> &ioutilId, const QList<QString> &httpId, const QList<QString> &urlId, const QList<QString> &multiContextId, const QObject *context, QtPrivate::QSlotObjectBase *slot)
* Implements the testPathParameterCollectionFormat() operation request.
* \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
* and can be overloaded for mocking testPathParameterCollectionFormat() operation calls.
* @param[in] pipeId QList<QString> [required]
* @param[in] ioutilId QList<QString> [required]
* @param[in] httpId QList<QString> [required]
* @param[in] urlId QList<QString> [required]
* @param[in] multiContextId QList<QString> [required]
* @param[in] context const QObject * [optional]
* @param[in] slot QtPrivate::QSlotObjectBase * [optional]
*/
void QtOAIFakeApi::testPathParameterCollectionFormatWithDataImpl(const QList<QString> &pipeId, const QList<QString> &ioutilId, const QList<QString> &httpId, const QList<QString> &urlId, const QList<QString> &multiContextId, const QObject *context, QtPrivate::QSlotObjectBase *slot)
{
const QUrl serverUrl = m_serverConfigs["testPathParameterCollectionFormat"][m_serverIndices.value("testPathParameterCollectionFormat")].serverUrl();
QString fullPath = "/fake/test-path-parameters/{pipeId}/{ioutilId}/{httpId}/{urlId}/{multiContextId}";
m_networkFactory->setBaseUrl(serverUrl);
{
QString pipeIdPathParam = QString("{%1}").arg("pipeId");
QString pathStyle = "";
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"pipeId"_s, false, (!false && !true));
+ const bool isObject = false || false;
+ [[maybe_unused]] const QString assignOperator = getParamStyleAssignOperator(pathStyle, false, isObject);
+ const QString pathSuffix = getParamStyleSuffix(pathStyle, u"pipeId"_s, false, isObject);
QString paramString = pathPrefix + pathSuffix;
paramString = pathPrefix + serializeArrayValue(pipeId, pathStyle, false, pathSuffix, pathDelimiter, true);
// In case style=matrix and paramString is empty due to any reasons,
// we serialize it like undefined value and delete '='.
// Described here: https://spec.openapis.org/oas/v3.1.1.html#style-values
if ((paramString == pathPrefix + pathSuffix) && QString("") == "matrix"_L1)
paramString.chop(1);
fullPath.replace(pipeIdPathParam, paramString);
}
{
QString ioutilIdPathParam = QString("{%1}").arg("ioutilId");
QString pathStyle = "";
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"ioutilId"_s, false, (!false && !true));
+ const bool isObject = false || false;
+ [[maybe_unused]] const QString assignOperator = getParamStyleAssignOperator(pathStyle, false, isObject);
+ const QString pathSuffix = getParamStyleSuffix(pathStyle, u"ioutilId"_s, false, isObject);
QString paramString = pathPrefix + pathSuffix;
paramString = pathPrefix + serializeArrayValue(ioutilId, pathStyle, false, pathSuffix, pathDelimiter, true);
// In case style=matrix and paramString is empty due to any reasons,
// we serialize it like undefined value and delete '='.
// Described here: https://spec.openapis.org/oas/v3.1.1.html#style-values
if ((paramString == pathPrefix + pathSuffix) && QString("") == "matrix"_L1)
paramString.chop(1);
fullPath.replace(ioutilIdPathParam, paramString);
}
{
QString httpIdPathParam = QString("{%1}").arg("httpId");
QString pathStyle = "";
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"httpId"_s, false, (!false && !true));
+ const bool isObject = false || false;
+ [[maybe_unused]] const QString assignOperator = getParamStyleAssignOperator(pathStyle, false, isObject);
+ const QString pathSuffix = getParamStyleSuffix(pathStyle, u"httpId"_s, false, isObject);
QString paramString = pathPrefix + pathSuffix;
paramString = pathPrefix + serializeArrayValue(httpId, pathStyle, false, pathSuffix, pathDelimiter, true);
// In case style=matrix and paramString is empty due to any reasons,
// we serialize it like undefined value and delete '='.
// Described here: https://spec.openapis.org/oas/v3.1.1.html#style-values
if ((paramString == pathPrefix + pathSuffix) && QString("") == "matrix"_L1)
paramString.chop(1);
fullPath.replace(httpIdPathParam, paramString);
}
{
QString urlIdPathParam = QString("{%1}").arg("urlId");
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"urlId"_s, false, (!false && !true));
+ const bool isObject = false || false;
+ [[maybe_unused]] const QString assignOperator = getParamStyleAssignOperator(pathStyle, false, isObject);
+ const QString pathSuffix = getParamStyleSuffix(pathStyle, u"urlId"_s, false, isObject);
QString paramString = pathPrefix + pathSuffix;
paramString = pathPrefix + serializeArrayValue(urlId, pathStyle, false, pathSuffix, pathDelimiter, true);
// In case style=matrix and paramString is empty due to any reasons,
// we serialize it like undefined value and delete '='.
// Described here: https://spec.openapis.org/oas/v3.1.1.html#style-values
if ((paramString == pathPrefix + pathSuffix) && QString("simple") == "matrix"_L1)
paramString.chop(1);
fullPath.replace(urlIdPathParam, paramString);
}
{
QString multiContextIdPathParam = QString("{%1}").arg("multiContextId");
QString pathStyle = "";
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"multiContextId"_s, false, (!false && !true));
+ const bool isObject = false || false;
+ [[maybe_unused]] const QString assignOperator = getParamStyleAssignOperator(pathStyle, false, isObject);
+ const QString pathSuffix = getParamStyleSuffix(pathStyle, u"multiContextId"_s, false, isObject);
QString paramString = pathPrefix + pathSuffix;
paramString = pathPrefix + serializeArrayValue(multiContextId, pathStyle, false, pathSuffix, pathDelimiter, true);
// In case style=matrix and paramString is empty due to any reasons,
// we serialize it like undefined value and delete '='.
// Described here: https://spec.openapis.org/oas/v3.1.1.html#style-values
if ((paramString == pathPrefix + pathSuffix) && QString("") == "matrix"_L1)
paramString.chop(1);
fullPath.replace(multiContextIdPathParam, paramString);
}
// set m_testOperationPath for serialization tests
m_testOperationPath = fullPath;
QtOAIHttpRequestInput input(fullPath, "POST");
QNetworkRequest request
= QtOAIHttpRequestWorker::getNetworkRequest(input, m_requestContent, m_networkFactory,
m_isResponseCompressionEnabled, m_isRequestCompressionEnabled);
QNetworkReply *reply = execute(input, request, m_requestContent);
if (reply != nullptr) {
reply->setParent(this);
m_callerData.insert(reply, QtOAICallerInfo{context, slot});
connect(reply, &QNetworkReply::finished, this, [this, reply] {
testPathParameterCollectionFormatCallback(QRestReply(reply));
});
connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
if (reply) {
emit testPathParameterCollectionFormatErrorOccurred(reply->error(), reply->errorString());
QtOAICallerInfo 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 QtOAIFakeApi::testPathParameterCollectionFormatCallback(const QRestReply &reply)
{
auto netReply = reply.networkReply();
if (netReply)
netReply->disconnect(this);
if (!reply.isSuccess())
return;
const QByteArray response = QtOAIHttpRequestWorker::parseResponse(reply, m_workingDirectory);
QString output;
const bool ok = ::QtOpenAPI::fromByteArray(response, output);
if (!ok)
qWarning("%s: Failed to convert the response to QString.", Q_FUNC_INFO);
// Check if callback is provided
QtOAICallerInfo 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 testPathParameterCollectionFormatFinished(output);
}
/**
* \fn virtual void QtOAIFakeApi::testQueryParameterCollectionFormat(const QList<QString> &pipe, const QList<QString> &ioutil, const QList<QString> &http, const QList<QString> &url, const QList<QString> &multiContext)
* 'testQueryParameterCollectionFormat' operation sends the request to a server.
* The request parameters are defined by a specification file.
* @param[in] pipe QList<QString> [required]
* @param[in] ioutil QList<QString> [required]
* @param[in] http QList<QString> [required]
* @param[in] url QList<QString> [required]
* @param[in] multiContext QList<QString> [required]
*/
/**
* \fn template < Functor, > void QtOAIFakeApi::testQueryParameterCollectionFormat(const QList<QString> &pipe, const QList<QString> &ioutil, const QList<QString> &http, const QList<QString> &url, const QList<QString> &multiContext, const ContextTypeForFunctor< Functor > *context = nullptr, Functor &&callback = (){})
* 'testQueryParameterCollectionFormat' 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++}
* testQueryParameterCollectionFormat(pipe, ioutil, http, url, multiContext, 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 testQueryParameterCollectionFormatWithDataImpl() in derived class.
* The virtual testQueryParameterCollectionFormatWithDataImpl() is being called by the template
* function.
* @param[in] pipe QList<QString> [required]
* @param[in] ioutil QList<QString> [required]
* @param[in] http QList<QString> [required]
* @param[in] url QList<QString> [required]
* @param[in] multiContext QList<QString> [required]
* @param[in] context const ContextTypeForFunctor< Functor > * [optional]
* @param[in] callback Functor && [optional]
*/
/**
* \fn void QtOAIFakeApi::testQueryParameterCollectionFormatCallback(const QRestReply &reply)
* Processes a \a reply response from a server.
* The result of processed data is emitted by testQueryParameterCollectionFormatFinished() or
* being returned as a callback parameter of testQueryParameterCollectionFormat() request.
* @param[in] reply const QRestReply &
*/
/**
* \fn virtual void QtOAIFakeApi::testQueryParameterCollectionFormatWithDataImpl(const QList<QString> &pipe, const QList<QString> &ioutil, const QList<QString> &http, const QList<QString> &url, const QList<QString> &multiContext, const QObject *context, QtPrivate::QSlotObjectBase *slot)
* Implements the testQueryParameterCollectionFormat() operation request.
* \note If 'makeOperationsVirtual' option is true, this function is declared as virtual
* and can be overloaded for mocking testQueryParameterCollectionFormat() operation calls.
* @param[in] pipe QList<QString> [required]
* @param[in] ioutil QList<QString> [required]
* @param[in] http QList<QString> [required]
* @param[in] url QList<QString> [required]
* @param[in] multiContext QList<QString> [required]
* @param[in] context const QObject * [optional]
* @param[in] slot QtPrivate::QSlotObjectBase * [optional]
*/
void QtOAIFakeApi::testQueryParameterCollectionFormatWithDataImpl(const QList<QString> &pipe, const QList<QString> &ioutil, const QList<QString> &http, const QList<QString> &url, const QList<QString> &multiContext, const QObject *context, QtPrivate::QSlotObjectBase *slot)
{
const QUrl serverUrl = m_serverConfigs["testQueryParameterCollectionFormat"][m_serverIndices.value("testQueryParameterCollectionFormat")].serverUrl();
QString fullPath = "/fake/test-query-parameters";
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"pipe"_s, false, (!false && !true));
- [[maybe_unused]] const QString queryAssignOperator = getParamStyleAssignOperator(queryStyle, false, (!false && !true));
+ const bool isObject = false || false;
+ const QString querySuffix = getParamStyleSuffix(queryStyle, u"pipe"_s, false, isObject);
+ [[maybe_unused]] const QString queryAssignOperator = getParamStyleAssignOperator(queryStyle, false, isObject);
if ((fullPath.indexOf("?") != fullPath.size() - 1) && (queryParamCounter == 0))
fullPath.append(queryPrefix);
{
if (queryParamCounter > 0)
fullPath.append("&");
fullPath.append(serializeArrayValue(pipe, queryStyle, false, querySuffix, queryDelimiter, true));
queryParamCounter++;
}
}
{
[[maybe_unused]] QString paramString;
QString queryStyle = "";
if (queryStyle.isEmpty())
queryStyle = "form";
const QString queryPrefix = getParamStylePrefix(queryStyle);
[[maybe_unused]] const QString queryDelimiter = getParamStyleDelimiter(queryStyle, false);
- const QString querySuffix = getParamStyleSuffix(queryStyle, u"ioutil"_s, false, (!false && !true));
- [[maybe_unused]] const QString queryAssignOperator = getParamStyleAssignOperator(queryStyle, false, (!false && !true));
+ const bool isObject = false || false;
+ const QString querySuffix = getParamStyleSuffix(queryStyle, u"ioutil"_s, false, isObject);
+ [[maybe_unused]] const QString queryAssignOperator = getParamStyleAssignOperator(queryStyle, false, isObject);
if ((fullPath.indexOf("?") != fullPath.size() - 1) && (queryParamCounter == 0))
fullPath.append(queryPrefix);
{
if (queryParamCounter > 0)
fullPath.append("&");
fullPath.append(serializeArrayValue(ioutil, queryStyle, false, querySuffix, queryDelimiter, true));
queryParamCounter++;
}
}
{
[[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"http"_s, false, (!false && !true));
- [[maybe_unused]] const QString queryAssignOperator = getParamStyleAssignOperator(queryStyle, false, (!false && !true));
+ const bool isObject = false || false;
+ const QString querySuffix = getParamStyleSuffix(queryStyle, u"http"_s, false, isObject);
+ [[maybe_unused]] const QString queryAssignOperator = getParamStyleAssignOperator(queryStyle, false, isObject);
if ((fullPath.indexOf("?") != fullPath.size() - 1) && (queryParamCounter == 0))
fullPath.append(queryPrefix);
{
if (queryParamCounter > 0)
fullPath.append("&");
fullPath.append(serializeArrayValue(http, queryStyle, false, querySuffix, queryDelimiter, true));
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, false);
- const QString querySuffix = getParamStyleSuffix(queryStyle, u"url"_s, false, (!false && !true));
- [[maybe_unused]] const QString queryAssignOperator = getParamStyleAssignOperator(queryStyle, false, (!false && !true));
+ const bool isObject = false || false;
+ const QString querySuffix = getParamStyleSuffix(queryStyle, u"url"_s, false, isObject);
+ [[maybe_unused]] const QString queryAssignOperator = getParamStyleAssignOperator(queryStyle, false, isObject);
if ((fullPath.indexOf("?") != fullPath.size() - 1) && (queryParamCounter == 0))
fullPath.append(queryPrefix);
{
if (queryParamCounter > 0)
fullPath.append("&");
fullPath.append(serializeArrayValue(url, queryStyle, false, querySuffix, queryDelimiter, true));
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"multiContext"_s, true, (!false && !true));
- [[maybe_unused]] const QString queryAssignOperator = getParamStyleAssignOperator(queryStyle, true, (!false && !true));
+ const bool isObject = false || false;
+ const QString querySuffix = getParamStyleSuffix(queryStyle, u"multiContext"_s, true, isObject);
+ [[maybe_unused]] const QString queryAssignOperator = getParamStyleAssignOperator(queryStyle, true, isObject);
if ((fullPath.indexOf("?") != fullPath.size() - 1) && (queryParamCounter == 0))
fullPath.append(queryPrefix);
{
if (queryParamCounter > 0)
fullPath.append("&");
fullPath.append(serializeArrayValue(multiContext, queryStyle, true, querySuffix, queryDelimiter, true));
queryParamCounter++;
}
}
// set m_testOperationPath for serialization tests
m_testOperationPath = fullPath;
QtOAIHttpRequestInput input(fullPath, "POST");
QNetworkRequest request
= QtOAIHttpRequestWorker::getNetworkRequest(input, m_requestContent, m_networkFactory,
m_isResponseCompressionEnabled, m_isRequestCompressionEnabled);
QNetworkReply *reply = execute(input, request, m_requestContent);
if (reply != nullptr) {
reply->setParent(this);
m_callerData.insert(reply, QtOAICallerInfo{context, slot});
connect(reply, &QNetworkReply::finished, this, [this, reply] {
testQueryParameterCollectionFormatCallback(QRestReply(reply));
});
connect(reply, &QNetworkReply::errorOccurred, this, [this, reply] {
if (reply) {
emit testQueryParameterCollectionFormatErrorOccurred(reply->error(), reply->errorString());
QtOAICallerInfo 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 QtOAIFakeApi::testQueryParameterCollectionFormatCallback(const QRestReply &reply)
{
auto netReply = reply.networkReply();
if (netReply)
netReply->disconnect(this);
if (!reply.isSuccess())
return;
const QByteArray response = QtOAIHttpRequestWorker::parseResponse(reply, m_workingDirectory);
QString output;
const bool ok = ::QtOpenAPI::fromByteArray(response, output);
if (!ok)
qWarning("%s: Failed to convert the response to QString.", Q_FUNC_INFO);
// Check if callback is provided
QtOAICallerInfo 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 testQueryParameterCollectionFormatFinished(output);
}
} // namespace QtOpenAPI