You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Lidarr/src/NzbDrone.Core/Notifications/PushBullet/PushBulletSettings.cs

45 lines
1.7 KiB

using System.Collections.Generic;
using FluentValidation;
using NzbDrone.Core.Annotations;
using NzbDrone.Core.ThingiProvider;
using NzbDrone.Core.Validation;
namespace NzbDrone.Core.Notifications.PushBullet
{
public class PushBulletSettingsValidator : AbstractValidator<PushBulletSettings>
{
public PushBulletSettingsValidator()
{
RuleFor(c => c.ApiKey).NotEmpty();
}
}
public class PushBulletSettings : IProviderConfig
{
private static readonly PushBulletSettingsValidator Validator = new PushBulletSettingsValidator();
public PushBulletSettings()
{
DeviceIds = System.Array.Empty<string>();
ChannelTags = System.Array.Empty<string>();
}
[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)]
public IEnumerable<string> DeviceIds { get; set; }
[FieldDefinition(2, Label = "Channel Tags", HelpText = "List of Channel Tags to send notifications to", Type = FieldType.Tag)]
public IEnumerable<string> 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 NzbDroneValidationResult Validate()
{
return new NzbDroneValidationResult(Validator.Validate(this));
}
}
}