rive_http/invites/
invites.rs1use crate::prelude::*;
2use rive_models::invite::{Invite, InviteJoin};
3
4impl Client {
5 pub async fn fetch_invite(&self, id: impl Into<String>) -> Result<Invite> {
7 Ok(self
8 .client
9 .get(ep!(self, "/invites/{}", 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 join_invite(&self, id: impl Into<String>) -> Result<InviteJoin> {
21 Ok(self
22 .client
23 .post(ep!(self, "/invites/{}", id.into()))
24 .auth(&self.authentication)
25 .send()
26 .await?
27 .process_error()
28 .await?
29 .json()
30 .await?)
31 }
32
33 pub async fn delete_invite(&self, id: impl Into<String>) -> Result<()> {
35 self.client
36 .delete(ep!(self, "/invites/{}", id.into()))
37 .auth(&self.authentication)
38 .send()
39 .await?
40 .process_error()
41 .await?;
42 Ok(())
43 }
44}