#pragma once #include "NetworkTypes.hpp" #include "Types.hpp" #include #include #include #include namespace Echoion::Api { // Network client interface class INetworkClient { public: virtual ~INetworkClient() = default; // Initialize with optional proxy virtual Result initialize( const std::optional& proxy = std::nullopt) = 0; virtual void shutdown() = 0; // Synchronous requests [[nodiscard]] virtual Result get(std::string_view url, const std::vector& headers = {}) = 0; [[nodiscard]] virtual Result post(std::string_view url, std::string_view body, const std::vector& headers = {}) = 0; [[nodiscard]] virtual Result request(const HttpRequest& req) = 0; // Asynchronous requests [[nodiscard]] virtual std::future> getAsync(std::string_view url, const std::vector& headers = {}) = 0; [[nodiscard]] virtual std::future> postAsync(std::string_view url, std::string_view body, const std::vector& headers = {}) = 0; [[nodiscard]] virtual std::future> requestAsync(const HttpRequest& req) = 0; // Proxy configuration virtual void setProxy(const std::optional& proxy) = 0; [[nodiscard]] virtual std::optional getProxy() const = 0; virtual void clearProxy() = 0; // Retry configuration virtual void setRetryConfig(const RetryConfig& config) = 0; [[nodiscard]] virtual RetryConfig getRetryConfig() const = 0; }; } // namespace Echoion::Api