hueplusplus  1.0.0
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 "json/json.hpp"
26 
27 namespace hueplusplus
28 {
35 class Action
36 {
37 public:
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 
60 public:
63  static Method parseMethod(const std::string& s);
66  static std::string methodToString(Method m);
67 
68 private:
69  nlohmann::json json;
70 };
71 } // namespace hueplusplus
72 
73 #endif
Method getMethod() const
Get request method.
Definition: Action.cpp:35
Action executed by the bridge, e.g. as a Schedule command.
Definition: Action.h:35
Namespace for the hueplusplus library.
Definition: Action.h:27
static Method parseMethod(const std::string &s)
Parse Method from string.
Definition: Action.cpp:50
const nlohmann::json & toJson() const
Get json object of command.
Definition: Action.cpp:45
Method
Method used for the command.
Definition: Action.h:43
static std::string methodToString(Method m)
Get string from Method.
Definition: Action.cpp:67
const nlohmann::json & getBody() const
Get request body.
Definition: Action.cpp:40
std::string getAddress() const
Get address the request is made to.
Definition: Action.cpp:30
Action(const nlohmann::json &json)
Create Action from json.
Definition: Action.cpp:28