summaryrefslogtreecommitdiff
path: root/src/emotes.rs
blob: 608f7a93a050dfddf057f0ec300fba574feeb21a (plain)
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
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>;
}