public class ProtectedBranchesApi extends AbstractApi
Constants.ActionType, Constants.ApplicationScope, Constants.ArchiveFormat, Constants.CommitBuildState, Constants.Encoding, Constants.EpicOrderBy, Constants.GroupOrderBy, Constants.GroupSearchScope, Constants.ImpersonationState, Constants.IssueOrderBy, Constants.IssueScope, Constants.IssueState, Constants.JobScope, Constants.LineType, Constants.MergeRequestOrderBy, Constants.MergeRequestScope, Constants.MergeRequestSearchIn, Constants.MergeRequestState, Constants.MilestoneState, Constants.PipelineOrderBy, Constants.PipelineScope, Constants.ProjectOrderBy, Constants.ProjectSearchScope, Constants.SearchScope, Constants.SortOrder, Constants.StateEvent, Constants.TagOrderBy, Constants.TargetType, Constants.TodoAction, Constants.TodoState, Constants.TodoType, Constants.TokenType
gitLabApi
NEXT_PAGE_HEADER, PAGE_HEADER, PAGE_PARAM, PER_PAGE, PER_PAGE_PARAM, PREV_PAGE_HEADER, TOTAL_HEADER, TOTAL_PAGES_HEADER
Constructor and Description |
---|
ProtectedBranchesApi(GitLabApi gitLabApi) |
Modifier and Type | Method and Description |
---|---|
List<ProtectedBranch> |
getProtectedBranches(Object projectIdOrPath)
Gets a list of protected branches from a project.
|
Pager<ProtectedBranch> |
getProtectedBranches(Object projectIdOrPath,
int itemsPerPage)
Gets a Pager of protected branches from a project.
|
Stream<ProtectedBranch> |
getProtectedBranchesStream(Object projectIdOrPath)
Gets a Stream of protected branches from a project.
|
ProtectedBranch |
protectBranch(Object projectIdOrPath,
String branchName)
Protects a single repository branch or several project repository branches using a wildcard protected branch.
|
ProtectedBranch |
protectBranch(Object projectIdOrPath,
String branchName,
AccessLevel pushAccessLevel,
AccessLevel mergeAccessLevel)
Protects a single repository branch or several project repository branches using a wildcard protected branch.
|
void |
unprotectBranch(Object projectIdOrPath,
String branchName)
Unprotects the given protected branch or wildcard protected branch.
|
addFormParam, addFormParam, delete, delete, get, get, getApiClient, getApiVersion, getDefaultPerPage, getDefaultPerPageParam, getDefaultPerPageParam, getGroupIdOrPath, getPageQueryParams, getPageQueryParams, getPerPageQueryParam, getProjectIdOrPath, getUserIdOrUsername, getWithAccepts, handle, head, isApiVersion, post, post, post, post, post, put, put, putUpload, putUpload, putWithFormData, upload, upload, upload, urlEncode, validate
public ProtectedBranchesApi(GitLabApi gitLabApi)
public List<ProtectedBranch> getProtectedBranches(Object projectIdOrPath) throws GitLabApiException
GitLab Endpoint: GET /projects/:id/protected_branches
projectIdOrPath
- the project in the form of an Integer(ID), String(path), or Project instanceGitLabApiException
- if any exception occurspublic Pager<ProtectedBranch> getProtectedBranches(Object projectIdOrPath, int itemsPerPage) throws GitLabApiException
GitLab Endpoint: GET /projects/:id/protected_branches
projectIdOrPath
- the project in the form of an Integer(ID), String(path), or Project instanceitemsPerPage
- the number of instances that will be fetched per pageGitLabApiException
- if any exception occurspublic Stream<ProtectedBranch> getProtectedBranchesStream(Object projectIdOrPath) throws GitLabApiException
GitLab Endpoint: GET /projects/:id/protected_branches
projectIdOrPath
- the project in the form of an Integer(ID), String(path), or Project instanceGitLabApiException
- if any exception occurspublic void unprotectBranch(Object projectIdOrPath, String branchName) throws GitLabApiException
GitLab Endpoint: DELETE /projects/:id/protected_branches/:name
projectIdOrPath
- the project in the form of an Integer(ID), String(path), or Project instancebranchName
- the name of the branch to un-protect, can be a wildcardGitLabApiException
- if any exception occurspublic ProtectedBranch protectBranch(Object projectIdOrPath, String branchName) throws GitLabApiException
GitLab Endpoint: POST /projects/:id/protected_branches
projectIdOrPath
- the project in the form of an Integer(ID), String(path), or Project instancebranchName
- the name of the branch to protect, can be a wildcardGitLabApiException
- if any exception occurspublic ProtectedBranch protectBranch(Object projectIdOrPath, String branchName, AccessLevel pushAccessLevel, AccessLevel mergeAccessLevel) throws GitLabApiException
GitLab Endpoint: POST /projects/:id/protected_branches
projectIdOrPath
- the project in the form of an Integer(ID), String(path), or Project instancebranchName
- the name of the branch to protect, can be a wildcardpushAccessLevel
- Access levels allowed to push (defaults: 40, maintainer access level)mergeAccessLevel
- Access levels allowed to merge (defaults: 40, maintainer access level)GitLabApiException
- if any exception occursCopyright © 2019. All rights reserved.