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