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: String,
71 pub content: crate::agent::completions::message::RichContent,
72}
73
74#[derive(clap::Args)]
75pub struct Args {
76 pub id: i64,
79 #[command(flatten)]
80 pub base: crate::cli::command::RequestBaseArgs,
81}
82
83#[derive(clap::Args)]
84#[command(args_conflicts_with_subcommands = true)]
85pub struct Command {
86 #[command(flatten)]
87 pub args: Args,
88 #[command(subcommand)]
89 pub schema: Option<Schema>,
90}
91
92#[derive(clap::Subcommand)]
93pub enum Schema {
94 RequestSchema(request_schema::Args),
96 ResponseSchema(response_schema::Args),
98}
99
100impl TryFrom<Args> for Request {
101 type Error = crate::cli::command::FromArgsError;
102 fn try_from(args: Args) -> Result<Self, Self::Error> {
103 Ok(Self {
104 path_type: Path::AgentsQueueDelete,
105 id: args.id,
106 base: args.base.into(),
107 })
108 }
109}
110
111#[cfg(feature = "cli-executor")]
112pub async fn execute<E: crate::cli::command::CommandExecutor>(
113 executor: &E,
114 mut request: Request,
115 agent_arguments: Option<&crate::cli::command::AgentArguments>,
116) -> Result<Response, E::Error> {
117 request.base.clear_transform();
118 executor.execute_one(request, agent_arguments).await
119}
120
121#[cfg(feature = "cli-executor")]
122pub async fn execute_transform<E: crate::cli::command::CommandExecutor>(
123 executor: &E,
124 mut request: Request,
125 transform: crate::cli::command::Transform,
126 agent_arguments: Option<&crate::cli::command::AgentArguments>,
127) -> Result<serde_json::Value, E::Error> {
128 request.base.set_transform(transform);
129 executor.execute_one(request, agent_arguments).await
130}
131
132#[cfg(feature = "mcp")]
133impl crate::cli::command::CommandResponse for Response {
134 fn into_mcp(self) -> crate::cli::command::McpResponseItem {
135 crate::cli::command::McpResponseItem::JSONL(serde_json::to_value(self).unwrap())
136 }
137}
138
139pub mod request_schema;
140
141pub mod response_schema;