1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
use crate::blocks;
use crate::composition::Text;
use serde::{Deserialize, Serialize};
#[derive(Debug, Deserialize, Serialize)]
pub struct Message {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub text: Option<String>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub blocks: Vec<blocks::Block>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub thread_ts: Option<String>,
#[serde(default = "default_mrkdwn")]
pub mrkdwn: bool,
}
fn default_mrkdwn() -> bool {
true
}
impl Default for Message {
fn default() -> Self {
Self {
text: None,
blocks: Vec::new(),
thread_ts: None,
mrkdwn: true,
}
}
}
#[derive(Debug, Deserialize, Serialize, Default)]
pub struct Modal {
pub title: Text,
pub submit: Text,
pub close: Text,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub blocks: Vec<blocks::Block>,
}