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.863.0
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    /// Filters to match incoming messages (only matching messages trigger the script). Each entry is either a leaf `{key, value}` (top-level field) or `{path, value}` (dotted path into nested objects), or a group `{any_of: [...]}` / `{all_of: [...]}` / `{none_of: [...]}` nesting more entries. Entries at the top level are combined with `filter_logic`.
29    #[serde(rename = "filters")]
30    pub filters: Vec<models::TriggerFilter>,
31    /// Logic to apply when evaluating the top-level filters. 'and' requires all of them to match, 'or' requires any of them to match. Nested `any_of`/`all_of`/`none_of` groups carry their own logic.
32    #[serde(rename = "filter_logic", skip_serializing_if = "Option::is_none")]
33    pub filter_logic: Option<FilterLogic>,
34    /// Whether a message the filters cannot read (not UTF-8, or not JSON) still runs the target, as if the trigger had no filters. A preprocessor then finds the reason in `event.filter_error`. When false, such a message is skipped.
35    #[serde(rename = "run_on_filter_error", skip_serializing_if = "Option::is_none")]
36    pub run_on_filter_error: Option<bool>,
37    /// Messages to send immediately after connecting (can be raw strings or computed by runnables)
38    #[serde(rename = "initial_messages", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
39    pub initial_messages: Option<Option<Vec<models::WebsocketTriggerInitialMessage>>>,
40    /// The arguments to pass to the script or flow
41    #[serde(rename = "url_runnable_args", skip_serializing_if = "Option::is_none")]
42    pub url_runnable_args: Option<std::collections::HashMap<String, serde_json::Value>>,
43    /// If true, the script can return a message to send back through the WebSocket
44    #[serde(rename = "can_return_message")]
45    pub can_return_message: bool,
46    /// If true, error results are sent back through the WebSocket
47    #[serde(rename = "can_return_error_result")]
48    pub can_return_error_result: bool,
49    #[serde(rename = "heartbeat", skip_serializing_if = "Option::is_none")]
50    pub heartbeat: Option<Box<models::WebsocketHeartbeat>>,
51    /// Path to a script to run when the triggered job fails. A bare path, without the script/ or flow/ prefix a schedule error handler takes; it cannot be a flow.
52    #[serde(rename = "error_handler_path", skip_serializing_if = "Option::is_none")]
53    pub error_handler_path: Option<String>,
54    /// The arguments to pass to the script or flow
55    #[serde(rename = "error_handler_args", skip_serializing_if = "Option::is_none")]
56    pub error_handler_args: Option<std::collections::HashMap<String, serde_json::Value>>,
57    #[serde(rename = "retry", skip_serializing_if = "Option::is_none")]
58    pub retry: Option<Box<models::Retry>>,
59    /// 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.
60    #[serde(rename = "path")]
61    pub path: String,
62    /// Path to the script or flow to execute when triggered
63    #[serde(rename = "script_path")]
64    pub script_path: String,
65    /// The user or group this trigger runs as (permissioned_as)
66    #[serde(rename = "permissioned_as")]
67    pub permissioned_as: String,
68    /// Additional permissions for this trigger
69    #[serde(rename = "extra_perms")]
70    pub extra_perms: std::collections::HashMap<String, bool>,
71    /// The workspace this trigger belongs to
72    #[serde(rename = "workspace_id")]
73    pub workspace_id: String,
74    /// Username of the last person who edited this trigger
75    #[serde(rename = "edited_by")]
76    pub edited_by: String,
77    /// Timestamp of the last edit
78    #[serde(rename = "edited_at")]
79    pub edited_at: String,
80    /// True if script_path points to a flow, false if it points to a script
81    #[serde(rename = "is_flow")]
82    pub is_flow: bool,
83    #[serde(rename = "mode")]
84    pub mode: models::TriggerMode,
85    #[serde(rename = "labels", skip_serializing_if = "Option::is_none")]
86    pub labels: Option<Vec<String>>,
87    /// 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. 
88    #[serde(rename = "draft_only", skip_serializing_if = "Option::is_none")]
89    pub draft_only: Option<bool>,
90    #[serde(rename = "is_draft")]
91    pub is_draft: bool,
92    #[serde(rename = "draft_saved_at", skip_serializing_if = "Option::is_none")]
93    pub draft_saved_at: Option<String>,
94    /// The deployed version the draft forked from, as text whatever the kind (script hash, flow version id, app version id). Compare to the deployed head to tell a draft that is behind. Absent when there is no draft or it was never forked from a deploy. 
95    #[serde(rename = "draft_base", skip_serializing_if = "Option::is_none")]
96    pub draft_base: Option<String>,
97    #[serde(rename = "no_deployed", skip_serializing_if = "Option::is_none")]
98    pub no_deployed: Option<bool>,
99    #[serde(rename = "draft", skip_serializing_if = "Option::is_none")]
100    pub draft: Option<std::collections::HashMap<String, serde_json::Value>>,
101    /// 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. 
102    #[serde(rename = "other_drafts_users", skip_serializing_if = "Option::is_none")]
103    pub other_drafts_users: Option<Vec<models::UserDraftOverlayOtherDraftsUsersInner>>,
104}
105
106impl GetWebsocketTrigger200Response {
107    pub fn new(url: String, filters: Vec<models::TriggerFilter>, 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 {
108        GetWebsocketTrigger200Response {
109            url,
110            server_id: None,
111            last_server_ping: None,
112            error: None,
113            filters,
114            filter_logic: None,
115            run_on_filter_error: None,
116            initial_messages: None,
117            url_runnable_args: None,
118            can_return_message,
119            can_return_error_result,
120            heartbeat: None,
121            error_handler_path: None,
122            error_handler_args: None,
123            retry: None,
124            path,
125            script_path,
126            permissioned_as,
127            extra_perms,
128            workspace_id,
129            edited_by,
130            edited_at,
131            is_flow,
132            mode,
133            labels: None,
134            draft_only: None,
135            is_draft,
136            draft_saved_at: None,
137            draft_base: None,
138            no_deployed: None,
139            draft: None,
140            other_drafts_users: None,
141        }
142    }
143}
144/// Logic to apply when evaluating the top-level filters. 'and' requires all of them to match, 'or' requires any of them to match. Nested `any_of`/`all_of`/`none_of` groups carry their own logic.
145#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
146pub enum FilterLogic {
147    #[serde(rename = "and")]
148    And,
149    #[serde(rename = "or")]
150    Or,
151}
152
153impl Default for FilterLogic {
154    fn default() -> FilterLogic {
155        Self::And
156    }
157}
158