# `Tinkex.API.Session`
[🔗](https://github.com/North-Shore-AI/tinkex/blob/v0.4.0/lib/tinkex/api/session.ex#L1)

Session management endpoints.

Uses :session pool (critical, keep-alive).
Pool size: 5 connections with infinite idle time.

# `create`

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

Create a new session.

## Examples

    Tinkex.API.Session.create(
      %{model_id: "...", config: %{}},
      config: config
    )

# `create_typed`

```elixir
@spec create_typed(
  map(),
  keyword()
) :: {:ok, Tinkex.Types.CreateSessionResponse.t()} | {:error, Tinkex.Error.t()}
```

Create a new session with typed response.

Returns a properly typed CreateSessionResponse struct.

## Examples

    {:ok, response} = Tinkex.API.Session.create_typed(request, config: config)
    response.session_id  # => "session-abc-123"

# `heartbeat`

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

Send heartbeat to keep session alive.

---

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