@@ -43,7 +43,9 @@ public class IssueClient {
43
43
static final String COMMENTS_URI_TEMPLATE = "/repos/%s/%s/issues/comments" ;
44
44
static final String COMMENTS_URI_ID_TEMPLATE = "/repos/%s/%s/issues/comments/%s" ;
45
45
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" ;
47
49
static final String ISSUES_URI_ID_TEMPLATE = "/repos/%s/%s/issues/%s" ;
48
50
private static final Logger log = LoggerFactory .getLogger (MethodHandles .lookup ().lookupClass ());
49
51
@@ -53,7 +55,6 @@ public class IssueClient {
53
55
54
56
/**
55
57
* Constructs an IssueClient.
56
- *
57
58
* @param github the GitHub client
58
59
* @param owner the repository owner
59
60
* @param repo the repository name
@@ -260,14 +261,14 @@ public CompletableFuture<CommentReaction> createCommentReaction(
260
261
* href="https://docs.github.com/en/rest/reactions/reactions?apiVersion=2022-11-28#delete-an-issue-comment-reaction">List
261
262
* reactions for an issue comment</a>
262
263
*
263
- * @param issueNumber the issue number
264
+ * @param commentId the comment id
264
265
* @param reactionId the reaction id
265
266
* @return a CompletableFuture containing the HTTP response
266
267
*/
267
268
public CompletableFuture <HttpResponse > deleteCommentReaction (
268
- final long issueNumber , final long reactionId ) {
269
+ final long commentId , final long reactionId ) {
269
270
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 );
271
272
return github .delete (path );
272
273
}
273
274
@@ -284,4 +285,35 @@ public GithubPageIterator<CommentReaction> listCommentReaction(final long commen
284
285
return new GithubPageIterator <>(
285
286
new GithubPage <>(github , path , LIST_COMMENT_REACTION_TYPE_REFERENCE ));
286
287
}
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
+ }
287
319
}
0 commit comments