Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
佳 邓
Gitlab4j Api
Commits
bee8b86c
Commit
bee8b86c
authored
Aug 31, 2018
by
Ruben Vitt
Committed by
Greg Messner
Aug 31, 2018
Browse files
feat: update group with groupApi (#242)
* Update group with groupApi * Add group with groupApi
parent
190740a8
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/gitlab4j/api/GroupApi.java
View file @
bee8b86c
...
...
@@ -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.
*
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment