Audit Logs implementation (#1055)
* Copy audit logs impl from old branch and clean up I suck at using git, so I'm gonna use brute force. * Remove unnecessary TODOs Category channels do not provide any new information, and the other I forgot to remove beforehand * Add invite update data, clean up after feedback * Remove TODOs, add WebhookType enum for future use WebhookType is a future-use type, as currently audit logs are the only thing which may return it.
This commit is contained in:
committed by
Christopher F
parent
97c893107b
commit
39dffe8585
16
src/Discord.Net.Rest/API/Common/AuditLog.cs
Normal file
16
src/Discord.Net.Rest/API/Common/AuditLog.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Discord.API
|
||||
{
|
||||
internal class AuditLog
|
||||
{
|
||||
[JsonProperty("webhooks")]
|
||||
public Webhook[] Webhooks { get; set; }
|
||||
|
||||
[JsonProperty("users")]
|
||||
public User[] Users { get; set; }
|
||||
|
||||
[JsonProperty("audit_log_entries")]
|
||||
public AuditLogEntry[] Entries { get; set; }
|
||||
}
|
||||
}
|
||||
17
src/Discord.Net.Rest/API/Common/AuditLogChange.cs
Normal file
17
src/Discord.Net.Rest/API/Common/AuditLogChange.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace Discord.API
|
||||
{
|
||||
internal class AuditLogChange
|
||||
{
|
||||
[JsonProperty("key")]
|
||||
public string ChangedProperty { get; set; }
|
||||
|
||||
[JsonProperty("new_value")]
|
||||
public JToken NewValue { get; set; }
|
||||
|
||||
[JsonProperty("old_value")]
|
||||
public JToken OldValue { get; set; }
|
||||
}
|
||||
}
|
||||
26
src/Discord.Net.Rest/API/Common/AuditLogEntry.cs
Normal file
26
src/Discord.Net.Rest/API/Common/AuditLogEntry.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Discord.API
|
||||
{
|
||||
internal class AuditLogEntry
|
||||
{
|
||||
[JsonProperty("target_id")]
|
||||
public ulong? TargetId { get; set; }
|
||||
[JsonProperty("user_id")]
|
||||
public ulong UserId { get; set; }
|
||||
|
||||
[JsonProperty("changes")]
|
||||
public AuditLogChange[] Changes { get; set; }
|
||||
[JsonProperty("options")]
|
||||
public AuditLogOptions Options { get; set; }
|
||||
|
||||
[JsonProperty("id")]
|
||||
public ulong Id { get; set; }
|
||||
|
||||
[JsonProperty("action_type")]
|
||||
public ActionType Action { get; set; }
|
||||
|
||||
[JsonProperty("reason")]
|
||||
public string Reason { get; set; }
|
||||
}
|
||||
}
|
||||
27
src/Discord.Net.Rest/API/Common/AuditLogOptions.cs
Normal file
27
src/Discord.Net.Rest/API/Common/AuditLogOptions.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Discord.API
|
||||
{
|
||||
internal class AuditLogOptions
|
||||
{
|
||||
//Message delete
|
||||
[JsonProperty("count")]
|
||||
public int? MessageDeleteCount { get; set; }
|
||||
[JsonProperty("channel_id")]
|
||||
public ulong? MessageDeleteChannelId { get; set; }
|
||||
|
||||
//Prune
|
||||
[JsonProperty("delete_member_days")]
|
||||
public int? PruneDeleteMemberDays { get; set; }
|
||||
[JsonProperty("members_removed")]
|
||||
public int? PruneMembersRemoved { get; set; }
|
||||
|
||||
//Overwrite Update
|
||||
[JsonProperty("role_name")]
|
||||
public string OverwriteRoleName { get; set; }
|
||||
[JsonProperty("type")]
|
||||
public string OverwriteType { get; set; }
|
||||
[JsonProperty("id")]
|
||||
public ulong? OverwriteTargetId { get; set; }
|
||||
}
|
||||
}
|
||||
8
src/Discord.Net.Rest/API/Rest/GetAuditLogsParams.cs
Normal file
8
src/Discord.Net.Rest/API/Rest/GetAuditLogsParams.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace Discord.API.Rest
|
||||
{
|
||||
class GetAuditLogsParams
|
||||
{
|
||||
public Optional<int> Limit { get; set; }
|
||||
public Optional<ulong> BeforeEntryId { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user