diff options
| author | Austin Hellyer <[email protected]> | 2016-09-19 09:00:03 -0700 |
|---|---|---|
| committer | Austin Hellyer <[email protected]> | 2016-10-18 11:14:27 -0700 |
| commit | 8fc8c81403c3daa187ba96a7d488a64db21463bf (patch) | |
| tree | 81bc4890c28b08ce806f69084617066bce863c2d /src/model/invite.rs | |
| download | serenity-8fc8c81403c3daa187ba96a7d488a64db21463bf.tar.xz serenity-8fc8c81403c3daa187ba96a7d488a64db21463bf.zip | |
Initial commit
Diffstat (limited to 'src/model/invite.rs')
| -rw-r--r-- | src/model/invite.rs | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/model/invite.rs b/src/model/invite.rs new file mode 100644 index 0000000..4324a67 --- /dev/null +++ b/src/model/invite.rs @@ -0,0 +1,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) + } +} |