1use clap::Parser;
2use jacquard::api::com_whtwnd::blog::entry::Entry;
3use jacquard::client::{AgentSessionExt, BasicClient};
4use jacquard::types::string::AtUri;
5
6#[derive(Parser, Debug)]
7#[command(author, version, about = "Read a WhiteWind blog post")]
8struct Args {
9 /// at:// URI of the blog entry
10 /// Example: at://did:plc:xyz/com.whtwnd.blog.entry/3l5abc123
11 uri: String,
12}
13
14#[tokio::main]
15async fn main() -> miette::Result<()> {
16 let args = Args::parse();
17
18 // Parse the at:// URI
19 let uri = AtUri::new(&args.uri)?;
20
21 // Create an unauthenticated agent for public record access
22 let agent = BasicClient::unauthenticated();
23
24 // Use Agent's get_record helper with the at:// URI
25 let response = agent.get_record::<Entry>(uri).await?;
26 let output = response.into_output()?;
27
28 println!("📚 WhiteWind Blog Entry\n");
29 println!("URI: {}", output.uri);
30 println!(
31 "Title: {}",
32 output.value.title.as_deref().unwrap_or("[Untitled]")
33 );
34 if let Some(subtitle) = &output.value.subtitle {
35 println!("Subtitle: {}", subtitle);
36 }
37 if let Some(created) = &output.value.created_at {
38 println!("Created: {}", created);
39 }
40 println!("\n{}", output.value.content);
41
42 Ok(())
43}