Skip to content

Commit

Permalink
Rename 'webhooks' methods to 'get_webhooks'
Browse files Browse the repository at this point in the history
  • Loading branch information
Austin Hellyer committed Jan 24, 2017
1 parent 324ff60 commit e8a9086
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 50 deletions.
40 changes: 20 additions & 20 deletions src/model/channel.rs
Expand Up @@ -703,6 +703,16 @@ impl ChannelId {
after.map(|u| u.into().0))
}

/// Retrieves the channel's webhooks.
///
/// **Note**: Requires the [Manage Webhooks] permission.
///
/// [Manage Webhooks]: permissions/constant.MANAGE_WEBHOOKS.html
#[inline]
pub fn get_webhooks(&self) -> Result<Vec<Webhook>> {
rest::get_channel_webhooks(self.0)
}

/// Pins a [`Message`] to the channel.
#[inline]
pub fn pin<M: Into<MessageId>>(&self, message_id: M) -> Result<()> {
Expand Down Expand Up @@ -819,16 +829,6 @@ impl ChannelId {
pub fn unpin<M: Into<MessageId>>(&self, message_id: M) -> Result<()> {
rest::unpin_message(self.0, message_id.into().0)
}

/// Retrieves the channel's webhooks.
///
/// **Note**: Requires the [Manage Webhooks] permission.
///
/// [Manage Webhooks]: permissions/constant.MANAGE_WEBHOOKS.html
#[inline]
pub fn webhooks(&self) -> Result<Vec<Webhook>> {
rest::get_channel_webhooks(self.0)
}
}

impl From<Channel> for ChannelId {
Expand Down Expand Up @@ -2109,6 +2109,16 @@ impl GuildChannel {
self.id.get_reaction_users(message_id, reaction_type, limit, after)
}

/// Retrieves the channel's webhooks.
///
/// **Note**: Requires the [Manage Webhooks] permission.
///
/// [Manage Webhooks]: permissions/constant.MANAGE_WEBHOOKS.html
#[inline]
pub fn get_webhooks(&self) -> Result<Vec<Webhook>> {
self.id.get_webhooks()
}

/// Attempts to find this channel's guild in the Cache.
///
/// **Note**: Right now this performs a clone of the guild. This will be
Expand Down Expand Up @@ -2202,16 +2212,6 @@ impl GuildChannel {
pub fn unpin<M: Into<MessageId>>(&self, message_id: M) -> Result<()> {
self.id.unpin(message_id)
}

/// Retrieves the channel's webhooks.
///
/// **Note**: Requires the [Manage Webhooks] permission.
///
/// [Manage Webhooks]: permissions/constant.MANAGE_WEBHOOKS.html
#[inline]
pub fn webhooks(&self) -> Result<Vec<Webhook>> {
self.id.webhooks()
}
}

impl fmt::Display for GuildChannel {
Expand Down
60 changes: 30 additions & 30 deletions src/model/guild.rs
Expand Up @@ -800,6 +800,16 @@ impl Guild {
self.id.get_prune_count(days)
}

/// Retrieves the guild's webhooks.
///
/// **Note**: Requires the [Manage Webhooks] permission.
///
/// [Manage Webhooks]: permissions/constant.MANAGE_WEBHOOKS.html
#[inline]
pub fn get_webhooks(&self) -> Result<Vec<Webhook>> {
self.id.get_webhooks()
}

/// Returns the formatted URL of the guild's icon, if one exists.
pub fn icon_url(&self) -> Option<String> {
self.icon.as_ref().map(|icon|
Expand Down Expand Up @@ -1097,16 +1107,6 @@ impl Guild {

self.id.unban(user_id)
}

/// Retrieves the guild's webhooks.
///
/// **Note**: Requires the [Manage Webhooks] permission.
///
/// [Manage Webhooks]: permissions/constant.MANAGE_WEBHOOKS.html
#[inline]
pub fn webhooks(&self) -> Result<Vec<Webhook>> {
self.id.webhooks()
}
}

impl GuildId {
Expand Down Expand Up @@ -1478,6 +1478,16 @@ impl GuildId {
rest::get_guild_prune_count(self.0, map)
}

/// Retrieves the guild's webhooks.
///
/// **Note**: Requires the [Manage Webhooks] permission.
///
/// [Manage Webhooks]: permissions/constant.MANAGE_WEBHOOKS.html
#[inline]
pub fn get_webhooks(&self) -> Result<Vec<Webhook>> {
rest::get_guild_webhooks(self.0)
}

/// Kicks a [`Member`] from the guild.
///
/// Requires the [Kick Members] permission.
Expand Down Expand Up @@ -1581,16 +1591,6 @@ impl GuildId {
pub fn unban<U: Into<UserId>>(&self, user_id: U) -> Result<()> {
rest::remove_ban(self.0, user_id.into().0)
}

/// Retrieves the guild's webhooks.
///
/// **Note**: Requires the [Manage Webhooks] permission.
///
/// [Manage Webhooks]: permissions/constant.MANAGE_WEBHOOKS.html
#[inline]
pub fn webhooks(&self) -> Result<Vec<Webhook>> {
rest::get_guild_webhooks(self.0)
}
}

impl fmt::Display for GuildId {
Expand Down Expand Up @@ -2229,6 +2229,16 @@ impl PartialGuild {
self.id.get_prune_count(days)
}

/// Retrieves the guild's webhooks.
///
/// **Note**: Requires the [Manage Webhooks] permission.
///
/// [Manage Webhooks]: permissions/constant.MANAGE_WEBHOOKS.html
#[inline]
pub fn get_webhooks(&self) -> Result<Vec<Webhook>> {
self.id.get_webhooks()
}

/// Kicks a [`Member`] from the guild.
///
/// Requires the [Kick Members] permission.
Expand Down Expand Up @@ -2361,16 +2371,6 @@ impl PartialGuild {
pub fn unban<U: Into<UserId>>(&self, user_id: U) -> Result<()> {
self.id.unban(user_id)
}

/// Retrieves the guild's webhooks.
///
/// **Note**: Requires the [Manage Webhooks] permission.
///
/// [Manage Webhooks]: permissions/constant.MANAGE_WEBHOOKS.html
#[inline]
pub fn webhooks(&self) -> Result<Vec<Webhook>> {
self.id.webhooks()
}
}

impl PossibleGuild<Guild> {
Expand Down

0 comments on commit e8a9086

Please sign in to comment.