using System; using System.Collections.Generic; using FluentValidation; using NzbDrone.Core.Annotations; using NzbDrone.Core.Validation; namespace NzbDrone.Core.Notifications.PushBullet { public class PushBulletSettingsValidator : AbstractValidator { public PushBulletSettingsValidator() { RuleFor(c => c.ApiKey).NotEmpty(); } } public class PushBulletSettings : NotificationBaseSettings { private static readonly PushBulletSettingsValidator Validator = new PushBulletSettingsValidator(); public PushBulletSettings() { DeviceIds = Array.Empty(); ChannelTags = Array.Empty(); } [FieldDefinition(0, Label = "Access Token", Privacy = PrivacyLevel.ApiKey, HelpLink = "https://www.pushbullet.com/#settings/account")] public string ApiKey { get; set; } [FieldDefinition(1, Label = "Device IDs", HelpText = "List of device IDs (leave blank to send to all devices)", Type = FieldType.Device, Placeholder = "123456789,987654321")] public IEnumerable DeviceIds { get; set; } [FieldDefinition(2, Label = "Channel Tags", HelpText = "List of Channel Tags to send notifications to", Type = FieldType.Tag, Placeholder = "Channel1234,Channel4321")] public IEnumerable ChannelTags { get; set; } [FieldDefinition(3, Label = "Sender ID", HelpText = "The device ID to send notifications from, use device_iden in the device's URL on pushbullet.com (leave blank to send from yourself)")] public string SenderId { get; set; } public override NzbDroneValidationResult Validate() { return new NzbDroneValidationResult(Validator.Validate(this)); } } }