[backend/masto-client] Fix json-body list endpoint processing

This commit is contained in:
Laura Hausmann 2024-02-23 00:48:30 +01:00
parent 450f754cf9
commit 95b8a61554
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -1,4 +1,6 @@
using B = Microsoft.AspNetCore.Mvc.BindPropertyAttribute; using B = Microsoft.AspNetCore.Mvc.BindPropertyAttribute;
using J = System.Text.Json.Serialization.JsonPropertyNameAttribute;
using JR = System.Text.Json.Serialization.JsonRequiredAttribute;
namespace Iceshrimp.Backend.Controllers.Mastodon.Schemas; namespace Iceshrimp.Backend.Controllers.Mastodon.Schemas;
@ -6,13 +8,22 @@ public abstract class ListSchemas
{ {
public class ListCreationRequest public class ListCreationRequest
{ {
[B(Name = "title")] public required string Title { get; set; } [J("title")] [JR] [B(Name = "title")] public required string Title { get; set; }
[B(Name = "replies_policy")] public string RepliesPolicy { get; set; } = "list";
[B(Name = "exclusive")] public bool Exclusive { get; set; } = false; [J("replies_policy")]
[B(Name = "replies_policy")]
public string RepliesPolicy { get; set; } = "list";
[J("exclusive")]
[B(Name = "exclusive")]
public bool Exclusive { get; set; } = false;
} }
public class ListUpdateMembersRequest public class ListUpdateMembersRequest
{ {
[B(Name = "account_ids")] public required List<string> AccountIds { get; set; } [J("account_ids")]
[JR]
[B(Name = "account_ids")]
public required List<string> AccountIds { get; set; }
} }
} }