Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use fluent API for adding webhook events and add document type events #15345

Merged
merged 15 commits into from
Dec 4, 2023

Conversation

ronaldbarendse
Copy link
Contributor

Prerequisites

  • I have added steps to test this contribution in the description below

Description

Extending on PR #15344, this makes adding webhook events use a (nested) fluent API, so adding only content events can be done the following way:

using Umbraco.Cms.Core.Composing;

public class WebhookComposer : IComposer
{
    public void Compose(IUmbracoBuilder builder)
        => builder.WebhookEvents()
            .Clear()
            .AddCms(cmsBuilder => cmsBuilder.AddContent());
}

Similarly, adding all events can be done using builder.WebhookEvents().AddCms() or just user login events using AddCms(cmsBuilder => cmsBuilder.AddUser(userBuilder => userBuilder.AddLogin())).

Other products and packages could use a similar structure, e.g. AddForms(), AddDeploy() and AddCommerce()... And if we add more events of a specific type, a nested fluent API can be easily created by adding a new overload that accepts the Action<FluentBuidlerTypeName>.

@ronaldbarendse ronaldbarendse changed the title Use fluent API for adding webhook events Use fluent API for adding webhook events and add document type events Dec 4, 2023
@ronaldbarendse ronaldbarendse changed the base branch from v13/feature/webhook-extensions to v13/dev December 4, 2023 09:18
Copy link
Member

@Zeegaan Zeegaan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love this approach, just needs proper documenting 🙈
I have a task this sprint for documenting, so noting this down 👍

@nul800sebastiaan
Copy link
Member

@Zeegaan @ronaldbarendse Ping me when this is merged and then I can fix up #15337 and merge it as well 👍

@Zeegaan Zeegaan merged commit c20d96c into v13/dev Dec 4, 2023
15 checks passed
@Zeegaan Zeegaan deleted the v13/feature/webhook-extensions-fluent branch December 4, 2023 12:25
@ronaldbarendse ronaldbarendse mentioned this pull request Dec 4, 2023
74 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants