51 lines
1.4 KiB
C++
51 lines
1.4 KiB
C++
#ifndef API_WEBAPI_H
|
|
#define API_WEBAPI_H
|
|
|
|
#include <HttpPostData.h>
|
|
#include <HttpServer.h>
|
|
#include <json.hpp>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
|
|
namespace DataStorage {
|
|
|
|
class DataStorageClient;
|
|
|
|
} // namespace DataStorage
|
|
|
|
namespace DataStorageInterface {
|
|
|
|
namespace DataInterface {
|
|
|
|
class GraphClient;
|
|
|
|
} // namespace DataInterface
|
|
|
|
namespace API {
|
|
|
|
class WebAPI
|
|
{
|
|
public:
|
|
WebAPI();
|
|
~WebAPI();
|
|
|
|
static Http::HttpServer::HttpReply ProcessQuery(DataStorage::DataStorageClient* pDataStorageClient, DataInterface::GraphClient* pGraphClient, const std::string& uri, const std::vector<Http::HttpPostData>& postData);
|
|
|
|
private:
|
|
static Http::HttpServer::HttpReply ProcessLogQuery(DataStorage::DataStorageClient* pDataStorageClient, const std::string& uri);
|
|
|
|
static Http::HttpServer::HttpReply ProcessGraphHeaderQuery(DataInterface::GraphClient* pGraphClient, const std::string& uri);
|
|
static Http::HttpServer::HttpReply ProcessGraphQuery(DataInterface::GraphClient* pGraphClient, const std::string& uri);
|
|
|
|
static Http::HttpServer::HttpReply ProcessSettingsQuery(const std::string& uri);
|
|
|
|
static nlohmann::json GetGraphHeader(DataInterface::GraphClient* pGraphClient, const std::vector<int>& dataIds, const std::string& timespan);
|
|
static nlohmann::json GetGraphData(DataInterface::GraphClient* pGraphClient, int deviceId, const std::vector<int>& dataIds, const std::string& timespan);
|
|
};
|
|
|
|
} // namespace API
|
|
} // namespace DataStorageInterface
|
|
|
|
#endif // UTIL_API_WEBAPI_H
|