From 81db323f88ddd87b4f75f9231206e83fbe4356b1 Mon Sep 17 00:00:00 2001 From: BaronGreenback Date: Thu, 17 Sep 2020 17:54:09 +0100 Subject: Update SessionController.cs --- Jellyfin.Api/Controllers/SessionController.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Jellyfin.Api/Controllers/SessionController.cs') diff --git a/Jellyfin.Api/Controllers/SessionController.cs b/Jellyfin.Api/Controllers/SessionController.cs index b00675d67..9820ded44 100644 --- a/Jellyfin.Api/Controllers/SessionController.cs +++ b/Jellyfin.Api/Controllers/SessionController.cs @@ -155,13 +155,13 @@ namespace Jellyfin.Api.Controllers /// The starting position of the first item. /// Instruction sent to session. /// A . - [HttpPost("Sessions/{sessionId}/Playing/{command}")] + [HttpPost("Sessions/{sessionId}/Playing")] [Authorize(Policy = Policies.DefaultAuthorization)] [ProducesResponseType(StatusCodes.Status204NoContent)] public ActionResult Play( [FromRoute, Required] string sessionId, [FromRoute, Required] PlayCommand command, - [FromQuery] Guid[] itemIds, + [FromQuery] Guid itemIds, [FromQuery] long? startPositionTicks) { var playRequest = new PlayRequest @@ -187,7 +187,7 @@ namespace Jellyfin.Api.Controllers /// The . /// Playstate command sent to session. /// A . - [HttpPost("Sessions/{sessionId}/Playing")] + [HttpPost("Sessions/{sessionId}/Playing/{command}")] [Authorize(Policy = Policies.DefaultAuthorization)] [ProducesResponseType(StatusCodes.Status204NoContent)] public ActionResult SendPlaystateCommand( -- cgit v1.2.3 From 8738fe570a54d367f3c13255ba18b21b12ac47ac Mon Sep 17 00:00:00 2001 From: BaronGreenback Date: Thu, 17 Sep 2020 18:27:07 +0100 Subject: Update SessionController.cs --- Jellyfin.Api/Controllers/SessionController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Jellyfin.Api/Controllers/SessionController.cs') diff --git a/Jellyfin.Api/Controllers/SessionController.cs b/Jellyfin.Api/Controllers/SessionController.cs index 9820ded44..e2e95182e 100644 --- a/Jellyfin.Api/Controllers/SessionController.cs +++ b/Jellyfin.Api/Controllers/SessionController.cs @@ -166,7 +166,7 @@ namespace Jellyfin.Api.Controllers { var playRequest = new PlayRequest { - ItemIds = itemIds, + ItemIds = new [] { itemIds }, StartPositionTicks = startPositionTicks, PlayCommand = command }; -- cgit v1.2.3 From ea7b3699c208ab542e4fc157acad2e9519891654 Mon Sep 17 00:00:00 2001 From: BaronGreenback Date: Thu, 17 Sep 2020 18:47:36 +0100 Subject: Update SessionController.cs removed space --- Jellyfin.Api/Controllers/SessionController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Jellyfin.Api/Controllers/SessionController.cs') diff --git a/Jellyfin.Api/Controllers/SessionController.cs b/Jellyfin.Api/Controllers/SessionController.cs index e2e95182e..6ae645e8f 100644 --- a/Jellyfin.Api/Controllers/SessionController.cs +++ b/Jellyfin.Api/Controllers/SessionController.cs @@ -166,7 +166,7 @@ namespace Jellyfin.Api.Controllers { var playRequest = new PlayRequest { - ItemIds = new [] { itemIds }, + ItemIds = new[] { itemIds }, StartPositionTicks = startPositionTicks, PlayCommand = command }; -- cgit v1.2.3 From 4dae7d0521fd0052a87515aefb3e3bd7f2fda3f7 Mon Sep 17 00:00:00 2001 From: BaronGreenback Date: Sat, 19 Sep 2020 13:58:18 +0100 Subject: Update Jellyfin.Api/Controllers/SessionController.cs Co-authored-by: Claus Vium --- Jellyfin.Api/Controllers/SessionController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Jellyfin.Api/Controllers/SessionController.cs') diff --git a/Jellyfin.Api/Controllers/SessionController.cs b/Jellyfin.Api/Controllers/SessionController.cs index 6ae645e8f..9d7f2a502 100644 --- a/Jellyfin.Api/Controllers/SessionController.cs +++ b/Jellyfin.Api/Controllers/SessionController.cs @@ -166,7 +166,7 @@ namespace Jellyfin.Api.Controllers { var playRequest = new PlayRequest { - ItemIds = new[] { itemIds }, + ItemIds = itemIds.Split(','), StartPositionTicks = startPositionTicks, PlayCommand = command }; -- cgit v1.2.3 From eee977a77ba775babeca61fed54793f9fc6f57dc Mon Sep 17 00:00:00 2001 From: BaronGreenback Date: Sat, 19 Sep 2020 13:58:39 +0100 Subject: Update Jellyfin.Api/Controllers/SessionController.cs Co-authored-by: Claus Vium --- Jellyfin.Api/Controllers/SessionController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Jellyfin.Api/Controllers/SessionController.cs') diff --git a/Jellyfin.Api/Controllers/SessionController.cs b/Jellyfin.Api/Controllers/SessionController.cs index 9d7f2a502..228d6c834 100644 --- a/Jellyfin.Api/Controllers/SessionController.cs +++ b/Jellyfin.Api/Controllers/SessionController.cs @@ -161,7 +161,7 @@ namespace Jellyfin.Api.Controllers public ActionResult Play( [FromRoute, Required] string sessionId, [FromRoute, Required] PlayCommand command, - [FromQuery] Guid itemIds, + [FromQuery] string itemIds, [FromQuery] long? startPositionTicks) { var playRequest = new PlayRequest -- cgit v1.2.3 From d8e8d298ea8cff3e1b47e7110d2abd80bd34b981 Mon Sep 17 00:00:00 2001 From: BaronGreenback Date: Sat, 19 Sep 2020 13:58:56 +0100 Subject: Update Jellyfin.Api/Controllers/SessionController.cs Co-authored-by: Claus Vium --- Jellyfin.Api/Controllers/SessionController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Jellyfin.Api/Controllers/SessionController.cs') diff --git a/Jellyfin.Api/Controllers/SessionController.cs b/Jellyfin.Api/Controllers/SessionController.cs index 228d6c834..3aa1642da 100644 --- a/Jellyfin.Api/Controllers/SessionController.cs +++ b/Jellyfin.Api/Controllers/SessionController.cs @@ -160,7 +160,7 @@ namespace Jellyfin.Api.Controllers [ProducesResponseType(StatusCodes.Status204NoContent)] public ActionResult Play( [FromRoute, Required] string sessionId, - [FromRoute, Required] PlayCommand command, + [FromQuery, Required] PlayRequest playRequest, [FromQuery] string itemIds, [FromQuery] long? startPositionTicks) { -- cgit v1.2.3 From 7050525f6b70d9725cb76a6954004a3979e4bfda Mon Sep 17 00:00:00 2001 From: BaronGreenback Date: Sat, 19 Sep 2020 15:01:34 +0100 Subject: Update SessionController.cs --- Jellyfin.Api/Controllers/SessionController.cs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'Jellyfin.Api/Controllers/SessionController.cs') diff --git a/Jellyfin.Api/Controllers/SessionController.cs b/Jellyfin.Api/Controllers/SessionController.cs index 3aa1642da..a1ec39112 100644 --- a/Jellyfin.Api/Controllers/SessionController.cs +++ b/Jellyfin.Api/Controllers/SessionController.cs @@ -1,4 +1,4 @@ -#pragma warning disable CA1801 +#pragma warning disable CA1801 using System; using System.Collections.Generic; @@ -150,7 +150,7 @@ namespace Jellyfin.Api.Controllers /// Instructs a session to play an item. /// /// The session id. - /// The type of play command to issue (PlayNow, PlayNext, PlayLast). Clients who have not yet implemented play next and play last may play now. + /// The type of play command to issue (PlayNow, PlayNext, PlayLast). Clients who have not yet implemented play next and play last may play now. /// The ids of the items to play, comma delimited. /// The starting position of the first item. /// Instruction sent to session. @@ -160,15 +160,15 @@ namespace Jellyfin.Api.Controllers [ProducesResponseType(StatusCodes.Status204NoContent)] public ActionResult Play( [FromRoute, Required] string sessionId, - [FromQuery, Required] PlayRequest playRequest, - [FromQuery] string itemIds, + [FromQuery, Required] PlayCommand playCommand, + [FromQuery] Guid itemIds, [FromQuery] long? startPositionTicks) { var playRequest = new PlayRequest { - ItemIds = itemIds.Split(','), + ItemIds = new[] { itemIds }, StartPositionTicks = startPositionTicks, - PlayCommand = command + PlayCommand = playCommand }; _sessionManager.SendPlayCommand( @@ -184,6 +184,7 @@ namespace Jellyfin.Api.Controllers /// Issues a playstate command to a client. /// /// The session id. + /// The . /// The . /// Playstate command sent to session. /// A . @@ -192,7 +193,8 @@ namespace Jellyfin.Api.Controllers [ProducesResponseType(StatusCodes.Status204NoContent)] public ActionResult SendPlaystateCommand( [FromRoute, Required] string sessionId, - [FromBody] PlaystateRequest playstateRequest) + [FromRoute, Required] PlayCommand command, + [FromQuery] PlaystateRequest playstateRequest) { _sessionManager.SendPlaystateCommand( RequestHelpers.GetSession(_sessionManager, _authContext, Request).Id, -- cgit v1.2.3 From 701d54260d44d7750ddc757f9957a9f0bdee781b Mon Sep 17 00:00:00 2001 From: BaronGreenback Date: Sat, 19 Sep 2020 15:46:47 +0100 Subject: Update SessionController.cs --- Jellyfin.Api/Controllers/SessionController.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Jellyfin.Api/Controllers/SessionController.cs') diff --git a/Jellyfin.Api/Controllers/SessionController.cs b/Jellyfin.Api/Controllers/SessionController.cs index a1ec39112..1d7dc7c8a 100644 --- a/Jellyfin.Api/Controllers/SessionController.cs +++ b/Jellyfin.Api/Controllers/SessionController.cs @@ -161,12 +161,12 @@ namespace Jellyfin.Api.Controllers public ActionResult Play( [FromRoute, Required] string sessionId, [FromQuery, Required] PlayCommand playCommand, - [FromQuery] Guid itemIds, + [FromQuery, Required] string itemIds, [FromQuery] long? startPositionTicks) { var playRequest = new PlayRequest { - ItemIds = new[] { itemIds }, + ItemIds = itemIds.Split(',').Select(p => Guid.Parse(p)).ToArray(), StartPositionTicks = startPositionTicks, PlayCommand = playCommand }; -- cgit v1.2.3 From 9cb37ae9c217146d94949a31df86ec3c85687ad8 Mon Sep 17 00:00:00 2001 From: BaronGreenback Date: Sun, 20 Sep 2020 12:44:10 +0100 Subject: Update Jellyfin.Api/Controllers/SessionController.cs Co-authored-by: Cody Robibero --- Jellyfin.Api/Controllers/SessionController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Jellyfin.Api/Controllers/SessionController.cs') diff --git a/Jellyfin.Api/Controllers/SessionController.cs b/Jellyfin.Api/Controllers/SessionController.cs index 1d7dc7c8a..3720e821f 100644 --- a/Jellyfin.Api/Controllers/SessionController.cs +++ b/Jellyfin.Api/Controllers/SessionController.cs @@ -166,7 +166,7 @@ namespace Jellyfin.Api.Controllers { var playRequest = new PlayRequest { - ItemIds = itemIds.Split(',').Select(p => Guid.Parse(p)).ToArray(), + ItemIds = RequestHelpers.GetGuids(itemIds), StartPositionTicks = startPositionTicks, PlayCommand = playCommand }; -- cgit v1.2.3 From f71812abc07bfe3784c4779d6e4fa8d87be7aa94 Mon Sep 17 00:00:00 2001 From: BaronGreenback Date: Sun, 20 Sep 2020 14:36:46 +0100 Subject: Update SessionController.cs --- Jellyfin.Api/Controllers/SessionController.cs | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'Jellyfin.Api/Controllers/SessionController.cs') diff --git a/Jellyfin.Api/Controllers/SessionController.cs b/Jellyfin.Api/Controllers/SessionController.cs index 3720e821f..a7bddc171 100644 --- a/Jellyfin.Api/Controllers/SessionController.cs +++ b/Jellyfin.Api/Controllers/SessionController.cs @@ -1,5 +1,3 @@ -#pragma warning disable CA1801 - using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; @@ -184,8 +182,9 @@ namespace Jellyfin.Api.Controllers /// Issues a playstate command to a client. /// /// The session id. - /// The . - /// The . + /// The . + /// The optional position ticks. + /// The optional controlling user id. /// Playstate command sent to session. /// A . [HttpPost("Sessions/{sessionId}/Playing/{command}")] @@ -193,13 +192,19 @@ namespace Jellyfin.Api.Controllers [ProducesResponseType(StatusCodes.Status204NoContent)] public ActionResult SendPlaystateCommand( [FromRoute, Required] string sessionId, - [FromRoute, Required] PlayCommand command, - [FromQuery] PlaystateRequest playstateRequest) + [FromRoute, Required] PlaystateCommand command, + [FromQuery] long? seekPositionTicks, + [FromQuery] string? controllingUserId) { _sessionManager.SendPlaystateCommand( RequestHelpers.GetSession(_sessionManager, _authContext, Request).Id, sessionId, - playstateRequest, + new PlaystateRequest() + { + Command = command, + ControllingUserId = controllingUserId, + SeekPositionTicks = seekPositionTicks, + }, CancellationToken.None); return NoContent(); @@ -436,9 +441,9 @@ namespace Jellyfin.Api.Controllers [ProducesResponseType(StatusCodes.Status204NoContent)] public ActionResult ReportViewing( [FromQuery] string? sessionId, - [FromQuery] string? itemId) + [FromQuery, Required] string? itemId) { - string session = RequestHelpers.GetSession(_sessionManager, _authContext, Request).Id; + string session = sessionId ?? RequestHelpers.GetSession(_sessionManager, _authContext, Request).Id; _sessionManager.ReportNowViewingItem(session, itemId); return NoContent(); -- cgit v1.2.3 From 3459655bb401595f62c21513964876b2f4549fed Mon Sep 17 00:00:00 2001 From: Niels van Velzen Date: Mon, 21 Sep 2020 16:53:00 +0200 Subject: Use GeneralCommandType enum in GeneralCommand name --- CONTRIBUTORS.md | 1 + Emby.Dlna/PlayTo/PlayToController.cs | 87 ++++++++++------------ .../Session/SessionManager.cs | 4 +- Jellyfin.Api/Controllers/SessionController.cs | 14 ++-- MediaBrowser.Model/Session/GeneralCommand.cs | 2 +- 5 files changed, 54 insertions(+), 54 deletions(-) (limited to 'Jellyfin.Api/Controllers/SessionController.cs') diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index f1fe65064..efd83012e 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -135,6 +135,7 @@ - [YouKnowBlom](https://github.com/YouKnowBlom) - [KristupasSavickas](https://github.com/KristupasSavickas) - [Pusta](https://github.com/pusta) + - [nielsvanvelzen](https://github.com/nielsvanvelzen) # Emby Contributors diff --git a/Emby.Dlna/PlayTo/PlayToController.cs b/Emby.Dlna/PlayTo/PlayToController.cs index 328759c5b..460ac2d8d 100644 --- a/Emby.Dlna/PlayTo/PlayToController.cs +++ b/Emby.Dlna/PlayTo/PlayToController.cs @@ -669,62 +669,57 @@ namespace Emby.Dlna.PlayTo private Task SendGeneralCommand(GeneralCommand command, CancellationToken cancellationToken) { - if (Enum.TryParse(command.Name, true, out GeneralCommandType commandType)) - { - switch (commandType) - { - case GeneralCommandType.VolumeDown: - return _device.VolumeDown(cancellationToken); - case GeneralCommandType.VolumeUp: - return _device.VolumeUp(cancellationToken); - case GeneralCommandType.Mute: - return _device.Mute(cancellationToken); - case GeneralCommandType.Unmute: - return _device.Unmute(cancellationToken); - case GeneralCommandType.ToggleMute: - return _device.ToggleMute(cancellationToken); - case GeneralCommandType.SetAudioStreamIndex: - if (command.Arguments.TryGetValue("Index", out string index)) + switch (command.Name) + { + case GeneralCommandType.VolumeDown: + return _device.VolumeDown(cancellationToken); + case GeneralCommandType.VolumeUp: + return _device.VolumeUp(cancellationToken); + case GeneralCommandType.Mute: + return _device.Mute(cancellationToken); + case GeneralCommandType.Unmute: + return _device.Unmute(cancellationToken); + case GeneralCommandType.ToggleMute: + return _device.ToggleMute(cancellationToken); + case GeneralCommandType.SetAudioStreamIndex: + if (command.Arguments.TryGetValue("Index", out string index)) + { + if (int.TryParse(index, NumberStyles.Integer, _usCulture, out var val)) { - if (int.TryParse(index, NumberStyles.Integer, _usCulture, out var val)) - { - return SetAudioStreamIndex(val); - } - - throw new ArgumentException("Unsupported SetAudioStreamIndex value supplied."); + return SetAudioStreamIndex(val); } - throw new ArgumentException("SetAudioStreamIndex argument cannot be null"); - case GeneralCommandType.SetSubtitleStreamIndex: - if (command.Arguments.TryGetValue("Index", out index)) - { - if (int.TryParse(index, NumberStyles.Integer, _usCulture, out var val)) - { - return SetSubtitleStreamIndex(val); - } + throw new ArgumentException("Unsupported SetAudioStreamIndex value supplied."); + } - throw new ArgumentException("Unsupported SetSubtitleStreamIndex value supplied."); + throw new ArgumentException("SetAudioStreamIndex argument cannot be null"); + case GeneralCommandType.SetSubtitleStreamIndex: + if (command.Arguments.TryGetValue("Index", out index)) + { + if (int.TryParse(index, NumberStyles.Integer, _usCulture, out var val)) + { + return SetSubtitleStreamIndex(val); } - throw new ArgumentException("SetSubtitleStreamIndex argument cannot be null"); - case GeneralCommandType.SetVolume: - if (command.Arguments.TryGetValue("Volume", out string vol)) - { - if (int.TryParse(vol, NumberStyles.Integer, _usCulture, out var volume)) - { - return _device.SetVolume(volume, cancellationToken); - } + throw new ArgumentException("Unsupported SetSubtitleStreamIndex value supplied."); + } - throw new ArgumentException("Unsupported volume value supplied."); + throw new ArgumentException("SetSubtitleStreamIndex argument cannot be null"); + case GeneralCommandType.SetVolume: + if (command.Arguments.TryGetValue("Volume", out string vol)) + { + if (int.TryParse(vol, NumberStyles.Integer, _usCulture, out var volume)) + { + return _device.SetVolume(volume, cancellationToken); } - throw new ArgumentException("Volume argument cannot be null"); - default: - return Task.CompletedTask; - } - } + throw new ArgumentException("Unsupported volume value supplied."); + } - return Task.CompletedTask; + throw new ArgumentException("Volume argument cannot be null"); + default: + return Task.CompletedTask; + } } private async Task SetAudioStreamIndex(int? newIndex) diff --git a/Emby.Server.Implementations/Session/SessionManager.cs b/Emby.Server.Implementations/Session/SessionManager.cs index ca8e0e29b..e42d47853 100644 --- a/Emby.Server.Implementations/Session/SessionManager.cs +++ b/Emby.Server.Implementations/Session/SessionManager.cs @@ -1037,7 +1037,7 @@ namespace Emby.Server.Implementations.Session var generalCommand = new GeneralCommand { - Name = GeneralCommandType.DisplayMessage.ToString() + Name = GeneralCommandType.DisplayMessage }; generalCommand.Arguments["Header"] = command.Header; @@ -1268,7 +1268,7 @@ namespace Emby.Server.Implementations.Session { var generalCommand = new GeneralCommand { - Name = GeneralCommandType.DisplayContent.ToString(), + Name = GeneralCommandType.DisplayContent, Arguments = { ["ItemId"] = command.ItemId, diff --git a/Jellyfin.Api/Controllers/SessionController.cs b/Jellyfin.Api/Controllers/SessionController.cs index b00675d67..5a2a3cdc0 100644 --- a/Jellyfin.Api/Controllers/SessionController.cs +++ b/Jellyfin.Api/Controllers/SessionController.cs @@ -217,16 +217,15 @@ namespace Jellyfin.Api.Controllers [FromRoute, Required] string sessionId, [FromRoute, Required] string command) { - var name = command; - if (Enum.TryParse(name, true, out GeneralCommandType commandType)) + if (!Enum.TryParse(command, true, out GeneralCommandType commandType)) { - name = commandType.ToString(); + return BadRequest(); } var currentSession = RequestHelpers.GetSession(_sessionManager, _authContext, Request); var generalCommand = new GeneralCommand { - Name = name, + Name = commandType, ControllingUserId = currentSession.UserId }; @@ -249,11 +248,16 @@ namespace Jellyfin.Api.Controllers [FromRoute, Required] string sessionId, [FromRoute, Required] string command) { + if (!Enum.TryParse(command, true, out GeneralCommandType commandType)) + { + return BadRequest(); + } + var currentSession = RequestHelpers.GetSession(_sessionManager, _authContext, Request); var generalCommand = new GeneralCommand { - Name = command, + Name = commandType, ControllingUserId = currentSession.UserId }; diff --git a/MediaBrowser.Model/Session/GeneralCommand.cs b/MediaBrowser.Model/Session/GeneralCommand.cs index 9794bd292..77bb6bcf7 100644 --- a/MediaBrowser.Model/Session/GeneralCommand.cs +++ b/MediaBrowser.Model/Session/GeneralCommand.cs @@ -8,7 +8,7 @@ namespace MediaBrowser.Model.Session { public class GeneralCommand { - public string Name { get; set; } + public GeneralCommandType Name { get; set; } public Guid ControllingUserId { get; set; } -- cgit v1.2.3 From 891c538f818be7a339fcdfacaf34adb4a329d514 Mon Sep 17 00:00:00 2001 From: Niels van Velzen Date: Mon, 21 Sep 2020 17:49:45 +0200 Subject: Use GeneralCommandType in SessionController parameters --- Jellyfin.Api/Controllers/SessionController.cs | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) (limited to 'Jellyfin.Api/Controllers/SessionController.cs') 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 }; -- cgit v1.2.3