New: Add Editions to Webhook Payloads

pull/2234/head
Qstick 2 years ago
parent d93329a3fd
commit 22781b62e6

@ -28,13 +28,7 @@ namespace NzbDrone.Core.Notifications.Webhook
EventType = WebhookEventType.Grab, EventType = WebhookEventType.Grab,
InstanceName = _configFileProvider.InstanceName, InstanceName = _configFileProvider.InstanceName,
Author = new WebhookAuthor(message.Author), Author = new WebhookAuthor(message.Author),
Books = remoteBook.Books.ConvertAll(x => new WebhookBook(x) Books = remoteBook.Books.ConvertAll(x => new WebhookBook(x)),
{
// TODO: Stop passing these parameters inside an book v3
Quality = quality.Quality.Name,
QualityVersion = quality.Revision.Version,
ReleaseGroup = remoteBook.ParsedBookInfo.ReleaseGroup
}),
Release = new WebhookRelease(quality, remoteBook), Release = new WebhookRelease(quality, remoteBook),
DownloadClient = message.DownloadClientName, DownloadClient = message.DownloadClientName,
DownloadClientType = message.DownloadClientType, DownloadClientType = message.DownloadClientType,

@ -1,4 +1,6 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using NzbDrone.Core.Books; using NzbDrone.Core.Books;
namespace NzbDrone.Core.Notifications.Webhook namespace NzbDrone.Core.Notifications.Webhook
@ -7,6 +9,7 @@ namespace NzbDrone.Core.Notifications.Webhook
{ {
public WebhookBook() public WebhookBook()
{ {
Editions = new List<WebhookBookEdition>();
} }
public WebhookBook(Book book) public WebhookBook(Book book)
@ -15,16 +18,13 @@ namespace NzbDrone.Core.Notifications.Webhook
GoodreadsId = book.ForeignBookId; GoodreadsId = book.ForeignBookId;
Title = book.Title; Title = book.Title;
ReleaseDate = book.ReleaseDate; ReleaseDate = book.ReleaseDate;
Editions = book.Editions.Value.Select(x => new WebhookBookEdition(x)).ToList();
} }
public int Id { get; set; } public int Id { get; set; }
public string GoodreadsId { get; set; } public string GoodreadsId { get; set; }
public string Title { get; set; } public string Title { get; set; }
public List<WebhookBookEdition> Editions { get; set; }
public DateTime? ReleaseDate { get; set; } public DateTime? ReleaseDate { get; set; }
public string Quality { get; set; }
public int QualityVersion { get; set; }
public string ReleaseGroup { get; set; }
public string SceneName { get; set; }
} }
} }

@ -0,0 +1,20 @@
using NzbDrone.Core.Books;
namespace NzbDrone.Core.Notifications.Webhook
{
public class WebhookBookEdition
{
public WebhookBookEdition(Edition edition)
{
GoodreadsId = edition.ForeignEditionId;
Title = edition.Title;
Asin = edition.Asin;
Isbn13 = edition.Isbn13;
}
public string Title { get; set; }
public string GoodreadsId { get; set; }
public string Asin { get; set; }
public string Isbn13 { get; set; }
}
}
Loading…
Cancel
Save