SolarEnergy/esp32_device/main/http_client.h

47 lines
804 B
C
Raw Permalink Normal View History

/**
* HTTP client
*/
#pragma once
#include <stddef.h>
#ifdef __cplusplus
extern "C"
{
#endif
2024-08-23 21:06:14 +00:00
enum method
{
MethodGET = 0,
MethodPOST
};
typedef struct
{
2024-08-23 19:00:18 +00:00
const char *url;
2024-08-18 18:13:03 +00:00
char *root_ca;
2024-08-23 21:06:14 +00:00
const char *body;
const char *content_type;
enum method method;
} http_request_opts;
/**
* Perform an HTTP request.
*
* Returns NULL in case of failure or the response else. The memory
* must be released by the caller.
*/
char *http_client_exec(const http_request_opts *opts);
2024-08-23 21:06:14 +00:00
/**
* Escape URI string
*
* See protocol_example_utils.c of esp32-idf
*/
size_t http_client_escape_uri(unsigned char *dst, const unsigned char *src, size_t size);
#ifdef __cplusplus
}
#endif