8 #ifndef MAIN_RESTCLIENT_H_
9 #define MAIN_RESTCLIENT_H_
10 #include "sdkconfig.h"
11 #if defined(CONFIG_LIBCURL_PRESENT)
14 #include <curl/curl.h>
22 RESTTimings(RESTClient* client);
24 std::string toString();
27 double m_namelookup = 0;
29 double m_appconnect = 0;
30 double m_pretransfer = 0;
31 double m_starttransfer = 0;
33 RESTClient* client =
nullptr;
71 virtual ~RESTClient();
72 void addHeader(std::string name, std::string value);
74 std::string getErrorMessage();
80 std::string getResponse() {
87 RESTTimings *getTimings() {
91 long post(std::string body);
99 void setURL(std::string url) {
108 void setVerbose(
bool value) {
115 char m_errbuf[CURL_ERROR_SIZE];
116 struct curl_slist* m_headers =
nullptr;
117 bool m_verbose =
false;
118 friend class RESTTimings;
119 RESTTimings* m_timings;
120 std::string m_response;
121 static size_t handleData(
void* buffer,
size_t size,
size_t nmemb,
void* userp);