objectiveai-cli 2.0.5

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 computations;

use clap::Subcommand;

#[derive(Subcommand)]
#[command(rename_all = "verbatim")]
pub enum GetCommand {
    #[command(name = "get")]
    Get,
}

#[derive(Subcommand)]
#[command(rename_all = "verbatim")]
pub enum Commands {
    #[command(name = "list")]
    List,
    #[command(name = "computations")]
    Computations {
        #[command(subcommand)]
        command: computations::Commands,
    },
    GetProfileResponse {
        #[command(subcommand)]
        command: GetCommand,
    },
    ListProfileResponse {
        #[command(subcommand)]
        command: GetCommand,
    },
    ListProfilesRequest {
        #[command(subcommand)]
        command: GetCommand,
    },
    ListProfilesSource {
        #[command(subcommand)]
        command: GetCommand,
    },
    UsageProfileResponse {
        #[command(subcommand)]
        command: GetCommand,
    },
}

impl Commands {
    pub async fn handle(self, handle: &objectiveai_cli_sdk::output::Handle) -> Result<(), crate::error::Error> {
        match self {
            Commands::List => {
                const NAMES: &[&str] = &["computations", "GetProfileResponse", "ListProfileResponse", "ListProfilesRequest", "ListProfilesSource", "UsageProfileResponse"];
                objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schemas>::Notification(
                    objectiveai_cli_sdk::output::Notification {
                        value: objectiveai_cli_sdk::output::Schemas {
                            schemas: NAMES.iter().map(|s| s.to_string()).collect(),
                        },
                    },
                ).emit(handle).await;
                Ok(())
            }
            Commands::Computations { command } => command.handle(handle).await,
            Commands::GetProfileResponse { .. } => {
                let schema: serde_json::Value = serde_json::from_str(
                    include_str!("../../../../../objectiveai-json-schema/functions.profiles.GetProfileResponse.json"),
                ).expect("embedded JSON Schema must parse");
                objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schema>::Notification(
                    objectiveai_cli_sdk::output::Notification {
                        value: objectiveai_cli_sdk::output::Schema { schema },
                    },
                ).emit(handle).await;
                Ok(())
            }
            Commands::ListProfileResponse { .. } => {
                let schema: serde_json::Value = serde_json::from_str(
                    include_str!("../../../../../objectiveai-json-schema/functions.profiles.ListProfileResponse.json"),
                ).expect("embedded JSON Schema must parse");
                objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schema>::Notification(
                    objectiveai_cli_sdk::output::Notification {
                        value: objectiveai_cli_sdk::output::Schema { schema },
                    },
                ).emit(handle).await;
                Ok(())
            }
            Commands::ListProfilesRequest { .. } => {
                let schema: serde_json::Value = serde_json::from_str(
                    include_str!("../../../../../objectiveai-json-schema/functions.profiles.ListProfilesRequest.json"),
                ).expect("embedded JSON Schema must parse");
                objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schema>::Notification(
                    objectiveai_cli_sdk::output::Notification {
                        value: objectiveai_cli_sdk::output::Schema { schema },
                    },
                ).emit(handle).await;
                Ok(())
            }
            Commands::ListProfilesSource { .. } => {
                let schema: serde_json::Value = serde_json::from_str(
                    include_str!("../../../../../objectiveai-json-schema/functions.profiles.ListProfilesSource.json"),
                ).expect("embedded JSON Schema must parse");
                objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schema>::Notification(
                    objectiveai_cli_sdk::output::Notification {
                        value: objectiveai_cli_sdk::output::Schema { schema },
                    },
                ).emit(handle).await;
                Ok(())
            }
            Commands::UsageProfileResponse { .. } => {
                let schema: serde_json::Value = serde_json::from_str(
                    include_str!("../../../../../objectiveai-json-schema/functions.profiles.UsageProfileResponse.json"),
                ).expect("embedded JSON Schema must parse");
                objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schema>::Notification(
                    objectiveai_cli_sdk::output::Notification {
                        value: objectiveai_cli_sdk::output::Schema { schema },
                    },
                ).emit(handle).await;
                Ok(())
            }
        }
    }
}