Skip to main content

agent_first_http/cli/cmd/
health.rs

1//! `afhttp health` subcommand.
2
3use crate::cli::output;
4use crate::sdk::Client;
5use crate::shared::error::Error;
6
7#[derive(Debug)]
8pub struct Args {
9    pub endpoint: String,
10    pub token: Option<String>,
11}
12
13pub async fn run(args: Args) -> Result<(), Error> {
14    let mut client = Client::connect(&args.endpoint)?;
15    if let Some(t) = args.token.as_deref() {
16        client = client.with_token(t);
17    }
18    let response = client.health().await?;
19    output::emit("health", &response)
20}