Commit a49ba426 authored by Greg Messner's avatar Greg Messner
Browse files

Added support for Issue Boards API (#316).

parent 0af6603e
...@@ -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.20' compile group: 'org.gitlab4j', name: 'gitlab4j-api', version: '4.9.21'
} }
``` ```
...@@ -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.20</version> <version>4.9.21</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
------------------ ------------------
&nbsp;&nbsp;[AwardEmojiApi](#awardemojiapi)<br/> &nbsp;&nbsp;[AwardEmojiApi](#awardemojiapi)<br/>
&nbsp;&nbsp;[BoardsApi](#boardsapi)<br/>
&nbsp;&nbsp;[CommitsApi](#commitsapi)<br/> &nbsp;&nbsp;[CommitsApi](#commitsapi)<br/>
&nbsp;&nbsp;[DeployKeysApi](#deploykeysapi)<br/> &nbsp;&nbsp;[DeployKeysApi](#deploykeysapi)<br/>
&nbsp;&nbsp;[DiscussionsApi](#discussionsapi)<br/> &nbsp;&nbsp;[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
......
...@@ -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.
......
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
* *
......
...@@ -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 boolean subscribed; private Boolean 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 boolean isSubscribed() { public Boolean isSubscribed() {
return subscribed; return subscribed;
} }
public void setSubscribed(boolean subscribed) { public void setSubscribed(Boolean subscribed) {
this.subscribed = subscribed; this.subscribed = subscribed;
} }
......
...@@ -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 {
......
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