diff --git a/src/warp/constellation.rs b/src/warp/constellation.rs index 21d554c..7ac071a 100644 --- a/src/warp/constellation.rs +++ b/src/warp/constellation.rs @@ -88,6 +88,9 @@ impl ConstellationBox { .map(|ok| ok.to_vec()) } + /// Returns a progression stream + /// The result of the stream is of type {@link Progression} + /// See https://github.com/Satellite-im/Warp/blob/main/warp/src/raygun/mod.rs#L306 pub async fn put_stream( &mut self, name: &str, @@ -107,6 +110,8 @@ impl ConstellationBox { }) } + /// Returns a file stream + /// Each stream element is a byte array chunk of the file pub async fn get_stream(&self, name: &str) -> Result { self.inner .get_stream(name) diff --git a/src/warp/multipass.rs b/src/warp/multipass.rs index 078c6bb..ea240b8 100644 --- a/src/warp/multipass.rs +++ b/src/warp/multipass.rs @@ -91,6 +91,9 @@ impl MultiPassBox { /// impl MultiPassEvent trait #[wasm_bindgen] impl MultiPassBox { + /// Subscribe to multipass events returning a stream of multipass events + /// The result is of type warp::multipass::MultiPassEventKind + /// See https://github.com/Satellite-im/Warp/blob/main/warp/src/multipass/mod.rs#L28 pub async fn multipass_subscribe(&mut self) -> Result { self.inner .multipass_subscribe() diff --git a/src/warp/raygun.rs b/src/warp/raygun.rs index 1f5919c..b6549c8 100644 --- a/src/warp/raygun.rs +++ b/src/warp/raygun.rs @@ -157,6 +157,7 @@ impl RayGunBox { } /// Retrieve all message references from a conversation + /// Stream values are {@link MessageReference} pub async fn get_message_references( &self, conversation_id: String, @@ -487,6 +488,7 @@ impl RayGunBox { /// Stream a file that been attached to a message /// Note: Must use the filename associated when downloading + /// Async results are a byte array pub async fn download_stream( &self, conversation_id: String, @@ -517,6 +519,8 @@ impl RayGunBox { #[wasm_bindgen] impl RayGunBox { /// Subscribe to an stream of events from the conversation + /// Async results are of type MessageEventKind + /// See https://github.com/Satellite-im/Warp/blob/main/warp/src/raygun/mod.rs#L47 pub async fn get_conversation_stream( &mut self, conversation_id: String, @@ -533,6 +537,8 @@ impl RayGunBox { } /// Subscribe to an stream of events + /// Async results are of type RayGunEventKind + /// See https://github.com/Satellite-im/Warp/blob/main/warp/src/raygun/mod.rs#L33 pub async fn raygun_subscribe(&mut self) -> Result { self.inner .raygun_subscribe() @@ -549,6 +555,8 @@ impl RayGunBox { /// impl RayGunCommunity trait #[wasm_bindgen] impl RayGunBox { + /// Async results are of type MessageEventKind + /// See https://github.com/Satellite-im/Warp/blob/main/warp/src/raygun/mod.rs#L47 pub async fn get_community_stream( &mut self, community_id: String, @@ -1101,6 +1109,7 @@ impl RayGunBox { .map_err(|e| e.into()) .map(|inner| MessageReference { inner }) } + /// Stream values are {@link MessageReference} pub async fn get_community_channel_message_references( &self, community_id: String, @@ -1460,6 +1469,8 @@ impl Messages { } } /// Return the next element of the stream if this is a stream variant + /// Async results are of type warp::raygun::Message + /// See https://github.com/Satellite-im/Warp/blob/main/warp/src/raygun/mod.rs#L1076 pub async fn next_stream(&mut self) -> std::result::Result { if let Some(s) = self.stream.as_mut() { return s.next().await; @@ -1762,6 +1773,9 @@ impl AttachmentResult { self.message_id.clone() } + /// Returns the next progress + /// The result is of type warp::raygun::AttachmentKind + /// See https://github.com/Satellite-im/Warp/blob/main/warp/src/raygun/mod.rs#L306 pub async fn next(&mut self) -> std::result::Result { self.stream.next().await } diff --git a/src/warp/stream.rs b/src/warp/stream.rs index afc6012..6fe945e 100644 --- a/src/warp/stream.rs +++ b/src/warp/stream.rs @@ -5,6 +5,7 @@ use std::task::{Context, Poll}; use wasm_bindgen::prelude::*; /// Wraps BoxStream<'static, TesseractEvent> into a js compatible struct +/// Currently there is no generic way for this so on JS-side this returns any #[wasm_bindgen] pub struct AsyncIterator { inner: BoxStream<'static, JsValue>, @@ -18,6 +19,8 @@ impl AsyncIterator { /// Provides the next() function expected by js async iterator #[wasm_bindgen] impl AsyncIterator { + /// Next value in this iterator. Due to wasm limitations can only return any type + /// Refer to implementations for more info pub async fn next(&mut self) -> std::result::Result { let next = self.inner.next().await; match next {