Skip to main content

firefly_iii/models/
webhook_store.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 WebhookStore {
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")]
23    pub title: String,
24    #[serde(rename = "triggers", skip_serializing_if = "Option::is_none")]
25    pub triggers: Option<Vec<models::WebhookTrigger>>,
26    #[serde(rename = "responses", skip_serializing_if = "Option::is_none")]
27    pub responses: Option<Vec<models::WebhookResponse>>,
28    #[serde(rename = "deliveries", skip_serializing_if = "Option::is_none")]
29    pub deliveries: Option<Vec<models::WebhookDelivery>>,
30    /// The URL of the webhook. Has to start with `https`.
31    #[serde(rename = "url")]
32    pub url: String,
33}
34
35impl WebhookStore {
36    pub fn new(title: String, url: String) -> WebhookStore {
37        WebhookStore {
38            active: None,
39            title,
40            triggers: None,
41            responses: None,
42            deliveries: None,
43            url,
44        }
45    }
46}
47
48impl fmt::Display for WebhookStore {
49    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
50        match serde_json::to_string(self) {
51            Ok(json) => write!(f, "{}", json),
52            Err(_) => write!(f, "{{{{}}}}"),
53        }
54    }
55}