firefly_iii/models/
webhook_store.rs1#![allow(unused_imports)]
12
13use crate::models::{self, *};
14use std::fmt;
15
16#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
17pub struct WebhookStore {
18 #[serde(rename = "active", skip_serializing_if = "Option::is_none")]
20 pub active: Option<bool>,
21 #[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 #[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}