diff --git a/src/protocols/HTTP.h b/src/protocols/HTTP.h index c689a89c..b0309853 100644 --- a/src/protocols/HTTP.h +++ b/src/protocols/HTTP.h @@ -4,19 +4,63 @@ #include "TypeDef.h" #include "TransportLayer.h" + +/*! + \class HTTPClient + + \brief Client for simple HTTP communication. +*/ class HTTPClient { public: - // constructor + /*! + \brief Default constructor. + + \param tl Pointer to the wireless module providing TransportLayer communication. + + \param port Port to be used for HTTP. Defaults to 80. + */ HTTPClient(TransportLayer* tl, uint16_t port = 80); - - // basic methods + + /*! + \brief Sends HTTP GET request. + + \param url URL to send the request to. + + \param response Arduino String object that will save the response. + + \returns \ref status_codes + */ int16_t get(String& url, String& response); + + /*! + \brief Sends HTTP GET request. + + \param url URL to send the request to. + + \param response Arduino String object that will save the response. + + \returns \ref status_codes + */ int16_t get(const char* url, String& response); + + /*! + \brief Sends HTTP POST request. + + \param url URL to send the request to. + + \param content Request content. + + \param response Arduino String object that will save the response. + + \param contentType MIME type of request content. Defaults to "text/plain". + + \returns \ref status_codes + */ int16_t post(const char* url, const char* content, String& response, const char* contentType = "text/plain"); - + private: TransportLayer* _tl; - + uint16_t _port; };