# `Sycophant.Transport`

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` -> `AuthenticationFailed`
  * `404` -> `ModelNotFound`
  * `429` -> `RateLimited` (with `Retry-After` parsing)
  * `400-499` -> `BadRequest`
  * `500+` -> `ServerError`

# `call`

```elixir
@spec call(
  map(),
  keyword()
) :: {:ok, map()} | {:error, Splode.Error.t()}
```

Sends a synchronous HTTP POST and returns the decoded body.

# `call_raw`

```elixir
@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.

# `stream`

```elixir
@spec stream(map(), keyword(), (Enumerable.t() -&gt; term())) ::
  {:ok, term()} | {:error, Splode.Error.t()}
```

Sends a streaming HTTP POST using SSE and yields the event stream to `on_event`.

# `stream_binary`

```elixir
@spec stream_binary(map(), keyword(), (Enumerable.t() -&gt; term())) ::
  {:ok, term()} | {:error, Splode.Error.t()}
```

Sends a streaming HTTP POST for binary event-stream protocols and yields raw chunks to `on_chunks`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
