cuddle-v2/crates/cuddle-actions-api/src/lib.rs
kjuulh 6729f6e794
feat: refactor projects
Signed-off-by: kjuulh <contact@kjuulh.io>
2024-10-26 22:27:16 +02:00

31 lines
598 B
Rust

use std::collections::BTreeMap;
use cuddle_lazy::LazyResolve;
use serde::{Deserialize, Serialize};
#[derive(Default)]
pub struct ExecutableActions {
pub actions: Vec<ExecutableAction>,
}
pub struct ExecutableAction {
pub name: String,
pub description: String,
pub flags: BTreeMap<String, ExecutableActionFlag>,
pub call_fn: LazyResolve,
}
impl ExecutableAction {
pub async fn call(&self) -> anyhow::Result<()> {
self.call_fn.call().await?;
Ok(())
}
}
#[derive(Debug, Serialize, Deserialize)]
pub enum ExecutableActionFlag {
String,
Bool,
}