hueplusplus  1.0.0
Public Types | Public Member Functions | Static Public Member Functions | List of all members
hueplusplus::Action Class Reference

Action executed by the bridge, e.g. as a Schedule command. More...

#include <hueplusplus/Action.h>

Public Types

enum  Method { Method::post, Method::put, Method::deleteMethod }
 Method used for the command. More...
 

Public Member Functions

 Action (const nlohmann::json &json)
 Create Action from json. More...
 
std::string getAddress () const
 Get address the request is made to. More...
 
Method getMethod () const
 Get request method. More...
 
const nlohmann::json & getBody () const
 Get request body. More...
 
const nlohmann::json & toJson () const
 Get json object of command. More...
 

Static Public Member Functions

static Method parseMethod (const std::string &s)
 Parse Method from string. More...
 
static std::string methodToString (Method m)
 Get string from Method. More...
 

Detailed Description

Action executed by the bridge, e.g. as a Schedule command.

The action makes either a POST, PUT or DELETE request with a given body to an address on the bridge.

The Action can also be created by StateTransaction::toAction().

Member Enumeration Documentation

◆ Method

Method used for the command.

Enumerator
post 

POST request.

put 

PUT request.

deleteMethod 

DELETE request.

Constructor & Destructor Documentation

◆ Action()

hueplusplus::Action::Action ( const nlohmann::json &  json)
explicit

Create Action from json.

Parameters
jsonJSON object with address, method and body

Member Function Documentation

◆ getAddress()

std::string hueplusplus::Action::getAddress ( ) const

Get address the request is made to.

◆ getBody()

const nlohmann::json & hueplusplus::Action::getBody ( ) const

Get request body.

◆ getMethod()

Action::Method hueplusplus::Action::getMethod ( ) const

Get request method.

◆ methodToString()

std::string hueplusplus::Action::methodToString ( Method  m)
static

Get string from Method.

Returns
POST, PUT or DELETE

◆ parseMethod()

Action::Method hueplusplus::Action::parseMethod ( const std::string &  s)
static

Parse Method from string.

Parameters
sPOST, PUT or DELETE

◆ toJson()

const nlohmann::json & hueplusplus::Action::toJson ( ) const

Get json object of command.


The documentation for this class was generated from the following files: