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,
GetSwarmResponse {
#[command(subcommand)]
command: GetCommand,
},
InlineSwarm {
#[command(subcommand)]
command: GetCommand,
},
InlineSwarmBase {
#[command(subcommand)]
command: GetCommand,
},
InlineSwarmBaseOrRemote {
#[command(subcommand)]
command: GetCommand,
},
InlineSwarmBaseOrRemoteCommitOptional {
#[command(subcommand)]
command: GetCommand,
},
ListSwarmResponse {
#[command(subcommand)]
command: GetCommand,
},
ListSwarmsRequest {
#[command(subcommand)]
command: GetCommand,
},
ListSwarmsSource {
#[command(subcommand)]
command: GetCommand,
},
RemoteSwarm {
#[command(subcommand)]
command: GetCommand,
},
RemoteSwarmBase {
#[command(subcommand)]
command: GetCommand,
},
Swarm {
#[command(subcommand)]
command: GetCommand,
},
SwarmBase {
#[command(subcommand)]
command: GetCommand,
},
UsageSwarmResponse {
#[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] = &["GetSwarmResponse", "InlineSwarm", "InlineSwarmBase", "InlineSwarmBaseOrRemote", "InlineSwarmBaseOrRemoteCommitOptional", "ListSwarmResponse", "ListSwarmsRequest", "ListSwarmsSource", "RemoteSwarm", "RemoteSwarmBase", "Swarm", "SwarmBase", "UsageSwarmResponse"];
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::GetSwarmResponse { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../objectiveai-json-schema/swarm.GetSwarmResponse.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::InlineSwarm { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../objectiveai-json-schema/swarm.InlineSwarm.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::InlineSwarmBase { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../objectiveai-json-schema/swarm.InlineSwarmBase.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::InlineSwarmBaseOrRemote { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../objectiveai-json-schema/swarm.InlineSwarmBaseOrRemote.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::InlineSwarmBaseOrRemoteCommitOptional { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../objectiveai-json-schema/swarm.InlineSwarmBaseOrRemoteCommitOptional.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::ListSwarmResponse { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../objectiveai-json-schema/swarm.ListSwarmResponse.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::ListSwarmsRequest { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../objectiveai-json-schema/swarm.ListSwarmsRequest.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::ListSwarmsSource { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../objectiveai-json-schema/swarm.ListSwarmsSource.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::RemoteSwarm { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../objectiveai-json-schema/swarm.RemoteSwarm.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::RemoteSwarmBase { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../objectiveai-json-schema/swarm.RemoteSwarmBase.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::Swarm { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../objectiveai-json-schema/swarm.Swarm.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::SwarmBase { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../objectiveai-json-schema/swarm.SwarmBase.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::UsageSwarmResponse { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../objectiveai-json-schema/swarm.UsageSwarmResponse.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(())
}
}
}
}