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
a8cd89f9
Commit
a8cd89f9
authored
Sep 17, 2017
by
Greg Messner
Browse files
Mods to support IssuesApi (#69)
parent
7abd37b4
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/gitlab4j/api/Constants.java
View file @
a8cd89f9
...
@@ -143,7 +143,28 @@ public interface Constants {
...
@@ -143,7 +143,28 @@ public interface Constants {
}
}
}
}
/** Enum to use for specifying the state of a merge request update. */
/** Enum to use for specifying the scope when calling the various get issue methods. */
public
enum
IssueScope
{
CREATED_BY_ME
,
ASSIGNED_TO_ME
,
ALL
;
private
static
JacksonJsonEnumHelper
<
IssueScope
>
enumHelper
=
new
JacksonJsonEnumHelper
<>(
IssueScope
.
class
);
@JsonCreator
public
static
IssueScope
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 specifying the state of a merge request or issue update. */
public
enum
StateEvent
{
public
enum
StateEvent
{
CLOSE
,
REOPEN
;
CLOSE
,
REOPEN
;
...
@@ -165,6 +186,29 @@ public interface Constants {
...
@@ -165,6 +186,29 @@ public interface Constants {
}
}
}
}
/** Enum to used to store the state of an issue. */
public
enum
IssueState
{
OPENED
,
CLOSED
,
REOPENED
;
private
static
JacksonJsonEnumHelper
<
IssueState
>
enumHelper
=
new
JacksonJsonEnumHelper
<>(
IssueState
.
class
);
@JsonCreator
public
static
IssueState
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 specifying the event action_type. */
/** Enum to use for specifying the event action_type. */
public
enum
ActionType
{
public
enum
ActionType
{
...
...
src/main/java/org/gitlab4j/api/GitLabApi.java
View file @
a8cd89f9
...
@@ -31,6 +31,7 @@ public class GitLabApi {
...
@@ -31,6 +31,7 @@ public class GitLabApi {
private
CommitsApi
commitsApi
;
private
CommitsApi
commitsApi
;
private
DeployKeysApi
deployKeysApi
;
private
DeployKeysApi
deployKeysApi
;
private
GroupApi
groupApi
;
private
GroupApi
groupApi
;
private
IssuesApi
issuesApi
;
private
MergeRequestApi
mergeRequestApi
;
private
MergeRequestApi
mergeRequestApi
;
private
NamespaceApi
namespaceApi
;
private
NamespaceApi
namespaceApi
;
private
PipelineApi
pipelineApi
;
private
PipelineApi
pipelineApi
;
...
@@ -183,19 +184,20 @@ public class GitLabApi {
...
@@ -183,19 +184,20 @@ public class GitLabApi {
apiClient
=
new
GitLabApiClient
(
apiVersion
,
hostUrl
,
privateToken
,
secretToken
,
clientConfigProperties
);
apiClient
=
new
GitLabApiClient
(
apiVersion
,
hostUrl
,
privateToken
,
secretToken
,
clientConfigProperties
);
commitsApi
=
new
CommitsApi
(
this
);
commitsApi
=
new
CommitsApi
(
this
);
deployKeysApi
=
new
DeployKeysApi
(
this
);
deployKeysApi
=
new
DeployKeysApi
(
this
);
eventsApi
=
new
EventsApi
(
this
);
groupApi
=
new
GroupApi
(
this
);
groupApi
=
new
GroupApi
(
this
);
issuesApi
=
new
IssuesApi
(
this
);
jobApi
=
new
JobApi
(
this
);
mergeRequestApi
=
new
MergeRequestApi
(
this
);
mergeRequestApi
=
new
MergeRequestApi
(
this
);
namespaceApi
=
new
NamespaceApi
(
this
);
namespaceApi
=
new
NamespaceApi
(
this
);
notesApi
=
new
NotesApi
(
this
);
pipelineApi
=
new
PipelineApi
(
this
);
pipelineApi
=
new
PipelineApi
(
this
);
projectApi
=
new
ProjectApi
(
this
);
projectApi
=
new
ProjectApi
(
this
);
repositoryApi
=
new
RepositoryApi
(
this
);
repositoryApi
=
new
RepositoryApi
(
this
);
repositoryFileApi
=
new
RepositoryFileApi
(
this
);
servicesApi
=
new
ServicesApi
(
this
);
servicesApi
=
new
ServicesApi
(
this
);
sessoinApi
=
new
SessionApi
(
this
);
sessoinApi
=
new
SessionApi
(
this
);
userApi
=
new
UserApi
(
this
);
userApi
=
new
UserApi
(
this
);
repositoryFileApi
=
new
RepositoryFileApi
(
this
);
jobApi
=
new
JobApi
(
this
);
notesApi
=
new
NotesApi
(
this
);
eventsApi
=
new
EventsApi
(
this
);
}
}
/**
/**
...
@@ -305,6 +307,46 @@ public class GitLabApi {
...
@@ -305,6 +307,46 @@ public class GitLabApi {
return
(
deployKeysApi
);
return
(
deployKeysApi
);
}
}
/**
* Gets the EventsApi instance owned by this GitLabApi instance. The EventsApi is used
* to perform all events related API calls.
*
* @return the EventsApi instance owned by this GitLabApi instance
*/
public
EventsApi
getEventsApi
()
{
return
(
eventsApi
);
}
/**
* Gets the GroupApi instance owned by this GitLabApi instance. The GroupApi is used
* to perform all group related API calls.
*
* @return the GroupApi instance owned by this GitLabApi instance
*/
public
GroupApi
getGroupApi
()
{
return
(
groupApi
);
}
/**
* Gets the IssuesApi instance owned by this GitLabApi instance. The IssuesApi is used
* to perform all iossue related API calls.
*
* @return the CommitsApi instance owned by this GitLabApi instance
*/
public
IssuesApi
getIssuesApi
()
{
return
(
issuesApi
);
}
/**
* Gets the JobApi instance owned by this GitLabApi instance. The JobApi is used
* to perform all jobs related API calls.
*
* @return the JobsApi instance owned by this GitLabApi instance
*/
public
JobApi
getJobApi
()
{
return
(
jobApi
);
}
/**
/**
* Gets the MergeRequestApi instance owned by this GitLabApi instance. The MergeRequestApi is used
* Gets the MergeRequestApi instance owned by this GitLabApi instance. The MergeRequestApi is used
* to perform all merge request related API calls.
* to perform all merge request related API calls.
...
@@ -330,13 +372,13 @@ public class GitLabApi {
...
@@ -330,13 +372,13 @@ public class GitLabApi {
}
}
/**
/**
* Gets the
Group
Api instance owned by this GitLabApi instance. The
Group
Api is used
* Gets the
Notes
Api instance owned by this GitLabApi instance. The
Notes
Api is used
* to perform all
group
related API calls.
* to perform all
notes
related API calls.
*
*
* @return the
Group
Api instance owned by this GitLabApi instance
* @return the
Notes
Api instance owned by this GitLabApi instance
*/
*/
public
Group
Api
get
Group
Api
()
{
public
Notes
Api
get
Notes
Api
()
{
return
(
group
Api
);
return
(
notes
Api
);
}
}
/**
/**
...
@@ -408,34 +450,4 @@ public class GitLabApi {
...
@@ -408,34 +450,4 @@ public class GitLabApi {
public
UserApi
getUserApi
()
{
public
UserApi
getUserApi
()
{
return
(
userApi
);
return
(
userApi
);
}
}
/**
* Gets the JobApi instance owned by this GitLabApi instance. The JobApi is used
* to perform all jobs related API calls.
*
* @return the JobsApi instance owned by this GitLabApi instance
*/
public
JobApi
getJobApi
()
{
return
(
jobApi
);
}
/**
* Gets the NotesApi instance owned by this GitLabApi instance. The NotesApi is used
* to perform all notes related API calls.
*
* @return the NotesApi instance owned by this GitLabApi instance
*/
public
NotesApi
getNotesApi
()
{
return
(
notesApi
);
}
/**
* Gets the EventsApi instance owned by this GitLabApi instance. The EventsApi is used
* to perform all events related API calls.
*
* @return the EventsApi instance owned by this GitLabApi instance
*/
public
EventsApi
getEventsApi
()
{
return
(
eventsApi
);
}
}
}
src/main/java/org/gitlab4j/api/ProjectApi.java
View file @
a8cd89f9
...
@@ -1225,6 +1225,7 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1225,6 +1225,7 @@ public class ProjectApi extends AbstractApi implements Constants {
* @param projectId the project ID to get the issues for
* @param projectId the project ID to get the issues for
* @return a list of project's issues
* @return a list of project's issues
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
* @deprecated Will be removed in version 5.0, replaced by {@link IssuesApi#getIssues(Integer)}
*/
*/
public
List
<
Issue
>
getIssues
(
Integer
projectId
)
throws
GitLabApiException
{
public
List
<
Issue
>
getIssues
(
Integer
projectId
)
throws
GitLabApiException
{
Response
response
=
get
(
Response
.
Status
.
OK
,
getDefaultPerPageParam
(),
"projects"
,
projectId
,
"issues"
);
Response
response
=
get
(
Response
.
Status
.
OK
,
getDefaultPerPageParam
(),
"projects"
,
projectId
,
"issues"
);
...
@@ -1241,6 +1242,7 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1241,6 +1242,7 @@ public class ProjectApi extends AbstractApi implements Constants {
* @param perPage the number of issues per page
* @param perPage the number of issues per page
* @return the list of issues in the specified range
* @return the list of issues in the specified range
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
* @deprecated Will be removed in version 5.0, replaced by {@link IssuesApi#getIssues(Integer, int, int)}
*/
*/
public
List
<
Issue
>
getIssues
(
Integer
projectId
,
int
page
,
int
perPage
)
throws
GitLabApiException
{
public
List
<
Issue
>
getIssues
(
Integer
projectId
,
int
page
,
int
perPage
)
throws
GitLabApiException
{
Response
response
=
get
(
Response
.
Status
.
OK
,
getPageQueryParams
(
page
,
perPage
),
"projects"
,
projectId
,
"issues"
);
Response
response
=
get
(
Response
.
Status
.
OK
,
getPageQueryParams
(
page
,
perPage
),
"projects"
,
projectId
,
"issues"
);
...
@@ -1256,6 +1258,7 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1256,6 +1258,7 @@ public class ProjectApi extends AbstractApi implements Constants {
* @param itemsPerPage the number of issues per page
* @param itemsPerPage the number of issues per page
* @return the list of issues in the specified range
* @return the list of issues in the specified range
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
* @deprecated Will be removed in version 5.0, replaced by {@link IssuesApi#getIssues(Integer, int)}
*/
*/
public
Pager
<
Issue
>
getIssues
(
Integer
projectId
,
int
itemsPerPage
)
throws
GitLabApiException
{
public
Pager
<
Issue
>
getIssues
(
Integer
projectId
,
int
itemsPerPage
)
throws
GitLabApiException
{
return
(
new
Pager
<
Issue
>(
this
,
Issue
.
class
,
itemsPerPage
,
null
,
"projects"
,
projectId
,
"issues"
));
return
(
new
Pager
<
Issue
>(
this
,
Issue
.
class
,
itemsPerPage
,
null
,
"projects"
,
projectId
,
"issues"
));
...
@@ -1270,6 +1273,7 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1270,6 +1273,7 @@ public class ProjectApi extends AbstractApi implements Constants {
* @param issueId the internal ID of a project's issue
* @param issueId the internal ID of a project's issue
* @return the specified Issue instance
* @return the specified Issue instance
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
* @deprecated Will be removed in version 5.0, replaced by {@link IssuesApi#getIssue(Integer, Integer)}
*/
*/
public
Issue
getIssue
(
Integer
projectId
,
Integer
issueId
)
throws
GitLabApiException
{
public
Issue
getIssue
(
Integer
projectId
,
Integer
issueId
)
throws
GitLabApiException
{
Response
response
=
get
(
Response
.
Status
.
OK
,
getDefaultPerPageParam
(),
"projects"
,
projectId
,
"issues"
,
issueId
);
Response
response
=
get
(
Response
.
Status
.
OK
,
getDefaultPerPageParam
(),
"projects"
,
projectId
,
"issues"
,
issueId
);
...
@@ -1284,6 +1288,7 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1284,6 +1288,7 @@ public class ProjectApi extends AbstractApi implements Constants {
* @param projectId the project ID to delete the issue from
* @param projectId the project ID to delete the issue from
* @param issueId the internal ID of a project's issue
* @param issueId the internal ID of a project's issue
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
* @deprecated Will be removed in version 5.0, replaced by {@link IssuesApi#deleteIssue(Integer, Integer)}
*/
*/
public
void
deleteIssue
(
Integer
projectId
,
Integer
issueId
)
throws
GitLabApiException
{
public
void
deleteIssue
(
Integer
projectId
,
Integer
issueId
)
throws
GitLabApiException
{
Response
.
Status
expectedStatus
=
(
isApiVersion
(
ApiVersion
.
V3
)
?
Response
.
Status
.
OK
:
Response
.
Status
.
NO_CONTENT
);
Response
.
Status
expectedStatus
=
(
isApiVersion
(
ApiVersion
.
V3
)
?
Response
.
Status
.
OK
:
Response
.
Status
.
NO_CONTENT
);
...
...
src/main/java/org/gitlab4j/api/models/Issue.java
View file @
a8cd89f9
...
@@ -8,6 +8,8 @@ import javax.xml.bind.annotation.XmlAccessType;
...
@@ -8,6 +8,8 @@ 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
;
import
org.gitlab4j.api.Constants.IssueState
;
@XmlRootElement
@XmlRootElement
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
public
class
Issue
{
public
class
Issue
{
...
@@ -22,13 +24,14 @@ public class Issue {
...
@@ -22,13 +24,14 @@ public class Issue {
private
Integer
iid
;
private
Integer
iid
;
private
List
<
String
>
labels
;
private
List
<
String
>
labels
;
private
Milestone
milestone
;
private
Milestone
milestone
;
private
Integer
project
_i
d
;
private
Integer
project
I
d
;
private
String
state
;
private
IssueState
state
;
private
Boolean
subscribed
;
private
Boolean
subscribed
;
private
String
title
;
private
String
title
;
private
Date
updatedAt
;
private
Date
updatedAt
;
private
Integer
userNotesCount
;
private
Integer
userNotesCount
;
private
String
webUrl
;
private
String
webUrl
;
private
TimeStats
timeStats
;
public
Assignee
getAssignee
()
{
public
Assignee
getAssignee
()
{
return
assignee
;
return
assignee
;
...
@@ -110,19 +113,19 @@ public class Issue {
...
@@ -110,19 +113,19 @@ public class Issue {
this
.
milestone
=
milestone
;
this
.
milestone
=
milestone
;
}
}
public
Integer
getProject
_i
d
()
{
public
Integer
getProject
I
d
()
{
return
project
_i
d
;
return
project
I
d
;
}
}
public
void
setProject
_i
d
(
Integer
project
_i
d
)
{
public
void
setProject
I
d
(
Integer
project
I
d
)
{
this
.
project
_i
d
=
project
_i
d
;
this
.
project
I
d
=
project
I
d
;
}
}
public
String
getState
()
{
public
IssueState
getState
()
{
return
state
;
return
state
;
}
}
public
void
setState
(
String
state
)
{
public
void
setState
(
IssueState
state
)
{
this
.
state
=
state
;
this
.
state
=
state
;
}
}
...
@@ -165,4 +168,12 @@ public class Issue {
...
@@ -165,4 +168,12 @@ public class Issue {
public
void
setWebUrl
(
String
webUrl
)
{
public
void
setWebUrl
(
String
webUrl
)
{
this
.
webUrl
=
webUrl
;
this
.
webUrl
=
webUrl
;
}
}
public
TimeStats
getTimeStats
()
{
return
timeStats
;
}
public
void
setTimeStats
(
TimeStats
timeStats
)
{
this
.
timeStats
=
timeStats
;
}
}
}
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