Skip to main content

windmill_api/models/
native_trigger_with_external.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.848.3
7 * Contact: contact@windmill.dev
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// NativeTriggerWithExternal : Full trigger response containing both Windmill data and external service data
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct NativeTriggerWithExternal {
17    /// The unique identifier from the external service
18    #[serde(rename = "external_id")]
19    pub external_id: String,
20    /// The workspace this trigger belongs to
21    #[serde(rename = "workspace_id")]
22    pub workspace_id: String,
23    #[serde(rename = "service_name")]
24    pub service_name: models::NativeServiceName,
25    /// The path to the script or flow that will be triggered
26    #[serde(rename = "script_path")]
27    pub script_path: String,
28    /// Whether the trigger targets a flow (true) or a script (false)
29    #[serde(rename = "is_flow")]
30    pub is_flow: bool,
31    /// Configuration for the trigger including event_type and service_config
32    #[serde(rename = "service_config")]
33    pub service_config: std::collections::HashMap<String, serde_json::Value>,
34    /// Error message if the trigger is in an error state
35    #[serde(rename = "error", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
36    pub error: Option<Option<String>>,
37    /// Short summary to be displayed when listed
38    #[serde(rename = "summary", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
39    pub summary: Option<Option<String>>,
40    /// Whether the trigger starts a job when it fires
41    #[serde(rename = "enabled")]
42    pub enabled: bool,
43    /// Path of the connection the trigger acts through on the external service
44    #[serde(rename = "connection_path", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
45    pub connection_path: Option<Option<String>>,
46    /// Configuration data from the external service. Null when the service has no such API, or when it could not be read — see external_error.
47    #[serde(rename = "external_data", deserialize_with = "Option::deserialize")]
48    pub external_data: Option<std::collections::HashMap<String, serde_json::Value>>,
49    /// Why the external service configuration could not be read. When set, external_data is null and the configuration Windmill stored is returned instead.
50    #[serde(rename = "external_error", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
51    pub external_error: Option<Option<String>>,
52}
53
54impl NativeTriggerWithExternal {
55    /// Full trigger response containing both Windmill data and external service data
56    pub fn new(external_id: String, workspace_id: String, service_name: models::NativeServiceName, script_path: String, is_flow: bool, service_config: std::collections::HashMap<String, serde_json::Value>, enabled: bool, external_data: Option<std::collections::HashMap<String, serde_json::Value>>) -> NativeTriggerWithExternal {
57        NativeTriggerWithExternal {
58            external_id,
59            workspace_id,
60            service_name,
61            script_path,
62            is_flow,
63            service_config,
64            error: None,
65            summary: None,
66            enabled,
67            connection_path: None,
68            external_data,
69            external_error: None,
70        }
71    }
72}
73