diff --git a/solar_client/examples/subscribers.rs b/solar_client/examples/subscribers.rs new file mode 100644 index 0000000..0f16d14 --- /dev/null +++ b/solar_client/examples/subscribers.rs @@ -0,0 +1,18 @@ +use anyhow::Result; +use solar_client::{Client, SolarClient}; + +const SERVER_ADDR: &str = "http://127.0.0.1:3030"; +const CHANNEL: &str = "myco"; + +#[tokio::main] +async fn main() -> Result<()> { + let client = Client::new(SERVER_ADDR.to_owned())?; + + let subscribers = client.subscribers(CHANNEL).await?; + println!("{:#?}", subscribers); + // [ + // "@HEqy940T6uB+T+d9Jaa58aNfRzLx9eRWqkZljBmnkmk=.ed25519", + // ] + + Ok(()) +} diff --git a/solar_client/src/lib.rs b/solar_client/src/lib.rs index 18ded46..d462bfa 100644 --- a/solar_client/src/lib.rs +++ b/solar_client/src/lib.rs @@ -48,6 +48,8 @@ pub trait SolarClient { async fn ping(&self) -> String; + async fn subscribers(&self, channel: &str) -> Vec; + async fn whoami(&self) -> String; }