aboutsummaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
authorMei <[email protected]>2017-05-19 01:07:46 -0400
committerzeyla <[email protected]>2017-05-18 22:07:46 -0700
commit302d771182308f907423ed73be9b736f268737fe (patch)
tree9b76f26beaaea596488f8b3497e787c4852c1f69 /src/client
parentFix call to VoiceManager.join in example 06 (diff)
downloadserenity-302d771182308f907423ed73be9b736f268737fe.tar.xz
serenity-302d771182308f907423ed73be9b736f268737fe.zip
Add support for retrieving invites with counts
Previously retrieving an invite with the `?with_counts=true` wasn't possible. Added support to `get_invite` for retrieving an invite with the counts, this requires the user to pass true to the function. The counts include `approximate_presence_count` and `approximate_member_count` which have been added to the `Invite` stuct, as well as `text_channel_count` and `voice_channel_count` to the `InviteGuild` struct.
Diffstat (limited to 'src/client')
-rw-r--r--src/client/rest/mod.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/client/rest/mod.rs b/src/client/rest/mod.rs
index 31d7a17..3890a46 100644
--- a/src/client/rest/mod.rs
+++ b/src/client/rest/mod.rs
@@ -1136,9 +1136,15 @@ pub fn get_guilds(target: &GuildPagination, limit: u64) -> Result<Vec<GuildInfo>
}
/// Gets information about a specific invite.
-pub fn get_invite(code: &str) -> Result<Invite> {
+pub fn get_invite(code: &str, stats: bool) -> Result<Invite> {
let invite = ::utils::parse_invite(code);
- let response = request!(Route::InvitesCode, get, "/invites/{}", invite);
+ let mut uri = format!("/invites/{}", invite);
+
+ if stats {
+ uri.push_str("?with_counts=true");
+ }
+
+ let response = request!(Route::InvitesCode, get, "{}", uri);
serde_json::from_reader::<HyperResponse, Invite>(response).map_err(From::from)
}