#ifndef LLMR_PLATFORM_REQUEST #define LLMR_PLATFORM_REQUEST #include #include #include #include #include // Forward definition. typedef struct uv_loop_s uv_loop_t; typedef struct uv_async_s uv_async_t; namespace llmr { namespace platform { struct Response; class Request : public std::enable_shared_from_this, private util::noncopyable { public: Request(const std::string &url, std::function callback, uv_loop_t *loop); ~Request(); void complete(); private: static void complete(uv_async_t *async); public: const std::string url; std::unique_ptr res; std::atomic cancelled; public: uv_async_t *async = nullptr; uv_loop_t *loop = nullptr; }; } } #endif