Files
EchoionApi/include/echoion/api/network/NetworkInterface.hpp
T
faumarayandClaude Opus 4.8 85c0377e87 Drop HTTP/proxy mirror types; speak Void::Net directly
Delete Api::HttpMethod/Header/Request/Response/ProxyConfig/ProxyType +
RetryConfig — they duplicated Void::Net::* and Void::Retry. INetworkClient
now takes/returns Void::Net::Request/Response/Header/ProxyConfig (retry
tuning drops off the public interface; it was unused and lives inside the
client now). NetworkConfig.proxy becomes Void::Net::ProxyConfig, and
NetworkTypes.hpp is a thin forwarder to <Void/Net/Http.hpp>.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-23 13:49:26 +03:00

56 lines
1.7 KiB
C++

#pragma once
#include "Types.hpp"
#include <Void/Net/Http.hpp>
#include <future>
#include <optional>
#include <string>
#include <vector>
namespace Echoion::Api
{
// Network client interface. Speaks Void::Net types directly — there is no
// echoion-side HTTP/proxy mirror.
class INetworkClient
{
public:
virtual ~INetworkClient() = default;
// Initialize with optional proxy
virtual Result<void> initialize(
const std::optional<Void::Net::ProxyConfig>& proxy =
std::nullopt) = 0;
virtual void shutdown() = 0;
// Synchronous requests
[[nodiscard]] virtual Result<Void::Net::Response>
get(std::string_view url,
const std::vector<Void::Net::Header>& headers = {}) = 0;
[[nodiscard]] virtual Result<Void::Net::Response>
post(std::string_view url, std::string_view body,
const std::vector<Void::Net::Header>& headers = {}) = 0;
[[nodiscard]] virtual Result<Void::Net::Response>
request(const Void::Net::Request& req) = 0;
// Asynchronous requests
[[nodiscard]] virtual std::future<Result<Void::Net::Response>>
getAsync(std::string_view url,
const std::vector<Void::Net::Header>& headers = {}) = 0;
[[nodiscard]] virtual std::future<Result<Void::Net::Response>>
postAsync(std::string_view url, std::string_view body,
const std::vector<Void::Net::Header>& headers = {}) = 0;
[[nodiscard]] virtual std::future<Result<Void::Net::Response>>
requestAsync(const Void::Net::Request& req) = 0;
// Proxy configuration
virtual void
setProxy(const std::optional<Void::Net::ProxyConfig>& proxy) = 0;
[[nodiscard]] virtual std::optional<Void::Net::ProxyConfig>
getProxy() const = 0;
virtual void clearProxy() = 0;
};
} // namespace Echoion::Api