@@ -551,7 +551,7 @@ public Issue updateIssue(Object projectIdOrPath, Long issueIid, String title, St
551551 }
552552
553553 /**
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 .
555555 *
556556 * <pre><code>GitLab Endpoint: PUT /projects/:id/issues/:issue_iid</code></pre>
557557 *
@@ -562,12 +562,32 @@ public Issue updateIssue(Object projectIdOrPath, Long issueIid, String title, St
562562 * @throws GitLabApiException if any exception occurs
563563 */
564564 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 {
565580
566581 if (issueIid == null ) {
567582 throw new RuntimeException ("issue IID cannot be null" );
568583 }
569584
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 );
571591 Response response = put (Response .Status .OK , formData .asMap (), "projects" , getProjectIdOrPath (projectIdOrPath ), "issues" , issueIid );
572592 return (response .readEntity (Issue .class ));
573593 }
0 commit comments