17 #ifndef __NUGU_HTTP_H__
18 #define __NUGU_HTTP_H__
62 NUGU_HTTP_REQUEST_GET,
63 NUGU_HTTP_REQUEST_POST,
64 NUGU_HTTP_REQUEST_PUT,
65 NUGU_HTTP_REQUEST_DELETE,
94 long long downloaded,
long long total,
239 const void *body,
size_t body_len);
283 const void *body,
size_t body_len,
316 const void *body,
size_t body_len,
334 const void *body,
size_t body_len);
struct _nugu_http_header NuguHttpHeader
HTTP Header object.
Definition: nugu_http.h:46
NUGU_API NuguHttpRequest * nugu_http_get_sync(NuguHttpHost *host, const char *path, NuguHttpHeader *header)
A convenient API for HTTP GET sync requests.
NuguHttpRequestType
HTTP request types.
Definition: nugu_http.h:61
NUGU_API NuguHttpHeader * nugu_http_header_dup(const NuguHttpHeader *src_header)
Duplicate the http header object.
NUGU_API NuguHttpRequest * nugu_http_get(NuguHttpHost *host, const char *path, NuguHttpHeader *header, NuguHttpCallback callback, void *user_data)
A convenient API for HTTP GET async requests.
NUGU_API int nugu_http_header_add(NuguHttpHeader *header, const char *key, const char *value)
Add a key-value string to header object.
NUGU_API const char * nugu_http_header_find(NuguHttpHeader *header, const char *key)
Find value from header object.
NUGU_API NuguHttpHeader * nugu_http_header_new(void)
Create a new HTTP header object.
NUGU_API NuguHttpRequest * nugu_http_delete_sync(NuguHttpHost *host, const char *path, NuguHttpHeader *header)
A convenient API for HTTP DELETE sync requests.
NUGU_API int nugu_http_header_remove(NuguHttpHeader *header, const char *key)
Remove a key-value string from header object.
NUGU_API NuguHttpRequest * nugu_http_put(NuguHttpHost *host, const char *path, NuguHttpHeader *header, const void *body, size_t body_len, NuguHttpCallback callback, void *user_data)
A convenient API for HTTP PUT async requests.
NUGU_API NuguHttpRequest * nugu_http_request_sync(enum NuguHttpRequestType type, NuguHttpHost *host, const char *path, NuguHttpHeader *header, const void *body, size_t body_len)
HTTP sync request.
NUGU_API void nugu_http_request_free(NuguHttpRequest *req)
Destroy the HTTP request object.
NUGU_API void nugu_http_header_free(NuguHttpHeader *header)
Destroy the header object.
NUGU_API NuguHttpRequest * nugu_http_download(NuguHttpHost *host, const char *path, const char *dest_path, NuguHttpHeader *header, NuguHttpCallback callback, NuguHttpProgressCallback progress_callback, void *user_data)
A convenient API for HTTP file download async requests.
NUGU_API NuguHttpResponse * nugu_http_response_dup(const NuguHttpResponse *orig)
Duplicate the HTTP response object.
int(* NuguHttpProgressCallback)(NuguHttpRequest *req, const NuguHttpResponse *resp, long long downloaded, long long total, void *user_data)
Callback prototype for HTTP download progress.
Definition: nugu_http.h:92
NUGU_API NuguHttpRequest * nugu_http_post_sync(NuguHttpHost *host, const char *path, NuguHttpHeader *header, const void *body, size_t body_len)
A convenient API for HTTP POST sync requests.
NUGU_API void nugu_http_response_free(NuguHttpResponse *resp)
Destroy the HTTP response object.
struct _nugu_http_request NuguHttpRequest
HTTP Request object.
Definition: nugu_http.h:51
NUGU_API void nugu_http_host_free(NuguHttpHost *host)
Destroy the host object.
NUGU_API NuguHttpHost * nugu_http_host_new(const char *url)
Create a new HTTP host object.
NUGU_API NuguHttpRequest * nugu_http_put_sync(NuguHttpHost *host, const char *path, NuguHttpHeader *header, const void *body, size_t body_len)
A convenient API for HTTP PUT sync requests.
NUGU_API void nugu_http_host_set_timeout(NuguHttpHost *host, long msecs)
Set timeout to host.
NUGU_API void nugu_http_host_set_connection_timeout(NuguHttpHost *host, long msecs)
Set connection timeout to host.
int(* NuguHttpCallback)(NuguHttpRequest *req, const NuguHttpResponse *resp, void *user_data)
Callback prototype for receiving async HTTP response.
Definition: nugu_http.h:86
NUGU_API NuguHttpRequest * nugu_http_delete(NuguHttpHost *host, const char *path, NuguHttpHeader *header, NuguHttpCallback callback, void *user_data)
A convenient API for HTTP DELETE async requests.
struct _nugu_http_host NuguHttpHost
HTTP Host object.
Definition: nugu_http.h:41
NUGU_API void nugu_http_init(void)
Initialize HTTP module (curl_global_init)
NUGU_API const NuguHttpResponse * nugu_http_request_response_get(NuguHttpRequest *req)
Get the HTTP response from request object.
NUGU_API NuguHttpRequest * nugu_http_request(enum NuguHttpRequestType type, NuguHttpHost *host, const char *path, NuguHttpHeader *header, const void *body, size_t body_len, NuguHttpCallback callback, void *user_data)
HTTP async request.
NUGU_API int nugu_http_header_import(NuguHttpHeader *header, const NuguHttpHeader *from)
Import header data from other header object.
NUGU_API NuguHttpRequest * nugu_http_post(NuguHttpHost *host, const char *path, NuguHttpHeader *header, const void *body, size_t body_len, NuguHttpCallback callback, void *user_data)
A convenient API for HTTP POST async requests.
NUGU_API const char * nugu_http_host_peek_url(NuguHttpHost *host)
Get url from HTTP host object.
HTTP Response object.
Definition: nugu_http.h:72