Class WinHttpRESTClient¶
Header: <siddiqsoft/restcl.hpp> or <siddiqsoft/private/restcl_win.hpp>
Namespace: siddiqsoft
Inherits: basic_restclient<char>
Platform: Windows (uses WinHTTP API)
Class Signature¶
class WinHttpRESTClient : public basic_restclient<char>
{
public:
WinHttpRESTClient() = default;
WinHttpRESTClient(const nlohmann::json& cfg, basic_callbacktype&& cb = {});
static std::shared_ptr<WinHttpRESTClient> CreateInstance(
const nlohmann::json& cfg = {},
basic_callbacktype&& cb = {}
);
basic_restclient& configure(
const nlohmann::json& cfg = {},
basic_callbacktype&& cb = {}
) override;
[[nodiscard]] std::expected<rest_response<char>, int> send(
rest_request<char>& req
) override;
basic_restclient& sendAsync(
rest_request<char>&& req,
basic_callbacktype&& cb = {}
) override;
};
Member Functions¶
CreateInstance¶
static std::shared_ptr<WinHttpRESTClient> CreateInstance(
const nlohmann::json& cfg = {},
basic_callbacktype&& cb = {}
);
WinHttpRESTClient instance configured with cfg.
configure¶
Updates client configuration settings and optional default callback.
send (Synchronous)¶
Performs a synchronous HTTP request and returns an std::expected containing the rest_response or an error code integer.
sendAsync (Asynchronous)¶
Dispatches the request asynchronously using background thread pools. Executes cb (or the default callback) upon completion.