Loading...
Searching...
No Matches
Action.h
Go to the documentation of this file.
#ifndef INCLUDE_HUEPLUSPLUS_ACTION_H
#define INCLUDE_HUEPLUSPLUS_ACTION_H
#include <nlohmann/json.hpp>
namespace hueplusplus
{
class Action
{
public:
explicit Action(const nlohmann::json& json);
enum class Method
{
post,
put,
deleteMethod
};
std::string getAddress() const;
Method getMethod() const;
const nlohmann::json& getBody() const;
const nlohmann::json& toJson() const;
public:
static Method parseMethod(const std::string& s);
static std::string methodToString(Method m);
private:
nlohmann::json json;
};
} // namespace hueplusplus
#endif
hueplusplus::Action
Action executed by the bridge, e.g. as a Schedule command.
Definition Action.h:36
hueplusplus::Action::Method
Method
Method used for the command.
Definition Action.h:44
hueplusplus::Action::Method::post
@ post
POST request.
hueplusplus::Action::Method::put
@ put
PUT request.
hueplusplus::Action::Method::deleteMethod
@ deleteMethod
DELETE request.
hueplusplus::Action::getAddress
std::string getAddress() const
Get address the request is made to.
Definition Action.cpp:30
hueplusplus::Action::getBody
const nlohmann::json & getBody() const
Get request body.
Definition Action.cpp:40
hueplusplus::Action::parseMethod
static Method parseMethod(const std::string &s)
Parse Method from string.
Definition Action.cpp:50
hueplusplus::Action::getMethod
Method getMethod() const
Get request method.
Definition Action.cpp:35
hueplusplus::Action::toJson
const nlohmann::json & toJson() const
Get json object of command.
Definition Action.cpp:45
hueplusplus::Action::methodToString
static std::string methodToString(Method m)
Get string from Method.
Definition Action.cpp:67
hueplusplus
Namespace for the hueplusplus library.
Definition Action.h:28