proto-blue-api
High-level AT Protocol client -- Agent, RichText, moderation, and generated types from 322 Lexicon schemas.
Installation
[]
= "0.3"
Exports
Agent,Session,AgentError-- authenticated API clientRichText,RichTextSegment,Facet,FacetFeature,detect_facets-- rich text processingModerationDecision,ModerationOpts,check_muted_words,known_labels-- content moderationgenerated::-- types generated from AT Protocol Lexicon schemas
Identifier types (Did, Handle, AtUri, AtIdentifier, ...) live in proto_blue_syntax; CIDs live in proto_blue_lex_data. The Agent surface and generated XRPC parameters take these by reference instead of &str.
Usage
Agent
use Agent;
use AtIdentifier;
async
RichText
use ;
let mut rt = new;
rt.detect_facets;
for seg in &rt.segments
Migrating from 0.2.x
v0.3.0 replaces String/&str identifier arguments and fields with validated newtypes from proto_blue_syntax. Wire format is unchanged; callers construct typed values explicitly.
use ;
use Cid;
Common swaps:
agent.login("alice.bsky.social", pw)->agent.login(&AtIdentifier::new("alice.bsky.social")?, pw)agent.resolve_handle("alice.bsky.social")->agent.resolve_handle(&Handle::new("alice.bsky.social")?)(now returnsDid)agent.follow(&did_str, ...)->agent.follow(&Did::new(did_str)?, ...)agent.like(&uri_str, &cid_str, ...)->agent.like(&AtUri::new(uri_str)?, &Cid::new(cid_str)?, ...)agent.delete_post(&uri_str)(anddelete_like/delete_repost/delete_follow) -> pass&AtUriagent.get_post_thread(&uri_str, ...)->&AtUri;agent.get_profile(&actor_str, ...)->&AtIdentifieragent.create_account(&handle_str, pw, email, ...)->&HandleSession.did: String->Did;Session.handle: String->Handle;LabelerOpts.did: String->Did.access_jwt,refresh_jwt, andemailremainString.Agent::did() -> Option<Did>(wasOption<String>).
resume_session and resolve_handle now validate server-returned DIDs through Did::new; a malformed DID surfaces as AgentError::Other(...) instead of being stored verbatim.
Generated XRPC method parameters whose lexicons declare a format-typed string (did, handle, at-uri, cid, nsid, ...) now expose the corresponding newtype on the request struct.
License
Licensed under MIT OR Apache-2.0.
Part of the proto-blue AT Protocol SDK for Rust.