コード例 #1
0
        public void TransitionIssue(string issueRef, string transitionName)
        {
            if (transitionName == null)
            {
                throw new ArgumentNullException(nameof(transitionName));
            }
            var transitions = GetIssueTransitions(issueRef);
            var transition  = transitions.transitions.FirstOrDefault(t => t.name == transitionName);

            if (transition == null)
            {
                throw new ClientException($"Unable to locate transition '{transitionName}'");
            }

            var postData = new Dictionary <string, object>
            {
                { "transition", new { id = transition.id } }
            };

            restClient.Post(HttpStatusCode.NoContent, $"api/2/issue/{issueRef}/transitions", postData);
        }
コード例 #2
0
ファイル: JiraClient.cs プロジェクト: punker76/Gallifrey
        public void AddWorkLog(string issueRef, WorkLogStrategy workLogStrategy, string comment, TimeSpan timeSpent, DateTime logDate, TimeSpan?remainingTime = null)
        {
            if (logDate.Kind != DateTimeKind.Local)
            {
                logDate = DateTime.SpecifyKind(logDate, DateTimeKind.Local);
            }

            timeSpent = new TimeSpan(timeSpent.Hours, timeSpent.Minutes, 0);

            if (tempoClient != null)
            {
                if (string.IsNullOrWhiteSpace(comment))
                {
                    comment = "N/A";
                }

                var remaining = 0d;
                switch (workLogStrategy)
                {
                case WorkLogStrategy.Automatic:
                    remaining = GetIssue(issueRef).fields.timetracking.remainingEstimateSeconds - timeSpent.TotalSeconds;
                    if (remaining < 0)
                    {
                        remaining = 0;
                    }
                    break;

                case WorkLogStrategy.LeaveRemaining:
                    remaining = GetIssue(issueRef).fields.timetracking.remainingEstimateSeconds;
                    break;

                case WorkLogStrategy.SetValue:
                    remaining = remainingTime?.TotalSeconds ?? 0;
                    break;
                }

                var tempoWorkLog = new TempoWorkLogUpload {
                    issueKey = issueRef, timeSpentSeconds = timeSpent.TotalSeconds, startDate = $"{logDate:yyyy-MM-dd}", startTime = $"{logDate:hh:mm:ss}", description = comment, authorAccountId = myUser.accountId, remainingEstimateSeconds = remaining
                };
                tempoClient.Post(HttpStatusCode.OK, "worklogs", tempoWorkLog);
            }
            else
            {
                var postData = new Dictionary <string, object>
                {
                    { "started", $"{logDate:yyyy-MM-ddTHH:mm:ss.fff}{logDate.ToString("zzz").Replace(":", "")}" },