23 #ifndef INCLUDE_HUEPLUSPLUS_IHTTPHANDLER_H 24 #define INCLUDE_HUEPLUSPLUS_IHTTPHANDLER_H 32 #include "json/json.hpp" 50 virtual std::string
send(
const std::string& msg,
const std::string& adr,
int port = 80)
const = 0;
60 virtual std::string
sendGetHTTPBody(
const std::string& msg,
const std::string& adr,
int port = 80)
const = 0;
73 virtual std::vector<std::string>
sendMulticast(
const std::string& msg,
const std::string& adr =
"239.255.255.250",
74 int port = 1900, std::chrono::steady_clock::duration timeout = std::chrono::seconds(5))
const = 0;
87 virtual std::string
sendHTTPRequest(
const std::string& method,
const std::string& uri,
88 const std::string& contentType,
const std::string& body,
const std::string& adr,
int port = 80)
const = 0;
101 virtual std::string
GETString(
const std::string& uri,
const std::string& contentType,
const std::string& body,
102 const std::string& adr,
int port = 80)
const = 0;
115 virtual std::string
POSTString(
const std::string& uri,
const std::string& contentType,
const std::string& body,
116 const std::string& adr,
int port = 80)
const = 0;
129 virtual std::string
PUTString(
const std::string& uri,
const std::string& contentType,
const std::string& body,
130 const std::string& adr,
int port = 80)
const = 0;
143 virtual std::string
DELETEString(
const std::string& uri,
const std::string& contentType,
const std::string& body,
144 const std::string& adr,
int port = 80)
const = 0;
156 virtual nlohmann::json
GETJson(
157 const std::string& uri,
const nlohmann::json& body,
const std::string& adr,
int port = 80)
const = 0;
170 const std::string& uri,
const nlohmann::json& body,
const std::string& adr,
int port = 80)
const = 0;
182 virtual nlohmann::json
PUTJson(
183 const std::string& uri,
const nlohmann::json& body,
const std::string& adr,
int port = 80)
const = 0;
196 const std::string& uri,
const nlohmann::json& body,
const std::string& adr,
int port = 80)
const = 0;
virtual std::string POSTString(const std::string &uri, const std::string &contentType, const std::string &body, const std::string &adr, int port=80) const =0
Send a HTTP POST request to the specified host and return the body of the response.
virtual std::string DELETEString(const std::string &uri, const std::string &contentType, const std::string &body, const std::string &adr, int port=80) const =0
Send a HTTP DELETE request to the specified host and return the body of the response.
virtual nlohmann::json PUTJson(const std::string &uri, const nlohmann::json &body, const std::string &adr, int port=80) const =0
Send a HTTP PUT request to the specified host and return the body of the response parsed as JSON...
virtual ~IHttpHandler()=default
Virtual dtor.
Namespace for the hueplusplus library.
Definition: Action.h:27
virtual std::vector< std::string > sendMulticast(const std::string &msg, const std::string &adr="239.255.255.250", int port=1900, std::chrono::steady_clock::duration timeout=std::chrono::seconds(5)) const =0
Send a multicast request with a specified message.
Abstract class for classes that handle http requests and multicast requests.
Definition: IHttpHandler.h:37
virtual std::string send(const std::string &msg, const std::string &adr, int port=80) const =0
Send a message to a specified host and return the response.
virtual nlohmann::json POSTJson(const std::string &uri, const nlohmann::json &body, const std::string &adr, int port=80) const =0
Send a HTTP POST request to the specified host and return the body of the response parsed as JSON...
virtual nlohmann::json GETJson(const std::string &uri, const nlohmann::json &body, const std::string &adr, int port=80) const =0
Send a HTTP GET request to the specified host and return the body of the response parsed as JSON...
virtual std::string sendGetHTTPBody(const std::string &msg, const std::string &adr, int port=80) const =0
Send a message to a specified host and return the body of the response.
virtual std::string GETString(const std::string &uri, const std::string &contentType, const std::string &body, const std::string &adr, int port=80) const =0
Send a HTTP GET request to the specified host and return the body of the response.
virtual std::string PUTString(const std::string &uri, const std::string &contentType, const std::string &body, const std::string &adr, int port=80) const =0
Send a HTTP PUT request to the specified host and return the body of the response.
virtual nlohmann::json DELETEJson(const std::string &uri, const nlohmann::json &body, const std::string &adr, int port=80) const =0
Send a HTTP DELETE request to the specified host and return the body of the response parsed as JSON...
virtual std::string sendHTTPRequest(const std::string &method, const std::string &uri, const std::string &contentType, const std::string &body, const std::string &adr, int port=80) const =0
Send a HTTP request with the given method to the specified host and return the body of the response...