diff options
| author | Austin Hellyer <[email protected]> | 2016-11-25 08:33:15 -0800 |
|---|---|---|
| committer | Austin Hellyer <[email protected]> | 2016-11-25 08:33:15 -0800 |
| commit | e75f30b6dedf366d72d8d56b44fdbe191961fa72 (patch) | |
| tree | 46f2a507d0865078e352769729c756592368b88e /src/model | |
| parent | Allow compiling with only either cache or methods (diff) | |
| download | serenity-e75f30b6dedf366d72d8d56b44fdbe191961fa72.tar.xz serenity-e75f30b6dedf366d72d8d56b44fdbe191961fa72.zip | |
Rename the `http` module to `rest`
Diffstat (limited to 'src/model')
| -rw-r--r-- | src/model/channel.rs | 62 | ||||
| -rw-r--r-- | src/model/guild.rs | 52 | ||||
| -rw-r--r-- | src/model/id.rs | 12 | ||||
| -rw-r--r-- | src/model/invite.rs | 22 | ||||
| -rw-r--r-- | src/model/user.rs | 8 | ||||
| -rw-r--r-- | src/model/webhook.rs | 42 |
6 files changed, 99 insertions, 99 deletions
diff --git a/src/model/channel.rs b/src/model/channel.rs index 3be8836..ffc8658 100644 --- a/src/model/channel.rs +++ b/src/model/channel.rs @@ -33,7 +33,7 @@ use ::utils::builder::{CreateEmbed, CreateInvite, EditChannel}; #[cfg(all(feature = "cache", feature = "methods"))] use ::client::CACHE; #[cfg(all(feature = "methods"))] -use ::client::http; +use ::client::rest; impl Attachment { /// If this attachment is an image, then a tuple of the width and height @@ -286,7 +286,7 @@ impl Group { /// Adds the given user to the group. If the user is already in the group, /// then nothing is done. /// - /// Refer to [`http::add_group_recipient`] for more information. + /// Refer to [`rest::add_group_recipient`] for more information. /// /// **Note**: Groups have a limit of 10 recipients, including the current /// user. @@ -299,13 +299,13 @@ impl Group { return Ok(()); } - http::add_group_recipient(self.channel_id.0, user.0) + rest::add_group_recipient(self.channel_id.0, user.0) } /// Broadcasts that the current user is typing in the group. #[cfg(feature = "methods")] pub fn broadcast_typing(&self) -> Result<()> { - http::broadcast_typing(self.channel_id.0) + rest::broadcast_typing(self.channel_id.0) } /// Deletes multiple messages in the group. @@ -337,7 +337,7 @@ impl Group { .insert("messages", ids) .build(); - http::delete_messages(self.channel_id.0, map) + rest::delete_messages(self.channel_id.0, map) } /// Returns the formatted URI of the group's icon if one exists. @@ -349,7 +349,7 @@ impl Group { /// Leaves the group. #[cfg(feature = "methods")] pub fn leave(&self) -> Result<Group> { - http::leave_group(self.channel_id.0) + rest::leave_group(self.channel_id.0) } /// Generates a name for the group. @@ -378,7 +378,7 @@ impl Group { /// Retrieves the list of messages that have been pinned in the group. #[cfg(feature = "methods")] pub fn pins(&self) -> Result<Vec<Message>> { - http::get_pins(self.channel_id.0) + rest::get_pins(self.channel_id.0) } /// Removes a recipient from the group. If the recipient is already not in @@ -394,7 +394,7 @@ impl Group { return Ok(()); } - http::remove_group_recipient(self.channel_id.0, user.0) + rest::remove_group_recipient(self.channel_id.0, user.0) } /// Sends a message to the group with the given content. @@ -412,7 +412,7 @@ impl Group { .insert("tts", false) .build(); - http::send_message(self.channel_id.0, map) + rest::send_message(self.channel_id.0, map) } } @@ -448,7 +448,7 @@ impl Message { return Err(Error::Client(ClientError::InvalidPermissions(req))); } - http::delete_message(self.channel_id.0, self.id.0) + rest::delete_message(self.channel_id.0, self.id.0) } /// Deletes all of the [`Reaction`]s associated with the message. @@ -471,7 +471,7 @@ impl Message { return Err(Error::Client(ClientError::InvalidPermissions(req))); } - http::delete_message_reactions(self.channel_id.0, self.id.0) + rest::delete_message_reactions(self.channel_id.0, self.id.0) } /// Edits this message, replacing the original content with new content. @@ -519,7 +519,7 @@ impl Message { map = map.insert("embed", Value::Object(embed)); } - match http::edit_message(self.channel_id.0, self.id.0, map.build()) { + match rest::edit_message(self.channel_id.0, self.id.0, map.build()) { Ok(edited) => { mem::replace(self, edited); @@ -568,7 +568,7 @@ impl Message { return Err(Error::Client(ClientError::InvalidPermissions(req))); } - http::pin_message(self.channel_id.0, self.id.0) + rest::pin_message(self.channel_id.0, self.id.0) } /// React to the message with a custom [`Emoji`] or unicode character. @@ -592,7 +592,7 @@ impl Message { return Err(Error::Client(ClientError::InvalidPermissions(req))); } - http::create_reaction(self.channel_id.0, + rest::create_reaction(self.channel_id.0, self.id.0, reaction_type.into()) } @@ -641,7 +641,7 @@ impl Message { .insert("tts", false) .build(); - http::send_message(self.channel_id.0, map) + rest::send_message(self.channel_id.0, map) } /// Unpins the message from its channel. @@ -664,7 +664,7 @@ impl Message { return Err(Error::Client(ClientError::InvalidPermissions(req))); } - http::unpin_message(self.channel_id.0, self.id.0) + rest::unpin_message(self.channel_id.0, self.id.0) } } @@ -692,7 +692,7 @@ impl PrivateChannel { /// Broadcasts that the current user is typing to the recipient. #[cfg(feature = "methods")] pub fn broadcast_typing(&self) -> Result<()> { - http::broadcast_typing(self.id.0) + rest::broadcast_typing(self.id.0) } #[doc(hidden)] @@ -738,7 +738,7 @@ impl PrivateChannel { .insert("messages", ids) .build(); - http::delete_messages(self.id.0, map) + rest::delete_messages(self.id.0, map) } /// Deletes the channel. This does not delete the contents of the channel, @@ -746,14 +746,14 @@ impl PrivateChannel { /// be re-opened. #[cfg(feature = "methods")] pub fn delete(&self) -> Result<Channel> { - http::delete_channel(self.id.0) + rest::delete_channel(self.id.0) } /// Retrieves the list of messages that have been pinned in the private /// channel. #[cfg(feature = "methods")] pub fn pins(&self) -> Result<Vec<Message>> { - http::get_pins(self.id.0) + rest::get_pins(self.id.0) } /// Sends a message to the channel with the given content. @@ -779,7 +779,7 @@ impl PrivateChannel { .insert("tts", false) .build(); - http::send_message(self.id.0, map) + rest::send_message(self.id.0, map) } } @@ -807,7 +807,7 @@ impl PublicChannel { /// [Send Messages]: permissions/constants.SEND_MESSAGES.html #[cfg(feature = "methods")] pub fn broadcast_typing(&self) -> Result<()> { - http::broadcast_typing(self.id.0) + rest::broadcast_typing(self.id.0) } #[cfg(feature = "methods")] @@ -821,7 +821,7 @@ impl PublicChannel { let map = f(CreateInvite::default()).0.build(); - http::create_invite(self.id.0, map) + rest::create_invite(self.id.0, map) } #[doc(hidden)] @@ -860,7 +860,7 @@ impl PublicChannel { return Err(Error::Client(ClientError::InvalidPermissions(req))); } - http::delete_channel(self.id.0) + rest::delete_channel(self.id.0) } #[cfg(feature = "methods")] @@ -879,7 +879,7 @@ impl PublicChannel { let edited = f(EditChannel(map)).0.build(); - match http::edit_channel(self.id.0, edited) { + match rest::edit_channel(self.id.0, edited) { Ok(channel) => { mem::replace(self, channel); @@ -907,7 +907,7 @@ impl PublicChannel { #[cfg(feature = "methods")] pub fn pins(&self) -> Result<Vec<Message>> { - http::get_pins(self.id.0) + rest::get_pins(self.id.0) } /// Sends a message to the channel with the given content. @@ -946,7 +946,7 @@ impl PublicChannel { .insert("tts", false) .build(); - http::send_message(self.id.0, map) + rest::send_message(self.id.0, map) } /// Retrieves the channel's webhooks. @@ -956,7 +956,7 @@ impl PublicChannel { /// [Manage Webhooks]: permissions/constant.MANAGE_WEBHOOKS.html #[cfg(feature = "methods")] pub fn webhooks(&self) -> Result<Vec<Webhook>> { - http::get_channel_webhooks(self.id.0) + rest::get_channel_webhooks(self.id.0) } } @@ -1006,12 +1006,12 @@ impl Reaction { } } - http::delete_reaction(self.channel_id.0, + rest::delete_reaction(self.channel_id.0, self.message_id.0, user, self.emoji.clone()) } else { - http::delete_reaction(self.channel_id.0, + rest::delete_reaction(self.channel_id.0, self.message_id.0, Some(self.user_id.0), self.emoji.clone()) @@ -1049,7 +1049,7 @@ impl Reaction { -> Result<Vec<User>> where R: Into<ReactionType>, U: Into<UserId> { - http::get_reaction_users(self.channel_id.0, + rest::get_reaction_users(self.channel_id.0, self.message_id.0, reaction_type.into(), limit.unwrap_or(50), diff --git a/src/model/guild.rs b/src/model/guild.rs index 842333b..33adc80 100644 --- a/src/model/guild.rs +++ b/src/model/guild.rs @@ -23,7 +23,7 @@ use std::mem; #[cfg(feature = "methods")] use ::utils::builder::{EditGuild, EditMember, EditRole}; #[cfg(feature = "methods")] -use ::client::http; +use ::client::rest; #[cfg(feature = "cache")] use ::client::CACHE; @@ -70,7 +70,7 @@ impl Emoji { #[cfg(all(feature = "cache", feature = "methods"))] pub fn delete(&self) -> Result<()> { match self.find_guild_id() { - Some(guild_id) => http::delete_emoji(guild_id.0, self.id.0), + Some(guild_id) => rest::delete_emoji(guild_id.0, self.id.0), None => Err(Error::Client(ClientError::ItemMissing)), } } @@ -90,7 +90,7 @@ impl Emoji { .insert("name", name) .build(); - match http::edit_emoji(guild_id.0, self.id.0, map) { + match rest::edit_emoji(guild_id.0, self.id.0, map) { Ok(emoji) => { mem::replace(self, emoji); @@ -143,7 +143,7 @@ impl PartialGuild { #[cfg(feature = "methods")] #[inline] pub fn edit_nickname(&self, new_nickname: Option<&str>) -> Result<()> { - http::edit_nickname(self.id.0, new_nickname) + rest::edit_nickname(self.id.0, new_nickname) } /// Returns a formatted URL of the guild's icon, if the guild has an icon. @@ -160,7 +160,7 @@ impl PartialGuild { #[cfg(feature = "methods")] #[inline] pub fn webhooks(&self) -> Result<Vec<Webhook>> { - http::get_guild_webhooks(self.id.0) + rest::get_guild_webhooks(self.id.0) } } @@ -224,7 +224,7 @@ impl Guild { return Err(Error::Client(ClientError::InvalidPermissions(req))); } - http::ban_user(self.id.0, user.into().0, delete_message_days) + rest::ban_user(self.id.0, user.into().0, delete_message_days) } /// Retrieves a list of [`Ban`]s for the guild. @@ -247,7 +247,7 @@ impl Guild { return Err(Error::Client(ClientError::InvalidPermissions(req))); } - http::get_bans(self.id.0) + rest::get_bans(self.id.0) } /// Creates a new [`Channel`] in the guild. @@ -286,7 +286,7 @@ impl Guild { .insert("type", kind.name()) .build(); - http::create_channel(self.id.0, map) + rest::create_channel(self.id.0, map) } /// Creates a new [`Role`] in the guild with the data set, if any. @@ -314,11 +314,11 @@ impl Guild { } let role = { - try!(http::create_role(self.id.0)) + try!(rest::create_role(self.id.0)) }; let map = f(EditRole::default()).0.build(); - http::edit_role(self.id.0, role.id.0, map) + rest::edit_role(self.id.0, role.id.0, map) } #[doc(hidden)] @@ -387,7 +387,7 @@ impl Guild { } }} - http::delete_guild(self.id.0) + rest::delete_guild(self.id.0) } /// Edits the current guild with new data where specified. See the @@ -415,7 +415,7 @@ impl Guild { let map = f(EditGuild::default()).0.build(); - match http::edit_guild(self.id.0, map) { + match rest::edit_guild(self.id.0, map) { Ok(guild) => { self.afk_channel_id = guild.afk_channel_id; self.afk_timeout = guild.afk_timeout; @@ -458,7 +458,7 @@ impl Guild { return Err(Error::Client(ClientError::InvalidPermissions(req))); } - http::edit_nickname(self.id.0, new_nickname) + rest::edit_nickname(self.id.0, new_nickname) } /// Attempts to retrieve a [`PublicChannel`] with the given Id. @@ -488,7 +488,7 @@ impl Guild { return Err(Error::Client(ClientError::InvalidPermissions(req))); } - http::get_guild_invites(self.id.0) + rest::get_guild_invites(self.id.0) } /// Attempts to retrieve the given user's member instance in the guild. @@ -554,7 +554,7 @@ impl Guild { /// Leaves the guild. #[cfg(feature = "methods")] pub fn leave(&self) -> Result<PartialGuild> { - http::leave_guild(self.id.0) + rest::leave_guild(self.id.0) } /// Calculate a [`User`]'s permissions in a given channel in the guild. @@ -694,7 +694,7 @@ impl Guild { .insert("days", days) .build(); - http::get_guild_prune_count(self.id.0, map) + rest::get_guild_prune_count(self.id.0, map) } /// Starts a prune of [`Member`]s. @@ -724,7 +724,7 @@ impl Guild { .insert("days", days) .build(); - http::start_guild_prune(self.id.0, map) + rest::start_guild_prune(self.id.0, map) } /// Unbans the given [`User`] from the guild. @@ -747,7 +747,7 @@ impl Guild { return Err(Error::Client(ClientError::InvalidPermissions(req))); } - http::remove_ban(self.id.0, user.into().0) + rest::remove_ban(self.id.0, user.into().0) } /// Retrieves the guild's webhooks. @@ -758,7 +758,7 @@ impl Guild { #[cfg(feature = "methods")] #[inline] pub fn webhooks(&self) -> Result<Vec<Webhook>> { - http::get_guild_webhooks(self.id.0) + rest::get_guild_webhooks(self.id.0) } } @@ -780,7 +780,7 @@ impl Member { let guild_id = try!(self.find_guild()); - match http::add_member_role(guild_id.0, self.user.id.0, role_id.0) { + match rest::add_member_role(guild_id.0, self.user.id.0, role_id.0) { Ok(()) => { self.roles.push(role_id); @@ -804,7 +804,7 @@ impl Member { let map = EditMember::default().roles(&self.roles).0.build(); - match http::edit_member(guild_id.0, self.user.id.0, map) { + match rest::edit_member(guild_id.0, self.user.id.0, map) { Ok(()) => Ok(()), Err(why) => { self.roles.retain(|r| !role_ids.contains(r)); @@ -824,7 +824,7 @@ impl Member { pub fn ban(&self, delete_message_days: u8) -> Result<()> { let guild_id = try!(self.find_guild()); - http::ban_user(guild_id.0, + rest::ban_user(guild_id.0, self.user.id.0, delete_message_days) } @@ -850,7 +850,7 @@ impl Member { let guild_id = try!(self.find_guild()); let map = f(EditMember::default()).0.build(); - http::edit_member(guild_id.0, self.user.id.0, map) + rest::edit_member(guild_id.0, self.user.id.0, map) } /// Finds the Id of the [`Guild`] that the member is in. @@ -893,7 +893,7 @@ impl Member { let guild_id = try!(self.find_guild()); - match http::remove_member_role(guild_id.0, self.user.id.0, role_id.0) { + match rest::remove_member_role(guild_id.0, self.user.id.0, role_id.0) { Ok(()) => { self.roles.retain(|r| r.0 != role_id.0); @@ -916,7 +916,7 @@ impl Member { let map = EditMember::default().roles(&self.roles).0.build(); - match http::edit_member(guild_id.0, self.user.id.0, map) { + match rest::edit_member(guild_id.0, self.user.id.0, map) { Ok(()) => Ok(()), Err(why) => { self.roles.extend_from_slice(role_ids); @@ -1017,7 +1017,7 @@ impl Role { pub fn delete(&self) -> Result<()> { let guild_id = try!(self.find_guild()); - http::delete_role(guild_id.0, self.id.0) + rest::delete_role(guild_id.0, self.id.0) } /// Searches the cache for the guild that owns the role. diff --git a/src/model/id.rs b/src/model/id.rs index d29fa2a..d7d131a 100644 --- a/src/model/id.rs +++ b/src/model/id.rs @@ -3,7 +3,7 @@ use super::*; #[cfg(all(feature = "cache", feature = "methods"))] use ::client::CACHE; #[cfg(feature = "methods")] -use ::client::http; +use ::client::rest; #[cfg(feature = "methods")] use ::internal::prelude::*; @@ -24,7 +24,7 @@ impl ChannelId { } }} - http::get_channel(self.0) + rest::get_channel(self.0) } /// Returns a [`Mention`] which will link to the [`Channel`]. @@ -45,7 +45,7 @@ impl ChannelId { /// [Manage Webhooks]: permissions/constant.MANAGE_WEBHOOKS.html #[cfg(feature="methods")] pub fn webhooks(&self) -> Result<Vec<Webhook>> { - http::get_channel_webhooks(self.0) + rest::get_channel_webhooks(self.0) } } @@ -90,7 +90,7 @@ impl GuildId { /// all data with a guild retrieval. #[cfg(feature="methods")] pub fn get(&self) -> Result<PartialGuild> { - http::get_guild(self.0) + rest::get_guild(self.0) } /// Mentions the [`Guild`]'s default channel. @@ -117,7 +117,7 @@ impl GuildId { /// [Manage Webhooks]: permissions/constant.MANAGE_WEBHOOKS.html #[cfg(feature="methods")] pub fn webhooks(&self) -> Result<Vec<Webhook>> { - http::get_guild_webhooks(self.0) + rest::get_guild_webhooks(self.0) } } @@ -229,6 +229,6 @@ impl WebhookId { /// [Manage Webhooks]: permissions/constant.MANAGE_WEBHOOKS.html #[cfg(feature="methods")] pub fn webhooks(&self) -> Result<Webhook> { - http::get_webhook(self.0) + rest::get_webhook(self.0) } } diff --git a/src/model/invite.rs b/src/model/invite.rs index 2f65fd1..8322ddb 100644 --- a/src/model/invite.rs +++ b/src/model/invite.rs @@ -1,5 +1,5 @@ use super::{Invite, RichInvite}; -use ::client::http; +use ::client::rest; use ::internal::prelude::*; use super::{permissions, utils}; @@ -10,7 +10,7 @@ impl Invite { /// Accepts the invite, placing the current user in the [`Guild`] that the /// invite was for. /// - /// Refer to [`http::accept_invite`] for more information. + /// Refer to [`rest::accept_invite`] for more information. /// /// **Note**: This will fail if you are already in the guild, or are banned. /// A ban is equivilant to an IP ban. @@ -25,7 +25,7 @@ impl Invite { /// /// [`ClientError::InvalidOperationAsBot`]: enum.ClientError.html#variant.InvalidOperationAsBot /// [`Guild`]: struct.Guild.html - /// [`http::accept_invite`]: ../client/http/fn.accept_invite.html + /// [`rest::accept_invite`]: ../client/rest/fn.accept_invite.html /// [permission]: permissions/index.html #[cfg(feature="methods")] pub fn accept(&self) -> Result<Invite> { @@ -35,7 +35,7 @@ impl Invite { } }} - http::accept_invite(&self.code) + rest::accept_invite(&self.code) } /// Deletes the invite. @@ -58,7 +58,7 @@ impl Invite { return Err(Error::Client(ClientError::InvalidPermissions(req))); } - http::delete_invite(&self.code) + rest::delete_invite(&self.code) } } @@ -66,7 +66,7 @@ impl RichInvite { /// Accepts the invite, placing the current user in the [`Guild`] that the /// invite was for. /// - /// Refer to [`http::accept_invite`] for more information. + /// Refer to [`rest::accept_invite`] for more information. /// /// **Note**: This will fail if you are already in the guild, or are banned. /// A ban is equivilant to an IP ban. @@ -80,7 +80,7 @@ impl RichInvite { /// /// [`ClientError::InvalidOperationAsBot`]: enum.ClientError.html#variant.InvalidOperationAsBot /// [`Guild`]: struct.Guild.html - /// [`http::accept_invite`]: ../client/http/fn.accept_invite.html + /// [`rest::accept_invite`]: ../client/rest/fn.accept_invite.html #[cfg(feature="methods")] pub fn accept(&self) -> Result<Invite> { feature_cache_enabled! {{ @@ -89,12 +89,12 @@ impl RichInvite { } }} - http::accept_invite(&self.code) + rest::accept_invite(&self.code) } /// Deletes the invite. /// - /// Refer to [`http::delete_invite`] for more information. + /// Refer to [`rest::delete_invite`] for more information. /// /// **Note**: Requires the [Manage Guild] permission. /// @@ -106,7 +106,7 @@ impl RichInvite { /// /// [`ClientError::InvalidPermissions`]: ../client/enum.ClientError.html#variant.InvalidPermissions /// [`Invite::delete`]: struct.Invite.html#method.delete - /// [`http::delete_invite`]: ../client/http/fn.delete_invite.html + /// [`rest::delete_invite`]: ../client/rest/fn.delete_invite.html /// [Manage Guild]: permissions/constant.MANAGE_GUILD.html /// [permission]: permissions/index.html #[cfg(feature = "methods")] @@ -119,6 +119,6 @@ impl RichInvite { } }} - http::delete_invite(&self.code) + rest::delete_invite(&self.code) } } diff --git a/src/model/user.rs b/src/model/user.rs index bedf696..4201bd2 100644 --- a/src/model/user.rs +++ b/src/model/user.rs @@ -20,7 +20,7 @@ use super::Message; #[cfg(feature = "methods")] use time::Timespec; #[cfg(feature = "methods")] -use ::client::http; +use ::client::rest; #[cfg(feature = "cache")] use ::client::CACHE; @@ -76,14 +76,14 @@ impl User { .insert("recipient_id", self.id.0) .build(); - try!(http::create_private_channel(map)).id + try!(rest::create_private_channel(map)).id } } else { let map = ObjectBuilder::new() .insert("recipient_id", self.id.0) .build(); - try!(http::create_private_channel(map)).id + try!(rest::create_private_channel(map)).id }}; let map = ObjectBuilder::new() @@ -92,7 +92,7 @@ impl User { .insert("tts", false) .build(); - http::send_message(private_channel_id.0, map) + rest::send_message(private_channel_id.0, map) } /// Check if a user has a [`Role`]. This will retrieve the diff --git a/src/model/webhook.rs b/src/model/webhook.rs index f0d7b16..4553f30 100644 --- a/src/model/webhook.rs +++ b/src/model/webhook.rs @@ -2,19 +2,19 @@ use serde_json::builder::ObjectBuilder; use std::mem; use super::{Message, Webhook}; use ::utils::builder::ExecuteWebhook; -use ::client::http; +use ::client::rest; use ::internal::prelude::*; impl Webhook { /// Deletes the webhook. /// - /// As this calls the [`http::delete_webhook_with_token`] function, + /// As this calls the [`rest::delete_webhook_with_token`] function, /// authentication is not required. /// - /// [`http::delete_webhook_with_token`]: ../client/http/fn.delete_webhook_with_token.html + /// [`rest::delete_webhook_with_token`]: ../client/rest/fn.delete_webhook_with_token.html #[cfg(feature="methods")] pub fn delete(&self) -> Result<()> { - http::delete_webhook_with_token(self.id.0, &self.token) + rest::delete_webhook_with_token(self.id.0, &self.token) } /// @@ -23,9 +23,9 @@ impl Webhook { /// To nullify the avatar, pass `Some("")`. Otherwise, passing `None` will /// not modify the avatar. /// - /// Refer to [`http::edit_webhook`] for restrictions on editing webhooks. + /// Refer to [`rest::edit_webhook`] for restrictions on editing webhooks. /// - /// As this calls the [`http::edit_webhook_with_token`] function, + /// As this calls the [`rest::edit_webhook_with_token`] function, /// authentication is not required. /// /// # Examples @@ -33,12 +33,12 @@ impl Webhook { /// Editing a webhook's name: /// /// ```rust,no_run - /// use serenity::client::http; + /// use serenity::client::rest; /// /// let id = 245037420704169985; /// let token = "ig5AO-wdVWpCBtUUMxmgsWryqgsW3DChbKYOINftJ4DCrUbnkedoYZD0VOH1QLr-S3sV"; /// - /// let mut webhook = http::get_webhook_with_token(id, token) + /// let mut webhook = rest::get_webhook_with_token(id, token) /// .expect("valid webhook"); /// /// let _ = webhook.edit(Some("new name"), None).expect("err editing"); @@ -47,12 +47,12 @@ impl Webhook { /// Setting a webhook's avatar: /// /// ```rust,no_run - /// use serenity::client::http; + /// use serenity::client::rest; /// /// let id = 245037420704169985; /// let token = "ig5AO-wdVWpCBtUUMxmgsWryqgsW3DChbKYOINftJ4DCrUbnkedoYZD0VOH1QLr-S3sV"; /// - /// let mut webhook = http::get_webhook_with_token(id, token) + /// let mut webhook = rest::get_webhook_with_token(id, token) /// .expect("valid webhook"); /// /// let image = serenity::utils::read_image("./webhook_img.png") @@ -61,8 +61,8 @@ impl Webhook { /// let _ = webhook.edit(None, Some(&image)).expect("err editing"); /// ``` /// - /// [`http::edit_webhook`]: ../client/http/fn.edit_webhook.html - /// [`http::edit_webhook_with_token`]: ../client/http/fn.edit_webhook_with_token.html + /// [`rest::edit_webhook`]: ../client/rest/fn.edit_webhook.html + /// [`rest::edit_webhook_with_token`]: ../client/rest/fn.edit_webhook_with_token.html #[cfg(feature="methods")] pub fn edit(&mut self, name: Option<&str>, avatar: Option<&str>) -> Result<()> { @@ -86,7 +86,7 @@ impl Webhook { let map = map.build(); - match http::edit_webhook_with_token(self.id.0, &self.token, map) { + match rest::edit_webhook_with_token(self.id.0, &self.token, map) { Ok(replacement) => { mem::replace(self, replacement); @@ -106,12 +106,12 @@ impl Webhook { /// Execute a webhook with message content of `test`: /// /// ```rust,no_run - /// use serenity::client::http; + /// use serenity::client::rest; /// /// let id = 245037420704169985; /// let token = "ig5AO-wdVWpCBtUUMxmgsWryqgsW3DChbKYOINftJ4DCrUbnkedoYZD0VOH1QLr-S3sV"; /// - /// let mut webhook = http::get_webhook_with_token(id, token) + /// let mut webhook = rest::get_webhook_with_token(id, token) /// .expect("valid webhook"); /// /// let _ = webhook.execute(|w| w.content("test")).expect("err executing"); @@ -121,13 +121,13 @@ impl Webhook { /// username to `serenity`, and sending an embed: /// /// ```rust,no_run - /// use serenity::client::http; + /// use serenity::client::rest; /// use serenity::model::Embed; /// /// let id = 245037420704169985; /// let token = "ig5AO-wdVWpCBtUUMxmgsWryqgsW3DChbKYOINftJ4DCrUbnkedoYZD0VOH1QLr-S3sV"; /// - /// let mut webhook = http::get_webhook_with_token(id, token) + /// let mut webhook = rest::get_webhook_with_token(id, token) /// .expect("valid webhook"); /// /// let embed = Embed::fake(|e| e @@ -148,19 +148,19 @@ impl Webhook { where F: FnOnce(ExecuteWebhook) -> ExecuteWebhook { let map = f(ExecuteWebhook::default()).0.build(); - http::execute_webhook(self.id.0, &self.token, map) + rest::execute_webhook(self.id.0, &self.token, map) } /// Retrieves the latest information about the webhook, editing the /// webhook in-place. /// - /// As this calls the [`http::get_webhook_with_token`] function, + /// As this calls the [`rest::get_webhook_with_token`] function, /// authentication is not required. /// - /// [`http::get_webhook_with_token`]: ../client/http/fn.get_webhook_with_token.html + /// [`rest::get_webhook_with_token`]: ../client/rest/fn.get_webhook_with_token.html #[cfg(feature="methods")] pub fn refresh(&mut self) -> Result<()> { - match http::get_webhook_with_token(self.id.0, &self.token) { + match rest::get_webhook_with_token(self.id.0, &self.token) { Ok(replacement) => { mem::replace(self, replacement); |