Latch.Client (latch v0.1.0)

Copy Markdown

Authenticated XRPC for a logged in did, with transparent token refresh.

Loads the session from config, ensuring the access token is current, and delegates to Latch.XRPC. Refresh-token rotation is single-use and serialized through Store.update_session/2.

Summary

Functions

Performs an authenticated XRPC procedure for did, with automatic refresh.

Performs an authenticated XRPC query for did, with automatic refresh.

Uploads a blob for did, with automatic refresh.

Functions

procedure(config, did, method, body)

@spec procedure(Latch.Config.t(), String.t(), String.t(), map()) ::
  {:ok, map()} | {:error, Latch.Error.t()}

Performs an authenticated XRPC procedure for did, with automatic refresh.

query(config, did, method, params \\ [])

@spec query(Latch.Config.t(), String.t(), String.t(), keyword()) ::
  {:ok, map()} | {:error, Latch.Error.t()}

Performs an authenticated XRPC query for did, with automatic refresh.

upload_blob(config, did, bytes, content_type)

@spec upload_blob(Latch.Config.t(), String.t(), binary(), String.t()) ::
  {:ok, map()} | {:error, Latch.Error.t()}

Uploads a blob for did, with automatic refresh.