Commit bee8b86c authored by Ruben Vitt's avatar Ruben Vitt Committed by Greg Messner
Browse files

feat: update group with groupApi (#242)

* Update group with groupApi
* Add group with groupApi
parent 190740a8
......@@ -342,6 +342,19 @@ public class GroupApi extends AbstractApi {
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.
*
......@@ -372,6 +385,28 @@ public class GroupApi extends AbstractApi {
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.
*
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment