hueplusplus 1.2.0
Loading...
Searching...
No Matches
Action.h
Go to the documentation of this file.
1
22#ifndef INCLUDE_HUEPLUSPLUS_ACTION_H
23#define INCLUDE_HUEPLUSPLUS_ACTION_H
24
25#include <nlohmann/json.hpp>
26
27namespace hueplusplus
28{
35class Action
36{
37public:
40 explicit Action(const nlohmann::json& json);
41
43 enum class Method
44 {
45 post,
46 put,
48 };
49
51 std::string getAddress() const;
53 Method getMethod() const;
55 const nlohmann::json& getBody() const;
56
58 const nlohmann::json& toJson() const;
59
60public:
63 static Method parseMethod(const std::string& s);
66 static std::string methodToString(Method m);
67
68private:
69 nlohmann::json json;
70};
71} // namespace hueplusplus
72
73#endif
Action executed by the bridge, e.g. as a Schedule command.
Definition Action.h:36
Method
Method used for the command.
Definition Action.h:44
@ deleteMethod
DELETE request.
std::string getAddress() const
Get address the request is made to.
Definition Action.cpp:30
const nlohmann::json & getBody() const
Get request body.
Definition Action.cpp:40
static Method parseMethod(const std::string &s)
Parse Method from string.
Definition Action.cpp:50
Method getMethod() const
Get request method.
Definition Action.cpp:35
const nlohmann::json & toJson() const
Get json object of command.
Definition Action.cpp:45
static std::string methodToString(Method m)
Get string from Method.
Definition Action.cpp:67
Namespace for the hueplusplus library.
Definition Action.h:28