Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions src/main/java/org/gitlab4j/api/GroupApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,19 @@ public Group addGroup(String name, String path) throws GitLabApiException {
return (response.readEntity(Group.class));
}

public Group addGroup(Group group) throws GitLabApiException {
Form formData = new GitLabApiForm()
.withParam("name", group.getName())
.withParam("path", group.getPath())
.withParam("description", group.getDescription())
.withParam("visibility", group.getDescription())
.withParam("lfs_enabled", group.getLfsEnabled())
.withParam("request_access_enabled", group.getRequestAccessEnabled())
.withParam("parent_id", isApiVersion(ApiVersion.V3) ? null : group.getParentId());
Response response = post(Response.Status.CREATED, formData, "groups");
return (response.readEntity(Group.class));
}

/**
* Creates a new project group. Available only for users who can create groups.
*
Expand Down Expand Up @@ -372,6 +385,28 @@ public Group addGroup(String name, String path, String description, Visibility v
return (response.readEntity(Group.class));
}

/**
* Updates a project group. Available only for users who can create groups.
*
* PUT /groups
*
* @param group to update
* @return updated group instance
* @throws GitLabApiException at any exception
*/
public Group updateGroup(Group group) throws GitLabApiException {
Form formData = new GitLabApiForm()
.withParam("name", group.getName())
.withParam("path", group.getPath())
.withParam("description", group.getDescription())
.withParam("visibility", group.getVisibility())
.withParam("lfs_enabled", group.getLfsEnabled())
.withParam("request_access_enabled", group.getRequestAccessEnabled())
.withParam("parent_id", isApiVersion(ApiVersion.V3) ? null : group.getParentId());
Response response = put(Response.Status.OK, formData.asMap(), "groups", group.getId());
return (response.readEntity(Group.class));
}

/**
* Updates a project group. Available only for users who can create groups.
*
Expand Down