-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
79 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,32 @@ | ||
using Kook.Net.Converters; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace Kook.API; | ||
|
||
internal class Role | ||
{ | ||
[JsonPropertyName("role_id")] public uint Id { get; set; } | ||
[JsonPropertyName("name")] public string Name { get; set; } | ||
[JsonPropertyName("color")] public uint Color { get; set; } | ||
[JsonPropertyName("position")] public int Position { get; set; } | ||
[JsonPropertyName("hoist")] public int Hoist { get; set; } | ||
[JsonPropertyName("mentionable")] public int Mentionable { get; set; } | ||
[JsonPropertyName("permissions")] public ulong Permissions { get; set; } | ||
[JsonPropertyName("type")] public RoleType? Type { get; set; } | ||
[JsonPropertyName("role_id")] | ||
public uint Id { get; set; } | ||
|
||
[JsonPropertyName("name")] | ||
public string Name { get; set; } | ||
|
||
[JsonPropertyName("color")] | ||
[JsonConverter(typeof(RawValueColorConverter))] | ||
public Color Color { get; set; } | ||
|
||
[JsonPropertyName("position")] | ||
public int Position { get; set; } | ||
|
||
[JsonPropertyName("hoist")] | ||
public int Hoist { get; set; } | ||
|
||
[JsonPropertyName("mentionable")] | ||
public int Mentionable { get; set; } | ||
|
||
[JsonPropertyName("permissions")] | ||
public ulong Permissions { get; set; } | ||
|
||
[JsonPropertyName("type")] | ||
public RoleType? Type { get; set; } | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
src/Kook.Net.Rest/Net/Converters/Cards/RawValueColorConverter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System.Text.Json; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace Kook.Net.Converters; | ||
|
||
internal class RawValueColorConverter : JsonConverter<Color> | ||
{ | ||
public override Color Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) | ||
{ | ||
uint rawValue = reader.GetUInt32(); | ||
return new Color(rawValue); | ||
} | ||
|
||
public override void Write(Utf8JsonWriter writer, Color value, JsonSerializerOptions options) | ||
{ | ||
writer.WriteNumberValue(value.RawValue); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters