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
a49ba426
Commit
a49ba426
authored
Apr 06, 2019
by
Greg Messner
Browse files
Added support for Issue Boards API (#316).
parent
0af6603e
Changes
5
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
a49ba426
...
@@ -11,7 +11,7 @@ To utilize the GitLab API for Java in your project, simply add the following dep
...
@@ -11,7 +11,7 @@ To utilize the GitLab API for Java in your project, simply add the following dep
```
java
```
java
dependencies
{
dependencies
{
...
...
compile
group:
'
org
.
gitlab4j
'
,
name:
'
gitlab4j
-
api
'
,
version:
'
4.9
.
2
0
'
compile
group:
'
org
.
gitlab4j
'
,
name:
'
gitlab4j
-
api
'
,
version:
'
4.9
.
2
1
'
}
}
```
```
...
@@ -22,7 +22,7 @@ dependencies {
...
@@ -22,7 +22,7 @@ dependencies {
<dependency>
<dependency>
<groupId>
org.gitlab4j
</groupId>
<groupId>
org.gitlab4j
</groupId>
<artifactId>
gitlab4j-api
</artifactId>
<artifactId>
gitlab4j-api
</artifactId>
<version>
4.9.2
0
</version>
<version>
4.9.2
1
</version>
</dependency>
</dependency>
```
```
...
@@ -206,6 +206,7 @@ The API has been broken up into sub API classes to make it easier to learn and t
...
@@ -206,6 +206,7 @@ The API has been broken up into sub API classes to make it easier to learn and t
### Available Sub APIs
### Available Sub APIs
------------------
------------------
[
AwardEmojiApi
](
#awardemojiapi
)
<br/>
[
AwardEmojiApi
](
#awardemojiapi
)
<br/>
[
BoardsApi
](
#boardsapi
)
<br/>
[
CommitsApi
](
#commitsapi
)
<br/>
[
CommitsApi
](
#commitsapi
)
<br/>
[
DeployKeysApi
](
#deploykeysapi
)
<br/>
[
DeployKeysApi
](
#deploykeysapi
)
<br/>
[
DiscussionsApi
](
#discussionsapi
)
<br/>
[
DiscussionsApi
](
#discussionsapi
)
<br/>
...
@@ -244,6 +245,12 @@ The API has been broken up into sub API classes to make it easier to learn and t
...
@@ -244,6 +245,12 @@ The API has been broken up into sub API classes to make it easier to learn and t
List
<
AwardEmoji
>
awardEmojis
=
gitLabApi
.
getAwardEmojiApi
().
getIssuAwardEmojis
(
1
,
1
);
List
<
AwardEmoji
>
awardEmojis
=
gitLabApi
.
getAwardEmojiApi
().
getIssuAwardEmojis
(
1
,
1
);
```
```
#### BoardsApi
```
java
// Get a list of the Issue Boards belonging to the specified project
List
<
Board
>
boards
=
gitLabApi
.
getBoardsApi
().
getBoards
(
projectId
);
```
#### CommitsApi
#### CommitsApi
```
java
```
java
// Get a list of commits associated with the specified branch that fall within the specified time window
// Get a list of commits associated with the specified branch that fall within the specified time window
...
...
src/main/java/org/gitlab4j/api/GitLabApi.java
View file @
a49ba426
...
@@ -50,6 +50,7 @@ public class GitLabApi {
...
@@ -50,6 +50,7 @@ public class GitLabApi {
private
Session
session
;
private
Session
session
;
private
AwardEmojiApi
awardEmojiApi
;
private
AwardEmojiApi
awardEmojiApi
;
private
BoardsApi
boardsApi
;
private
CommitsApi
commitsApi
;
private
CommitsApi
commitsApi
;
private
DiscussionsApi
discussionsApi
;
private
DiscussionsApi
discussionsApi
;
private
DeployKeysApi
deployKeysApi
;
private
DeployKeysApi
deployKeysApi
;
...
@@ -826,6 +827,25 @@ public class GitLabApi {
...
@@ -826,6 +827,25 @@ public class GitLabApi {
return
(
awardEmojiApi
);
return
(
awardEmojiApi
);
}
}
/**
* Gets the BoardsApi instance owned by this GitLabApi instance. The BoardsApi is used
* to perform all Issue Boards related API calls.
*
* @return the BoardsApi instance owned by this GitLabApi instance
*/
public
BoardsApi
getBoardsApi
()
{
if
(
boardsApi
==
null
)
{
synchronized
(
this
)
{
if
(
boardsApi
==
null
)
{
boardsApi
=
new
BoardsApi
(
this
);
}
}
}
return
(
boardsApi
);
}
/**
/**
* Gets the CommitsApi instance owned by this GitLabApi instance. The CommitsApi is used
* Gets the CommitsApi instance owned by this GitLabApi instance. The CommitsApi is used
* to perform all commit related API calls.
* to perform all commit related API calls.
...
...
src/main/java/org/gitlab4j/api/LabelsApi.java
View file @
a49ba426
package
org.gitlab4j.api
;
package
org.gitlab4j.api
;
import
java.util.List
;
import
java.util.List
;
import
java.util.stream.Stream
;
import
javax.ws.rs.core.GenericType
;
import
javax.ws.rs.core.GenericType
;
import
javax.ws.rs.core.Response
;
import
javax.ws.rs.core.Response
;
...
@@ -52,6 +53,17 @@ public class LabelsApi extends AbstractApi {
...
@@ -52,6 +53,17 @@ public class LabelsApi extends AbstractApi {
"projects"
,
getProjectIdOrPath
(
projectIdOrPath
),
"labels"
));
"projects"
,
getProjectIdOrPath
(
projectIdOrPath
),
"labels"
));
}
}
/**
* Get a Stream of all labels of the specified project.
*
* @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @return a Stream of project's labels
* @throws GitLabApiException if any exception occurs
*/
public
Stream
<
Label
>
getLabelsStream
(
Object
projectIdOrPath
)
throws
GitLabApiException
{
return
(
getLabels
(
projectIdOrPath
,
getDefaultPerPage
()).
stream
());
}
/**
/**
* Create a label
* Create a label
*
*
...
...
src/main/java/org/gitlab4j/api/models/Label.java
View file @
a49ba426
...
@@ -17,7 +17,7 @@ public class Label {
...
@@ -17,7 +17,7 @@ public class Label {
private
Integer
openIssuesCount
;
private
Integer
openIssuesCount
;
private
Integer
closedIssuesCount
;
private
Integer
closedIssuesCount
;
private
Integer
openMergeRequestsCount
;
private
Integer
openMergeRequestsCount
;
private
b
oolean
subscribed
;
private
B
oolean
subscribed
;
private
Integer
priority
;
private
Integer
priority
;
public
Integer
getId
()
{
public
Integer
getId
()
{
...
@@ -76,11 +76,11 @@ public class Label {
...
@@ -76,11 +76,11 @@ public class Label {
this
.
openMergeRequestsCount
=
openMergeRequestsCount
;
this
.
openMergeRequestsCount
=
openMergeRequestsCount
;
}
}
public
b
oolean
isSubscribed
()
{
public
B
oolean
isSubscribed
()
{
return
subscribed
;
return
subscribed
;
}
}
public
void
setSubscribed
(
b
oolean
subscribed
)
{
public
void
setSubscribed
(
B
oolean
subscribed
)
{
this
.
subscribed
=
subscribed
;
this
.
subscribed
=
subscribed
;
}
}
...
...
src/test/java/org/gitlab4j/api/TestGitLabApiBeans.java
View file @
a49ba426
...
@@ -34,6 +34,7 @@ import java.util.Map;
...
@@ -34,6 +34,7 @@ import java.util.Map;
import
org.gitlab4j.api.models.ArtifactsFile
;
import
org.gitlab4j.api.models.ArtifactsFile
;
import
org.gitlab4j.api.models.AwardEmoji
;
import
org.gitlab4j.api.models.AwardEmoji
;
import
org.gitlab4j.api.models.Board
;
import
org.gitlab4j.api.models.Branch
;
import
org.gitlab4j.api.models.Branch
;
import
org.gitlab4j.api.models.Comment
;
import
org.gitlab4j.api.models.Comment
;
import
org.gitlab4j.api.models.Commit
;
import
org.gitlab4j.api.models.Commit
;
...
@@ -94,6 +95,12 @@ public class TestGitLabApiBeans {
...
@@ -94,6 +95,12 @@ public class TestGitLabApiBeans {
assertTrue
(
compareJson
(
awardEmoji
,
"award-emoji.json"
));
assertTrue
(
compareJson
(
awardEmoji
,
"award-emoji.json"
));
}
}
@Test
public
void
testBoard
()
throws
Exception
{
List
<
Board
>
boards
=
unmarshalResourceList
(
Board
.
class
,
"project-board.json"
);
assertTrue
(
compareJson
(
boards
,
"project-board.json"
));
}
@Test
@Test
public
void
testBranch
()
throws
Exception
{
public
void
testBranch
()
throws
Exception
{
...
...
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