@@ -351,13 +351,28 @@ public User modifyUser(User user, String password, Integer projectsLimit) throws
351351 * @throws GitLabApiException if any exception occurs
352352 */
353353 public void deleteUser (Integer userId ) throws GitLabApiException {
354+ deleteUser (userId , null );
355+ }
356+
357+ /**
358+ * Deletes a user. Available only for administrators.
359+ *
360+ * DELETE /users/:id
361+ *
362+ * @param userId the user ID to delete
363+ * @param hardDelete If true, contributions that would usually be moved to the
364+ * ghost user will be deleted instead, as well as groups owned solely by this user
365+ * @throws GitLabApiException if any exception occurs
366+ */
367+ public void deleteUser (Integer userId , Boolean hardDelete ) throws GitLabApiException {
354368
355369 if (userId == null ) {
356370 throw new RuntimeException ("userId cannot be null" );
357371 }
358372
373+ GitLabApiForm formData = new GitLabApiForm ().withParam ("hard_delete " , hardDelete );
359374 Response .Status expectedStatus = (isApiVersion (ApiVersion .V3 ) ? Response .Status .OK : Response .Status .NO_CONTENT );
360- delete (expectedStatus , null , "users" , userId );
375+ delete (expectedStatus , formData . asMap () , "users" , userId );
361376 }
362377
363378 /**
@@ -369,7 +384,21 @@ public void deleteUser(Integer userId) throws GitLabApiException {
369384 * @throws GitLabApiException if any exception occurs
370385 */
371386 public void deleteUser (User user ) throws GitLabApiException {
372- deleteUser (user .getId ());
387+ deleteUser (user .getId (), null );
388+ }
389+
390+ /**
391+ * Deletes a user. Available only for administrators.
392+ *
393+ * DELETE /users/:id
394+ *
395+ * @param user the User instance to delete
396+ * @param hardDelete If true, contributions that would usually be moved to the
397+ * ghost user will be deleted instead, as well as groups owned solely by this user
398+ * @throws GitLabApiException if any exception occurs
399+ */
400+ public void deleteUser (User user , Boolean hardDelete ) throws GitLabApiException {
401+ deleteUser (user .getId (), hardDelete );
373402 }
374403
375404 /**
0 commit comments