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
e0eb2cce
Commit
e0eb2cce
authored
Dec 17, 2017
by
Greg Messner
Browse files
Consolidated method calls.
parent
067a73d9
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/gitlab4j/api/Constants.java
View file @
e0eb2cce
...
@@ -171,6 +171,7 @@ public interface Constants {
...
@@ -171,6 +171,7 @@ public interface Constants {
/** Enum to use for querying the state of a MergeRequest */
/** Enum to use for querying the state of a MergeRequest */
public
enum
MergeRequestState
{
public
enum
MergeRequestState
{
OPENED
,
CLOSED
,
MERGED
,
ALL
;
OPENED
,
CLOSED
,
MERGED
,
ALL
;
private
static
JacksonJsonEnumHelper
<
MergeRequestState
>
enumHelper
=
new
JacksonJsonEnumHelper
<>(
MergeRequestState
.
class
);
private
static
JacksonJsonEnumHelper
<
MergeRequestState
>
enumHelper
=
new
JacksonJsonEnumHelper
<>(
MergeRequestState
.
class
);
...
@@ -178,7 +179,6 @@ public interface Constants {
...
@@ -178,7 +179,6 @@ public interface Constants {
@JsonCreator
@JsonCreator
public
static
MergeRequestState
forValue
(
String
value
)
{
return
enumHelper
.
forValue
(
value
);
}
public
static
MergeRequestState
forValue
(
String
value
)
{
return
enumHelper
.
forValue
(
value
);
}
@JsonValue
@JsonValue
public
String
toValue
()
{
public
String
toValue
()
{
return
(
enumHelper
.
toString
(
this
));
return
(
enumHelper
.
toString
(
this
));
...
@@ -190,7 +190,6 @@ public interface Constants {
...
@@ -190,7 +190,6 @@ public interface Constants {
}
}
}
}
/** Enum to use for specifying the state of a merge request or issue update. */
/** Enum to use for specifying the state of a merge request or issue update. */
public
enum
StateEvent
{
public
enum
StateEvent
{
...
...
src/main/java/org/gitlab4j/api/MergeRequestApi.java
View file @
e0eb2cce
...
@@ -29,8 +29,7 @@ public class MergeRequestApi extends AbstractApi {
...
@@ -29,8 +29,7 @@ public class MergeRequestApi extends AbstractApi {
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
List
<
MergeRequest
>
getMergeRequests
(
Integer
projectId
)
throws
GitLabApiException
{
public
List
<
MergeRequest
>
getMergeRequests
(
Integer
projectId
)
throws
GitLabApiException
{
Response
response
=
get
(
Response
.
Status
.
OK
,
getDefaultPerPageParam
(),
"projects"
,
projectId
,
"merge_requests"
);
return
(
getMergeRequests
(
projectId
,
1
,
getDefaultPerPage
()));
return
(
response
.
readEntity
(
new
GenericType
<
List
<
MergeRequest
>>()
{}));
}
}
/**
/**
...
@@ -64,60 +63,55 @@ public class MergeRequestApi extends AbstractApi {
...
@@ -64,60 +63,55 @@ public class MergeRequestApi extends AbstractApi {
}
}
/**
/**
* Get all merge requests for the specified project.
* Get all merge requests
with a specific state
for the specified project.
*
*
* GET /projects/:id/merge_requests
* GET /projects/:id/merge_requests
?state=:state
*
*
* @param projectId the project ID to get the merge requests for
* @param projectId the project ID to get the merge requests for
* @param page the page to get
* @param perPage the number of MergeRequest instances per page
* @param state the state parameter can be used to get only merge requests with a given state (opened, closed, or merged) or all of them (all).
* @param state the state parameter can be used to get only merge requests with a given state (opened, closed, or merged) or all of them (all).
* @return all merge requests for the specified project
* @return all merge requests for the specified project
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
List
<
MergeRequest
>
getMergeRequests
(
Integer
projectId
,
int
page
,
int
perPage
,
MergeRequestState
state
)
throws
GitLabApiException
{
public
List
<
MergeRequest
>
getMergeRequests
(
Integer
projectId
,
MergeRequestState
state
)
throws
GitLabApiException
{
Form
formData
=
new
GitLabApiForm
()
return
(
getMergeRequests
(
projectId
,
state
,
1
,
getDefaultPerPage
()));
.
withParam
(
"state"
,
state
)
.
withParam
(
PAGE_PARAM
,
page
)
.
withParam
(
PER_PAGE_PARAM
,
perPage
);
Response
response
=
get
(
Response
.
Status
.
OK
,
formData
.
asMap
(),
"projects"
,
projectId
,
"merge_requests"
);
return
(
response
.
readEntity
(
new
GenericType
<
List
<
MergeRequest
>>()
{}));
}
}
/**
/**
* Get all merge requests for the specified project.
* Get all merge requests for the specified project.
*
*
* GET /projects/:id/merge_requests
* GET /projects/:id/merge_requests
*
*
* @param projectId the project ID to get the merge requests for
* @param projectId the project ID to get the merge requests for
* @param itemsPerPage the number of MergeRequest instances that will be fetched per page
* @param state the state parameter can be used to get only merge requests with a given state (opened, closed, or merged) or all of them (all).
* @param state the state parameter can be used to get only merge requests with a given state (opened, closed, or merged) or all of them (all).
* @param page the page to get
* @param perPage the number of MergeRequest instances per page
* @return all merge requests for the specified project
* @return all merge requests for the specified project
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
Pager
<
MergeRequest
>
getMergeRequests
(
Integer
projectId
,
int
itemsPerPage
,
MergeRequestState
state
)
throws
GitLabApiException
{
public
List
<
MergeRequest
>
getMergeRequests
(
Integer
projectId
,
MergeRequestState
state
,
int
page
,
int
perPage
)
throws
GitLabApiException
{
Form
formData
=
new
GitLabApiForm
()
Form
formData
=
new
GitLabApiForm
()
.
withParam
(
"state"
,
state
);
.
withParam
(
"state"
,
state
)
return
(
new
Pager
<
MergeRequest
>(
this
,
MergeRequest
.
class
,
itemsPerPage
,
formData
.
asMap
(),
"projects"
,
projectId
,
"merge_requests"
));
.
withParam
(
PAGE_PARAM
,
page
)
.
withParam
(
PER_PAGE_PARAM
,
perPage
);
Response
response
=
get
(
Response
.
Status
.
OK
,
formData
.
asMap
(),
"projects"
,
projectId
,
"merge_requests"
);
return
(
response
.
readEntity
(
new
GenericType
<
List
<
MergeRequest
>>()
{}));
}
}
/**
/**
* Get all merge requests
with a specific state
for the specified project.
* Get all merge requests for the specified project.
*
*
* GET /projects/:id/merge_requests
?state=:state
* GET /projects/:id/merge_requests
*
*
* @param projectId the project ID to get the merge requests for
* @param projectId the project ID to get the merge requests for
* @param state the state parameter can be used to get only merge requests with a given state (opened, closed, or merged) or all of them (all).
* @param state the state parameter can be used to get only merge requests with a given state (opened, closed, or merged) or all of them (all).
* @param itemsPerPage the number of MergeRequest instances that will be fetched per page
* @return all merge requests for the specified project
* @return all merge requests for the specified project
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
List
<
MergeRequest
>
getMergeRequests
(
Integer
projectId
,
MergeRequestState
state
)
throws
GitLabApiException
{
public
Pager
<
MergeRequest
>
getMergeRequests
(
Integer
projectId
,
MergeRequestState
state
,
int
itemsPerPage
)
throws
GitLabApiException
{
Form
formData
=
new
GitLabApiForm
()
Form
formData
=
new
GitLabApiForm
()
.
withParam
(
"state"
,
state
)
.
withParam
(
"state"
,
state
);
.
withParam
(
PER_PAGE_PARAM
,
getDefaultPerPage
());
return
(
new
Pager
<
MergeRequest
>(
this
,
MergeRequest
.
class
,
itemsPerPage
,
formData
.
asMap
(),
"projects"
,
projectId
,
"merge_requests"
));
Response
response
=
get
(
Response
.
Status
.
OK
,
formData
.
asMap
(),
"projects"
,
projectId
,
"merge_requests"
);
return
(
response
.
readEntity
(
new
GenericType
<
List
<
MergeRequest
>>()
{}));
}
}
/**
/**
...
...
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