@@ -342,6 +342,19 @@ public Group addGroup(String name, String path) throws GitLabApiException {
342
342
return (response .readEntity (Group .class ));
343
343
}
344
344
345
+ public Group addGroup (Group group ) throws GitLabApiException {
346
+ Form formData = new GitLabApiForm ()
347
+ .withParam ("name" , group .getName ())
348
+ .withParam ("path" , group .getPath ())
349
+ .withParam ("description" , group .getDescription ())
350
+ .withParam ("visibility" , group .getDescription ())
351
+ .withParam ("lfs_enabled" , group .getLfsEnabled ())
352
+ .withParam ("request_access_enabled" , group .getRequestAccessEnabled ())
353
+ .withParam ("parent_id" , isApiVersion (ApiVersion .V3 ) ? null : group .getParentId ());
354
+ Response response = post (Response .Status .CREATED , formData , "groups" );
355
+ return (response .readEntity (Group .class ));
356
+ }
357
+
345
358
/**
346
359
* Creates a new project group. Available only for users who can create groups.
347
360
*
@@ -372,6 +385,28 @@ public Group addGroup(String name, String path, String description, Visibility v
372
385
return (response .readEntity (Group .class ));
373
386
}
374
387
388
+ /**
389
+ * Updates a project group. Available only for users who can create groups.
390
+ *
391
+ * PUT /groups
392
+ *
393
+ * @param group to update
394
+ * @return updated group instance
395
+ * @throws GitLabApiException at any exception
396
+ */
397
+ public Group updateGroup (Group group ) throws GitLabApiException {
398
+ Form formData = new GitLabApiForm ()
399
+ .withParam ("name" , group .getName ())
400
+ .withParam ("path" , group .getPath ())
401
+ .withParam ("description" , group .getDescription ())
402
+ .withParam ("visibility" , group .getVisibility ())
403
+ .withParam ("lfs_enabled" , group .getLfsEnabled ())
404
+ .withParam ("request_access_enabled" , group .getRequestAccessEnabled ())
405
+ .withParam ("parent_id" , isApiVersion (ApiVersion .V3 ) ? null : group .getParentId ());
406
+ Response response = put (Response .Status .OK , formData .asMap (), "groups" , group .getId ());
407
+ return (response .readEntity (Group .class ));
408
+ }
409
+
375
410
/**
376
411
* Updates a project group. Available only for users who can create groups.
377
412
*
0 commit comments