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,
ApiKeyWithMetadata {
#[command(subcommand)]
command: GetCommand,
},
CreateApiKeyRequest {
#[command(subcommand)]
command: GetCommand,
},
CreateOpenRouterByokApiKeyRequest {
#[command(subcommand)]
command: GetCommand,
},
DisableApiKeyRequest {
#[command(subcommand)]
command: GetCommand,
},
GetCreditsResponse {
#[command(subcommand)]
command: GetCommand,
},
GetOpenRouterByokApiKeyResponse {
#[command(subcommand)]
command: GetCommand,
},
ListApiKeyItem {
#[command(subcommand)]
command: GetCommand,
},
ListApiKeyResponse {
#[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] = &["ApiKeyWithMetadata", "CreateApiKeyRequest", "CreateOpenRouterByokApiKeyRequest", "DisableApiKeyRequest", "GetCreditsResponse", "GetOpenRouterByokApiKeyResponse", "ListApiKeyItem", "ListApiKeyResponse"];
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::ApiKeyWithMetadata { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../objectiveai-json-schema/auth.ApiKeyWithMetadata.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::CreateApiKeyRequest { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../objectiveai-json-schema/auth.CreateApiKeyRequest.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::CreateOpenRouterByokApiKeyRequest { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../objectiveai-json-schema/auth.CreateOpenRouterByokApiKeyRequest.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::DisableApiKeyRequest { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../objectiveai-json-schema/auth.DisableApiKeyRequest.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::GetCreditsResponse { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../objectiveai-json-schema/auth.GetCreditsResponse.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::GetOpenRouterByokApiKeyResponse { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../objectiveai-json-schema/auth.GetOpenRouterByokApiKeyResponse.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::ListApiKeyItem { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../objectiveai-json-schema/auth.ListApiKeyItem.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::ListApiKeyResponse { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../objectiveai-json-schema/auth.ListApiKeyResponse.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(())
}
}
}
}