A better Rust ATProto crate

docs cleanup

+2 -53
-7
crates/jacquard/src/moderation/decision.rs
··· 11 11 /// Takes the content, user preferences, labeler definitions, and list of accepted labelers, 12 12 /// and produces a moderation decision indicating what actions to take. 13 13 /// 14 - /// # Arguments 15 - /// 16 - /// * `item` - The content to moderate 17 - /// * `prefs` - User's moderation preferences 18 - /// * `defs` - Labeler definitions describing what labels mean 19 - /// * `accepted_labelers` - Which labelers to trust (usually from CallOptions) 20 - /// 21 14 /// # Example 22 15 /// 23 16 /// ```ignore
+1 -45
crates/jacquard/src/moderation/fetch.rs
··· 7 7 use jacquard_common::types::string::Did; 8 8 use jacquard_common::xrpc::{XrpcClient, XrpcError}; 9 9 10 - /// Fetch labeler definitions from app.bsky.labeler.getServices 11 - /// 12 - /// This is a convenience helper for fetching labeler service records from Bluesky's 13 - /// labeler service. You can also fetch these from other indexes or sources and 14 - /// construct a `LabelerDefs` manually. 15 - /// 16 - /// # Arguments 17 - /// 18 - /// * `client` - Any XRPC client (Agent, stateless client, etc.) 19 - /// * `dids` - List of labeler DIDs to fetch definitions for 20 - /// 21 - /// # Example 22 - /// 23 - /// ```no_run 24 - /// # use jacquard::moderation::fetch_labeler_defs; 25 - /// # use jacquard::client::BasicClient; 26 - /// # use jacquard_common::types::string::Did; 27 - /// # #[tokio::main] 28 - /// # async fn main() -> Result<(), Box<dyn std::error::Error>> { 29 - /// let client = BasicClient::unauthenticated(); 30 - /// let labeler_did = Did::new_static("did:plc:ar7c4by46qjdydhdevvrndac").unwrap(); 31 - /// let defs = fetch_labeler_defs(&client, vec![labeler_did]).await?; 32 - /// # Ok(()) 33 - /// # } 34 - /// ``` 10 + /// Fetch labeler definitions from Bluesky's AppView (or a compatible one) 35 11 pub async fn fetch_labeler_defs( 36 12 client: &(impl XrpcClient + Sync), 37 13 dids: Vec<Did<'_>>, ··· 85 61 /// This fetches the `app.bsky.labeler.service` record directly from the PDS where 86 62 /// the labeler is hosted. 87 63 /// 88 - /// # Arguments 89 - /// 90 - /// * `client` - Any XRPC client with fetch_record support (Agent, etc.) 91 - /// * `dids` - List of labeler DIDs to fetch definitions for 92 - /// 93 - /// # Example 94 - /// 95 - /// ```no_run 96 - /// # use jacquard::moderation::fetch_labeler_defs_direct; 97 - /// # use jacquard::client::BasicClient; 98 - /// # use jacquard::prelude::*; 99 - /// # use jacquard_common::types::string::Did; 100 - /// # #[tokio::main] 101 - /// # async fn main() -> Result<(), Box<dyn std::error::Error>> { 102 - /// # let client = BasicClient::unauthenticated(); 103 - /// let labeler_did = Did::new_static("did:plc:ar7c4by46qjdydhdevvrndac").unwrap(); 104 - /// let defs = fetch_labeler_defs_direct(&client, vec![labeler_did]).await?; 105 - /// # Ok(()) 106 - /// # } 107 - /// ``` 108 64 pub async fn fetch_labeler_defs_direct( 109 65 client: &(impl AgentSessionExt + Sync), 110 66 dids: Vec<Did<'_>>,
+1 -1
crates/jacquard/src/moderation/tests.rs
··· 707 707 // Use the Moderateable trait with empty accepted_labelers to trust all labels 708 708 let decisions = labeled_post.moderate_all(&prefs, &defs, &[]); 709 709 710 - println!("Moderateable decisions for labeled post:"); 710 + println!("Moderation decisions for labeled post:"); 711 711 for (tag, decision) in &decisions { 712 712 if !decision.causes.is_empty() { 713 713 println!(