objectiveai_sdk/cli/command/tools/install/filesystem/response_schema/
mod.rs1use crate::cli::command::CommandRequest;
2
3#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, schemars::JsonSchema)]
4#[schemars(rename = "cli.command.tools.install.filesystem.response_schema.Request")]
5pub struct Request {
6 pub path_type: Path,
7 #[serde(flatten)]
8 pub base: crate::cli::command::RequestBase,
9}
10
11#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize, schemars::JsonSchema)]
12#[schemars(rename = "cli.command.tools.install.filesystem.response_schema.Path")]
13pub enum Path {
14 #[serde(rename = "tools/install/filesystem/response_schema")]
15 ToolsInstallFilesystemResponseSchema,
16}
17#[derive(clap::Args)]
18pub struct Args {
19 #[command(flatten)]
20 pub base: crate::cli::command::RequestBaseArgs,
21}
22
23
24impl CommandRequest for Request {
25 fn into_command(&self) -> Vec<String> {
26 let mut argv: Vec<String> = vec!["tools", "install", "filesystem", "response-schema"].into_iter().map(String::from).collect();
27 self.base.push_flags(&mut argv);
28 argv
29 }
30
31 fn request_base(&self) -> &crate::cli::command::RequestBase {
32 &self.base
33 }
34
35 fn request_base_mut(&mut self) -> Option<&mut crate::cli::command::RequestBase> {
36 Some(&mut self.base)
37 }
38}
39
40pub type Response = crate::cli::command::ResponseSchema;
41
42impl TryFrom<Args> for Request {
43 type Error = crate::cli::command::FromArgsError;
44 fn try_from(args: Args) -> Result<Self, Self::Error> {
45 Ok(Self { path_type: Path::ToolsInstallFilesystemResponseSchema, base: args.base.into() })
46 }
47}
48
49#[cfg(feature = "cli-executor")]
50pub async fn execute<E: crate::cli::command::CommandExecutor>(
51 executor: &E,
52 mut request: Request,
53
54 agent_arguments: Option<&crate::cli::command::AgentArguments>,
55) -> Result<Response, E::Error> {
56 request.base.clear_transform();
57 executor.execute_one(request, agent_arguments).await
58}
59
60#[cfg(feature = "cli-executor")]
61pub async fn execute_transform<E: crate::cli::command::CommandExecutor>(
62 executor: &E,
63 mut request: Request,
64 transform: crate::cli::command::Transform,
65
66 agent_arguments: Option<&crate::cli::command::AgentArguments>,
67) -> Result<serde_json::Value, E::Error> {
68 request.base.set_transform(transform);
69 executor.execute_one(request, agent_arguments).await
70}