Skip to main content

firefly_iii/models/
webhook_update.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 WebhookUpdate {
18    /// Boolean to indicate if the webhook is active
19    #[serde(rename = "active", skip_serializing_if = "Option::is_none")]
20    pub active: Option<bool>,
21    /// A title for the webhook for easy recognition.
22    #[serde(rename = "title", skip_serializing_if = "Option::is_none")]
23    pub title: Option<String>,
24    /// A 24-character secret for the webhook. It's generated by Firefly III when saving a new webhook. If you submit a new secret through the PUT endpoint it will generate a new secret for the selected webhook, a new secret bearing no relation to whatever you just submitted.
25    #[serde(rename = "secret", skip_serializing_if = "Option::is_none")]
26    pub secret: Option<String>,
27    #[serde(rename = "triggers", skip_serializing_if = "Option::is_none")]
28    pub triggers: Option<Vec<models::WebhookTrigger>>,
29    #[serde(rename = "responses", skip_serializing_if = "Option::is_none")]
30    pub responses: Option<Vec<models::WebhookResponse>>,
31    #[serde(rename = "deliveries", skip_serializing_if = "Option::is_none")]
32    pub deliveries: Option<Vec<models::WebhookDelivery>>,
33    /// The URL of the webhook. Has to start with `https`.
34    #[serde(rename = "url", skip_serializing_if = "Option::is_none")]
35    pub url: Option<String>,
36}
37
38impl WebhookUpdate {
39    pub fn new() -> WebhookUpdate {
40        WebhookUpdate {
41            active: None,
42            title: None,
43            secret: None,
44            triggers: None,
45            responses: None,
46            deliveries: None,
47            url: None,
48        }
49    }
50}
51
52impl fmt::Display for WebhookUpdate {
53    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
54        match serde_json::to_string(self) {
55            Ok(json) => write!(f, "{}", json),
56            Err(_) => write!(f, "{{{{}}}}"),
57        }
58    }
59}