NUGU SDK Linux
1.7.6
|
NUGU HTTP Rest. More...
#include <nugu_http_rest.hh>
Public Types | |
typedef std::function< void(const NuguHttpResponse *resp)> | ResponseCallback |
Callback prototype for receiving async response. | |
Public Member Functions | |
bool | addHeader (const std::string &key, const std::string &value) |
Add a key-value string to common header. More... | |
bool | del (const std::string &path, const NuguHttpHeader *additional_header, ResponseCallback cb) |
HTTP DELETE async requests. More... | |
NuguHttpResponse * | del (const std::string &path, const NuguHttpHeader *additional_header=nullptr) |
HTTP DELETE requests. More... | |
bool | del (const std::string &path, ResponseCallback cb) |
HTTP DELETE async requests. More... | |
std::string | findHeader (const std::string &key) |
Find a value for key from common header. More... | |
bool | get (const std::string &path, const NuguHttpHeader *additional_header, ResponseCallback cb) |
HTTP GET async requests. More... | |
NuguHttpResponse * | get (const std::string &path, const NuguHttpHeader *additional_header=nullptr) |
HTTP GET requests. More... | |
bool | get (const std::string &path, ResponseCallback cb) |
HTTP GET async requests. More... | |
std::string | getUrl () |
Get the url of host. More... | |
NuguHttpRest (const std::string &url) | |
bool | post (const std::string &path, const std::string &body, const NuguHttpHeader *additional_header, ResponseCallback cb) |
HTTP POST async requests. More... | |
NuguHttpResponse * | post (const std::string &path, const std::string &body, const NuguHttpHeader *additional_header=nullptr) |
HTTP POST requests. More... | |
bool | post (const std::string &path, const std::string &body, ResponseCallback cb) |
HTTP POST async requests. More... | |
bool | put (const std::string &path, const std::string &body, const NuguHttpHeader *additional_header, ResponseCallback cb) |
HTTP PUT async requests. More... | |
NuguHttpResponse * | put (const std::string &path, const std::string &body, const NuguHttpHeader *additional_header=nullptr) |
HTTP PUT requests. More... | |
bool | put (const std::string &path, const std::string &body, ResponseCallback cb) |
HTTP PUT async requests. More... | |
bool | removeHeader (const std::string &key) |
Remove a key-value from common header. More... | |
void | setConnectionTimeout (long msecs) |
Set connection timeout to host. More... | |
void | setTimeout (long msecs) |
Set timeout to host. More... | |
NUGU HTTP Rest.
void NuguClientKit::NuguHttpRest::setTimeout | ( | long | msecs | ) |
Set timeout to host.
[in] | msecs | millisecond |
void NuguClientKit::NuguHttpRest::setConnectionTimeout | ( | long | msecs | ) |
Set connection timeout to host.
[in] | msecs | millisecond |
std::string NuguClientKit::NuguHttpRest::getUrl | ( | ) |
Get the url of host.
bool NuguClientKit::NuguHttpRest::addHeader | ( | const std::string & | key, |
const std::string & | value | ||
) |
Add a key-value string to common header.
[in] | key | key string, e.g. "Content-Type" |
[in] | value | value string, e.g. "application/json" |
true | success |
false | failure |
bool NuguClientKit::NuguHttpRest::removeHeader | ( | const std::string & | key | ) |
Remove a key-value from common header.
[in] | key | key string, e.g. "Content-Type" |
true | success |
false | failure |
std::string NuguClientKit::NuguHttpRest::findHeader | ( | const std::string & | key | ) |
Find a value for key from common header.
[in] | key | key string, e.g. "Content-Type" |
NuguHttpResponse* NuguClientKit::NuguHttpRest::get | ( | const std::string & | path, |
const NuguHttpHeader * | additional_header = nullptr |
||
) |
HTTP GET requests.
[in] | path | url path |
[in] | additional_header | additional header |
bool NuguClientKit::NuguHttpRest::get | ( | const std::string & | path, |
ResponseCallback | cb | ||
) |
HTTP GET async requests.
[in] | path | url path |
[in] | cb | callback function to receive response |
true | success |
false | failure |
bool NuguClientKit::NuguHttpRest::get | ( | const std::string & | path, |
const NuguHttpHeader * | additional_header, | ||
ResponseCallback | cb | ||
) |
HTTP GET async requests.
[in] | path | url path |
[in] | additional_header | additional header |
[in] | cb | callback function to receive response |
true | success |
false | failure |
NuguHttpResponse* NuguClientKit::NuguHttpRest::post | ( | const std::string & | path, |
const std::string & | body, | ||
const NuguHttpHeader * | additional_header = nullptr |
||
) |
HTTP POST requests.
[in] | path | url path |
[in] | body | body data to send |
[in] | additional_header | additional header |
bool NuguClientKit::NuguHttpRest::post | ( | const std::string & | path, |
const std::string & | body, | ||
ResponseCallback | cb | ||
) |
HTTP POST async requests.
[in] | path | url path |
[in] | body | body data to send |
[in] | cb | callback function to receive response |
true | success |
false | failure |
bool NuguClientKit::NuguHttpRest::post | ( | const std::string & | path, |
const std::string & | body, | ||
const NuguHttpHeader * | additional_header, | ||
ResponseCallback | cb | ||
) |
HTTP POST async requests.
[in] | path | url path |
[in] | body | body data to send |
[in] | additional_header | additional header |
[in] | cb | callback function to receive response |
true | success |
false | failure |
NuguHttpResponse* NuguClientKit::NuguHttpRest::put | ( | const std::string & | path, |
const std::string & | body, | ||
const NuguHttpHeader * | additional_header = nullptr |
||
) |
HTTP PUT requests.
[in] | path | url path |
[in] | body | body data to send |
[in] | additional_header | additional header |
bool NuguClientKit::NuguHttpRest::put | ( | const std::string & | path, |
const std::string & | body, | ||
ResponseCallback | cb | ||
) |
HTTP PUT async requests.
[in] | path | url path |
[in] | body | body data to send |
[in] | cb | callback function to receive response |
true | success |
false | failure |
bool NuguClientKit::NuguHttpRest::put | ( | const std::string & | path, |
const std::string & | body, | ||
const NuguHttpHeader * | additional_header, | ||
ResponseCallback | cb | ||
) |
HTTP PUT async requests.
[in] | path | url path |
[in] | body | body data to send |
[in] | additional_header | additional header |
[in] | cb | callback function to receive response |
true | success |
false | failure |
NuguHttpResponse* NuguClientKit::NuguHttpRest::del | ( | const std::string & | path, |
const NuguHttpHeader * | additional_header = nullptr |
||
) |
HTTP DELETE requests.
[in] | path | url path |
[in] | additional_header | additional header |
bool NuguClientKit::NuguHttpRest::del | ( | const std::string & | path, |
ResponseCallback | cb | ||
) |
HTTP DELETE async requests.
[in] | path | url path |
[in] | cb | callback function to receive response |
true | success |
false | failure |
bool NuguClientKit::NuguHttpRest::del | ( | const std::string & | path, |
const NuguHttpHeader * | additional_header, | ||
ResponseCallback | cb | ||
) |
HTTP DELETE async requests.
[in] | path | url path |
[in] | additional_header | additional header |
[in] | cb | callback function to receive response |
true | success |
false | failure |