line_bot_messaging_api/entity/webhook/event/
postback.rs

1use serde_derive::{Deserialize, Serialize};
2
3#[derive(Debug, Deserialize, Serialize, Clone, Default)]
4pub struct LineWebhookEventPostback {
5    #[serde(default)]
6    #[serde(rename = "data")]
7    pub data: String,
8    #[serde(default)]
9    pub params: LineWebhookEventPostbackParams,
10}
11
12#[derive(Debug, Default, Deserialize, Serialize, Clone)]
13#[serde(untagged)]
14pub enum LineWebhookEventPostbackParams {
15    Date(LineWebhookEventPostbackParamsDatetime),
16    Richmenu(LineWebhookEventPostbackParamsNewRichmenu),
17    #[default]
18    None,
19}
20
21#[derive(Debug, Deserialize, Serialize, Clone)]
22pub enum LineWebhookEventPostbackParamsDatetime {
23    #[serde(rename = "date")]
24    Date(String),
25    #[serde(rename = "time")]
26    Time(String),
27    #[serde(rename = "datetime")]
28    Datetime(String),
29}
30
31#[derive(Debug, Deserialize, Serialize, Clone)]
32pub struct LineWebhookEventPostbackParamsNewRichmenu {
33    pub status: String,
34    #[serde(rename = "newRichMenuAliasId")]
35    pub new_rich_menu_alias_id: Option<String>,
36}