/// <summary>
        /// Gets the check log.
        /// </summary>
        /// <param name="issuesId">The issues identifier.</param>
        /// <returns></returns>
        private async Task <Changelog> GetCheckLog(int issuesId)
        {
            using (var client = new JiraClient.JiraClient(new Uri(_jiraUri)))
            {
                client.SetBasicAuthentication(_nickName, _password);

                var checkLogSearchResult = await client.Agile.GetChangelogAsync(issuesId);

                return(checkLogSearchResult.Changelog);
            }
        }
示例#2
0
        /// <summary>
        /// Gets all team issues in current sprint.
        /// </summary>
        /// <param name="teamMembersNames">The team members names.</param>
        /// <param name="projectName">Name of the project.</param>
        /// <param name="projectAgileBoardName">Name of the project agile board.</param>
        /// <returns></returns>
        private async Task <List <AgileIssue> > GetAllTeamIssuesInCurrentSprint(IEnumerable <string> teamMembersNames, string projectName, string projectAgileBoardName)
        {
            using (var client = new JiraClient.JiraClient(new Uri(_jiraUri)))
            {
                client.SetBasicAuthentication(_nickName, _password);

                // Getting projectId by project name
                var projects = await client.Project.GetAllAsync();

                var projectId = projects.First(p => p.Name == projectName).Key;

                // Getting project boardId by projectid
                var searchResult = await client.Agile.GetBoardsAsync(null, null, projectId);

                var boardId = searchResult.First(b => b.Name == projectAgileBoardName).Id;

                // Getting active sprint in current board
                var sprintId = client.Agile.GetSprintsAsync(boardId, "active").Result.First().Id;

                var msxResultsCount = new Page()
                {
                    StartAt = 1, MaxResults = 1000
                };
                var activeSprintIssues = new List <AgileIssue>();

                while (activeSprintIssues.Count == 0 || activeSprintIssues.Count % 1000 == 0)
                {
                    var issues = await client.Agile.GetIssuesInSprintAsync(boardId, sprintId, msxResultsCount);

                    activeSprintIssues.AddRange(issues);
                    msxResultsCount.StartAt += 1000;
                }

                // Selecting issues which was assigned on team members
                var teamActiveSprintIssues = activeSprintIssues
                                             .Where(i => i.Fields.Assignee != null && teamMembersNames.Contains(i.Fields.Assignee.DisplayName))
                                             .ToList();

                return(teamActiveSprintIssues);
            }
        }