nit: remove redundant CreateGuildRoleParams

CreateGuildRoleParams is identical to ModifyGuildRoleParams, so just use
the latter when creating new roles.
This commit is contained in:
Christopher Felegy
2020-06-15 00:29:16 -04:00
parent 5430cc8df9
commit 3df05399ea
3 changed files with 2 additions and 21 deletions

View File

@@ -1,19 +0,0 @@
using Newtonsoft.Json;
namespace Discord.API.Rest
{
[JsonObject(MemberSerialization = MemberSerialization.OptIn)]
public class CreateGuildRoleParams
{
[JsonProperty("name")]
public Optional<string> Name { get; set; }
[JsonProperty("permissions")]
public Optional<ulong> Permissions { get; set; }
[JsonProperty("color")]
public Optional<uint> Color { get; set; }
[JsonProperty("hoist")]
public Optional<bool> Hoist { get; set; }
[JsonProperty("mentionable")]
public Optional<bool> Mentionable { get; set; }
}
}

View File

@@ -1174,7 +1174,7 @@ namespace Discord.API
var ids = new BucketIds(guildId: guildId); var ids = new BucketIds(guildId: guildId);
return await SendAsync<IReadOnlyCollection<Role>>("GET", () => $"guilds/{guildId}/roles", ids, options: options).ConfigureAwait(false); return await SendAsync<IReadOnlyCollection<Role>>("GET", () => $"guilds/{guildId}/roles", ids, options: options).ConfigureAwait(false);
} }
public async Task<Role> CreateGuildRoleAsync(ulong guildId, Rest.CreateGuildRoleParams args, RequestOptions options = null) public async Task<Role> CreateGuildRoleAsync(ulong guildId, Rest.ModifyGuildRoleParams args, RequestOptions options = null)
{ {
Preconditions.NotEqual(guildId, 0, nameof(guildId)); Preconditions.NotEqual(guildId, 0, nameof(guildId));
options = RequestOptions.CreateOrClone(options); options = RequestOptions.CreateOrClone(options);

View File

@@ -264,7 +264,7 @@ namespace Discord.Rest
{ {
if (name == null) throw new ArgumentNullException(paramName: nameof(name)); if (name == null) throw new ArgumentNullException(paramName: nameof(name));
var createGuildRoleParams = new API.Rest.CreateGuildRoleParams var createGuildRoleParams = new API.Rest.ModifyGuildRoleParams
{ {
Color = color?.RawValue ?? Optional.Create<uint>(), Color = color?.RawValue ?? Optional.Create<uint>(),
Hoist = isHoisted, Hoist = isHoisted,