objectiveai_sdk/cli/command/functions/profiles/get/
mod.rs1use crate::cli::command::CommandRequest;
4
5#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, schemars::JsonSchema)]
6#[schemars(rename = "cli.command.functions.profiles.get.Request")]
7pub struct Request {
8 pub path_type: Path,
9 pub path: crate::RemotePathCommitOptional,
10 #[serde(flatten)]
11 pub base: crate::cli::command::RequestBase,
12}
13
14#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize, schemars::JsonSchema)]
15#[schemars(rename = "cli.command.functions.profiles.get.Path")]
16pub enum Path {
17 #[serde(rename = "functions/profiles/get")]
18 FunctionsProfilesGet,
19}
20
21impl CommandRequest for Request {
22 fn into_command(&self) -> Vec<String> {
23 let mut argv = vec![
24 "functions".to_string(),
25 "profiles".to_string(),
26 "get".to_string(),
27 "--path".to_string(),
28 crate::cli::command::path_ref::remote_path_to_arg_string(&self.path),
29 ];
30 self.base.push_flags(&mut argv);
31 argv
32 }
33
34 fn request_base(&self) -> &crate::cli::command::RequestBase {
35 &self.base
36 }
37
38 fn request_base_mut(&mut self) -> Option<&mut crate::cli::command::RequestBase> {
39 Some(&mut self.base)
40 }
41}
42
43pub type Response = crate::functions::profiles::response::GetProfileResponse;
44
45#[derive(clap::Args)]
46pub struct Args {
47 #[arg(long)]
49 pub path: String,
50 #[command(flatten)]
51 pub base: crate::cli::command::RequestBaseArgs,
52}
53
54#[derive(clap::Args)]
55#[command(args_conflicts_with_subcommands = true)]
56pub struct Command {
57 #[command(flatten)]
58 pub args: Args,
59 #[command(subcommand)]
60 pub schema: Option<Schema>,
61}
62
63#[derive(clap::Subcommand)]
64pub enum Schema {
65 RequestSchema(request_schema::Args),
67 ResponseSchema(response_schema::Args),
69}
70
71impl TryFrom<Args> for Request {
72 type Error = crate::cli::command::FromArgsError;
73 fn try_from(args: Args) -> Result<Self, Self::Error> {
74 let path = args
75 .path
76 .parse::<crate::RemotePathCommitOptional>()
77 .map_err(|msg| crate::cli::command::FromArgsError::path_parse("path", msg))?;
78 Ok(Self { path_type: Path::FunctionsProfilesGet, path, base: args.base.into() })
79 }
80}
81
82#[cfg(feature = "cli-executor")]
83pub async fn execute<E: crate::cli::command::CommandExecutor>(
84 executor: &E,
85 mut request: Request,
86
87 agent_arguments: Option<&crate::cli::command::AgentArguments>,
88 ) -> Result<Response, E::Error> {
89 request.base.clear_transform();
90 executor.execute_one(request, agent_arguments).await
91}
92
93#[cfg(feature = "cli-executor")]
94pub async fn execute_transform<E: crate::cli::command::CommandExecutor>(
95 executor: &E,
96 mut request: Request,
97 transform: crate::cli::command::Transform,
98
99 agent_arguments: Option<&crate::cli::command::AgentArguments>,
100 ) -> Result<serde_json::Value, E::Error> {
101 request.base.set_transform(transform);
102 executor.execute_one(request, agent_arguments).await
103}
104
105pub mod request_schema;
106
107
108pub mod response_schema;