Revision control
Copy as Markdown
/**
* OpenAPI Petstore
* This is a sample of Petstore application. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
* Do not edit the class manually.
*/
#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonObject>
#include <QVariantMap>
#include <QDebug>
#include "OAIHelpers.h"
#include "OAIStoreApiHandler.h"
#include "OAIStoreApiRequest.h"
namespace OpenAPI {
OAIStoreApiHandler::OAIStoreApiHandler(){
}
OAIStoreApiHandler::~OAIStoreApiHandler(){
}
void OAIStoreApiHandler::deleteOrder(QString order_id) {
qint64 id;
fromStringValue(order_id, id);
m_orders.remove(id);
auto reqObj = qobject_cast<OAIStoreApiRequest*>(sender());
if( reqObj != nullptr )
{
reqObj->deleteOrderResponse();
}
}
void OAIStoreApiHandler::getInventory() {
auto reqObj = qobject_cast<OAIStoreApiRequest*>(sender());
if( reqObj != nullptr )
{
QMap<QString, qint32> res;
reqObj->getInventoryResponse(res);
}
}
void OAIStoreApiHandler::getOrderById(qint64 order_id) {
auto reqObj = qobject_cast<OAIStoreApiRequest*>(sender());
if( reqObj != nullptr )
{
reqObj->getOrderByIdResponse(m_orders.value(order_id));
}
}
void OAIStoreApiHandler::placeOrder(OAIOrder body) {
m_orders.insert(body.getId(), body);
auto reqObj = qobject_cast<OAIStoreApiRequest*>(sender());
if( reqObj != nullptr )
{
OAIOrder res;
res.setShipDate(QDateTime::fromString("1.30.1", "M.d.s"));
reqObj->placeOrderResponse(res);
}
}
}