@@ -351,13 +351,28 @@ public User modifyUser(User user, String password, Integer projectsLimit) throws
351
351
* @throws GitLabApiException if any exception occurs
352
352
*/
353
353
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 {
354
368
355
369
if (userId == null ) {
356
370
throw new RuntimeException ("userId cannot be null" );
357
371
}
358
372
373
+ GitLabApiForm formData = new GitLabApiForm ().withParam ("hard_delete " , hardDelete );
359
374
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 );
361
376
}
362
377
363
378
/**
@@ -369,7 +384,21 @@ public void deleteUser(Integer userId) throws GitLabApiException {
369
384
* @throws GitLabApiException if any exception occurs
370
385
*/
371
386
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 );
373
402
}
374
403
375
404
/**
0 commit comments