hueplusplus 1.2.0
|
#include <hueplusplus/HueCommandAPI.h>
Public Member Functions | |
HueCommandAPI (const std::string &ip, int port, const std::string &username, std::shared_ptr< const IHttpHandler > httpHandler) | |
Construct from ip, username and HttpHandler. | |
HueCommandAPI (const HueCommandAPI &)=default | |
Copy construct from other HueCommandAPI. | |
HueCommandAPI (HueCommandAPI &&)=default | |
Move construct from other HueCommandAPI. | |
HueCommandAPI & | operator= (const HueCommandAPI &)=default |
Copy assign from other HueCommandAPI. | |
HueCommandAPI & | operator= (HueCommandAPI &&)=default |
Move assign from other HueCommandAPI. | |
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. | |
nlohmann::json | 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. | |
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. | |
nlohmann::json | 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. | |
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. | |
nlohmann::json | 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. | |
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. | |
nlohmann::json | 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. | |
std::string | combinedPath (const std::string &path) const |
Combines path with api prefix and username. | |
Handles communication to the bridge via IHttpHandler and enforces a timeout between each request
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.
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 |
|
default |
Copy construct from other HueCommandAPI.
|
default |
Move construct from other HueCommandAPI.
std::string hueplusplus::HueCommandAPI::combinedPath | ( | const std::string & | path | ) | const |
Combines path with api prefix and username.
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.
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
path | API request path (appended after /api/{username}) |
request | Request to the api, may be empty |
fileInfo | File information for thrown 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 |
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.
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
path | API request path (appended after /api/{username}) |
request | Request to the api, may be empty |
fileInfo | File information for thrown 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 |
|
default |
Copy assign from other HueCommandAPI.
|
default |
Move assign from other HueCommandAPI.
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.
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
path | API request path (appended after /api/{username}) |
request | Request to the api, may be empty |
fileInfo | File information for thrown 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 |
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.
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
path | API request path (appended after /api/{username}) |
request | Request to the api, may be empty |
fileInfo | File information for thrown exceptions. |
std::system_error | when system or socket operations fail |
HueException | when response contains no body |
HueAPIResponseException | when response contains an error |