rive_http/channels/
interactions.rs1use rive_models::data::RemoveReactionToMessageData;
2
3use crate::prelude::*;
4
5impl Client {
6 pub async fn add_reaction_to_message(
8 &self,
9 channel_id: impl Into<String>,
10 message_id: impl Into<String>,
11 emoji: impl Into<String>,
12 ) -> Result<()> {
13 self.client
14 .put(ep!(
15 self,
16 "/channels/{}/messages/{}/reactions/{}",
17 channel_id.into(),
18 message_id.into(),
19 emoji.into()
20 ))
21 .auth(&self.authentication)
22 .send()
23 .await?
24 .process_error()
25 .await?;
26 Ok(())
27 }
28
29 pub async fn remove_reaction_to_message(
35 &self,
36 channel_id: impl Into<String>,
37 message_id: impl Into<String>,
38 emoji: impl Into<String>,
39 data: RemoveReactionToMessageData,
40 ) -> Result<()> {
41 self.client
42 .delete(ep!(
43 self,
44 "/channels/{}/messages/{}/reactions/{}",
45 channel_id.into(),
46 message_id.into(),
47 emoji.into()
48 ))
49 .query(&data)
50 .auth(&self.authentication)
51 .send()
52 .await?
53 .process_error()
54 .await?;
55 Ok(())
56 }
57
58 pub async fn remove_all_reactions_from_message(
64 &self,
65 channel_id: impl Into<String>,
66 message_id: impl Into<String>,
67 ) -> Result<()> {
68 self.client
69 .delete(ep!(
70 self,
71 "/channels/{}/messages/{}/reactions",
72 channel_id.into(),
73 message_id.into(),
74 ))
75 .auth(&self.authentication)
76 .send()
77 .await?
78 .process_error()
79 .await?;
80 Ok(())
81 }
82}