Loading...
Searching...
No Matches
hueplusplus::Action Class Reference

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

`#include <hueplusplus/Action.h>`

## Public Types

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

## Public Member Functions

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

## Static Public Member Functions

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

## 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

enum class hueplusplus::Action::Method

strong

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

  json | JSON 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

  s | `POST`, `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:

- include/hueplusplus/Action.h
- src/Action.cpp