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.

1 Like

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!

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.

1 Like

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.

@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.