A better Rust ATProto crate

added setters for options and endpoint on XrpcClient both have default no-op implementations.

Orual ee0f31db 71aae4e8

Changed files
+44 -1
crates
jacquard
jacquard-common
src
jacquard-lexgen
jacquard-oauth
src
+12
crates/jacquard-common/src/xrpc.rs
··· 274 274 /// Get the base URI for the client. 275 275 fn base_uri(&self) -> impl Future<Output = Url>; 276 276 277 + /// Set the base URI for the client. 278 + fn set_base_uri(&self, url: Url) -> impl Future<Output = ()> { 279 + let _ = url; 280 + async {} 281 + } 282 + 277 283 /// Get the call options for the client. 278 284 fn opts(&self) -> impl Future<Output = CallOptions<'_>> { 279 285 async { CallOptions::default() } 286 + } 287 + 288 + /// Set the call options for the client. 289 + fn set_opts(&self, opts: CallOptions) -> impl Future<Output = ()> { 290 + let _ = opts; 291 + async {} 280 292 } 281 293 282 294 /// Send an XRPC request and parse the response
-1
crates/jacquard-lexgen/Cargo.toml
··· 26 26 [[example]] 27 27 name = "extract_inventory" 28 28 path = "../../examples/extract_inventory.rs" 29 - required-features = ["codegen"] 30 29 31 30 32 31 [dependencies]
+10
crates/jacquard-oauth/src/client.rs
··· 466 466 self.options.read().await.clone() 467 467 } 468 468 469 + async fn set_opts(&self, opts: CallOptions<'_>) { 470 + let mut guard = self.options.write().await; 471 + *guard = opts.into_static(); 472 + } 473 + 474 + async fn set_base_uri(&self, url: Url) { 475 + let mut guard = self.data.write().await; 476 + guard.host_url = url; 477 + } 478 + 469 479 async fn send<R>(&self, request: R) -> XrpcResult<XrpcResponse<R>> 470 480 where 471 481 R: XrpcRequest + Send + Sync,
+8
crates/jacquard/src/client.rs
··· 1020 1020 fn opts(&self) -> impl Future<Output = CallOptions<'_>> { 1021 1021 self.inner.opts() 1022 1022 } 1023 + 1024 + async fn set_opts(&self, opts: CallOptions<'_>) { 1025 + self.inner.set_opts(opts).await 1026 + } 1027 + 1028 + async fn set_base_uri(&self, url: url::Url) { 1029 + self.inner.set_base_uri(url).await 1030 + } 1023 1031 fn send<R>( 1024 1032 &self, 1025 1033 request: R,
+14
crates/jacquard/src/client/credential_session.rs
··· 408 408 ) 409 409 } 410 410 411 + async fn opts(&self) -> CallOptions<'_> { 412 + self.options.read().await.clone() 413 + } 414 + 415 + async fn set_opts(&self, opts: CallOptions<'_>) { 416 + let mut guard = self.options.write().await; 417 + *guard = opts.into_static(); 418 + } 419 + 420 + async fn set_base_uri(&self, url: Url) { 421 + let mut guard = self.endpoint.write().await; 422 + *guard = Some(url); 423 + } 424 + 411 425 async fn send<R>(&self, request: R) -> XrpcResult<XrpcResponse<R>> 412 426 where 413 427 R: XrpcRequest + Send + Sync,