@@ -550,7 +550,7 @@ public Issue updateIssue(Object projectIdOrPath, Long issueIid, String title, St
550
550
}
551
551
552
552
/**
553
- * Updates an existing project issue. This call can also be used to mark an issue as closed .
553
+ * Updates an existing project issue to change the assignee .
554
554
*
555
555
* <pre><code>GitLab Endpoint: PUT /projects/:id/issues/:issue_iid</code></pre>
556
556
*
@@ -561,12 +561,32 @@ public Issue updateIssue(Object projectIdOrPath, Long issueIid, String title, St
561
561
* @throws GitLabApiException if any exception occurs
562
562
*/
563
563
public Issue assignIssue (Object projectIdOrPath , Long issueIid , Long assigneeId ) throws GitLabApiException {
564
+ return assignIssue (projectIdOrPath , issueIid , Collections .singletonList (assigneeId ));
565
+ }
566
+
567
+ /**
568
+ * Updates an existing project issue to change the assignees.
569
+ *
570
+ * <pre><code>GitLab Endpoint: PUT /projects/:id/issues/:issue_iid</code></pre>
571
+ *
572
+ * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required
573
+ * @param issueIid the issue IID to update, required
574
+ * @param assigneeIds the IDs of the user to assign issue to, required, use an empty list to clear the assignees
575
+ * @return an instance of the updated Issue
576
+ * @throws GitLabApiException if any exception occurs
577
+ */
578
+ public Issue assignIssue (Object projectIdOrPath , Long issueIid , List <Long > assigneeIds ) throws GitLabApiException {
564
579
565
580
if (issueIid == null ) {
566
581
throw new RuntimeException ("issue IID cannot be null" );
567
582
}
568
583
569
- GitLabApiForm formData = new GitLabApiForm ().withParam ("assignee_ids" , Collections .singletonList (assigneeId ));
584
+ // replace empty list with an invalid userId (clears the assignees in gitlab)
585
+ if (assigneeIds .isEmpty ()) {
586
+ assigneeIds = Collections .singletonList (0L );
587
+ }
588
+
589
+ GitLabApiForm formData = new GitLabApiForm ().withParam ("assignee_ids" , assigneeIds );
570
590
Response response = put (Response .Status .OK , formData .asMap (), "projects" , getProjectIdOrPath (projectIdOrPath ), "issues" , issueIid );
571
591
return (response .readEntity (Issue .class ));
572
592
}
0 commit comments