Sycophant.Transport
(sycophant v0.4.2)
Copy Markdown
HTTP transport layer built on Tesla.
Constructs a fresh Tesla client per request and executes HTTP POSTs,
mapping HTTP status codes to Splode error structs. Auth middleware is
injected by the caller via :auth_middlewares, keeping Transport
agnostic about authentication schemes.
Error Mapping
401->AuthenticationFailed404->ModelNotFound429->RateLimited(withRetry-Afterparsing)400-499->BadRequest500+->ServerError
Summary
Functions
Sends a synchronous HTTP POST and returns the decoded body.
Sends a synchronous HTTP POST and returns the decoded body along with response headers.
Sends a streaming HTTP POST using SSE and yields the event stream to on_event.
Sends a streaming HTTP POST for binary event-stream protocols and yields raw chunks to on_chunks.
Functions
@spec call( map(), keyword() ) :: {:ok, map()} | {:error, Splode.Error.t()}
Sends a synchronous HTTP POST and returns the decoded body.
@spec call_raw( map(), keyword() ) :: {:ok, {map(), [{String.t(), String.t()}]}} | {:error, Splode.Error.t()}
Sends a synchronous HTTP POST and returns the decoded body along with response headers.
@spec stream(map(), keyword(), (Enumerable.t() -> term())) :: {:ok, term()} | {:error, Splode.Error.t()}
Sends a streaming HTTP POST using SSE and yields the event stream to on_event.
@spec stream_binary(map(), keyword(), (Enumerable.t() -> term())) :: {:ok, term()} | {:error, Splode.Error.t()}
Sends a streaming HTTP POST for binary event-stream protocols and yields raw chunks to on_chunks.