GitRoot
Craft your forge, Build your project, Grow your community freely
1// SPDX-FileCopyrightText: 2026 Romain Maneschi <romain@gitroot.dev>
2//
3// SPDX-License-Identifier: MIT
4
5use serde::{Deserialize, Serialize};
6use serde_json::Value;
7
8#[derive(Debug, Deserialize, Serialize, Clone)]
9#[serde(rename_all = "camelCase")]
10pub struct PluginRun {
11 pub path: String,
12 pub branch: Vec<String>,
13 pub when: Vec<PluginRunWhen>,
14 pub schedule: String,
15 pub func: Vec<PluginFunc>,
16 pub write: PluginWrite,
17 pub configuration: Value,
18}
19
20#[derive(Debug, Deserialize, Serialize, Clone)]
21#[serde(rename_all = "camelCase")]
22pub struct PluginFunc {
23 pub func_name: String,
24 pub args: Vec<String>,
25 pub res: Vec<String>,
26}
27
28#[derive(Debug, Deserialize, Serialize, Clone)]
29#[serde(rename_all = "camelCase")]
30pub struct PluginWrite {
31 pub git: Vec<PluginWriteRight>,
32 pub web: Vec<PluginWriteRight>,
33 pub exec: Vec<PluginExecRight>,
34 pub call_func: Vec<PluginCallFuncRight>,
35}
36
37#[derive(Debug, Deserialize, Serialize, Clone)]
38#[serde(rename_all = "camelCase")]
39pub struct PluginWriteRight {
40 pub path: String,
41 pub can: Vec<PluginWriteRightCan>,
42}
43
44#[derive(Debug, Deserialize, Serialize, Clone)]
45#[serde(rename_all = "camelCase")]
46pub struct PluginExecRight {
47 pub command: String,
48}
49
50#[derive(Debug, Deserialize, Serialize, Clone)]
51#[serde(rename_all = "camelCase")]
52pub struct PluginCallFuncRight {
53 pub plugin_purl: String,
54 pub func_name: String,
55 pub configuration: Value,
56}
57
58#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, Serialize)]
59#[serde(rename_all = "lowercase")]
60pub enum PluginRunWhen {
61 Add,
62 Mod,
63 Del,
64}
65
66#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, Serialize)]
67#[serde(rename_all = "lowercase")]
68pub enum PluginWriteRightCan {
69 Add,
70 Mod,
71 Del,
72 Append,
73}