mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-05 13:27:54 +00:00
feat(apiv2): reorganize controllers, add stats to meta endpoint
This commit is contained in:
parent
8fe688e4aa
commit
2bf1617737
6 changed files with 68 additions and 58 deletions
30
PluralKit.API/Controllers/v2/PrivateControllerV2.cs
Normal file
30
PluralKit.API/Controllers/v2/PrivateControllerV2.cs
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace PluralKit.API
|
||||
{
|
||||
[ApiController]
|
||||
[ApiVersion("2.0")]
|
||||
[Route("v{version:apiVersion}")]
|
||||
public class PrivateControllerV2: PKControllerBase
|
||||
{
|
||||
public PrivateControllerV2(IServiceProvider svc) : base(svc) { }
|
||||
|
||||
[HttpGet("meta")]
|
||||
public async Task<ActionResult<JObject>> Meta()
|
||||
{
|
||||
var shards = await _repo.GetShards();
|
||||
var stats = await _repo.GetStats();
|
||||
|
||||
var o = new JObject();
|
||||
o.Add("shards", shards.ToJSON());
|
||||
o.Add("stats", stats.ToJson());
|
||||
|
||||
return Ok(o);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue