Skip to main content

objectiveai_sdk/cli/output/notification/
items.rs

1use schemars::JsonSchema;
2use serde::{Deserialize, Serialize};
3
4/// Generic wire wrapper for every list-style notification:
5/// `{"type":"notification","items":[...]}`. The element type varies
6/// (e.g. `Items<ListItem>` for `agents list`, `Items<PairListItem>` for
7/// `pairs list`, `Items<crate::filesystem::config::Favorite>` for
8/// favorites listings, `Items<crate::filesystem::logs::ListItem>`
9/// for log listings).
10#[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)]
11#[schemars(rename = "cli.output.notification.Items.{T}")]
12pub struct Items<T> {
13    pub items: Vec<T>,
14}
15
16/// One entry in a non-pair resource listing — either a favorite that
17/// matches a remote resource or a resolved remote path. Untagged so the
18/// wire shape is whichever underlying object matches.
19#[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)]
20#[serde(untagged)]
21#[schemars(rename = "cli.output.notification.ListItem")]
22pub enum ListItem {
23    #[schemars(title = "Favorite")]
24    Favorite(crate::filesystem::config::Favorite),
25    #[schemars(title = "Item")]
26    Item(crate::RemotePath),
27}
28
29/// One entry in a function-profile pair listing.
30#[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)]
31#[serde(untagged)]
32#[schemars(rename = "cli.output.notification.PairListItem")]
33pub enum PairListItem {
34    #[schemars(title = "Favorite")]
35    Favorite(crate::filesystem::config::PairFavorite),
36    #[schemars(title = "Item")]
37    Item(crate::functions::response::ListFunctionProfilePairItem),
38}