use crate::service::stream::{publish_to_stream, Error, Stream}; use serde::{Deserialize, Serialize}; // TODO: define schema type in other place #[derive(Deserialize, Serialize)] #[serde(rename_all = "camelCase")] #[crate::export(object)] pub struct PackedEmoji { pub id: String, pub aliases: Vec, pub name: String, pub category: Option, pub host: Option, pub url: String, pub license: Option, pub width: Option, pub height: Option, } #[crate::export(js_name = "publishToBroadcastStream")] pub fn publish(emoji: &PackedEmoji) -> Result<(), Error> { publish_to_stream( &Stream::CustomEmoji, Some("emojiAdded".to_string()), Some(format!("{{\"emoji\":{}}}", serde_json::to_string(emoji)?)), ) }