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.
37 lines
1.1 KiB
37 lines
1.1 KiB
using FluentValidation;
|
|
using NzbDrone.Core.Annotations;
|
|
using NzbDrone.Core.ThingiProvider;
|
|
using NzbDrone.Core.Validation;
|
|
|
|
namespace NzbDrone.Core.Applications.Radarr
|
|
{
|
|
public class RadarrSettingsValidator : AbstractValidator<RadarrSettings>
|
|
{
|
|
public RadarrSettingsValidator()
|
|
{
|
|
RuleFor(c => c.BaseUrl).IsValidUrl();
|
|
RuleFor(c => c.ApiKey).NotEmpty();
|
|
}
|
|
}
|
|
|
|
public class RadarrSettings : IProviderConfig
|
|
{
|
|
private static readonly RadarrSettingsValidator Validator = new RadarrSettingsValidator();
|
|
|
|
public RadarrSettings()
|
|
{
|
|
}
|
|
|
|
[FieldDefinition(0, Label = "Radarr Server", HelpText = "Radarr server URL, including http(s):// and port if needed")]
|
|
public string BaseUrl { get; set; }
|
|
|
|
[FieldDefinition(1, Label = "ApiKey", Privacy = PrivacyLevel.ApiKey, HelpText = "The ApiKey generated by Radarr in Settings/General")]
|
|
public string ApiKey { get; set; }
|
|
|
|
public NzbDroneValidationResult Validate()
|
|
{
|
|
return new NzbDroneValidationResult(Validator.Validate(this));
|
|
}
|
|
}
|
|
}
|