From 891c538f818be7a339fcdfacaf34adb4a329d514 Mon Sep 17 00:00:00 2001 From: Niels van Velzen Date: Mon, 21 Sep 2020 17:49:45 +0200 Subject: [PATCH] Use GeneralCommandType in SessionController parameters --- Jellyfin.Api/Controllers/SessionController.cs | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/Jellyfin.Api/Controllers/SessionController.cs b/Jellyfin.Api/Controllers/SessionController.cs index 5a2a3cdc0..c257a46dc 100644 --- a/Jellyfin.Api/Controllers/SessionController.cs +++ b/Jellyfin.Api/Controllers/SessionController.cs @@ -215,17 +215,12 @@ namespace Jellyfin.Api.Controllers [ProducesResponseType(StatusCodes.Status204NoContent)] public ActionResult SendSystemCommand( [FromRoute, Required] string sessionId, - [FromRoute, Required] string command) + [FromRoute, Required] GeneralCommandType command) { - if (!Enum.TryParse(command, true, out GeneralCommandType commandType)) - { - return BadRequest(); - } - var currentSession = RequestHelpers.GetSession(_sessionManager, _authContext, Request); var generalCommand = new GeneralCommand { - Name = commandType, + Name = command, ControllingUserId = currentSession.UserId }; @@ -246,18 +241,13 @@ namespace Jellyfin.Api.Controllers [ProducesResponseType(StatusCodes.Status204NoContent)] public ActionResult SendGeneralCommand( [FromRoute, Required] string sessionId, - [FromRoute, Required] string command) + [FromRoute, Required] GeneralCommandType command) { - if (!Enum.TryParse(command, true, out GeneralCommandType commandType)) - { - return BadRequest(); - } - var currentSession = RequestHelpers.GetSession(_sessionManager, _authContext, Request); var generalCommand = new GeneralCommand { - Name = commandType, + Name = command, ControllingUserId = currentSession.UserId };