update create_history_stream example
This commit is contained in:
parent
80e99deb6f
commit
c556373a96
|
@ -4,7 +4,10 @@ use async_std::stream::StreamExt;
|
||||||
use futures::TryStreamExt;
|
use futures::TryStreamExt;
|
||||||
|
|
||||||
use golgi::{
|
use golgi::{
|
||||||
api::get_subset::{SubsetQuery, SubsetQueryOptions},
|
api::{
|
||||||
|
get_subset::{SubsetQuery, SubsetQueryOptions},
|
||||||
|
history_stream::CreateHistoryStream,
|
||||||
|
},
|
||||||
messages::{SsbMessageContentType, SsbMessageKVT},
|
messages::{SsbMessageContentType, SsbMessageKVT},
|
||||||
sbot::Keystore,
|
sbot::Keystore,
|
||||||
GolgiError, Sbot,
|
GolgiError, Sbot,
|
||||||
|
@ -30,10 +33,11 @@ async fn run() -> Result<(), GolgiError> {
|
||||||
|
|
||||||
/* HISTORY STREAM EXAMPLE */
|
/* HISTORY STREAM EXAMPLE */
|
||||||
|
|
||||||
|
let history_stream_args = CreateHistoryStream::new(author.to_string());
|
||||||
// Create an ordered stream of all messages authored by the `author`
|
// Create an ordered stream of all messages authored by the `author`
|
||||||
// identity. Messages are returned as KVTs (Key Value Timestamp).
|
// identity. Messages are returned as KVTs (Key Value Timestamp).
|
||||||
let history_stream = sbot_client
|
let history_stream = sbot_client
|
||||||
.create_history_stream(author.to_string())
|
.create_history_stream(history_stream_args)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
// Pin the stream to the stack to allow polling of the `future`.
|
// Pin the stream to the stack to allow polling of the `future`.
|
||||||
|
@ -61,7 +65,7 @@ async fn run() -> Result<(), GolgiError> {
|
||||||
// Create an ordered stream of all messages authored by the `author`
|
// Create an ordered stream of all messages authored by the `author`
|
||||||
// identity.
|
// identity.
|
||||||
let history_stream = sbot_client
|
let history_stream = sbot_client
|
||||||
.create_history_stream(author.to_string())
|
.create_history_stream(CreateHistoryStream::new(author.to_string()))
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
// Collect the stream elements into a `Vec<SsbMessageKVT>` using
|
// Collect the stream elements into a `Vec<SsbMessageKVT>` using
|
||||||
|
@ -78,7 +82,7 @@ async fn run() -> Result<(), GolgiError> {
|
||||||
// Create an ordered stream of all messages authored by the `author`
|
// Create an ordered stream of all messages authored by the `author`
|
||||||
// identity.
|
// identity.
|
||||||
let history_stream = sbot_client
|
let history_stream = sbot_client
|
||||||
.create_history_stream(author.to_string())
|
.create_history_stream(CreateHistoryStream::new(author.to_string()))
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
// Iterate through the elements in the stream and use `map` to convert
|
// Iterate through the elements in the stream and use `map` to convert
|
||||||
|
|
Loading…
Reference in New Issue