objectiveai-cli 2.0.11

ObjectiveAI command-line interface and embeddable library
// THIS FILE IS AUTO-GENERATED. DO NOT EDIT.
// Generated by objectiveai-cli-builder from objectiveai-json-schema/.

pub mod client_request;
pub mod client_response;
pub mod server_request;
pub mod server_response;

use clap::Subcommand;

#[derive(Subcommand)]
#[command(rename_all = "verbatim")]
pub enum Commands {
    #[command(name = "list")]
    List,
    #[command(name = "client_request")]
    ClientRequest {
        #[command(subcommand)]
        command: client_request::Commands,
    },
    #[command(name = "client_response")]
    ClientResponse {
        #[command(subcommand)]
        command: client_response::Commands,
    },
    #[command(name = "server_request")]
    ServerRequest {
        #[command(subcommand)]
        command: server_request::Commands,
    },
    #[command(name = "server_response")]
    ServerResponse {
        #[command(subcommand)]
        command: server_response::Commands,
    },
}

impl Commands {
    pub async fn handle(self, handle: &objectiveai_sdk::cli::output::Handle) -> Result<(), crate::error::Error> {
        match self {
            Commands::List => {
                const NAMES: &[&str] = &["client_request", "client_response", "server_request", "server_response"];
                objectiveai_sdk::cli::output::Output::<objectiveai_sdk::cli::output::Schemas>::Notification(
                    objectiveai_sdk::cli::output::Notification {
                        agent_id: None,
                        value: objectiveai_sdk::cli::output::Schemas {
                            schemas: NAMES.iter().map(|s| s.to_string()).collect(),
                        },
                    },
                ).emit(handle).await;
                Ok(())
            }
            Commands::ClientRequest { command } => command.handle(handle).await,
            Commands::ClientResponse { command } => command.handle(handle).await,
            Commands::ServerRequest { command } => command.handle(handle).await,
            Commands::ServerResponse { command } => command.handle(handle).await,
        }
    }
}