Skip to content

Commit c3cbaa4

Browse files
authored
Merge pull request hub4j#1425 from gsmet/GHPullRequestReviewComment-missing-fields
Add some of the missing fields to GHPullRequestReviewComment
2 parents 7215207 + 5926b50 commit c3cbaa4

2 files changed

Lines changed: 44 additions & 0 deletions

File tree

src/main/java/org/kohsuke/github/GHPullRequestReviewComment.java

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ public class GHPullRequestReviewComment extends GHObject implements Reactable {
5050
private int position = -1;
5151
private int original_position = -1;
5252
private long in_reply_to_id = -1L;
53+
private String diff_hunk;
54+
private String commit_id;
55+
private String original_commit_id;
56+
private GHCommentAuthorAssociation author_association;
5357

5458
/**
5559
* Draft gh pull request review comment.
@@ -135,6 +139,42 @@ public int getOriginalPosition() {
135139
return original_position;
136140
}
137141

142+
/**
143+
* Gets diff hunk.
144+
*
145+
* @return the diff hunk
146+
*/
147+
public String getDiffHunk() {
148+
return diff_hunk;
149+
}
150+
151+
/**
152+
* Gets commit id.
153+
*
154+
* @return the commit id
155+
*/
156+
public String getCommitId() {
157+
return commit_id;
158+
}
159+
160+
/**
161+
* Gets commit id.
162+
*
163+
* @return the commit id
164+
*/
165+
public String getOriginalCommitId() {
166+
return original_commit_id;
167+
}
168+
169+
/**
170+
* Gets the author association to the project.
171+
*
172+
* @return the author association to the project
173+
*/
174+
public GHCommentAuthorAssociation getAuthorAssociation() {
175+
return author_association;
176+
}
177+
138178
/**
139179
* Gets in reply to id.
140180
*

src/test/java/org/kohsuke/github/GHPullRequestTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,10 @@ public void pullRequestReviewComments() throws Exception {
131131
assertThat(comment.getInReplyToId(), equalTo(-1L));
132132
assertThat(comment.getPath(), equalTo("README.md"));
133133
assertThat(comment.getPosition(), equalTo(1));
134+
assertThat(comment.getDiffHunk(), equalTo("@@ -1,3 +1,4 @@\n-Java API for GitHub"));
135+
assertThat(comment.getCommitId(), equalTo("1f40fdf4acf1adb246c109c21a22f617e4bd1ca8"));
136+
assertThat(comment.getOriginalCommitId(), equalTo("1f40fdf4acf1adb246c109c21a22f617e4bd1ca8"));
137+
assertThat(comment.getAuthorAssociation(), equalTo(GHCommentAuthorAssociation.MEMBER));
134138
assertThat(comment.getUser(), notNullValue());
135139
// Assert htmlUrl is not null
136140
assertThat(comment.getHtmlUrl(), notNullValue());

0 commit comments

Comments
 (0)