use crate::cli::{print_value, DaemonClient};
use anyhow::Result;
pub async fn health(client: &DaemonClient) -> Result<()> {
client.ensure_running().await?;
let resp = client.get("/health").await?;
print_value(client.format(), &resp);
Ok(())
}
pub async fn status(client: &DaemonClient) -> Result<()> {
client.ensure_running().await?;
let resp = client.get("/status").await?;
print_value(client.format(), &resp);
Ok(())
}
pub async fn peers(client: &DaemonClient) -> Result<()> {
client.ensure_running().await?;
let resp = client.get("/peers").await?;
print_value(client.format(), &resp);
Ok(())
}
pub async fn presence(client: &DaemonClient) -> Result<()> {
client.ensure_running().await?;
let resp = client.get("/presence").await?;
print_value(client.format(), &resp);
Ok(())
}
pub async fn network_status(client: &DaemonClient) -> Result<()> {
client.ensure_running().await?;
let resp = client.get("/network/status").await?;
print_value(client.format(), &resp);
Ok(())
}
pub async fn bootstrap_cache(client: &DaemonClient) -> Result<()> {
client.ensure_running().await?;
let resp = client.get("/network/bootstrap-cache").await?;
print_value(client.format(), &resp);
Ok(())
}