1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
/*
* Windmill API
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.864.0
* Contact: contact@windmill.dev
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct GetWebsocketTrigger200Response {
/// The WebSocket URL to connect to (can be a static URL or computed by a runnable)
#[serde(rename = "url")]
pub url: String,
/// ID of the server currently handling this trigger (internal)
#[serde(rename = "server_id", skip_serializing_if = "Option::is_none")]
pub server_id: Option<String>,
/// Timestamp of last server heartbeat (internal)
#[serde(rename = "last_server_ping", skip_serializing_if = "Option::is_none")]
pub last_server_ping: Option<String>,
/// Last error message if the trigger failed
#[serde(rename = "error", skip_serializing_if = "Option::is_none")]
pub error: Option<String>,
/// 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`.
#[serde(rename = "filters")]
pub filters: Vec<models::TriggerFilter>,
/// 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.
#[serde(rename = "filter_logic", skip_serializing_if = "Option::is_none")]
pub filter_logic: Option<FilterLogic>,
/// 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.
#[serde(rename = "run_on_filter_error", skip_serializing_if = "Option::is_none")]
pub run_on_filter_error: Option<bool>,
/// Messages to send immediately after connecting (can be raw strings or computed by runnables)
#[serde(rename = "initial_messages", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
pub initial_messages: Option<Option<Vec<models::WebsocketTriggerInitialMessage>>>,
/// The arguments to pass to the script or flow
#[serde(rename = "url_runnable_args", skip_serializing_if = "Option::is_none")]
pub url_runnable_args: Option<std::collections::HashMap<String, serde_json::Value>>,
/// If true, the script can return a message to send back through the WebSocket
#[serde(rename = "can_return_message")]
pub can_return_message: bool,
/// If true, error results are sent back through the WebSocket
#[serde(rename = "can_return_error_result")]
pub can_return_error_result: bool,
#[serde(rename = "heartbeat", skip_serializing_if = "Option::is_none")]
pub heartbeat: Option<Box<models::WebsocketHeartbeat>>,
/// 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.
#[serde(rename = "error_handler_path", skip_serializing_if = "Option::is_none")]
pub error_handler_path: Option<String>,
/// The arguments to pass to the script or flow
#[serde(rename = "error_handler_args", skip_serializing_if = "Option::is_none")]
pub error_handler_args: Option<std::collections::HashMap<String, serde_json::Value>>,
#[serde(rename = "retry", skip_serializing_if = "Option::is_none")]
pub retry: Option<Box<models::Retry>>,
/// 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.
#[serde(rename = "path")]
pub path: String,
/// Path to the script or flow to execute when triggered
#[serde(rename = "script_path")]
pub script_path: String,
/// The user or group this trigger runs as (permissioned_as)
#[serde(rename = "permissioned_as")]
pub permissioned_as: String,
/// Additional permissions for this trigger
#[serde(rename = "extra_perms")]
pub extra_perms: std::collections::HashMap<String, bool>,
/// The workspace this trigger belongs to
#[serde(rename = "workspace_id")]
pub workspace_id: String,
/// Username of the last person who edited this trigger
#[serde(rename = "edited_by")]
pub edited_by: String,
/// Timestamp of the last edit
#[serde(rename = "edited_at")]
pub edited_at: String,
/// True if script_path points to a flow, false if it points to a script
#[serde(rename = "is_flow")]
pub is_flow: bool,
#[serde(rename = "mode")]
pub mode: models::TriggerMode,
#[serde(rename = "labels", skip_serializing_if = "Option::is_none")]
pub labels: Option<Vec<String>>,
/// 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.
#[serde(rename = "draft_only", skip_serializing_if = "Option::is_none")]
pub draft_only: Option<bool>,
#[serde(rename = "is_draft")]
pub is_draft: bool,
#[serde(rename = "draft_saved_at", skip_serializing_if = "Option::is_none")]
pub draft_saved_at: Option<String>,
/// 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.
#[serde(rename = "draft_base", skip_serializing_if = "Option::is_none")]
pub draft_base: Option<String>,
#[serde(rename = "no_deployed", skip_serializing_if = "Option::is_none")]
pub no_deployed: Option<bool>,
#[serde(rename = "draft", skip_serializing_if = "Option::is_none")]
pub draft: Option<std::collections::HashMap<String, serde_json::Value>>,
/// 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.
#[serde(rename = "other_drafts_users", skip_serializing_if = "Option::is_none")]
pub other_drafts_users: Option<Vec<models::UserDraftOverlayOtherDraftsUsersInner>>,
}
impl GetWebsocketTrigger200Response {
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 {
GetWebsocketTrigger200Response {
url,
server_id: None,
last_server_ping: None,
error: None,
filters,
filter_logic: None,
run_on_filter_error: None,
initial_messages: None,
url_runnable_args: None,
can_return_message,
can_return_error_result,
heartbeat: None,
error_handler_path: None,
error_handler_args: None,
retry: None,
path,
script_path,
permissioned_as,
extra_perms,
workspace_id,
edited_by,
edited_at,
is_flow,
mode,
labels: None,
draft_only: None,
is_draft,
draft_saved_at: None,
draft_base: None,
no_deployed: None,
draft: None,
other_drafts_users: None,
}
}
}
/// 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.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum FilterLogic {
#[serde(rename = "and")]
And,
#[serde(rename = "or")]
Or,
}
impl Default for FilterLogic {
fn default() -> FilterLogic {
Self::And
}
}