2020-10-02 18:29:25 +00:00
|
|
|
using System;
|
2020-08-20 01:07:02 +00:00
|
|
|
using System.Collections.Generic;
|
2013-10-12 18:44:40 +00:00
|
|
|
using FluentValidation;
|
2013-09-18 07:33:31 +00:00
|
|
|
using NzbDrone.Core.Annotations;
|
2015-03-17 04:33:34 +00:00
|
|
|
using NzbDrone.Core.Validation;
|
2013-09-18 07:33:31 +00:00
|
|
|
|
|
|
|
namespace NzbDrone.Core.Notifications.PushBullet
|
|
|
|
{
|
2013-10-12 18:44:40 +00:00
|
|
|
public class PushBulletSettingsValidator : AbstractValidator<PushBulletSettings>
|
|
|
|
{
|
|
|
|
public PushBulletSettingsValidator()
|
|
|
|
{
|
|
|
|
RuleFor(c => c.ApiKey).NotEmpty();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-14 04:16:26 +00:00
|
|
|
public class PushBulletSettings : NotificationSettingsBase<PushBulletSettings>
|
2013-09-18 07:33:31 +00:00
|
|
|
{
|
2024-04-14 04:16:26 +00:00
|
|
|
private static readonly PushBulletSettingsValidator Validator = new ();
|
2013-10-12 18:44:40 +00:00
|
|
|
|
2015-06-28 19:45:02 +00:00
|
|
|
public PushBulletSettings()
|
|
|
|
{
|
2020-10-02 18:29:25 +00:00
|
|
|
DeviceIds = Array.Empty<string>();
|
|
|
|
ChannelTags = Array.Empty<string>();
|
2015-06-28 19:45:02 +00:00
|
|
|
}
|
|
|
|
|
2024-01-03 20:41:16 +00:00
|
|
|
[FieldDefinition(0, Label = "NotificationsPushBulletSettingsAccessToken", Privacy = PrivacyLevel.ApiKey, HelpLink = "https://www.pushbullet.com/#settings/account")]
|
2015-06-28 19:45:02 +00:00
|
|
|
public string ApiKey { get; set; }
|
2013-09-18 07:33:31 +00:00
|
|
|
|
2024-01-03 20:41:16 +00:00
|
|
|
[FieldDefinition(1, Label = "NotificationsPushBulletSettingsDeviceIds", HelpText = "NotificationsPushBulletSettingsDeviceIdsHelpText", Type = FieldType.Device, Placeholder = "123456789,987654321")]
|
2015-06-28 19:45:02 +00:00
|
|
|
public IEnumerable<string> DeviceIds { get; set; }
|
2013-09-18 07:33:31 +00:00
|
|
|
|
2024-01-03 20:41:16 +00:00
|
|
|
[FieldDefinition(2, Label = "NotificationsPushBulletSettingsChannelTags", HelpText = "NotificationsPushBulletSettingsChannelTagsHelpText", Type = FieldType.Tag, Placeholder = "Channel1234,Channel4321")]
|
2015-06-28 19:45:02 +00:00
|
|
|
public IEnumerable<string> ChannelTags { get; set; }
|
2013-09-21 07:09:26 +00:00
|
|
|
|
2024-01-03 20:41:16 +00:00
|
|
|
[FieldDefinition(3, Label = "NotificationsPushBulletSettingSenderId", HelpText = "NotificationsPushBulletSettingSenderIdHelpText")]
|
2016-01-28 17:10:55 +00:00
|
|
|
public string SenderId { get; set; }
|
|
|
|
|
2024-04-14 04:16:26 +00:00
|
|
|
public override NzbDroneValidationResult Validate()
|
2013-09-21 07:09:26 +00:00
|
|
|
{
|
2015-03-17 04:33:34 +00:00
|
|
|
return new NzbDroneValidationResult(Validator.Validate(this));
|
2013-09-21 07:09:26 +00:00
|
|
|
}
|
2013-09-18 07:33:31 +00:00
|
|
|
}
|
|
|
|
}
|