Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get the Repo from the Issue Object? #882

Closed
naveensrinivasan opened this issue Sep 8, 2015 · 3 comments
Closed

How to get the Repo from the Issue Object? #882

naveensrinivasan opened this issue Sep 8, 2015 · 3 comments

Comments

@naveensrinivasan
Copy link

I would like to the get the Repo the issue belongs to get the comments. How do I get Repo the issue belongs to?

Here is an example of my code which gets all the Issue for the user

var result = await GitHub.Issue.GetAllForCurrent ();

For each of these issues I want the comments on them.

Thanks

@shiftkey
Copy link
Member

shiftkey commented Sep 8, 2015

How do I get Repo the issue belongs to?

Unfortunately the raw JSON doesn't contain anything related to the repository. I'd recommend parsing the HtmlUrl property on the issue (you could look at everything before /issues in the URL).

For each of these issues I want the comments on them.

There's a comments_url property on the raw JSON which we're not surfacing. We should do that.

Alternatively, you could just go and fetch it directly:

var issues = await GitHub.Issue.GetAllForCurrent();

foreach (var issue in issues)
{
    var comments = await GitHub.Issue.Comment. GetAllForIssue("owner", "repo", issue.Id);
}

@shiftkey
Copy link
Member

shiftkey commented Sep 8, 2015

Opened #883 to address the missing property

@naveensrinivasan
Copy link
Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants