예제 #1
0
 public Issue CreateIssue(String projectKey, String issueType, IssueFields issueFields)
 {
     return(Issue.From(client.CreateIssue(projectKey, issueType, issueFields)));
 }
예제 #2
0
        //ToDo: Implement strategy pattern for various models to be built based off of a differing issueType
        //For example: issueType of Story requires more than what issueType Task requires
        public Issue CreateNewJiraTicket(string baseUrl, string username, string password, string projectKey, string issueType, IssueFields issueFields)
        {
            issueFields.timetracking = null;//necessary for API rest call
            var response = new Issue();
            var client   = new JiraClient(baseUrl, username, password);

            if (issueFields != null)
            {
                response = client.CreateIssue(projectKey, issueType, issueFields);

                if (issueFields.assignee != null)
                {
                    var issue = new Issue();
                    var user  = new JiraUser();
                    user.name             = issueFields.assignee.name;
                    issue.fields          = new IssueFields();
                    issue.self            = response.self;
                    issue.key             = response.key;
                    issue.id              = response.id;
                    issue.expand          = response.expand;
                    issue.fields.assignee = user;
                    client.UpdateIssue(issue);
                }
                if (response == null)
                {
                    return(new Issue());
                }
            }

            return(response);
        }