From e59b4385adfcb342fb77d03661c559129ff56a68 Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Wed, 1 Dec 2021 11:36:35 +0100 Subject: [PATCH] Add the node_id to the Discussion Category payload I reported the fact that the field was missing to the GitHub team and they were kind enough to add it so we can now take it into account. --- src/main/java/org/kohsuke/github/GHRepositoryDiscussion.java | 5 +++++ src/test/java/org/kohsuke/github/GHEventPayloadTest.java | 3 +++ .../github/GHEventPayloadTest/discussion_answered.json | 1 + .../github/GHEventPayloadTest/discussion_created.json | 1 + .../github/GHEventPayloadTest/discussion_labeled.json | 1 + 5 files changed, 11 insertions(+) diff --git a/src/main/java/org/kohsuke/github/GHRepositoryDiscussion.java b/src/main/java/org/kohsuke/github/GHRepositoryDiscussion.java index 48abbd8e9e..7b84c6e023 100644 --- a/src/main/java/org/kohsuke/github/GHRepositoryDiscussion.java +++ b/src/main/java/org/kohsuke/github/GHRepositoryDiscussion.java @@ -113,6 +113,7 @@ public String getTimelineUrl() { public static class Category { private long id; + private String nodeId; private long repositoryId; private String emoji; private String name; @@ -126,6 +127,10 @@ public long getId() { return id; } + public String getNodeId() { + return nodeId; + } + public long getRepositoryId() { return repositoryId; } diff --git a/src/test/java/org/kohsuke/github/GHEventPayloadTest.java b/src/test/java/org/kohsuke/github/GHEventPayloadTest.java index b9d0b7c436..f245250a96 100644 --- a/src/test/java/org/kohsuke/github/GHEventPayloadTest.java +++ b/src/test/java/org/kohsuke/github/GHEventPayloadTest.java @@ -953,6 +953,7 @@ public void discussion_created() throws Exception { GHRepositoryDiscussion.Category category = discussion.getCategory(); assertThat(category.getId(), is(33522033L)); + assertThat(category.getNodeId(), is("DIC_kwDOEq3cwc4B_4Fx")); assertThat(category.getEmoji(), is(":pray:")); assertThat(category.getName(), is("Q&A")); assertThat(category.getDescription(), is("Ask the community for help")); @@ -1000,6 +1001,7 @@ public void discussion_answered() throws Exception { GHRepositoryDiscussion.Category category = discussion.getCategory(); assertThat(category.getId(), is(33522033L)); + assertThat(category.getNodeId(), is("DIC_kwDOEq3cwc4B_4Fx")); assertThat(category.getEmoji(), is(":pray:")); assertThat(category.getName(), is("Q&A")); assertThat(category.getDescription(), is("Ask the community for help")); @@ -1048,6 +1050,7 @@ public void discussion_labeled() throws Exception { GHRepositoryDiscussion.Category category = discussion.getCategory(); assertThat(category.getId(), is(33522033L)); + assertThat(category.getNodeId(), is("DIC_kwDOEq3cwc4B_4Fx")); assertThat(category.getEmoji(), is(":pray:")); assertThat(category.getName(), is("Q&A")); assertThat(category.getDescription(), is("Ask the community for help")); diff --git a/src/test/resources/org/kohsuke/github/GHEventPayloadTest/discussion_answered.json b/src/test/resources/org/kohsuke/github/GHEventPayloadTest/discussion_answered.json index 84e060efbb..8ac6b52de8 100644 --- a/src/test/resources/org/kohsuke/github/GHEventPayloadTest/discussion_answered.json +++ b/src/test/resources/org/kohsuke/github/GHEventPayloadTest/discussion_answered.json @@ -4,6 +4,7 @@ "repository_url": "https://api.github.com/repos/gsmet/quarkus-bot-java-playground", "category": { "id": 33522033, + "node_id": "DIC_kwDOEq3cwc4B_4Fx", "repository_id": 313384129, "emoji": ":pray:", "name": "Q&A", diff --git a/src/test/resources/org/kohsuke/github/GHEventPayloadTest/discussion_created.json b/src/test/resources/org/kohsuke/github/GHEventPayloadTest/discussion_created.json index ec28d686c1..2444384801 100644 --- a/src/test/resources/org/kohsuke/github/GHEventPayloadTest/discussion_created.json +++ b/src/test/resources/org/kohsuke/github/GHEventPayloadTest/discussion_created.json @@ -4,6 +4,7 @@ "repository_url": "https://api.github.com/repos/gsmet/quarkus-bot-java-playground", "category": { "id": 33522033, + "node_id": "DIC_kwDOEq3cwc4B_4Fx", "repository_id": 313384129, "emoji": ":pray:", "name": "Q&A", diff --git a/src/test/resources/org/kohsuke/github/GHEventPayloadTest/discussion_labeled.json b/src/test/resources/org/kohsuke/github/GHEventPayloadTest/discussion_labeled.json index 565714409a..dc45539582 100644 --- a/src/test/resources/org/kohsuke/github/GHEventPayloadTest/discussion_labeled.json +++ b/src/test/resources/org/kohsuke/github/GHEventPayloadTest/discussion_labeled.json @@ -4,6 +4,7 @@ "repository_url": "https://api.github.com/repos/gsmet/quarkus-bot-java-playground", "category": { "id": 33522033, + "node_id": "DIC_kwDOEq3cwc4B_4Fx", "repository_id": 313384129, "emoji": ":pray:", "name": "Q&A",