Skip to content

Commit

Permalink
Add guild_scheduled_event_id field to stage instance creation.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nihlus committed Oct 29, 2023
1 parent f117a30 commit ac8a97f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public interface IDiscordRestStageInstanceAPI
/// <param name="sendStartNotification">
/// Indicates whether @everyone should be notified that a stage instance has started.
/// </param>
/// <param name="guildScheduledEventID">The scheduled event associated with this stage instance.</param>
/// <param name="reason">The reason to mark the action in the audit log with.</param>
/// <param name="ct">The cancellation token for this operation.</param>
/// <returns>A result which may or may not have succeeded.</returns>
Expand All @@ -53,6 +54,7 @@ Task<Result<IStageInstance>> CreateStageInstanceAsync
string topic,
Optional<StagePrivacyLevel> privacyLevel = default,
Optional<bool> sendStartNotification = default,
Optional<Snowflake> guildScheduledEventID = default,
Optional<string> reason = default,
CancellationToken ct = default
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public virtual Task<Result<IStageInstance>> CreateStageInstanceAsync
string topic,
Optional<StagePrivacyLevel> privacyLevel = default,
Optional<bool> sendStartNotification = default,
Optional<Snowflake> guildScheduledEventID = default,
Optional<string> reason = default,
CancellationToken ct = default
)
Expand All @@ -79,6 +80,7 @@ public virtual Task<Result<IStageInstance>> CreateStageInstanceAsync
json.Write("topic", topic, this.JsonOptions);
json.Write("privacy_level", privacyLevel, this.JsonOptions);
json.Write("send_start_notification", sendStartNotification, this.JsonOptions);
json.Write("guild_scheduled_event_id", guildScheduledEventID, this.JsonOptions);
}
)
.WithRateLimitContext(this.RateLimitCache),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
using Remora.Discord.API.Abstractions.Objects;
using Remora.Discord.API.Abstractions.Rest;
using Remora.Discord.Rest.API;
using Remora.Discord.Rest.Tests.Extensions;
using Remora.Discord.Rest.Tests.TestBases;
using Remora.Discord.Tests;
using Remora.Rest.Xunit.Extensions;
Expand Down Expand Up @@ -65,6 +66,7 @@ public async Task PerformsRequestCorrectly()
var topic = "aa";
var privacyLevel = StagePrivacyLevel.GuildOnly;
var sendNotification = true;
var guildScheduledEventID = DiscordSnowflake.New(2);
var reason = "test";

var api = CreateAPI
Expand All @@ -77,15 +79,26 @@ public async Task PerformsRequestCorrectly()
json => json.IsObject
(
o => o
.WithProperty("channel_id", p => p.Is(channelID.ToString()))
.WithProperty("channel_id", p => p.Is(channelID))
.WithProperty("topic", p => p.Is(topic))
.WithProperty("privacy_level", p => p.Is((int)privacyLevel))
.WithProperty("send_start_notification", p => p.Is(sendNotification))
.WithProperty("guild_scheduled_event_id", p => p.Is(guildScheduledEventID))
)
)
.Respond("application/json", SampleRepository.Samples[typeof(IStageInstance)])
);

var result = await api.CreateStageInstanceAsync(channelID, topic, privacyLevel, sendNotification, reason);
var result = await api.CreateStageInstanceAsync
(
channelID,
topic,
privacyLevel,
sendNotification,
guildScheduledEventID,
reason
);

ResultAssert.Successful(result);
}
}
Expand Down

0 comments on commit ac8a97f

Please sign in to comment.