Skip to content

Commit

Permalink
add latest_image and example, update self_images example
Browse files Browse the repository at this point in the history
  • Loading branch information
mycognosist committed Feb 13, 2024
1 parent 9074460 commit 915d068
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
19 changes: 19 additions & 0 deletions solar_client/examples/latest_image.rs
Original file line number Diff line number Diff line change
@@ -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(())
}
11 changes: 6 additions & 5 deletions solar_client/examples/self_images.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
Expand Down
2 changes: 2 additions & 0 deletions solar_client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ pub trait SolarClient {

async fn self_images(&self, pub_key: &str) -> Vec<String>;

async fn latest_image(&self, pub_key: &str) -> (String, String);

async fn ping(&self) -> String;

async fn whoami(&self) -> String;
Expand Down

0 comments on commit 915d068

Please sign in to comment.