/// <summary> /// Transition an issue through a workflow action. /// </summary> /// <param name="actionName">The workflow action to transition to.</param> /// <param name="additionalUpdates">Additional updates to perform when transitioning the issue.</param> /// <param name="token">Cancellation token for this operation.</param> public async Task WorkflowTransitionAsync(string actionName, WorkflowTransitionUpdates additionalUpdates = null, CancellationToken token = default(CancellationToken)) { if (String.IsNullOrEmpty(_originalIssue.key)) { throw new InvalidOperationException("Unable to execute workflow transition, issue has not been created."); } await _jira.Issues.ExecuteWorkflowActionAsync(this, actionName, additionalUpdates, token).ConfigureAwait(false); var issue = await _jira.Issues.GetIssueAsync(_originalIssue.key, token).ConfigureAwait(false); Initialize(issue.OriginalRemoteIssue); }
/// <summary> /// Transition an issue through a workflow action. /// </summary> /// <param name="actionName">The workflow action to transition to.</param> /// <param name="additionalUpdates">Additional updates to perform when transitioning the issue.</param> /// <param name="token">Cancellation token for this operation.</param> public Task WorkflowTransitionAsync(string actionName, WorkflowTransitionUpdates additionalUpdates, CancellationToken token) { if (String.IsNullOrEmpty(_originalIssue.key)) { throw new InvalidOperationException("Unable to execute workflow transition, issue has not been created."); } return(this.GetAvailableActionsAsync(token).ContinueWith(actionsTask => { var action = actionsTask.Result.FirstOrDefault(a => a.Name.Equals(actionName, StringComparison.OrdinalIgnoreCase)); if (action == null) { throw new InvalidOperationException(String.Format("Worflow action with name '{0}' not found.", actionName)); } return this._jira.RestClient.ExecuteIssueWorkflowActionAsync(this, action.Id, additionalUpdates, token).ContinueWith(issueTask => { Initialize(issueTask.Result.OriginalRemoteIssue); }); }).Unwrap()); }