aboutsummaryrefslogtreecommitdiff
path: root/src/http
diff options
context:
space:
mode:
authoracdenisSK <[email protected]>2017-07-20 03:47:13 +0200
committeracdenisSK <[email protected]>2017-07-20 03:48:28 +0200
commit6a101c4a409ae3abe4038f96dcd51f0788d4c0e4 (patch)
tree505c7dc6e4735c82dc9d01c0b83146b30c75da50 /src/http
parentFix tests (diff)
downloadserenity-6a101c4a409ae3abe4038f96dcd51f0788d4c0e4.tar.xz
serenity-6a101c4a409ae3abe4038f96dcd51f0788d4c0e4.zip
Add an actual way to fetch audit log entries from a guild
Diffstat (limited to 'src/http')
-rw-r--r--src/http/mod.rs10
-rw-r--r--src/http/ratelimiting.rs5
2 files changed, 15 insertions, 0 deletions
diff --git a/src/http/mod.rs b/src/http/mod.rs
index 781e64a..850f800 100644
--- a/src/http/mod.rs
+++ b/src/http/mod.rs
@@ -887,6 +887,16 @@ pub fn get_bans(guild_id: u64) -> Result<Vec<Ban>> {
serde_json::from_reader::<HyperResponse, Vec<Ban>>(response).map_err(From::from)
}
+/// Gets all audit logs in a specific guild.
+pub fn get_audit_logs(guild_id: u64) -> Result<AuditLogs> {
+ let response = request!(Route::GuildsIdAuditLogs(guild_id),
+ get,
+ "/guilds/{}/audit-logs",
+ guild_id);
+
+ serde_json::from_reader::<HyperResponse, AuditLogs>(response).map_err(From::from)
+}
+
/// Gets current bot gateway.
pub fn get_bot_gateway() -> Result<BotGateway> {
let response = request!(Route::GatewayBot, get, "/gateway/bot");
diff --git a/src/http/ratelimiting.rs b/src/http/ratelimiting.rs
index a674537..a5b7032 100644
--- a/src/http/ratelimiting.rs
+++ b/src/http/ratelimiting.rs
@@ -207,6 +207,11 @@ pub enum Route {
///
/// [`GuildId`]: struct.GuildId.html
GuildsIdBans(u64),
+ /// Route for the `/guilds/:guild_id/audit-logs` path.
+ /// The data is the relevant [`GuildId`].
+ ///
+ /// [`GuildId`]: struct.GuildId.html
+ GuildsIdAuditLogs(u64),
/// Route for the `/guilds/:guild_id/bans/:user_id` path.
///
/// The data is the relevant [`GuildId`].