Skip to main content

windmill_api/models/
preview.rs

1/*
2 * Windmill API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 1.660.1
7 * Contact: contact@windmill.dev
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct Preview {
16    /// The code to run
17    #[serde(rename = "content", skip_serializing_if = "Option::is_none")]
18    pub content: Option<String>,
19    /// The path to the script
20    #[serde(rename = "path", skip_serializing_if = "Option::is_none")]
21    pub path: Option<String>,
22    /// The hash of the script
23    #[serde(rename = "script_hash", skip_serializing_if = "Option::is_none")]
24    pub script_hash: Option<String>,
25    /// The arguments to pass to the script or flow
26    #[serde(rename = "args")]
27    pub args: std::collections::HashMap<String, serde_json::Value>,
28    #[serde(rename = "language", skip_serializing_if = "Option::is_none")]
29    pub language: Option<models::ScriptLang>,
30    #[serde(rename = "tag", skip_serializing_if = "Option::is_none")]
31    pub tag: Option<String>,
32    #[serde(rename = "kind", skip_serializing_if = "Option::is_none")]
33    pub kind: Option<Kind>,
34    #[serde(rename = "dedicated_worker", skip_serializing_if = "Option::is_none")]
35    pub dedicated_worker: Option<bool>,
36    #[serde(rename = "lock", skip_serializing_if = "Option::is_none")]
37    pub lock: Option<String>,
38    #[serde(rename = "flow_path", skip_serializing_if = "Option::is_none")]
39    pub flow_path: Option<String>,
40    /// Additional script modules keyed by relative file path
41    #[serde(rename = "modules", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
42    pub modules: Option<Option<std::collections::HashMap<String, models::ScriptModule>>>,
43}
44
45impl Preview {
46    pub fn new(args: std::collections::HashMap<String, serde_json::Value>) -> Preview {
47        Preview {
48            content: None,
49            path: None,
50            script_hash: None,
51            args,
52            language: None,
53            tag: None,
54            kind: None,
55            dedicated_worker: None,
56            lock: None,
57            flow_path: None,
58            modules: None,
59        }
60    }
61}
62/// 
63#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
64pub enum Kind {
65    #[serde(rename = "code")]
66    Code,
67    #[serde(rename = "identity")]
68    Identity,
69    #[serde(rename = "http")]
70    Http,
71}
72
73impl Default for Kind {
74    fn default() -> Kind {
75        Self::Code
76    }
77}
78