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