mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 13:06:50 +00:00
Add endpoint for querying systems by Discord snowflake
This commit is contained in:
parent
1c48cb2fc7
commit
e28ed585ce
2 changed files with 48 additions and 0 deletions
27
PluralKit.API/Controllers/AccountController.cs
Normal file
27
PluralKit.API/Controllers/AccountController.cs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace PluralKit.API.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("a")]
|
||||
[Route("v1/a")]
|
||||
public class AccountController: ControllerBase
|
||||
{
|
||||
private SystemStore _systems;
|
||||
|
||||
public AccountController(SystemStore systems)
|
||||
{
|
||||
_systems = systems;
|
||||
}
|
||||
|
||||
[HttpGet("{aid}")]
|
||||
public async Task<ActionResult<PKSystem>> GetSystemByAccount(ulong aid)
|
||||
{
|
||||
var system = await _systems.GetByAccount(aid);
|
||||
if (system == null) return NotFound("Account not found.");
|
||||
|
||||
return Ok(system);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue