use super::{Action, ActionContext};
use crate::definition::{ParamInput, Params, UiCatalog};
use crate::error::BaseError;
use async_trait::async_trait;
use serde::Deserialize;
#[derive(Debug, Default, Deserialize, schemars::JsonSchema)]
#[serde(deny_unknown_fields)]
pub struct UiCatalogInput {}
impl ParamInput for UiCatalogInput {
fn params() -> Params {
Params::new()
}
}
#[derive(Debug, Default, crate::Action)]
#[action(
name = "ui_catalog",
display_name = "UI 目录",
description = "返回当前请求身份可访问的 Action 演示契约",
method = "GET",
path = "/.well-known/yang/ui-catalog",
public
)]
pub struct UiCatalogAction;
#[async_trait]
impl Action for UiCatalogAction {
type Input = UiCatalogInput;
type Output = UiCatalog;
async fn index(
&self,
ctx: ActionContext,
_input: Self::Input,
) -> Result<Self::Output, BaseError> {
ctx.ui_catalog()
}
}