@@ -43,7 +43,9 @@ public class IssueClient {
4343 static final String COMMENTS_URI_TEMPLATE = "/repos/%s/%s/issues/comments" ;
4444 static final String COMMENTS_URI_ID_TEMPLATE = "/repos/%s/%s/issues/comments/%s" ;
4545 static final String COMMENTS_REACTION_TEMPLATE = "/repos/%s/%s/issues/comments/%s/reactions" ;
46- static final String COMMENTS_REACTION_ID_TEMPLATE = "/repos/%s/%s/issues/%s/reactions/%s" ;
46+ static final String COMMENTS_REACTION_ID_TEMPLATE = "/repos/%s/%s/issues/comments/%s/reactions/%s" ;
47+ static final String ISSUES_REACTION_TEMPLATE = "/repos/%s/%s/issues/%s/reactions" ;
48+ static final String ISSUES_REACTION_ID_TEMPLATE = "/repos/%s/%s/issues/%s/reactions/%s" ;
4749 static final String ISSUES_URI_ID_TEMPLATE = "/repos/%s/%s/issues/%s" ;
4850 private static final Logger log = LoggerFactory .getLogger (MethodHandles .lookup ().lookupClass ());
4951
@@ -53,7 +55,6 @@ public class IssueClient {
5355
5456 /**
5557 * Constructs an IssueClient.
56- *
5758 * @param github the GitHub client
5859 * @param owner the repository owner
5960 * @param repo the repository name
@@ -260,14 +261,14 @@ public CompletableFuture<CommentReaction> createCommentReaction(
260261 * href="https://docs.github.com/en/rest/reactions/reactions?apiVersion=2022-11-28#delete-an-issue-comment-reaction">List
261262 * reactions for an issue comment</a>
262263 *
263- * @param issueNumber the issue number
264+ * @param commentId the comment id
264265 * @param reactionId the reaction id
265266 * @return a CompletableFuture containing the HTTP response
266267 */
267268 public CompletableFuture <HttpResponse > deleteCommentReaction (
268- final long issueNumber , final long reactionId ) {
269+ final long commentId , final long reactionId ) {
269270 final String path =
270- String .format (COMMENTS_REACTION_ID_TEMPLATE , owner , repo , issueNumber , reactionId );
271+ String .format (COMMENTS_REACTION_ID_TEMPLATE , owner , repo , commentId , reactionId );
271272 return github .delete (path );
272273 }
273274
@@ -284,4 +285,35 @@ public GithubPageIterator<CommentReaction> listCommentReaction(final long commen
284285 return new GithubPageIterator <>(
285286 new GithubPage <>(github , path , LIST_COMMENT_REACTION_TYPE_REFERENCE ));
286287 }
288+
289+ /**
290+ * Creates a reaction on an issue.
291+ *
292+ * @param issueNumber the issue number
293+ * @param reaction the reaction content
294+ * @return a CompletableFuture containing the created reaction
295+ */
296+ public CompletableFuture <CommentReaction > createIssueReaction (
297+ final long issueNumber , final CommentReactionContent reaction ) {
298+ final String path = String .format (ISSUES_REACTION_TEMPLATE , owner , repo , issueNumber );
299+ final String requestBody =
300+ github .json ().toJsonUnchecked (ImmutableMap .of ("content" , reaction .toString ()));
301+ return github .post (path , requestBody , CommentReaction .class );
302+ }
303+
304+ /**
305+ * Deletes a reaction on an issue. See <a
306+ * href="https://docs.github.com/en/rest/reactions/reactions?apiVersion=2022-11-28#delete-an-issue-reaction">Delete
307+ * an issue reaction</a>
308+ *
309+ * @param issueNumber the issue number
310+ * @param reactionId the reaction id
311+ * @return a CompletableFuture containing the HTTP response
312+ */
313+ public CompletableFuture <HttpResponse > deleteIssueReaction (
314+ final long issueNumber , final long reactionId ) {
315+ final String path =
316+ String .format (ISSUES_REACTION_ID_TEMPLATE , owner , repo , issueNumber , reactionId );
317+ return github .delete (path );
318+ }
287319}
0 commit comments