Tinkex.API.Session (Tinkex v0.3.4)

View Source

Session management endpoints.

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

Summary

Functions

Create a new session.

Create a new session with typed response.

Send heartbeat to keep session alive.

Functions

create(request, opts)

@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(request, opts)

@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(request, opts)

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

Send heartbeat to keep session alive.