From 5e4bd744c07d44d75c8e9eb7b6dc03b7ff4f147c Mon Sep 17 00:00:00 2001 From: Niels van Velzen Date: Mon, 21 Apr 2025 03:40:23 +0200 Subject: Return SyncPlay group info after creation, add GET group endpoint (#13935) --- Jellyfin.Api/Controllers/SyncPlayController.cs | 28 ++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'Jellyfin.Api') diff --git a/Jellyfin.Api/Controllers/SyncPlayController.cs b/Jellyfin.Api/Controllers/SyncPlayController.cs index 3839781971..fbab2a7845 100644 --- a/Jellyfin.Api/Controllers/SyncPlayController.cs +++ b/Jellyfin.Api/Controllers/SyncPlayController.cs @@ -1,9 +1,9 @@ +using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Threading; using System.Threading.Tasks; -using Jellyfin.Api.Constants; using Jellyfin.Api.Helpers; using Jellyfin.Api.Models.SyncPlayDtos; using MediaBrowser.Common.Api; @@ -50,17 +50,16 @@ public class SyncPlayController : BaseJellyfinApiController /// /// The settings of the new group. /// New group created. - /// A indicating success. + /// An for the created group. [HttpPost("New")] - [ProducesResponseType(StatusCodes.Status204NoContent)] + [ProducesResponseType(StatusCodes.Status200OK)] [Authorize(Policy = Policies.SyncPlayCreateGroup)] - public async Task SyncPlayCreateGroup( + public async Task> SyncPlayCreateGroup( [FromBody, Required] NewGroupRequestDto requestData) { var currentSession = await RequestHelpers.GetSession(_sessionManager, _userManager, HttpContext).ConfigureAwait(false); var syncPlayRequest = new NewGroupRequest(requestData.GroupName); - _syncPlayManager.NewGroup(currentSession, syncPlayRequest, CancellationToken.None); - return NoContent(); + return Ok(_syncPlayManager.NewGroup(currentSession, syncPlayRequest, CancellationToken.None)); } /// @@ -112,6 +111,23 @@ public class SyncPlayController : BaseJellyfinApiController return Ok(_syncPlayManager.ListGroups(currentSession, syncPlayRequest).AsEnumerable()); } + /// + /// Gets a SyncPlay group by id. + /// + /// The id of the group. + /// Group returned. + /// An for the requested group. + [HttpGet("{id:guid}")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status404NotFound)] + [Authorize(Policy = Policies.SyncPlayJoinGroup)] + public async Task> SyncPlayGetGroup([FromRoute] Guid id) + { + var currentSession = await RequestHelpers.GetSession(_sessionManager, _userManager, HttpContext).ConfigureAwait(false); + var group = _syncPlayManager.GetGroup(currentSession, id); + return group == null ? NotFound() : Ok(group); + } + /// /// Request to set new playlist in SyncPlay group. /// -- cgit v1.2.3