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
4b727853
Unverified
Commit
4b727853
authored
Jul 07, 2018
by
Greg Messner
Committed by
GitHub
Jul 07, 2018
Browse files
Add Epic and Epic Issues API support (#218)
parent
2263d761
Changes
11
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
4b727853
...
...
@@ -11,7 +11,7 @@ To utilize the GitLab API for Java in your project, simply add the following dep
```
java
dependencies
{
...
compile
group:
'
org
.
gitlab4j
'
,
name:
'
gitlab4j
-
api
'
,
version:
'
4.8
.
29
'
compile
group:
'
org
.
gitlab4j
'
,
name:
'
gitlab4j
-
api
'
,
version:
'
4.8
.
30
'
}
```
...
...
@@ -20,7 +20,7 @@ dependencies {
<dependency>
<groupId>
org.gitlab4j
</groupId>
<artifactId>
gitlab4j-api
</artifactId>
<version>
4.8.
29
</version>
<version>
4.8.
30
</version>
</dependency>
```
...
...
@@ -137,6 +137,7 @@ The API has been broken up into sub APIs classes to make it easier to learn and
------------------
[
CommitsApi
](
#commitsapi
)
<br/>
[
DeployKeysApi
](
#deploykeysapi
)
<br/>
[
EpicsApi
](
#epicsapi
)
<br/>
[
EventsApi
](
#eventsapi
)
<br/>
[
GroupApi
](
#groupapi
)
<br/>
[
HealthCheckApi
](
#healthcheckapi
)
<br/>
...
...
@@ -179,10 +180,16 @@ List<Commit> commits = gitLabApi.getCommitsApi().getCommits(1234, "new-feature",
List
<
DeployKey
>
deployKeys
=
gitLabApi
.
getDeployKeysApi
().
getDeployKeys
();
```
#### EpicsApi
```
java
// Get a list epics of the requested group and its subgroups.
List
<
Epic
>
epics
=
gitLabApi
.
getEpicsApi
().
getEpics
(
1
);
```
#### EventsApi
```
java
// Get a list of Events for the authenticated user
Date
after
=
new
Date
(
0
);
// After Epo
s
c
Date
after
=
new
Date
(
0
);
// After Epoc
h
Date
before
=
new
Date
();
// Before now
List
<
Event
>
events
=
gitLabApi
.
getEventsApi
().
getAuthenticatedUserEvents
(
null
,
null
,
before
,
after
,
DESC
);
```
...
...
src/main/java/org/gitlab4j/api/Constants.java
View file @
4b727853
...
...
@@ -59,6 +59,30 @@ public interface Constants {
}
}
/** Enum to use for ordering the results of getEpics(). */
public
enum
EpicOrderBy
{
CREATED_AT
,
UPDATED_AT
;
private
static
JacksonJsonEnumHelper
<
EpicOrderBy
>
enumHelper
=
new
JacksonJsonEnumHelper
<>(
EpicOrderBy
.
class
);
@JsonCreator
public
static
EpicOrderBy
forValue
(
String
value
)
{
return
enumHelper
.
forValue
(
value
);
}
@JsonValue
public
String
toValue
()
{
return
(
enumHelper
.
toString
(
this
));
}
@Override
public
String
toString
()
{
return
(
enumHelper
.
toString
(
this
));
}
}
/** Enum to use for ordering the results of getProjects(). */
public
enum
ProjectOrderBy
{
...
...
src/main/java/org/gitlab4j/api/EpicsApi.java
0 → 100644
View file @
4b727853
package
org.gitlab4j.api
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Optional
;
import
javax.ws.rs.core.Form
;
import
javax.ws.rs.core.GenericType
;
import
javax.ws.rs.core.Response
;
import
org.gitlab4j.api.models.Epic
;
import
org.gitlab4j.api.models.EpicIssue
;
/**
* This class implements the client side API for the GitLab Epics and Epic Issues API calls.
*
* NOTE:
* - If a user is not a member of a group and the group is private, a GET request on that group will result to a 404 status code.
* - Epics are available only in Ultimate. If epics feature is not available a 403 status code will be returned.
*
* @see <a href="https://docs.gitlab.com/ee/api/epics.html">GitLab Epics API Documentaion</a>
* @see <a href="https://docs.gitlab.com/ee/api/epic_issues.html">GitLab Epic Issues API Documentation</a>
*/
public
class
EpicsApi
extends
AbstractApi
{
public
EpicsApi
(
GitLabApi
gitLabApi
)
{
super
(
gitLabApi
);
}
/**
* Gets all epics of the requested group and its subgroups.
*
* <pre><code>GitLab Endpoint: GET /groups/:id/epics</code></pre>
*
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
* @return a list of all epics of the requested group and its subgroups
* @throws GitLabApiException if any exception occurs
*/
public
List
<
Epic
>
getEpics
(
Object
groupIdOrPath
)
throws
GitLabApiException
{
return
(
getEpics
(
groupIdOrPath
,
1
,
getDefaultPerPage
()));
}
/**
* Gets all epics of the requested group and its subgroups using the specified page and per page setting.
*
* <pre><code>GitLab Endpoint: GET /groups/:id/epics</code></pre>
*
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
* @param page the page to get
* @param perPage the number of issues per page
* @return a list of all epics of the requested group and its subgroups in the specified range
* @throws GitLabApiException if any exception occurs
*/
public
List
<
Epic
>
getEpics
(
Object
groupIdOrPath
,
int
page
,
int
perPage
)
throws
GitLabApiException
{
Response
response
=
get
(
Response
.
Status
.
OK
,
getPageQueryParams
(
page
,
perPage
),
"groups"
,
getGroupIdOrPath
(
groupIdOrPath
),
"epics"
);
return
(
response
.
readEntity
(
new
GenericType
<
List
<
Epic
>>()
{
}));
}
/**
* Get a Pager of all epics of the requested group and its subgroups.
*
* <pre><code>GitLab Endpoint: GET /groups/:id/epics</code></pre>
*
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
* @param itemsPerPage the number of issues per page
* @return the Pager of all epics of the requested group and its subgroups
* @throws GitLabApiException if any exception occurs
*/
public
Pager
<
Epic
>
getEpics
(
Object
groupIdOrPath
,
int
itemsPerPage
)
throws
GitLabApiException
{
return
(
new
Pager
<
Epic
>(
this
,
Epic
.
class
,
itemsPerPage
,
null
,
"groups"
,
getGroupIdOrPath
(
groupIdOrPath
),
"epics"
));
}
/**
* Gets all epics of the requested group and its subgroups.
*
* <pre><code>GitLab Endpoint: GET /groups/:id/epics</code></pre>
*
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
* @param authorId returns epics created by the given user id
* @param labels return epics matching a comma separated list of labels names.
* Label names from the epic group or a parent group can be used
* @param orderBy return epics ordered by CREATED_AT or UPDATED_AT. Default is CREATED_AT
* @param sortOrder return epics sorted in ASC or DESC order. Default is DESC
* @param search search epics against their title and description
* @return a list of matching epics of the requested group and its subgroups
* @throws GitLabApiException if any exception occurs
*/
public
List
<
Epic
>
getEpics
(
Object
groupIdOrPath
,
Integer
authorId
,
String
labels
,
EpicOrderBy
orderBy
,
SortOrder
sortOrder
,
String
search
)
throws
GitLabApiException
{
return
(
getEpics
(
groupIdOrPath
,
authorId
,
labels
,
orderBy
,
sortOrder
,
search
,
1
,
getDefaultPerPage
()));
}
/**
* Gets all epics of the requested group and its subgroups using the specified page and per page setting.
*
* <pre><code>GitLab Endpoint: GET /groups/:id/epics</code></pre>
*
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
* @param authorId returns epics created by the given user id
* @param labels return epics matching a comma separated list of labels names
* Label names from the epic group or a parent group can be used
* @param orderBy return epics ordered by CREATED_AT or UPDATED_AT. Default is CREATED_AT
* @param sortOrder return epics sorted in ASC or DESC order. Default is DESC
* @param search search epics against their title and description
* @param page the page to get
* @param perPage the number of issues per page
* @return a list of matching epics of the requested group and its subgroups in the specified range
* @throws GitLabApiException if any exception occurs
*/
public
List
<
Epic
>
getEpics
(
Object
groupIdOrPath
,
Integer
authorId
,
String
labels
,
EpicOrderBy
orderBy
,
SortOrder
sortOrder
,
String
search
,
int
page
,
int
perPage
)
throws
GitLabApiException
{
GitLabApiForm
formData
=
new
GitLabApiForm
(
page
,
perPage
)
.
withParam
(
"author_id"
,
authorId
)
.
withParam
(
"labels"
,
labels
)
.
withParam
(
"order_by"
,
orderBy
)
.
withParam
(
"sort"
,
sortOrder
)
.
withParam
(
"search"
,
search
);
Response
response
=
get
(
Response
.
Status
.
OK
,
formData
.
asMap
(),
"groups"
,
getGroupIdOrPath
(
groupIdOrPath
),
"epics"
);
return
(
response
.
readEntity
(
new
GenericType
<
List
<
Epic
>>()
{
}));
}
/**
* Get a Pager of all epics of the requested group and its subgroups.
*
* <pre><code>GitLab Endpoint: GET /groups/:id/epics</code></pre>
*
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
* @param authorId returns epics created by the given user id
* @param labels return epics matching a comma separated list of labels names.
* Label names from the epic group or a parent group can be used
* @param itemsPerPage the number of issues per page
* @param orderBy return epics ordered by CREATED_AT or UPDATED_AT. Default is CREATED_AT
* @param sortOrder return epics sorted in ASC or DESC order. Default is DESC
* @param search search epics against their title and description
* @return the Pager of matching epics of the requested group and its subgroups
* @throws GitLabApiException if any exception occurs
*/
public
Pager
<
Epic
>
getEpics
(
Object
groupIdOrPath
,
Integer
authorId
,
String
labels
,
EpicOrderBy
orderBy
,
SortOrder
sortOrder
,
String
search
,
int
itemsPerPage
)
throws
GitLabApiException
{
GitLabApiForm
formData
=
new
GitLabApiForm
()
.
withParam
(
"author_id"
,
authorId
)
.
withParam
(
"labels"
,
labels
)
.
withParam
(
"order_by"
,
orderBy
)
.
withParam
(
"sort"
,
sortOrder
)
.
withParam
(
"search"
,
search
);
return
(
new
Pager
<
Epic
>(
this
,
Epic
.
class
,
itemsPerPage
,
formData
.
asMap
(),
"groups"
,
getGroupIdOrPath
(
groupIdOrPath
),
"epics"
));
}
/**
* Get a single epic for the specified group.
*
* <pre><code>GitLab Endpoint: GET /groups/:id/epics/:epic_iid</code></pre>
*
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
* @param epicIid the IID of the epic to get
* @return an Epic instance for the specified Epic
* @throws GitLabApiException if any exception occurs
*/
public
Epic
getEpic
(
Object
groupIdOrPath
,
Integer
epicIid
)
throws
GitLabApiException
{
Response
response
=
get
(
Response
.
Status
.
OK
,
null
,
"groups"
,
getGroupIdOrPath
(
groupIdOrPath
),
"epics"
,
epicIid
);
return
(
response
.
readEntity
(
Epic
.
class
));
}
/**
* Get an Optional instance with the value for the specific Epic.
*
* <pre><code>GitLab Endpoint: GET /groups/:id/epics/:epic_iid</code></pre>
*
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
* @param epicIid the IID of the epic to get
* @return an Optional instance with the specified Epic as a value
*/
public
Optional
<
Epic
>
getOptionalEpic
(
Object
groupIdOrPath
,
Integer
epicIid
)
{
try
{
return
(
Optional
.
ofNullable
(
getEpic
(
groupIdOrPath
,
epicIid
)));
}
catch
(
GitLabApiException
glae
)
{
return
(
GitLabApi
.
createOptionalFromException
(
glae
));
}
}
/**
* Creates a new epic.
*
* <pre><code>GitLab Endpoint: POST /groups/:id/epics</code></pre>
*
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
* @param title the title of the epic (required)
* @param labels comma separated list of labels (optional)
* @param description the description of the epic (optional)
* @param startDate the start date of the epic (optional)
* @param endDate the end date of the epic (optional)
* @return an Epic instance containing info on the newly created epic
* @throws GitLabApiException if any exception occurs
*/
public
Epic
createEpic
(
Object
groupIdOrPath
,
String
title
,
String
labels
,
String
description
,
Date
startDate
,
Date
endDate
)
throws
GitLabApiException
{
Form
formData
=
new
GitLabApiForm
()
.
withParam
(
"title"
,
title
,
true
)
.
withParam
(
"labels"
,
labels
)
.
withParam
(
"description"
,
description
)
.
withParam
(
"start_date"
,
startDate
)
.
withParam
(
"end_date"
,
endDate
);
Response
response
=
post
(
Response
.
Status
.
CREATED
,
formData
.
asMap
(),
"groups"
,
getGroupIdOrPath
(
groupIdOrPath
),
"epics"
);
return
(
response
.
readEntity
(
Epic
.
class
));
}
/**
* Creates a new epic using the information contained in the provided Epic instance. Only the following
* fields from the Epic instance are used:
* <pre><code>
* title - the title of the epic (required)
* labels - comma separated list of labels (optional)
* description - the description of the epic (optional)
* startDate - the start date of the epic (optional)
* endDate - the end date of the epic (optional)
* </code></pre>
*
* <pre><code>GitLab Endpoint: POST /groups/:id/epics</code></pre>
*
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
* @param epic the Epic instance with information for the new epic
* @return an Epic instance containing info on the newly created epic
* @throws GitLabApiException if any exception occurs
*/
public
Epic
createEpic
(
Object
groupIdOrPath
,
Epic
epic
)
throws
GitLabApiException
{
Form
formData
=
new
GitLabApiForm
()
.
withParam
(
"title"
,
epic
.
getTitle
(),
true
)
.
withParam
(
"labels"
,
epic
.
getLabels
())
.
withParam
(
"description"
,
epic
.
getDescription
())
.
withParam
(
"start_date"
,
epic
.
getStartDate
())
.
withParam
(
"end_date"
,
epic
.
getEndDate
());
Response
response
=
post
(
Response
.
Status
.
CREATED
,
formData
.
asMap
(),
"groups"
,
getGroupIdOrPath
(
groupIdOrPath
),
"epics"
);
return
(
response
.
readEntity
(
Epic
.
class
));
}
/**
* Updates an existing epic.
*
* <pre><code>GitLab Endpoint: PUT /groups/:id/epics/:epic_iid</code></pre>
*
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
* @param epicIid the IID of the epic to update
* @param title the title of the epic (optional)
* @param labels comma separated list of labels (optional)
* @param description the description of the epic (optional)
* @param startDate the start date of the epic (optional)
* @param endDate the end date of the epic (optional)
* @return an Epic instance containing info on the newly created epic
* @throws GitLabApiException if any exception occurs
*/
public
Epic
updateEpic
(
Object
groupIdOrPath
,
Integer
epicIid
,
String
title
,
String
labels
,
String
description
,
Date
startDate
,
Date
endDate
)
throws
GitLabApiException
{
Form
formData
=
new
GitLabApiForm
()
.
withParam
(
"title"
,
title
,
true
)
.
withParam
(
"labels"
,
labels
)
.
withParam
(
"description"
,
description
)
.
withParam
(
"start_date"
,
startDate
)
.
withParam
(
"end_date"
,
endDate
);
Response
response
=
put
(
Response
.
Status
.
CREATED
,
formData
.
asMap
(),
"groups"
,
getGroupIdOrPath
(
groupIdOrPath
),
"epics"
,
epicIid
);
return
(
response
.
readEntity
(
Epic
.
class
));
}
/**
* Updates an epic using the information contained in the provided Epic instance. Only the following
* fields from the Epic instance are used:
* <pre><code>
* title - the title of the epic (optional)
* labels - comma separated list of labels (optional)
* description - the description of the epic (optional)
* startDate - the start date of the epic (optional)
* endDate - the end date of the epic (optional)
* </code></pre>
* <pre><code>GitLab Endpoint: PUT /groups/:id/epics/:epic_iid</code></pre>
*
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
* @param epicIid the IID of the epic to update
* @param epic the Epic instance with update information
* @return an Epic instance containing info on the updated epic
* @throws GitLabApiException if any exception occurs
*/
public
Epic
updateEpic
(
Object
groupIdOrPath
,
Integer
epicIid
,
Epic
epic
)
throws
GitLabApiException
{
Form
formData
=
new
GitLabApiForm
()
.
withParam
(
"title"
,
epic
.
getTitle
(),
true
)
.
withParam
(
"labels"
,
epic
.
getLabels
())
.
withParam
(
"description"
,
epic
.
getDescription
())
.
withParam
(
"start_date"
,
epic
.
getStartDate
())
.
withParam
(
"end_date"
,
epic
.
getEndDate
());
Response
response
=
put
(
Response
.
Status
.
CREATED
,
formData
.
asMap
(),
"groups"
,
getGroupIdOrPath
(
groupIdOrPath
),
"epics"
,
epicIid
);
return
(
response
.
readEntity
(
Epic
.
class
));
}
/**
* Deletes an epic.
*
* <pre><code>GitLab Endpoint: DELETE /groups/:id/epics/:epic_iid</code></pre>
*
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
* @param epicIid the IID of the epic to delete
* @throws GitLabApiException if any exception occurs
*/
public
void
deleteEpic
(
Object
groupIdOrPath
,
Integer
epicIid
)
throws
GitLabApiException
{
delete
(
Response
.
Status
.
NO_CONTENT
,
null
,
"groups"
,
getGroupIdOrPath
(
groupIdOrPath
),
"epics"
,
epicIid
);
}
/**
* Gets all issues that are assigned to an epic and the authenticated user has access to.
*
* <pre><code>GitLab Endpoint: GET /groups/:id/epics/:epic_iid/issues</code></pre>
*
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
* @param epicIid the IID of the epic to get issues for
* @return a list of all epic issues belonging to the specified epic
* @throws GitLabApiException if any exception occurs
*/
public
List
<
Epic
>
getEpicIssues
(
Object
groupIdOrPath
,
Integer
epicIid
)
throws
GitLabApiException
{
return
(
getEpicIssues
(
groupIdOrPath
,
epicIid
,
1
,
getDefaultPerPage
()));
}
/**
* Gets all issues that are assigned to an epic and the authenticated user has access to
* using the specified page and per page setting.
*
* <pre><code>GitLab Endpoint: GET /groups/:id/epics/:epic_iid/issues</code></pre>
*
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
* @param epicIid the IID of the epic to get issues for
* @param page the page to get
* @param perPage the number of issues per page
* @return a list of all epic issues belonging to the specified epic in the specified range
* @throws GitLabApiException if any exception occurs
*/
public
List
<
Epic
>
getEpicIssues
(
Object
groupIdOrPath
,
Integer
epicIid
,
int
page
,
int
perPage
)
throws
GitLabApiException
{
Response
response
=
get
(
Response
.
Status
.
OK
,
getPageQueryParams
(
page
,
perPage
),
"groups"
,
getGroupIdOrPath
(
groupIdOrPath
),
"epics"
,
epicIid
,
"issues"
);
return
(
response
.
readEntity
(
new
GenericType
<
List
<
Epic
>>()
{
}));
}
/**
* Get a Pager of all issues that are assigned to an epic and the authenticated user has access to.
*
* <pre><code>GitLab Endpoint: GET /groups/:id/epics/:epic_iid/issues</code></pre>
*
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
* @param epicIid the IID of the epic to get issues for
* @param itemsPerPage the number of issues per page
* @return the Pager of all epic issues belonging to the specified epic
* @throws GitLabApiException if any exception occurs
*/
public
Pager
<
Epic
>
getEpicIssues
(
Object
groupIdOrPath
,
Integer
epicIid
,
int
itemsPerPage
)
throws
GitLabApiException
{
return
(
new
Pager
<
Epic
>(
this
,
Epic
.
class
,
itemsPerPage
,
null
,
"groups"
,
getGroupIdOrPath
(
groupIdOrPath
),
"epics"
,
epicIid
,
"issues"
));
}
/**
* Creates an epic - issue association. If the issue in question belongs to another epic
* it is unassigned from that epic.
*
* <pre><code>GitLab Endpoint: POST /groups/:id/epics/:epic_iid/issues/:issue_id</code></pre>
*
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
* @param epicIid the Epic IID to assign the issue to
* @param issueIid the issue IID of the issue to assign to the epic
* @return an EpicIssue instance containing info on the newly assigned epic issue
* @throws GitLabApiException if any exception occurs
*/
public
EpicIssue
assignIssue
(
Object
groupIdOrPath
,
Integer
epicIid
,
Integer
issueIid
)
throws
GitLabApiException
{
Response
response
=
post
(
Response
.
Status
.
CREATED
,
(
Form
)
null
,
"groups"
,
getGroupIdOrPath
(
groupIdOrPath
),
"epics"
,
epicIid
,
"issues"
,
issueIid
);
return
(
response
.
readEntity
(
EpicIssue
.
class
));
}
/**
* Remove an epic - issue association.
*
* <pre><code>GitLab Endpoint: DELETE /groups/:id/epics/:epic_iid/issues/:issue_id</code></pre>
*
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
* @param epicIid the Epic IID to remove the issue from
* @param issueIid the issue IID of the issue to remove from the epic
* @return an EpicIssue instance containing info on the removed issue
* @throws GitLabApiException if any exception occurs
*/
public
EpicIssue
removeIssue
(
Object
groupIdOrPath
,
Integer
epicIid
,
Integer
issueIid
)
throws
GitLabApiException
{
Response
response
=
delete
(
Response
.
Status
.
CREATED
,
null
,
"groups"
,
getGroupIdOrPath
(
groupIdOrPath
),
"epics"
,
epicIid
,
"issues"
,
issueIid
);
return
(
response
.
readEntity
(
EpicIssue
.
class
));
}
/**
* Updates an epic - issue association.
*
* <pre><code>GitLab Endpoint: PUT /groups/:id/epics/:epic_iid/issues/:issue_id</code></pre>
*
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
* @param epicIid the Epic IID that the issue is assigned to
* @param issueIid the issue IID to update
* @param moveBeforeId the ID of the issue - epic association that should be placed before the link in the question (optional)
* @param moveAfterId the ID of the issue - epic association that should be placed after the link in the question (optional)
* @return an EpicIssue instance containing info on the newly assigned epic issue
* @throws GitLabApiException if any exception occurs
*/
public
EpicIssue
updateIssue
(
Object
groupIdOrPath
,
Integer
epicIid
,
Integer
issueIid
,
Integer
moveBeforeId
,
Integer
moveAfterId
)
throws
GitLabApiException
{
GitLabApiForm
form
=
new
GitLabApiForm
()
.
withParam
(
"move_before_id"
,
moveBeforeId
)
.
withParam
(
"move_after_id"
,
moveAfterId
);
Response
response
=
post
(
Response
.
Status
.
CREATED
,
form
,
"groups"
,
getGroupIdOrPath
(
groupIdOrPath
),
"epics"
,
epicIid
,
"issues"
,
issueIid
);
return
(
response
.
readEntity
(
EpicIssue
.
class
));
}
}
src/main/java/org/gitlab4j/api/GitLabApi.java
View file @
4b727853
...
...
@@ -50,6 +50,7 @@ public class GitLabApi {
private
CommitsApi
commitsApi
;
private
DeployKeysApi
deployKeysApi
;
private
EpicsApi
epicsApi
;
private
EventsApi
eventsApi
;
private
GroupApi
groupApi
;
private
HealthCheckApi
healthCheckApi
;
...
...
@@ -846,6 +847,25 @@ public class GitLabApi {
return
(
deployKeysApi
);
}
/**
* Gets the EpicsApi instance owned by this GitLabApi instance. The EpicsApi is used
* to perform all Epics and Epic Issues related API calls.
*
* @return the EpicsApi instance owned by this GitLabApi instance
*/
public
EpicsApi
getEpicsApi
()
{
if
(
epicsApi
==
null
)
{
synchronized
(
this
)
{
if
(
epicsApi
==
null
)
{
epicsApi
=
new
EpicsApi
(
this
);
}
}
}
return
(
epicsApi
);
}
/**
* Gets the EventsApi instance owned by this GitLabApi instance. The EventsApi is used
* to perform all events related API calls.
...
...
src/main/java/org/gitlab4j/api/GitLabApiForm.java
View file @
4b727853
...
...
@@ -21,6 +21,18 @@ public class GitLabApiForm extends Form {
super
(
map
);
}
/**
* Create a GitLabApiForm instance with the "page", and "per_page" parameters preset.
*
* @param page the value for the "page" parameter
* @param perPage the value for the "per_page" parameter
*/
public
GitLabApiForm
(
int
page
,
int
perPage
)
{
super
();
withParam
(
AbstractApi
.
PAGE_PARAM
,
page
);
withParam
(
AbstractApi
.
PER_PAGE_PARAM
,
(
Integer
)
perPage
);
}
/**
* Fluent method for adding query and form parameters to a get() or post() call.
*
...
...
src/main/java/org/gitlab4j/api/models/Epic.java
0 → 100644
View file @
4b727853
package
org.gitlab4j.api.models
;
import
java.util.Date
;
import
java.util.List
;
import
javax.xml.bind.annotation.XmlAccessType
;
import
javax.xml.bind.annotation.XmlAccessorType
;
import
javax.xml.bind.annotation.XmlRootElement
;
@XmlRootElement
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
public
class
Epic
{
private
Integer
id
;
private
Integer
iid
;
private
Integer
groupId
;
private
String
title
;
private
String
description
;
private
Author
author
;
private
List
<
String
>
labels
;
private
Date
startDate
;
private
Date
endDate
;
private
Date
createdAt
;
private
Date
updatedAt
;
public
Integer
getId
()
{
return
id
;
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
public
Integer
getIid
()
{
return
iid
;
}
public
void
setIid
(
Integer
iid
)
{
this
.
iid
=
iid
;
}
public
Integer
getGroupId
()
{
return
groupId
;
}
public
void
setGroupId
(
Integer
groupId
)
{
this
.
groupId
=
groupId
;
}
public
String
getTitle
()
{
return
title
;
}
public
void
setTitle
(
String
title
)
{
this
.
title
=
title
;
}
public
Epic
withTitle
(
String
title
)
{
this
.
title
=
title
;
return
(
this
);
}
public
String
getDescription
()
{
return
description
;
}
public
void
setDescription
(
String
description
)
{
this
.
description
=
description
;
}
public
Epic
withDescription
(
String
description
)
{
this
.
description
=
description
;
return
(
this
);
}
public
Author
getAuthor
()
{
return
author
;
}
public
void
setAuthor
(
Author
author
)
{
this
.
author
=
author
;
}
public
Epic
withAuthor
(
Author
author
)
{
this
.
author
=
author
;
return
(
this
);
}
public
List
<
String
>
getLabels
()
{
return
labels
;
}
public
void
setLabels
(
List
<
String
>
labels
)
{
this
.
labels
=
labels
;
}
public
Epic
withLabels
(
List
<
String
>
labels
)
{
this
.
labels
=
labels
;
return
(
this
);
}
public
Date
getStartDate
()
{
return
startDate
;
}
public
void
setStartDate
(
Date
startDate
)
{
this
.
startDate
=
startDate
;
}
public
Epic
withStartDate
(
Date
startDate
)
{
this
.
startDate
=
startDate
;
return
(
this
);
}
public
Date
getEndDate
()
{
return
endDate
;
}
public
void
setEndDate
(
Date
endDate
)
{
this
.
endDate
=
endDate
;
}
public
Epic
withEndDate
(
Date
endDate
)
{
this
.
endDate
=
endDate
;
return
(
this
);
}
public
Date
getCreatedAt
()
{
return
createdAt
;
}
public
void
setCreatedAt
(
Date
createdAt
)
{
this
.
createdAt
=
createdAt
;
}
public
Date
getUpdatedAt
()
{
return
updatedAt
;
}
public
void
setUpdatedAt
(
Date
updatedAt
)
{
this
.
updatedAt
=
updatedAt
;
}
}
src/main/java/org/gitlab4j/api/models/EpicIssue.java
0 → 100644
View file @
4b727853
package
org.gitlab4j.api.models
;
import
java.util.Map
;
import
javax.xml.bind.annotation.XmlAccessType
;
import
javax.xml.bind.annotation.XmlAccessorType
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
public
class
EpicIssue
extends
Issue
{
private
Integer
downvotes
;
private
Integer
upvotes
;
@JsonProperty
(
"_links"
)
private
Map
<
String
,
String
>
links
;
private
Boolean
subscribed
;
private
Integer
epicIssueId
;
private
Integer
relativePosition
;
public
Integer
getDownvotes
()
{
return
downvotes
;
}
public
void
setDownvotes
(
Integer
downvotes
)
{
this
.
downvotes
=
downvotes
;
}
public
Integer
getUpvotes
()
{
return
upvotes
;
}
public
void
setUpvotes
(
Integer
upvotes
)
{
this
.
upvotes
=
upvotes
;
}
public
Map
<
String
,
String
>
getLinks
()
{
return
links
;
}
public
void
setLinks
(
Map
<
String
,
String
>
links
)
{
this
.
links
=
links
;
}
@JsonIgnore
public
String
getLinkByName
(
String
name
)
{
if
(
links
==
null
||
links
.
isEmpty
())
{
return
(
null
);
}
return
(
links
.
get
(
name
));
}
public
Boolean
getSubscribed
()
{
return
subscribed
;
}
public
void
setSubscribed
(
Boolean
subscribed
)
{
this
.
subscribed
=
subscribed
;
}
public
Integer
getEpicIssueId
()
{
return
epicIssueId
;
}
public
void
setEpicIssueId
(
Integer
epicIssueId
)
{
this
.
epicIssueId
=
epicIssueId
;
}
public
Integer
getRelativePosition
()
{
return
relativePosition
;
}
public
void
setRelativePosition
(
Integer
relativePosition
)
{
this
.
relativePosition
=
relativePosition
;
}
}
src/main/java/org/gitlab4j/api/models/Issue.java
View file @
4b727853
...
...
@@ -15,6 +15,7 @@ import org.gitlab4j.api.Constants.IssueState;
public
class
Issue
{
private
Assignee
assignee
;
private
List
<
Assignee
>
assignees
;
private
Author
author
;
private
Boolean
confidential
;
private
Date
createdAt
;
...
...
@@ -33,6 +34,8 @@ public class Issue {
private
String
title
;
private
Integer
userNotesCount
;
private
String
webUrl
;
private
Integer
weight
;
private
Boolean
discussionLocked
;
private
TimeStats
timeStats
;
public
Assignee
getAssignee
()
{
...
...
@@ -43,6 +46,14 @@ public class Issue {
this
.
assignee
=
assignee
;
}
public
List
<
Assignee
>
getAssignees
()
{
return
assignees
;
}
public
void
setAssignees
(
List
<
Assignee
>
assignees
)
{
this
.
assignees
=
assignees
;
}
public
Author
getAuthor
()
{
return
author
;
}
...
...
@@ -187,6 +198,22 @@ public class Issue {
this
.
webUrl
=
webUrl
;
}
public
Integer
getWeight
()
{
return
weight
;
}
public
void
setWeight
(
Integer
weight
)
{
this
.
weight
=
weight
;
}
public
Boolean
getDiscussionLocked
()
{
return
discussionLocked
;
}
public
void
setDiscussionLocked
(
Boolean
discussionLocked
)
{
this
.
discussionLocked
=
discussionLocked
;
}
public
TimeStats
getTimeStats
()
{
return
timeStats
;
}
...
...
src/test/java/org/gitlab4j/api/TestGitLabApiBeans.java
View file @
4b727853
...
...
@@ -38,6 +38,8 @@ import org.gitlab4j.api.models.CommitPayload;
import
org.gitlab4j.api.models.CompareResults
;
import
org.gitlab4j.api.models.DeployKey
;
import
org.gitlab4j.api.models.Diff
;
import
org.gitlab4j.api.models.Epic
;
import
org.gitlab4j.api.models.EpicIssue
;
import
org.gitlab4j.api.models.Event
;
import
org.gitlab4j.api.models.FileUpload
;
import
org.gitlab4j.api.models.Group
;
...
...
@@ -169,6 +171,28 @@ public class TestGitLabApiBeans {
}
}
@Test
public
void
testEpic
()
{
try
{
Epic
epic
=
makeFakeApiCall
(
Epic
.
class
,
"epic"
);
assertTrue
(
compareJson
(
epic
,
"epic"
));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
@Test
public
void
testEpicIssue
()
{
try
{
EpicIssue
epicIssue
=
makeFakeApiCall
(
EpicIssue
.
class
,
"epic-issue"
);
assertTrue
(
compareJson
(
epicIssue
,
"epic-issue"
));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
@Test
public
void
testEvent
()
{
...
...
src/test/resources/org/gitlab4j/api/epic-issue.json
0 → 100644
View file @
4b727853
{
"id"
:
76
,
"iid"
:
6
,
"project_id"
:
8
,
"title"
:
"Consequatur vero maxime deserunt laboriosam est voluptas dolorem."
,
"description"
:
"Ratione dolores corrupti mollitia soluta quia."
,
"state"
:
"opened"
,
"created_at"
:
"2017-11-15T13:39:24.670Z"
,
"updated_at"
:
"2018-01-04T10:49:19.506Z"
,
"labels"
:
[],
"milestone"
:
{
"id"
:
38
,
"iid"
:
3
,
"project_id"
:
8
,
"title"
:
"v2.0"
,
"description"
:
"In tempore culpa inventore quo accusantium."
,
"state"
:
"closed"
,
"created_at"
:
"2017-11-15T13:39:13.825Z"
,
"updated_at"
:
"2017-11-15T13:39:13.825Z"
},
"assignees"
:
[{
"id"
:
7
,
"name"
:
"Pamella Huel"
,
"username"
:
"arnita"
,
"state"
:
"active"
,
"avatar_url"
:
"http://www.gravatar.com/avatar/a2f5c6fcef64c9c69cb8779cb292be1b?s=80&d=identicon"
,
"web_url"
:
"http://localhost:3001/arnita"
}],
"assignee"
:
{
"id"
:
7
,
"name"
:
"Pamella Huel"
,
"username"
:
"arnita"
,
"state"
:
"active"
,
"avatar_url"
:
"http://www.gravatar.com/avatar/a2f5c6fcef64c9c69cb8779cb292be1b?s=80&d=identicon"
,
"web_url"
:
"http://localhost:3001/arnita"
},
"author"
:
{
"id"
:
13
,
"name"
:
"Michell Johns"
,
"username"
:
"chris_hahn"
,
"state"
:
"active"
,
"avatar_url"
:
"http://www.gravatar.com/avatar/30e3b2122ccd6b8e45e8e14a3ffb58fc?s=80&d=identicon"
,
"web_url"
:
"http://localhost:3001/chris_hahn"
},
"user_notes_count"
:
8
,
"upvotes"
:
0
,
"downvotes"
:
0
,
"confidential"
:
false
,
"weight"
:
9
,
"discussion_locked"
:
true
,
"web_url"
:
"http://localhost:3001/h5bp/html5-boilerplate/issues/6"
,
"time_stats"
:
{
"time_estimate"
:
0
,
"total_time_spent"
:
0
},
"_links"
:{
"self"
:
"http://localhost:3001/api/v4/projects/8/issues/6"
,
"notes"
:
"http://localhost:3001/api/v4/projects/8/issues/6/notes"
,
"award_emoji"
:
"http://localhost:3001/api/v4/projects/8/issues/6/award_emoji"
,
"project"
:
"http://localhost:3001/api/v4/projects/8"
},
"subscribed"
:
true
,
"epic_issue_id"
:
2
,
"relative_position"
:
55
}
\ No newline at end of file
src/test/resources/org/gitlab4j/api/epic.json
0 → 100644
View file @
4b727853
{
"id"
:
30
,
"iid"
:
5
,
"group_id"
:
7
,
"title"
:
"Ea cupiditate dolores ut vero consequatur quasi veniam voluptatem et non."
,
"description"
:
"Molestias dolorem eos vitae expedita impedit necessitatibus quo voluptatum."
,
"author"
:{
"id"
:
7
,
"name"
:
"Pamella Huel"
,
"username"
:
"arnita"
,
"state"
:
"active"
,
"avatar_url"
:
"http://www.gravatar.com/avatar/a2f5c6fcef64c9c69cb8779cb292be1b?s=80&d=identicon"
,
"web_url"
:
"http://localhost:3001/arnita"
},
"created_at"
:
"2018-01-21T06:21:13.165Z"
,
"updated_at"
:
"2018-01-22T12:41:41.166Z"
}
\ No newline at end of file
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