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