diff options
author | IronClawTrem <louie.nutman@gmail.com> | 2020-02-16 03:40:06 +0000 |
---|---|---|
committer | IronClawTrem <louie.nutman@gmail.com> | 2020-02-16 03:40:06 +0000 |
commit | 425decdf7e9284d15aa726e3ae96b9942fb0e3ea (patch) | |
tree | 6c0dd7edfefff1be7b9e75fe0b3a0a85fe1595f3 /external/restclient/restclient/restclient.h | |
parent | ccb0b2e4d6674a7a00c9bf491f08fc73b6898c54 (diff) |
create tremded branch
Diffstat (limited to 'external/restclient/restclient/restclient.h')
-rw-r--r-- | external/restclient/restclient/restclient.h | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/external/restclient/restclient/restclient.h b/external/restclient/restclient/restclient.h new file mode 100644 index 0000000..d6fa77c --- /dev/null +++ b/external/restclient/restclient/restclient.h @@ -0,0 +1,63 @@ +/** + * @file restclient.h + * @brief libcurl wrapper for REST calls + * @author Daniel Schauenberg <d@unwiredcouch.com> + * @version + * @date 2010-10-11 + */ + +#ifndef INCLUDE_RESTCLIENT_CPP_RESTCLIENT_H_ +#define INCLUDE_RESTCLIENT_CPP_RESTCLIENT_H_ + +#include <string> +#include <map> +#include <cstdlib> + +#include "version.h" + +/** + * @brief namespace for all RestClient definitions + */ +namespace RestClient { + +/** + * public data definitions + */ +typedef std::map<std::string, std::string> HeaderFields; + +/** @struct Response + * @brief This structure represents the HTTP response data + * @var Response::code + * Member 'code' contains the HTTP response code + * @var Response::body + * Member 'body' contains the HTTP response body + * @var Response::headers + * Member 'headers' contains the HTTP response headers + */ +typedef struct { + int code; + std::string body; + HeaderFields headers; +} Response; + +// init and disable functions +int init(); +void disable(); + +/** + * public methods for the simple API. These don't allow a lot of + * configuration but are meant for simple HTTP calls. + * + */ +Response get(const std::string& url); +Response post(const std::string& url, + const std::string& content_type, + const std::string& data); +Response put(const std::string& url, + const std::string& content_type, + const std::string& data); +Response del(const std::string& url); + +}; // namespace RestClient + +#endif // INCLUDE_RESTCLIENT_CPP_RESTCLIENT_H_ |