rive_http/customisation/
emojis.rs1use rive_models::{data::CreateEmojiData, emoji::Emoji};
2
3use crate::prelude::*;
4
5impl Client {
6 pub async fn fetch_emoji(&self, id: impl Into<String>) -> Result<Emoji> {
8 Ok(self
9 .client
10 .get(ep!(self, "/custom/emoji/{}", id.into()))
11 .auth(&self.authentication)
12 .send()
13 .await?
14 .process_error()
15 .await?
16 .json()
17 .await?)
18 }
19
20 pub async fn create_new_emoji(
22 &self,
23 id: impl Into<String>,
24 data: CreateEmojiData,
25 ) -> Result<Emoji> {
26 Ok(self
27 .client
28 .put(ep!(self, "/custom/emoji/{}", id.into()))
29 .json(&data)
30 .auth(&self.authentication)
31 .send()
32 .await?
33 .process_error()
34 .await?
35 .json()
36 .await?)
37 }
38
39 pub async fn delete_emoji(&self, id: impl Into<String>) -> Result<()> {
41 self.client
42 .delete(ep!(self, "/custom/emoji/{}", id.into()))
43 .auth(&self.authentication)
44 .send()
45 .await?
46 .process_error()
47 .await?;
48 Ok(())
49 }
50}