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.778.0
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    /// Configuration data from the external service. Null when the service has no such API, or when it could not be read — see external_error.
41    #[serde(rename = "external_data", deserialize_with = "Option::deserialize")]
42    pub external_data: Option<std::collections::HashMap<String, serde_json::Value>>,
43    /// Why the external service configuration could not be read. When set, external_data is null and the configuration Windmill stored is returned instead.
44    #[serde(rename = "external_error", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
45    pub external_error: Option<Option<String>>,
46}
47
48impl NativeTriggerWithExternal {
49    /// Full trigger response containing both Windmill data and external service data
50    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>, external_data: Option<std::collections::HashMap<String, serde_json::Value>>) -> NativeTriggerWithExternal {
51        NativeTriggerWithExternal {
52            external_id,
53            workspace_id,
54            service_name,
55            script_path,
56            is_flow,
57            service_config,
58            error: None,
59            summary: None,
60            external_data,
61            external_error: None,
62        }
63    }
64}
65