use std::process; use kuska_ssb::api::dto::content::PubAddress; use golgi::error::GolgiError; use golgi::messages::SsbMessageContent; use golgi::sbot::Sbot; async fn run() -> Result<(), GolgiError> { let mut sbot_client = Sbot::connect(None, None).await?; let id = sbot_client.whoami().await?; println!("whoami: {}", id); // publish a pub address message (in order to test accepting invite from other client) let pub_address_msg = SsbMessageContent::Pub { address: Some(PubAddress { host: Some("127.0.0.1".to_string()), port: 8009, key: id, }), }; let pub_msg_ref = sbot_client.publish(pub_address_msg).await?; println!("pub_msg_ref: {}", pub_msg_ref); let invite_code = sbot_client.invite_create(1).await?; println!("invite (1 use): {:?}", invite_code); let invite_code_2 = sbot_client.invite_create(7).await?; println!("invite (7 uses): {:?}", invite_code_2); let test_invite = "net:ssbroom2.commoninternet.net:8009~shs:wm8a1zHWjtESv4XSKMWU/rPRhnAoAiSAe4hQSY0UF5A="; let mref = sbot_client.invite_use(test_invite).await?; println!("mref: {:?}", mref); Ok(()) } #[async_std::main] async fn main() { if let Err(e) = run().await { eprintln!("Application error: {}", e); process::exit(1); } }