public static async Task <string> GetIssueDetails(WebhookRequest request) { var requestParameters = request.QueryResult.Parameters; string issueId = requestParameters.Fields["issue-id"].StringValue; return(await JiraAPIContext.getIssueDetails(issueId)); }
public static async Task <string> AddComment(WebhookRequest request) { var requestParameters = request.QueryResult.Parameters; string issueId = requestParameters.Fields["issue-id"].StringValue; string newComment = JiraHelper.ExtractCommentFromParams(requestParameters); return(await JiraAPIContext.addComment(issueId, newComment)); }
public static async Task <string> ChangeStatusOfIssue(WebhookRequest request) { var requestParameters = request.QueryResult.Parameters; string issueId = requestParameters.Fields["issue-id"].StringValue; string newStatusName = requestParameters.Fields["status"].StringValue.ToLower(); string newStatusId = JiraHelper.StatusNametoCode(newStatusName); var responseString = await JiraAPIContext.changeIssueStatus(issueId, newStatusId); return(JiraHelper.GenerateResponseForChangingStatus(responseString, issueId, newStatusName)); }
public static async System.Threading.Tasks.Task SendMorningMessagesAsync() { var issues = await JiraAPIContext.GetAssignedIssues(); foreach (IssueShortened userIssue in issues) { string smsText = "Issue id: " + userIssue.id + "\n Summary: " + userIssue.fields.summary + "\n Priority: " + userIssue.fields.priority.name + "\n Status: " + userIssue.fields.status.name; SendMessage(smsText); } }
public async Task <ContentResult> DialogActionAsync() { // Parse the body of the request using the Protobuf JSON parser, // *not* Json.NET. string textToReturn = ""; string requestJson; using (TextReader reader = new StreamReader(Request.Body)) { requestJson = await reader.ReadToEndAsync(); } WebhookRequest request; request = jsonParser.Parse <WebhookRequest>(requestJson); // Add a comment if (request.QueryResult.Action == "addIssueComment") { textToReturn = await JiraService.AddComment(request); } // Change issue status else if (request.QueryResult.Action == "changeIssueStatus") { textToReturn = await JiraService.ChangeStatusOfIssue(request); } // Get issue details else if (request.QueryResult.Action == "getIssueDetails") { textToReturn = await JiraService.GetIssueDetails(request); } // Get all the issues asssigned to the user else if (request.QueryResult.Action == "getAllAssignedIssues") { textToReturn = JiraHelper.CreateAssignedIssueTable(await JiraAPIContext.GetAssignedIssues()); } else { textToReturn = "Your action could not be resolved!"; } string responseJson = DialogService.populateResponse(textToReturn); var content = Content(responseJson, "application/json"); return(content); }