objectiveai_sdk/cli/command/agents/queue/read/id/
mod.rs1use crate::cli::command::CommandRequest;
14
15#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, schemars::JsonSchema)]
16#[schemars(rename = "cli.command.agents.queue.read.id.Request")]
17pub struct Request {
18 pub path_type: Path,
19 pub id: i64,
20 #[serde(flatten)]
21 pub base: crate::cli::command::RequestBase,
22}
23
24#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize, schemars::JsonSchema)]
25#[schemars(rename = "cli.command.agents.queue.read.id.Path")]
26pub enum Path {
27 #[serde(rename = "agents/queue/read/id")]
28 AgentsQueueReadId,
29}
30
31impl CommandRequest for Request {
32 fn into_command(&self) -> Vec<String> {
33 let mut argv = vec![
34 "agents".to_string(),
35 "queue".to_string(),
36 "read".to_string(),
37 "id".to_string(),
38 self.id.to_string(),
39 ];
40 self.base.push_flags(&mut argv);
41 argv
42 }
43
44 fn request_base(&self) -> &crate::cli::command::RequestBase {
45 &self.base
46 }
47
48 fn request_base_mut(&mut self) -> Option<&mut crate::cli::command::RequestBase> {
49 Some(&mut self.base)
50 }
51}
52
53pub type Response = crate::agent::completions::message::RichContentPart;
65
66#[derive(clap::Args)]
67pub struct Args {
68 pub id: i64,
70 #[command(flatten)]
71 pub base: crate::cli::command::RequestBaseArgs,
72}
73
74#[derive(clap::Args)]
75#[command(args_conflicts_with_subcommands = true)]
76pub struct Command {
77 #[command(flatten)]
78 pub args: Args,
79 #[command(subcommand)]
80 pub schema: Option<Schema>,
81}
82
83#[derive(clap::Subcommand)]
84pub enum Schema {
85 RequestSchema(request_schema::Args),
87 ResponseSchema(response_schema::Args),
89}
90
91impl TryFrom<Args> for Request {
92 type Error = crate::cli::command::FromArgsError;
93 fn try_from(args: Args) -> Result<Self, Self::Error> {
94 Ok(Self {
95 path_type: Path::AgentsQueueReadId,
96 id: args.id,
97 base: args.base.into(),
98 })
99 }
100}
101
102#[cfg(feature = "cli-executor")]
103pub async fn execute<E: crate::cli::command::CommandExecutor>(
104 executor: &E,
105 mut request: Request,
106 agent_arguments: Option<&crate::cli::command::AgentArguments>,
107) -> Result<Response, E::Error> {
108 request.base.clear_transform();
109 executor.execute_one(request, agent_arguments).await
110}
111
112#[cfg(feature = "cli-executor")]
113pub async fn execute_transform<E: crate::cli::command::CommandExecutor>(
114 executor: &E,
115 mut request: Request,
116 transform: crate::cli::command::Transform,
117 agent_arguments: Option<&crate::cli::command::AgentArguments>,
118) -> Result<serde_json::Value, E::Error> {
119 request.base.set_transform(transform);
120 executor.execute_one(request, agent_arguments).await
121}
122
123pub mod request_schema;
128
129pub mod response_schema;