mirror of https://github.com/Radarr/Radarr
38 lines
1.2 KiB
C#
38 lines
1.2 KiB
C#
![]() |
using FluentValidation;
|
||
|
using NzbDrone.Core.Annotations;
|
||
|
using NzbDrone.Core.ThingiProvider;
|
||
|
using NzbDrone.Core.Validation;
|
||
|
|
||
|
namespace NzbDrone.Core.Indexers.TorrentPotato
|
||
|
{
|
||
|
public class TorrentPotatoSettingsValidator : AbstractValidator<TorrentPotatoSettings>
|
||
|
{
|
||
|
public TorrentPotatoSettingsValidator()
|
||
|
{
|
||
|
RuleFor(c => c.BaseUrl).ValidRootUrl();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public class TorrentPotatoSettings : IProviderConfig
|
||
|
{
|
||
|
private static readonly TorrentPotatoSettingsValidator Validator = new TorrentPotatoSettingsValidator();
|
||
|
|
||
|
public TorrentPotatoSettings()
|
||
|
{
|
||
|
BaseUrl = "";
|
||
|
}
|
||
|
|
||
|
[FieldDefinition(0, Label = "API URL", HelpText = "URL to TorrentPotato api.")]
|
||
|
public string BaseUrl { get; set; }
|
||
|
|
||
|
[FieldDefinition(1, Label = "Username", HelpText = "The username you use at your indexer.")]
|
||
|
public string User { get; set; }
|
||
|
|
||
|
[FieldDefinition(2, Label = "Passkey", HelpText = "The password you use at your Indexer,")]
|
||
|
public string Passkey { get; set; }
|
||
|
public NzbDroneValidationResult Validate()
|
||
|
{
|
||
|
return new NzbDroneValidationResult(Validator.Validate(this));
|
||
|
}
|
||
|
}
|
||
|
}
|