From bb0783969150014a46e989da0c9e506ac3fc86d1 Mon Sep 17 00:00:00 2001 From: glyph Date: Wed, 29 Jun 2022 13:49:00 +0100 Subject: [PATCH 1/3] return kvt instead of value --- src/api/history_stream.rs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/api/history_stream.rs b/src/api/history_stream.rs index 1a2e4d1..0cfbe8f 100644 --- a/src/api/history_stream.rs +++ b/src/api/history_stream.rs @@ -7,10 +7,11 @@ use async_std::stream::Stream; use kuska_ssb::api::dto::CreateHistoryStreamIn; -use crate::{error::GolgiError, messages::SsbMessageValue, sbot::Sbot, utils}; +use crate::{error::GolgiError, messages::SsbMessageKVT, sbot::Sbot, utils}; impl Sbot { - /// Call the `createHistoryStream` RPC method. + /// Call the `createHistoryStream` RPC method. Returns messages in the form + /// of KVTs (Key Value Timestamp). /// /// # Example /// @@ -38,19 +39,16 @@ impl Sbot { pub async fn create_history_stream( &mut self, id: String, - ) -> Result>, GolgiError> { + ) -> Result>, GolgiError> { let mut sbot_connection = self.get_sbot_connection().await?; - let args = CreateHistoryStreamIn::new(id); + let args = CreateHistoryStreamIn::new(id).keys_values(true, true); let req_id = sbot_connection .client .create_history_stream_req_send(&args) .await?; - let history_stream = utils::get_source_stream( - sbot_connection.rpc_reader, - req_id, - utils::ssb_message_res_parse, - ) - .await; + let history_stream = + utils::get_source_stream(sbot_connection.rpc_reader, req_id, utils::kvt_res_parse) + .await; Ok(history_stream) } } From 2abe4b5e103d7bae5de908491c32b07755388a7a Mon Sep 17 00:00:00 2001 From: glyph Date: Wed, 29 Jun 2022 13:49:38 +0100 Subject: [PATCH 2/3] bump version to reflect api change --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 1742676..aa265b4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "golgi" -version = "0.1.4" +version = "0.2.0" edition = "2021" authors = ["Max Fowler ", "Andrew Reid "] readme = "README.md" From 914ffb70cc84de35dd0d46db02bf820dca3440c0 Mon Sep 17 00:00:00 2001 From: glyph Date: Wed, 29 Jun 2022 13:56:43 +0100 Subject: [PATCH 3/3] fix formatting --- src/sbot.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/sbot.rs b/src/sbot.rs index e553d70..63bdeb4 100644 --- a/src/sbot.rs +++ b/src/sbot.rs @@ -84,18 +84,16 @@ impl Sbot { Keystore::CustomGoSbot(key_path) => { keystore::from_custom_gosbot_keypath(key_path.to_string()) .await - .unwrap_or_else(|_| panic!( - "couldn't read local go-sbot secret from: {}", - key_path - )) + .unwrap_or_else(|_| { + panic!("couldn't read local go-sbot secret from: {}", key_path) + }) } Keystore::CustomPatchwork(key_path) => { keystore::from_custom_patchwork_keypath(key_path.to_string()) .await - .unwrap_or_else(|_| panic!( - "couldn't read local patchwork secret from: {}", - key_path - )) + .unwrap_or_else(|_| { + panic!("couldn't read local patchwork secret from: {}", key_path) + }) } };