41 lines
1.1 KiB
Rust
41 lines
1.1 KiB
Rust
use std::process;
|
|
|
|
use kuska_ssb::api::dto::content::{SubsetQuery, TypedMessage, Post};
|
|
|
|
use golgi::error::GolgiError;
|
|
use golgi::sbot::Sbot;
|
|
use golgi::messages::{SsbMessageValue, SsbMessageContent};
|
|
|
|
async fn run() -> Result<(), GolgiError> {
|
|
let mut sbot_client = Sbot::init(None, None).await?;
|
|
|
|
let id = sbot_client.whoami().await?;
|
|
println!("{}", id);
|
|
|
|
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<SsbMessageValue> = 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(())
|
|
}
|
|
|
|
#[async_std::main]
|
|
async fn main() {
|
|
if let Err(e) = run().await {
|
|
eprintln!("Application error: {}", e);
|
|
process::exit(1);
|
|
}
|
|
}
|