ProtoRune. Atproto. Repo
(proto_rune v0.5.2)
Copy Markdown
Low-level com.atproto.repo operations.
Create, read, update, delete, and list records in a repository.
Write operations require an authenticated ProtoRune.Atproto.Session;
read operations (get_record, list_records) accept an optional session.
For common Bluesky actions (posting, liking, reposting) prefer the
high-level ProtoRune API, which wraps these calls with the right
collections and record schemas.
Summary
Functions
Create a single new repository record. Requires auth, implemented by PDS.
Delete a repository record, or ensure it doesn't exist. Requires auth, implemented by PDS.
Get a single record from a repository. Does not require auth.
List a range of records in a repository, matching a specific collection. Does not require auth.
Write a repository record, creating or updating it as needed. Requires auth, implemented by PDS.
Upload a blob of binary data to be stored with the account, for later reference in repository records (for example, a profile avatar). Requires auth, implemented by PDS.
Functions
Create a single new repository record. Requires auth, implemented by PDS.
The :collection param accepts any collection NSID:
- As an atom (
:post,:like,:repost), it must be one of the built-in Bluesky collections: it is encoded as"app.bsky.feed.<name>"and the record is validated against the built-in schema. Any other atom fails with{:error, {:unsupported_collection, collection}}. - As a string, the NSID passes through as-is, so custom-lexicon
collections work out of the box. The known Bluesky NSIDs
(
"app.bsky.feed.post","app.bsky.feed.like","app.bsky.feed.repost") are still validated against the built-in schemas; records for any other collection are sent unvalidated.
Options
:schema- a Peri schema used to validate the record before sending, for any collection. Overrides the built-in validation when both apply. Schema modules generated bymix proto_rune.gen.lexiconscan be passed here directly.
https://docs.bsky.app/docs/api/com-atproto-repo-create-record
Delete a repository record, or ensure it doesn't exist. Requires auth, implemented by PDS.
https://docs.bsky.app/docs/api/com-atproto-repo-delete-record
Get a single record from a repository. Does not require auth.
List a range of records in a repository, matching a specific collection. Does not require auth.
https://docs.bsky.app/docs/api/com-atproto-repo-list-records
Write a repository record, creating or updating it as needed. Requires auth, implemented by PDS.
The :collection param follows the same rules as create_record/3: atoms
are restricted to the built-in Bluesky collections, while any NSID string
passes through as-is. Records for unknown string collections are sent
unvalidated unless the :schema option is given.
Options
:schema- a Peri schema used to validate the record before sending, for any collection. Overrides the built-in validation when both apply.
@spec upload_blob(ProtoRune.Session.t(), binary(), String.t()) :: {:ok, map()} | {:error, term()}
Upload a blob of binary data to be stored with the account, for later reference in repository records (for example, a profile avatar). Requires auth, implemented by PDS.
Returns {:ok, %{blob: blob}} where blob is a blob reference map
suitable for embedding in a record.
https://docs.bsky.app/docs/api/com-atproto-repo-upload-blob
Examples
{:ok, %{blob: blob}} = Repo.upload_blob(session, image_data, "image/png")