diff --git a/Jellyfin.Api/Controllers/LibraryController.cs b/Jellyfin.Api/Controllers/LibraryController.cs index 92843a3737..9ad70024a2 100644 --- a/Jellyfin.Api/Controllers/LibraryController.cs +++ b/Jellyfin.Api/Controllers/LibraryController.cs @@ -31,6 +31,7 @@ using MediaBrowser.Model.Globalization; using MediaBrowser.Model.Net; using MediaBrowser.Model.Querying; using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.Extensions.Logging; @@ -102,6 +103,8 @@ namespace Jellyfin.Api.Controllers /// A with the original file. [HttpGet("/Items/{itemId}/File")] [Authorize(Policy = Policies.DefaultAuthorization)] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status404NotFound)] public ActionResult GetFile([FromRoute] Guid itemId) { var item = _libraryManager.GetItemById(itemId); @@ -128,6 +131,7 @@ namespace Jellyfin.Api.Controllers [SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "itemId", Justification = "Imported from ServiceStack")] [SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "startIndex", Justification = "Imported from ServiceStack")] [SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "limit", Justification = "Imported from ServiceStack")] + [ProducesResponseType(StatusCodes.Status200OK)] public ActionResult> GetCriticReviews( [FromRoute] Guid itemId, [FromQuery] int? startIndex, @@ -147,6 +151,8 @@ namespace Jellyfin.Api.Controllers /// The item theme songs. [HttpGet("/Items/{itemId}/ThemeSongs")] [Authorize(Policy = Policies.DefaultAuthorization)] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status404NotFound)] public ActionResult GetThemeSongs( [FromRoute] Guid itemId, [FromQuery] Guid userId, @@ -211,6 +217,8 @@ namespace Jellyfin.Api.Controllers /// The item theme videos. [HttpGet("/Items/{itemId}/ThemeVideos")] [Authorize(Policy = Policies.DefaultAuthorization)] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status404NotFound)] public ActionResult GetThemeVideos( [FromRoute] Guid itemId, [FromQuery] Guid userId, @@ -273,6 +281,7 @@ namespace Jellyfin.Api.Controllers /// Theme songs and videos returned. /// Item not found. /// The item theme videos. + [ProducesResponseType(StatusCodes.Status200OK)] public ActionResult GetThemeMedia( [FromRoute] Guid itemId, [FromQuery] Guid userId, @@ -303,6 +312,7 @@ namespace Jellyfin.Api.Controllers /// A . [HttpGet("/Library/Refresh")] [Authorize(Policy = Policies.RequiresElevation)] + [ProducesResponseType(StatusCodes.Status204NoContent)] public async Task RefreshLibrary() { try @@ -326,6 +336,8 @@ namespace Jellyfin.Api.Controllers /// A . [HttpDelete("/Items/{itemId}")] [Authorize(Policy = Policies.DefaultAuthorization)] + [ProducesResponseType(StatusCodes.Status204NoContent)] + [ProducesResponseType(StatusCodes.Status401Unauthorized)] public ActionResult DeleteItem(Guid itemId) { var item = _libraryManager.GetItemById(itemId); @@ -354,6 +366,8 @@ namespace Jellyfin.Api.Controllers /// A . [HttpDelete("/Items")] [Authorize(Policy = Policies.DefaultAuthorization)] + [ProducesResponseType(StatusCodes.Status204NoContent)] + [ProducesResponseType(StatusCodes.Status401Unauthorized)] public ActionResult DeleteItems([FromQuery] string ids) { var itemIds = string.IsNullOrWhiteSpace(ids) @@ -394,6 +408,7 @@ namespace Jellyfin.Api.Controllers /// Item counts. [HttpGet("/Items/Counts")] [Authorize(Policy = Policies.DefaultAuthorization)] + [ProducesResponseType(StatusCodes.Status200OK)] public ActionResult GetItemCounts( [FromQuery] Guid userId, [FromQuery] bool? isFavorite) @@ -427,6 +442,8 @@ namespace Jellyfin.Api.Controllers /// Item parents. [HttpGet("/Items/{itemId}/Ancestors")] [Authorize(Policy = Policies.DefaultAuthorization)] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status404NotFound)] public ActionResult> GetAncestors([FromRoute] Guid itemId, [FromQuery] Guid userId) { var item = _libraryManager.GetItemById(itemId); @@ -467,6 +484,7 @@ namespace Jellyfin.Api.Controllers /// List of physical paths. [HttpGet("/Library/PhysicalPaths")] [Authorize(Policy = Policies.RequiresElevation)] + [ProducesResponseType(StatusCodes.Status200OK)] public ActionResult> GetPhysicalPaths() { return Ok(_libraryManager.RootFolder.Children @@ -477,9 +495,11 @@ namespace Jellyfin.Api.Controllers /// Gets all user media folders. /// /// Optional. Filter by folders that are marked hidden, or not. + /// Media folders returned. /// List of user media folders. [HttpGet("/Library/MediaFolders")] [Authorize(Policy = Policies.DefaultAuthorization)] + [ProducesResponseType(StatusCodes.Status200OK)] public ActionResult> GetMediaFolders([FromQuery] bool? isHidden) { var items = _libraryManager.GetUserRootFolder().Children.Concat(_libraryManager.RootFolder.VirtualChildren).OrderBy(i => i.SortName).ToList(); @@ -510,6 +530,7 @@ namespace Jellyfin.Api.Controllers [HttpPost("/Library/Series/Added")] [HttpPost("/Library/Series/Updated")] [Authorize(Policy = Policies.DefaultAuthorization)] + [ProducesResponseType(StatusCodes.Status204NoContent)] public ActionResult PostUpdatedSeries([FromQuery] string tvdbId) { var series = _libraryManager.GetItemList(new InternalItemsQuery @@ -539,6 +560,7 @@ namespace Jellyfin.Api.Controllers [HttpPost("/Library/Movies/Added")] [HttpPost("/Library/Movies/Updated")] [Authorize(Policy = Policies.DefaultAuthorization)] + [ProducesResponseType(StatusCodes.Status204NoContent)] public ActionResult PostUpdatedMovies([FromRoute] string tmdbId, [FromRoute] string imdbId) { var movies = _libraryManager.GetItemList(new InternalItemsQuery @@ -579,6 +601,7 @@ namespace Jellyfin.Api.Controllers /// A . [HttpPost("/Library/Media/Updated")] [Authorize(Policy = Policies.DefaultAuthorization)] + [ProducesResponseType(StatusCodes.Status204NoContent)] public ActionResult PostUpdatedMedia([FromBody, BindRequired] MediaUpdateInfoDto[] updates) { foreach (var item in updates) @@ -599,6 +622,8 @@ namespace Jellyfin.Api.Controllers /// User can't download or item can't be downloaded. [HttpGet("/Items/{itemId}/Download")] [Authorize(Policy = Policies.Download)] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status404NotFound)] public ActionResult GetDownload([FromRoute] Guid itemId) { var item = _libraryManager.GetItemById(itemId); @@ -662,6 +687,7 @@ namespace Jellyfin.Api.Controllers /// Optional. Filter by user id, and attach user data. /// Optional. The maximum number of records to return. /// Optional. Specify additional fields of information to return in the output. This allows multiple, comma delimited. Options: Budget, Chapters, DateCreated, Genres, HomePageUrl, IndexOptions, MediaStreams, Overview, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SortName, Studios, Taglines, TrailerUrls. + /// Similar items returned. /// A containing the similar items. [HttpGet("/Artists/{itemId}/Similar")] [HttpGet("/Items/{itemId}/Similar")] @@ -673,6 +699,7 @@ namespace Jellyfin.Api.Controllers [SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "enableUserData", Justification = "Imported from ServiceStack")] [SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "imageTypeLimit", Justification = "Imported from ServiceStack")] [SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "enableImageTypes", Justification = "Imported from ServiceStack")] + [ProducesResponseType(StatusCodes.Status200OK)] public ActionResult> GetSimilarItems( [FromRoute] Guid itemId, [FromQuery] string excludeArtistIds, @@ -728,6 +755,7 @@ namespace Jellyfin.Api.Controllers /// Library options info. [HttpGet("/Libraries/AvailableOptions")] [Authorize(Policy = Policies.FirstTimeSetupOrElevated)] + [ProducesResponseType(StatusCodes.Status200OK)] public ActionResult GetLibraryOptionsInfo([FromQuery] string libraryContentType, [FromQuery] bool isNewLibrary) { var result = new LibraryOptionsResultDto();