diff --git a/src/main/java/org/kohsuke/github/GHPullRequestReviewCommentBuilder.java b/src/main/java/org/kohsuke/github/GHPullRequestReviewCommentBuilder.java
index a3b267c9f9..98709f6e8f 100644
--- a/src/main/java/org/kohsuke/github/GHPullRequestReviewCommentBuilder.java
+++ b/src/main/java/org/kohsuke/github/GHPullRequestReviewCommentBuilder.java
@@ -110,6 +110,43 @@ public GHPullRequestReviewCommentBuilder lines(int startLine, int endLine) {
return this;
}
+ /**
+ * The side of the diff in the pull request that the comment applies to.
+ *
+ * {@link #side(GHPullRequestReviewComment.Side)} and
+ * {@link #sides(GHPullRequestReviewComment.Side, GHPullRequestReviewComment.Side)} will overwrite each other's
+ * values.
+ *
+ * @param side
+ * side of the diff to which the comment applies
+ * @return the gh pull request review comment builder
+ */
+ public GHPullRequestReviewCommentBuilder side(GHPullRequestReviewComment.Side side) {
+ builder.with("side", side);
+ builder.remove("start_side");
+ return this;
+ }
+
+ /**
+ * The sides of the diff in the pull request that the comment applies to.
+ *
+ * {@link #side(GHPullRequestReviewComment.Side)} and
+ * {@link #sides(GHPullRequestReviewComment.Side, GHPullRequestReviewComment.Side)} will overwrite each other's
+ * values.
+ *
+ * @param startSide
+ * side of the diff to which the start of the comment applies
+ * @param endSide
+ * side of the diff to which the end of the comment applies
+ * @return the gh pull request review comment builder
+ */
+ public GHPullRequestReviewCommentBuilder sides(GHPullRequestReviewComment.Side startSide,
+ GHPullRequestReviewComment.Side endSide) {
+ builder.with("start_side", startSide);
+ builder.with("side", endSide);
+ return this;
+ }
+
/**
* Create gh pull request review comment.
*
diff --git a/src/test/java/org/kohsuke/github/GHPullRequestTest.java b/src/test/java/org/kohsuke/github/GHPullRequestTest.java
index ba43195755..3beddb2769 100644
--- a/src/test/java/org/kohsuke/github/GHPullRequestTest.java
+++ b/src/test/java/org/kohsuke/github/GHPullRequestTest.java
@@ -25,6 +25,8 @@
import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue;
+import static org.kohsuke.github.GHPullRequestReviewComment.Side.LEFT;
+import static org.kohsuke.github.GHPullRequestReviewComment.Side.RIGHT;
// TODO: Auto-generated Javadoc
/**
@@ -337,12 +339,14 @@ public void pullRequestReviewComments() throws Exception {
.body("A single line review comment")
.path("README.md")
.line(2)
+ .side(RIGHT)
.create();
p.createReviewComment()
.commitId(p.getHead().getSha())
.body("A multiline review comment")
.path("README.md")
.lines(2, 3)
+ .sides(RIGHT, RIGHT)
.create();
List comments = p.listReviewComments().toList();
assertThat(comments.size(), equalTo(3));
@@ -362,7 +366,7 @@ public void pullRequestReviewComments() throws Exception {
assertThat(comment.getStartSide(), equalTo(GHPullRequestReviewComment.Side.UNKNOWN));
assertThat(comment.getLine(), equalTo(1));
assertThat(comment.getOriginalLine(), equalTo(1));
- assertThat(comment.getSide(), equalTo(GHPullRequestReviewComment.Side.LEFT));
+ assertThat(comment.getSide(), equalTo(LEFT));
assertThat(comment.getPullRequestUrl(), notNullValue());
assertThat(comment.getPullRequestUrl().toString(), containsString("hub4j-test-org/github-api/pulls/"));
assertThat(comment.getBodyHtml(), nullValue());
@@ -375,11 +379,14 @@ public void pullRequestReviewComments() throws Exception {
comment = comments.get(1);
assertThat(comment.getBody(), equalTo("A single line review comment"));
assertThat(comment.getLine(), equalTo(2));
+ assertThat(comment.getSide(), equalTo(RIGHT));
comment = comments.get(2);
assertThat(comment.getBody(), equalTo("A multiline review comment"));
assertThat(comment.getStartLine(), equalTo(2));
assertThat(comment.getLine(), equalTo(3));
+ assertThat(comment.getStartSide(), equalTo(RIGHT));
+ assertThat(comment.getSide(), equalTo(RIGHT));
comment.createReaction(ReactionContent.EYES);
GHReaction toBeRemoved = comment.createReaction(ReactionContent.CONFUSED);
diff --git a/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/pullRequestReviewComments/mappings/7-r_h_g_pulls_484_comments.json b/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/pullRequestReviewComments/mappings/7-r_h_g_pulls_484_comments.json
index c62816d287..94ea535e21 100644
--- a/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/pullRequestReviewComments/mappings/7-r_h_g_pulls_484_comments.json
+++ b/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/pullRequestReviewComments/mappings/7-r_h_g_pulls_484_comments.json
@@ -11,7 +11,7 @@
},
"bodyPatterns": [
{
- "equalToJson": "{\"path\":\"README.md\",\"line\":2,\"body\":\"A single line review comment\",\"commit_id\":\"07374fe73aff1c2024a8d4114b32406c7a8e89b7\"}",
+ "equalToJson": "{\"path\":\"README.md\",\"side\":\"right\",\"line\":2,\"body\":\"A single line review comment\",\"commit_id\":\"07374fe73aff1c2024a8d4114b32406c7a8e89b7\"}",
"ignoreArrayOrder": true,
"ignoreExtraElements": false
}
@@ -55,4 +55,4 @@
"uuid": "43f15589-cf59-4ed5-a2b8-8f6b7ebae791",
"persistent": true,
"insertionIndex": 7
-}
\ No newline at end of file
+}
diff --git a/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/pullRequestReviewComments/mappings/8-r_h_g_pulls_484_comments.json b/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/pullRequestReviewComments/mappings/8-r_h_g_pulls_484_comments.json
index 2b80fe4f36..f335232943 100644
--- a/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/pullRequestReviewComments/mappings/8-r_h_g_pulls_484_comments.json
+++ b/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/pullRequestReviewComments/mappings/8-r_h_g_pulls_484_comments.json
@@ -11,7 +11,7 @@
},
"bodyPatterns": [
{
- "equalToJson": "{\"path\":\"README.md\",\"line\":3,\"start_line\":2,\"body\":\"A multiline review comment\",\"commit_id\":\"07374fe73aff1c2024a8d4114b32406c7a8e89b7\"}",
+ "equalToJson": "{\"path\":\"README.md\",\"side\":\"right\",\"start_side\":\"right\",\"line\":3,\"start_line\":2,\"body\":\"A multiline review comment\",\"commit_id\":\"07374fe73aff1c2024a8d4114b32406c7a8e89b7\"}",
"ignoreArrayOrder": true,
"ignoreExtraElements": false
}
@@ -55,4 +55,4 @@
"uuid": "efe94b1b-7f9c-4bba-9af2-0a7a59a498ab",
"persistent": true,
"insertionIndex": 8
-}
\ No newline at end of file
+}