hueplusplus 1.2.0
Loading...
Searching...
No Matches
BaseHttpHandler.h
Go to the documentation of this file.
1
23#ifndef INCLUDE_HUEPLUSPLUS_BASE_HTTP_HANDLER_H
24#define INCLUDE_HUEPLUSPLUS_BASE_HTTP_HANDLER_H
25
26#include <iostream>
27#include <memory>
28#include <string>
29#include <vector>
30
31#include "IHttpHandler.h"
32
33#include <nlohmann/json.hpp>
34
35namespace hueplusplus
36{
39{
40public:
42 virtual ~BaseHttpHandler() = default;
43
52 std::string sendGetHTTPBody(const std::string& msg, const std::string& adr, int port = 80) const override;
53
65 std::string sendHTTPRequest(const std::string& method, const std::string& uri, const std::string& contentType,
66 const std::string& body, const std::string& adr, int port = 80) const override;
67
79 std::string GETString(const std::string& uri, const std::string& contentType, const std::string& body,
80 const std::string& adr, int port = 80) const override;
81
93 std::string POSTString(const std::string& uri, const std::string& contentType, const std::string& body,
94 const std::string& adr, int port = 80) const override;
95
107 std::string PUTString(const std::string& uri, const std::string& contentType, const std::string& body,
108 const std::string& adr, int port = 80) const override;
109
121 std::string DELETEString(const std::string& uri, const std::string& contentType, const std::string& body,
122 const std::string& adr, int port = 80) const override;
123
134 nlohmann::json GETJson(
135 const std::string& uri, const nlohmann::json& body, const std::string& adr, int port = 80) const override;
136
147 nlohmann::json POSTJson(
148 const std::string& uri, const nlohmann::json& body, const std::string& adr, int port = 80) const override;
149
160 nlohmann::json PUTJson(
161 const std::string& uri, const nlohmann::json& body, const std::string& adr, int port = 80) const override;
162
173 nlohmann::json DELETEJson(
174 const std::string& uri, const nlohmann::json& body, const std::string& adr, int port = 80) const override;
175};
176} // namespace hueplusplus
177
178#endif
Base class for classes that handle http requests and multicast requests.
Definition BaseHttpHandler.h:39
nlohmann::json GETJson(const std::string &uri, const nlohmann::json &body, const std::string &adr, int port=80) const override
Send a HTTP GET request to the specified host and return the body of the response parsed as JSON.
Definition BaseHttpHandler.cpp:103
virtual ~BaseHttpHandler()=default
Virtual dtor.
std::string DELETEString(const std::string &uri, const std::string &contentType, const std::string &body, const std::string &adr, int port=80) const override
Send a HTTP DELETE request to the specified host and return the body of the response.
Definition BaseHttpHandler.cpp:97
std::string GETString(const std::string &uri, const std::string &contentType, const std::string &body, const std::string &adr, int port=80) const override
Send a HTTP GET request to the specified host and return the body of the response.
Definition BaseHttpHandler.cpp:79
nlohmann::json PUTJson(const std::string &uri, const nlohmann::json &body, const std::string &adr, int port=80) const override
Send a HTTP PUT request to the specified host and return the body of the response parsed as JSON.
Definition BaseHttpHandler.cpp:115
std::string PUTString(const std::string &uri, const std::string &contentType, const std::string &body, const std::string &adr, int port=80) const override
Send a HTTP PUT request to the specified host and return the body of the response.
Definition BaseHttpHandler.cpp:91
std::string POSTString(const std::string &uri, const std::string &contentType, const std::string &body, const std::string &adr, int port=80) const override
Send a HTTP POST request to the specified host and return the body of the response.
Definition BaseHttpHandler.cpp:85
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 override
Send a HTTP request with the given method to the specified host and return the body of the response.
Definition BaseHttpHandler.cpp:46
nlohmann::json DELETEJson(const std::string &uri, const nlohmann::json &body, const std::string &adr, int port=80) const override
Send a HTTP DELETE request to the specified host and return the body of the response parsed as JSON.
Definition BaseHttpHandler.cpp:121
nlohmann::json POSTJson(const std::string &uri, const nlohmann::json &body, const std::string &adr, int port=80) const override
Send a HTTP POST request to the specified host and return the body of the response parsed as JSON.
Definition BaseHttpHandler.cpp:109
std::string sendGetHTTPBody(const std::string &msg, const std::string &adr, int port=80) const override
Send a message to a specified host and return the body of the response.
Definition BaseHttpHandler.cpp:29
Abstract class for classes that handle http requests and multicast requests.
Definition IHttpHandler.h:38
Namespace for the hueplusplus library.
Definition Action.h:28