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

Added getOptionalMergeRequest().

parent a5c86202
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.
*
......
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