windmill_api/models/
app_with_last_version.rs1use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct AppWithLastVersion {
16 #[serde(rename = "id")]
17 pub id: i32,
18 #[serde(rename = "workspace_id")]
19 pub workspace_id: String,
20 #[serde(rename = "path")]
21 pub path: String,
22 #[serde(rename = "summary")]
23 pub summary: String,
24 #[serde(rename = "versions")]
25 pub versions: Vec<i32>,
26 #[serde(rename = "created_by")]
27 pub created_by: String,
28 #[serde(rename = "created_at")]
29 pub created_at: String,
30 #[serde(rename = "value", deserialize_with = "Option::deserialize")]
31 pub value: Option<serde_json::Value>,
32 #[serde(rename = "policy")]
33 pub policy: Box<models::Policy>,
34 #[serde(rename = "execution_mode")]
35 pub execution_mode: ExecutionMode,
36 #[serde(rename = "extra_perms")]
37 pub extra_perms: std::collections::HashMap<String, bool>,
38 #[serde(rename = "custom_path", skip_serializing_if = "Option::is_none")]
39 pub custom_path: Option<String>,
40 #[serde(rename = "raw_app")]
41 pub raw_app: bool,
42 #[serde(rename = "bundle_secret", skip_serializing_if = "Option::is_none")]
43 pub bundle_secret: Option<String>,
44 #[serde(rename = "labels", skip_serializing_if = "Option::is_none")]
45 pub labels: Option<Vec<String>>,
46}
47
48impl AppWithLastVersion {
49 pub fn new(id: i32, workspace_id: String, path: String, summary: String, versions: Vec<i32>, created_by: String, created_at: String, value: Option<serde_json::Value>, policy: models::Policy, execution_mode: ExecutionMode, extra_perms: std::collections::HashMap<String, bool>, raw_app: bool) -> AppWithLastVersion {
50 AppWithLastVersion {
51 id,
52 workspace_id,
53 path,
54 summary,
55 versions,
56 created_by,
57 created_at,
58 value,
59 policy: Box::new(policy),
60 execution_mode,
61 extra_perms,
62 custom_path: None,
63 raw_app,
64 bundle_secret: None,
65 labels: None,
66 }
67 }
68}
69#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
71pub enum ExecutionMode {
72 #[serde(rename = "viewer")]
73 Viewer,
74 #[serde(rename = "publisher")]
75 Publisher,
76 #[serde(rename = "anonymous")]
77 Anonymous,
78}
79
80impl Default for ExecutionMode {
81 fn default() -> ExecutionMode {
82 Self::Viewer
83 }
84}
85