objectiveai_sdk/cli/command/config/functions/profiles/favorites/del/
mod.rs1use crate::cli::command::CommandRequest;
4
5#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, schemars::JsonSchema)]
6#[schemars(rename = "cli.command.config.functions.profiles.favorites.del.Request")]
7pub struct Request {
8 pub path_type: Path,
9 pub name: String,
10}
11
12#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize, schemars::JsonSchema)]
13#[schemars(rename = "cli.command.config.functions.profiles.favorites.del.Path")]
14pub enum Path {
15 #[serde(rename = "config/functions/profiles/favorites/del")]
16 ConfigFunctionsProfilesFavoritesDel,
17}
18
19impl CommandRequest for Request {
20 fn into_command(&self) -> Vec<String> {
21 vec!["config".to_string(), "functions".to_string(), "profiles".to_string(), "favorites".to_string(), "del".to_string(), self.name.clone()]
22 }
23}
24
25pub type Response = crate::cli::command::Ok;
26
27#[derive(clap::Args)]
28pub struct Args {
29 pub name: String,
31}
32
33#[derive(clap::Args)]
34#[command(args_conflicts_with_subcommands = true)]
35pub struct Command {
36 #[command(flatten)]
37 pub args: Args,
38 #[command(subcommand)]
39 pub schema: Option<Schema>,
40}
41
42#[derive(clap::Subcommand)]
43pub enum Schema {
44 RequestSchema(request_schema::Args),
46 ResponseSchema(response_schema::Args),
48}
49
50impl TryFrom<Args> for Request {
51 type Error = crate::cli::command::FromArgsError;
52 fn try_from(args: Args) -> Result<Self, Self::Error> {
53 Ok(Self { path_type: Path::ConfigFunctionsProfilesFavoritesDel, name: args.name })
54 }
55}
56
57#[cfg(feature = "cli-executor")]
58pub async fn execute<E: crate::cli::command::CommandExecutor>(
59 executor: &E,
60 request: Request,
61
62 agent_arguments: Option<&crate::cli::command::AgentArguments>,
63 ) -> Result<Response, E::Error> {
64 executor.execute_one(request, agent_arguments).await
65}
66
67pub mod request_schema;
68
69
70pub mod response_schema;
71
72#[cfg(feature = "cli-executor")]
73pub async fn execute_jq<E: crate::cli::command::CommandExecutor>(
74 executor: &E,
75 request: Request,
76 _jq: String,
77
78 agent_arguments: Option<&crate::cli::command::AgentArguments>,
79 ) -> Result<serde_json::Value, E::Error> {
80 let resp: Response = executor.execute_one(request, agent_arguments).await?;
81 Ok(serde_json::to_value(resp).expect("Response serializes"))
82}