New: Added priority levels to Join Notifications

pull/6/head
Qstick 6 years ago
parent 32c75cfcbc
commit 6da9868716

@ -0,0 +1,11 @@
namespace NzbDrone.Core.Notifications.Join
{
public enum JoinPriority
{
Silent = -2,
Quiet = -1,
Normal = 0,
High = 1,
Emergency = 2
}
}

@ -94,6 +94,7 @@ namespace NzbDrone.Core.Notifications.Join
request.AddParameter("text", message);
request.AddParameter("icon", "https://cdn.rawgit.com/Lidarr/Lidarr/develop/Logo/256.png"); // Use the Lidarr logo.
request.AddParameter("smallicon", "https://cdn.rawgit.com/Lidarr/Lidarr/develop/Logo/96-Outline-White.png"); // 96x96px with outline at 88x88px on a transparent background.
request.AddParameter("priority", settings.Priority);
var response = client.ExecuteAndValidate(request);
var res = Json.Deserialize<JoinResponseModel>(response.Content);

@ -16,6 +16,11 @@ namespace NzbDrone.Core.Notifications.Join
public class JoinSettings : IProviderConfig
{
public JoinSettings()
{
Priority = (int)JoinPriority.Normal;
}
private static readonly JoinSettingsValidator Validator = new JoinSettingsValidator();
[FieldDefinition(0, Label = "API Key", HelpText = "The API Key from your Join account settings (click Join API button).", HelpLink = "https://joinjoaomgcd.appspot.com/")]
@ -27,6 +32,9 @@ namespace NzbDrone.Core.Notifications.Join
[FieldDefinition(2, Label = "Device Names", HelpText = "Comma separated list of full or partial device names you'd like to send notifications to. If unset, all devices will receive notifications.", HelpLink = "https://joaoapps.com/join/api/")]
public string DeviceNames { get; set; }
[FieldDefinition(3, Label = "Notification Priority", Type = FieldType.Select, SelectOptions = typeof(JoinPriority))]
public int Priority { get; set; }
public NzbDroneValidationResult Validate()
{
return new NzbDroneValidationResult(Validator.Validate(this));

@ -884,6 +884,7 @@
<Compile Include="Notifications\AlbumDownloadMessage.cs" />
<Compile Include="Notifications\Join\JoinAuthException.cs" />
<Compile Include="Notifications\Join\JoinInvalidDeviceException.cs" />
<Compile Include="Notifications\Join\JoinPriority.cs" />
<Compile Include="Notifications\Join\JoinResponseModel.cs" />
<Compile Include="Notifications\Join\Join.cs" />
<Compile Include="Notifications\Join\JoinException.cs" />

Loading…
Cancel
Save