ProtoRune. Bsky
(proto_rune v0.2.0)
Copy Markdown
High-level Bluesky API helpers.
Provides ergonomic wrappers around repository operations and XRPC calls for common Bluesky tasks.
Examples
# Post
{:ok, post} = Bsky.post(session, "Hello!")
# Like
{:ok, like} = Bsky.like(session, post_uri, post_cid)
# Follow
{:ok, follow} = Bsky.follow(session, "alice.bsky.social")
# Get profile
{:ok, profile} = Bsky.get_profile(session, "bob.bsky.social")
Summary
Functions
Blocks an actor.
Deletes a post by its AT-URI.
Follows an actor.
Gets a post thread with context.
Gets multiple posts by their AT-URIs.
Gets an actor's profile.
Gets multiple actor profiles.
Gets the authenticated user's timeline.
Gets the count of unread notifications.
Likes a post.
Lists notifications for the authenticated user.
Mutes an actor (client-side muting via XRPC).
Posts a text message to Bluesky.
Reposts a post.
Unblocks an actor by deleting the block record.
Unfollows an actor by deleting the follow record.
Unlikes a post by deleting the like record.
Unmutes an actor.
Unrepost by deleting the repost record.
Marks notifications as seen up to a given timestamp.
Types
@type session() :: map()
Functions
Blocks an actor.
Examples
{:ok, block} = Bsky.block(session, "spammer.bsky.social")
{:ok, block} = Bsky.block(session, "did:plc:xyz123")
Deletes a post by its AT-URI.
Examples
:ok = Bsky.delete_post(session, post.uri)
Follows an actor.
Examples
{:ok, follow} = Bsky.follow(session, "alice.bsky.social")
{:ok, follow} = Bsky.follow(session, "did:plc:abc123")
Gets a post thread with context.
Options
:depth- How many levels of replies to fetch (default: 6):parent_height- How many levels of parent posts to fetch (default: 80)
Examples
{:ok, thread} = Bsky.get_post_thread(session, post_uri)
Gets multiple posts by their AT-URIs.
Examples
uris = ["at://did:plc:xyz/app.bsky.feed.post/123", "at://..."]
{:ok, posts} = Bsky.get_posts(session, uris)
Gets an actor's profile.
Examples
{:ok, profile} = Bsky.get_profile(session, "alice.bsky.social")
Gets multiple actor profiles.
Examples
{:ok, profiles} = Bsky.get_profiles(session, ["alice.bsky.social", "bob.bsky.social"])
Gets the authenticated user's timeline.
Options
:limit- Number of posts (default: 50, max: 100):cursor- Pagination cursor
Examples
{:ok, %{feed: posts, cursor: cursor}} = Bsky.get_timeline(session)
{:ok, %{feed: more}} = Bsky.get_timeline(session, cursor: cursor)
Gets the count of unread notifications.
Examples
{:ok, %{count: unread}} = Bsky.get_unread_count(session)
Likes a post.
Examples
{:ok, like} = Bsky.like(session, post.uri, post.cid)
Lists notifications for the authenticated user.
Options
:limit- Number of notifications (default: 50):cursor- Pagination cursor:seen_at- Only return notifications after this timestamp
Examples
{:ok, %{notifications: notifs, cursor: cursor}} = Bsky.list_notifications(session)
Mutes an actor (client-side muting via XRPC).
Examples
{:ok, _} = Bsky.mute(session, "noisy.bsky.social")
Posts a text message to Bluesky.
Supports both plain text strings and RichText structs with facets.
Options
:langs- List of language codes (default:["en"]):reply_to- AT-URI of post to reply to:created_at- Timestamp (default: now)
Examples
# Simple text post
{:ok, post} = Bsky.post(session, "Hello Bluesky!")
# Reply to a post
{:ok, reply} = Bsky.post(session, "Great point!",
reply_to: "at://did:plc:xyz/app.bsky.feed.post/3k..."
)
# Rich text with mentions and links
alias ProtoRune.RichText
{:ok, rt} =
RichText.new()
|> RichText.text("Hello ")
|> RichText.mention("alice.bsky.social")
|> RichText.text("!")
|> RichText.build()
{:ok, post} = Bsky.post(session, rt)
Reposts a post.
Examples
{:ok, repost} = Bsky.repost(session, post.uri, post.cid)
Unblocks an actor by deleting the block record.
Examples
:ok = Bsky.unblock(session, block.uri)
Unfollows an actor by deleting the follow record.
Examples
:ok = Bsky.unfollow(session, follow.uri)
Unlikes a post by deleting the like record.
Examples
:ok = Bsky.unlike(session, like.uri)
Unmutes an actor.
Examples
{:ok, _} = Bsky.unmute(session, "noisy.bsky.social")
Unrepost by deleting the repost record.
Examples
:ok = Bsky.unrepost(session, repost.uri)
@spec update_seen(session(), DateTime.t()) :: {:ok, map()} | {:error, term()}
Marks notifications as seen up to a given timestamp.
Examples
:ok = Bsky.update_seen(session, DateTime.utc_now())