pleroma: add JsonConstructor attribs

This commit is contained in:
uwaa 2024-12-25 23:34:13 +00:00
parent e5273860a6
commit 02ddd4c918
10 changed files with 16 additions and 0 deletions

View file

@ -11,6 +11,11 @@ public class ASObject
[JsonPropertyName("id")] [JsonPropertyName("id")]
public string ID { get; set; } = null!; public string ID { get; set; } = null!;
[JsonConstructor()]
internal ASObject()
{
}
public override string ToString() => ID; public override string ToString() => ID;
public override bool Equals(object? obj) => Equals(obj as ASObject); public override bool Equals(object? obj) => Equals(obj as ASObject);

View file

@ -53,6 +53,7 @@ public class Account : ASObject
} }
} }
[JsonConstructor()]
internal Account() internal Account()
{ {
} }

View file

@ -10,6 +10,7 @@ public class AccountField
public DateTime? VerifiedAt { get; set; } public DateTime? VerifiedAt { get; set; }
[JsonConstructor()]
internal AccountField() internal AccountField()
{ {
} }

View file

@ -50,6 +50,7 @@ public class Attachment
[JsonPropertyName("url")] [JsonPropertyName("url")]
public string URL { get; set; } = null!; public string URL { get; set; } = null!;
[JsonConstructor()]
internal Attachment() internal Attachment()
{ {
} }

View file

@ -8,6 +8,7 @@ public class Context
[JsonPropertyName("descendants")] [JsonPropertyName("descendants")]
public Status[] Descendants { get; set; } = null!; public Status[] Descendants { get; set; } = null!;
[JsonConstructor()]
internal Context() internal Context()
{ {
} }

View file

@ -14,6 +14,7 @@ public class Hashtag
[JsonPropertyName("url")] [JsonPropertyName("url")]
public string URL { get; set; } = null!; public string URL { get; set; } = null!;
[JsonConstructor()]
internal Hashtag() internal Hashtag()
{ {
} }

View file

@ -28,6 +28,7 @@ public class Mention
[JsonPropertyName("username")] [JsonPropertyName("username")]
public string Username { get; set; } = null!; public string Username { get; set; } = null!;
[JsonConstructor()]
internal Mention() internal Mention()
{ {
} }

View file

@ -50,6 +50,7 @@ public class Relationship
[JsonPropertyName("subscribing")] [JsonPropertyName("subscribing")]
public bool Subscribing { get; set; } public bool Subscribing { get; set; }
[JsonConstructor()]
internal Relationship() internal Relationship()
{ {
} }

View file

@ -20,6 +20,7 @@ public class SearchResults
[JsonPropertyName("statuses")] [JsonPropertyName("statuses")]
public Status[]? Statuses { get; set; } public Status[]? Statuses { get; set; }
[JsonConstructor()]
internal SearchResults() internal SearchResults()
{ {
} }

View file

@ -140,6 +140,7 @@ public class Status : ASObject
[JsonIgnore] [JsonIgnore]
public string Content => Pleroma?.Content?.Plain ?? HtmlContent; public string Content => Pleroma?.Content?.Plain ?? HtmlContent;
[JsonConstructor()]
internal Status() internal Status()
{ {
} }
@ -170,6 +171,7 @@ public class PleromaStatusData
[JsonPropertyName("quote_id")] [JsonPropertyName("quote_id")]
public string? QuoteID { get; set; } public string? QuoteID { get; set; }
[JsonConstructor()]
internal PleromaStatusData() internal PleromaStatusData()
{ {
} }
@ -180,6 +182,7 @@ public class PleromaStatusContent
[JsonPropertyName("text/plain")] [JsonPropertyName("text/plain")]
public string Plain { get; set; } = null!; public string Plain { get; set; } = null!;
[JsonConstructor()]
internal PleromaStatusContent() internal PleromaStatusContent()
{ {
} }