Skip to main content

djs_model/rest/
audit_log.rs

1//! The query of the [audit log endpoint](https://docs.discord.com/developers/resources/audit-log).
2
3use crate::{
4    audit_log::AuditLogEvent,
5    id::{AuditLogEntryId, UserId},
6};
7
8/// The query of [Get Guild Audit Log](https://docs.discord.com/developers/resources/audit-log#get-guild-audit-log).
9///
10/// Entries come newest first, or oldest first with [`after`](Self::after) (`after` the
11/// smallest ID, e.g. `AuditLogEntryId::new(1)`, starts from the oldest).
12///
13/// discord.js counterpart: `GuildAuditLogsFetchOptions`.
14#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
15#[non_exhaustive]
16pub struct GetGuildAuditLog {
17    /// Only entries of actions by this user.
18    pub user_id: Option<UserId>,
19    /// Only entries of this kind of action.
20    pub action_type: Option<AuditLogEvent>,
21    /// Entries older than this one.
22    pub before: Option<AuditLogEntryId>,
23    /// Entries newer than this one.
24    pub after: Option<AuditLogEntryId>,
25    /// The page size (1-100, default 50).
26    pub limit: Option<u8>,
27}