objectiveai_sdk/cli/command/agents/queue/open/
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.open.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.open.Path")]
26pub enum Path {
27 #[serde(rename = "agents/queue/open")]
28 AgentsQueueOpen,
29}
30
31impl CommandRequest for Request {
32 fn request_base(&self) -> &crate::cli::command::RequestBase {
33 &self.base
34 }
35
36 fn request_base_mut(&mut self) -> Option<&mut crate::cli::command::RequestBase> {
37 Some(&mut self.base)
38 }
39}
40
41pub type Response = crate::agent::completions::message::RichContentPart;
53
54#[derive(clap::Args)]
55#[command(group(clap::ArgGroup::new("id_required").required(true).args(["id"])))]
56pub struct Args {
57 #[arg(long)]
59 pub id: Option<i64>,
60 #[command(flatten)]
61 pub base: crate::cli::command::RequestBaseArgs,
62}
63
64#[derive(clap::Args)]
65#[command(args_conflicts_with_subcommands = true)]
66pub struct Command {
67 #[command(flatten)]
68 pub args: Args,
69 #[command(subcommand)]
70 pub schema: Option<Schema>,
71}
72
73#[derive(clap::Subcommand)]
74pub enum Schema {
75 RequestSchema(request_schema::Args),
77 ResponseSchema(response_schema::Args),
79}
80
81impl TryFrom<Args> for Request {
82 type Error = crate::cli::command::FromArgsError;
83 fn try_from(args: Args) -> Result<Self, Self::Error> {
84 Ok(Self {
85 path_type: Path::AgentsQueueOpen,
86 id: args.id.ok_or_else(|| {
87 crate::cli::command::FromArgsError::path_parse(
88 "id",
89 "--id is required".to_string(),
90 )
91 })?,
92 base: args.base.into(),
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.base.clear_transform();
104 executor.execute_one(request, agent_arguments).await
105}
106
107#[cfg(feature = "cli-executor")]
108pub async fn execute_transform<E: crate::cli::command::CommandExecutor>(
109 executor: &E,
110 mut request: Request,
111 transform: crate::cli::command::Transform,
112 agent_arguments: Option<&crate::cli::command::AgentArguments>,
113) -> Result<serde_json::Value, E::Error> {
114 request.base.set_transform(transform);
115 executor.execute_one(request, agent_arguments).await
116}
117
118pub mod request_schema;
123
124pub mod response_schema;