|
|
|
@ -73,16 +73,9 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
[HttpGet("Types")]
|
|
|
|
|
[ProducesResponseType(typeof(IEnumerable<NameIdPair>), StatusCodes.Status200OK)]
|
|
|
|
|
public IActionResult GetNotificationTypes()
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
return Ok(_notificationManager.GetNotificationTypes());
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Endpoint for getting notification services.
|
|
|
|
@ -91,16 +84,9 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
[HttpGet("Services")]
|
|
|
|
|
[ProducesResponseType(typeof(IEnumerable<NameIdPair>), StatusCodes.Status200OK)]
|
|
|
|
|
public IActionResult GetNotificationServices()
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
return Ok(_notificationManager.GetNotificationServices());
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Endpoint to send a notification to all admins.
|
|
|
|
@ -112,13 +98,11 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
/// <returns>Status.</returns>
|
|
|
|
|
[HttpPost("Admin")]
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
public IActionResult CreateAdminNotification(
|
|
|
|
|
public void CreateAdminNotification(
|
|
|
|
|
[FromQuery] string name,
|
|
|
|
|
[FromQuery] string description,
|
|
|
|
|
[FromQuery] string? url,
|
|
|
|
|
[FromQuery] NotificationLevel? level)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var notification = new NotificationRequest
|
|
|
|
|
{
|
|
|
|
@ -131,13 +115,6 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
_notificationManager.SendNotification(notification, CancellationToken.None);
|
|
|
|
|
|
|
|
|
|
return Ok();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|