golgi/examples/ssb-client.rs

33 lines
643 B
Rust
Raw Normal View History

2021-12-02 17:48:16 +00:00
use std::process;
use kuska_ssb::api::dto::content::Post;
use golgi::error::GolgiError;
use golgi::sbot::Sbot;
async fn run() -> Result<(), GolgiError> {
let mut sbot_client = Sbot::init(None, None).await?;
let id = sbot_client.whoami().await?;
println!("{}", id);
let post = Post::new(
"glyph from golgi".to_string(),
// mentions
None,
);
let msg_ref = sbot_client.publish_post(post).await?;
println!("{}", msg_ref);
Ok(())
}
#[async_std::main]
async fn main() {
if let Err(e) = run().await {
eprintln!("Application error: {}", e);
process::exit(1);
}
}