Files
Umbraco-CMS/src/Umbraco.Core/Webhooks/Events/Content/ContentDeletedWebhookEvent.cs
Sven Geusens 2297404041 Normalize webhook payloads (#19110)
Co-authored-by: Andy Butland <abutland73@gmail.com>
Co-authored-by: Kenn Jacobsen <kja@umbraco.dk>
2025-05-06 14:02:49 +02:00

34 lines
1.2 KiB
C#

using Microsoft.Extensions.Options;
using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Notifications;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Core.Sync;
namespace Umbraco.Cms.Core.Webhooks.Events;
[WebhookEvent("Content Deleted", Constants.WebhookEvents.Types.Content)]
public class ContentDeletedWebhookEvent : WebhookEventContentBase<ContentDeletedNotification, IContent>
{
public ContentDeletedWebhookEvent(
IWebhookFiringService webhookFiringService,
IWebhookService webhookService,
IOptionsMonitor<WebhookSettings> webhookSettings,
IServerRoleAccessor serverRoleAccessor)
: base(
webhookFiringService,
webhookService,
webhookSettings,
serverRoleAccessor)
{
}
public override string Alias => Constants.WebhookEvents.Aliases.ContentDelete;
protected override IEnumerable<IContent> GetEntitiesFromNotification(ContentDeletedNotification notification) =>
notification.DeletedEntities;
protected override object ConvertEntityToRequestPayload(IContent entity)
=> new DefaultPayloadModel { Id = entity.Key };
}