1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use crate::prelude::*;
use rive_models::channel::PartialInvite;

impl Client {
    /// Creates an invite to this channel.
    ///
    /// Channel must be a [Channel::TextChannel].
    pub async fn create_invite(&self, id: impl Into<String>) -> Result<PartialInvite> {
        Ok(self
            .client
            .post(ep!(self, "/channels/{}/invites", id.into()))
            .auth(&self.authentication)
            .send()
            .await?
            .process_error()
            .await?
            .json()
            .await?)
    }
}