Sonarr/src/NzbDrone.Core/Notifications/Gotify/GotifySettings.cs

43 lines
1.6 KiB
C#
Raw Normal View History

2019-04-07 11:55:38 +00:00
using FluentValidation;
using NzbDrone.Core.Annotations;
using NzbDrone.Core.Validation;
namespace NzbDrone.Core.Notifications.Gotify
{
public class GotifySettingsValidator : AbstractValidator<GotifySettings>
{
public GotifySettingsValidator()
{
RuleFor(c => c.Server).IsValidUrl();
RuleFor(c => c.AppToken).NotEmpty();
}
}
public class GotifySettings : NotificationSettingsBase<GotifySettings>
2019-04-07 11:55:38 +00:00
{
private static readonly GotifySettingsValidator Validator = new ();
2019-04-07 11:55:38 +00:00
public GotifySettings()
{
Priority = 5;
}
2024-01-12 00:33:01 +00:00
[FieldDefinition(0, Label = "NotificationsGotifySettingsServer", HelpText = "NotificationsGotifySettingsServerHelpText")]
2019-04-07 11:55:38 +00:00
public string Server { get; set; }
2024-01-03 20:41:16 +00:00
[FieldDefinition(1, Label = "NotificationsGotifySettingsAppToken", Privacy = PrivacyLevel.ApiKey, HelpText = "NotificationsGotifySettingsAppTokenHelpText")]
2019-04-07 11:55:38 +00:00
public string AppToken { get; set; }
2024-01-03 20:41:16 +00:00
[FieldDefinition(2, Label = "Priority", Type = FieldType.Select, SelectOptions = typeof(GotifyPriority), HelpText = "NotificationsGotifySettingsPriorityHelpText")]
2019-04-07 11:55:38 +00:00
public int Priority { get; set; }
2024-01-03 20:41:16 +00:00
[FieldDefinition(3, Label = "NotificationsGotifySettingIncludeSeriesPoster", Type = FieldType.Checkbox, HelpText = "NotificationsGotifySettingIncludeSeriesPosterHelpText")]
public bool IncludeSeriesPoster { get; set; }
public override NzbDroneValidationResult Validate()
2019-04-07 11:55:38 +00:00
{
return new NzbDroneValidationResult(Validator.Validate(this));
}
}
}