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")]
31 pub value: 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 = "draft_only", skip_serializing_if = "Option::is_none")]
45 pub draft_only: Option<bool>,
46 #[serde(rename = "draft", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
47 pub draft: Option<Option<serde_json::Value>>,
48}
49
50impl AppWithLastVersionWDraft {
51 pub fn new(id: i32, workspace_id: String, path: String, summary: String, versions: Vec<i32>, created_by: String, created_at: String, value: serde_json::Value, policy: models::Policy, execution_mode: ExecutionMode, extra_perms: std::collections::HashMap<String, bool>, raw_app: bool) -> AppWithLastVersionWDraft {
52 AppWithLastVersionWDraft {
53 id,
54 workspace_id,
55 path,
56 summary,
57 versions,
58 created_by,
59 created_at,
60 value,
61 policy: Box::new(policy),
62 execution_mode,
63 extra_perms,
64 custom_path: None,
65 raw_app,
66 bundle_secret: None,
67 draft_only: None,
68 draft: None,
69 }
70 }
71}
72#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
74pub enum ExecutionMode {
75 #[serde(rename = "viewer")]
76 Viewer,
77 #[serde(rename = "publisher")]
78 Publisher,
79 #[serde(rename = "anonymous")]
80 Anonymous,
81}
82
83impl Default for ExecutionMode {
84 fn default() -> ExecutionMode {
85 Self::Viewer
86 }
87}
88