Class MergeRequestApi
- java.lang.Object
-
- org.gitlab4j.api.AbstractApi
-
- org.gitlab4j.api.MergeRequestApi
-
- All Implemented Interfaces:
org.gitlab4j.models.Constants
public class MergeRequestApi extends AbstractApi
This class implements the client side API for the GitLab merge request calls.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.gitlab4j.models.Constants
org.gitlab4j.models.Constants.ActionType, org.gitlab4j.models.Constants.ApplicationScope, org.gitlab4j.models.Constants.ArchiveFormat, org.gitlab4j.models.Constants.AutoCancelPendingPipelines, org.gitlab4j.models.Constants.AutoDevopsDeployStrategy, org.gitlab4j.models.Constants.BuildGitStrategy, org.gitlab4j.models.Constants.CommitBuildState, org.gitlab4j.models.Constants.ContributorOrderBy, org.gitlab4j.models.Constants.DefaultBranchProtectionLevel, org.gitlab4j.models.Constants.DeploymentOrderBy, org.gitlab4j.models.Constants.DeploymentStatus, org.gitlab4j.models.Constants.DeployTokenScope, org.gitlab4j.models.Constants.Encoding, org.gitlab4j.models.Constants.EpicOrderBy, org.gitlab4j.models.Constants.EventScope, org.gitlab4j.models.Constants.GroupOrderBy, org.gitlab4j.models.Constants.GroupSearchScope<T extends java.lang.Object>, org.gitlab4j.models.Constants.ImpersonationState, org.gitlab4j.models.Constants.IssueOrderBy, org.gitlab4j.models.Constants.IssueScope, org.gitlab4j.models.Constants.IssueState, org.gitlab4j.models.Constants.JobScope, org.gitlab4j.models.Constants.LineType, org.gitlab4j.models.Constants.MergeRequestOrderBy, org.gitlab4j.models.Constants.MergeRequestScope, org.gitlab4j.models.Constants.MergeRequestSearchIn, org.gitlab4j.models.Constants.MergeRequestState, org.gitlab4j.models.Constants.MilestoneState, org.gitlab4j.models.Constants.PackageOrderBy, org.gitlab4j.models.Constants.PackageStatus, org.gitlab4j.models.Constants.PipelineOrderBy, org.gitlab4j.models.Constants.PipelineScope, org.gitlab4j.models.Constants.PipelineSource, org.gitlab4j.models.Constants.ProjectAccessTokenScope, org.gitlab4j.models.Constants.ProjectCreationLevel, org.gitlab4j.models.Constants.ProjectFeatureVisibilityAccessLevel, org.gitlab4j.models.Constants.ProjectOrderBy, org.gitlab4j.models.Constants.ProjectSearchScope<T extends java.lang.Object>, org.gitlab4j.models.Constants.SearchScope<T extends java.lang.Object>, org.gitlab4j.models.Constants.SortOrder, org.gitlab4j.models.Constants.SquashOption, org.gitlab4j.models.Constants.StateEvent, org.gitlab4j.models.Constants.SubgroupCreationLevel, org.gitlab4j.models.Constants.TagOrderBy, org.gitlab4j.models.Constants.TargetType, org.gitlab4j.models.Constants.TodoAction, org.gitlab4j.models.Constants.TodoState, org.gitlab4j.models.Constants.TodoType, org.gitlab4j.models.Constants.TokenType
-
-
Field Summary
-
Fields inherited from class org.gitlab4j.api.AbstractApi
gitLabApi
-
-
Constructor Summary
Constructors Constructor Description MergeRequestApi(GitLabApi gitLabApi)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.gitlab4j.api.models.MergeRequest
acceptMergeRequest(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid)
Merge changes to the merge request.org.gitlab4j.api.models.MergeRequest
acceptMergeRequest(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid, java.lang.String mergeCommitMessage, java.lang.Boolean shouldRemoveSourceBranch, java.lang.Boolean mergeWhenPipelineSucceeds)
Merge changes to the merge request.org.gitlab4j.api.models.MergeRequest
acceptMergeRequest(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid, java.lang.String mergeCommitMessage, java.lang.Boolean shouldRemoveSourceBranch, java.lang.Boolean mergeWhenPipelineSucceeds, java.lang.String sha)
Merge changes to the merge request.org.gitlab4j.api.models.MergeRequest
acceptMergeRequest(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid, org.gitlab4j.api.models.AcceptMergeRequestParams params)
Merge changes to the merge request.org.gitlab4j.api.models.MergeRequest
approveMergeRequest(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid, java.lang.String sha)
Approve a merge request.org.gitlab4j.api.models.MergeRequest
cancelMergeRequest(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid)
Cancel merge when pipeline succeeds.org.gitlab4j.api.models.ApprovalRule
createApprovalRule(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid, java.lang.Long projectRuleId, org.gitlab4j.api.models.ApprovalRuleParams params)
Create a merge request level approval rule.org.gitlab4j.api.models.MergeRequest
createMergeRequest(java.lang.Object projectIdOrPath, java.lang.String sourceBranch, java.lang.String targetBranch, java.lang.String title, java.lang.String description, java.lang.Long assigneeId)
Creates a merge request and optionally assigns a reviewer to it.org.gitlab4j.api.models.MergeRequest
createMergeRequest(java.lang.Object projectIdOrPath, java.lang.String sourceBranch, java.lang.String targetBranch, java.lang.String title, java.lang.String description, java.lang.Long assigneeId, java.lang.Long targetProjectId, java.lang.String[] labels, java.lang.Long milestoneId, java.lang.Boolean removeSourceBranch)
Creates a merge request.org.gitlab4j.api.models.MergeRequest
createMergeRequest(java.lang.Object projectIdOrPath, java.lang.String sourceBranch, java.lang.String targetBranch, java.lang.String title, java.lang.String description, java.lang.Long assigneeId, java.lang.Long targetProjectId, java.lang.String[] labels, java.lang.Long milestoneId, java.lang.Boolean removeSourceBranch, java.lang.Boolean squash)
Creates a merge request.org.gitlab4j.api.models.MergeRequest
createMergeRequest(java.lang.Object projectIdOrPath, org.gitlab4j.api.models.MergeRequestParams params)
Creates a merge request.org.gitlab4j.api.models.Pipeline
createMergeRequestPipeline(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid)
Create a new pipeline for a merge request.void
deleteApprovalRule(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid, java.lang.Long approvalRuleId)
Delete the specified the merge request level approval rule.void
deleteMergeRequest(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid)
Only for admins and project owners.java.util.List<org.gitlab4j.api.models.ApprovalRule>
getApprovalRules(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid)
Get a list of the merge request level approval rules.Pager<org.gitlab4j.api.models.ApprovalRule>
getApprovalRules(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid, int itemsPerPage)
Get a Pager of the merge request level approval rules.java.util.stream.Stream<org.gitlab4j.api.models.ApprovalRule>
getApprovalRulesStream(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid)
Get a Stream of the merge request level approval rules.org.gitlab4j.api.models.MergeRequest
getApprovals(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid)
Get the merge request with approval information.org.gitlab4j.api.models.ApprovalState
getApprovalState(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid)
Get the approval state of a merge request.java.util.List<org.gitlab4j.api.models.Issue>
getApprovalStatus(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid)
Get list containing all the issues that would be closed by merging the provided merge request.java.util.List<org.gitlab4j.api.models.Issue>
getClosesIssues(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid)
Get list containing all the issues that would be closed by merging the provided merge request.Pager<org.gitlab4j.api.models.Issue>
getClosesIssues(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid, int itemsPerPage)
Get a Pager containing all the issues that would be closed by merging the provided merge request.java.util.List<org.gitlab4j.api.models.Issue>
getClosesIssues(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid, int page, int perPage)
Get list containing all the issues that would be closed by merging the provided merge request.java.util.stream.Stream<org.gitlab4j.api.models.Issue>
getClosesIssuesStream(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid)
Get Stream containing all the issues that would be closed by merging the provided merge request.java.util.List<org.gitlab4j.api.models.Commit>
getCommits(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid)
Get a list of merge request commits.Pager<org.gitlab4j.api.models.Commit>
getCommits(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid, int itemsPerPage)
Get a Pager of merge request commits.java.util.List<org.gitlab4j.api.models.Commit>
getCommits(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid, int page, int perPage)
Get a list of merge request commits.java.util.stream.Stream<org.gitlab4j.api.models.Commit>
getCommitsStream(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid)
Get a Stream of merge request commits.java.util.List<org.gitlab4j.api.models.Diff>
getDiffs(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid)
Get a list of merge request diffs.Pager<org.gitlab4j.api.models.Diff>
getDiffs(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid, int itemsPerPage)
Get a Pager of merge request diffs.java.util.stream.Stream<org.gitlab4j.api.models.Diff>
getDiffsStream(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid)
Get a Stream of merge request diffs.org.gitlab4j.api.models.MergeRequestDiff
getDiffVersion(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid, java.lang.Long versionId)
Get a single merge request diff version.java.util.List<org.gitlab4j.api.models.MergeRequestVersion>
getDiffVersions(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid)
Get a list of merge request diff versions.Pager<org.gitlab4j.api.models.MergeRequestVersion>
getDiffVersions(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid, int itemsPerPage)
Get a Pager of merge request diff versions.java.util.stream.Stream<org.gitlab4j.api.models.MergeRequestVersion>
getDiffVersionsStream(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid)
Get a Stream of merge request diff versions.org.gitlab4j.api.models.MergeRequest
getMergeRequest(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid)
Get information about a single merge request.org.gitlab4j.api.models.MergeRequest
getMergeRequest(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid, java.lang.Boolean renderHtml, java.lang.Boolean includeDivergedCommitCount, java.lang.Boolean includeRebaseInProgress)
Get information about a single merge request.org.gitlab4j.api.models.MergeRequest
getMergeRequestApprovals(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid)
Get the merge request with approval information.org.gitlab4j.api.models.MergeRequest
getMergeRequestChanges(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid)
Get merge request with changes information.java.util.List<org.gitlab4j.api.models.Pipeline>
getMergeRequestPipelines(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid)
Get a list of pipelines for a merge request.Pager<org.gitlab4j.api.models.Pipeline>
getMergeRequestPipelines(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid, int itemsPerPage)
Get a Pager of pipelines for a merge request.java.util.stream.Stream<org.gitlab4j.api.models.Pipeline>
getMergeRequestPipelinesStream(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid)
Get a Stream of pipelines for a merge request.java.util.List<org.gitlab4j.api.models.MergeRequest>
getMergeRequests(java.lang.Object projectIdOrPath)
Get all merge requests for the specified project.Pager<org.gitlab4j.api.models.MergeRequest>
getMergeRequests(java.lang.Object projectIdOrPath, int itemsPerPage)
Get all merge requests for the specified project.java.util.List<org.gitlab4j.api.models.MergeRequest>
getMergeRequests(java.lang.Object projectIdOrPath, int page, int perPage)
Get all merge requests for the specified project.java.util.List<org.gitlab4j.api.models.MergeRequest>
getMergeRequests(java.lang.Object projectIdOrPath, org.gitlab4j.models.Constants.MergeRequestState state)
Get all merge requests with a specific state for the specified project.Pager<org.gitlab4j.api.models.MergeRequest>
getMergeRequests(java.lang.Object projectIdOrPath, org.gitlab4j.models.Constants.MergeRequestState state, int itemsPerPage)
Get all merge requests for the specified project.java.util.List<org.gitlab4j.api.models.MergeRequest>
getMergeRequests(java.lang.Object projectIdOrPath, org.gitlab4j.models.Constants.MergeRequestState state, int page, int perPage)
Get all merge requests for the specified project.java.util.List<org.gitlab4j.api.models.MergeRequest>
getMergeRequests(org.gitlab4j.api.models.MergeRequestFilter filter)
Get all merge requests matching the filter.Pager<org.gitlab4j.api.models.MergeRequest>
getMergeRequests(org.gitlab4j.api.models.MergeRequestFilter filter, int itemsPerPage)
Get all merge requests matching the filter.java.util.List<org.gitlab4j.api.models.MergeRequest>
getMergeRequests(org.gitlab4j.api.models.MergeRequestFilter filter, int page, int perPage)
Get all merge requests matching the filter.java.util.stream.Stream<org.gitlab4j.api.models.MergeRequest>
getMergeRequestsStream(java.lang.Object projectIdOrPath)
Get all merge requests for the specified project as a Streamjava.util.stream.Stream<org.gitlab4j.api.models.MergeRequest>
getMergeRequestsStream(java.lang.Object projectIdOrPath, org.gitlab4j.models.Constants.MergeRequestState state)
Get all merge requests with a specific state for the specified project as a Stream.java.util.stream.Stream<org.gitlab4j.api.models.MergeRequest>
getMergeRequestsStream(org.gitlab4j.api.models.MergeRequestFilter filter)
Get all merge requests matching the filter as a Stream.java.util.Optional<org.gitlab4j.api.models.MergeRequestDiff>
getOptionalDiffVersion(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid, java.lang.Long versionId)
Get a single merge request diff version as an Optional instance.java.util.Optional<org.gitlab4j.api.models.MergeRequest>
getOptionalMergeRequest(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid)
Get information about a single merge request as an Optional instance.java.util.Optional<org.gitlab4j.api.models.MergeRequest>
getOptionalMergeRequest(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid, java.lang.Boolean renderHtml, java.lang.Boolean includeDivergedCommitCount, java.lang.Boolean includeRebaseInProgress)
Get information about a single merge request as an Optional instance.java.util.List<org.gitlab4j.api.models.Participant>
getParticipants(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid)
Get list of participants of merge request.Pager<org.gitlab4j.api.models.Participant>
getParticipants(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid, int itemsPerPage)
Get a Pager of the participants of merge request.java.util.List<org.gitlab4j.api.models.Participant>
getParticipants(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid, int page, int perPage)
Get list of participants of merge request and in the specified page range.java.util.stream.Stream<org.gitlab4j.api.models.Participant>
getParticipantsStream(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid)
Get Stream of participants of merge request.org.gitlab4j.api.models.MergeRequest
getRebaseStatus(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid)
Get the merge request info containing the status of a merge request rebase.org.gitlab4j.api.models.MergeRequest
rebaseMergeRequest(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid)
Automatically rebase the source_branch of the merge request against its target_branch.org.gitlab4j.api.models.MergeRequest
unapproveMergeRequest(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid)
Unapprove a merge request.org.gitlab4j.api.models.ApprovalRule
updateApprovalRule(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid, java.lang.Long approvalRuleId, org.gitlab4j.api.models.ApprovalRuleParams params)
Update the specified the merge request level approval rule.org.gitlab4j.api.models.MergeRequest
updateMergeRequest(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid, java.lang.String targetBranch, java.lang.String title, java.lang.Long assigneeId, java.lang.String description, org.gitlab4j.models.Constants.StateEvent stateEvent, java.lang.String labels, java.lang.Long milestoneId, java.lang.Boolean removeSourceBranch, java.lang.Boolean squash, java.lang.Boolean discussionLocked, java.lang.Boolean allowCollaboration)
Updates an existing merge request.org.gitlab4j.api.models.MergeRequest
updateMergeRequest(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid, org.gitlab4j.api.models.MergeRequestParams params)
Updates an existing merge request.-
Methods inherited from class org.gitlab4j.api.AbstractApi
addFormParam, addFormParam, delete, delete, get, get, getApiClient, getApiVersion, getDefaultPerPage, getDefaultPerPageParam, getDefaultPerPageParam, getGroupIdOrPath, getLabelIdOrName, getNamespaceIdOrPath, getPageQueryParams, getPageQueryParams, getPerPageQueryParam, getProjectIdOrPath, getUserIdOrUsername, getWithAccepts, handle, head, isApiVersion, patch, patch, post, post, post, post, post, put, put, put, putUpload, putUpload, putWithFormData, putWithFormData, upload, upload, upload, upload, urlEncode, validate
-
-
-
-
Constructor Detail
-
MergeRequestApi
public MergeRequestApi(GitLabApi gitLabApi)
-
-
Method Detail
-
getMergeRequests
public java.util.List<org.gitlab4j.api.models.MergeRequest> getMergeRequests(org.gitlab4j.api.models.MergeRequestFilter filter) throws GitLabApiException
Get all merge requests matching the filter.GitLab Endpoint: GET /merge_requests
- Parameters:
filter
- a MergeRequestFilter instance with the filter settings- Returns:
- all merge requests for the specified project matching the filter
- Throws:
GitLabApiException
- if any exception occursput
-
getMergeRequests
public java.util.List<org.gitlab4j.api.models.MergeRequest> getMergeRequests(org.gitlab4j.api.models.MergeRequestFilter filter, int page, int perPage) throws GitLabApiException
Get all merge requests matching the filter.GitLab Endpoint: GET /merge_requests
- Parameters:
filter
- a MergeRequestFilter instance with the filter settingspage
- the page to getperPage
- the number of MergeRequest instances per page- Returns:
- all merge requests for the specified project matching the filter
- Throws:
GitLabApiException
- if any exception occurs
-
getMergeRequests
public Pager<org.gitlab4j.api.models.MergeRequest> getMergeRequests(org.gitlab4j.api.models.MergeRequestFilter filter, int itemsPerPage) throws GitLabApiException
Get all merge requests matching the filter.GitLab Endpoint: GET /merge_requests
- Parameters:
filter
- a MergeRequestFilter instance with the filter settingsitemsPerPage
- the number of MergeRequest instances that will be fetched per page- Returns:
- all merge requests for the specified project/group matching the filter
- Throws:
GitLabApiException
- if any exception occurs
-
getMergeRequestsStream
public java.util.stream.Stream<org.gitlab4j.api.models.MergeRequest> getMergeRequestsStream(org.gitlab4j.api.models.MergeRequestFilter filter) throws GitLabApiException
Get all merge requests matching the filter as a Stream.GitLab Endpoint: GET /merge_requests
- Parameters:
filter
- a MergeRequestFilter instance with the filter settings- Returns:
- a Stream containing all the merge requests for the specified project matching the filter
- Throws:
GitLabApiException
- if any exception occurs
-
getMergeRequests
public java.util.List<org.gitlab4j.api.models.MergeRequest> getMergeRequests(java.lang.Object projectIdOrPath) throws GitLabApiException
Get all merge requests for the specified project.GitLab Endpoint: GET /projects/:id/merge_requests
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instance- Returns:
- all merge requests for the specified project
- Throws:
GitLabApiException
- if any exception occurs
-
getMergeRequests
public java.util.List<org.gitlab4j.api.models.MergeRequest> getMergeRequests(java.lang.Object projectIdOrPath, int page, int perPage) throws GitLabApiException
Get all merge requests for the specified project.GitLab Endpoint: GET /projects/:id/merge_requests
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancepage
- the page to getperPage
- the number of MergeRequest instances per page- Returns:
- all merge requests for the specified project
- Throws:
GitLabApiException
- if any exception occurs
-
getMergeRequests
public Pager<org.gitlab4j.api.models.MergeRequest> getMergeRequests(java.lang.Object projectIdOrPath, int itemsPerPage) throws GitLabApiException
Get all merge requests for the specified project.GitLab Endpoint: GET /projects/:id/merge_requests
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instanceitemsPerPage
- the number of MergeRequest instances that will be fetched per page- Returns:
- all merge requests for the specified project
- Throws:
GitLabApiException
- if any exception occurs
-
getMergeRequestsStream
public java.util.stream.Stream<org.gitlab4j.api.models.MergeRequest> getMergeRequestsStream(java.lang.Object projectIdOrPath) throws GitLabApiException
Get all merge requests for the specified project as a StreamGitLab Endpoint: GET /projects/:id/merge_requests
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instance- Returns:
- a Stream with all merge requests for the specified project
- Throws:
GitLabApiException
- if any exception occurs
-
getMergeRequests
public java.util.List<org.gitlab4j.api.models.MergeRequest> getMergeRequests(java.lang.Object projectIdOrPath, org.gitlab4j.models.Constants.MergeRequestState state) throws GitLabApiException
Get all merge requests with a specific state for the specified project.GitLab Endpoint: GET /projects/:id/merge_requests?state=:state
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancestate
- the state parameter can be used to get only merge requests with a given state (opened, closed, or merged) or all of them (all).- Returns:
- all merge requests for the specified project
- Throws:
GitLabApiException
- if any exception occurs
-
getMergeRequests
public java.util.List<org.gitlab4j.api.models.MergeRequest> getMergeRequests(java.lang.Object projectIdOrPath, org.gitlab4j.models.Constants.MergeRequestState state, int page, int perPage) throws GitLabApiException
Get all merge requests for the specified project.GitLab Endpoint: GET /projects/:id/merge_requests
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancestate
- 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 page- Returns:
- all merge requests for the specified project
- Throws:
GitLabApiException
- if any exception occurs
-
getMergeRequests
public Pager<org.gitlab4j.api.models.MergeRequest> getMergeRequests(java.lang.Object projectIdOrPath, org.gitlab4j.models.Constants.MergeRequestState state, int itemsPerPage) throws GitLabApiException
Get all merge requests for the specified project.GitLab Endpoint: GET /projects/:id/merge_requests
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancestate
- 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 page- Returns:
- all merge requests for the specified project
- Throws:
GitLabApiException
- if any exception occurs
-
getMergeRequestsStream
public java.util.stream.Stream<org.gitlab4j.api.models.MergeRequest> getMergeRequestsStream(java.lang.Object projectIdOrPath, org.gitlab4j.models.Constants.MergeRequestState state) throws GitLabApiException
Get all merge requests with a specific state for the specified project as a Stream.GitLab Endpoint: GET /projects/:id/merge_requests?state=:state
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancestate
- the state parameter can be used to get only merge requests with a given state (opened, closed, or merged) or all of them (all).- Returns:
- a Stream with all the merge requests for the specified project
- Throws:
GitLabApiException
- if any exception occurs
-
getMergeRequest
public org.gitlab4j.api.models.MergeRequest getMergeRequest(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid) throws GitLabApiException
Get information about a single merge request.NOTE: GitLab API V4 uses IID (internal ID), V3 uses ID to identify the merge request.
GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_id
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancemergeRequestIid
- the internal ID of the merge request- Returns:
- the specified MergeRequest instance
- Throws:
GitLabApiException
- if any exception occurs
-
getMergeRequest
public org.gitlab4j.api.models.MergeRequest getMergeRequest(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid, java.lang.Boolean renderHtml, java.lang.Boolean includeDivergedCommitCount, java.lang.Boolean includeRebaseInProgress) throws GitLabApiException
Get information about a single merge request.GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancemergeRequestIid
- the internal ID of the merge requestrenderHtml
- if true response includes rendered HTML for title and description, can be nullincludeDivergedCommitCount
- if true response includes the commits behind the target branch, can be nullincludeRebaseInProgress
- if true response includes whether a rebase operation is in progress, can be null- Returns:
- a MergeRequest instance as specified by the parameters
- Throws:
GitLabApiException
- if any exception occurs
-
getOptionalMergeRequest
public java.util.Optional<org.gitlab4j.api.models.MergeRequest> getOptionalMergeRequest(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid)
Get information about a single merge request as an Optional instance.NOTE: GitLab API V4 uses IID (internal ID), V3 uses ID to identify the merge request.
GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_id
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancemergeRequestIid
- the internal ID of the merge request- Returns:
- the specified MergeRequest as an Optional instance instance
-
getOptionalMergeRequest
public java.util.Optional<org.gitlab4j.api.models.MergeRequest> getOptionalMergeRequest(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid, java.lang.Boolean renderHtml, java.lang.Boolean includeDivergedCommitCount, java.lang.Boolean includeRebaseInProgress)
Get information about a single merge request as an Optional instance.NOTE: GitLab API V4 uses IID (internal ID), V3 uses ID to identify the merge request.
GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_id
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancemergeRequestIid
- the internal ID of the merge requestrenderHtml
- if true response includes rendered HTML for title and description, can be nullincludeDivergedCommitCount
- if true response includes the commits behind the target branch, can be nullincludeRebaseInProgress
- if true response includes whether a rebase operation is in progress, can be null- Returns:
- the specified MergeRequest as an Optional instance instance
-
getCommits
public java.util.List<org.gitlab4j.api.models.Commit> getCommits(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid) throws GitLabApiException
Get a list of merge request commits.NOTE: GitLab API V4 uses IID (internal ID), V3 uses ID to identify the merge request.
GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid/commits
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancemergeRequestIid
- the internal ID of the merge request- Returns:
- a list containing the commits for the specified merge request
- Throws:
GitLabApiException
- GitLabApiException if any exception occurs during execution
-
getCommits
public java.util.List<org.gitlab4j.api.models.Commit> getCommits(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid, int page, int perPage) throws GitLabApiException
Get a list of merge request commits.NOTE: GitLab API V4 uses IID (internal ID), V3 uses ID to identify the merge request.
GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid/commits
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancemergeRequestIid
- the internal ID of the merge requestpage
- the page to getperPage
- the number of commits per page- Returns:
- a list containing the commits for the specified merge request
- Throws:
GitLabApiException
- GitLabApiException if any exception occurs during execution
-
getCommits
public Pager<org.gitlab4j.api.models.Commit> getCommits(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid, int itemsPerPage) throws GitLabApiException
Get a Pager of merge request commits.NOTE: GitLab API V4 uses IID (internal ID), V3 uses ID to identify the merge request.
GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid/commits
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancemergeRequestIid
- the internal ID of the merge requestitemsPerPage
- the number of Commit instances that will be fetched per page- Returns:
- a Pager containing the commits for the specified merge request
- Throws:
GitLabApiException
- GitLabApiException if any exception occurs during execution
-
getCommitsStream
public java.util.stream.Stream<org.gitlab4j.api.models.Commit> getCommitsStream(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid) throws GitLabApiException
Get a Stream of merge request commits.NOTE: GitLab API V4 uses IID (internal ID), V3 uses ID to identify the merge request.
GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid/commits
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancemergeRequestIid
- the internal ID of the merge request- Returns:
- a Stream containing the commits for the specified merge request
- Throws:
GitLabApiException
- GitLabApiException if any exception occurs during execution
-
getDiffVersions
public java.util.List<org.gitlab4j.api.models.MergeRequestVersion> getDiffVersions(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid) throws GitLabApiException
Get a list of merge request diff versions.GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid/versions
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancemergeRequestIid
- the internal ID of the merge request- Returns:
- a List of merge request diff versions for the specified merge request
- Throws:
GitLabApiException
- if any exception occurs
-
getDiffVersions
public Pager<org.gitlab4j.api.models.MergeRequestVersion> getDiffVersions(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid, int itemsPerPage) throws GitLabApiException
Get a Pager of merge request diff versions.GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid/versions
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancemergeRequestIid
- the internal ID of the merge requestitemsPerPage
- the number of MergeRequest instances that will be fetched per page- Returns:
- a Pager of merge request diff versions for the specified merge request
- Throws:
GitLabApiException
- if any exception occurs
-
getDiffVersionsStream
public java.util.stream.Stream<org.gitlab4j.api.models.MergeRequestVersion> getDiffVersionsStream(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid) throws GitLabApiException
Get a Stream of merge request diff versions.GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid/versions
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancemergeRequestIid
- the internal ID of the merge request- Returns:
- a Stream of merge request diff versions for the specified merge request
- Throws:
GitLabApiException
- if any exception occurs
-
getDiffVersion
public org.gitlab4j.api.models.MergeRequestDiff getDiffVersion(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid, java.lang.Long versionId) throws GitLabApiException
Get a single merge request diff version.GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid/versions/:version_id
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancemergeRequestIid
- the internal ID of the merge requestversionId
- the ID of the merge request diff version- Returns:
- a MergeRequestVersion instance for the specified MR diff version
- Throws:
GitLabApiException
- if any exception occurs
-
getOptionalDiffVersion
public java.util.Optional<org.gitlab4j.api.models.MergeRequestDiff> getOptionalDiffVersion(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid, java.lang.Long versionId)
Get a single merge request diff version as an Optional instance.GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid/versions/:version_id
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancemergeRequestIid
- the internal ID of the merge requestversionId
- the ID of the merge request diff version- Returns:
- the specified MergeRequestVersion as an Optional instance instance
-
getDiffs
public java.util.List<org.gitlab4j.api.models.Diff> getDiffs(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid) throws GitLabApiException
Get a list of merge request diffs.GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid/diffs
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancemergeRequestIid
- the internal ID of the merge request- Returns:
- a List of merge request diffs for the specified merge request
- Throws:
GitLabApiException
- if any exception occurs
-
getDiffs
public Pager<org.gitlab4j.api.models.Diff> getDiffs(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid, int itemsPerPage) throws GitLabApiException
Get a Pager of merge request diffs.GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid/diffs
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancemergeRequestIid
- the internal ID of the merge requestitemsPerPage
- the number of Diff instances that will be fetched per page- Returns:
- a Pager of merge request diffs for the specified merge request
- Throws:
GitLabApiException
- if any exception occurs
-
getDiffsStream
public java.util.stream.Stream<org.gitlab4j.api.models.Diff> getDiffsStream(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid) throws GitLabApiException
Get a Stream of merge request diffs.GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid/diffs
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancemergeRequestIid
- the internal ID of the merge request- Returns:
- a Stream of merge request diffs for the specified merge request
- Throws:
GitLabApiException
- if any exception occurs
-
createMergeRequest
public org.gitlab4j.api.models.MergeRequest createMergeRequest(java.lang.Object projectIdOrPath, org.gitlab4j.api.models.MergeRequestParams params) throws GitLabApiException
Creates a merge request.GitLab Endpoint: POST /projects/:id/merge_requests
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instanceparams
- a MergeRequestParams instance holding the info to create the merge request- Returns:
- the created MergeRequest instance
- Throws:
GitLabApiException
- if any exception occurs- Since:
- GitLab Starter 8.17, GitLab CE 11.0.
-
createMergeRequest
public org.gitlab4j.api.models.MergeRequest createMergeRequest(java.lang.Object projectIdOrPath, java.lang.String sourceBranch, java.lang.String targetBranch, java.lang.String title, java.lang.String description, java.lang.Long assigneeId, java.lang.Long targetProjectId, java.lang.String[] labels, java.lang.Long milestoneId, java.lang.Boolean removeSourceBranch, java.lang.Boolean squash) throws GitLabApiException
Creates a merge request.GitLab Endpoint: POST /projects/:id/merge_requests
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancesourceBranch
- 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, optional- Returns:
- the created MergeRequest instance
- Throws:
GitLabApiException
- if any exception occurs- Since:
- GitLab Starter 8.17, GitLab CE 11.0.
-
createMergeRequest
public org.gitlab4j.api.models.MergeRequest createMergeRequest(java.lang.Object projectIdOrPath, java.lang.String sourceBranch, java.lang.String targetBranch, java.lang.String title, java.lang.String description, java.lang.Long assigneeId, java.lang.Long targetProjectId, java.lang.String[] labels, java.lang.Long milestoneId, java.lang.Boolean removeSourceBranch) throws GitLabApiException
Creates a merge request.GitLab Endpoint: POST /projects/:id/merge_requests
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancesourceBranch
- 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, optional- Returns:
- the created MergeRequest instance
- Throws:
GitLabApiException
- if any exception occurs
-
createMergeRequest
public org.gitlab4j.api.models.MergeRequest createMergeRequest(java.lang.Object projectIdOrPath, java.lang.String sourceBranch, java.lang.String targetBranch, java.lang.String title, java.lang.String description, java.lang.Long assigneeId) throws GitLabApiException
Creates a merge request and optionally assigns a reviewer to it.GitLab Endpoint: POST /projects/:id/merge_requests
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancesourceBranch
- 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, optional- Returns:
- the created MergeRequest instance
- Throws:
GitLabApiException
- if any exception occurs
-
updateMergeRequest
public org.gitlab4j.api.models.MergeRequest updateMergeRequest(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid, org.gitlab4j.api.models.MergeRequestParams params) throws GitLabApiException
Updates an existing merge request. You can change branches, title, or even close the merge request.GitLab Endpoint: PUT /projects/:id/merge_requests/:merge_request_iid
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancemergeRequestIid
- the internal ID of the merge request to updateparams
- a MergeRequestParams instance holding the info to update the merge request- Returns:
- the updated merge request
- Throws:
GitLabApiException
- if any exception occurs
-
updateMergeRequest
public org.gitlab4j.api.models.MergeRequest updateMergeRequest(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid, java.lang.String targetBranch, java.lang.String title, java.lang.Long assigneeId, java.lang.String description, org.gitlab4j.models.Constants.StateEvent stateEvent, java.lang.String labels, java.lang.Long milestoneId, java.lang.Boolean removeSourceBranch, java.lang.Boolean squash, java.lang.Boolean discussionLocked, java.lang.Boolean allowCollaboration) throws GitLabApiException
Updates an existing merge request. You can change branches, title, or even close the MR.NOTE: GitLab API V4 uses IID (internal ID), V3 uses ID to identify the merge request.
GitLab Endpoint: PUT /projects/:id/merge_requests/:merge_request_iid
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancemergeRequestIid
- 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, optional- Returns:
- the updated merge request
- Throws:
GitLabApiException
- if any exception occurs
-
deleteMergeRequest
public void deleteMergeRequest(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid) throws GitLabApiException
Only for admins and project owners. Soft deletes the specified merge.NOTE: GitLab API V4 uses IID (internal ID), V3 uses ID to identify the merge request.
GitLab Endpoint: DELETE /projects/:id/merge_requests/:merge_request_iid
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancemergeRequestIid
- the internal ID of the merge request- Throws:
GitLabApiException
- if any exception occurs
-
acceptMergeRequest
public org.gitlab4j.api.models.MergeRequest acceptMergeRequest(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid, org.gitlab4j.api.models.AcceptMergeRequestParams params) throws GitLabApiException
Merge changes to the merge request. If the MR has any conflicts and can not be merged, you'll get a 405 and the error message 'Branch cannot be merged'. If merge request is already merged or closed, you'll get a 406 and the error message 'Method Not Allowed'. If the sha parameter is passed and does not match the HEAD of the source, you'll get a 409 and the error message 'SHA does not match HEAD of source branch'. If you don't have permissions to accept this merge request, you'll get a 401.NOTE: GitLab API V4 uses IID (internal ID), V3 uses ID to identify the merge request.
GitLab Endpoint: PUT /projects/:id/merge_requests/:merge_request_iid/merge
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancemergeRequestIid
- the internal ID of the merge requestparams
- the MergeRequest instance holding the parameters for accepting the merge request- Returns:
- the merged merge request
- Throws:
GitLabApiException
- if any exception occurs
-
acceptMergeRequest
public org.gitlab4j.api.models.MergeRequest acceptMergeRequest(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid) throws GitLabApiException
Merge changes to the merge request. If the MR has any conflicts and can not be merged, you'll get a 405 and the error message 'Branch cannot be merged'. If merge request is already merged or closed, you'll get a 406 and the error message 'Method Not Allowed'. If the sha parameter is passed and does not match the HEAD of the source, you'll get a 409 and the error message 'SHA does not match HEAD of source branch'. If you don't have permissions to accept this merge request, you'll get a 401.NOTE: GitLab API V4 uses IID (internal ID), V3 uses ID to identify the merge request.
GitLab Endpoint: PUT /projects/:id/merge_requests/:merge_request_iid/merge
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancemergeRequestIid
- the internal ID of the merge request- Returns:
- the merged merge request
- Throws:
GitLabApiException
- if any exception occurs
-
acceptMergeRequest
public org.gitlab4j.api.models.MergeRequest acceptMergeRequest(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid, java.lang.String mergeCommitMessage, java.lang.Boolean shouldRemoveSourceBranch, java.lang.Boolean mergeWhenPipelineSucceeds) throws GitLabApiException
Merge changes to the merge request. If the MR has any conflicts and can not be merged, you'll get a 405 and the error message 'Branch cannot be merged'. If merge request is already merged or closed, you'll get a 406 and the error message 'Method Not Allowed'. If the sha parameter is passed and does not match the HEAD of the source, you'll get a 409 and the error message 'SHA does not match HEAD of source branch'. If you don't have permissions to accept this merge request, you'll get a 401.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.
GitLab Endpoint: PUT /projects/:id/merge_requests/:merge_request_iid/merge
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancemergeRequestIid
- 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, optional- Returns:
- the merged merge request
- Throws:
GitLabApiException
- if any exception occurs
-
acceptMergeRequest
public org.gitlab4j.api.models.MergeRequest acceptMergeRequest(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid, java.lang.String mergeCommitMessage, java.lang.Boolean shouldRemoveSourceBranch, java.lang.Boolean mergeWhenPipelineSucceeds, java.lang.String sha) throws GitLabApiException
Merge changes to the merge request. If the MR has any conflicts and can not be merged, you'll get a 405 and the error message 'Branch cannot be merged'. If merge request is already merged or closed, you'll get a 406 and the error message 'Method Not Allowed'. If the sha parameter is passed and does not match the HEAD of the source, you'll get a 409 and the error message 'SHA does not match HEAD of source branch'. If you don't have permissions to accept this merge request, you'll get a 401.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.
GitLab Endpoint: PUT /projects/:id/merge_requests/:merge_request_iid/merge
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancemergeRequestIid
- 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, optional- Returns:
- the merged merge request
- Throws:
GitLabApiException
- if any exception occurs
-
cancelMergeRequest
public org.gitlab4j.api.models.MergeRequest cancelMergeRequest(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid) throws GitLabApiException
Cancel merge when pipeline succeeds. If you don't have permissions to accept this merge request, you'll get a 401. If the merge request is already merged or closed, you get 405 and error message 'Method Not Allowed'. In case the merge request is not set to be merged when the pipeline succeeds, you'll also get a 406 error.NOTE: GitLab API V4 uses IID (internal ID), V3 uses ID to identify the merge request.
GitLab Endpoint: POST /projects/:id/merge_requests/:merge_request_iid/cancel_merge_when_pipeline_succeeds
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancemergeRequestIid
- the internal ID of the merge request- Returns:
- the updated merge request
- Throws:
GitLabApiException
- if any exception occurs
-
getMergeRequestApprovals
public org.gitlab4j.api.models.MergeRequest getMergeRequestApprovals(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid) throws GitLabApiException
Get the merge request with approval information. Note: This API endpoint is only available on 8.9 Starter and above.GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid/approvals
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancemergeRequestIid
- the internal ID of the merge request- Returns:
- a MergeRequest instance with approval information included
- Throws:
GitLabApiException
- if any exception occurs
-
getApprovals
public org.gitlab4j.api.models.MergeRequest getApprovals(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid) throws GitLabApiException
Get the merge request with approval information. Note: This API endpoint is only available on 8.9 Starter and above.GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid/approvals
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancemergeRequestIid
- the internal ID of the merge request- Returns:
- a MergeRequest instance with approval information included
- Throws:
GitLabApiException
- if any exception occurs
-
getApprovalState
public org.gitlab4j.api.models.ApprovalState getApprovalState(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid) throws GitLabApiException
Get the approval state of a merge request. Note: This API endpoint is only available on 12.3 Starter and above.GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid/approval_state
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancemergeRequestIid
- the internal ID of the merge request- Returns:
- a ApprovalState instance with approval state
- Throws:
GitLabApiException
- if any exception occurs
-
getApprovalRules
public java.util.List<org.gitlab4j.api.models.ApprovalRule> getApprovalRules(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid) throws GitLabApiException
Get a list of the merge request level approval rules. Note: This API endpoint is only available on 12.3 Starter and above.GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid/approval_rules
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancemergeRequestIid
- the internal ID of the merge request- Returns:
- a List of ApprovalRule instances for the specified merge request.
- Throws:
GitLabApiException
- if any exception occurs
-
getApprovalRules
public Pager<org.gitlab4j.api.models.ApprovalRule> getApprovalRules(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid, int itemsPerPage) throws GitLabApiException
Get a Pager of the merge request level approval rules. Note: This API endpoint is only available on 12.3 Starter and above.GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid/approval_rules
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancemergeRequestIid
- the internal ID of the merge requestitemsPerPage
- the number of ApprovalRule instances that will be fetched per page- Returns:
- a Pager of ApprovalRule instances for the specified merge request.
- Throws:
GitLabApiException
- if any exception occurs
-
getApprovalRulesStream
public java.util.stream.Stream<org.gitlab4j.api.models.ApprovalRule> getApprovalRulesStream(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid) throws GitLabApiException
Get a Stream of the merge request level approval rules. Note: This API endpoint is only available on 12.3 Starter and above.GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid/approval_rules
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancemergeRequestIid
- the internal ID of the merge request- Returns:
- a Stream of ApprovalRule instances for the specified merge request.
- Throws:
GitLabApiException
- if any exception occurs
-
createApprovalRule
public org.gitlab4j.api.models.ApprovalRule createApprovalRule(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid, java.lang.Long projectRuleId, org.gitlab4j.api.models.ApprovalRuleParams params) throws GitLabApiException
Create a merge request level approval rule. Note: This API endpoint is only available on 12.3 Starter and above.GitLab Endpoint: POST /projects/:id/merge_requests/:merge_request_iid/approval_rules
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancemergeRequestIid
- the internal ID of the merge requestprojectRuleId
- the ID of a project-level approval ruleparams
- the ApprovalRuleParams instance holding the parameters for the approval rule- Returns:
- a ApprovalRule instance with approval configuration
- Throws:
GitLabApiException
- if any exception occurs
-
updateApprovalRule
public org.gitlab4j.api.models.ApprovalRule updateApprovalRule(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid, java.lang.Long approvalRuleId, org.gitlab4j.api.models.ApprovalRuleParams params) throws GitLabApiException
Update the specified the merge request level approval rule. Note: This API endpoint is only available on 12.3 Starter and above.GitLab Endpoint: PUT /projects/:id/merge_requests/:merge_request_iid/approval_rules/:approval_rule_id
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancemergeRequestIid
- the internal ID of the merge requestapprovalRuleId
- the ID of the approval ruleparams
- the ApprovalRuleParams instance holding the parameters for the approval rule update- Returns:
- a ApprovalRule instance with approval configuration
- Throws:
GitLabApiException
- if any exception occurs
-
deleteApprovalRule
public void deleteApprovalRule(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid, java.lang.Long approvalRuleId) throws GitLabApiException
Delete the specified the merge request level approval rule. Note: This API endpoint is only available on 12.3 Starter and above.GitLab Endpoint: DELETE /projects/:id/merge_requests/:merge_request_iid/approval_rules/:approval_rule_id
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancemergeRequestIid
- the internal ID of the merge requestapprovalRuleId
- the ID of the approval rule- Throws:
GitLabApiException
- if any exception occurs
-
approveMergeRequest
public org.gitlab4j.api.models.MergeRequest approveMergeRequest(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid, java.lang.String sha) throws GitLabApiException
Approve a merge request. Note: This API endpoint is only available on 8.9 EE and above.GitLab Endpoint: POST /projects/:id/merge_requests/:merge_request_iid/approve
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancemergeRequestIid
- the internal ID of the merge requestsha
- the HEAD of the merge request, optional- Returns:
- a MergeRequest instance with approval information included
- Throws:
GitLabApiException
- if any exception occurs
-
unapproveMergeRequest
public org.gitlab4j.api.models.MergeRequest unapproveMergeRequest(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid) throws GitLabApiException
Unapprove a merge request. Note: This API endpoint is only available on 8.9 EE and above.GitLab Endpoint: POST /projects/:id/merge_requests/:merge_request_iid/unapprove
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancemergeRequestIid
- the internal ID of the merge request- Returns:
- a MergeRequest instance with approval information included
- Throws:
GitLabApiException
- if any exception occurs
-
getMergeRequestChanges
public org.gitlab4j.api.models.MergeRequest getMergeRequestChanges(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid) throws GitLabApiException
Get merge request with changes information.GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid/changes
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancemergeRequestIid
- the IID of the merge request to get- Returns:
- a merge request including its changes
- Throws:
GitLabApiException
- if any exception occurs
-
getParticipants
public java.util.List<org.gitlab4j.api.models.Participant> getParticipants(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid) throws GitLabApiException
Get list of participants of merge request.GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid/participants
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancemergeRequestIid
- the IID of the merge request to get- Returns:
- a List containing all participants for the specified merge request
- Throws:
GitLabApiException
- if any exception occurs
-
getParticipants
public java.util.List<org.gitlab4j.api.models.Participant> getParticipants(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid, int page, int perPage) throws GitLabApiException
Get list of participants of merge request and in the specified page range.GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid/participants
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancemergeRequestIid
- the IID of the merge request to getpage
- the page to getperPage
- the number of projects per page- Returns:
- a List containing all participants for the specified merge request
- Throws:
GitLabApiException
- if any exception occurs
-
getParticipants
public Pager<org.gitlab4j.api.models.Participant> getParticipants(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid, int itemsPerPage) throws GitLabApiException
Get a Pager of the participants of merge request.GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid/participants
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancemergeRequestIid
- the IID of the merge request to getitemsPerPage
- the number of Participant instances that will be fetched per page- Returns:
- a Pager containing all participants for the specified merge request
- Throws:
GitLabApiException
- if any exception occurs
-
getParticipantsStream
public java.util.stream.Stream<org.gitlab4j.api.models.Participant> getParticipantsStream(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid) throws GitLabApiException
Get Stream of participants of merge request.GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid/participants
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancemergeRequestIid
- the IID of the merge request to get- Returns:
- a Stream containing all participants for the specified merge request
- Throws:
GitLabApiException
- if any exception occurs
-
getClosesIssues
public java.util.List<org.gitlab4j.api.models.Issue> getClosesIssues(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid) throws GitLabApiException
Get list containing all the issues that would be closed by merging the provided merge request.GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid/closes_issues
- Parameters:
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 for- Returns:
- a List containing all the issues that would be closed by merging the provided merge request
- Throws:
GitLabApiException
- if any exception occurs
-
getClosesIssues
public java.util.List<org.gitlab4j.api.models.Issue> getClosesIssues(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid, int page, int perPage) throws GitLabApiException
Get list containing all the issues that would be closed by merging the provided merge request.GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid/closes_issues
- Parameters:
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 page- Returns:
- a List containing all the issues that would be closed by merging the provided merge request
- Throws:
GitLabApiException
- if any exception occurs
-
getClosesIssues
public Pager<org.gitlab4j.api.models.Issue> getClosesIssues(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid, int itemsPerPage) throws GitLabApiException
Get a Pager containing all the issues that would be closed by merging the provided merge request.GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid/closes_issues
- Parameters:
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 page- Returns:
- a Pager containing all the issues that would be closed by merging the provided merge request
- Throws:
GitLabApiException
- if any exception occurs
-
getClosesIssuesStream
public java.util.stream.Stream<org.gitlab4j.api.models.Issue> getClosesIssuesStream(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid) throws GitLabApiException
Get Stream containing all the issues that would be closed by merging the provided merge request.GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid/closes_issues
- Parameters:
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 for- Returns:
- a Stream containing all the issues that would be closed by merging the provided merge request
- Throws:
GitLabApiException
- if any exception occurs
-
getApprovalStatus
public java.util.List<org.gitlab4j.api.models.Issue> getApprovalStatus(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid) throws GitLabApiException
Get list containing all the issues that would be closed by merging the provided merge request.GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid/closes_issues
- Parameters:
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 for- Returns:
- a List containing all the issues that would be closed by merging the provided merge request
- Throws:
GitLabApiException
- if any exception occurs
-
rebaseMergeRequest
public org.gitlab4j.api.models.MergeRequest rebaseMergeRequest(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid) throws GitLabApiException
Automatically rebase the source_branch of the merge request against its target_branch. This is an asynchronous request. The API will return a 202 Accepted response if the request is enqueued successfullyGitLab Endpoint: PUT /projects/:id/merge_requests/:merge_request_iid/rebase
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancemergeRequestIid
- the internal ID of the merge request to rebase- Returns:
- the merge request info containing the status of a merge request rebase
- Throws:
GitLabApiException
- if any exception occurs
-
getRebaseStatus
public org.gitlab4j.api.models.MergeRequest getRebaseStatus(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid) throws GitLabApiException
Get the merge request info containing the status of a merge request rebase.GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancemergeRequestIid
- the internal ID of the merge request being rebased- Returns:
- the merge request info containing the status of a merge request rebase
- Throws:
GitLabApiException
- if any exception occurs
-
getMergeRequestPipelines
public java.util.List<org.gitlab4j.api.models.Pipeline> getMergeRequestPipelines(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid) throws GitLabApiException
Get a list of pipelines for a merge request.GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid/pipelines
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancemergeRequestIid
- the internal ID of the merge request- Returns:
- a list containing the pipelines for the specified merge request
- Throws:
GitLabApiException
- if any exception occurs during execution
-
getMergeRequestPipelines
public Pager<org.gitlab4j.api.models.Pipeline> getMergeRequestPipelines(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid, int itemsPerPage) throws GitLabApiException
Get a Pager of pipelines for a merge request.GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid/pipelines
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancemergeRequestIid
- the internal ID of the merge requestitemsPerPage
- the number of Pipeline instances that will be fetched per page- Returns:
- a Pager containing the pipelines for the specified merge request
- Throws:
GitLabApiException
- if any exception occurs during execution
-
getMergeRequestPipelinesStream
public java.util.stream.Stream<org.gitlab4j.api.models.Pipeline> getMergeRequestPipelinesStream(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid) throws GitLabApiException
Get a Stream of pipelines for a merge request.GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid/pipelines
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancemergeRequestIid
- the internal ID of the merge request- Returns:
- a Stream containing the pipelines for the specified merge request
- Throws:
GitLabApiException
- if any exception occurs during execution
-
createMergeRequestPipeline
public org.gitlab4j.api.models.Pipeline createMergeRequestPipeline(java.lang.Object projectIdOrPath, java.lang.Long mergeRequestIid) throws GitLabApiException
Create a new pipeline for a merge request. A pipeline created via this endpoint will not run a regular branch/tag pipeline, it requires .gitlab-ci.yml to be configured with only: [merge_requests] to create jobs.
The new pipeline can be: A detached merge request pipeline. A pipeline for merged results if the project setting is enabled.GitLab Endpoint: POST /projects/:id/merge_requests/:merge_request_iid/pipelines
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancemergeRequestIid
- the internal ID of the merge request- Returns:
- a Pipeline instance with the newly created pipeline info
- Throws:
GitLabApiException
- if any exception occurs during execution
-
-