Repository: hub4j/github-api (java)

Issue:
No way to access pull request review comment details
I'm not sure of the intended way I should access pull request review comment details.

Specifically, this API here: https://docs.github.com/en/rest/reference/pulls#get-a-review-comment-for-a-pull-request

I can get a list of comments with `GHPullRequest#listReviewComments()`, but they don't contain the commit ID, diff hunk, etc. The comments returned from that API contain a URL to retrieve more details, but after upgrading to the latest version and seeing the stdout warnings I'm not sure how/when I should use the connector (if ever?).



Pull request:
Add some of the missing fields to GHPullRequestReviewComment
Fixes #1420

I haven't added all of them as some of them are a bit obscure and I wasn't sure how to get sane values to test but this is already an improvement over what we have.

Patch:
diff --git a/src/main/java/org/kohsuke/github/GHPullRequestReviewComment.java b/src/main/java/org/kohsuke/github/GHPullRequestReviewComment.java
index fa8653061..e286682c1 100644
--- a/src/main/java/org/kohsuke/github/GHPullRequestReviewComment.java
+++ b/src/main/java/org/kohsuke/github/GHPullRequestReviewComment.java
@@ -50,6 +50,10 @@ public class GHPullRequestReviewComment extends GHObject implements Reactable {
     private int position = -1;
     private int original_position = -1;
     private long in_reply_to_id = -1L;
+    private String diff_hunk;
+    private String commit_id;
+    private String original_commit_id;
+    private GHCommentAuthorAssociation author_association;
 
     /**
      * Draft gh pull request review comment.
@@ -135,6 +139,42 @@ public class GHPullRequestReviewComment extends GHObject implements Reactable {
         return original_position;
     }
 
+    /**
+     * Gets diff hunk.
+     *
+     * @return the diff hunk
+     */
+    public String getDiffHunk() {
+        return diff_hunk;
+    }
+
+    /**
+     * Gets commit id.
+     *
+     * @return the commit id
+     */
+    public String getCommitId() {
+        return commit_id;
+    }
+
+    /**
+     * Gets commit id.
+     *
+     * @return the commit id
+     */
+    public String getOriginalCommitId() {
+        return original_commit_id;
+    }
+
+    /**
+     * Gets the author association to the project.
+     *
+     * @return the author association to the project
+     */
+    public GHCommentAuthorAssociation getAuthorAssociation() {
+        return author_association;
+    }
+
     /**
      * Gets in reply to id.
      *


Test patch:
diff --git a/src/test/java/org/kohsuke/github/GHPullRequestTest.java b/src/test/java/org/kohsuke/github/GHPullRequestTest.java
index 165e50ba0..a8bc8cb9c 100644
--- a/src/test/java/org/kohsuke/github/GHPullRequestTest.java
+++ b/src/test/java/org/kohsuke/github/GHPullRequestTest.java
@@ -131,6 +131,10 @@ public class GHPullRequestTest extends AbstractGitHubWireMockTest {
             assertThat(comment.getInReplyToId(), equalTo(-1L));
             assertThat(comment.getPath(), equalTo("README.md"));
             assertThat(comment.getPosition(), equalTo(1));
+            assertThat(comment.getDiffHunk(), equalTo("@@ -1,3 +1,4 @@\n-Java API for GitHub"));
+            assertThat(comment.getCommitId(), equalTo("1f40fdf4acf1adb246c109c21a22f617e4bd1ca8"));
+            assertThat(comment.getOriginalCommitId(), equalTo("1f40fdf4acf1adb246c109c21a22f617e4bd1ca8"));
+            assertThat(comment.getAuthorAssociation(), equalTo(GHCommentAuthorAssociation.MEMBER));
             assertThat(comment.getUser(), notNullValue());
             // Assert htmlUrl is not null
             assertThat(comment.getHtmlUrl(), notNullValue());