atproto_client
Alpha, pre-release. Pre-1.0, evolving alongside at-record; expect breaking changes between 0.x releases.
A small, transport-agnostic atproto client for Gleam.
No app or lexicon knowledge: XRPC, identity resolution, OAuth discovery,
blobs, and generic repo CRUD. Dual-target (erlang + javascript); browser-only
consumers want the sibling atproto_browser instead,
which owns the atproto/browser/* namespace within the shared atproto/
prefix.
Installation
gleam add atproto_client
Usage
The client carries a send function instead of a hardcoded HTTP backend, so
you choose the transport per target:
import atproto/xrpc
import gleam/httpc
import gleam/result
import gleam/string
let client =
xrpc.Client(send: fn(req) {
httpc.send(req) |> result.map_error(string.inspect)
})
Architecture
| Module | What it does |
|---|---|
atproto/xrpc | Client, XrpcError, get/post_json, parse |
atproto/identity | resolve_pds (handle/DID -> PDS) via Slingshot resolveMiniDoc |
atproto/auth | create_session (com.atproto.server.createSession) |
atproto/repo | list_records/create_record/delete_record, generic over a row decoder |
atproto/uri | at-uri helpers (rkey) |
Development
gleam test