// ========================================================================== // Squidex Headless CMS // ========================================================================== // Copyright (c) Squidex UG (haftungsbeschraenkt) // All rights reserved. Licensed under the MIT license. // ========================================================================== using System.ComponentModel.DataAnnotations; using Squidex.Domain.Apps.Core.HandleRules; using Squidex.Domain.Apps.Core.Rules; using Squidex.Infrastructure.Validation; #pragma warning disable MA0048 // File name must match type name namespace Squidex.Extensions.Actions.Webhook { [RuleAction( Title = "Webhook", IconImage = "", IconColor = "#4bb958", Display = "Send webhook", Description = "Invoke HTTP endpoints on a target system.", ReadMore = "https://en.wikipedia.org/wiki/Webhook")] public sealed record WebhookAction : RuleAction { [LocalizedRequired] [Display(Name = "Url", Description = "The url to the webhook.")] [Editor(RuleFieldEditor.Text)] [Formattable] public Uri Url { get; set; } [LocalizedRequired] [Display(Name = "Method", Description = "The type of the request.")] public WebhookMethod Method { get; set; } [Display(Name = "Payload (Optional)", Description = "Leave it empty to use the full event as body.")] [Editor(RuleFieldEditor.TextArea)] [Formattable] public string Payload { get; set; } [Display(Name = "Payload Type", Description = "The mime type of the payload.")] [Editor(RuleFieldEditor.Text)] public string PayloadType { get; set; } [Display(Name = "Headers (Optional)", Description = "The message headers in the format '[Key]=[Value]', one entry per line.")] [Editor(RuleFieldEditor.TextArea)] [Formattable] public string Headers { get; set; } [Display(Name = "Shared Secret", Description = "The shared secret that is used to calculate the payload signature.")] [Editor(RuleFieldEditor.Text)] public string SharedSecret { get; set; } } public enum WebhookMethod { POST, PUT, GET, DELETE, PATCH } }