@@ -21,14 +21,5 @@ namespace Discord | |||||
/// Moves the channel to the following position. This property is zero-based. | /// Moves the channel to the following position. This property is zero-based. | ||||
/// </summary> | /// </summary> | ||||
public Optional<int> Position { get; set; } | public Optional<int> Position { get; set; } | ||||
/// <summary> | |||||
/// Gets or sets the category ID for this channel. | |||||
/// </summary> | |||||
/// <remarks> | |||||
/// Setting this value to a category's snowflake identifier will change or set this channel's parent to the | |||||
/// specified channel; setting this value to <c>0</c> will detach this channel from its parent if one | |||||
/// is set. | |||||
/// </remarks> | |||||
public Optional<ulong?> CategoryId { get; set; } | |||||
} | } | ||||
} | } |
@@ -0,0 +1,18 @@ | |||||
namespace Discord | |||||
{ | |||||
/// <summary> | |||||
/// Properties that are used to modify an <see cref="INestedChannel"/> with the specified changes. | |||||
/// </summary> | |||||
public class NestedChannelProperties : GuildChannelProperties | |||||
{ | |||||
/// <summary> | |||||
/// Gets or sets the category ID for this channel. | |||||
/// </summary> | |||||
/// <remarks> | |||||
/// Setting this value to a category's snowflake identifier will change or set this channel's parent to the | |||||
/// specified channel; setting this value to <c>null</c> will detach this channel from its parent if one | |||||
/// is set. | |||||
/// </remarks> | |||||
public Optional<ulong?> CategoryId { get; set; } | |||||
} | |||||
} |
@@ -6,7 +6,7 @@ namespace Discord | |||||
/// Provides properties that are used to modify an <see cref="ITextChannel"/> with the specified changes. | /// Provides properties that are used to modify an <see cref="ITextChannel"/> with the specified changes. | ||||
/// </summary> | /// </summary> | ||||
/// <seealso cref="ITextChannel.ModifyAsync(System.Action{TextChannelProperties}, RequestOptions)"/> | /// <seealso cref="ITextChannel.ModifyAsync(System.Action{TextChannelProperties}, RequestOptions)"/> | ||||
public class TextChannelProperties : GuildChannelProperties | |||||
public class TextChannelProperties : NestedChannelProperties | |||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// Gets or sets the topic of the channel. | /// Gets or sets the topic of the channel. | ||||
@@ -3,7 +3,7 @@ namespace Discord | |||||
/// <summary> | /// <summary> | ||||
/// Provides properties that are used to modify an <see cref="IVoiceChannel" /> with the specified changes. | /// Provides properties that are used to modify an <see cref="IVoiceChannel" /> with the specified changes. | ||||
/// </summary> | /// </summary> | ||||
public class VoiceChannelProperties : GuildChannelProperties | |||||
public class VoiceChannelProperties : NestedChannelProperties | |||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// Gets or sets the bitrate of the voice connections in this channel. Must be greater than 8000. | /// Gets or sets the bitrate of the voice connections in this channel. Must be greater than 8000. | ||||
@@ -10,8 +10,6 @@ namespace Discord.API.Rest | |||||
public Optional<string> Name { get; set; } | public Optional<string> Name { get; set; } | ||||
[JsonProperty("position")] | [JsonProperty("position")] | ||||
public Optional<int> Position { get; set; } | public Optional<int> Position { get; set; } | ||||
[JsonProperty("parent_id")] | |||||
public Optional<ulong?> CategoryId { get; set; } | |||||
[JsonProperty("permission_overwrites")] | [JsonProperty("permission_overwrites")] | ||||
public Optional<Overwrite[]> Overwrites { get; set; } | public Optional<Overwrite[]> Overwrites { get; set; } | ||||
} | } | ||||
@@ -0,0 +1,12 @@ | |||||
#pragma warning disable CS1591 | |||||
using Newtonsoft.Json; | |||||
namespace Discord.API.Rest | |||||
{ | |||||
[JsonObject(MemberSerialization = MemberSerialization.OptIn)] | |||||
internal class ModifyNestedChannelParams : ModifyGuildChannelParams | |||||
{ | |||||
[JsonProperty("parent_id")] | |||||
public Optional<ulong?> CategoryId { get; set; } | |||||
} | |||||
} |
@@ -4,7 +4,7 @@ using Newtonsoft.Json; | |||||
namespace Discord.API.Rest | namespace Discord.API.Rest | ||||
{ | { | ||||
[JsonObject(MemberSerialization = MemberSerialization.OptIn)] | [JsonObject(MemberSerialization = MemberSerialization.OptIn)] | ||||
internal class ModifyTextChannelParams : ModifyGuildChannelParams | |||||
internal class ModifyTextChannelParams : ModifyNestedChannelParams | |||||
{ | { | ||||
[JsonProperty("topic")] | [JsonProperty("topic")] | ||||
public Optional<string> Topic { get; set; } | public Optional<string> Topic { get; set; } | ||||
@@ -1,10 +1,10 @@ | |||||
#pragma warning disable CS1591 | |||||
#pragma warning disable CS1591 | |||||
using Newtonsoft.Json; | using Newtonsoft.Json; | ||||
namespace Discord.API.Rest | namespace Discord.API.Rest | ||||
{ | { | ||||
[JsonObject(MemberSerialization = MemberSerialization.OptIn)] | [JsonObject(MemberSerialization = MemberSerialization.OptIn)] | ||||
internal class ModifyVoiceChannelParams : ModifyGuildChannelParams | |||||
internal class ModifyVoiceChannelParams : ModifyNestedChannelParams | |||||
{ | { | ||||
[JsonProperty("bitrate")] | [JsonProperty("bitrate")] | ||||
public Optional<int> Bitrate { get; set; } | public Optional<int> Bitrate { get; set; } | ||||
@@ -27,8 +27,7 @@ namespace Discord.Rest | |||||
var apiArgs = new API.Rest.ModifyGuildChannelParams | var apiArgs = new API.Rest.ModifyGuildChannelParams | ||||
{ | { | ||||
Name = args.Name, | Name = args.Name, | ||||
Position = args.Position, | |||||
CategoryId = args.CategoryId | |||||
Position = args.Position | |||||
}; | }; | ||||
return await client.ApiClient.ModifyGuildChannelAsync(channel.Id, apiArgs, options).ConfigureAwait(false); | return await client.ApiClient.ModifyGuildChannelAsync(channel.Id, apiArgs, options).ConfigureAwait(false); | ||||
} | } | ||||