|
|
|
@ -1,6 +1,5 @@
|
|
|
|
|
#nullable enable
|
|
|
|
|
#pragma warning disable CA1801
|
|
|
|
|
#pragma warning disable SA1313
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
@ -37,17 +36,17 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Endpoint for getting a user's notifications.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="UserID">The UserID.</param>
|
|
|
|
|
/// <param name="IsRead">An optional filter by IsRead.</param>
|
|
|
|
|
/// <param name="StartIndex">The optional index to start at. All notifications with a lower index will be dropped from the results.</param>
|
|
|
|
|
/// <param name="Limit">An optional limit on the number of notifications returned.</param>
|
|
|
|
|
/// <param name="userID">The UserID.</param>
|
|
|
|
|
/// <param name="isRead">An optional filter by IsRead.</param>
|
|
|
|
|
/// <param name="startIndex">The optional index to start at. All notifications with a lower index will be dropped from the results.</param>
|
|
|
|
|
/// <param name="limit">An optional limit on the number of notifications returned.</param>
|
|
|
|
|
/// <returns>A read-only list of all of the user's notifications.</returns>
|
|
|
|
|
[HttpGet("{UserID}")]
|
|
|
|
|
public IReadOnlyList<NotificationDto> GetNotifications(
|
|
|
|
|
[FromRoute] string UserID,
|
|
|
|
|
[FromQuery] bool? IsRead,
|
|
|
|
|
[FromQuery] int? StartIndex,
|
|
|
|
|
[FromQuery] int? Limit)
|
|
|
|
|
[FromRoute] string userID,
|
|
|
|
|
[FromQuery] bool? isRead,
|
|
|
|
|
[FromQuery] int? startIndex,
|
|
|
|
|
[FromQuery] int? limit)
|
|
|
|
|
{
|
|
|
|
|
return new List<NotificationDto>();
|
|
|
|
|
}
|
|
|
|
@ -55,11 +54,11 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Endpoint for getting a user's notification summary.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="UserID">The UserID.</param>
|
|
|
|
|
/// <param name="userID">The userID.</param>
|
|
|
|
|
/// <returns>Notifications summary for the user.</returns>
|
|
|
|
|
[HttpGet("{UserId}/Summary")]
|
|
|
|
|
[HttpGet("{UserID}/Summary")]
|
|
|
|
|
public NotificationsSummaryDto GetNotificationsSummary(
|
|
|
|
|
[FromRoute] string UserID)
|
|
|
|
|
[FromRoute] string userID)
|
|
|
|
|
{
|
|
|
|
|
return new NotificationsSummaryDto();
|
|
|
|
|
}
|
|
|
|
@ -87,23 +86,23 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Endpoint to send a notification to all admins.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="Name">The name of the notification.</param>
|
|
|
|
|
/// <param name="Description">The description of the notification.</param>
|
|
|
|
|
/// <param name="URL">The URL of the notification.</param>
|
|
|
|
|
/// <param name="Level">The level of the notification.</param>
|
|
|
|
|
/// <param name="name">The name of the notification.</param>
|
|
|
|
|
/// <param name="description">The description of the notification.</param>
|
|
|
|
|
/// <param name="url">The URL of the notification.</param>
|
|
|
|
|
/// <param name="level">The level of the notification.</param>
|
|
|
|
|
[HttpPost("Admin")]
|
|
|
|
|
public void CreateAdminNotification(
|
|
|
|
|
[FromForm] string Name,
|
|
|
|
|
[FromForm] string Description,
|
|
|
|
|
[FromForm] string? URL,
|
|
|
|
|
[FromForm] NotificationLevel Level)
|
|
|
|
|
[FromForm] string name,
|
|
|
|
|
[FromForm] string description,
|
|
|
|
|
[FromForm] string? url,
|
|
|
|
|
[FromForm] NotificationLevel level)
|
|
|
|
|
{
|
|
|
|
|
var notification = new NotificationRequest
|
|
|
|
|
{
|
|
|
|
|
Name = Name,
|
|
|
|
|
Description = Description,
|
|
|
|
|
Url = URL,
|
|
|
|
|
Level = Level,
|
|
|
|
|
Name = name,
|
|
|
|
|
Description = description,
|
|
|
|
|
Url = url,
|
|
|
|
|
Level = level,
|
|
|
|
|
UserIds = _userManager.Users.Where(i => i.Policy.IsAdministrator).Select(i => i.Id).ToArray(),
|
|
|
|
|
Date = DateTime.UtcNow,
|
|
|
|
|
};
|
|
|
|
@ -114,24 +113,24 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Endpoint to set notifications as read.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="UserID">The UserID.</param>
|
|
|
|
|
/// <param name="IDs">The IDs of notifications which should be set as read.</param>
|
|
|
|
|
/// <param name="userID">The userID.</param>
|
|
|
|
|
/// <param name="ids">The IDs of notifications which should be set as read.</param>
|
|
|
|
|
[HttpPost("{UserID}/Read")]
|
|
|
|
|
public void SetRead(
|
|
|
|
|
[FromRoute] string UserID,
|
|
|
|
|
[FromForm] List<string> IDs)
|
|
|
|
|
[FromRoute] string userID,
|
|
|
|
|
[FromForm] List<string> ids)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Endpoint to set notifications as unread.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="UserID">The UserID.</param>
|
|
|
|
|
/// <param name="IDs">The IDs of notifications which should be set as unread.</param>
|
|
|
|
|
/// <param name="userID">The userID.</param>
|
|
|
|
|
/// <param name="ids">The IDs of notifications which should be set as unread.</param>
|
|
|
|
|
[HttpPost("{UserID}/Unread")]
|
|
|
|
|
public void SetUnread(
|
|
|
|
|
[FromRoute] string UserID,
|
|
|
|
|
[FromForm] List<string> IDs)
|
|
|
|
|
[FromRoute] string userID,
|
|
|
|
|
[FromForm] List<string> ids)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|