flow_bot/event/
meta_event.rs1use serde::Deserialize;
2
3use crate::{api::BotStatus, impl_from_event};
4
5#[derive(Deserialize, Debug, Clone)]
6#[serde(rename_all = "snake_case")]
7pub enum LifecycleSubType {
8 Enable,
9 Disable,
10 Connect,
11}
12
13#[derive(Deserialize, Debug, Clone)]
14pub struct Lifecycle {
15 pub sub_type: LifecycleSubType,
16}
17
18#[derive(Deserialize, Debug, Clone)]
19pub struct Heartbeat {
20 pub interval: i64,
21 pub status: BotStatus,
22}
23
24#[derive(Deserialize, Debug, Clone)]
25#[serde(tag = "meta_event_type", rename_all = "snake_case")]
26pub enum MetaEvent {
27 Lifecycle(Lifecycle),
28 Heartbeat(Heartbeat),
29}
30
31impl_from_event!(MetaEvent);
32
33impl_from_event!(MetaEvent, Lifecycle);
34
35impl_from_event!(MetaEvent, Heartbeat);