@@ -9,6 +9,15 @@ namespace Umbraco.Cms.Core.DependencyInjection;
99/// </summary>
1010public static class WebhookEventCollectionBuilderCmsExtensions
1111{
12+ private static readonly Type [ ] _defaultTypes =
13+ [
14+ typeof ( ContentDeletedWebhookEvent ) ,
15+ typeof ( ContentPublishedWebhookEvent ) ,
16+ typeof ( ContentUnpublishedWebhookEvent ) ,
17+ typeof ( MediaDeletedWebhookEvent ) ,
18+ typeof ( MediaSavedWebhookEvent ) ,
19+ ] ;
20+
1221 /// <summary>
1322 /// Adds the default webhook events.
1423 /// </summary>
@@ -21,12 +30,24 @@ public static class WebhookEventCollectionBuilderCmsExtensions
2130 /// </remarks>
2231 public static WebhookEventCollectionBuilderCms AddDefault ( this WebhookEventCollectionBuilderCms builder )
2332 {
24- builder . Builder
25- . Add < ContentDeletedWebhookEvent > ( )
26- . Add < ContentPublishedWebhookEvent > ( )
27- . Add < ContentUnpublishedWebhookEvent > ( )
28- . Add < MediaDeletedWebhookEvent > ( )
29- . Add < MediaSavedWebhookEvent > ( ) ;
33+ builder . Builder . Add ( _defaultTypes ) ;
34+
35+ return builder ;
36+ }
37+
38+ /// <summary>
39+ /// Removes the default webhook events.
40+ /// </summary>
41+ /// <param name="builder">The builder.</param>
42+ /// <returns>
43+ /// The builder.
44+ /// </returns>
45+ public static WebhookEventCollectionBuilderCms RemoveDefault ( this WebhookEventCollectionBuilderCms builder )
46+ {
47+ foreach ( Type type in _defaultTypes )
48+ {
49+ builder . Builder . Remove ( type ) ;
50+ }
3051
3152 return builder ;
3253 }
0 commit comments