public class MergeRequestApi extends AbstractApi
Constants.ActionType, Constants.ArchiveFormat, Constants.EpicOrderBy, Constants.GroupOrderBy, Constants.ImpersonationState, Constants.IssueOrderBy, Constants.IssueScope, Constants.IssueState, Constants.JobScope, Constants.LineType, Constants.MergeRequestOrderBy, Constants.MergeRequestScope, Constants.MergeRequestState, Constants.MilestoneState, 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 mergeRequestIid)
Merge changes to the merge request.
|
MergeRequest |
acceptMergeRequest(Integer projectId,
Integer mergeRequestIid,
String mergeCommitMessage,
Boolean shouldRemoveSourceBranch,
Boolean mergeWhenPipelineSucceeds)
Merge changes to the merge request.
|
MergeRequest |
acceptMergeRequest(Integer projectId,
Integer mergeRequestIid,
String mergeCommitMessage,
Boolean shouldRemoveSourceBranch,
Boolean mergeWhenPipelineSucceeds,
String sha)
Merge changes to the merge request.
|
MergeRequest |
approveMergeRequest(Integer projectId,
Integer mergeRequestIid,
String sha)
Approve a merge request.
|
MergeRequest |
cancelMergeRequest(Integer projectId,
Integer mergeRequestIid)
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.
|
MergeRequest |
createMergeRequest(Integer projectId,
String sourceBranch,
String targetBranch,
String title,
String description,
Integer assigneeId,
Integer targetProjectId,
String[] labels,
Integer milestoneId,
Boolean removeSourceBranch)
Creates a merge request and optionally assigns a reviewer to it.
|
MergeRequest |
createMergeRequest(Integer projectId,
String sourceBranch,
String targetBranch,
String title,
String description,
Integer assigneeId,
Integer targetProjectId,
String[] labels,
Integer milestoneId,
Boolean removeSourceBranch,
Boolean squash)
Creates a merge request and optionally assigns a reviewer to it.
|
void |
deleteMergeRequest(Integer projectId,
Integer mergeRequestIid)
Only for admins and project owners.
|
List<Issue> |
getClosesIssues(Object projectIdOrPath,
Integer mergeRequestIid)
Get list containing all the issues that would be closed by merging the provided merge requestt.
|
Pager<Issue> |
getClosesIssues(Object projectIdOrPath,
Integer mergeRequestIid,
int itemsPerPage)
Get a Pager containing all the issues that would be closed by merging the provided merge request.
|
List<Issue> |
getClosesIssues(Object projectIdOrPath,
Integer mergeRequestIid,
int page,
int perPage)
Get list containing all the issues that would be closed by merging the provided merge request.
|
List<Commit> |
getCommits(int projectId,
int mergeRequestIid)
Get a list of merge request commits.
|
Pager<Commit> |
getCommits(int projectId,
int mergeRequestIid,
int itemsPerPage)
Get a Pager of merge request commits.
|
List<Commit> |
getCommits(int projectId,
int mergeRequestIid,
int page,
int perPage)
Get a list of merge request commits.
|
MergeRequest |
getMergeRequest(Integer projectId,
Integer mergeRequestIid)
Get information about a single merge request.
|
MergeRequest |
getMergeRequestApprovals(Integer projectId,
Integer mergeRequestIid)
Get the merge request with approval information.
|
MergeRequest |
getMergeRequestChanges(Integer projectId,
Integer mergeRequestIid)
Get merge request with changes information.
|
List<MergeRequest> |
getMergeRequests(Integer projectId)
Get all merge requests for the specified project.
|
List<MergeRequest> |
getMergeRequests(Integer projectId,
Constants.MergeRequestState state)
Get all merge requests with a specific state for the specified project.
|
Pager<MergeRequest> |
getMergeRequests(Integer projectId,
Constants.MergeRequestState state,
int itemsPerPage)
Get all merge requests for the specified project.
|
List<MergeRequest> |
getMergeRequests(Integer projectId,
Constants.MergeRequestState state,
int page,
int perPage)
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.
|
List<MergeRequest> |
getMergeRequests(MergeRequestFilter filter)
Get all merge requests matching the filter.
|
Pager<MergeRequest> |
getMergeRequests(MergeRequestFilter filter,
int itemsPerPage)
Get all merge requests matching the filter.
|
List<MergeRequest> |
getMergeRequests(MergeRequestFilter filter,
int page,
int perPage)
Get all merge requests matching the filter.
|
Optional<MergeRequest> |
getOptionalMergeRequest(Integer projectId,
Integer mergeRequestIid)
Get information about a single merge request as an Optional instance.
|
List<Participant> |
getParticipants(Integer projectId,
Integer mergeRequestIid)
Get list of participants of merge request.
|
Pager<Participant> |
getParticipants(Integer projectId,
Integer mergeRequestIid,
int itemsPerPage)
Get a Pager of the participants of merge request.
|
List<Participant> |
getParticipants(Integer projectId,
Integer mergeRequestIid,
int page,
int perPage)
Get list of participants of merge request and in the specified page range.
|
MergeRequest |
unapproveMergeRequest(Integer projectId,
Integer mergeRequestIid)
Unapprove a merge request.
|
protected MergeRequest |
updateMergeRequest(Integer projectId,
Integer mergeRequestIid,
javax.ws.rs.core.Form formData) |
MergeRequest |
updateMergeRequest(Integer projectId,
Integer mergeRequestIid,
String targetBranch,
String title,
Integer assigneeId,
String description,
Constants.StateEvent stateEvent,
String labels,
Integer milestoneId)
Deprecated.
|
MergeRequest |
updateMergeRequest(Integer projectId,
Integer mergeRequestIid,
String targetBranch,
String title,
Integer assigneeId,
String description,
Constants.StateEvent stateEvent,
String labels,
Integer milestoneId,
Boolean removeSourceBranch,
Boolean squash,
Boolean discussionLocked,
Boolean allowCollaboration)
Updates an existing merge request.
|
MergeRequest |
updateMergeRequest(Integer projectId,
Integer mergeRequestIid,
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, getDefaultPerPageParam, getGroupIdOrPath, getPageQueryParams, getPageQueryParams, getProjectIdOrPath, getUserIdOrUsername, getWithAccepts, handle, head, isApiVersion, post, post, post, post, post, put, put, putWithFormData, upload, upload, urlEncode, validate
public MergeRequestApi(GitLabApi gitLabApi)
public List<MergeRequest> getMergeRequests(MergeRequestFilter filter) throws GitLabApiException
filter
- a MergeRequestFilter instance with the filter settingsGitLabApiException
- if any exception occurspublic List<MergeRequest> getMergeRequests(MergeRequestFilter filter, int page, int perPage) throws GitLabApiException
filter
- a MergeRequestFilter instance with the filter settingspage
- the page to getperPage
- the number of MergeRequest instances per pageGitLabApiException
- if any exception occurspublic Pager<MergeRequest> getMergeRequests(MergeRequestFilter filter, int itemsPerPage) throws GitLabApiException
filter
- a MergeRequestFilter instance with the filter settingsitemsPerPage
- the number of MergeRequest instances that will be fetched per pageGitLabApiException
- if any exception occurspublic 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 List<MergeRequest> getMergeRequests(Integer projectId, Constants.MergeRequestState state) throws GitLabApiException
projectId
- the project ID to get the merge requests forstate
- the state parameter can be used to get only merge requests with a given state (opened, closed, or merged) or all of them (all).GitLabApiException
- if any exception occurspublic List<MergeRequest> getMergeRequests(Integer projectId, Constants.MergeRequestState state, int page, int perPage) throws GitLabApiException
projectId
- the project ID to get the merge requests forstate
- the state parameter can be used to get only merge requests with a given state (opened, closed, or merged) or all of them (all).page
- the page to getperPage
- the number of MergeRequest instances per pageGitLabApiException
- if any exception occurspublic Pager<MergeRequest> getMergeRequests(Integer projectId, Constants.MergeRequestState state, int itemsPerPage) throws GitLabApiException
projectId
- the project ID to get the merge requests forstate
- the state parameter can be used to get only merge requests with a given state (opened, closed, or merged) or all of them (all).itemsPerPage
- the number of MergeRequest instances that will be fetched per pageGitLabApiException
- if any exception occurspublic MergeRequest getMergeRequest(Integer projectId, Integer mergeRequestIid) throws GitLabApiException
NOTE: GitLab API V4 uses IID (internal ID), V3 uses ID to identify the merge request.
GET /projects/:id/merge_requests/:merge_request_idprojectId
- the project ID of the merge requestmergeRequestIid
- the internal ID of the merge requestGitLabApiException
- if any exception occurspublic Optional<MergeRequest> getOptionalMergeRequest(Integer projectId, Integer mergeRequestIid)
NOTE: GitLab API V4 uses IID (internal ID), V3 uses ID to identify the merge request.
GET /projects/:id/merge_requests/:merge_request_idprojectId
- the project ID of the merge requestmergeRequestIid
- the internal ID of the merge requestpublic List<Commit> getCommits(int projectId, int mergeRequestIid) throws GitLabApiException
NOTE: GitLab API V4 uses IID (internal ID), V3 uses ID to identify the merge request.
GET /projects/:id/merge_requests/:merge_request_iid/commitsprojectId
- the project ID for the merge requestmergeRequestIid
- the internal ID of the merge requestGitLabApiException
- GitLabApiException if any exception occurs during executionpublic List<Commit> getCommits(int projectId, int mergeRequestIid, int page, int perPage) throws GitLabApiException
NOTE: GitLab API V4 uses IID (internal ID), V3 uses ID to identify the merge request.
GET /projects/:id/merge_requests/:merge_request_iid/commitsprojectId
- the project ID for the merge requestmergeRequestIid
- the internal 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 mergeRequestIid, int itemsPerPage) throws GitLabApiException
NOTE: GitLab API V4 uses IID (internal ID), V3 uses ID to identify the merge request.
GET /projects/:id/merge_requests/:merge_request_iid/commitsprojectId
- the project ID for the merge requestmergeRequestIid
- the internal 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, Integer targetProjectId, String[] labels, Integer milestoneId, Boolean removeSourceBranch, Boolean squash) 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, optionaltargetProjectId
- the ID of a target project, optionallabels
- labels for MR, optionalmilestoneId
- the ID of a milestone, optionalremoveSourceBranch
- Flag indicating if a merge request should remove the source branch when merging, optionalsquash
- Squash commits into a single commit when merging, optionalGitLabApiException
- if any exception occurspublic MergeRequest createMergeRequest(Integer projectId, String sourceBranch, String targetBranch, String title, String description, Integer assigneeId, Integer targetProjectId, String[] labels, Integer milestoneId, Boolean removeSourceBranch) 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, optionaltargetProjectId
- the ID of a target project, optionallabels
- labels for MR, optionalmilestoneId
- the ID of a milestone, optionalremoveSourceBranch
- Flag indicating if a merge request should remove the source branch when merging, optionalGitLabApiException
- if any exception occurspublic 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 mergeRequestIid, String targetBranch, String title, Integer assigneeId, String description, Constants.StateEvent stateEvent, String labels, Integer milestoneId, Boolean removeSourceBranch, Boolean squash, Boolean discussionLocked, Boolean allowCollaboration) throws GitLabApiException
NOTE: GitLab API V4 uses IID (internal ID), V3 uses ID to identify the merge request.
PUT /projects/:id/merge_requests/:merge_request_iidprojectId
- the ID of a projectmergeRequestIid
- 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, optionalremoveSourceBranch
- Flag indicating if a merge request should remove the source
branch when merging, optionalsquash
- Squash commits into a single commit when merging, optionaldiscussionLocked
- Flag indicating if the merge request's discussion is locked, optionalallowCollaboration
- Allow commits from members who can merge to the target branch,
optionalGitLabApiException
- if any exception occurs@Deprecated public MergeRequest updateMergeRequest(Integer projectId, Integer mergeRequestIid, String targetBranch, String title, Integer assigneeId, String description, Constants.StateEvent stateEvent, String labels, Integer milestoneId) throws GitLabApiException
NOTE: GitLab API V4 uses IID (internal ID), V3 uses ID to identify the merge request.
PUT /projects/:id/merge_requests/:merge_request_iidprojectId
- the ID of a projectmergeRequestIid
- 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 mergeRequestIid, String sourceBranch, String targetBranch, String title, String description, Integer assigneeId) throws GitLabApiException
NOTE: GitLab API V4 uses IID (internal ID), V3 uses ID to identify the merge request.
PUT /projects/:id/merge_requests/:merge_request_iidprojectId
- the ID of a projectmergeRequestIid
- the internal 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 occursprotected MergeRequest updateMergeRequest(Integer projectId, Integer mergeRequestIid, javax.ws.rs.core.Form formData) throws GitLabApiException
GitLabApiException
public void deleteMergeRequest(Integer projectId, Integer mergeRequestIid) throws GitLabApiException
NOTE: GitLab API V4 uses IID (internal ID), V3 uses ID to identify the merge request.
DELETE /projects/:id/merge_requests/:merge_request_iidprojectId
- the ID of a projectmergeRequestIid
- the internal ID of the merge requestGitLabApiException
- if any exception occurspublic MergeRequest acceptMergeRequest(Integer projectId, Integer mergeRequestIid) throws GitLabApiException
NOTE: GitLab API V4 uses IID (internal ID), V3 uses ID to identify the merge request.
PUT /projects/:id/merge_requests/:merge_request_iid/mergeprojectId
- the ID of a projectmergeRequestIid
- the internal ID of the merge requestGitLabApiException
- if any exception occurspublic MergeRequest acceptMergeRequest(Integer projectId, Integer mergeRequestIid, String mergeCommitMessage, Boolean shouldRemoveSourceBranch, Boolean mergeWhenPipelineSucceeds) throws GitLabApiException
NOTE: GitLab API V4 uses IID (internal ID), V3 uses ID to identify the merge request. Additionally, mergeWhenPipelineSucceeds sets the merge_when_build_succeeds flag for GitLab API V3.
PUT /projects/:id/merge_requests/:merge_request_iid/mergeprojectId
- the ID of a projectmergeRequestIid
- 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 acceptMergeRequest(Integer projectId, Integer mergeRequestIid, String mergeCommitMessage, Boolean shouldRemoveSourceBranch, Boolean mergeWhenPipelineSucceeds, String sha) throws GitLabApiException
NOTE: GitLab API V4 uses IID (internal ID), V3 uses ID to identify the merge request. Additionally, mergeWhenPipelineSucceeds sets the merge_when_build_succeeds flag for GitLab API V3.
PUT /projects/:id/merge_requests/:merge_request_iid/mergeprojectId
- the ID of a projectmergeRequestIid
- 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, optionalsha
- if present, then this SHA must match the HEAD of the source branch, otherwise the merge will fail, optionalGitLabApiException
- if any exception occurspublic MergeRequest cancelMergeRequest(Integer projectId, Integer mergeRequestIid) throws GitLabApiException
NOTE: GitLab API V4 uses IID (internal ID), V3 uses ID to identify the merge request.
PUT /projects/:id/merge_requests/:merge_request_iid/cancel_merge_when_pipeline_succeedsprojectId
- the ID of a projectmergeRequestIid
- the internal ID of the merge requestGitLabApiException
- if any exception occurspublic MergeRequest getMergeRequestApprovals(Integer projectId, Integer mergeRequestIid) throws GitLabApiException
projectId
- the project ID of the merge requestmergeRequestIid
- the internal ID of the merge requestGitLabApiException
- if any exception occurspublic MergeRequest approveMergeRequest(Integer projectId, Integer mergeRequestIid, String sha) throws GitLabApiException
projectId
- the project ID of the merge requestmergeRequestIid
- the internal ID of the merge requestsha
- the HEAD of the merge request, optionalGitLabApiException
- if any exception occurspublic MergeRequest unapproveMergeRequest(Integer projectId, Integer mergeRequestIid) throws GitLabApiException
projectId
- the project ID of the merge requestmergeRequestIid
- the internal ID of the merge requestGitLabApiException
- if any exception occurspublic MergeRequest getMergeRequestChanges(Integer projectId, Integer mergeRequestIid) throws GitLabApiException
projectId
- the project ID to get the merge requests formergeRequestIid
- the IID of the merge request to getGitLabApiException
- if any exception occurspublic List<Participant> getParticipants(Integer projectId, Integer mergeRequestIid) throws GitLabApiException
projectId
- the project ID to get the merge requests formergeRequestIid
- the IID of the merge request to getGitLabApiException
- if any exception occurspublic List<Participant> getParticipants(Integer projectId, Integer mergeRequestIid, int page, int perPage) throws GitLabApiException
projectId
- the project ID to get the merge requests formergeRequestIid
- the IID of the merge request to getpage
- the page to getperPage
- the number of projects per pageGitLabApiException
- if any exception occurspublic Pager<Participant> getParticipants(Integer projectId, Integer mergeRequestIid, int itemsPerPage) throws GitLabApiException
projectId
- the project ID to get the merge requests formergeRequestIid
- the IID of the merge request to getitemsPerPage
- the number of Participant instances that will be fetched per pageGitLabApiException
- if any exception occurspublic List<Issue> getClosesIssues(Object projectIdOrPath, Integer mergeRequestIid) throws GitLabApiException
GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid/closes_issues
projectIdOrPath
- id, path of the project, or a Project instance holding the project ID or pathmergeRequestIid
- the IID of the merge request to get the closes issues forGitLabApiException
- if any exception occurspublic List<Issue> getClosesIssues(Object projectIdOrPath, Integer mergeRequestIid, int page, int perPage) throws GitLabApiException
GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid/closes_issues
projectIdOrPath
- id, path of the project, or a Project instance holding the project ID or pathmergeRequestIid
- the IID of the merge request to get the closes issues forpage
- the page to getperPage
- the number of issues per pageGitLabApiException
- if any exception occurspublic Pager<Issue> getClosesIssues(Object projectIdOrPath, Integer mergeRequestIid, int itemsPerPage) throws GitLabApiException
GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid/closes_issues
projectIdOrPath
- id, path of the project, or a Project instance holding the project ID or pathmergeRequestIid
- the IID of the merge request to get the closes issues foritemsPerPage
- the number of Issue instances that will be fetched per pageGitLabApiException
- if any exception occursCopyright © 2018. All rights reserved.