2021-12-02 17:48:16 +00:00
|
|
|
use std::process;
|
|
|
|
|
2021-12-27 17:56:43 +00:00
|
|
|
use kuska_ssb::api::dto::content::{SubsetQuery, TypedMessage};
|
2021-12-02 17:48:16 +00:00
|
|
|
|
|
|
|
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);
|
|
|
|
|
2021-12-27 21:43:44 +00:00
|
|
|
// /*
|
|
|
|
// let name = TypedMessage::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);
|
2021-12-03 09:37:22 +00:00
|
|
|
|
2021-12-27 21:43:44 +00:00
|
|
|
// let post = TypedMessage::Post {
|
|
|
|
// text: "golgi go womp womp".to_string(),
|
|
|
|
// mentions: None,
|
|
|
|
// };
|
|
|
|
//
|
|
|
|
// let post_msg_ref = sbot_client.publish(post).await?;
|
|
|
|
// println!("{}", post_msg_ref);
|
2021-12-02 17:48:16 +00:00
|
|
|
|
2021-12-27 21:43:44 +00:00
|
|
|
//
|
|
|
|
// let post_msg_ref = sbot_client
|
|
|
|
// .publish_description("this is a description")
|
|
|
|
// .await?;
|
|
|
|
// println!("description: {}", post_msg_ref);
|
|
|
|
// */
|
2021-12-27 17:56:43 +00:00
|
|
|
|
2021-12-27 21:43:44 +00:00
|
|
|
// let query = SubsetQuery::Type {
|
|
|
|
// op: "type".to_string(),
|
|
|
|
// string: "post".to_string(),
|
|
|
|
// };
|
2021-12-27 17:56:43 +00:00
|
|
|
let query = SubsetQuery::Type {
|
2021-12-27 21:43:44 +00:00
|
|
|
op: "author".to_string(),
|
|
|
|
string: "@L/z54cbc8V1kL1/MiBhpEKuN3QJkSoZYNaukny3ghIs=.ed25519".to_string(),
|
2021-12-27 17:56:43 +00:00
|
|
|
};
|
|
|
|
let query_response = sbot_client.getsubset(query).await?;
|
|
|
|
println!("{}", query_response);
|
2021-12-22 21:19:52 +00:00
|
|
|
|
2021-12-27 21:43:44 +00:00
|
|
|
|
|
|
|
// println!("Calling log");
|
|
|
|
// let log_response = sbot_client.log().await?;
|
|
|
|
// println!("log: {}", log_response);
|
|
|
|
|
|
|
|
// println!("Calling create_history");
|
|
|
|
// let hist_response = sbot_client.create_history_stream("@L/z54cbc8V1kL1/MiBhpEKuN3QJkSoZYNaukny3ghIs=.ed25519".to_string()).await?;
|
|
|
|
// println!("hist: {:?}", hist_response);
|
|
|
|
|
2021-12-02 17:48:16 +00:00
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
|
|
|
#[async_std::main]
|
|
|
|
async fn main() {
|
|
|
|
if let Err(e) = run().await {
|
|
|
|
eprintln!("Application error: {}", e);
|
|
|
|
process::exit(1);
|
|
|
|
}
|
|
|
|
}
|