use megalodon::{entities, error, generator}; use std::env; #[tokio::main] async fn main() { tracing_subscriber::fmt::init(); let Ok(url) = env::var("PLEROMA_URL") else { println!("Specify PLEROMA_URL!!"); return; }; let Ok(token) = env::var("PLEROMA_ACCESS_TOKEN") else { println!("Specify PLEROMA_ACCESS_TOKEN!!"); return; }; let res = get_markers(url.as_str(), token).await; match res { Ok(res) => { println!("{:#?}", res); } Err(err) => { println!("{:#?}", err); } } } async fn get_markers(url: &str, access_token: String) -> Result { let client = generator( megalodon::SNS::Pleroma, url.to_string(), Some(access_token), None, )?; let res = client .get_markers(vec![String::from("notifications")]) .await?; Ok(res.json()) }