#include <hueplusplus/HueCommandAPI.h>
|
| HueCommandAPI (const std::string &ip, int port, const std::string &username, std::shared_ptr< const IHttpHandler > httpHandler) |
| Construct from ip, username and HttpHandler. More...
|
|
| HueCommandAPI (const HueCommandAPI &)=default |
| Copy construct from other HueCommandAPI. More...
|
|
| HueCommandAPI (HueCommandAPI &&)=default |
| Move construct from other HueCommandAPI. More...
|
|
HueCommandAPI & | operator= (const HueCommandAPI &)=default |
| Copy assign from other HueCommandAPI. More...
|
|
HueCommandAPI & | operator= (HueCommandAPI &&)=default |
| Move assign from other HueCommandAPI. More...
|
|
nlohmann::json | PUTRequest (const std::string &path, const nlohmann::json &request, FileInfo fileInfo) const |
| Sends a HTTP PUT request to the bridge and returns the response. More...
|
|
nlohmann::json | PUTRequest (const std::string &path, const nlohmann::json &request) const |
|
nlohmann::json | GETRequest (const std::string &path, const nlohmann::json &request, FileInfo fileInfo) const |
| Sends a HTTP GET request to the bridge and returns the response. More...
|
|
nlohmann::json | GETRequest (const std::string &path, const nlohmann::json &request) const |
|
nlohmann::json | DELETERequest (const std::string &path, const nlohmann::json &request, FileInfo fileInfo) const |
| Sends a HTTP DELETE request to the bridge and returns the response. More...
|
|
nlohmann::json | DELETERequest (const std::string &path, const nlohmann::json &request) const |
|
nlohmann::json | POSTRequest (const std::string &path, const nlohmann::json &request, FileInfo fileInfo) const |
| Sends a HTTP POST request to the bridge and returns the response. More...
|
|
nlohmann::json | POSTRequest (const std::string &path, const nlohmann::json &request) const |
|
std::string | combinedPath (const std::string &path) const |
| Combines path with api prefix and username. More...
|
|
Handles communication to the bridge via IHttpHandler and enforces a timeout between each request
◆ HueCommandAPI() [1/3]
hueplusplus::HueCommandAPI::HueCommandAPI |
( |
const std::string & |
ip, |
|
|
int |
port, |
|
|
const std::string & |
username, |
|
|
std::shared_ptr< const IHttpHandler > |
httpHandler |
|
) |
| |
Construct from ip, username and HttpHandler.
- Parameters
-
ip | ip address of the Hue bridge in dotted decimal notation like "192.168.2.1" |
port | of the hue bridge |
username | username that is used to control the bridge |
httpHandler | HttpHandler for communication with the bridge |
◆ HueCommandAPI() [2/3]
hueplusplus::HueCommandAPI::HueCommandAPI |
( |
const HueCommandAPI & |
| ) |
|
|
default |
Copy construct from other HueCommandAPI.
- Note
- All copies refer to the same timeout data, so even calls from different objects will be delayed
◆ HueCommandAPI() [3/3]
Move construct from other HueCommandAPI.
- Note
- All copies refer to the same timeout data, so even calls from different objects will be delayed
◆ combinedPath()
std::string hueplusplus::HueCommandAPI::combinedPath |
( |
const std::string & |
path | ) |
const |
Combines path with api prefix and username.
- Returns
- "/api/<username>/<path>"
◆ DELETERequest() [1/2]
nlohmann::json hueplusplus::HueCommandAPI::DELETERequest |
( |
const std::string & |
path, |
|
|
const nlohmann::json & |
request, |
|
|
FileInfo |
fileInfo |
|
) |
| const |
Sends a HTTP DELETE request to the bridge and returns the response.
This function will block until at least Config::getBridgeRequestDelay() has passed to any previous request
- Parameters
-
path | API request path (appended after /api/{username}) |
request | Request to the api, may be empty |
fileInfo | File information for thrown exceptions. |
- Returns
- The return value of the underlying IHttpHandler::DELETEJson call
- Exceptions
-
std::system_error | when system or socket operations fail |
HueException | when response contains no body |
HueAPIResponseException | when response contains an error |
nlohmann::json::parse_error | when response could not be parsed |
◆ DELETERequest() [2/2]
nlohmann::json hueplusplus::HueCommandAPI::DELETERequest |
( |
const std::string & |
path, |
|
|
const nlohmann::json & |
request |
|
) |
| const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
◆ GETRequest() [1/2]
nlohmann::json hueplusplus::HueCommandAPI::GETRequest |
( |
const std::string & |
path, |
|
|
const nlohmann::json & |
request, |
|
|
FileInfo |
fileInfo |
|
) |
| const |
Sends a HTTP GET request to the bridge and returns the response.
This function will block until at least Config::getBridgeRequestDelay() has passed to any previous request
- Parameters
-
path | API request path (appended after /api/{username}) |
request | Request to the api, may be empty |
fileInfo | File information for thrown exceptions. |
- Returns
- The return value of the underlying IHttpHandler::GETJson call
- Exceptions
-
std::system_error | when system or socket operations fail |
HueException | when response contains no body |
HueAPIResponseException | when response contains an error |
nlohmann::json::parse_error | when response could not be parsed |
◆ GETRequest() [2/2]
nlohmann::json hueplusplus::HueCommandAPI::GETRequest |
( |
const std::string & |
path, |
|
|
const nlohmann::json & |
request |
|
) |
| const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
◆ operator=() [1/2]
Copy assign from other HueCommandAPI.
- Note
- All copies refer to the same timeout data, so even calls from different objects will be delayed
◆ operator=() [2/2]
Move assign from other HueCommandAPI.
- Note
- All copies refer to the same timeout data, so even calls from different objects will be delayed
◆ POSTRequest() [1/2]
nlohmann::json hueplusplus::HueCommandAPI::POSTRequest |
( |
const std::string & |
path, |
|
|
const nlohmann::json & |
request, |
|
|
FileInfo |
fileInfo |
|
) |
| const |
Sends a HTTP POST request to the bridge and returns the response.
This function will block until at least Config::getBridgeRequestDelay() has passed to any previous request
- Parameters
-
path | API request path (appended after /api/{username}) |
request | Request to the api, may be empty |
fileInfo | File information for thrown exceptions. |
- Returns
- The return value of the underlying IHttpHandler::POSTJson call
- Exceptions
-
std::system_error | when system or socket operations fail |
HueException | when response contains no body |
HueAPIResponseException | when response contains an error |
nlohmann::json::parse_error | when response could not be parsed |
◆ POSTRequest() [2/2]
nlohmann::json hueplusplus::HueCommandAPI::POSTRequest |
( |
const std::string & |
path, |
|
|
const nlohmann::json & |
request |
|
) |
| const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
◆ PUTRequest() [1/2]
nlohmann::json hueplusplus::HueCommandAPI::PUTRequest |
( |
const std::string & |
path, |
|
|
const nlohmann::json & |
request, |
|
|
FileInfo |
fileInfo |
|
) |
| const |
Sends a HTTP PUT request to the bridge and returns the response.
This function will block until at least Config::getBridgeRequestDelay() has passed to any previous request
- Parameters
-
path | API request path (appended after /api/{username}) |
request | Request to the api, may be empty |
fileInfo | File information for thrown exceptions. |
- Returns
- The return value of the underlying IHttpHandler::PUTJson call
- Exceptions
-
◆ PUTRequest() [2/2]
nlohmann::json hueplusplus::HueCommandAPI::PUTRequest |
( |
const std::string & |
path, |
|
|
const nlohmann::json & |
request |
|
) |
| const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
The documentation for this class was generated from the following files: