Current section
Files
Jump to
Current section
Files
atproto_client
README.md
README.md
# atproto_client
> **Alpha, pre-release.** Pre-1.0, evolving alongside
> [at-record](https://tangled.org/@niels.atproto.fan/at-record); expect breaking
> changes between 0.x releases.
A small, transport-agnostic [atproto](https://atproto.com/) 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`](https://hex.pm/packages/atproto_browser) instead,
which owns the `atproto/browser/*` namespace within the shared `atproto/`
prefix.
## Installation
```sh
gleam add atproto_client
```
## Usage
The client carries a `send` function instead of a hardcoded HTTP backend, so
you choose the transport per target:
```gleam
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
```sh
gleam test
```