2024-12-13 13:25:20 +01:00
|
|
|
|
namespace Uwaa.Pleroma;
|
2024-11-22 09:55:08 +01:00
|
|
|
|
|
|
|
|
|
public class Status
|
|
|
|
|
{
|
2024-12-11 03:49:46 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Pleroma uses 128-bit ids as opposed to Mastodon's 64 bits. However just like Mastodon's ids they are lexically sortable strings
|
|
|
|
|
/// </summary>
|
2024-11-22 09:55:08 +01:00
|
|
|
|
[JsonPropertyName("id")]
|
|
|
|
|
public string ID { get; set; } = null!;
|
|
|
|
|
|
2024-12-11 03:49:46 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// HTML-encoded status content
|
|
|
|
|
/// </summary>
|
2024-11-22 09:55:08 +01:00
|
|
|
|
[JsonPropertyName("content")]
|
|
|
|
|
public string HtmlContent { get; set; } = null!;
|
|
|
|
|
|
2024-12-11 03:49:46 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// The account that authored this status
|
|
|
|
|
/// </summary>
|
2024-11-22 09:55:08 +01:00
|
|
|
|
[JsonPropertyName("account")]
|
|
|
|
|
public Account Account { get; set; } = null!;
|
|
|
|
|
|
2024-12-11 03:49:46 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// The date when this status was created
|
|
|
|
|
/// </summary>
|
2024-11-22 09:55:08 +01:00
|
|
|
|
[JsonPropertyName("created_at")]
|
|
|
|
|
public DateTime CreatedAt { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonPropertyName("pleroma")]
|
|
|
|
|
public PleromaObject Pleroma { get; set; } = null!;
|
|
|
|
|
|
2024-12-11 03:49:46 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// ID of the account being replied to
|
|
|
|
|
/// </summary>
|
2024-11-22 09:55:08 +01:00
|
|
|
|
[JsonPropertyName("in_reply_to_account_id")]
|
|
|
|
|
public string? ReplyToAccount { get; set; } = null;
|
|
|
|
|
|
2024-12-11 03:49:46 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// ID of the status being replied
|
|
|
|
|
/// </summary>
|
2024-11-22 09:55:08 +01:00
|
|
|
|
[JsonPropertyName("in_reply_to_id")]
|
|
|
|
|
public string? ReplyToStatus { get; set; } = null;
|
|
|
|
|
|
2024-12-11 03:49:46 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Mentions of users within the status content
|
|
|
|
|
/// </summary>
|
2024-11-22 09:55:08 +01:00
|
|
|
|
[JsonPropertyName("mentions")]
|
|
|
|
|
public Mention[] Mentions { get; set; } = Array.Empty<Mention>();
|
|
|
|
|
|
2024-12-11 03:49:46 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Primary language of this status
|
|
|
|
|
/// </summary>
|
2024-11-22 09:55:08 +01:00
|
|
|
|
[JsonPropertyName("language")]
|
|
|
|
|
public string? Language { get; set; }
|
|
|
|
|
|
2024-12-11 03:49:46 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Have you pinned this status? Only appears if the status is pinnable.
|
|
|
|
|
/// </summary>
|
2024-11-22 09:55:08 +01:00
|
|
|
|
[JsonPropertyName("pinned")]
|
|
|
|
|
public bool Pinned { get; set; }
|
|
|
|
|
|
2024-12-11 03:49:46 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Visibility of this status
|
|
|
|
|
/// </summary>
|
|
|
|
|
[JsonPropertyName("visibility")]
|
|
|
|
|
public StatusVisibility Visibility { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Plain text content of that status.
|
|
|
|
|
/// </summary>
|
2024-11-22 09:55:08 +01:00
|
|
|
|
[JsonIgnore]
|
2024-11-30 14:14:31 +01:00
|
|
|
|
public string Content => Pleroma?.Content?.Plain ?? HtmlContent;
|
2024-11-22 09:55:08 +01:00
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
2024-12-11 03:49:46 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// The webfinger acct: URI of the mentioned user. Equivalent to <c>username</c> for local users, or <c>username@domain</c> for remote users.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[JsonPropertyName("acct")]
|
|
|
|
|
public string Account { get; set; } = null!;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The account id of the mentioned user
|
|
|
|
|
/// </summary>
|
2024-11-22 09:55:08 +01:00
|
|
|
|
[JsonPropertyName("id")]
|
|
|
|
|
public string ID { get; set; } = null!;
|
2024-12-11 03:49:46 +01:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The location of the mentioned user's profile
|
|
|
|
|
/// </summary>
|
|
|
|
|
[JsonPropertyName("url")]
|
|
|
|
|
public string URL { get; set; } = null!;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The username of the mentioned user
|
|
|
|
|
/// </summary>
|
|
|
|
|
[JsonPropertyName("username")]
|
|
|
|
|
public string Username { get; set; } = null!;
|
|
|
|
|
|
|
|
|
|
public override string ToString() => $"@{Account}";
|
|
|
|
|
}
|