2013-04-07 09:30:37 +02:00
|
|
|
|
using System;
|
2013-08-22 10:08:43 +02:00
|
|
|
|
using FluentValidation;
|
|
|
|
|
using FluentValidation.Results;
|
2013-05-03 07:24:52 +02:00
|
|
|
|
using NzbDrone.Core.Annotations;
|
2013-04-07 09:30:37 +02:00
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Indexers.Omgwtfnzbs
|
|
|
|
|
{
|
2013-08-26 06:01:03 +02:00
|
|
|
|
public class OmgwtfnzbsSettingsValidator : AbstractValidator<OmgwtfnzbsSettings>
|
|
|
|
|
{
|
|
|
|
|
public OmgwtfnzbsSettingsValidator()
|
|
|
|
|
{
|
|
|
|
|
RuleFor(c => c.Username).NotEmpty();
|
|
|
|
|
RuleFor(c => c.ApiKey).NotEmpty();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-24 06:40:02 +02:00
|
|
|
|
public class OmgwtfnzbsSettings : IIndexerSetting
|
2013-04-07 09:30:37 +02:00
|
|
|
|
{
|
2013-08-26 06:01:03 +02:00
|
|
|
|
private static readonly OmgwtfnzbsSettingsValidator Validator = new OmgwtfnzbsSettingsValidator();
|
2013-08-22 10:08:43 +02:00
|
|
|
|
|
2013-05-29 09:06:25 +02:00
|
|
|
|
[FieldDefinition(0, Label = "Username")]
|
2013-04-07 09:30:37 +02:00
|
|
|
|
public String Username { get; set; }
|
2013-05-03 07:24:52 +02:00
|
|
|
|
|
2013-05-29 09:06:25 +02:00
|
|
|
|
[FieldDefinition(1, Label = "API Key")]
|
2013-04-07 09:30:37 +02:00
|
|
|
|
public String ApiKey { get; set; }
|
|
|
|
|
|
2013-08-22 10:08:43 +02:00
|
|
|
|
public ValidationResult Validate()
|
2013-04-07 09:30:37 +02:00
|
|
|
|
{
|
2013-08-26 06:01:03 +02:00
|
|
|
|
return Validator.Validate(this);
|
2013-04-07 09:30:37 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|