pass CreateHistoryStream as arg
This commit is contained in:
parent
e16f567c19
commit
80e99deb6f
|
@ -5,7 +5,7 @@
|
||||||
//! - [`Sbot::create_history_stream`]
|
//! - [`Sbot::create_history_stream`]
|
||||||
|
|
||||||
use async_std::stream::Stream;
|
use async_std::stream::Stream;
|
||||||
use kuska_ssb::api::dto::CreateHistoryStreamIn;
|
pub use kuska_ssb::api::dto::CreateHistoryStreamIn as CreateHistoryStream;
|
||||||
|
|
||||||
use crate::{error::GolgiError, messages::SsbMessageKVT, sbot::Sbot, utils};
|
use crate::{error::GolgiError, messages::SsbMessageKVT, sbot::Sbot, utils};
|
||||||
|
|
||||||
|
@ -17,14 +17,20 @@ impl Sbot {
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// use async_std::stream::StreamExt;
|
/// use async_std::stream::StreamExt;
|
||||||
/// use golgi::{Sbot, GolgiError, sbot::Keystore};
|
/// use golgi::{
|
||||||
|
/// Sbot,
|
||||||
|
/// GolgiError,
|
||||||
|
/// sbot::Keystore,
|
||||||
|
/// api::history_stream::CreateHistoryStream
|
||||||
|
/// };
|
||||||
///
|
///
|
||||||
/// async fn history() -> Result<(), GolgiError> {
|
/// async fn history() -> Result<(), GolgiError> {
|
||||||
/// let mut sbot_client = Sbot::init(Keystore::Patchwork, None, None).await?;
|
/// let mut sbot_client = Sbot::init(Keystore::Patchwork, None, None).await?;
|
||||||
///
|
///
|
||||||
/// let ssb_id = "@zqshk7o2Rpd/OaZ/MxH6xXONgonP1jH+edK9+GZb/NY=.ed25519".to_string();
|
/// let ssb_id = "@zqshk7o2Rpd/OaZ/MxH6xXONgonP1jH+edK9+GZb/NY=.ed25519".to_string();
|
||||||
///
|
///
|
||||||
/// let history_stream = sbot_client.create_history_stream(ssb_id).await?;
|
/// let args = CreateHistoryStream::new(ssb_id);
|
||||||
|
/// let history_stream = sbot_client.create_history_stream(args).await?;
|
||||||
///
|
///
|
||||||
/// history_stream.for_each(|msg| {
|
/// history_stream.for_each(|msg| {
|
||||||
/// match msg {
|
/// match msg {
|
||||||
|
@ -38,10 +44,9 @@ impl Sbot {
|
||||||
/// ```
|
/// ```
|
||||||
pub async fn create_history_stream(
|
pub async fn create_history_stream(
|
||||||
&mut self,
|
&mut self,
|
||||||
id: String,
|
args: CreateHistoryStream,
|
||||||
) -> Result<impl Stream<Item = Result<SsbMessageKVT, GolgiError>>, GolgiError> {
|
) -> Result<impl Stream<Item = Result<SsbMessageKVT, GolgiError>>, GolgiError> {
|
||||||
let mut sbot_connection = self.get_sbot_connection().await?;
|
let mut sbot_connection = self.get_sbot_connection().await?;
|
||||||
let args = CreateHistoryStreamIn::new(id).keys_values(true, true);
|
|
||||||
let req_id = sbot_connection
|
let req_id = sbot_connection
|
||||||
.client
|
.client
|
||||||
.create_history_stream_req_send(&args)
|
.create_history_stream_req_send(&args)
|
||||||
|
|
Loading…
Reference in New Issue