sharp-chat/SharpChat/Misuzu/MisuzuBanInfo.cs

33 lines
943 B
C#
Raw Normal View History

using System;
using System.Text.Json.Serialization;
namespace SharpChat.Misuzu {
public class MisuzuBanInfo {
[JsonPropertyName("is_ban")]
public bool IsBanned { get; set; }
[JsonPropertyName("user_id")]
2024-05-10 19:18:55 +00:00
public string? UserId { get; set; }
[JsonPropertyName("ip_addr")]
2024-05-10 19:18:55 +00:00
public string? RemoteAddress { get; set; }
[JsonPropertyName("is_perma")]
public bool IsPermanent { get; set; }
[JsonPropertyName("expires")]
public DateTimeOffset ExpiresAt { get; set; }
// only populated in list request
[JsonPropertyName("user_name")]
2024-05-10 19:18:55 +00:00
public string? UserName { get; set; }
[JsonPropertyName("user_colour")]
public int UserColourRaw { get; set; }
public bool HasExpired => !IsPermanent && DateTimeOffset.UtcNow >= ExpiresAt;
public ChatColour UserColour => ChatColour.FromMisuzu(UserColourRaw);
}
}