aboutsummaryrefslogtreecommitdiff
path: root/src/client/context.rs
diff options
context:
space:
mode:
authorAustin Hellyer <[email protected]>2016-11-30 05:52:47 -0800
committerAustin Hellyer <[email protected]>2016-11-30 05:52:47 -0800
commit5c4a79fd62e549573e97c400176313cbc8f66b58 (patch)
tree987787378d6d8214b53d5b23584ed20779633f24 /src/client/context.rs
parentAdd documentation for examples (diff)
downloadserenity-5c4a79fd62e549573e97c400176313cbc8f66b58.tar.xz
serenity-5c4a79fd62e549573e97c400176313cbc8f66b58.zip
Add remaining REST routes
The status routes were missing from the HTTP module (now the REST module) rewrite, as well as the `GET /guilds/:id/members` route. In addition, remove an unnecessary counter to the global ratelimit mutex.
Diffstat (limited to 'src/client/context.rs')
-rw-r--r--src/client/context.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/client/context.rs b/src/client/context.rs
index d648888..529a0b4 100644
--- a/src/client/context.rs
+++ b/src/client/context.rs
@@ -1028,6 +1028,21 @@ impl Context {
rest::get_member(guild_id.0, user_id.0)
}
+ /// Gets a list of a [`Guild`]'s members.
+ ///
+ /// Optionally pass in the `limit` to limit the number of results. Maximum
+ /// value is 1000. Optionally pass in `after` to offset the results by a
+ /// [`User`]'s Id.
+ ///
+ /// [`Guild`]: ../model/struct.Guild.html
+ /// [`User`]: ../model/struct.User.html
+ pub fn get_members<G, U>(&self, guild_id: G, limit: Option<u64>, after: Option<U>)
+ -> Result<Vec<Member>> where G: Into<GuildId>, U: Into<UserId> {
+ rest::get_guild_members(guild_id.into().0,
+ limit,
+ after.map(|x| x.into().0))
+ }
+
/// Retrieves a single [`Message`] from a [`Channel`].
///
/// Requires the [Read Message History] permission.