diff --git a/solar_client/examples/latest_image.rs b/solar_client/examples/latest_image.rs new file mode 100644 index 0000000..94ea87d --- /dev/null +++ b/solar_client/examples/latest_image.rs @@ -0,0 +1,19 @@ +use anyhow::Result; +use solar_client::{Client, SolarClient}; + +const SERVER_ADDR: &str = "http://127.0.0.1:3030"; +const PUB_KEY: &str = "@HEqy940T6uB+T+d9Jaa58aNfRzLx9eRWqkZljBmnkmk=.ed25519"; + +#[tokio::main] +async fn main() -> Result<()> { + let client = Client::new(SERVER_ADDR.to_owned())?; + + let latest_image = client.latest_image(PUB_KEY).await?; + println!("{:#?}", latest_image); + // ( + // "@HEqy940T6uB+T+d9Jaa58aNfRzLx9eRWqkZljBmnkmk=.ed25519", + // "&8M2JFEFHlxJ5q8Lmu3P4bDdCHg0SLB27Q321cy9Upx4=.sha256", + // ) + + Ok(()) +} diff --git a/solar_client/examples/self_images.rs b/solar_client/examples/self_images.rs index 851d54b..0e03f75 100644 --- a/solar_client/examples/self_images.rs +++ b/solar_client/examples/self_images.rs @@ -11,11 +11,12 @@ async fn main() -> Result<()> { let self_images = client.self_images(PUB_KEY).await?; println!("{:#?}", self_images); // [ - // ( - // "@HEqy940T6uB+T+d9Jaa58aNfRzLx9eRWqkZljBmnkmk=.ed25519", - // "&dmLPhR0npN7tHiICGfM1WLBMHhhzh5I5VR3rEKvmOXw=.sha256", - // ), - // ... + // "&dmLPhR0npN7tHiICGfM1WLBMHhhzh5I5VR3rEKvmOXw=.sha256", + // "&f4YiGjvj3ClOc3VA0XYQnPZAflQm/GROfTkHBjAb3a0=.sha256", + // "&dmLPhR0npN7tHiICGfM1WLBMHhhzh5I5VR3rEKvmOXw=.sha256", + // "&Z8X3/bszQTRZ3cmyEM6sUoa8hlDbS+qfecziI5gRXpY=.sha256", + // "&LesplCjgV8Q355b93QOFCoL5G1KdyXTqIsm4EL9R2Fw=.sha256", + // "&8M2JFEFHlxJ5q8Lmu3P4bDdCHg0SLB27Q321cy9Upx4=.sha256", // ] Ok(()) diff --git a/solar_client/src/lib.rs b/solar_client/src/lib.rs index 1338ff5..461d005 100644 --- a/solar_client/src/lib.rs +++ b/solar_client/src/lib.rs @@ -28,6 +28,8 @@ pub trait SolarClient { async fn self_images(&self, pub_key: &str) -> Vec; + async fn latest_image(&self, pub_key: &str) -> (String, String); + async fn ping(&self) -> String; async fn whoami(&self) -> String;