Migrate to VoidLibrary (toolchain + API groundwork)
This commit is contained in:
1 parent
5e1e3d66c4
commit
e17cfed56f
38 files changed
+3077
-2505
No files matched your search
@@ -0,0 +1,56 @@
|
||||
#pragma once
|
||||
|
||||
#include "NetworkTypes.hpp"
|
||||
#include "Types.hpp"
|
||||
#include <future>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace Echoion::Api
|
||||
{
|
||||
|
||||
// Network client interface
|
||||
class INetworkClient
|
||||
{
|
||||
public:
|
||||
|
||||
virtual ~INetworkClient() = default;
|
||||
|
||||
// Initialize with optional proxy
|
||||
virtual Result<void> initialize(
|
||||
const std::optional<ProxyConfig>& proxy = std::nullopt) = 0;
|
||||
virtual void shutdown() = 0;
|
||||
|
||||
// Synchronous requests
|
||||
[[nodiscard]] virtual Result<HttpResponse>
|
||||
get(std::string_view url,
|
||||
const std::vector<HttpHeader>& headers = {}) = 0;
|
||||
[[nodiscard]] virtual Result<HttpResponse>
|
||||
post(std::string_view url, std::string_view body,
|
||||
const std::vector<HttpHeader>& headers = {}) = 0;
|
||||
[[nodiscard]] virtual Result<HttpResponse>
|
||||
request(const HttpRequest& req) = 0;
|
||||
|
||||
// Asynchronous requests
|
||||
[[nodiscard]] virtual std::future<Result<HttpResponse>>
|
||||
getAsync(std::string_view url,
|
||||
const std::vector<HttpHeader>& headers = {}) = 0;
|
||||
[[nodiscard]] virtual std::future<Result<HttpResponse>>
|
||||
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;
|
||||
|
||||
// Proxy configuration
|
||||
virtual void setProxy(const std::optional<ProxyConfig>& proxy) = 0;
|
||||
[[nodiscard]] virtual std::optional<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