Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions NetCord/Rest/RestClient.Channel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ public async Task<Channel> ModifyGuildChannelAsync(ulong channelId, Action<Guild
return Channel.CreateFromJson(await (await SendRequestAsync(HttpMethod.Patch, content, $"/channels/{channelId}", null, new(channelId), properties, cancellationToken: cancellationToken).ConfigureAwait(false)).ToObjectAsync(Serialization.Default.JsonChannel).ConfigureAwait(false), this);
}

[GenerateAlias([typeof(VoiceGuildChannel)], nameof(VoiceGuildChannel.Id))]
public async Task SetVoiceGuildChannelStatusAsync(ulong channelId, VoiceGuildChannelStatusProperties statusProperties, RestRequestProperties? properties = null, CancellationToken cancellationToken = default)
{
using (HttpContent content = new JsonContent<VoiceGuildChannelStatusProperties>(statusProperties, Serialization.Default.VoiceGuildChannelStatusProperties))
await SendRequestAsync(HttpMethod.Put, content, $"/channels/{channelId}/voice-status", null, new(channelId), properties, cancellationToken: cancellationToken).ConfigureAwait(false);
}

[GenerateAlias([typeof(Channel)], nameof(Channel.Id), Cast = true)]
public async Task<Channel> DeleteChannelAsync(ulong channelId, RestRequestProperties? properties = null, CancellationToken cancellationToken = default)
=> Channel.CreateFromJson(await (await SendRequestAsync(HttpMethod.Delete, $"/channels/{channelId}", null, new(channelId), properties, cancellationToken: cancellationToken).ConfigureAwait(false)).ToObjectAsync(Serialization.Default.JsonChannel).ConfigureAwait(false), this);
Expand Down Expand Up @@ -206,12 +213,10 @@ public async Task<IEnumerable<RestInvite>> GetGuildChannelInvitesAsync(ulong cha

[GenerateAlias([typeof(IGuildChannel)], nameof(IGuildChannel.Id))]
public async Task<RestInvite> CreateGuildChannelInviteAsync(ulong channelId, InviteProperties? inviteProperties = null, RestRequestProperties? properties = null, CancellationToken cancellationToken = default)
#pragma warning disable CS8620 // Argument cannot be used for parameter due to differences in the nullability of reference types.
{
using (HttpContent content = new JsonContent<InviteProperties?>(inviteProperties, Serialization.Default.InviteProperties))
return new(await (await SendRequestAsync(HttpMethod.Post, content, $"/channels/{channelId}/invites", null, new(channelId), properties, cancellationToken: cancellationToken).ConfigureAwait(false)).ToObjectAsync(Serialization.Default.JsonRestInvite).ConfigureAwait(false), this);
Comment thread
KubaZ2 marked this conversation as resolved.
}
#pragma warning restore CS8620 // Argument cannot be used for parameter due to differences in the nullability of reference types.

[GenerateAlias([typeof(IGuildChannel)], nameof(IGuildChannel.Id))]
public Task DeleteGuildChannelPermissionAsync(ulong channelId, ulong overwriteId, RestRequestProperties? properties = null, CancellationToken cancellationToken = default)
Expand Down
14 changes: 14 additions & 0 deletions NetCord/Rest/VoiceGuildChannelStatusProperties.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System.Text.Json.Serialization;

namespace NetCord.Rest;

[GenerateMethodsForProperties]
public partial class VoiceGuildChannelStatusProperties
Comment thread
KubaZ2 marked this conversation as resolved.
{
/// <summary>
/// The new voice channel status (max 500 characters).
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("status")]
public string? Status { get; set; }
}
1 change: 1 addition & 0 deletions NetCord/Serialization.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ namespace NetCord;
[JsonSerializable(typeof(AutoModerationRuleOptions))]
[JsonSerializable(typeof(GroupDMChannelOptions))]
[JsonSerializable(typeof(GuildChannelOptions))]
[JsonSerializable(typeof(VoiceGuildChannelStatusProperties))]
[JsonSerializable(typeof(JsonMessage[]))]
[JsonSerializable(typeof(JsonUser[]))]
[JsonSerializable(typeof(BulkDeleteMessagesProperties))]
Expand Down