Skip to main content

windmill_api/models/
edit_websocket_trigger.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.626.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 EditWebsocketTrigger {
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    /// The unique path identifier for this trigger
20    #[serde(rename = "path")]
21    pub path: String,
22    /// Path to the script or flow to execute when a message is received
23    #[serde(rename = "script_path")]
24    pub script_path: String,
25    /// True if script_path points to a flow, false if it points to a script
26    #[serde(rename = "is_flow")]
27    pub is_flow: bool,
28    /// Array of key-value filters to match incoming messages (only matching messages trigger the script)
29    #[serde(rename = "filters")]
30    pub filters: Vec<models::NewWebsocketTriggerFiltersInner>,
31    /// Messages to send immediately after connecting (can be raw strings or computed by runnables)
32    #[serde(rename = "initial_messages", skip_serializing_if = "Option::is_none")]
33    pub initial_messages: Option<Vec<models::WebsocketTriggerInitialMessage>>,
34    /// The arguments to pass to the script or flow
35    #[serde(rename = "url_runnable_args", skip_serializing_if = "Option::is_none")]
36    pub url_runnable_args: Option<std::collections::HashMap<String, serde_json::Value>>,
37    /// If true, the script can return a message to send back through the WebSocket
38    #[serde(rename = "can_return_message")]
39    pub can_return_message: bool,
40    /// If true, error results are sent back through the WebSocket
41    #[serde(rename = "can_return_error_result")]
42    pub can_return_error_result: bool,
43    /// Path to a script or flow to run when the triggered job fails
44    #[serde(rename = "error_handler_path", skip_serializing_if = "Option::is_none")]
45    pub error_handler_path: Option<String>,
46    /// The arguments to pass to the script or flow
47    #[serde(rename = "error_handler_args", skip_serializing_if = "Option::is_none")]
48    pub error_handler_args: Option<std::collections::HashMap<String, serde_json::Value>>,
49    #[serde(rename = "retry", skip_serializing_if = "Option::is_none")]
50    pub retry: Option<Box<models::Retry>>,
51}
52
53impl EditWebsocketTrigger {
54    pub fn new(url: String, path: String, script_path: String, is_flow: bool, filters: Vec<models::NewWebsocketTriggerFiltersInner>, can_return_message: bool, can_return_error_result: bool) -> EditWebsocketTrigger {
55        EditWebsocketTrigger {
56            url,
57            path,
58            script_path,
59            is_flow,
60            filters,
61            initial_messages: None,
62            url_runnable_args: None,
63            can_return_message,
64            can_return_error_result,
65            error_handler_path: None,
66            error_handler_args: None,
67            retry: None,
68        }
69    }
70}
71