FastLED 3.9.15
|
Unified HTTP fetch API for FastLED (cross-platform)
This API provides both simple callback-based and JavaScript-like promise-based interfaces for HTTP requests. Works on WASM/browser platforms with real fetch, provides stubs on embedded.
WASM Optimization: On WASM platforms, delay()
automatically pumps all async tasks (fetch, timers, etc.) in 1ms intervals, making delay time useful for processing async operations.
Definition in file fetch.h.
#include "fl/namespace.h"
#include "fl/promise.h"
#include "fl/string.h"
#include "fl/vector.h"
#include "fl/map.h"
#include "fl/hash_map.h"
#include "fl/optional.h"
#include "fl/function.h"
#include "fl/ptr.h"
#include "fl/async.h"
#include "fl/mutex.h"
#include "fl/warn.h"
#include "fl/json.h"
Go to the source code of this file.
Classes | |
class | fl::fetch_options |
Fetch options builder (fluent interface) More... | |
class | fl::FetchManager |
Internal fetch manager for promise tracking. More... | |
struct | fl::RequestOptions |
Request options (matches JavaScript fetch RequestInit) More... | |
class | fl::response |
HTTP response class (unified interface) More... | |
Namespaces | |
namespace | fl |
IMPORTANT! | |
Typedefs | |
using | fl::FetchCallback = fl::function<void(const response&)> |
Callback type for simple fetch responses (backward compatible) | |
Functions | |
fl::promise< response > | fl::execute_fetch_request (const fl::string &url, const fetch_options &request) |
Internal helper to execute a fetch request and return a promise. | |
void | fl::fetch (const char *url, const FetchCallback &callback) |
Make an HTTP GET request with URL string literal (cross-platform) | |
void | fl::fetch (const fl::string &url, const FetchCallback &callback) |
Make an HTTP GET request (cross-platform, backward compatible) | |
fl::size | fl::fetch_active_requests () |
Get number of active requests. | |
fl::promise< response > | fl::fetch_delete (const fl::string &url, const fetch_options &request=fetch_options("")) |
HTTP DELETE request. | |
fl::promise< response > | fl::fetch_get (const fl::string &url, const fetch_options &request=fetch_options("")) |
HTTP GET request. | |
fl::promise< response > | fl::fetch_head (const fl::string &url, const fetch_options &request=fetch_options("")) |
HTTP HEAD request. | |
fl::promise< response > | fl::fetch_http_options (const fl::string &url, const fetch_options &request=fetch_options("")) |
HTTP OPTIONS request. | |
fl::promise< response > | fl::fetch_patch (const fl::string &url, const fetch_options &request=fetch_options("")) |
HTTP PATCH request. | |
fl::promise< response > | fl::fetch_post (const fl::string &url, const fetch_options &request=fetch_options("")) |
HTTP POST request. | |
fl::promise< response > | fl::fetch_put (const fl::string &url, const fetch_options &request=fetch_options("")) |
HTTP PUT request. | |
fl::promise< response > | fl::fetch_request (const fl::string &url, const RequestOptions &options=RequestOptions()) |
Generic request with options (like fetch(url, options)) | |
void | fl::fetch_update () |
Legacy manual update for fetch promises (use fl::async_run() for new code) | |