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
d8f9b2f1
Commit
d8f9b2f1
authored
Feb 10, 2018
by
Greg Messner
Browse files
Added getOptionalMergeRequest().
parent
a5c86202
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/gitlab4j/api/MergeRequestApi.java
View file @
d8f9b2f1
package
org.gitlab4j.api
;
import
java.util.List
;
import
java.util.Optional
;
import
javax.ws.rs.core.Form
;
import
javax.ws.rs.core.GenericType
;
...
...
@@ -131,6 +132,25 @@ public class MergeRequestApi extends AbstractApi {
return
(
response
.
readEntity
(
MergeRequest
.
class
));
}
/**
* Get information about a single merge request as an Optional instance.
*
* <p>NOTE: GitLab API V4 uses IID (internal ID), V3 uses ID to identify the merge request.</p>
*
* GET /projects/:id/merge_requests/:merge_request_id
*
* @param projectId the project ID of the merge request
* @param mergeRequestIid the internal ID of the merge request
* @return the specified MergeRequest as an Optional instance instance
*/
public
Optional
<
MergeRequest
>
getOptionalMergeRequest
(
Integer
projectId
,
Integer
mergeRequestIid
)
{
try
{
return
(
Optional
.
ofNullable
(
getMergeRequest
(
projectId
,
mergeRequestIid
)));
}
catch
(
GitLabApiException
glae
)
{
return
(
GitLabApi
.
createOptionalFromException
(
glae
));
}
}
/**
* Get a list of merge request commits.
*
...
...
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