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>
This commit is contained in:
1 parent
a2de8c63ce
commit
85c0377e87
3 files changed
+25
-187
No files matched your search
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "NetworkTypes.hpp"
|
||||
#include "Types.hpp"
|
||||
#include <Void/Net/Http.hpp>
|
||||
#include <future>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
@@ -10,7 +10,8 @@
|
||||
namespace Echoion::Api
|
||||
{
|
||||
|
||||
// Network client interface
|
||||
// Network client interface. Speaks Void::Net types directly — there is no
|
||||
// echoion-side HTTP/proxy mirror.
|
||||
class INetworkClient
|
||||
{
|
||||
public:
|
||||
@@ -19,38 +20,36 @@ namespace Echoion::Api
|
||||
|
||||
// Initialize with optional proxy
|
||||
virtual Result<void> initialize(
|
||||
const std::optional<ProxyConfig>& proxy = std::nullopt) = 0;
|
||||
const std::optional<Void::Net::ProxyConfig>& proxy =
|
||||
std::nullopt) = 0;
|
||||
virtual void shutdown() = 0;
|
||||
|
||||
// Synchronous requests
|
||||
[[nodiscard]] virtual Result<HttpResponse>
|
||||
[[nodiscard]] virtual Result<Void::Net::Response>
|
||||
get(std::string_view url,
|
||||
const std::vector<HttpHeader>& headers = {}) = 0;
|
||||
[[nodiscard]] virtual Result<HttpResponse>
|
||||
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<HttpHeader>& headers = {}) = 0;
|
||||
[[nodiscard]] virtual Result<HttpResponse>
|
||||
request(const HttpRequest& req) = 0;
|
||||
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<HttpResponse>>
|
||||
[[nodiscard]] virtual std::future<Result<Void::Net::Response>>
|
||||
getAsync(std::string_view url,
|
||||
const std::vector<HttpHeader>& headers = {}) = 0;
|
||||
[[nodiscard]] virtual std::future<Result<HttpResponse>>
|
||||
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<HttpHeader>& headers = {}) = 0;
|
||||
[[nodiscard]] virtual std::future<Result<HttpResponse>>
|
||||
requestAsync(const HttpRequest& req) = 0;
|
||||
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<ProxyConfig>& proxy) = 0;
|
||||
[[nodiscard]] virtual std::optional<ProxyConfig>
|
||||
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;
|
||||
|
||||
// Retry configuration
|
||||
virtual void setRetryConfig(const RetryConfig& config) = 0;
|
||||
[[nodiscard]] virtual RetryConfig getRetryConfig() const = 0;
|
||||
};
|
||||
|
||||
} // namespace Echoion::Api
|
||||
Reference in new issue
Block a user