rive_http/channels/
webhooks.rs1use rive_models::{data::CreateWebhookData, webhook::Webhook};
2
3use crate::prelude::*;
4
5impl Client {
6 pub async fn create_webhook(
8 &self,
9 channel_id: impl Into<String>,
10 data: CreateWebhookData,
11 ) -> Result<Webhook> {
12 Ok(self
13 .client
14 .post(ep!(self, "/channels/{}/webhooks", channel_id.into()))
15 .json(&data)
16 .auth(&self.authentication)
17 .send()
18 .await?
19 .process_error()
20 .await?
21 .json()
22 .await?)
23 }
24
25 pub async fn get_all_webhooks(&self, channel_id: impl Into<String>) -> Result<Vec<Webhook>> {
27 Ok(self
28 .client
29 .get(ep!(self, "/channels/{}/webhooks", channel_id.into()))
30 .auth(&self.authentication)
31 .send()
32 .await?
33 .process_error()
34 .await?
35 .json()
36 .await?)
37 }
38}