diff --git a/Backend/Remora.Discord.API.Abstractions/API/Rest/IDiscordRestGuildScheduledEventAPI.cs b/Backend/Remora.Discord.API.Abstractions/API/Rest/IDiscordRestGuildScheduledEventAPI.cs
index 98af664a8a..a61a656147 100644
--- a/Backend/Remora.Discord.API.Abstractions/API/Rest/IDiscordRestGuildScheduledEventAPI.cs
+++ b/Backend/Remora.Discord.API.Abstractions/API/Rest/IDiscordRestGuildScheduledEventAPI.cs
@@ -24,6 +24,7 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
+using JetBrains.Annotations;
using Remora.Discord.API.Abstractions.Objects;
using Remora.Rest.Core;
using Remora.Results;
@@ -33,6 +34,7 @@ namespace Remora.Discord.API.Abstractions.Rest;
///
/// Represents the Discord Guild Scheduled Event API.
///
+[PublicAPI]
public interface IDiscordRestGuildScheduledEventAPI
{
///
@@ -63,6 +65,7 @@ Task>> ListScheduledEventsForGuildAsy
/// The time at which the event is scheduled to end, if any.
/// The description of the event, if any (1-100 characters).
/// The entity type of the event.
+ /// The reason to mark the action in the audit log with.
/// The cancellation token for this operation.
/// A creation result which may or may not have succeeded.
Task> CreateGuildScheduledEventAsync
@@ -76,6 +79,7 @@ Task> CreateGuildScheduledEventAsync
Optional scheduledEndTime,
Optional description,
GuildScheduledEventEntityType entityType,
+ Optional reason = default,
CancellationToken ct = default
);
@@ -109,6 +113,7 @@ Task> GetGuildScheduledEventAsync
/// The new description of the event (1-100 characters).
/// The new entity type associated with the event.
/// The new status of the event.
+ /// The reason to mark the action in the audit log with.
/// The cancellation token for this operation.
/// A modification result which may or may not have succeeded.
Task> ModifyGuildScheduledEventAsync
@@ -124,6 +129,7 @@ Task> ModifyGuildScheduledEventAsync
Optional description = default,
Optional entityType = default,
Optional status = default,
+ Optional reason = default,
CancellationToken ct = default
);
diff --git a/Backend/Remora.Discord.Rest/API/GuildScheduledEvents/DiscordRestGuildScheduledEventAPI.cs b/Backend/Remora.Discord.Rest/API/GuildScheduledEvents/DiscordRestGuildScheduledEventAPI.cs
index 361d71f753..83b206afdd 100644
--- a/Backend/Remora.Discord.Rest/API/GuildScheduledEvents/DiscordRestGuildScheduledEventAPI.cs
+++ b/Backend/Remora.Discord.Rest/API/GuildScheduledEvents/DiscordRestGuildScheduledEventAPI.cs
@@ -84,6 +84,7 @@ public async Task> CreateGuildScheduledEventAsync
Optional scheduledEndTime,
Optional description,
GuildScheduledEventEntityType entityType,
+ Optional reason = default,
CancellationToken ct = default
)
{
@@ -139,6 +140,7 @@ entityMetadata.Value.Location.Value.Length is < 1 or > 100
}
);
+ b.AddAuditLogReason(reason);
b.WithRateLimitContext();
},
ct: ct
@@ -184,6 +186,7 @@ public async Task> ModifyGuildScheduledEventAsync
Optional description = default,
Optional entityType = default,
Optional status = default,
+ Optional reason = default,
CancellationToken ct = default
)
{
@@ -240,6 +243,7 @@ entityMetadata.Value.Location.Value.Length is < 1 or > 100
}
);
+ b.AddAuditLogReason(reason);
b.WithRateLimitContext();
},
ct: ct
diff --git a/Tests/Remora.Discord.Rest.Tests/API/GuildScheduledEvents/DiscordRestGuildScheduledEventAPITests.cs b/Tests/Remora.Discord.Rest.Tests/API/GuildScheduledEvents/DiscordRestGuildScheduledEventAPITests.cs
index d80045213e..9db109421a 100644
--- a/Tests/Remora.Discord.Rest.Tests/API/GuildScheduledEvents/DiscordRestGuildScheduledEventAPITests.cs
+++ b/Tests/Remora.Discord.Rest.Tests/API/GuildScheduledEvents/DiscordRestGuildScheduledEventAPITests.cs
@@ -92,6 +92,7 @@ public async Task PerformsRequestCorrectly()
var scheduledEndTime = scheduledStartTime.AddHours(1);
var description = "booga";
var entityType = GuildScheduledEventEntityType.StageInstance;
+ var reason = "aaa";
var api = CreateAPI
(
@@ -116,6 +117,7 @@ public async Task PerformsRequestCorrectly()
.WithProperty("entity_type", p => p.Is((int)entityType))
)
)
+ .WithHeaders(Constants.AuditLogHeaderName, reason)
.Respond("application/json", SampleRepository.Samples[typeof(IGuildScheduledEvent)])
);
@@ -129,7 +131,8 @@ public async Task PerformsRequestCorrectly()
scheduledStartTime,
scheduledEndTime,
description,
- entityType
+ entityType,
+ reason
);
ResultAssert.Successful(result);
@@ -189,6 +192,7 @@ public async Task PerformsRequestCorrectly()
var description = "booga";
var entityType = GuildScheduledEventEntityType.StageInstance;
var status = GuildScheduledEventStatus.Completed;
+ var reason = "aaa";
var api = CreateAPI
(
@@ -214,6 +218,7 @@ public async Task PerformsRequestCorrectly()
.WithProperty("status", p => p.Is((int)status))
)
)
+ .WithHeaders(Constants.AuditLogHeaderName, reason)
.Respond("application/json", SampleRepository.Samples[typeof(IGuildScheduledEvent)])
);
@@ -229,7 +234,8 @@ public async Task PerformsRequestCorrectly()
scheduledEndTime,
description,
entityType,
- status
+ status,
+ reason
);
ResultAssert.Successful(result);