1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
use reqwest::Error;
use serde::{Deserialize, Serialize};
pub trait EmoteBase: Send + Sync {
fn get_id(&self) -> &String;
fn get_code(&self) -> &String;
fn get_original_code(&self) -> &Option<String>;
}
#[derive(Deserialize, Serialize, Clone, Debug)]
pub struct Emote {
pub id: String,
pub code: String,
pub original_code: Option<String>,
}
impl EmoteBase for Emote {
fn get_id(&self) -> &String {
&self.id
}
fn get_code(&self) -> &String {
&self.code
}
fn get_original_code(&self) -> &Option<String> {
&self.original_code
}
}
pub trait RetrieveEmoteAPI<T> {
async fn get_channel_emotes(&self, channel_login: &str) -> Result<Vec<T>, Error>;
async fn get_global_emotes(&self) -> Result<Vec<T>, Error>;
}
pub trait RetrieveEmoteWS<T> {
fn on_emote_create(&mut self, func: &'static (dyn Fn(String, Option<String>, T) + Send + Sync));
fn on_emote_update(&mut self, func: &'static (dyn Fn(String, Option<String>, T) + Send + Sync));
fn on_emote_delete(&mut self, func: &'static (dyn Fn(String, Option<String>, T) + Send + Sync));
}
|