mirror of
https://github.com/Readarr/Readarr
synced 2026-02-05 14:22:32 +01:00
37 lines
No EOL
1.2 KiB
C#
37 lines
No EOL
1.2 KiB
C#
using System.Collections.Generic;
|
|
using NzbDrone.Api.ClientSchema;
|
|
using NzbDrone.Core.Notifications;
|
|
using Omu.ValueInjecter;
|
|
|
|
namespace NzbDrone.Api.Notifications
|
|
{
|
|
public class NotificationSchemaModule : NzbDroneRestModule<NotificationResource>
|
|
{
|
|
private readonly INotificationFactory _notificationFactory;
|
|
|
|
public NotificationSchemaModule(INotificationFactory notificationFactory)
|
|
: base("notification/schema")
|
|
{
|
|
_notificationFactory = notificationFactory;
|
|
GetResourceAll = GetSchema;
|
|
}
|
|
|
|
private List<NotificationResource> GetSchema()
|
|
{
|
|
var notifications = _notificationFactory.Templates();
|
|
|
|
var result = new List<NotificationResource>(notifications.Count);
|
|
|
|
foreach (var notification in notifications)
|
|
{
|
|
var notificationResource = new NotificationResource();
|
|
notificationResource.InjectFrom(notification);
|
|
notificationResource.Fields = SchemaBuilder.ToSchema(notification.Settings);
|
|
|
|
result.Add(notificationResource);
|
|
}
|
|
|
|
return result;
|
|
}
|
|
}
|
|
} |