A better Rust ATProto crate
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 63 lines 1.8 kB view raw
1use clap::Parser; 2use jacquard::api::sh_tangled::repo::Repo; 3use jacquard::client::{AgentSessionExt, BasicClient}; 4use jacquard::types::string::AtUri; 5use jacquard_api::sh_tangled::repo::RepoRecord; 6 7#[derive(Parser, Debug)] 8#[command(author, version, about = "Read a Tangled git repository record")] 9struct Args { 10 /// at:// URI of the repo record 11 /// Example: at://did:plc:xyz/sh.tangled.repo/3lzabc123 12 /// The default is the jacquard repository 13 #[arg(default_value = "at://did:plc:yfvwmnlztr4dwkb7hwz55r2g/sh.tangled.repo/3lzrya6fcwv22")] 14 uri: String, 15} 16 17#[tokio::main] 18async fn main() -> miette::Result<()> { 19 let args = Args::parse(); 20 21 // Parse the at:// URI 22 let uri = AtUri::new(&args.uri)?; 23 24 // Create an unauthenticated agent for public record access 25 let agent = BasicClient::unauthenticated(); 26 27 // Use Agent's get_record helper with the at:// URI 28 let output = agent.fetch_record(RepoRecord, uri).await?; 29 30 println!("Tangled Repository\n"); 31 println!("URI: {}", output.uri); 32 println!("Name: {}", output.value.name); 33 34 if let Some(desc) = &output.value.description { 35 println!("Description: {}", desc); 36 } 37 38 println!("Knot: {}", output.value.knot); 39 println!("Created: {}", output.value.created_at); 40 41 if let Some(source) = &output.value.source { 42 println!("Source: {}", source.as_str()); 43 } 44 45 if let Some(spindle) = &output.value.spindle { 46 println!("CI Spindle: {}", spindle); 47 } 48 49 if let Some(labels) = &output.value.labels { 50 if !labels.is_empty() { 51 println!( 52 "Labels available: {}", 53 labels 54 .iter() 55 .map(|l| l.to_string()) 56 .collect::<Vec<_>>() 57 .join(", ") 58 ); 59 } 60 } 61 62 Ok(()) 63}