Generic Req-based transport helper for the Polymarket SDK.
This module is the shared HTTP layer used by Polymarket.Gamma,
Polymarket.Data, and any future read-mostly Polymarket public-API
surface in this package. User code should prefer the higher-level
modules; this is documented mainly so it is testable in isolation and
so the response contract is recorded once instead of repeated in each
consumer.
This module deliberately does not depend on polymarket_clob's HTTP
layer. The two have different host defaults and different error
semantics: polymarket_clob's HTTP.normalize/2 returns
%PolymarketClob.Error{} structs, while this SDK's wrappers return
flat tuples. Keeping the layers separate avoids leaking the lower
package's namespace into this package's user-facing types.
Response contract
Every call returns one of:
{:ok, body}— 2xx, body is the JSON-decoded response (Req's built-in:decode_bodystep handles JSON automatically when the response carriescontent-type: application/json).{:error, {:http_error, status, body}}— non-2xx HTTP response.statusis the integer status code;bodyis the upstream payload (typically a JSON map, sometimes a raw string).{:error, {:transport_error, reason}}— Req-level transport failure (DNS, TCP, TLS, connection timeout, HTTP-2 protocol error).reasonis the underlying exception or atom.
Options
:params— keyword list serialized into the query string (default[]).:plug— Req.Test plug, for tests.:timeout—receive_timeoutin milliseconds (default15_000).:retry— Req retry policy. Defaults to:transientfor GETs andfalsefor everything else, mirroringpolymarket_clob's posture.:max_retries— Req max retries (default2).:headers— extra request headers (default[]).
Summary
Functions
Issues a GET against host <> path and returns the normalized result.