public async Task <IActionResult> Webhook(string token, string projectKey, string issueKey,
                                                  [FromBody] JToken jToken)
        {
            if (!await _jiraBot.IsValidEndpoint(token))
            {
                return(NotFound());
            }


            var update = jToken.ToObject <Jira.Models.Update>();

            await _jiraBot.ProcessNotification(update, token, projectKey, issueKey);

            return(Ok());
        }
예제 #2
0
        public async Task <IActionResult> Webhook(string token, string projectKey, string issueKey, [FromBody] dynamic payload)
        {
            if (token != _jiraToken)
            {
                return(NotFound());
            }
            //_logger.LogInformation("projectKey:" + projectKey + ", issueKey:" + issueKey);
            var updateStr = ((JsonElement)payload).ToString();

            //_logger.LogInformation(updateStr);
            try
            {
                var update = JsonConvert.DeserializeObject <Update>(updateStr);
                await _jiraBot.ProcessNotification(update, projectKey, issueKey);
            }
            catch (Exception ex)
            {
                _logger.LogError("projectKey:" + projectKey + ", issueKey:" + issueKey);
                _logger.LogError(updateStr);
                _logger.LogError(ex, ex.Message);
            }
            return(Ok());
        }