GetEpicClient(issue).AddIssuesAsync(issuesToAdd) NullException
jdonohoo opened this issue · 3 comments
jdonohoo commented
This has been the first actual issue I've ran into with Zenhub.Net
.GetDetailsAsync() and .ConvertToIssueAsync() appear to be the only methods off the EpicClient that works
var issuesToAdd = new List<Issue>();
var client = new ZenHubClient(AppConfig.ZenHub.AccessToken);
client.GetEpicClient(epics.Id,epic.Number).AddIssuesAsync(issuesToAdd).Result.Dump();
jdonohoo commented
What is strange is if you pass in an empty List<Octokit.Issue>
it returns a 200 Okay, but ass soon as you add an OctoKit.Issue to the list you get the null exception
jdonohoo commented
Further review the octokit api might be the issue:
var issue = github.Issue.Get(repoId, issueId).Result;
Repository object is coming back as null, so it explodes when the tuple select is taking place in AddIssuesAsync();
jdonohoo commented
I'm leaving this here in case some one else runs into this issue.
The IEnumerable<Issue>
will always fail as Octokit doesn't set Repository on Issue.Get()
However, I was able to get this to work:
public void AttachIssuesToEpic(string epicRepo, int epicNumber, string issueRepo, int[] issueNumbers)
{
var epics = GetGitHubRepoByName(epicRepo);
var issues = GetGitHubRepoByName(issueRepo);
var issuesToAdd = new List<Tuple<long, int>>();
foreach(var i in issueNumbers)
{
issuesToAdd.Add(new Tuple<long, int>(issues.Id, i));
}
var epic = GetGitHubIssue(epics.Id,epicNumber);
var client = new ZenHubClient(AppConfig.ZenHub.AccessToken);
var result = client.GetEpicClient(epics.Id, epic.Number).AddIssuesAsync(issuesToAdd.Select(x => (x.Item1,x.Item2))).Result;
result.Dump();
}