aboutsummaryrefslogtreecommitdiff
path: root/src/model/invite.rs
blob: 4324a67faa54bcc4a25ad40bfef1dc491ced621e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
use super::{Invite, RichInvite};
use ::client::http;
use ::prelude::*;

impl Invite {
    /// Accepts an invite.
    ///
    /// Refer to the documentation for [`Context::accept_invite`] for
    /// restrictions on accepting an invite.
    ///
    /// [`Context::accept_invite`]: ../client/struct.Context.html#method.accept_invite
    pub fn accept(&self) -> Result<Invite> {
        http::accept_invite(&self.code)
    }

    /// Deletes an invite.
    ///
    /// Refer to the documentation for [`Context::delete_invite`] for more
    /// information.
    ///
    /// [`Context::delete_invite`]: ../client/struct.Context.html#method.delete_invite
    pub fn delete(&self) -> Result<Invite> {
        http::delete_invite(&self.code)
    }
}

impl RichInvite {
    /// Accepts an invite.
    ///
    /// Refer to the documentation for [`Context::accept_invite`] for
    /// restrictions on accepting an invite.
    ///
    /// [`Context::accept_invite`]: ../client/struct.Context.html#method.accept_invite
    pub fn accept(&self) -> Result<Invite> {
        http::accept_invite(&self.code)
    }

    /// Deletes an invite.
    ///
    /// Refer to the documentation for [`Context::delete_invite`] for more
    /// information.
    ///
    /// [`Context::delete_invite`]: ../client/struct.Context.html#method.delete_invite
    pub fn delete(&self) -> Result<Invite> {
        http::delete_invite(&self.code)
    }
}