Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Copilot Lvl 2
Message 1 of 5

Fetching comments in GraphQL (v4)

In the v3 API, GET /repos/:owner/:repo/issues/comments allows fetching comments across all issues in a repository, as well as the ability to provide a since parameter for delta updates.

 

Is there any support for doing similar in the GraphQL API? The comments edge on the Issue node doesn't provide for a since parameter, and also requires fetching all the issues.

4 Replies
Highlighted
Pilot Lvl 2
Message 2 of 5

Re: Fetching comments in GraphQL (v4)

For the IssueConnection! object in the GraphQL API v4, it is possible to use an IssueFilters parameter to get issues that have been updated at or after the given date (if that's what you're looking for). After that, you should be able to also retrieve comments from those issues after they've been filtered. All IssueFilters are visible on this documentation page.

 

Hope this helps you out! If you have more questions or need more information on this issue, just reply back and I'll try to find another solution!

 

Gavin R. Isgar - Freelance Software Developer
Copilot Lvl 2
Message 3 of 5

Re: Fetching comments in GraphQL (v4)

Thanks for the suggestion @Gisgar3. Unfortunately, that doesn't solve my problem.

 

IssueFilters gets the newest issues, but not the newest comments. The since filter here applies against the updated time of the issue, which isn't affected by new comments.

 

Essentially, what I'd need is a CommentConnection from the Repository, rather than from the Issue directly.

Pilot Lvl 2
Message 4 of 5

Re: Fetching comments in GraphQL (v4)

Ahhh, I see. But, couldn't you use the last or first parameters of the IssueCommentConnection! of the issues object to get the most-recent comment on an issue? I assume that last would work because it would look for the last object in a list, which would be the equivalent of the most-recent comment added. Just a suggestion.

Gavin R. Isgar - Freelance Software Developer
Pilot Lvl 2
Message 5 of 5

Re: Fetching comments in GraphQL (v4)


@Gisgar3 wrote:

Ahhh, I see. But, couldn't you use the last or first parameters of the IssueCommentConnection! of the issues object to get the most-recent comment on an issue? I assume that last would work because it would look for the last object in a list, which would be the equivalent of the most-recent comment added. Just a suggestion.


^ Granted, this solution would not allow for a since parameter, but you could go into each comment's nodes and find the createdAt date.

Gavin R. Isgar - Freelance Software Developer