diff --git a/examples/ssb-client.rs b/examples/ssb-client.rs index c76d5f2..00f9759 100644 --- a/examples/ssb-client.rs +++ b/examples/ssb-client.rs @@ -1,9 +1,7 @@ use std::process; -use kuska_ssb::api::dto::content::{Post, SubsetQuery, TypedMessage}; - +use golgi::messages::SsbMessageContent; use golgi::error::GolgiError; -use golgi::messages::{SsbMessageContent, SsbMessageValue}; use golgi::sbot::Sbot; async fn run() -> Result<(), GolgiError> { @@ -12,22 +10,31 @@ async fn run() -> Result<(), GolgiError> { let id = sbot_client.whoami().await?; println!("{}", id); - let post_msg_ref = sbot_client - .publish_description("this is a description") - .await?; + let name = SsbMessageContent::About { + about: id, + name: Some("golgi".to_string()), + title: None, + branch: None, + image: None, + description: None, + location: None, + start_datetime: None, + }; + + let name_msg_ref = sbot_client.publish(name).await?; + println!("{}", name_msg_ref); + + let post = SsbMessageContent::Post { + text: "golgi go womp womp".to_string(), + mentions: None, + }; + + let post_msg_ref = sbot_client.publish(post).await?; + println!("{}", post_msg_ref); + + let post_msg_ref = sbot_client.publish_description("this is a description").await?; println!("description: {}", post_msg_ref); - let author = "@L/z54cbc8V1kL1/MiBhpEKuN3QJkSoZYNaukny3ghIs=.ed25519".to_string(); - - println!("Calling create_history"); - let messages: Vec = sbot_client.create_history_stream(author).await?; - println!("hist: {:?}", messages); - - for message in messages { - let content: SsbMessageContent = message.into_ssb_message_content()?; - println!("content: {:?}", content); - } - Ok(()) } diff --git a/src/messages.rs b/src/messages.rs index e90a1c2..ee39a07 100644 --- a/src/messages.rs +++ b/src/messages.rs @@ -30,7 +30,6 @@ pub struct SsbMessageValue { } impl SsbMessageValue { - /// Gets the type field of the message content if found, /// and if not returns "none" pub fn get_message_type(&self) -> String { diff --git a/src/sbot.rs b/src/sbot.rs index 23cca11..4ff8608 100644 --- a/src/sbot.rs +++ b/src/sbot.rs @@ -8,8 +8,7 @@ use kuska_ssb::{ dto::{content::SubsetQuery, CreateHistoryStreamIn}, ApiCaller, }, - discovery, - keystore, + discovery, keystore, keystore::OwnedIdentity, rpc::{RpcReader, RpcWriter}, }; diff --git a/src/utils.rs b/src/utils.rs index 637d085..1ab449e 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -49,7 +49,6 @@ pub fn ssb_message_res_parse(body: &[u8]) -> Result Ok(message) } - /// Takes in an rpc request number, and a handling function, /// and waits for an rpc response which matches the request number, /// and then calls the handling function on the response.