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.617.1
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    /// Configuration data from the external service
38    #[serde(rename = "external_data")]
39    pub external_data: std::collections::HashMap<String, serde_json::Value>,
40}
41
42impl NativeTriggerWithExternal {
43    /// Full trigger response containing both Windmill data and external service data
44    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: std::collections::HashMap<String, serde_json::Value>) -> NativeTriggerWithExternal {
45        NativeTriggerWithExternal {
46            external_id,
47            workspace_id,
48            service_name,
49            script_path,
50            is_flow,
51            service_config,
52            error: None,
53            external_data,
54        }
55    }
56}
57