コード例 #1
0
        public IActionResult Register(WebhookRegistrationViewModel registration)
        {
            if (registration == null)
            {
                return(BadRequest("webhook data must be provided"));
            }

            if (string.IsNullOrWhiteSpace(registration.EndpointUrl))
            {
                return(BadRequest("endpoint url must be provided"));
            }

            if (!AvailableEvents.GetAll.Contains(registration.Event))
            {
                return(BadRequest($"{registration.Event} is not a supported webhook event"));
            }

            _webhookService.AddWebhook(registration);

            return(NoContent());
        }