我正在使用SDK下面通过C#与JIRA进行交互,
https://bitbucket.org/farmas/atlassian.net-sdk/wiki/Home
故障单创建成功,响应显示在控制台中提及故障单ID,但我找不到将故障单ID加载到变量的方法。
var settings = new JiraRestClientSettings()
{
EnableRequestTrace = true
};
var jira = Jira.CreateRestClient("https://testjira.xxxxxxxx.com/",
jiraUsername, jiraPWD, settings);
var issue = jira.CreateIssue("TMS");
issue.Type = "Service Desk Incident";
issue.Summary = "Test issue created via API 3";
issue.Description = "Test issue created via API 3";
issue["Service Desk Priority"] = "Level 3";
await issue.SaveChangesAsync();
我需要做的就是在变量中捕获此ID。提前致谢 :)
查看bitbucket中的源代码,可以看出,它返回一个Issue
对象
public async Task<Issue> SaveChangesAsync(CancellationToken token = default(CancellationToken))
所以,你所需要的只是:
var jiraIssue = await issue.SaveChangesAsync();
jiraIssue.Key
是您新创建的密钥。