54 lines
No EOL
1.4 KiB
C#
54 lines
No EOL
1.4 KiB
C#
using System.Text.Json.Serialization;
|
|
|
|
namespace Uwaa.Pleroma;
|
|
|
|
public class Status
|
|
{
|
|
[JsonPropertyName("id")]
|
|
public string ID { get; set; } = null!;
|
|
|
|
[JsonPropertyName("content")]
|
|
public string HtmlContent { get; set; } = null!;
|
|
|
|
[JsonPropertyName("account")]
|
|
public Account Account { get; set; } = null!;
|
|
|
|
[JsonPropertyName("created_at")]
|
|
public DateTime CreatedAt { get; set; }
|
|
|
|
[JsonPropertyName("pleroma")]
|
|
public PleromaObject Pleroma { get; set; } = null!;
|
|
|
|
[JsonPropertyName("in_reply_to_account_id")]
|
|
public string? ReplyToAccount { get; set; } = null;
|
|
|
|
[JsonPropertyName("in_reply_to_id")]
|
|
public string? ReplyToStatus { get; set; } = null;
|
|
|
|
[JsonPropertyName("mentions")]
|
|
public Mention[] Mentions { get; set; } = Array.Empty<Mention>();
|
|
|
|
[JsonPropertyName("language")]
|
|
public string? Language { get; set; }
|
|
|
|
[JsonPropertyName("pinned")]
|
|
public bool Pinned { get; set; }
|
|
|
|
[JsonIgnore]
|
|
public string Content => Pleroma?.Content?.Plain ?? HtmlContent;
|
|
|
|
public bool CheckMention(string id)
|
|
{
|
|
return ReplyToAccount == id || Mentions.Any(m => m.ID == id);
|
|
}
|
|
|
|
public override string ToString() => $"{Account?.Username ?? "unknown"}: \"{Content}\"";
|
|
}
|
|
|
|
public class Mention
|
|
{
|
|
public static implicit operator string(Mention mention) => mention.ID;
|
|
|
|
[JsonPropertyName("id")]
|
|
public string ID { get; set; } = null!;
|
|
} |