windmill_api/models/
app_with_last_version_w_draft.rs1use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct AppWithLastVersionWDraft {
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 #[serde(rename = "draft_only", skip_serializing_if = "Option::is_none")]
47 pub draft_only: Option<bool>,
48 #[serde(rename = "draft", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
49 pub draft: Option<Option<serde_json::Value>>,
50 #[serde(rename = "draft_created_at", skip_serializing_if = "Option::is_none")]
52 pub draft_created_at: Option<String>,
53}
54
55impl AppWithLastVersionWDraft {
56 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) -> AppWithLastVersionWDraft {
57 AppWithLastVersionWDraft {
58 id,
59 workspace_id,
60 path,
61 summary,
62 versions,
63 created_by,
64 created_at,
65 value,
66 policy: Box::new(policy),
67 execution_mode,
68 extra_perms,
69 custom_path: None,
70 raw_app,
71 bundle_secret: None,
72 labels: None,
73 draft_only: None,
74 draft: None,
75 draft_created_at: None,
76 }
77 }
78}
79#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
81pub enum ExecutionMode {
82 #[serde(rename = "viewer")]
83 Viewer,
84 #[serde(rename = "publisher")]
85 Publisher,
86 #[serde(rename = "anonymous")]
87 Anonymous,
88}
89
90impl Default for ExecutionMode {
91 fn default() -> ExecutionMode {
92 Self::Viewer
93 }
94}
95