diff --git a/crates/jacquard-common/tests/streaming_integration.rs b/crates/jacquard-common/tests/streaming_integration.rs index 8500cc91..2de8b560 100644 --- a/crates/jacquard-common/tests/streaming_integration.rs +++ b/crates/jacquard-common/tests/streaming_integration.rs @@ -1,9 +1,12 @@ -#![cfg(all(feature = "streaming", feature = "reqwest-client", not(target_arch = "wasm32")))] +#![cfg(all( + feature = "streaming", + feature = "reqwest-client", + not(target_arch = "wasm32") +))] use jacquard_common::http_client::HttpClientExt; use jacquard_common::stream::{StreamError, StreamErrorKind}; use n0_future::StreamExt; -use bytes::Bytes; #[tokio::test] async fn streaming_response_delivers_all_bytes() { @@ -34,28 +37,31 @@ async fn streaming_response_delivers_all_bytes() { assert!(total > 0); } -#[tokio::test] -async fn streaming_upload_sends_all_chunks() { - let client = reqwest::Client::new(); +// #[tokio::test] +// async fn streaming_upload_sends_all_chunks() { +// let client = reqwest::Client::new(); - let chunks = vec![ - Bytes::from("chunk1"), - Bytes::from("chunk2"), - Bytes::from("chunk3"), - ]; - let body_stream = futures::stream::iter(chunks.clone()); +// let chunks = vec![ +// Bytes::from("chunk1"), +// Bytes::from("chunk2"), +// Bytes::from("chunk3"), +// ]; +// let body_stream = futures::stream::iter(chunks.clone()); - // Build a complete request and extract parts - let request: http::Request> = http::Request::builder() - .method(http::Method::POST) - .uri("https://httpbin.org/post") - .body(vec![]) - .unwrap(); - let (parts, _) = request.into_parts(); +// // Build a complete request and extract parts +// let request: http::Request> = http::Request::builder() +// .method(http::Method::POST) +// .uri("https://httpbingo.org/post") +// .body(vec![]) +// .unwrap(); +// let (parts, _) = request.into_parts(); - let response = client.send_http_bidirectional(parts, body_stream).await.unwrap(); - assert!(response.status().is_success()); -} +// let response = client +// .send_http_bidirectional(parts, body_stream) +// .await +// .unwrap(); +// assert!(response.status().is_success()); +// } #[tokio::test] async fn stream_error_preserves_source() { diff --git a/crates/jacquard/src/client.rs b/crates/jacquard/src/client.rs index 797d1bd2..091e5936 100644 --- a/crates/jacquard/src/client.rs +++ b/crates/jacquard/src/client.rs @@ -1072,13 +1072,18 @@ impl MemoryCredentialSession { /// ```no_run /// # use jacquard::client::BasicClient; /// # use jacquard::types::string::AtUri; - /// # use jacquard_api::app_bsky::feed::post::Post; - /// use crate::jacquard::client::{Agent, AgentSessionExt}; + /// # use jacquard::api::app_bsky::feed::post::Post; + /// # use jacquard::types::string::Datetime; + /// # use jacquard::CowStr; + /// use jacquard::client::MemoryCredentialSession; + /// use jacquard::client::{Agent, AgentSessionExt}; /// # #[tokio::main] /// # async fn main() -> Result<(), Box> { - /// let (session, _) = MemoryCredentialSession::authenticated(identifier, password, None); + /// # let (identifier, password, post_text): (CowStr<'_>, CowStr<'_>, CowStr<'_>) = todo!(); + /// let (session, _) = MemoryCredentialSession::authenticated(identifier, password, None).await?; /// let agent = Agent::from(session); - /// let output = agent.create_record::(post, None).await?; + /// let post = Post::builder().text(post_text).created_at(Datetime::now()).build(); + /// let output = agent.create_record(post, None).await?; /// # Ok(()) /// # } /// ``` diff --git a/examples/app_password_create_post.rs b/examples/app_password_create_post.rs index b2fccee8..35198152 100644 --- a/examples/app_password_create_post.rs +++ b/examples/app_password_create_post.rs @@ -29,7 +29,10 @@ async fn main() -> miette::Result<()> { let agent: Agent<_> = Agent::from(session); // Create a simple text post using the Agent convenience method - let post = Post::builder().text(args.text).build(); + let post = Post::builder() + .text(args.text) + .created_at(Datetime::now()) + .build(); let output = agent.create_record(post, None).await?; println!("✓ Created post: {}", output.uri); diff --git a/examples/post_with_image.rs b/examples/post_with_image.rs index c64f44b9..7933201a 100644 --- a/examples/post_with_image.rs +++ b/examples/post_with_image.rs @@ -67,7 +67,7 @@ async fn main() -> miette::Result<()> { embed: Some(PostEmbed::Images(Box::new(Images { images: vec![Image { alt: CowStr::from(args.alt.unwrap_or_default()), - image: blob, + image: blob.into(), aspect_ratio: None, extra_data: Default::default(), }],