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