mirror of https://github.com/lidarr/Lidarr
New: Health events for Webhooks
This commit is contained in:
parent
5a15565d2b
commit
acda741b2b
|
@ -25,7 +25,7 @@ namespace NzbDrone.Core.Notifications.Webhook
|
|||
|
||||
var payload = new WebhookGrabPayload
|
||||
{
|
||||
EventType = "Grab",
|
||||
EventType = WebhookEventType.Grab,
|
||||
Artist = new WebhookArtist(message.Artist),
|
||||
Albums = remoteAlbum.Albums.ConvertAll(x => new WebhookAlbum(x)
|
||||
{
|
||||
|
@ -48,7 +48,7 @@ namespace NzbDrone.Core.Notifications.Webhook
|
|||
|
||||
var payload = new WebhookImportPayload
|
||||
{
|
||||
EventType = "Download",
|
||||
EventType = WebhookEventType.Download,
|
||||
Artist = new WebhookArtist(message.Artist),
|
||||
Tracks = trackFiles.SelectMany(x => x.Tracks.Value.Select(y => new WebhookTrack(y)
|
||||
{
|
||||
|
@ -68,9 +68,9 @@ namespace NzbDrone.Core.Notifications.Webhook
|
|||
|
||||
public override void OnRename(Artist artist)
|
||||
{
|
||||
var payload = new WebhookPayload
|
||||
var payload = new WebhookRenamePayload
|
||||
{
|
||||
EventType = "Rename",
|
||||
EventType = WebhookEventType.Rename,
|
||||
Artist = new WebhookArtist(artist)
|
||||
};
|
||||
|
||||
|
@ -79,15 +79,29 @@ namespace NzbDrone.Core.Notifications.Webhook
|
|||
|
||||
public override void OnTrackRetag(TrackRetagMessage message)
|
||||
{
|
||||
var payload = new WebhookPayload
|
||||
var payload = new WebhookRetagPayload
|
||||
{
|
||||
EventType = "Retag",
|
||||
EventType = WebhookEventType.Retag,
|
||||
Artist = new WebhookArtist(message.Artist)
|
||||
};
|
||||
|
||||
_proxy.SendWebhook(payload, Settings);
|
||||
}
|
||||
|
||||
public override void OnHealthIssue(HealthCheck.HealthCheck healthCheck)
|
||||
{
|
||||
var payload = new WebhookHealthPayload
|
||||
{
|
||||
EventType = WebhookEventType.Health,
|
||||
Level = healthCheck.Type,
|
||||
Message = healthCheck.Message,
|
||||
Type = healthCheck.Source.Name,
|
||||
WikiUrl = healthCheck.WikiUrl?.ToString()
|
||||
};
|
||||
|
||||
_proxy.SendWebhook(payload, Settings);
|
||||
}
|
||||
|
||||
public override string Name => "Webhook";
|
||||
|
||||
public override ValidationResult Test()
|
||||
|
@ -105,7 +119,7 @@ namespace NzbDrone.Core.Notifications.Webhook
|
|||
{
|
||||
var payload = new WebhookGrabPayload
|
||||
{
|
||||
EventType = "Test",
|
||||
EventType = WebhookEventType.Test,
|
||||
Artist = new WebhookArtist()
|
||||
{
|
||||
Id = 1,
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
namespace NzbDrone.Core.Notifications.Webhook
|
||||
{
|
||||
public enum WebhookEventType
|
||||
{
|
||||
Test,
|
||||
Grab,
|
||||
Download,
|
||||
Rename,
|
||||
Health,
|
||||
Retag
|
||||
}
|
||||
}
|
|
@ -4,6 +4,7 @@ namespace NzbDrone.Core.Notifications.Webhook
|
|||
{
|
||||
public class WebhookGrabPayload : WebhookPayload
|
||||
{
|
||||
public WebhookArtist Artist { get; set; }
|
||||
public List<WebhookAlbum> Albums { get; set; }
|
||||
public WebhookRelease Release { get; set; }
|
||||
public string DownloadClient { get; set; }
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
using NzbDrone.Core.HealthCheck;
|
||||
|
||||
namespace NzbDrone.Core.Notifications.Webhook
|
||||
{
|
||||
public class WebhookHealthPayload : WebhookPayload
|
||||
{
|
||||
public HealthCheckResult Level { get; set; }
|
||||
public string Message { get; set; }
|
||||
public string Type { get; set; }
|
||||
public string WikiUrl { get; set; }
|
||||
}
|
||||
}
|
|
@ -4,6 +4,7 @@ namespace NzbDrone.Core.Notifications.Webhook
|
|||
{
|
||||
public class WebhookImportPayload : WebhookPayload
|
||||
{
|
||||
public WebhookArtist Artist { get; set; }
|
||||
public List<WebhookTrack> Tracks { get; set; }
|
||||
public List<WebhookTrackFile> TrackFiles { get; set; }
|
||||
public bool IsUpgrade { get; set; }
|
||||
|
|
|
@ -2,7 +2,6 @@ namespace NzbDrone.Core.Notifications.Webhook
|
|||
{
|
||||
public class WebhookPayload
|
||||
{
|
||||
public string EventType { get; set; }
|
||||
public WebhookArtist Artist { get; set; }
|
||||
public WebhookEventType EventType { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
namespace NzbDrone.Core.Notifications.Webhook
|
||||
{
|
||||
public class WebhookRenamePayload : WebhookPayload
|
||||
{
|
||||
public WebhookArtist Artist { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
namespace NzbDrone.Core.Notifications.Webhook
|
||||
{
|
||||
public class WebhookRetagPayload : WebhookPayload
|
||||
{
|
||||
public WebhookArtist Artist { get; set; }
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue