Skip to main content

objectiveai_sdk/cli/command/functions/profiles/list/
mod.rs

1//! `functions profiles list` — 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.functions.profiles.list.Request")]
7pub struct Request {
8    pub path_type: Path,
9    #[serde(flatten)]
10    pub base: crate::cli::command::RequestBase,
11}
12
13#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize, schemars::JsonSchema)]
14#[schemars(rename = "cli.command.functions.profiles.list.Path")]
15pub enum Path {
16    #[serde(rename = "functions/profiles/list")]
17    FunctionsProfilesList,
18}
19
20impl CommandRequest for Request {
21    fn into_command(&self) -> Vec<String> {
22        let mut argv = vec!["functions".to_string(), "profiles".to_string(), "list".to_string()];
23        self.base.push_flags(&mut argv);
24        argv
25    }
26
27    fn request_base(&self) -> &crate::cli::command::RequestBase {
28        &self.base
29    }
30
31    fn request_base_mut(&mut self) -> Option<&mut crate::cli::command::RequestBase> {
32        Some(&mut self.base)
33    }
34}
35
36#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, schemars::JsonSchema)]
37#[schemars(rename = "cli.command.functions.profiles.list.Response")]
38pub struct Response {
39    pub items: Vec<ResponseItem>,
40}
41
42/// The list endpoints return remote paths verbatim, so this is a plain
43/// alias of [`crate::RemotePath`] (not a wrapper enum) — its published
44/// schema is therefore the bare `RemotePath` `$ref` with no distinct
45/// named type for the SDK code generators to reconstruct.
46pub type ResponseItem = crate::RemotePath;
47
48#[derive(clap::Args)]
49pub struct Args {
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    /// Emit the JSON Schema for this leaf's `Request` type and exit.
66    RequestSchema(request_schema::Args),
67    /// Emit the JSON Schema for this leaf's `Response` type and exit.
68    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        Ok(Self { path_type: Path::FunctionsProfilesList,
75            base: args.base.into(),
76        })
77    }
78}
79
80#[cfg(feature = "cli-executor")]
81pub async fn execute<E: crate::cli::command::CommandExecutor>(
82    executor: &E,
83    mut request: Request,
84
85        agent_arguments: Option<&crate::cli::command::AgentArguments>,
86    ) -> Result<E::Stream<ResponseItem>, E::Error> {
87    request.base.clear_transform();
88    executor.execute(request, agent_arguments).await
89}
90
91#[cfg(feature = "cli-executor")]
92pub async fn execute_transform<E: crate::cli::command::CommandExecutor>(
93    executor: &E,
94    mut request: Request,
95    transform: crate::cli::command::Transform,
96
97        agent_arguments: Option<&crate::cli::command::AgentArguments>,
98    ) -> Result<E::Stream<serde_json::Value>, E::Error> {
99    request.base.set_transform(transform);
100    executor.execute(request, agent_arguments).await
101}
102
103#[cfg(feature = "mcp")]
104impl crate::cli::command::CommandResponse for Response {
105    fn into_mcp(self) -> crate::cli::command::McpResponseItem {
106        crate::cli::command::McpResponseItem::JSONL(serde_json::to_value(self).unwrap())
107    }
108}
109
110// `ResponseItem` is `crate::RemotePath`; its `CommandResponse` impl lives
111// on `RemotePath` in `crate::remote` (one impl shared by every list leaf
112// that aliases it).
113
114pub mod request_schema;
115
116
117pub mod response_schema;