objectiveai_sdk/cli/command/logs/functions/inventions/recursive/response/get/
mod.rs1use crate::cli::command::CommandRequest;
4
5#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, schemars::JsonSchema)]
6#[schemars(rename = "cli.command.logs.functions.inventions.recursive.response.get.Request")]
7pub struct Request {
8 pub path_type: Path,
9 pub id: String,
10 pub jq: Option<String>,
11}
12
13#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize, schemars::JsonSchema)]
14#[schemars(rename = "cli.command.logs.functions.inventions.recursive.response.get.Path")]
15pub enum Path {
16 #[serde(rename = "logs/functions/inventions/recursive/response/get")]
17 LogsFunctionsInventionsRecursiveResponseGet,
18}
19
20impl CommandRequest for Request {
21 fn into_command(&self) -> Vec<String> {
22 let mut argv: Vec<String> = vec!["logs", "functions", "inventions", "recursive", "response", "get"]
23 .into_iter().map(String::from).collect();
24 argv.push(self.id.clone());
25 if let Some(jq) = &self.jq {
26 argv.push("--jq".to_string());
27 argv.push(jq.clone());
28 }
29 argv
30 }
31}
32
33pub type Response = crate::functions::inventions::recursive::response::streaming::FunctionInventionRecursiveChunkLog;
34
35#[derive(clap::Args)]
36pub struct Args {
37 pub id: String,
39 #[arg(long)]
41 pub jq: Option<String>,
42}
43
44#[derive(clap::Args)]
45#[command(args_conflicts_with_subcommands = true)]
46pub struct Command {
47 #[command(flatten)]
48 pub args: Args,
49 #[command(subcommand)]
50 pub schema: Option<Schema>,
51}
52
53#[derive(clap::Subcommand)]
54pub enum Schema {
55 RequestSchema(request_schema::Args),
57 ResponseSchema(response_schema::Args),
59}
60
61impl TryFrom<Args> for Request {
62 type Error = crate::cli::command::FromArgsError;
63 fn try_from(args: Args) -> Result<Self, Self::Error> {
64 Ok(Self { path_type: Path::LogsFunctionsInventionsRecursiveResponseGet,
65 id: args.id,
66 jq: args.jq,
67 })
68 }
69}
70
71#[cfg(feature = "cli-executor")]
72pub async fn execute<E: crate::cli::command::CommandExecutor>(
73 executor: &E,
74 mut request: Request,
75
76 agent_arguments: Option<&crate::cli::command::AgentArguments>,
77 ) -> Result<Response, E::Error> {
78 request.jq = None;
79 executor.execute_one(request, agent_arguments).await
80}
81
82#[cfg(feature = "cli-executor")]
83pub async fn execute_jq<E: crate::cli::command::CommandExecutor>(
84 executor: &E,
85 mut request: Request,
86 jq: String,
87
88 agent_arguments: Option<&crate::cli::command::AgentArguments>,
89 ) -> Result<serde_json::Value, E::Error> {
90 request.jq = Some(jq);
91 executor.execute_one(request, agent_arguments).await
92}
93
94pub mod request_schema;
95
96
97pub mod response_schema;