All 384 routes, the Mastodon API, the client API and the frozen federation paths, are read from one class with one nested class per controller. Their values are unchanged, checked one by one against the old literals; decePubClient keeps its own APIs class. Checked against GoToSocial in the pasture: 64 passed, 0 failed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01W4YtEJrgxG12Pc39Fai8Bd
This commit is contained in:
1 parent
0f73f69239
commit
739a1603ca
47 files changed
+952
-373
No files matched your search
@@ -59,10 +59,10 @@ namespace PrivaPub.Api.Mastodon.Controllers
|
||||
summary = await Summary(token)
|
||||
};
|
||||
|
||||
[HttpGet("/api/v2/notifications/policy"), Scope("read:notifications")]
|
||||
[HttpGet(ApiPaths.NotificationRequests.GET_Policy), Scope("read:notifications")]
|
||||
public async Task<IActionResult> Policy(CancellationToken token) => Json(await V2(await NotificationPolicies.Of(MyId, token), token));
|
||||
|
||||
[HttpPatch("/api/v2/notifications/policy"), HttpPut("/api/v2/notifications/policy"), Scope("write:notifications")]
|
||||
[HttpPatch(ApiPaths.NotificationRequests.PATCH_SetPolicy), HttpPut(ApiPaths.NotificationRequests.PUT_SetPolicy), Scope("write:notifications")]
|
||||
public async Task<IActionResult> SetPolicy(CancellationToken token)
|
||||
{
|
||||
var policy = await NotificationPolicies.Of(MyId, token);
|
||||
@@ -75,10 +75,10 @@ namespace PrivaPub.Api.Mastodon.Controllers
|
||||
return Json(await V2(policy, token));
|
||||
}
|
||||
|
||||
[HttpGet("/api/v1/notifications/policy"), Scope("read:notifications")]
|
||||
[HttpGet(ApiPaths.NotificationRequests.GET_PolicyV1), Scope("read:notifications")]
|
||||
public async Task<IActionResult> PolicyV1(CancellationToken token) => Json(await V1(await NotificationPolicies.Of(MyId, token), token));
|
||||
|
||||
[HttpPut("/api/v1/notifications/policy"), HttpPatch("/api/v1/notifications/policy"), Scope("write:notifications")]
|
||||
[HttpPut(ApiPaths.NotificationRequests.PUT_SetPolicyV1), HttpPatch(ApiPaths.NotificationRequests.PATCH_SetPolicyV1), Scope("write:notifications")]
|
||||
public async Task<IActionResult> SetPolicyV1(CancellationToken token)
|
||||
{
|
||||
var policy = await NotificationPolicies.Of(MyId, token);
|
||||
@@ -110,7 +110,7 @@ namespace PrivaPub.Api.Mastodon.Controllers
|
||||
};
|
||||
}
|
||||
|
||||
[HttpGet("/api/v1/notifications/requests"), Scope("read:notifications")]
|
||||
[HttpGet(ApiPaths.NotificationRequests.GET_Requests), Scope("read:notifications")]
|
||||
public async Task<IActionResult> Requests(CancellationToken token)
|
||||
{
|
||||
var requests = await Page.From(Params, Limit(40, 80)).Fetch(DB.Default.Find<NotificationRequest>().Match(r => r.AvatarId == MyId), r => r.ID, token);
|
||||
@@ -125,14 +125,14 @@ namespace PrivaPub.Api.Mastodon.Controllers
|
||||
Task<NotificationRequest> Mine(string id, CancellationToken token) =>
|
||||
DB.Default.Find<NotificationRequest>().Match(r => r.ID == id && r.AvatarId == MyId).ExecuteFirstAsync(token);
|
||||
|
||||
[HttpGet("/api/v1/notifications/requests/merged"), Scope("read:notifications")]
|
||||
[HttpGet(ApiPaths.NotificationRequests.GET_Merged), Scope("read:notifications")]
|
||||
public IActionResult Merged() => Json(new { merged = true });
|
||||
|
||||
[HttpGet("/api/v1/notifications/requests/{id}"), Scope("read:notifications")]
|
||||
[HttpGet(ApiPaths.NotificationRequests.GET_M_Request), Scope("read:notifications")]
|
||||
public async Task<IActionResult> Request(string id, CancellationToken token) =>
|
||||
await Mine(id, token) is { } request && await Map(request, token) is { } mapped ? Json(mapped) : NotFoundError();
|
||||
|
||||
[HttpPost("/api/v1/notifications/requests/{id}/accept"), Scope("write:notifications")]
|
||||
[HttpPost(ApiPaths.NotificationRequests.POST_M_Accept), Scope("write:notifications")]
|
||||
public async Task<IActionResult> Accept(string id, CancellationToken token)
|
||||
{
|
||||
if (await Mine(id, token) is not { } request)
|
||||
@@ -141,7 +141,7 @@ namespace PrivaPub.Api.Mastodon.Controllers
|
||||
return Json(new { });
|
||||
}
|
||||
|
||||
[HttpPost("/api/v1/notifications/requests/{id}/dismiss"), Scope("write:notifications")]
|
||||
[HttpPost(ApiPaths.NotificationRequests.POST_M_Dismiss), Scope("write:notifications")]
|
||||
public async Task<IActionResult> Dismiss(string id, CancellationToken token)
|
||||
{
|
||||
if (await Mine(id, token) is not { } request)
|
||||
@@ -150,7 +150,7 @@ namespace PrivaPub.Api.Mastodon.Controllers
|
||||
return Json(new { });
|
||||
}
|
||||
|
||||
[HttpPost("/api/v1/notifications/requests/accept"), Scope("write:notifications")]
|
||||
[HttpPost(ApiPaths.NotificationRequests.POST_AcceptMany), Scope("write:notifications")]
|
||||
public async Task<IActionResult> AcceptMany(CancellationToken token)
|
||||
{
|
||||
foreach (var id in Params.List("id").Take(100))
|
||||
@@ -159,7 +159,7 @@ namespace PrivaPub.Api.Mastodon.Controllers
|
||||
return Json(new { });
|
||||
}
|
||||
|
||||
[HttpPost("/api/v1/notifications/requests/dismiss"), Scope("write:notifications")]
|
||||
[HttpPost(ApiPaths.NotificationRequests.POST_DismissMany), Scope("write:notifications")]
|
||||
public async Task<IActionResult> DismissMany(CancellationToken token)
|
||||
{
|
||||
foreach (var id in Params.List("id").Take(100))
|
||||
|
||||
Reference in new issue
Block a user