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 pub jq: Option<String>,
21}
22
23#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize, schemars::JsonSchema)]
24#[schemars(rename = "cli.command.agents.queue.read.id.Path")]
25pub enum Path {
26 #[serde(rename = "agents/queue/read/id")]
27 AgentsQueueReadId,
28}
29
30impl CommandRequest for Request {
31 fn into_command(&self) -> Vec<String> {
32 let mut argv = vec![
33 "agents".to_string(),
34 "queue".to_string(),
35 "read".to_string(),
36 "id".to_string(),
37 self.id.to_string(),
38 ];
39 if let Some(jq) = &self.jq {
40 argv.push("--jq".to_string());
41 argv.push(jq.clone());
42 }
43 argv
44 }
45}
46
47pub type Response = crate::agent::completions::message::RichContentPart;
59
60#[derive(clap::Args)]
61pub struct Args {
62 pub id: i64,
64 #[arg(long)]
66 pub jq: Option<String>,
67}
68
69#[derive(clap::Args)]
70#[command(args_conflicts_with_subcommands = true)]
71pub struct Command {
72 #[command(flatten)]
73 pub args: Args,
74 #[command(subcommand)]
75 pub schema: Option<Schema>,
76}
77
78#[derive(clap::Subcommand)]
79pub enum Schema {
80 RequestSchema(request_schema::Args),
82 ResponseSchema(response_schema::Args),
84}
85
86impl TryFrom<Args> for Request {
87 type Error = crate::cli::command::FromArgsError;
88 fn try_from(args: Args) -> Result<Self, Self::Error> {
89 Ok(Self {
90 path_type: Path::AgentsQueueReadId,
91 id: args.id,
92 jq: args.jq,
93 })
94 }
95}
96
97#[cfg(feature = "cli-executor")]
98pub async fn execute<E: crate::cli::command::CommandExecutor>(
99 executor: &E,
100 mut request: Request,
101 agent_arguments: Option<&crate::cli::command::AgentArguments>,
102) -> Result<Response, E::Error> {
103 request.jq = None;
104 executor.execute_one(request, agent_arguments).await
105}
106
107#[cfg(feature = "cli-executor")]
108pub async fn execute_jq<E: crate::cli::command::CommandExecutor>(
109 executor: &E,
110 mut request: Request,
111 jq: String,
112 agent_arguments: Option<&crate::cli::command::AgentArguments>,
113) -> Result<serde_json::Value, E::Error> {
114 request.jq = Some(jq);
115 executor.execute_one(request, agent_arguments).await
116}
117
118pub mod request_schema;
123
124pub mod response_schema;