39 std::vector<std::pair<std::string, std::string>>
headers;
42 [[nodiscard]] std::optional<std::string_view>
header(std::string_view name)
const noexcept;
49 std::chrono::milliseconds
timeout{std::chrono::seconds{30}};
68 std::string_view body = {})
const = 0;
74 std::string_view body = {})
const {
78 std::string_view body = {})
const {
82 std::string_view body = {})
const {
110 std::string_view body = {})
const override;
116 std::unique_ptr<Impl> impl_;
libcurl transport.
Definition http_client.hpp:93
Result< HttpResponse > del(std::string_view path, std::string_view body={}) const
Definition http_client.hpp:81
Result< HttpResponse > request(HttpMethod method, std::string_view path, std::string_view body={}) const override
path is relative to the base URL and may carry a query string.
Result< HttpResponse > put(std::string_view path, std::string_view body={}) const
Definition http_client.hpp:77
Result< HttpResponse > post(std::string_view path, std::string_view body={}) const
Definition http_client.hpp:73
HttpClient(Signer signer, ClientConfig config={})
HttpClient(ClientConfig config={})
Result< HttpResponse > get(std::string_view path) const
Definition http_client.hpp:70
HttpClient(HttpClient &&) noexcept
const ClientConfig & config() const noexcept
Request boundary used by KalshiClient.
Definition http_client.hpp:62
Result< HttpResponse > del(std::string_view path, std::string_view body={}) const
Definition http_client.hpp:81
Result< HttpResponse > put(std::string_view path, std::string_view body={}) const
Definition http_client.hpp:77
virtual Result< HttpResponse > request(HttpMethod method, std::string_view path, std::string_view body={}) const =0
path is relative to the base URL and may carry a query string.
virtual ~HttpTransport()=default
Result< HttpResponse > post(std::string_view path, std::string_view body={}) const
Definition http_client.hpp:73
Result< HttpResponse > get(std::string_view path) const
Definition http_client.hpp:70
Signs Kalshi requests with an API key.
Definition signer.hpp:32
constexpr std::string_view to_string(HttpMethod method) noexcept
Definition http_client.hpp:22
Environment
Kalshi deployment.
Definition environment.hpp:10
constexpr std::string_view rest_base_url(Environment environment) noexcept
REST base URL, including the /trade-api/v2 prefix that requests sign.
Definition environment.hpp:13
std::expected< T, Error > Result
Result type for SDK operations.
Definition error.hpp:50
HttpMethod
HTTP methods.
Definition http_client.hpp:20
Definition http_client.hpp:45
std::chrono::milliseconds timeout
Limit for the whole request, including the response body.
Definition http_client.hpp:49
std::chrono::milliseconds connect_timeout
Definition http_client.hpp:50
static ClientConfig for_environment(Environment environment)
Definition http_client.hpp:53
std::string base_url
Base URL including /trade-api/v2. See rest_base_url().
Definition http_client.hpp:47
bool verify_ssl
Definition http_client.hpp:51
Definition http_client.hpp:36
std::string body
Definition http_client.hpp:38
int status_code
Definition http_client.hpp:37
std::optional< std::string_view > header(std::string_view name) const noexcept
Case-insensitive header lookup. Returns the first match.
std::vector< std::pair< std::string, std::string > > headers
Definition http_client.hpp:39