diff --git a/pom.xml b/pom.xml index 425d1d9a..ae66c23f 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 github-client - 0.4.5 + 0.4.6 com.spotify @@ -23,7 +23,7 @@ scm:git:https://github.com/spotify/github-java-client.git scm:git:git@github.com:spotify/github-java-client.git scm:https://github.com/spotify/github-java-client/ - v0.4.5 + v0.4.6 @@ -67,7 +67,7 @@ UTF-8 UTF-8 - 1748586975 + 1748848013 spotbugsexclude.xml error checkstyle.xml diff --git a/src/main/java/com/spotify/github/v3/prs/Comment.java b/src/main/java/com/spotify/github/v3/prs/Comment.java index 0c890408..02a2819c 100644 --- a/src/main/java/com/spotify/github/v3/prs/Comment.java +++ b/src/main/java/com/spotify/github/v3/prs/Comment.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -94,4 +94,8 @@ public interface Comment extends UpdateTracking { @Nullable @JsonProperty("_links") CommentLinks links(); + + /** Node ID */ + @Nullable + String nodeId(); } diff --git a/src/main/java/com/spotify/github/v3/prs/PullRequestItem.java b/src/main/java/com/spotify/github/v3/prs/PullRequestItem.java index 469b8c87..f334919f 100644 --- a/src/main/java/com/spotify/github/v3/prs/PullRequestItem.java +++ b/src/main/java/com/spotify/github/v3/prs/PullRequestItem.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -122,6 +122,12 @@ public interface PullRequestItem extends PartialPullRequestItem { @JsonProperty("requested_teams") List requestedTeams(); - /** @Deprecated the merge commit sha. */ + /** + * @Deprecated the merge commit sha. + */ Optional mergeCommitSha(); + + /** Node ID. */ + @Nullable + String nodeId(); } diff --git a/src/test/java/com/spotify/github/v3/activity/events/PullRequestReviewCommentEventTest.java b/src/test/java/com/spotify/github/v3/activity/events/PullRequestReviewCommentEventTest.java new file mode 100644 index 00000000..79d8feb5 --- /dev/null +++ b/src/test/java/com/spotify/github/v3/activity/events/PullRequestReviewCommentEventTest.java @@ -0,0 +1,49 @@ +/*- + * -\-\- + * github-client + * -- + * Copyright (C) 2016 - 2020 Spotify AB + * -- + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * -/-/- + */ + +package com.spotify.github.v3.activity.events; + +import java.io.IOException; +import static java.nio.charset.Charset.defaultCharset; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.core.Is.is; +import org.junit.jupiter.api.Test; + +import com.google.common.io.Resources; +import static com.google.common.io.Resources.getResource; +import com.spotify.github.jackson.Json; + +public class PullRequestReviewCommentEventTest { + @Test + public void testDeserialization() throws IOException { + String fixture = + Resources.toString( + getResource(this.getClass(), "fixtures/pull_request_review_comment_event.json"), + defaultCharset()); + final PullRequestReviewCommentEvent event = + Json.create().fromJson(fixture, PullRequestReviewCommentEvent.class); + assertThat(event.action(), is("created")); + assertThat(event.comment().id(), is(29724692L)); + assertThat(event.comment().nodeId(), is("abc234")); + assertThat(event.pullRequest().nodeId(), is("abc123")); + assertThat(event.comment().body(), is("Maybe you should use more emojji on this line.")); + } +} diff --git a/src/test/resources/com/spotify/github/v3/activity/events/fixtures/pull_request_review_comment_event.json b/src/test/resources/com/spotify/github/v3/activity/events/fixtures/pull_request_review_comment_event.json index a89b6b54..631e771d 100644 --- a/src/test/resources/com/spotify/github/v3/activity/events/fixtures/pull_request_review_comment_event.json +++ b/src/test/resources/com/spotify/github/v3/activity/events/fixtures/pull_request_review_comment_event.json @@ -3,6 +3,7 @@ "comment": { "url": "https://api.github.com/repos/baxterthehacker/public-repo/pulls/comments/29724692", "id": 29724692, + "node_id": "abc234", "diff_hunk": "@@ -1 +1 @@\n-# public-repo", "path": "README.md", "position": 1, @@ -48,6 +49,7 @@ "pull_request": { "url": "https://api.github.com/repos/baxterthehacker/public-repo/pulls/1", "id": 34778301, + "node_id": "abc123", "html_url": "https://github.com/baxterthehacker/public-repo/pull/1", "diff_url": "https://github.com/baxterthehacker/public-repo/pull/1.diff", "patch_url": "https://github.com/baxterthehacker/public-repo/pull/1.patch",