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
514e9046
Commit
514e9046
authored
Mar 03, 2014
by
Greg Messner
Browse files
Added additional Group API calls.
parent
64622559
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/main/java/com/messners/gitlab/api/GroupApi.java
0 → 100644
View file @
514e9046
package
com.messners.gitlab.api
;
import
java.io.IOException
;
import
java.util.List
;
import
com.messners.gitlab.api.models.Group
;
import
com.messners.gitlab.api.models.Member
;
import
com.sun.jersey.api.client.ClientResponse
;
import
com.sun.jersey.api.client.GenericType
;
public
class
GroupApi
extends
AbstractApi
{
GroupApi
(
GitLabApi
gitLabApi
)
{
super
(
gitLabApi
);
}
/**
* GET /groups
*
* @return
* @throws IOException
*/
public
List
<
Group
>
getGroups
()
throws
IOException
{
ClientResponse
response
=
get
(
null
,
"groups"
);
return
(
response
.
getEntity
(
new
GenericType
<
List
<
Group
>>()
{}));
}
/**
* GET /groups/:id
*
* @param groupId
* @return
* @throws IOException
*/
public
Group
getGroup
(
int
groupId
)
throws
IOException
{
ClientResponse
response
=
get
(
null
,
"groups"
,
groupId
);
return
(
response
.
getEntity
(
Group
.
class
));
}
/**
* DELETE /groups/:id
*
* @param groupId
* @return
* @throws IOException
*/
public
boolean
deleteGroup
(
Integer
groupId
)
throws
IOException
{
if
(
groupId
==
null
)
{
throw
new
RuntimeException
(
"groupId cannot be null"
);
}
ClientResponse
response
=
delete
(
null
,
"groups"
,
groupId
);
return
(
response
.
getStatus
()
==
ClientResponse
.
Status
.
OK
.
getStatusCode
());
}
/**
*
* @param group
* @return
* @throws IOException
*/
public
boolean
deleteGroup
(
Group
group
)
throws
IOException
{
return
(
deleteGroup
(
group
.
getId
()));
}
/**
* GET /groups/:id/members
*
* @return
* @throws IOException
*/
public
List
<
Member
>
getMembers
(
int
groupId
)
throws
IOException
{
ClientResponse
response
=
get
(
null
,
"groups"
,
groupId
,
"members"
);
return
(
response
.
getEntity
(
new
GenericType
<
List
<
Member
>>()
{}));
}
}
src/main/java/com/messners/gitlab/api/models/Group.java
View file @
514e9046
package
com.messners.gitlab.api.models
;
package
com.messners.gitlab.api.models
;
import
java.util.List
;
import
javax.xml.bind.annotation.XmlAccessType
;
import
javax.xml.bind.annotation.XmlAccessType
;
import
javax.xml.bind.annotation.XmlAccessorType
;
import
javax.xml.bind.annotation.XmlAccessorType
;
import
javax.xml.bind.annotation.XmlRootElement
;
import
javax.xml.bind.annotation.XmlRootElement
;
...
@@ -13,6 +15,7 @@ public class Group {
...
@@ -13,6 +15,7 @@ public class Group {
private
String
name
;
private
String
name
;
private
Integer
ownerId
;
private
Integer
ownerId
;
private
String
path
;
private
String
path
;
private
List
<
Project
>
projects
;
public
Integer
getId
()
{
public
Integer
getId
()
{
return
this
.
id
;
return
this
.
id
;
...
@@ -45,4 +48,12 @@ public class Group {
...
@@ -45,4 +48,12 @@ public class Group {
public
void
setPath
(
String
path
)
{
public
void
setPath
(
String
path
)
{
this
.
path
=
path
;
this
.
path
=
path
;
}
}
public
List
<
Project
>
getProjects
()
{
return
(
projects
);
}
public
void
setProjects
(
List
<
Project
>
projects
)
{
this
.
projects
=
projects
;
}
}
}
src/main/java/com/messners/gitlab/api/models/Member.java
View file @
514e9046
...
@@ -10,6 +10,12 @@ import javax.xml.bind.annotation.XmlRootElement;
...
@@ -10,6 +10,12 @@ import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
@XmlRootElement
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
public
class
Member
{
public
class
Member
{
public
static
final
int
GUEST_LEVEL
=
10
;
public
static
final
int
REPORTER_LEVEL
=
20
;
public
static
final
int
DEVELOPER_LEVEL
=
30
;
public
static
final
int
MASTER_LEVEL
=
40
;
public
static
final
int
OWNER_LEVEL
=
50
;
private
Integer
accessLevel
;
private
Integer
accessLevel
;
private
Date
createdAt
;
private
Date
createdAt
;
...
...
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