Skip to main content

windmill_api/models/
get_websocket_trigger_200_response.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.725.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 GetWebsocketTrigger200Response {
16    /// The WebSocket URL to connect to (can be a static URL or computed by a runnable)
17    #[serde(rename = "url")]
18    pub url: String,
19    /// ID of the server currently handling this trigger (internal)
20    #[serde(rename = "server_id", skip_serializing_if = "Option::is_none")]
21    pub server_id: Option<String>,
22    /// Timestamp of last server heartbeat (internal)
23    #[serde(rename = "last_server_ping", skip_serializing_if = "Option::is_none")]
24    pub last_server_ping: Option<String>,
25    /// Last error message if the trigger failed
26    #[serde(rename = "error", skip_serializing_if = "Option::is_none")]
27    pub error: Option<String>,
28    /// Array of key-value filters to match incoming messages (only matching messages trigger the script)
29    #[serde(rename = "filters")]
30    pub filters: Vec<serde_json::Value>,
31    /// Logic to apply when evaluating filters. 'and' requires all filters to match, 'or' requires any filter to match.
32    #[serde(rename = "filter_logic", skip_serializing_if = "Option::is_none")]
33    pub filter_logic: Option<FilterLogic>,
34    /// Messages to send immediately after connecting (can be raw strings or computed by runnables)
35    #[serde(rename = "initial_messages", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
36    pub initial_messages: Option<Option<Vec<models::WebsocketTriggerInitialMessage>>>,
37    /// The arguments to pass to the script or flow
38    #[serde(rename = "url_runnable_args", skip_serializing_if = "Option::is_none")]
39    pub url_runnable_args: Option<std::collections::HashMap<String, serde_json::Value>>,
40    /// If true, the script can return a message to send back through the WebSocket
41    #[serde(rename = "can_return_message")]
42    pub can_return_message: bool,
43    /// If true, error results are sent back through the WebSocket
44    #[serde(rename = "can_return_error_result")]
45    pub can_return_error_result: bool,
46    #[serde(rename = "heartbeat", skip_serializing_if = "Option::is_none")]
47    pub heartbeat: Option<Box<models::WebsocketHeartbeat>>,
48    /// Path to a script or flow to run when the triggered job fails
49    #[serde(rename = "error_handler_path", skip_serializing_if = "Option::is_none")]
50    pub error_handler_path: Option<String>,
51    /// The arguments to pass to the script or flow
52    #[serde(rename = "error_handler_args", skip_serializing_if = "Option::is_none")]
53    pub error_handler_args: Option<std::collections::HashMap<String, serde_json::Value>>,
54    #[serde(rename = "retry", skip_serializing_if = "Option::is_none")]
55    pub retry: Option<Box<models::Retry>>,
56    /// The unique Windmill path for this trigger. Must be of the form `u/<user>/<path>` or `f/<folder>/<path>`. This is the trigger object path, not the HTTP route path.
57    #[serde(rename = "path")]
58    pub path: String,
59    /// Path to the script or flow to execute when triggered
60    #[serde(rename = "script_path")]
61    pub script_path: String,
62    /// The user or group this trigger runs as (permissioned_as)
63    #[serde(rename = "permissioned_as")]
64    pub permissioned_as: String,
65    /// Additional permissions for this trigger
66    #[serde(rename = "extra_perms")]
67    pub extra_perms: std::collections::HashMap<String, bool>,
68    /// The workspace this trigger belongs to
69    #[serde(rename = "workspace_id")]
70    pub workspace_id: String,
71    /// Username of the last person who edited this trigger
72    #[serde(rename = "edited_by")]
73    pub edited_by: String,
74    /// Timestamp of the last edit
75    #[serde(rename = "edited_at")]
76    pub edited_at: String,
77    /// True if script_path points to a flow, false if it points to a script
78    #[serde(rename = "is_flow")]
79    pub is_flow: bool,
80    #[serde(rename = "mode")]
81    pub mode: models::TriggerMode,
82    #[serde(rename = "labels", skip_serializing_if = "Option::is_none")]
83    pub labels: Option<Vec<String>>,
84    /// True when this row is a per-user draft with no deployed trigger at the same path. Set by list endpoints when `include_draft_only=true` synthesizes the row from the draft. Frontend renders a \"Draft\" badge. 
85    #[serde(rename = "draft_only", skip_serializing_if = "Option::is_none")]
86    pub draft_only: Option<bool>,
87    #[serde(rename = "is_draft")]
88    pub is_draft: bool,
89    #[serde(rename = "draft_saved_at", skip_serializing_if = "Option::is_none")]
90    pub draft_saved_at: Option<String>,
91    #[serde(rename = "no_deployed", skip_serializing_if = "Option::is_none")]
92    pub no_deployed: Option<bool>,
93    #[serde(rename = "draft", skip_serializing_if = "Option::is_none")]
94    pub draft: Option<std::collections::HashMap<String, serde_json::Value>>,
95    /// Other workspace users (and the legacy NULL-email row, if any) with a saved draft at the same path. Populated only on the authed user's \"get by path\" responses for kinds the editor surfaces a fork banner for (script, flow, app, raw_app). Empty / omitted for kinds without that UI. 
96    #[serde(rename = "other_drafts_users", skip_serializing_if = "Option::is_none")]
97    pub other_drafts_users: Option<Vec<models::UserDraftOverlayOtherDraftsUsersInner>>,
98}
99
100impl GetWebsocketTrigger200Response {
101    pub fn new(url: String, filters: Vec<serde_json::Value>, can_return_message: bool, can_return_error_result: bool, path: String, script_path: String, permissioned_as: String, extra_perms: std::collections::HashMap<String, bool>, workspace_id: String, edited_by: String, edited_at: String, is_flow: bool, mode: models::TriggerMode, is_draft: bool) -> GetWebsocketTrigger200Response {
102        GetWebsocketTrigger200Response {
103            url,
104            server_id: None,
105            last_server_ping: None,
106            error: None,
107            filters,
108            filter_logic: None,
109            initial_messages: None,
110            url_runnable_args: None,
111            can_return_message,
112            can_return_error_result,
113            heartbeat: None,
114            error_handler_path: None,
115            error_handler_args: None,
116            retry: None,
117            path,
118            script_path,
119            permissioned_as,
120            extra_perms,
121            workspace_id,
122            edited_by,
123            edited_at,
124            is_flow,
125            mode,
126            labels: None,
127            draft_only: None,
128            is_draft,
129            draft_saved_at: None,
130            no_deployed: None,
131            draft: None,
132            other_drafts_users: None,
133        }
134    }
135}
136/// Logic to apply when evaluating filters. 'and' requires all filters to match, 'or' requires any filter to match.
137#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
138pub enum FilterLogic {
139    #[serde(rename = "and")]
140    And,
141    #[serde(rename = "or")]
142    Or,
143}
144
145impl Default for FilterLogic {
146    fn default() -> FilterLogic {
147        Self::And
148    }
149}
150