mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 13:06:50 +00:00
Add member routes to API
This commit is contained in:
parent
4874879979
commit
9a5152a74c
8 changed files with 96 additions and 4 deletions
|
|
@ -99,9 +99,9 @@ namespace PluralKit.API.Controllers
|
|||
}
|
||||
|
||||
[HttpPatch]
|
||||
[RequiresSystem]
|
||||
public async Task<ActionResult<PKSystem>> EditSystem([FromBody] PKSystem newSystem)
|
||||
{
|
||||
if (_auth.CurrentSystem == null) return Unauthorized("No token specified in Authorization header.");
|
||||
var system = _auth.CurrentSystem;
|
||||
|
||||
system.Name = newSystem.Name;
|
||||
|
|
@ -115,10 +115,9 @@ namespace PluralKit.API.Controllers
|
|||
}
|
||||
|
||||
[HttpPost("switches")]
|
||||
[RequiresSystem]
|
||||
public async Task<IActionResult> PostSwitch([FromBody] PostSwitchParams param)
|
||||
{
|
||||
if (_auth.CurrentSystem == null) return Unauthorized("No token specified in Authorization header.");
|
||||
|
||||
if (param.Members.Distinct().Count() != param.Members.Count())
|
||||
return BadRequest("Duplicate members in member list.");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue