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.
42 lines
1.3 KiB
42 lines
1.3 KiB
using FluentValidation;
|
|
using NzbDrone.Core.Annotations;
|
|
using NzbDrone.Core.ThingiProvider;
|
|
using NzbDrone.Core.Validation;
|
|
|
|
namespace NzbDrone.Core.Notifications.Pushalot
|
|
{
|
|
public class PushalotSettingsValidator : AbstractValidator<PushalotSettings>
|
|
{
|
|
public PushalotSettingsValidator()
|
|
{
|
|
RuleFor(c => c.AuthToken).NotEmpty();
|
|
}
|
|
}
|
|
|
|
public class PushalotSettings : IProviderConfig
|
|
{
|
|
public PushalotSettings()
|
|
{
|
|
Image = true;
|
|
}
|
|
|
|
private static readonly PushalotSettingsValidator Validator = new PushalotSettingsValidator();
|
|
|
|
[FieldDefinition(0, Label = "Authorization Token", HelpLink = "https://pushalot.com/manager/authorizations")]
|
|
public string AuthToken { get; set; }
|
|
|
|
[FieldDefinition(1, Label = "Priority", Type = FieldType.Select, SelectOptions = typeof(PushalotPriority))]
|
|
public int Priority { get; set; }
|
|
|
|
[FieldDefinition(2, Label = "Image", Type = FieldType.Checkbox, HelpText = "Include Radarr logo with notifications")]
|
|
public bool Image { get; set; }
|
|
|
|
public bool IsValid => !string.IsNullOrWhiteSpace(AuthToken);
|
|
|
|
public NzbDroneValidationResult Validate()
|
|
{
|
|
return new NzbDroneValidationResult(Validator.Validate(this));
|
|
}
|
|
}
|
|
}
|