rive_http/channels/
channel_information.rs1use crate::prelude::*;
2use rive_models::{channel::Channel, data::EditChannelData};
3
4impl Client {
5 pub async fn fetch_channel(&self, id: impl Into<String>) -> Result<Channel> {
7 Ok(self
8 .client
9 .get(ep!(self, "/channels/{}", id.into()))
10 .auth(&self.authentication)
11 .send()
12 .await?
13 .process_error()
14 .await?
15 .json()
16 .await?)
17 }
18
19 pub async fn close_channel(&self, id: impl Into<String>) -> Result<()> {
21 self.client
22 .delete(ep!(self, "/channels/{}", id.into()))
23 .auth(&self.authentication)
24 .send()
25 .await?
26 .process_error()
27 .await?;
28 Ok(())
29 }
30
31 pub async fn edit_channel(
33 &self,
34 id: impl Into<String>,
35 data: EditChannelData,
36 ) -> Result<Channel> {
37 Ok(self
38 .client
39 .patch(ep!(self, "/channels/{}", id.into()))
40 .auth(&self.authentication)
41 .json(&data)
42 .send()
43 .await?
44 .process_error()
45 .await?
46 .json()
47 .await?)
48 }
49}