Move helper methods for adding webhooks to extension methods#15344
Merged
Move helper methods for adding webhooks to extension methods#15344
Conversation
ronaldbarendse
commented
Dec 3, 2023
1 task
Contributor
|
I agree |
Contributor
Author
|
I've implemented the document type webhook events and the applied the comments about grouping in PR #15345, which adds a way nicer fluent API 😄 Lets continue the discussion on that PR instead! |
Member
|
LGTM 🚀 |
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prerequisites
Description
This moves the helper methods for adding webhooks that were introduced in PR #15161 to extension methods, so the
WebhookEventCollectionBuilderclass only contains the required logic for configuring the collection. I've also cleaned up this class, specifically by usingTryAddEnumerable()to add the webhook event/notification type to the service collection and only callingTryGetGenericArguments()once (IsOfGenericType()is doing the same, but without returning the generic types).I've also renamed
AddAllAvailableWebhooks()toAddCmsWebhooks(), because 'all available' could suggest it does a type scan of allIWebhookEventtypes and adds those, but instead it only adds the CMS supported ones.Another thing I noticed is the lack of
DocumentType*events: do we want to add those as well? And if PR #15337 gets merged, we should ensure theAddHealthCheckWebhooks()helper methods gets moved into an extension method too 😄Testing can be done by adding the following composer, which removes the default events and adds all content ones instead:
Or if you want all CMS supported ones added (ignoring the duplicate default ones), try:
I'd also recommend a sanity check to see whether the webhooks get fired, since this does contain a change in the registration of the notification handlers.