Browse Source

Document remaining audit log data types

pull/1161/head
sarcasmloading 7 years ago
parent
commit
d4598bac11
8 changed files with 192 additions and 4 deletions
  1. +15
    -0
      src/Discord.Net.Rest/Entities/AuditLogs/DataTypes/RoleDeleteAuditLogData.cs
  2. +37
    -0
      src/Discord.Net.Rest/Entities/AuditLogs/DataTypes/RoleEditInfo.cs
  3. +21
    -0
      src/Discord.Net.Rest/Entities/AuditLogs/DataTypes/RoleUpdateAuditLogData.cs
  4. +9
    -0
      src/Discord.Net.Rest/Entities/AuditLogs/DataTypes/UnbanAuditLogData.cs
  5. +32
    -2
      src/Discord.Net.Rest/Entities/AuditLogs/DataTypes/WebhookCreateAuditLogData.cs
  6. +34
    -0
      src/Discord.Net.Rest/Entities/AuditLogs/DataTypes/WebhookDeleteAuditLogData.cs
  7. +22
    -0
      src/Discord.Net.Rest/Entities/AuditLogs/DataTypes/WebhookInfo.cs
  8. +22
    -2
      src/Discord.Net.Rest/Entities/AuditLogs/DataTypes/WebhookUpdateAuditLogData.cs

+ 15
- 0
src/Discord.Net.Rest/Entities/AuditLogs/DataTypes/RoleDeleteAuditLogData.cs View File

@@ -5,6 +5,9 @@ using EntryModel = Discord.API.AuditLogEntry;

namespace Discord.Rest
{
/// <summary>
/// Contains audit log data relating to a role deletion.
/// </summary>
public class RoleDeleteAuditLogData : IAuditLogData
{
private RoleDeleteAuditLogData(ulong id, RoleEditInfo props)
@@ -41,7 +44,19 @@ namespace Discord.Rest
new RoleEditInfo(color, mentionable, hoist, name, permissions));
}

/// <summary>
/// Gets the ID of the role that has been deleted.
/// </summary>
/// <return>
/// A <see cref="ulong"/> representing the snowflake identifer to the role that has been deleted.
/// </return>
public ulong RoleId { get; }
/// <summary>
/// Gets the role information that has been deleted.
/// </summary>
/// <return>
/// An information object representing the properties of the role that has been deleted.
/// </return>
public RoleEditInfo Properties { get; }
}
}

+ 37
- 0
src/Discord.Net.Rest/Entities/AuditLogs/DataTypes/RoleEditInfo.cs View File

@@ -1,5 +1,8 @@
namespace Discord.Rest
{
/// <summary>
/// Represents information for a role edit.
/// </summary>
public struct RoleEditInfo
{
internal RoleEditInfo(Color? color, bool? mentionable, bool? hoist, string name,
@@ -12,10 +15,44 @@ namespace Discord.Rest
Permissions = permissions;
}

/// <summary>
/// Gets the color of this role.
/// </summary>
/// <returns>
/// A color object representing the color assigned to this role; <c>null</c> if this role does not have a
/// color.
/// </returns>
public Color? Color { get; }
/// <summary>
/// Determines whether this role is mentionable (i.e. it can be mentioned in a text channel).
/// </summary>
/// <returns>
/// <c>true</c> if other members can mention this role in a text channel; otherwise <c>false</c>.
/// </returns>
public bool? Mentionable { get; }
/// <summary>
/// Determines whether this role is hoisted (i.e its members will appear in a seperate section on the user
/// list).
/// </summary>
/// <returns>
/// <c>true</c> if this role's members will appear in a seperate section in the user list; otherwise
/// <c>false</c>.
/// </returns>
public bool? Hoist { get; }
/// <summary>
/// Gets the name of this role.
/// </summary>
/// <returns>
/// A string containing the name of this role.
/// </returns>
public string Name { get; }
/// <summary>
/// Gets the permissions assigned to this role.
/// </summary>
/// <returns>
/// A guild permissions object representing the permissions that have been assigned to this role; <c>null</c>
/// if no permissions have been assigned.
/// </returns>
public GuildPermissions? Permissions { get; }
}
}

+ 21
- 0
src/Discord.Net.Rest/Entities/AuditLogs/DataTypes/RoleUpdateAuditLogData.cs View File

@@ -5,6 +5,9 @@ using EntryModel = Discord.API.AuditLogEntry;

namespace Discord.Rest
{
/// <summary>
/// Contains audit log data related to a role update.
/// </summary>
public class RoleUpdateAuditLogData : IAuditLogData
{
private RoleUpdateAuditLogData(ulong id, RoleEditInfo oldProps, RoleEditInfo newProps)
@@ -55,8 +58,26 @@ namespace Discord.Rest
return new RoleUpdateAuditLogData(entry.TargetId.Value, oldProps, newProps);
}

/// <summary>
/// Gets the ID of the role that has been changed.
/// </summary>
/// <returns>
/// A <see cref="ulong"/> representing the snowflake identifier of the role that has been changed.
/// </returns>
public ulong RoleId { get; }
/// <summary>
/// Gets the role information before the changes.
/// </summary>
/// <returns>
/// A role information object containing the role information before the changes were made.
/// </returns>
public RoleEditInfo Before { get; }
/// <summary>
/// Gets the role information after the changes.
/// </summary>
/// <returns>
/// A role information object containing the role information after the changes were made.
/// </returns>
public RoleEditInfo After { get; }
}
}

+ 9
- 0
src/Discord.Net.Rest/Entities/AuditLogs/DataTypes/UnbanAuditLogData.cs View File

@@ -5,6 +5,9 @@ using EntryModel = Discord.API.AuditLogEntry;

namespace Discord.Rest
{
/// <summary>
/// Contains audit log data related to an unban.
/// </summary>
public class UnbanAuditLogData : IAuditLogData
{
private UnbanAuditLogData(IUser user)
@@ -18,6 +21,12 @@ namespace Discord.Rest
return new UnbanAuditLogData(RestUser.Create(discord, userInfo));
}

/// <summary>
/// Gets the user that was unbanned.
/// </summary>
/// <returns>
/// A user object representing the user that was unbanned.
/// </returns>
public IUser Target { get; }
}
}

+ 32
- 2
src/Discord.Net.Rest/Entities/AuditLogs/DataTypes/WebhookCreateAuditLogData.cs View File

@@ -5,6 +5,9 @@ using EntryModel = Discord.API.AuditLogEntry;

namespace Discord.Rest
{
/// <summary>
/// Contains audit log data related to a webhook creation.
/// </summary>
public class WebhookCreateAuditLogData : IAuditLogData
{
private WebhookCreateAuditLogData(IWebhook webhook, WebhookType type, string name, ulong channelId)
@@ -33,12 +36,39 @@ namespace Discord.Rest
return new WebhookCreateAuditLogData(webhook, type, name, channelId);
}

//Corresponds to the *current* data
// Doc Note: Corresponds to the *current* data

/// <summary>
/// Gets the webhook that was created.
/// </summary>
/// <returns>
/// A webhook object representing the webhook that was created.
/// </returns>
public IWebhook Webhook { get; }

//Corresponds to the *audit log* data
// Doc Note: Corresponds to the *audit log* data

/// <summary>
/// Gets the type of webhook that was created.
/// </summary>
/// <returns>
/// The type of webhook that was created.
/// </returns>
public WebhookType Type { get; }

/// <summary>
/// Gets the name of the webhook.
/// </summary>
/// <returns>
/// A string containing the name of the webhook.
/// </returns>
public string Name { get; }
/// <summary>
/// Gets the ID of the channel that the webhook can send to.
/// </summary>
/// <returns>
/// A <see cref="ulong"/> representing the snowflake identifier of the channel that the webhook can send to.
/// </returns>
public ulong ChannelId { get; }
}
}

+ 34
- 0
src/Discord.Net.Rest/Entities/AuditLogs/DataTypes/WebhookDeleteAuditLogData.cs View File

@@ -5,6 +5,9 @@ using EntryModel = Discord.API.AuditLogEntry;

namespace Discord.Rest
{
/// <summary>
/// Contains audit log data related to a webhook deletion.
/// </summary>
public class WebhookDeleteAuditLogData : IAuditLogData
{
private WebhookDeleteAuditLogData(ulong id, ulong channel, WebhookType type, string name, string avatar)
@@ -33,10 +36,41 @@ namespace Discord.Rest
return new WebhookDeleteAuditLogData(entry.TargetId.Value, channelId, type, name, avatarHash);
}

/// <summary>
/// Gets the ID of the webhook that was deleted.
/// </summary>
/// <returns>
/// A <see cref="ulong"/> representing the snowflake identifier of the webhook that was deleted.
/// </returns>
public ulong WebhookId { get; }
/// <summary>
/// Gets the ID of the channel that the webhook could send to.
/// </summary>
/// <returns>
/// A <see cref="ulong"/> representing the snowflake identifier of the channel that the webhook could send
/// to.
/// </returns>
public ulong ChannelId { get; }
/// <summary>
/// Gets the type of the webhook that was deleted.
/// </summary>
/// <returns>
/// The type of webhook that was deleted.
/// </returns>
public WebhookType Type { get; }
/// <summary>
/// Gets the name of the webhook that was deleted.
/// </summary>
/// <returns>
/// A string containing the name of the webhook that was deleted.
/// </returns>
public string Name { get; }
/// <summary>
/// Gets the hash value of the webhook's avatar.
/// </summary>
/// <returns>
/// A string containing the hash of the webhook's avatar.
/// </returns>
public string Avatar { get; }
}
}

+ 22
- 0
src/Discord.Net.Rest/Entities/AuditLogs/DataTypes/WebhookInfo.cs View File

@@ -1,5 +1,8 @@
namespace Discord.Rest
{
/// <summary>
/// Represents information for a webhook.
/// </summary>
public struct WebhookInfo
{
internal WebhookInfo(string name, ulong? channelId, string avatar)
@@ -9,8 +12,27 @@ namespace Discord.Rest
Avatar = avatar;
}

/// <summary>
/// Gets the name of this webhook.
/// </summary>
/// <returns>
/// A string containing the name of this webhook.
/// </returns>
public string Name { get; }
/// <summary>
/// Gets the ID of the channel that this webhook sends to.
/// </summary>
/// <returns>
/// A <see cref="ulong"/> representing the snowflake identifier of the channel that this webhook can send
/// to.
/// </returns>
public ulong? ChannelId { get; }
/// <summary>
/// Gets the hash value of this webhook's avatar.
/// </summary>
/// <returns>
/// A string containing the hash of this webhook's avatar.
/// </returns>
public string Avatar { get; }
}
}

+ 22
- 2
src/Discord.Net.Rest/Entities/AuditLogs/DataTypes/WebhookUpdateAuditLogData.cs View File

@@ -5,6 +5,9 @@ using EntryModel = Discord.API.AuditLogEntry;

namespace Discord.Rest
{
/// <summary>
/// Contains audit log data related to a webhook update.
/// </summary>
public class WebhookUpdateAuditLogData : IAuditLogData
{
private WebhookUpdateAuditLogData(IWebhook webhook, WebhookInfo before, WebhookInfo after)
@@ -38,11 +41,28 @@ namespace Discord.Rest
return new WebhookUpdateAuditLogData(webhook, before, after);
}

//Again, the *current* data
/// <summary>
/// Gets the webhook that was updated.
/// </summary>
/// <returns>
/// A webhook objet representing the webhook that was updated.
/// </returns>
public IWebhook Webhook { get; }

//And the *audit log* data
/// <summary>
/// Gets the webhook information before the changes.
/// </summary>
/// <returns>
/// A webhook information object representing the webhook before the changes were made.
/// </returns>
public WebhookInfo Before { get; }

/// <summary>
/// Gets the webhook information after the changes.
/// </summary>
/// <returns>
/// A webhook information object representing the webhook after the changes were made.
/// </returns>
public WebhookInfo After { get; }
}
}

Loading…
Cancel
Save