#![doc(alias = "channel.goal")]
use super::{EventSubscription, EventType};
use crate::types;
use serde_derive::{Deserialize, Serialize};
pub mod clear;
pub mod clear_user_messages;
pub mod message;
pub mod message_delete;
pub mod notification;
pub mod user_message_hold;
pub mod user_message_update;
#[doc(inline)]
pub use clear::{ChannelChatClearV1, ChannelChatClearV1Payload};
#[doc(inline)]
pub use clear_user_messages::{
ChannelChatClearUserMessagesV1, ChannelChatClearUserMessagesV1Payload,
};
#[doc(inline)]
pub use message::{ChannelChatMessageV1, ChannelChatMessageV1Payload};
#[doc(inline)]
pub use message_delete::{ChannelChatMessageDeleteV1, ChannelChatMessageDeleteV1Payload};
#[doc(inline)]
pub use notification::{ChannelChatNotificationV1, ChannelChatNotificationV1Payload};
#[doc(inline)]
pub use user_message_hold::{ChannelChatUserMessageHoldV1, ChannelChatUserMessageHoldV1Payload};
#[doc(inline)]
pub use user_message_update::{
ChannelChatUserMessageUpdateV1, ChannelChatUserMessageUpdateV1Payload,
};
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct Message {
pub text: String,
pub fragments: Vec<Fragment>,
}
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
#[serde(tag = "type", rename_all = "snake_case")]
#[non_exhaustive]
pub enum Fragment {
Cheermote {
text: String,
cheermote: Cheermote,
},
Emote {
text: String,
emote: Emote,
},
Mention {
text: String,
mention: Mention,
},
Text {
text: String,
},
}
impl Fragment {
pub fn text(&self) -> &str {
match self {
Self::Cheermote { text, .. } => text,
Self::Emote { text, .. } => text,
Self::Mention { text, .. } => text,
Self::Text { text } => text,
}
}
}
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "deny_unknown_fields", serde(deny_unknown_fields))]
#[non_exhaustive]
pub struct Cheermote {
pub prefix: String,
pub bits: i32,
pub tier: i32,
}
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "deny_unknown_fields", serde(deny_unknown_fields))]
#[non_exhaustive]
pub struct Emote {
pub id: types::EmoteId,
pub emote_set_id: types::EmoteSetId,
pub owner_id: types::UserId,
pub format: Vec<types::EmoteAnimationSetting>,
}
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "deny_unknown_fields", serde(deny_unknown_fields))]
#[non_exhaustive]
pub struct Mention {
pub user_id: types::UserId,
pub user_name: types::DisplayName,
pub user_login: types::UserName,
}
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "deny_unknown_fields", serde(deny_unknown_fields))]
#[non_exhaustive]
pub struct Badge {
pub set_id: types::BadgeSetId,
pub id: types::ChatBadgeId,
pub info: String,
}