public class MergeRequestApi extends AbstractApi
Constants.ActionType, Constants.IssueScope, Constants.IssueState, Constants.JobScope, Constants.LineType, Constants.PipelineOrderBy, Constants.PipelineScope, Constants.ProjectOrderBy, Constants.SortOrder, Constants.StateEvent, Constants.TargetType, Constants.TokenType
NEXT_PAGE_HEADER, PAGE_HEADER, PAGE_PARAM, PER_PAGE, PER_PAGE_PARAM, PREV_PAGE_HEADER, TOTAL_HEADER, TOTAL_PAGES_HEADER
Constructor and Description |
---|
MergeRequestApi(GitLabApi gitLabApi) |
Modifier and Type | Method and Description |
---|---|
MergeRequest |
acceptMergeRequest(Integer projectId,
Integer mergeRequestId,
String mergeCommitMessage,
Boolean shouldRemoveSourceBranch,
Boolean mergeWhenPipelineSucceeds)
Merge changes to the merge request.
|
MergeRequest |
approveMergeRequest(Integer projectId,
Integer mergeRequestId,
String sha)
Approve a merge request.
|
MergeRequest |
cancelMergeRequest(Integer projectId,
Integer mergeRequestId)
Cancel merge when pipeline succeeds.
|
MergeRequest |
createMergeRequest(Integer projectId,
String sourceBranch,
String targetBranch,
String title,
String description,
Integer assigneeId)
Creates a merge request and optionally assigns a reviewer to it.
|
void |
deleteMergeRequest(Integer projectId,
Integer mergeRequestId)
Only for admins and project owners.
|
List<Commit> |
getCommits(int projectId,
int mergeRequestId)
Get a list of merge request commits.
|
Pager<Commit> |
getCommits(int projectId,
int mergeRequestId,
int itemsPerPage)
Get a Pager of merge request commits.
|
List<Commit> |
getCommits(int projectId,
int mergeRequestId,
int page,
int perPage)
Get a list of merge request commits.
|
MergeRequest |
getMergeRequest(Integer projectId,
Integer mergeRequestId)
Get information about a single merge request.
|
MergeRequest |
getMergeRequestApprovals(Integer projectId,
Integer mergeRequestId)
Get the merge request with approval information.
|
List<MergeRequest> |
getMergeRequests(Integer projectId)
Get all merge requests for the specified project.
|
Pager<MergeRequest> |
getMergeRequests(Integer projectId,
int itemsPerPage)
Get all merge requests for the specified project.
|
List<MergeRequest> |
getMergeRequests(Integer projectId,
int page,
int perPage)
Get all merge requests for the specified project.
|
MergeRequest |
unapproveMergeRequest(Integer projectId,
Integer mergeRequestId)
Unapprove a merge request.
|
MergeRequest |
updateMergeRequest(Integer projectId,
Integer mergeRequestId,
String targetBranch,
String title,
Integer assigneeId,
String description,
Constants.StateEvent stateEvent,
String labels,
Integer milestoneId)
Updates an existing merge request.
|
MergeRequest |
updateMergeRequest(Integer projectId,
Integer mergeRequestId,
String sourceBranch,
String targetBranch,
String title,
String description,
Integer assigneeId)
Deprecated.
as of release 4.4.3
|
addFormParam, addFormParam, delete, delete, get, get, getApiClient, getApiVersion, getDefaultPerPage, getDefaultPerPageParam, getPageQueryParams, getWithAccepts, handle, isApiVersion, post, post, post, put, put, putWithFormData, urlEncode, validate
public MergeRequestApi(GitLabApi gitLabApi)
public List<MergeRequest> getMergeRequests(Integer projectId) throws GitLabApiException
projectId
- the project ID to get the merge requests forGitLabApiException
- if any exception occurspublic List<MergeRequest> getMergeRequests(Integer projectId, int page, int perPage) throws GitLabApiException
projectId
- the project ID to get the merge requests forpage
- the page to getperPage
- the number of MergeRequest instances per pageGitLabApiException
- if any exception occurspublic Pager<MergeRequest> getMergeRequests(Integer projectId, int itemsPerPage) throws GitLabApiException
projectId
- the project ID to get the merge requests foritemsPerPage
- the number of MergeRequest instances that will be fetched per pageGitLabApiException
- if any exception occurspublic MergeRequest getMergeRequest(Integer projectId, Integer mergeRequestId) throws GitLabApiException
projectId
- the project ID of the merge requestmergeRequestId
- the ID of the merge requestGitLabApiException
- if any exception occurspublic List<Commit> getCommits(int projectId, int mergeRequestId) throws GitLabApiException
projectId
- the project ID for the merge requestmergeRequestId
- the ID of the merge requestGitLabApiException
- GitLabApiException if any exception occurs during executionpublic List<Commit> getCommits(int projectId, int mergeRequestId, int page, int perPage) throws GitLabApiException
projectId
- the project ID for the merge requestmergeRequestId
- the ID of the merge requestpage
- the page to getperPage
- the number of commits per pageGitLabApiException
- GitLabApiException if any exception occurs during executionpublic Pager<Commit> getCommits(int projectId, int mergeRequestId, int itemsPerPage) throws GitLabApiException
projectId
- the project ID for the merge requestmergeRequestId
- the ID of the merge requestitemsPerPage
- the number of Commit instances that will be fetched per pageGitLabApiException
- GitLabApiException if any exception occurs during executionpublic MergeRequest createMergeRequest(Integer projectId, String sourceBranch, String targetBranch, String title, String description, Integer assigneeId) throws GitLabApiException
projectId
- the ID of a project, requiredsourceBranch
- the source branch, requiredtargetBranch
- the target branch, requiredtitle
- the title for the merge request, requireddescription
- the description of the merge requestassigneeId
- the Assignee user ID, optionalGitLabApiException
- if any exception occurspublic MergeRequest updateMergeRequest(Integer projectId, Integer mergeRequestId, String targetBranch, String title, Integer assigneeId, String description, Constants.StateEvent stateEvent, String labels, Integer milestoneId) throws GitLabApiException
projectId
- the ID of a projectmergeRequestId
- the internal ID of the merge request to updatetargetBranch
- the target branch, optionaltitle
- the title for the merge requestassigneeId
- the Assignee user ID, optionaldescription
- the description of the merge request, optionalstateEvent
- new state for the merge request, optionallabels
- comma separated list of labels, optionalmilestoneId
- the ID of a milestone, optionalGitLabApiException
- if any exception occurs@Deprecated public MergeRequest updateMergeRequest(Integer projectId, Integer mergeRequestId, String sourceBranch, String targetBranch, String title, String description, Integer assigneeId) throws GitLabApiException
projectId
- the ID of a projectmergeRequestId
- the ID of the merge request to updatesourceBranch
- the source branchtargetBranch
- the target branchtitle
- the title for the merge requestdescription
- the description of the merge requestassigneeId
- the Assignee user ID, optionalGitLabApiException
- if any exception occurspublic void deleteMergeRequest(Integer projectId, Integer mergeRequestId) throws GitLabApiException
projectId
- the ID of a projectmergeRequestId
- the internal ID of the merge request\GitLabApiException
- if any exception occurspublic MergeRequest acceptMergeRequest(Integer projectId, Integer mergeRequestId, String mergeCommitMessage, Boolean shouldRemoveSourceBranch, Boolean mergeWhenPipelineSucceeds) throws GitLabApiException
projectId
- the ID of a projectmergeRequestId
- the internal ID of the merge requestmergeCommitMessage,
- custom merge commit message, optionalshouldRemoveSourceBranch,
- if true removes the source branch, optionalmergeWhenPipelineSucceeds,
- if true the MR is merged when the pipeline, optionalGitLabApiException
- if any exception occurspublic MergeRequest cancelMergeRequest(Integer projectId, Integer mergeRequestId) throws GitLabApiException
projectId
- the ID of a projectmergeRequestId
- the internal ID of the merge requestGitLabApiException
- if any exception occurspublic MergeRequest getMergeRequestApprovals(Integer projectId, Integer mergeRequestId) throws GitLabApiException
projectId
- the project ID of the merge requestmergeRequestId
- the internal ID of the merge requestGitLabApiException
- if any exception occurspublic MergeRequest approveMergeRequest(Integer projectId, Integer mergeRequestId, String sha) throws GitLabApiException
projectId
- the project ID of the merge requestmergeRequestId
- the internal ID of the merge requestsha
- the HEAD of the merge request, optionalGitLabApiException
- if any exception occurspublic MergeRequest unapproveMergeRequest(Integer projectId, Integer mergeRequestId) throws GitLabApiException
projectId
- the project ID of the merge requestmergeRequestId
- the internal ID of the merge requestGitLabApiException
- if any exception occursCopyright © 2017. All rights reserved.