A better Rust ATProto crate

docs cleanup

Changed files
+16 -33
crates
jacquard
src
identity
+16 -33
crates/jacquard/src/identity/resolver.rs
··· 249 249 250 250 /// Resolve DID document 251 251 async fn resolve_did_doc(&self, did: &Did<'_>) -> Result<DidDocResponse, IdentityError>; 252 + 253 + /// Resolve the DID document and return an owned version 252 254 async fn resolve_did_doc_owned( 253 255 &self, 254 256 did: &Did<'_>, 255 257 ) -> Result<DidDocument<'static>, IdentityError> { 256 258 self.resolve_did_doc(did).await?.into_owned() 257 259 } 260 + /// reutrn the PDS url for a DID 258 261 async fn pds_for_did(&self, did: &Did<'_>) -> Result<Url, IdentityError> { 259 262 let resp = self.resolve_did_doc(did).await?; 260 263 let doc = resp.parse()?; ··· 269 272 } 270 273 doc.pds_endpoint().ok_or(IdentityError::MissingPdsEndpoint) 271 274 } 275 + /// Return the DIS and PDS url for a handle 272 276 async fn pds_for_handle( 273 277 &self, 274 278 handle: &Handle<'_>, ··· 292 296 /// 293 297 /// Example 294 298 /// ```ignore 295 - /// use jacquard::identity::resolver::{DefaultResolver, ResolverOptions}; 296 - /// use jacquard::client::{AuthenticatedClient, XrpcClient}; 297 - /// use jacquard::types::string::Handle; 298 - /// use jacquard::CowStr; 299 + /// # use jacquard::identity::resolver::{DefaultResolver, ResolverOptions}; 300 + /// # use jacquard::client::{AuthenticatedClient, XrpcClient}; 301 + /// # use jacquard::types::string::Handle; 302 + /// # use jacquard::CowStr; 299 303 /// 300 304 /// // Build an auth-capable XRPC client (without a session it behaves like public/unauth) 301 305 /// let http = reqwest::Client::new(); 302 - /// let xrpc = AuthenticatedClient::new(http.clone(), CowStr::from("https://bsky.social")); 306 + /// let xrpc = AuthenticatedClient::new(http.clone(), CowStr::new_static("https://bsky.social")); 303 307 /// let resolver = DefaultResolver::new(http, xrpc, ResolverOptions::default()); 304 308 /// 305 309 /// // Resolve a handle to a DID ··· 314 318 } 315 319 316 320 impl<C: crate::client::XrpcClient + Send + Sync> DefaultResolver<C> { 321 + /// Create a new instance of the default resolver with all options (except DNS) up front 317 322 pub fn new(http: reqwest::Client, xrpc: C, opts: ResolverOptions) -> Self { 318 323 Self { 319 324 http, ··· 325 330 } 326 331 327 332 #[cfg(feature = "dns")] 333 + /// Add default DNS resolution to the resolver 328 334 pub fn with_system_dns(mut self) -> Self { 329 335 self.dns = Some(TokioAsyncResolver::tokio( 330 336 ResolverConfig::default(), ··· 334 340 } 335 341 336 342 /// Set PLC source (PLC directory or Slingshot) 337 - /// 338 - /// Example 339 - /// ```ignore 340 - /// use jacquard::identity::resolver::{DefaultResolver, ResolverOptions, PlcSource}; 341 - /// let http = reqwest::Client::new(); 342 - /// let xrpc = jacquard::client::AuthenticatedClient::new(http.clone(), jacquard::CowStr::from("https://public.api.bsky.app")); 343 - /// let resolver = DefaultResolver::new(http, xrpc, ResolverOptions::default()) 344 - /// .with_plc_source(PlcSource::slingshot_default()); 345 - /// ``` 346 343 pub fn with_plc_source(mut self, source: PlcSource) -> Self { 347 344 self.opts.plc_source = source; 348 345 self 349 346 } 350 347 351 348 /// Enable/disable public unauthenticated fallback for resolveHandle 352 - /// 353 - /// Example 354 - /// ```ignore 355 - /// # use jacquard::identity::resolver::{DefaultResolver, ResolverOptions}; 356 - /// # let http = reqwest::Client::new(); 357 - /// # let xrpc = jacquard::client::AuthenticatedClient::new(http.clone(), jacquard::CowStr::from("https://public.api.bsky.app")); 358 - /// let resolver = DefaultResolver::new(http, xrpc, ResolverOptions::default()) 359 - /// .with_public_fallback_for_handle(true); 360 - /// ``` 361 349 pub fn with_public_fallback_for_handle(mut self, enable: bool) -> Self { 362 350 self.opts.public_fallback_for_handle = enable; 363 351 self 364 352 } 365 353 366 354 /// Enable/disable doc id validation 367 - /// 368 - /// Example 369 - /// ```ignore 370 - /// # use jacquard::identity::resolver::{DefaultResolver, ResolverOptions}; 371 - /// # let http = reqwest::Client::new(); 372 - /// # let xrpc = jacquard::client::AuthenticatedClient::new(http.clone(), jacquard::CowStr::from("https://public.api.bsky.app")); 373 - /// let resolver = DefaultResolver::new(http, xrpc, ResolverOptions::default()) 374 - /// .with_validate_doc_id(true); 375 - /// ``` 376 355 pub fn with_validate_doc_id(mut self, enable: bool) -> Self { 377 356 self.opts.validate_doc_id = enable; 378 357 self ··· 682 661 #[derive(Debug, Clone, PartialEq, Eq)] 683 662 pub enum IdentityWarning { 684 663 /// The DID doc did not contain the expected handle alias under alsoKnownAs 685 - HandleAliasMismatch { expected: Handle<'static> }, 664 + HandleAliasMismatch { 665 + #[allow(missing_docs)] 666 + expected: Handle<'static>, 667 + }, 686 668 } 687 669 688 670 impl<C: crate::client::XrpcClient + Send + Sync> DefaultResolver<C> { ··· 772 754 /// Slingshot mini-doc data (subset of DID doc info) 773 755 #[derive(Debug, Clone, PartialEq, Eq, serde::Deserialize)] 774 756 #[serde(rename_all = "camelCase")] 757 + #[allow(missing_docs)] 775 758 pub struct MiniDoc<'a> { 776 759 #[serde(borrow)] 777 760 pub did: Did<'a>,