Every route is a constant in ApiPaths
Build / Build (push) Successful in 35s

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:
thepraandClaude Opus 5.5 committed 2026-11-10 01:59:20 +01:00
1 parent 0f73f69239
commit 739a1603ca
47 files changed
+952 -373

No files matched your search

@@ -31,7 +31,7 @@ namespace PrivaPub.Api.Mastodon.Controllers
string TokenId => User.GetTokenId();
// a new subscription replaces the one this token had, as on Mastodon
[HttpPost("/api/v1/push/subscription"), Scope("push")]
[HttpPost(ApiPaths.Push.POST_Create), Scope("push")]
public async Task<IActionResult> Create(CancellationToken token)
{
var endpoint = Params.Get("subscription[endpoint]")?.Trim();
@@ -82,12 +82,12 @@ namespace PrivaPub.Api.Mastodon.Controllers
return Json(await View(subscription, token));
}
[HttpGet("/api/v1/push/subscription"), Scope("push")]
[HttpGet(ApiPaths.Push.GET_Show), Scope("push")]
public async Task<IActionResult> Show(CancellationToken token) =>
await Mine(token) is { } subscription ? Json(await View(subscription, token)) : NotFoundError();
// Mastodon's update: the data given replaces what was there (alerts left out are off, the policy left out is all)
[HttpPut("/api/v1/push/subscription"), Scope("push")]
[HttpPut(ApiPaths.Push.PUT_Update), Scope("push")]
public async Task<IActionResult> Update(CancellationToken token)
{
var subscription = await Mine(token);
@@ -107,7 +107,7 @@ namespace PrivaPub.Api.Mastodon.Controllers
return Json(await View(subscription, token));
}
[HttpDelete("/api/v1/push/subscription"), Scope("push")]
[HttpDelete(ApiPaths.Push.DELETE_Delete), Scope("push")]
public async Task<IActionResult> Delete(CancellationToken token)
{
await WebPush.ForgetToken(TokenId, token);