mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-17 21:25:39 -04:00
Moved source code under src folder - massive change
This commit is contained in:
40
src/NzbDrone.Api/Notifications/NotificationSchemaModule.cs
Normal file
40
src/NzbDrone.Api/Notifications/NotificationSchemaModule.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
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 INotificationService _notificationService;
|
||||
|
||||
public NotificationSchemaModule(INotificationService notificationService)
|
||||
: base("notification/schema")
|
||||
{
|
||||
_notificationService = notificationService;
|
||||
|
||||
GetResourceAll = GetSchema;
|
||||
}
|
||||
|
||||
private List<NotificationResource> GetSchema()
|
||||
{
|
||||
var notifications = _notificationService.Schema();
|
||||
|
||||
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);
|
||||
notificationResource.TestCommand = String.Format("test{0}", notification.Implementation.ToLowerInvariant());
|
||||
|
||||
result.Add(notificationResource);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user