Class WebhookEventContentBase<TNotification, TEntity>
Abstract base class for webhook events that handle content-based notifications, providing filtering by content type and per-entity webhook firing.
Namespace: Umbraco.Cms.Core.Webhooks
Assembly: Umbraco.Core.dll
Syntax
public abstract class WebhookEventContentBase<TNotification, TEntity> : WebhookEventBase<TNotification>, IWebhookEvent, INotificationAsyncHandler<TNotification>, INotificationHandler where TNotification : INotification where TEntity : IContentBase
Type Parameters
| Name | Description |
|---|---|
| TNotification | The type of notification this webhook event handles. |
| TEntity | The type of content entity associated with the notification. |
Constructors
View SourceWebhookEventContentBase(IWebhookFiringService, IWebhookService, IOptionsMonitor<WebhookSettings>, IServerRoleAccessor)
Initializes a new instance of the WebhookEventContentBase<TNotification, TEntity> class.
Declaration
protected WebhookEventContentBase(IWebhookFiringService webhookFiringService, IWebhookService webhookService, IOptionsMonitor<WebhookSettings> webhookSettings, IServerRoleAccessor serverRoleAccessor)
Parameters
| Type | Name | Description |
|---|---|---|
| IWebhookFiringService | webhookFiringService | The service responsible for firing webhooks. |
| IWebhookService | webhookService | The service for managing webhook configurations. |
| IOptionsMonitor<WebhookSettings> | webhookSettings | The webhook settings configuration. |
| IServerRoleAccessor | serverRoleAccessor | The server role accessor to determine the current server role. |
Methods
View SourceConvertEntityToRequestPayload(TEntity)
Converts a content entity to the webhook request payload.
Declaration
protected abstract object? ConvertEntityToRequestPayload(TEntity entity)
Parameters
| Type | Name | Description |
|---|---|---|
| TEntity | entity | The content entity to convert. |
Returns
| Type | Description |
|---|---|
| object | The payload object to be sent in the webhook request. |
GetEntitiesFromNotification(TNotification)
Extracts the content entities from the notification.
Declaration
protected abstract IEnumerable<TEntity> GetEntitiesFromNotification(TNotification notification)
Parameters
| Type | Name | Description |
|---|---|---|
| TNotification | notification | The notification containing the entities. |
Returns
| Type | Description |
|---|---|
| IEnumerable<TEntity> | An enumerable of content entities from the notification. |
ProcessWebhooks(TNotification, IEnumerable<IWebhook>, CancellationToken)
Process the webhooks for the given notification.
Declaration
public override Task ProcessWebhooks(TNotification notification, IEnumerable<IWebhook> webhooks, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| TNotification | notification | |
| IEnumerable<IWebhook> | webhooks | |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |