Something went wrong. Try again.
atproto made easy crates.io/crates/jacquard
atproto rust
Something went wrong. Try again.
Rust
1234567891011121314151617181920212223242526272829303132333435363738394041use clap::Parser;use jacquard::CowStr;use jacquard::api::app_bsky::feed::post::Post;use jacquard::client::{Agent, AgentSessionExt, MemoryCredentialSession};use jacquard::types::string::Datetime;
#[derive(Parser, Debug)]#[command(author, version, about = "Create a simple post")]struct Args { /// Handle (e.g., alice.bsky.social) or DID input: CowStr<'static>,
/// App Password password: CowStr<'static>,
/// Post text #[arg(short, long)] text: String,}
#[tokio::main]async fn main() -> miette::Result<()> { let args = Args::parse();
let (session, auth) = MemoryCredentialSession::authenticated(args.input, args.password, None, None).await?; println!("Signed in as {}", auth.handle);
let agent: Agent<_> = Agent::from(session);
// Create a simple text post using the Agent convenience method let post = Post::new() .text(args.text) .created_at(Datetime::now()) .build(); let output = agent.create_record(post, None).await?; println!("✓ Created post: {}", output.uri);
Ok(())}