mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-07-05 13:53:20 +01:00
Merge branch 'api-migration' of github.com:jellyfin/jellyfin into api-instantmix
This commit is contained in:
@@ -35,17 +35,14 @@ namespace Jellyfin.Api.Controllers
|
||||
/// <param name="startIndex">Optional. The record index to start at. All items with a lower index will be dropped from the results.</param>
|
||||
/// <param name="limit">Optional. The maximum number of records to return.</param>
|
||||
/// <param name="minDate">Optional. The minimum date. Format = ISO.</param>
|
||||
/// <param name="hasUserId">Optional. Only returns activities that have a user associated.</param>
|
||||
/// <response code="200">Activity log returned.</response>
|
||||
/// <returns>A <see cref="QueryResult{ActivityLogEntry}"/> containing the log entries.</returns>
|
||||
[HttpGet("Entries")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "hasUserId", Justification = "Imported from ServiceStack")]
|
||||
public ActionResult<QueryResult<ActivityLogEntry>> GetLogEntries(
|
||||
[FromQuery] int? startIndex,
|
||||
[FromQuery] int? limit,
|
||||
[FromQuery] DateTime? minDate,
|
||||
bool? hasUserId)
|
||||
[FromQuery] DateTime? minDate)
|
||||
{
|
||||
var filterFunc = new Func<IQueryable<ActivityLog>, IQueryable<ActivityLog>>(
|
||||
entries => entries.Where(entry => entry.DateCreated >= minDate));
|
||||
|
||||
@@ -178,14 +178,13 @@ namespace Jellyfin.Api.Controllers
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public ActionResult GetRobotsTxt()
|
||||
{
|
||||
return GetWebClientResource("robots.txt", string.Empty);
|
||||
return GetWebClientResource("robots.txt");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a resource from the web client.
|
||||
/// </summary>
|
||||
/// <param name="resourceName">The resource name.</param>
|
||||
/// <param name="v">The v.</param>
|
||||
/// <response code="200">Web client returned.</response>
|
||||
/// <response code="404">Server does not host a web client.</response>
|
||||
/// <returns>The resource.</returns>
|
||||
@@ -193,10 +192,7 @@ namespace Jellyfin.Api.Controllers
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "v", Justification = "Imported from ServiceStack")]
|
||||
public ActionResult GetWebClientResource(
|
||||
[FromRoute] string resourceName,
|
||||
[FromQuery] string? v)
|
||||
public ActionResult GetWebClientResource([FromRoute] string resourceName)
|
||||
{
|
||||
if (!_appConfig.HostWebClient() || WebClientUiPath == null)
|
||||
{
|
||||
@@ -228,7 +224,7 @@ namespace Jellyfin.Api.Controllers
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public ActionResult GetFavIcon()
|
||||
{
|
||||
return GetWebClientResource("favicon.ico", string.Empty);
|
||||
return GetWebClientResource("favicon.ico");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -125,7 +125,6 @@ namespace Jellyfin.Api.Controllers
|
||||
/// <param name="userId">Optional. User id.</param>
|
||||
/// <param name="parentId">Optional. Specify this to localize the search to a specific item or folder. Omit to use the root.</param>
|
||||
/// <param name="includeItemTypes">Optional. If specified, results will be filtered based on item type. This allows multiple, comma delimited.</param>
|
||||
/// <param name="mediaTypes">[Unused] Optional. Filter by MediaType. Allows multiple, comma delimited.</param>
|
||||
/// <param name="isAiring">Optional. Is item airing.</param>
|
||||
/// <param name="isMovie">Optional. Is item movie.</param>
|
||||
/// <param name="isSports">Optional. Is item sports.</param>
|
||||
@@ -137,12 +136,10 @@ namespace Jellyfin.Api.Controllers
|
||||
/// <returns>Query filters.</returns>
|
||||
[HttpGet("/Items/Filters2")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "mediaTypes", Justification = "Imported from ServiceStack")]
|
||||
public ActionResult<QueryFilters> GetQueryFilters(
|
||||
[FromQuery] Guid? userId,
|
||||
[FromQuery] string? parentId,
|
||||
[FromQuery] string? includeItemTypes,
|
||||
[FromQuery] string? mediaTypes,
|
||||
[FromQuery] bool? isAiring,
|
||||
[FromQuery] bool? isMovie,
|
||||
[FromQuery] bool? isSports,
|
||||
|
||||
@@ -47,7 +47,6 @@ namespace Jellyfin.Api.Controllers
|
||||
/// <param name="imageRefreshMode">(Optional) Specifies the image refresh mode.</param>
|
||||
/// <param name="replaceAllMetadata">(Optional) Determines if metadata should be replaced. Only applicable if mode is FullRefresh.</param>
|
||||
/// <param name="replaceAllImages">(Optional) Determines if images should be replaced. Only applicable if mode is FullRefresh.</param>
|
||||
/// <param name="recursive">(Unused) Indicates if the refresh should occur recursively.</param>
|
||||
/// <response code="204">Item metadata refresh queued.</response>
|
||||
/// <response code="404">Item to refresh not found.</response>
|
||||
/// <returns>An <see cref="NoContentResult"/> on success, or a <see cref="NotFoundResult"/> if the item could not be found.</returns>
|
||||
@@ -55,14 +54,12 @@ namespace Jellyfin.Api.Controllers
|
||||
[Description("Refreshes metadata for an item.")]
|
||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "recursive", Justification = "Imported from ServiceStack")]
|
||||
public ActionResult Post(
|
||||
[FromRoute] Guid itemId,
|
||||
[FromQuery] MetadataRefreshMode metadataRefreshMode = MetadataRefreshMode.None,
|
||||
[FromQuery] MetadataRefreshMode imageRefreshMode = MetadataRefreshMode.None,
|
||||
[FromQuery] bool replaceAllMetadata = false,
|
||||
[FromQuery] bool replaceAllImages = false,
|
||||
[FromQuery] bool recursive = false)
|
||||
[FromQuery] bool replaceAllImages = false)
|
||||
{
|
||||
var item = _libraryManager.GetItemById(itemId);
|
||||
if (item == null)
|
||||
|
||||
@@ -120,22 +120,13 @@ namespace Jellyfin.Api.Controllers
|
||||
/// <summary>
|
||||
/// Gets critic review for an item.
|
||||
/// </summary>
|
||||
/// <param name="itemId">The item id.</param>
|
||||
/// <param name="startIndex">Optional. The record index to start at. All items with a lower index will be dropped from the results.</param>
|
||||
/// <param name="limit">Optional. The maximum number of records to return.</param>
|
||||
/// <response code="200">Critic reviews returned.</response>
|
||||
/// <returns>The list of critic reviews.</returns>
|
||||
[HttpGet("/Items/{itemId}/CriticReviews")]
|
||||
[Authorize(Policy = Policies.DefaultAuthorization)]
|
||||
[Obsolete("This endpoint is obsolete.")]
|
||||
[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<QueryResult<BaseItemDto>> GetCriticReviews(
|
||||
[FromRoute] Guid itemId,
|
||||
[FromQuery] int? startIndex,
|
||||
[FromQuery] int? limit)
|
||||
public ActionResult<QueryResult<BaseItemDto>> GetCriticReviews()
|
||||
{
|
||||
return new QueryResult<BaseItemDto>();
|
||||
}
|
||||
@@ -282,6 +273,7 @@ namespace Jellyfin.Api.Controllers
|
||||
/// <response code="404">Item not found.</response>
|
||||
/// <returns>The item theme videos.</returns>
|
||||
[HttpGet("/Items/{itemId}/ThemeMedia")]
|
||||
[Authorize(Policy = Policies.DefaultAuthorization)]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
public ActionResult<AllThemeMediaResult> GetThemeMedia(
|
||||
[FromRoute] Guid itemId,
|
||||
@@ -681,10 +673,6 @@ namespace Jellyfin.Api.Controllers
|
||||
/// </summary>
|
||||
/// <param name="itemId">The item id.</param>
|
||||
/// <param name="excludeArtistIds">Exclude artist ids.</param>
|
||||
/// <param name="enableImages">(Unused) Optional. include image information in output.</param>
|
||||
/// <param name="enableUserData">(Unused) Optional. include user data.</param>
|
||||
/// <param name="imageTypeLimit">(Unused) Optional. the max number of images to return, per image type.</param>
|
||||
/// <param name="enableImageTypes">(Unused) Optional. The image types to include in the output.</param>
|
||||
/// <param name="userId">Optional. Filter by user id, and attach user data.</param>
|
||||
/// <param name="limit">Optional. The maximum number of records to return.</param>
|
||||
/// <param name="fields">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.</param>
|
||||
@@ -696,18 +684,10 @@ namespace Jellyfin.Api.Controllers
|
||||
[HttpGet("/Shows/{itemId}/Similar")]
|
||||
[HttpGet("/Movies/{itemId}/Similar")]
|
||||
[HttpGet("/Trailers/{itemId}/Similar")]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "enableImages", Justification = "Imported from ServiceStack")]
|
||||
[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<QueryResult<BaseItemDto>> GetSimilarItems(
|
||||
[FromRoute] Guid itemId,
|
||||
[FromQuery] string excludeArtistIds,
|
||||
[FromQuery] bool? enableImages,
|
||||
[FromQuery] bool? enableUserData,
|
||||
[FromQuery] int? imageTypeLimit,
|
||||
[FromQuery] string enableImageTypes,
|
||||
[FromQuery] Guid userId,
|
||||
[FromQuery] int? limit,
|
||||
[FromQuery] string fields)
|
||||
|
||||
@@ -50,13 +50,11 @@ namespace Jellyfin.Api.Controllers
|
||||
/// <summary>
|
||||
/// Gets all virtual folders.
|
||||
/// </summary>
|
||||
/// <param name="userId">The user id.</param>
|
||||
/// <response code="200">Virtual folders retrieved.</response>
|
||||
/// <returns>An <see cref="IEnumerable{VirtualFolderInfo}"/> with the virtual folders.</returns>
|
||||
[HttpGet]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "userId", Justification = "Imported from ServiceStack")]
|
||||
public ActionResult<IEnumerable<VirtualFolderInfo>> GetVirtualFolders([FromQuery] string userId)
|
||||
public ActionResult<IEnumerable<VirtualFolderInfo>> GetVirtualFolders()
|
||||
{
|
||||
return _libraryManager.GetVirtualFolders(true);
|
||||
}
|
||||
|
||||
@@ -36,23 +36,11 @@ namespace Jellyfin.Api.Controllers
|
||||
/// <summary>
|
||||
/// Gets a user's notifications.
|
||||
/// </summary>
|
||||
/// <param name="userId">The user's ID.</param>
|
||||
/// <param name="isRead">An optional filter by notification read state.</param>
|
||||
/// <param name="startIndex">The optional index to start at. All notifications with a lower index will be omitted from the results.</param>
|
||||
/// <param name="limit">An optional limit on the number of notifications returned.</param>
|
||||
/// <response code="200">Notifications returned.</response>
|
||||
/// <returns>An <see cref="OkResult"/> containing a list of notifications.</returns>
|
||||
[HttpGet("{userId}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "userId", Justification = "Imported from ServiceStack")]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "isRead", 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")]
|
||||
public ActionResult<NotificationResultDto> GetNotifications(
|
||||
[FromRoute] string userId,
|
||||
[FromQuery] bool? isRead,
|
||||
[FromQuery] int? startIndex,
|
||||
[FromQuery] int? limit)
|
||||
public ActionResult<NotificationResultDto> GetNotifications()
|
||||
{
|
||||
return new NotificationResultDto();
|
||||
}
|
||||
@@ -60,14 +48,11 @@ namespace Jellyfin.Api.Controllers
|
||||
/// <summary>
|
||||
/// Gets a user's notification summary.
|
||||
/// </summary>
|
||||
/// <param name="userId">The user's ID.</param>
|
||||
/// <response code="200">Summary of user's notifications returned.</response>
|
||||
/// <returns>An <cref see="OkResult"/> containing a summary of the users notifications.</returns>
|
||||
[HttpGet("{userId}/Summary")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "userId", Justification = "Imported from ServiceStack")]
|
||||
public ActionResult<NotificationsSummaryDto> GetNotificationsSummary(
|
||||
[FromRoute] string userId)
|
||||
public ActionResult<NotificationsSummaryDto> GetNotificationsSummary()
|
||||
{
|
||||
return new NotificationsSummaryDto();
|
||||
}
|
||||
@@ -134,17 +119,11 @@ namespace Jellyfin.Api.Controllers
|
||||
/// <summary>
|
||||
/// Sets notifications as read.
|
||||
/// </summary>
|
||||
/// <param name="userId">The userID.</param>
|
||||
/// <param name="ids">A comma-separated list of the IDs of notifications which should be set as read.</param>
|
||||
/// <response code="204">Notifications set as read.</response>
|
||||
/// <returns>A <cref see="NoContentResult"/>.</returns>
|
||||
[HttpPost("{userId}/Read")]
|
||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "userId", Justification = "Imported from ServiceStack")]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "ids", Justification = "Imported from ServiceStack")]
|
||||
public ActionResult SetRead(
|
||||
[FromRoute] string userId,
|
||||
[FromQuery] string ids)
|
||||
public ActionResult SetRead()
|
||||
{
|
||||
return NoContent();
|
||||
}
|
||||
@@ -152,17 +131,11 @@ namespace Jellyfin.Api.Controllers
|
||||
/// <summary>
|
||||
/// Sets notifications as unread.
|
||||
/// </summary>
|
||||
/// <param name="userId">The userID.</param>
|
||||
/// <param name="ids">A comma-separated list of the IDs of notifications which should be set as unread.</param>
|
||||
/// <response code="204">Notifications set as unread.</response>
|
||||
/// <returns>A <cref see="NoContentResult"/>.</returns>
|
||||
[HttpPost("{userId}/Unread")]
|
||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "userId", Justification = "Imported from ServiceStack")]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "ids", Justification = "Imported from ServiceStack")]
|
||||
public ActionResult SetUnread(
|
||||
[FromRoute] string userId,
|
||||
[FromQuery] string ids)
|
||||
public ActionResult SetUnread()
|
||||
{
|
||||
return NoContent();
|
||||
}
|
||||
|
||||
@@ -42,13 +42,11 @@ namespace Jellyfin.Api.Controllers
|
||||
/// <summary>
|
||||
/// Gets a list of currently installed plugins.
|
||||
/// </summary>
|
||||
/// <param name="isAppStoreEnabled">Optional. Unused.</param>
|
||||
/// <response code="200">Installed plugins returned.</response>
|
||||
/// <returns>List of currently installed plugins.</returns>
|
||||
[HttpGet]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "isAppStoreEnabled", Justification = "Imported from ServiceStack")]
|
||||
public ActionResult<IEnumerable<PluginInfo>> GetPlugins([FromRoute] bool? isAppStoreEnabled)
|
||||
public ActionResult<IEnumerable<PluginInfo>> GetPlugins()
|
||||
{
|
||||
return Ok(_appHost.Plugins.OrderBy(p => p.Name).Select(p => p.GetPluginInfo()));
|
||||
}
|
||||
|
||||
161
Jellyfin.Api/Controllers/ScheduledTasksController.cs
Normal file
161
Jellyfin.Api/Controllers/ScheduledTasksController.cs
Normal file
@@ -0,0 +1,161 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Jellyfin.Api.Constants;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
||||
|
||||
namespace Jellyfin.Api.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// Scheduled Tasks Controller.
|
||||
/// </summary>
|
||||
[Authorize(Policy = Policies.RequiresElevation)]
|
||||
public class ScheduledTasksController : BaseJellyfinApiController
|
||||
{
|
||||
private readonly ITaskManager _taskManager;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ScheduledTasksController"/> class.
|
||||
/// </summary>
|
||||
/// <param name="taskManager">Instance of the <see cref="ITaskManager"/> interface.</param>
|
||||
public ScheduledTasksController(ITaskManager taskManager)
|
||||
{
|
||||
_taskManager = taskManager;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get tasks.
|
||||
/// </summary>
|
||||
/// <param name="isHidden">Optional filter tasks that are hidden, or not.</param>
|
||||
/// <param name="isEnabled">Optional filter tasks that are enabled, or not.</param>
|
||||
/// <response code="200">Scheduled tasks retrieved.</response>
|
||||
/// <returns>The list of scheduled tasks.</returns>
|
||||
[HttpGet]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
public IEnumerable<IScheduledTaskWorker> GetTasks(
|
||||
[FromQuery] bool? isHidden,
|
||||
[FromQuery] bool? isEnabled)
|
||||
{
|
||||
IEnumerable<IScheduledTaskWorker> tasks = _taskManager.ScheduledTasks.OrderBy(o => o.Name);
|
||||
|
||||
foreach (var task in tasks)
|
||||
{
|
||||
if (task.ScheduledTask is IConfigurableScheduledTask scheduledTask)
|
||||
{
|
||||
if (isHidden.HasValue && isHidden.Value != scheduledTask.IsHidden)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isEnabled.HasValue && isEnabled.Value != scheduledTask.IsEnabled)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
yield return task;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get task by id.
|
||||
/// </summary>
|
||||
/// <param name="taskId">Task Id.</param>
|
||||
/// <response code="200">Task retrieved.</response>
|
||||
/// <response code="404">Task not found.</response>
|
||||
/// <returns>An <see cref="OkResult"/> containing the task on success, or a <see cref="NotFoundResult"/> if the task could not be found.</returns>
|
||||
[HttpGet("{taskId}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
public ActionResult<TaskInfo> GetTask([FromRoute] string taskId)
|
||||
{
|
||||
var task = _taskManager.ScheduledTasks.FirstOrDefault(i =>
|
||||
string.Equals(i.Id, taskId, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (task == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return ScheduledTaskHelpers.GetTaskInfo(task);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Start specified task.
|
||||
/// </summary>
|
||||
/// <param name="taskId">Task Id.</param>
|
||||
/// <response code="204">Task started.</response>
|
||||
/// <response code="404">Task not found.</response>
|
||||
/// <returns>An <see cref="NoContentResult"/> on success, or a <see cref="NotFoundResult"/> if the file could not be found.</returns>
|
||||
[HttpPost("Running/{taskId}")]
|
||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
public ActionResult StartTask([FromRoute] string taskId)
|
||||
{
|
||||
var task = _taskManager.ScheduledTasks.FirstOrDefault(o =>
|
||||
o.Id.Equals(taskId, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (task == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
_taskManager.Execute(task, new TaskOptions());
|
||||
return NoContent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stop specified task.
|
||||
/// </summary>
|
||||
/// <param name="taskId">Task Id.</param>
|
||||
/// <response code="204">Task stopped.</response>
|
||||
/// <response code="404">Task not found.</response>
|
||||
/// <returns>An <see cref="OkResult"/> on success, or a <see cref="NotFoundResult"/> if the file could not be found.</returns>
|
||||
[HttpDelete("Running/{taskId}")]
|
||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
public ActionResult StopTask([FromRoute] string taskId)
|
||||
{
|
||||
var task = _taskManager.ScheduledTasks.FirstOrDefault(o =>
|
||||
o.Id.Equals(taskId, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (task == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
_taskManager.Cancel(task);
|
||||
return NoContent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update specified task triggers.
|
||||
/// </summary>
|
||||
/// <param name="taskId">Task Id.</param>
|
||||
/// <param name="triggerInfos">Triggers.</param>
|
||||
/// <response code="204">Task triggers updated.</response>
|
||||
/// <response code="404">Task not found.</response>
|
||||
/// <returns>An <see cref="OkResult"/> on success, or a <see cref="NotFoundResult"/> if the file could not be found.</returns>
|
||||
[HttpPost("{taskId}/Triggers")]
|
||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
public ActionResult UpdateTask(
|
||||
[FromRoute] string taskId,
|
||||
[FromBody, BindRequired] TaskTriggerInfo[] triggerInfos)
|
||||
{
|
||||
var task = _taskManager.ScheduledTasks.FirstOrDefault(o =>
|
||||
o.Id.Equals(taskId, StringComparison.OrdinalIgnoreCase));
|
||||
if (task == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
task.Triggers = triggerInfos;
|
||||
return NoContent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -185,12 +185,10 @@ namespace Jellyfin.Api.Controllers
|
||||
/// <param name="enableImageTypes">Optional. The image types to include in the output.</param>
|
||||
/// <param name="enableUserData">Optional. Include user data.</param>
|
||||
/// <param name="sortBy">Optional. Specify one or more sort orders, comma delimeted. Options: Album, AlbumArtist, Artist, Budget, CommunityRating, CriticRating, DateCreated, DatePlayed, PlayCount, PremiereDate, ProductionYear, SortName, Random, Revenue, Runtime.</param>
|
||||
/// <param name="sortOrder">Optional. Sort order: Ascending,Descending.</param>
|
||||
/// <returns>A <see cref="QueryResult{BaseItemDto}"/> with the episodes on success or a <see cref="NotFoundResult"/> if the series was not found.</returns>
|
||||
[HttpGet("{seriesId}/Episodes")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "sortOrder", Justification = "Imported from ServiceStack")]
|
||||
public ActionResult<QueryResult<BaseItemDto>> GetEpisodes(
|
||||
[FromRoute] string seriesId,
|
||||
[FromQuery] Guid userId,
|
||||
@@ -206,8 +204,7 @@ namespace Jellyfin.Api.Controllers
|
||||
[FromQuery] int? imageTypeLimit,
|
||||
[FromQuery] string? enableImageTypes,
|
||||
[FromQuery] bool? enableUserData,
|
||||
[FromQuery] string? sortBy,
|
||||
[FromQuery] SortOrder? sortOrder)
|
||||
[FromQuery] string? sortBy)
|
||||
{
|
||||
var user = _userManager.GetUserById(userId);
|
||||
|
||||
|
||||
@@ -68,17 +68,14 @@ namespace Jellyfin.Api.Controllers
|
||||
/// </summary>
|
||||
/// <param name="isHidden">Optional filter by IsHidden=true or false.</param>
|
||||
/// <param name="isDisabled">Optional filter by IsDisabled=true or false.</param>
|
||||
/// <param name="isGuest">Optional filter by IsGuest=true or false.</param>
|
||||
/// <response code="200">Users returned.</response>
|
||||
/// <returns>An <see cref="IEnumerable{UserDto}"/> containing the users.</returns>
|
||||
[HttpGet]
|
||||
[Authorize(Policy = Policies.DefaultAuthorization)]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "isGuest", Justification = "Imported from ServiceStack")]
|
||||
public ActionResult<IEnumerable<UserDto>> GetUsers(
|
||||
[FromQuery] bool? isHidden,
|
||||
[FromQuery] bool? isDisabled,
|
||||
[FromQuery] bool? isGuest)
|
||||
[FromQuery] bool? isDisabled)
|
||||
{
|
||||
var users = Get(isHidden, isDisabled, false, false);
|
||||
return Ok(users);
|
||||
|
||||
Reference in New Issue
Block a user