objectiveai_sdk/cli/command/agents/queue/delete/
mod.rs1use crate::cli::command::CommandRequest;
11
12#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, schemars::JsonSchema)]
13#[schemars(rename = "cli.command.agents.queue.delete.Request")]
14pub struct Request {
15 pub path_type: Path,
16 pub id: i64,
17 #[serde(flatten)]
18 pub base: crate::cli::command::RequestBase,
19}
20
21#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize, schemars::JsonSchema)]
22#[schemars(rename = "cli.command.agents.queue.delete.Path")]
23pub enum Path {
24 #[serde(rename = "agents/queue/delete")]
25 AgentsQueueDelete,
26}
27
28impl CommandRequest for Request {
29 fn into_command(&self) -> Vec<String> {
30 let mut argv = vec![
31 "agents".to_string(),
32 "queue".to_string(),
33 "delete".to_string(),
34 self.id.to_string(),
35 ];
36 self.base.push_flags(&mut argv);
37 argv
38 }
39
40 fn request_base(&self) -> &crate::cli::command::RequestBase {
41 &self.base
42 }
43
44 fn request_base_mut(&mut self) -> Option<&mut crate::cli::command::RequestBase> {
45 Some(&mut self.base)
46 }
47}
48
49#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, schemars::JsonSchema)]
56#[schemars(rename = "cli.command.agents.queue.delete.Response")]
57pub struct Response {
58 pub id: i64,
59 #[serde(default, skip_serializing_if = "Option::is_none")]
60 #[schemars(extend("omitempty" = true))]
61 pub agent_instance_hierarchy: Option<String>,
62 #[serde(default, skip_serializing_if = "Option::is_none")]
63 #[schemars(extend("omitempty" = true))]
64 pub agent_tag: Option<String>,
65 #[serde(default, skip_serializing_if = "Option::is_none")]
67 #[schemars(extend("omitempty" = true))]
68 pub key: Option<String>,
69 pub enqueued_at: i64,
70 pub content: crate::agent::completions::message::RichContent,
71}
72
73#[derive(clap::Args)]
74pub struct Args {
75 pub id: i64,
78 #[command(flatten)]
79 pub base: crate::cli::command::RequestBaseArgs,
80}
81
82#[derive(clap::Args)]
83#[command(args_conflicts_with_subcommands = true)]
84pub struct Command {
85 #[command(flatten)]
86 pub args: Args,
87 #[command(subcommand)]
88 pub schema: Option<Schema>,
89}
90
91#[derive(clap::Subcommand)]
92pub enum Schema {
93 RequestSchema(request_schema::Args),
95 ResponseSchema(response_schema::Args),
97}
98
99impl TryFrom<Args> for Request {
100 type Error = crate::cli::command::FromArgsError;
101 fn try_from(args: Args) -> Result<Self, Self::Error> {
102 Ok(Self {
103 path_type: Path::AgentsQueueDelete,
104 id: args.id,
105 base: args.base.into(),
106 })
107 }
108}
109
110#[cfg(feature = "cli-executor")]
111pub async fn execute<E: crate::cli::command::CommandExecutor>(
112 executor: &E,
113 mut request: Request,
114 agent_arguments: Option<&crate::cli::command::AgentArguments>,
115) -> Result<Response, E::Error> {
116 request.base.clear_transform();
117 executor.execute_one(request, agent_arguments).await
118}
119
120#[cfg(feature = "cli-executor")]
121pub async fn execute_transform<E: crate::cli::command::CommandExecutor>(
122 executor: &E,
123 mut request: Request,
124 transform: crate::cli::command::Transform,
125 agent_arguments: Option<&crate::cli::command::AgentArguments>,
126) -> Result<serde_json::Value, E::Error> {
127 request.base.set_transform(transform);
128 executor.execute_one(request, agent_arguments).await
129}
130
131#[cfg(feature = "mcp")]
132impl crate::cli::command::CommandResponse for Response {
133 fn into_mcp(self) -> crate::cli::command::McpResponseItem {
134 crate::cli::command::McpResponseItem::JSONL(serde_json::to_value(self).unwrap())
135 }
136}
137
138pub mod request_schema;
139
140pub mod response_schema;