Skip to main content

firefly_iii/models/
rule_trigger.rs

1/*
2 * Firefly III API v6.4.14
3 *
4 * This is the documentation of the Firefly III API. Please report any bugs or issues. You may use the \"Authorize\" button to try the API below. <br><br> Please keep in mind that the demo site does **not** accept requests from `curl`, `colly`, `wget`, etc. You must use a browser or a tool like Insomnia to make your test requests. <br><br> To learn more about the idiosyncrasies of this API, please read about the API in the [Firefly III API documentation](https://docs.firefly-iii.org/references/firefly-iii/api/). <br><br> <small>This file was last generated on 2025-12-26 @ 15:17:41 (Europe/Amsterdam)</small>
5 *
6 * The version of the OpenAPI document: v6.4.14
7 * Contact: james@firefly-iii.org
8 * Generated by: https://openapi-generator.tech
9 */
10
11#![allow(unused_imports)]
12
13use crate::models::{self, *};
14use std::fmt;
15
16#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
17pub struct RuleTrigger {
18    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
19    pub id: Option<String>,
20    #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")]
21    pub created_at: Option<String>,
22    #[serde(rename = "updated_at", skip_serializing_if = "Option::is_none")]
23    pub updated_at: Option<String>,
24    #[serde(rename = "type")]
25    pub r#type: models::RuleTriggerKeyword,
26    /// The accompanying value the trigger responds to. This value is often mandatory, but this depends on the trigger.
27    #[serde(rename = "value")]
28    pub value: String,
29    /// If 'prohibited' is true, this rule trigger will be negated. 'Description is' will become 'Description is NOT' etc.
30    #[serde(rename = "prohibited", skip_serializing_if = "Option::is_none")]
31    pub prohibited: Option<bool>,
32    /// Order of the trigger
33    #[serde(rename = "order", skip_serializing_if = "Option::is_none")]
34    pub order: Option<i32>,
35    /// If the trigger is active. Defaults to true.
36    #[serde(rename = "active", skip_serializing_if = "Option::is_none")]
37    pub active: Option<bool>,
38    /// When true, other triggers will not be checked if this trigger was triggered. Defaults to false.
39    #[serde(rename = "stop_processing", skip_serializing_if = "Option::is_none")]
40    pub stop_processing: Option<bool>,
41}
42
43impl RuleTrigger {
44    pub fn new(r#type: models::RuleTriggerKeyword, value: String) -> RuleTrigger {
45        RuleTrigger {
46            id: None,
47            created_at: None,
48            updated_at: None,
49            r#type,
50            value,
51            prohibited: None,
52            order: None,
53            active: None,
54            stop_processing: None,
55        }
56    }
57}
58
59impl fmt::Display for RuleTrigger {
60    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
61        match serde_json::to_string(self) {
62            Ok(json) => write!(f, "{}", json),
63            Err(_) => write!(f, "{{{{}}}}"),
64        }
65    }
66}