Skip to main content

objectiveai_sdk/cli/command/logs/vector/completions/request/get/
mod.rs

1//! `logs vector completions request get` — async handler stub.
2
3use crate::cli::command::CommandRequest;
4
5#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, schemars::JsonSchema)]
6#[schemars(rename = "cli.command.logs.vector.completions.request.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.vector.completions.request.get.Path")]
15pub enum Path {
16    #[serde(rename = "logs/vector/completions/request/get")]
17    LogsVectorCompletionsRequestGet,
18}
19
20impl CommandRequest for Request {
21    fn into_command(&self) -> Vec<String> {
22        let mut argv: Vec<String> = vec!["logs", "vector", "completions", "request", "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::vector::completions::request::VectorCompletionCreateParams;
34
35#[derive(clap::Args)]
36pub struct Args {
37    /// Identifier of the target log entry.
38    pub id: String,
39    /// jq filter applied to the JSON output.
40    #[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    /// Emit the JSON Schema for this leaf's `Request` type and exit.
56    RequestSchema(request_schema::Args),
57    /// Emit the JSON Schema for this leaf's `Response` type and exit.
58    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::LogsVectorCompletionsRequestGet,
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;