WebAPI.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #ifndef API_WEBAPI_H
  2. #define API_WEBAPI_H
  3. #include <HttpPostData.h>
  4. #include <HttpServer.h>
  5. #include <json.hpp>
  6. #include <string>
  7. #include <vector>
  8. namespace DataStorage {
  9. class DataStorageClient;
  10. } // namespace DataStorage
  11. namespace DataStorageInterface {
  12. namespace DataInterface {
  13. class GraphClient;
  14. } // namespace DataInterface
  15. namespace API {
  16. class WebAPI
  17. {
  18. public:
  19. WebAPI();
  20. ~WebAPI();
  21. static Http::HttpServer::HttpReply ProcessQuery(DataStorage::DataStorageClient* pDataStorageClient, DataInterface::GraphClient* pGraphClient, const std::string& uri, const std::vector<Http::HttpPostData>& postData);
  22. private:
  23. static Http::HttpServer::HttpReply ProcessLogQuery(DataStorage::DataStorageClient* pDataStorageClient, const std::string& uri);
  24. static Http::HttpServer::HttpReply ProcessGraphHeaderQuery(DataInterface::GraphClient* pGraphClient, const std::string& uri);
  25. static Http::HttpServer::HttpReply ProcessGraphQuery(DataInterface::GraphClient* pGraphClient, const std::string& uri);
  26. static Http::HttpServer::HttpReply ProcessSettingsQuery(const std::string& uri);
  27. static nlohmann::json GetGraphHeader(DataInterface::GraphClient* pGraphClient, const std::vector<int>& dataIds, const std::string& timespan);
  28. static nlohmann::json GetGraphData(DataInterface::GraphClient* pGraphClient, int deviceId, const std::vector<int>& dataIds, const std::string& timespan);
  29. };
  30. } // namespace API
  31. } // namespace DataStorageInterface
  32. #endif // UTIL_API_WEBAPI_H