use af_core::prelude::*;
#[derive(Debug, Serialize)]
pub struct Text<'a> {
#[serde(rename = "type")]
pub kind: TextKind,
pub text: Cow<'a, str>,
}
impl<'a> Text<'a> {
pub fn mrkdwn(text: impl Into<Cow<'a, str>>) -> Self {
Self { kind: TextKind::Mrkdwn, text: text.into() }
}
pub fn plain(text: impl Into<Cow<'a, str>>) -> Self {
Self { kind: TextKind::Plain, text: text.into() }
}
}
#[derive(Debug, Serialize)]
pub enum TextKind {
#[serde(rename = "mrkdwn")]
Mrkdwn,
#[serde(rename = "plain_text")]
Plain,
}