Skip to main content

dingtalk_sdk/types/
webhook.rs

1use serde::Serialize;
2
3/// Multi-button `actionCard` button item.
4#[derive(Debug, Clone, Serialize)]
5pub struct ActionCardButton {
6    /// Button title.
7    pub title: String,
8    /// Redirect URL after clicking the button.
9    #[serde(rename = "actionURL")]
10    pub action_url: String,
11}
12
13impl ActionCardButton {
14    /// Creates an action-card button.
15    #[must_use]
16    pub fn new(title: impl Into<String>, action_url: impl Into<String>) -> Self {
17        Self {
18            title: title.into(),
19            action_url: action_url.into(),
20        }
21    }
22}
23
24/// `feedCard` link item.
25#[derive(Debug, Clone, Serialize)]
26pub struct FeedCardLink {
27    /// Link title.
28    pub title: String,
29    /// Message jump URL.
30    #[serde(rename = "messageURL")]
31    pub message_url: String,
32    /// Image URL.
33    #[serde(rename = "picURL")]
34    pub pic_url: String,
35}
36
37impl FeedCardLink {
38    /// Creates a feed-card link.
39    #[must_use]
40    pub fn new(
41        title: impl Into<String>,
42        message_url: impl Into<String>,
43        pic_url: impl Into<String>,
44    ) -> Self {
45        Self {
46            title: title.into(),
47            message_url: message_url.into(),
48            pic_url: pic_url.into(),
49        }
50    }
51}