Package org.gitlab4j.api
Class RepositoryApi
- java.lang.Object
-
- org.gitlab4j.api.AbstractApi
-
- org.gitlab4j.api.RepositoryApi
-
- All Implemented Interfaces:
org.gitlab4j.models.Constants
public class RepositoryApi extends AbstractApi
This class provides an entry point to all the GitLab API repository calls. For more information on the repository APIs see:
Repositories API Branches API
-
-
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 RepositoryApi(GitLabApi gitLabApi)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description org.gitlab4j.api.models.CompareResultscompare(java.lang.Object projectIdOrPath, java.lang.String from, java.lang.String to)Deprecated.usecompare(Object, String, String, Long, Boolean)insteadorg.gitlab4j.api.models.CompareResultscompare(java.lang.Object projectIdOrPath, java.lang.String from, java.lang.String to, java.lang.Boolean straight)Deprecated.usecompare(Object, String, String, Long, Boolean)insteadorg.gitlab4j.api.models.CompareResultscompare(java.lang.Object projectIdOrPath, java.lang.String from, java.lang.String to, java.lang.Long fromProjectId, java.lang.Boolean straight)Compare branches, tags or commits.org.gitlab4j.api.models.BranchcreateBranch(java.lang.Object projectIdOrPath, java.lang.String branchName, java.lang.String ref)Creates a branch for the project.voiddeleteBranch(java.lang.Object projectIdOrPath, java.lang.String branchName)Delete a single project repository branch.voiddeleteMergedBranches(java.lang.Object projectIdOrPath)Delete all branches that are merged into the project’s default branch.voidgenerateChangelog(java.lang.Object projectIdOrPath, java.lang.String version)Generate changelog data based on commits in a repository.voidgenerateChangelog(java.lang.Object projectIdOrPath, org.gitlab4j.api.models.ChangelogPayload payload)Generate changelog data based on commits in a repository.org.gitlab4j.api.models.BranchgetBranch(java.lang.Object projectIdOrPath, java.lang.String branchName)Get a single project repository branch.java.util.List<org.gitlab4j.api.models.Branch>getBranches(java.lang.Object projectIdOrPath)Get a list of repository branches from a project, sorted by name alphabetically.Pager<org.gitlab4j.api.models.Branch>getBranches(java.lang.Object projectIdOrPath, int itemsPerPage)Get a Pager of repository branches from a project, sorted by name alphabetically.java.util.List<org.gitlab4j.api.models.Branch>getBranches(java.lang.Object projectIdOrPath, int page, int perPage)Get a list of repository branches from a project, sorted by name alphabetically.java.util.List<org.gitlab4j.api.models.Branch>getBranches(java.lang.Object projectIdOrPath, java.lang.String search)Get a List of repository branches from a project, sorted by name alphabetically, filter by the search term.Pager<org.gitlab4j.api.models.Branch>getBranches(java.lang.Object projectIdOrPath, java.lang.String search, int itemsPerPage)Get a Pager of repository branches from a project, sorted by name alphabetically, filter by the search term.java.util.stream.Stream<org.gitlab4j.api.models.Branch>getBranchesStream(java.lang.Object projectIdOrPath)Get a Stream of repository branches from a project, sorted by name alphabetically.java.util.stream.Stream<org.gitlab4j.api.models.Branch>getBranchesStream(java.lang.Object projectIdOrPath, java.lang.String search)Get a Stream of repository branches from a project, sorted by name alphabetically, filter by the search term.java.util.List<org.gitlab4j.api.models.Contributor>getContributors(java.lang.Object projectIdOrPath)Get a list of contributors from a project.Pager<org.gitlab4j.api.models.Contributor>getContributors(java.lang.Object projectIdOrPath, int itemsPerPage)Get a Pager of contributors from a project.java.util.List<org.gitlab4j.api.models.Contributor>getContributors(java.lang.Object projectIdOrPath, int page, int perPage)Get a list of contributors from a project and in the specified page range.java.util.List<org.gitlab4j.api.models.Contributor>getContributors(java.lang.Object projectIdOrPath, int page, int perPage, org.gitlab4j.models.Constants.ContributorOrderBy orderBy, org.gitlab4j.models.Constants.SortOrder sortOrder)Get a list of contributors from a project and in the specified page range, sorted by specified param.java.util.stream.Stream<org.gitlab4j.api.models.Contributor>getContributorsStream(java.lang.Object projectIdOrPath)Get a list of contributors from a project.org.gitlab4j.api.models.CommitgetMergeBase(java.lang.Object projectIdOrPath, java.util.List<java.lang.String> refs)Get the common ancestor for 2 or more refs (commit SHAs, branch names or tags).java.util.Optional<org.gitlab4j.api.models.Branch>getOptionalBranch(java.lang.Object projectIdOrPath, java.lang.String branchName)Get an Optional instance with the value for the specific repository branch.java.util.Optional<org.gitlab4j.api.models.Commit>getOptionalMergeBase(java.lang.Object projectIdOrPath, java.util.List<java.lang.String> refs)Get an Optional instance with the value of the common ancestor for 2 or more refs (commit SHAs, branch names or tags).java.io.InputStreamgetRawBlobContent(java.lang.Object projectIdOrPath, java.lang.String sha)Get the raw file contents for a blob by blob SHA.java.io.InputStreamgetRepositoryArchive(java.lang.Object projectIdOrPath, java.lang.String sha)Deprecated.java.io.FilegetRepositoryArchive(java.lang.Object projectIdOrPath, java.lang.String sha, java.io.File directory)Deprecated.java.io.FilegetRepositoryArchive(java.lang.Object projectIdOrPath, java.lang.String sha, java.io.File directory, java.lang.String format)java.io.FilegetRepositoryArchive(java.lang.Object projectIdOrPath, java.lang.String sha, java.io.File directory, org.gitlab4j.models.Constants.ArchiveFormat format)java.io.InputStreamgetRepositoryArchive(java.lang.Object projectIdOrPath, java.lang.String sha, java.lang.String format)Deprecated.java.io.InputStreamgetRepositoryArchive(java.lang.Object projectIdOrPath, java.lang.String sha, org.gitlab4j.models.Constants.ArchiveFormat format)Deprecated.java.io.InputStreamgetRepositoryArchive(java.lang.Object projectIdOrPath, org.gitlab4j.api.models.RepositoryArchiveParams params)Get an archive of the complete repository by SHA (optional) and Path (optional).java.io.FilegetRepositoryArchive(java.lang.Object projectIdOrPath, org.gitlab4j.api.models.RepositoryArchiveParams params, java.io.File directory)Get an archive of the complete repository by SHA (optional) and Path (optional) and saves to the specified directory.java.io.FilegetRepositoryArchive(java.lang.Object projectIdOrPath, org.gitlab4j.api.models.RepositoryArchiveParams params, java.io.File directory, java.lang.String format)Get an archive of the complete repository by SHA (optional) and Path (optional) and saves to the specified directory.java.io.FilegetRepositoryArchive(java.lang.Object projectIdOrPath, org.gitlab4j.api.models.RepositoryArchiveParams params, java.io.File directory, org.gitlab4j.models.Constants.ArchiveFormat format)Get an archive of the complete repository by SHA (optional) and Path (optional) and saves to the specified directory.java.io.InputStreamgetRepositoryArchive(java.lang.Object projectIdOrPath, org.gitlab4j.api.models.RepositoryArchiveParams params, java.lang.String format)Get an archive of the complete repository by SHA (optional) and Path (optional).java.io.InputStreamgetRepositoryArchive(java.lang.Object projectIdOrPath, org.gitlab4j.api.models.RepositoryArchiveParams params, org.gitlab4j.models.Constants.ArchiveFormat format)Get an archive of the complete repository by SHA (optional) and Path (optional).java.util.List<org.gitlab4j.api.models.TreeItem>getTree(java.lang.Object projectIdOrPath)Get a list of repository files and directories in a project.Pager<org.gitlab4j.api.models.TreeItem>getTree(java.lang.Object projectIdOrPath, int itemsPerPage)Get a Pager of repository files and directories in a project.java.util.List<org.gitlab4j.api.models.TreeItem>getTree(java.lang.Object projectIdOrPath, java.lang.String filePath, java.lang.String refName)Get a list of repository files and directories in a project.Pager<org.gitlab4j.api.models.TreeItem>getTree(java.lang.Object projectIdOrPath, java.lang.String filePath, java.lang.String refName, int itemsPerPage)Get a Pager of repository files and directories in a project.java.util.List<org.gitlab4j.api.models.TreeItem>getTree(java.lang.Object projectIdOrPath, java.lang.String filePath, java.lang.String refName, java.lang.Boolean recursive)Get a list of repository files and directories in a project.Pager<org.gitlab4j.api.models.TreeItem>getTree(java.lang.Object projectIdOrPath, java.lang.String filePath, java.lang.String refName, java.lang.Boolean recursive, int itemsPerPage)Get a Pager of repository files and directories in a project.java.util.stream.Stream<org.gitlab4j.api.models.TreeItem>getTreeStream(java.lang.Object projectIdOrPath)Get a Stream of repository files and directories in a project.java.util.stream.Stream<org.gitlab4j.api.models.TreeItem>getTreeStream(java.lang.Object projectIdOrPath, java.lang.String filePath, java.lang.String refName)Get a Stream of repository files and directories in a project.java.util.stream.Stream<org.gitlab4j.api.models.TreeItem>getTreeStream(java.lang.Object projectIdOrPath, java.lang.String filePath, java.lang.String refName, java.lang.Boolean recursive)Get a Stream of repository files and directories in a project.org.gitlab4j.api.models.BranchprotectBranch(java.lang.Object projectIdOrPath, java.lang.String branchName)Protects a single project repository branch.org.gitlab4j.api.models.BranchunprotectBranch(java.lang.Object projectIdOrPath, java.lang.String branchName)Unprotects a single project repository branch.-
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
-
RepositoryApi
public RepositoryApi(GitLabApi gitLabApi)
-
-
Method Detail
-
getBranches
public java.util.List<org.gitlab4j.api.models.Branch> getBranches(java.lang.Object projectIdOrPath) throws GitLabApiExceptionGet a list of repository branches from a project, sorted by name alphabetically.GitLab Endpoint: GET /projects/:id/repository/branches- Parameters:
projectIdOrPath- the project in the form of an Long(ID), String(path), or Project instance- Returns:
- the list of repository branches for the specified project
- Throws:
GitLabApiException- if any exception occurs
-
getBranches
public java.util.List<org.gitlab4j.api.models.Branch> getBranches(java.lang.Object projectIdOrPath, int page, int perPage) throws GitLabApiExceptionGet a list of repository branches from a project, sorted by name alphabetically.GitLab Endpoint: GET /projects/:id/repository/branches- Parameters:
projectIdOrPath- the project in the form of an Long(ID), String(path), or Project instancepage- the page to getperPage- the number of Branch instances per page- Returns:
- the list of repository branches for the specified project
- Throws:
GitLabApiException- if any exception occurs
-
getBranches
public Pager<org.gitlab4j.api.models.Branch> getBranches(java.lang.Object projectIdOrPath, int itemsPerPage) throws GitLabApiException
Get a Pager of repository branches from a project, sorted by name alphabetically.GitLab Endpoint: GET /projects/:id/repository/branches- Parameters:
projectIdOrPath- the project in the form of an Long(ID), String(path), or Project instanceitemsPerPage- the number of Project instances that will be fetched per page- Returns:
- the list of repository branches for the specified project ID
- Throws:
GitLabApiException- if any exception occurs
-
getBranchesStream
public java.util.stream.Stream<org.gitlab4j.api.models.Branch> getBranchesStream(java.lang.Object projectIdOrPath) throws GitLabApiExceptionGet a Stream of repository branches from a project, sorted by name alphabetically.GitLab Endpoint: GET /projects/:id/repository/branches- Parameters:
projectIdOrPath- the project in the form of an Long(ID), String(path), or Project instance- Returns:
- a Stream of repository branches for the specified project
- Throws:
GitLabApiException- if any exception occurs
-
getBranch
public org.gitlab4j.api.models.Branch getBranch(java.lang.Object projectIdOrPath, java.lang.String branchName) throws GitLabApiExceptionGet a single project repository branch.GitLab Endpoint: GET /projects/:id/repository/branches/:branch- Parameters:
projectIdOrPath- the project in the form of an Long(ID), String(path), or Project instancebranchName- the name of the branch to get- Returns:
- the branch info for the specified project ID/branch name pair
- Throws:
GitLabApiException- if any exception occurs
-
getBranches
public java.util.List<org.gitlab4j.api.models.Branch> getBranches(java.lang.Object projectIdOrPath, java.lang.String search) throws GitLabApiExceptionGet a List of repository branches from a project, sorted by name alphabetically, filter by the search term.GitLab Endpoint: GET /projects/:id/repository/branches?search=:search- Parameters:
projectIdOrPath- the project in the form of an Long(ID), String(path), or Project instancesearch- the branch name search term- Returns:
- the List of repository branches for the specified project ID and search term
- Throws:
GitLabApiException- if any exception occurs
-
getBranches
public Pager<org.gitlab4j.api.models.Branch> getBranches(java.lang.Object projectIdOrPath, java.lang.String search, int itemsPerPage) throws GitLabApiException
Get a Pager of repository branches from a project, sorted by name alphabetically, filter by the search term.GitLab Endpoint: GET /projects/:id/repository/branches?search=:search- Parameters:
projectIdOrPath- the project in the form of an Long(ID), String(path), or Project instancesearch- the branch name search termitemsPerPage- the number of Project instances that will be fetched per page- Returns:
- the list of repository branches for the specified project ID and search term
- Throws:
GitLabApiException- if any exception occurs
-
getBranchesStream
public java.util.stream.Stream<org.gitlab4j.api.models.Branch> getBranchesStream(java.lang.Object projectIdOrPath, java.lang.String search) throws GitLabApiExceptionGet a Stream of repository branches from a project, sorted by name alphabetically, filter by the search term.GitLab Endpoint: GET /projects/:id/repository/branches?search=:search- Parameters:
projectIdOrPath- the project in the form of an Long(ID), String(path), or Project instancesearch- the branch name search term- Returns:
- the Stream of repository branches for the specified project ID and search term
- Throws:
GitLabApiException- if any exception occurs
-
getOptionalBranch
public java.util.Optional<org.gitlab4j.api.models.Branch> getOptionalBranch(java.lang.Object projectIdOrPath, java.lang.String branchName) throws GitLabApiExceptionGet an Optional instance with the value for the specific repository branch.GitLab Endpoint: GET /projects/:id/repository/branches/:branch- Parameters:
projectIdOrPath- the project in the form of an Long(ID), String(path), or Project instancebranchName- the name of the branch to get- Returns:
- an Optional instance with the info for the specified project ID/branch name pair as the value
- Throws:
GitLabApiException- if any exception occurs
-
createBranch
public org.gitlab4j.api.models.Branch createBranch(java.lang.Object projectIdOrPath, java.lang.String branchName, java.lang.String ref) throws GitLabApiExceptionCreates a branch for the project. Support as of version 6.8.xGitLab Endpoint: POST /projects/:id/repository/branches- Parameters:
projectIdOrPath- the project in the form of an Long(ID), String(path), or Project instancebranchName- the name of the branch to createref- Source to create the branch from, can be an existing branch, tag or commit SHA- Returns:
- the branch info for the created branch
- Throws:
GitLabApiException- if any exception occurs
-
deleteBranch
public void deleteBranch(java.lang.Object projectIdOrPath, java.lang.String branchName) throws GitLabApiExceptionDelete a single project repository branch.GitLab Endpoint: DELETE /projects/:id/repository/branches/:branch- Parameters:
projectIdOrPath- the project in the form of an Long(ID), String(path), or Project instancebranchName- the name of the branch to delete- Throws:
GitLabApiException- if any exception occurs
-
protectBranch
public org.gitlab4j.api.models.Branch protectBranch(java.lang.Object projectIdOrPath, java.lang.String branchName) throws GitLabApiExceptionProtects a single project repository branch. This is an idempotent function, protecting an already protected repository branch will not produce an error.GitLab Endpoint: PUT /projects/:id/repository/branches/:branch/protect- Parameters:
projectIdOrPath- the project in the form of an Long(ID), String(path), or Project instancebranchName- the name of the branch to protect- Returns:
- the branch info for the protected branch
- Throws:
GitLabApiException- if any exception occurs
-
unprotectBranch
public org.gitlab4j.api.models.Branch unprotectBranch(java.lang.Object projectIdOrPath, java.lang.String branchName) throws GitLabApiExceptionUnprotects a single project repository branch. This is an idempotent function, unprotecting an already unprotected repository branch will not produce an error.GitLab Endpoint: PUT /projects/:id/repository/branches/:branch/unprotect- Parameters:
projectIdOrPath- the project in the form of an Long(ID), String(path), or Project instancebranchName- the name of the branch to un-protect- Returns:
- the branch info for the unprotected branch
- Throws:
GitLabApiException- if any exception occurs
-
getTree
public java.util.List<org.gitlab4j.api.models.TreeItem> getTree(java.lang.Object projectIdOrPath) throws GitLabApiExceptionGet a list of repository files and directories in a project.GitLab Endpoint: GET /projects/:id/repository/tree- Parameters:
projectIdOrPath- the project in the form of an Long(ID), String(path), or Project instance- Returns:
- a tree with the root directories and files of a project
- Throws:
GitLabApiException- if any exception occurs
-
getTree
public Pager<org.gitlab4j.api.models.TreeItem> getTree(java.lang.Object projectIdOrPath, int itemsPerPage) throws GitLabApiException
Get a Pager of repository files and directories in a project.GitLab Endpoint: GET /projects/:id/repository/tree- Parameters:
projectIdOrPath- the project in the form of an Long(ID), String(path), or Project instanceitemsPerPage- the number of Project instances that will be fetched per page- Returns:
- a Pager containing a tree with the root directories and files of a project
- Throws:
GitLabApiException- if any exception occurs
-
getTreeStream
public java.util.stream.Stream<org.gitlab4j.api.models.TreeItem> getTreeStream(java.lang.Object projectIdOrPath) throws GitLabApiExceptionGet a Stream of repository files and directories in a project.GitLab Endpoint: GET /projects/:id/repository/tree- Parameters:
projectIdOrPath- the project in the form of an Long(ID), String(path), or Project instance- Returns:
- a Stream containing a tree with the root directories and files of a project
- Throws:
GitLabApiException- if any exception occurs
-
getTree
public java.util.List<org.gitlab4j.api.models.TreeItem> getTree(java.lang.Object projectIdOrPath, java.lang.String filePath, java.lang.String refName) throws GitLabApiExceptionGet a list of repository files and directories in a project.
id (required) - The ID of a project path (optional) - The path inside repository. Used to get content of subdirectories ref_name (optional) - The name of a repository branch or tag or if not given the default branchGitLab Endpoint: GET /projects/:id/repository/tree- Parameters:
projectIdOrPath- the project in the form of an Long(ID), String(path), or Project instancefilePath- the path inside repository, used to get content of subdirectoriesrefName- the name of a repository branch or tag or if not given the default branch- Returns:
- a tree with the directories and files of a project
- Throws:
GitLabApiException- if any exception occurs
-
getTree
public Pager<org.gitlab4j.api.models.TreeItem> getTree(java.lang.Object projectIdOrPath, java.lang.String filePath, java.lang.String refName, int itemsPerPage) throws GitLabApiException
Get a Pager of repository files and directories in a project.
id (required) - The ID of a project path (optional) - The path inside repository. Used to get content of subdirectories ref_name (optional) - The name of a repository branch or tag or if not given the default branchGitLab Endpoint: GET /projects/:id/repository/tree- Parameters:
projectIdOrPath- the project in the form of an Long(ID), String(path), or Project instancefilePath- the path inside repository, used to get content of subdirectoriesrefName- the name of a repository branch or tag or if not given the default branchitemsPerPage- the number of Project instances that will be fetched per page- Returns:
- a Pager containing a tree with the directories and files of a project
- Throws:
GitLabApiException- if any exception occurs
-
getTreeStream
public java.util.stream.Stream<org.gitlab4j.api.models.TreeItem> getTreeStream(java.lang.Object projectIdOrPath, java.lang.String filePath, java.lang.String refName) throws GitLabApiExceptionGet a Stream of repository files and directories in a project.
id (required) - The ID of a project path (optional) - The path inside repository. Used to get content of subdirectories ref_name (optional) - The name of a repository branch or tag or if not given the default branchGitLab Endpoint: GET /projects/:id/repository/tree- Parameters:
projectIdOrPath- the project in the form of an Long(ID), String(path), or Project instancefilePath- the path inside repository, used to get content of subdirectoriesrefName- the name of a repository branch or tag or if not given the default branch- Returns:
- a Stream containing a tree with the directories and files of a project
- Throws:
GitLabApiException- if any exception occurs
-
getTree
public java.util.List<org.gitlab4j.api.models.TreeItem> getTree(java.lang.Object projectIdOrPath, java.lang.String filePath, java.lang.String refName, java.lang.Boolean recursive) throws GitLabApiExceptionGet a list of repository files and directories in a project.
id (required) - The ID of a project path (optional) - The path inside repository. Used to get contend of subdirectories ref_name (optional) - The name of a repository branch or tag or if not given the default branch recursive (optional) - Boolean value used to get a recursive tree (false by default)GitLab Endpoint: GET /projects/:id/repository/tree- Parameters:
projectIdOrPath- the project in the form of an Long(ID), String(path), or Project instancefilePath- the path inside repository, used to get content of subdirectoriesrefName- the name of a repository branch or tag or if not given the default branchrecursive- flag to get a recursive tree or not- Returns:
- a tree with the directories and files of a project
- Throws:
GitLabApiException- if any exception occurs
-
getTree
public Pager<org.gitlab4j.api.models.TreeItem> getTree(java.lang.Object projectIdOrPath, java.lang.String filePath, java.lang.String refName, java.lang.Boolean recursive, int itemsPerPage) throws GitLabApiException
Get a Pager of repository files and directories in a project.
id (required) - The ID of a project path (optional) - The path inside repository. Used to get contend of subdirectories ref_name (optional) - The name of a repository branch or tag or if not given the default branch recursive (optional) - Boolean value used to get a recursive tree (false by default)GitLab Endpoint: GET /projects/:id/repository/tree- Parameters:
projectIdOrPath- the project in the form of an Long(ID), String(path), or Project instancefilePath- the path inside repository, used to get content of subdirectoriesrefName- the name of a repository branch or tag or if not given the default branchrecursive- flag to get a recursive tree or notitemsPerPage- the number of Project instances that will be fetched per page- Returns:
- a tree with the directories and files of a project
- Throws:
GitLabApiException- if any exception occurs
-
getTreeStream
public java.util.stream.Stream<org.gitlab4j.api.models.TreeItem> getTreeStream(java.lang.Object projectIdOrPath, java.lang.String filePath, java.lang.String refName, java.lang.Boolean recursive) throws GitLabApiExceptionGet a Stream of repository files and directories in a project.
id (required) - The ID of a project path (optional) - The path inside repository. Used to get contend of subdirectories ref_name (optional) - The name of a repository branch or tag or if not given the default branch recursive (optional) - Boolean value used to get a recursive tree (false by default)GitLab Endpoint: GET /projects/:id/repository/tree- Parameters:
projectIdOrPath- the project in the form of an Long(ID), String(path), or Project instancefilePath- the path inside repository, used to get content of subdirectoriesrefName- the name of a repository branch or tag or if not given the default branchrecursive- flag to get a recursive tree or not- Returns:
- a Stream containing a tree with the directories and files of a project
- Throws:
GitLabApiException- if any exception occurs
-
getRawBlobContent
public java.io.InputStream getRawBlobContent(java.lang.Object projectIdOrPath, java.lang.String sha) throws GitLabApiExceptionGet the raw file contents for a blob by blob SHA.GitLab Endpoint: GET /projects/:id/repository/raw_blobs/:sha- Parameters:
projectIdOrPath- the project in the form of an Long(ID), String(path), or Project instancesha- the SHA of the file to get the contents for- Returns:
- the raw file contents for the blob on an InputStream
- Throws:
GitLabApiException- if any exception occurs
-
getRepositoryArchive
@Deprecated public java.io.InputStream getRepositoryArchive(java.lang.Object projectIdOrPath, java.lang.String sha) throws GitLabApiExceptionDeprecated.Get an archive of the complete repository by SHA (optional).GitLab Endpoint: GET /projects/:id/repository/archive- Parameters:
projectIdOrPath- the project in the form of an Long(ID), String(path), or Project instancesha- the SHA of the archive to get- Returns:
- an input stream that can be used to save as a file or to read the content of the archive
- Throws:
GitLabApiException- if any exception occurs
-
getRepositoryArchive
public java.io.InputStream getRepositoryArchive(java.lang.Object projectIdOrPath, org.gitlab4j.api.models.RepositoryArchiveParams params) throws GitLabApiExceptionGet an archive of the complete repository by SHA (optional) and Path (optional).GitLab Endpoint: GET /projects/:id/repository/archive- Parameters:
projectIdOrPath- the project in the form of an Long(ID), String(path), or Project instanceparams- params for getting file archive of the repository- Returns:
- an input stream that can be used to save as a file or to read the content of the archive
- Throws:
GitLabApiException- if any exception occurs
-
getRepositoryArchive
@Deprecated public java.io.InputStream getRepositoryArchive(java.lang.Object projectIdOrPath, java.lang.String sha, java.lang.String format) throws GitLabApiExceptionDeprecated.Get an archive of the complete repository by SHA (optional).GitLab Endpoint: GET /projects/:id/repository/archive- Parameters:
projectIdOrPath- the project in the form of an Long(ID), String(path), or Project instancesha- the SHA of the archive to getformat- The archive format, defaults to "tar.gz" if null- Returns:
- an input stream that can be used to save as a file or to read the content of the archive
- Throws:
GitLabApiException- if format is not a valid archive format or any exception occurs
-
getRepositoryArchive
public java.io.InputStream getRepositoryArchive(java.lang.Object projectIdOrPath, org.gitlab4j.api.models.RepositoryArchiveParams params, java.lang.String format) throws GitLabApiExceptionGet an archive of the complete repository by SHA (optional) and Path (optional).GitLab Endpoint: GET /projects/:id/repository/archive- Parameters:
projectIdOrPath- the project in the form of an Long(ID), String(path), or Project instanceparams- params for getting file archive of the repositoryformat- The archive format, defaults to "tar.gz" if null- Returns:
- an input stream that can be used to save as a file or to read the content of the archive
- Throws:
GitLabApiException- if format is not a valid archive format or any exception occurs
-
getRepositoryArchive
@Deprecated public java.io.InputStream getRepositoryArchive(java.lang.Object projectIdOrPath, java.lang.String sha, org.gitlab4j.models.Constants.ArchiveFormat format) throws GitLabApiExceptionDeprecated.Get an archive of the complete repository by SHA (optional).GitLab Endpoint: GET /projects/:id/repository/archive- Parameters:
projectIdOrPath- the project in the form of an Long(ID), String(path), or Project instancesha- the SHA of the archive to getformat- The archive format, defaults to TAR_GZ if null- Returns:
- an input stream that can be used to save as a file or to read the content of the archive
- Throws:
GitLabApiException- if any exception occurs
-
getRepositoryArchive
public java.io.InputStream getRepositoryArchive(java.lang.Object projectIdOrPath, org.gitlab4j.api.models.RepositoryArchiveParams params, org.gitlab4j.models.Constants.ArchiveFormat format) throws GitLabApiExceptionGet an archive of the complete repository by SHA (optional) and Path (optional).GitLab Endpoint: GET /projects/:id/repository/archive- Parameters:
projectIdOrPath- the project in the form of an Long(ID), String(path), or Project instanceparams- params for getting file archive of the repositoryformat- The archive format, defaults to TAR_GZ if null- Returns:
- an input stream that can be used to save as a file or to read the content of the archive
- Throws:
GitLabApiException- if any exception occurs
-
getRepositoryArchive
@Deprecated public java.io.File getRepositoryArchive(java.lang.Object projectIdOrPath, java.lang.String sha, java.io.File directory) throws GitLabApiExceptionDeprecated.Get an archive of the complete repository by SHA (optional) and saves to the specified directory. If the archive already exists in the directory it will be overwritten.GitLab Endpoint: GET /projects/:id/repository/archive- Parameters:
projectIdOrPath- the project in the form of an Long(ID), String(path), or Project instancesha- the SHA of the archive to getdirectory- the File instance of the directory to save the archive to, if null will use "java.io.tmpdir"- Returns:
- a File instance pointing to the downloaded instance
- Throws:
GitLabApiException- if any exception occurs
-
getRepositoryArchive
public java.io.File getRepositoryArchive(java.lang.Object projectIdOrPath, org.gitlab4j.api.models.RepositoryArchiveParams params, java.io.File directory) throws GitLabApiExceptionGet an archive of the complete repository by SHA (optional) and Path (optional) and saves to the specified directory. If the archive already exists in the directory it will be overwritten.GitLab Endpoint: GET /projects/:id/repository/archive- Parameters:
projectIdOrPath- the project in the form of an Long(ID), String(path), or Project instanceparams- params for getting file archive of the repositorydirectory- the File instance of the directory to save the archive to, if null will use "java.io.tmpdir"- Returns:
- a File instance pointing to the downloaded instance
- Throws:
GitLabApiException- if any exception occurs
-
getRepositoryArchive
@Deprecated public java.io.File getRepositoryArchive(java.lang.Object projectIdOrPath, java.lang.String sha, java.io.File directory, java.lang.String format) throws GitLabApiExceptionGet an archive of the complete repository by SHA (optional) and saves to the specified directory. If the archive already exists in the directory it will be overwritten.GitLab Endpoint: GET /projects/:id/repository/archive- Parameters:
projectIdOrPath- the project in the form of an Long(ID), String(path), or Project instancesha- the SHA of the archive to getdirectory- the File instance of the directory to save the archive to, if null will use "java.io.tmpdir"format- The archive format, defaults to "tar.gz" if null- Returns:
- a File instance pointing to the downloaded instance
- Throws:
GitLabApiException- if format is not a valid archive format or any exception occurs
-
getRepositoryArchive
public java.io.File getRepositoryArchive(java.lang.Object projectIdOrPath, org.gitlab4j.api.models.RepositoryArchiveParams params, java.io.File directory, java.lang.String format) throws GitLabApiExceptionGet an archive of the complete repository by SHA (optional) and Path (optional) and saves to the specified directory. If the archive already exists in the directory it will be overwritten.GitLab Endpoint: GET /projects/:id/repository/archive- Parameters:
projectIdOrPath- the project in the form of an Long(ID), String(path), or Project instanceparams- params for getting file archive of the repositorydirectory- the File instance of the directory to save the archive to, if null will use "java.io.tmpdir"format- The archive format, defaults to "tar.gz" if null- Returns:
- a File instance pointing to the downloaded instance
- Throws:
GitLabApiException- if format is not a valid archive format or any exception occurs
-
getRepositoryArchive
@Deprecated public java.io.File getRepositoryArchive(java.lang.Object projectIdOrPath, java.lang.String sha, java.io.File directory, org.gitlab4j.models.Constants.ArchiveFormat format) throws GitLabApiExceptionGet an archive of the complete repository by SHA (optional) and saves to the specified directory. If the archive already exists in the directory it will be overwritten.GitLab Endpoint: GET /projects/:id/repository/archive- Parameters:
projectIdOrPath- the project in the form of an Long(ID), String(path), or Project instancesha- the SHA of the archive to getdirectory- the File instance of the directory to save the archive to, if null will use "java.io.tmpdir"format- The archive format, defaults to TAR_GZ if null- Returns:
- a File instance pointing to the downloaded instance
- Throws:
GitLabApiException- if any exception occurs
-
getRepositoryArchive
public java.io.File getRepositoryArchive(java.lang.Object projectIdOrPath, org.gitlab4j.api.models.RepositoryArchiveParams params, java.io.File directory, org.gitlab4j.models.Constants.ArchiveFormat format) throws GitLabApiExceptionGet an archive of the complete repository by SHA (optional) and Path (optional) and saves to the specified directory. If the archive already exists in the directory it will be overwritten.GitLab Endpoint: GET /projects/:id/repository/archive- Parameters:
projectIdOrPath- the project in the form of an Long(ID), String(path), or Project instanceparams- params for getting file archive of the repositorydirectory- the File instance of the directory to save the archive to, if null will use "java.io.tmpdir"format- The archive format, defaults to TAR_GZ if null- Returns:
- a File instance pointing to the downloaded instance
- Throws:
GitLabApiException- if any exception occurs
-
compare
@Deprecated public org.gitlab4j.api.models.CompareResults compare(java.lang.Object projectIdOrPath, java.lang.String from, java.lang.String to, java.lang.Boolean straight) throws GitLabApiExceptionDeprecated.usecompare(Object, String, String, Long, Boolean)insteadCompare branches, tags or commits. This can be accessed without authentication if the repository is publicly accessible.GitLab Endpoint: GET /projects/:id/repository/compare- Parameters:
projectIdOrPath- the project in the form of an Long(ID), String(path), or Project instancefrom- the commit SHA or branch nameto- the commit SHA or branch namestraight- specifies the comparison method, true for direct comparison between from and to (from..to), false to compare using merge base (from…to)’.- Returns:
- a CompareResults containing the results of the comparison
- Throws:
GitLabApiException- if any exception occurs
-
compare
@Deprecated public org.gitlab4j.api.models.CompareResults compare(java.lang.Object projectIdOrPath, java.lang.String from, java.lang.String to) throws GitLabApiExceptionDeprecated.usecompare(Object, String, String, Long, Boolean)insteadCompare branches, tags or commits. This can be accessed without authentication if the repository is publicly accessible.- Parameters:
projectIdOrPath- the project in the form of an Long(ID), String(path), or Project instancefrom- the commit SHA or branch nameto- the commit SHA or branch name- Returns:
- a CompareResults containing the results of the comparison
- Throws:
GitLabApiException- if any exception occurs
-
compare
public org.gitlab4j.api.models.CompareResults compare(java.lang.Object projectIdOrPath, java.lang.String from, java.lang.String to, java.lang.Long fromProjectId, java.lang.Boolean straight) throws GitLabApiExceptionCompare branches, tags or commits. This can be accessed without authentication if the repository is publicly accessible.- Parameters:
projectIdOrPath- the project in the form of an Long(ID), String(path), or Project instancefrom- the commit SHA or branch nameto- the commit SHA or branch namefromProjectId- The ID to compare from.straight- specifies the comparison method, true for direct comparison between from and to (from..to), false to compare using merge base (from…to)- Returns:
- a CompareResults containing the results of the comparison
- Throws:
GitLabApiException- if any exception occurs
-
getContributors
public java.util.List<org.gitlab4j.api.models.Contributor> getContributors(java.lang.Object projectIdOrPath) throws GitLabApiExceptionGet a list of contributors from a project.GitLab Endpoint: GET /projects/:id/repository/contributors- Parameters:
projectIdOrPath- the project in the form of an Long(ID), String(path), or Project instance- Returns:
- a List containing the contributors for the specified project ID
- Throws:
GitLabApiException- if any exception occurs
-
getContributors
public java.util.List<org.gitlab4j.api.models.Contributor> getContributors(java.lang.Object projectIdOrPath, int page, int perPage) throws GitLabApiExceptionGet a list of contributors from a project and in the specified page range.GitLab Endpoint: GET /projects/:id/repository/contributors- Parameters:
projectIdOrPath- the project in the form of an Long(ID), String(path), or Project instancepage- the page to getperPage- the number of projects per page- Returns:
- a List containing the contributors for the specified project ID
- Throws:
GitLabApiException- if any exception occurs
-
getContributors
public java.util.List<org.gitlab4j.api.models.Contributor> getContributors(java.lang.Object projectIdOrPath, int page, int perPage, org.gitlab4j.models.Constants.ContributorOrderBy orderBy, org.gitlab4j.models.Constants.SortOrder sortOrder) throws GitLabApiExceptionGet a list of contributors from a project and in the specified page range, sorted by specified param.GitLab Endpoint: GET /projects/:id/repository/contributors- Parameters:
projectIdOrPath- the project in the form of an Long(ID), String(path), or Project instancepage- the page to getperPage- the number of projects per pageorderBy- (optional param) returns contributors ordered by NAME, EMAIL, or COMMITS. Default is COMMITSsortOrder- (optional param) returns contributors sorted in ASC or DESC order. Default is ASC- Returns:
- a List containing the contributors for the specified project ID
- Throws:
GitLabApiException- if any exception occurs
-
getContributors
public Pager<org.gitlab4j.api.models.Contributor> getContributors(java.lang.Object projectIdOrPath, int itemsPerPage) throws GitLabApiException
Get a Pager of contributors from a project.GitLab Endpoint: GET /projects/:id/repository/contributors- Parameters:
projectIdOrPath- the project in the form of an Long(ID), String(path), or Project instanceitemsPerPage- the number of Project instances that will be fetched per page- Returns:
- a Pager containing the contributors for the specified project ID
- Throws:
GitLabApiException- if any exception occurs
-
getContributorsStream
public java.util.stream.Stream<org.gitlab4j.api.models.Contributor> getContributorsStream(java.lang.Object projectIdOrPath) throws GitLabApiExceptionGet a list of contributors from a project.GitLab Endpoint: GET /projects/:id/repository/contributors- Parameters:
projectIdOrPath- the project in the form of an Long(ID), String(path), or Project instance- Returns:
- a List containing the contributors for the specified project ID
- Throws:
GitLabApiException- if any exception occurs
-
getMergeBase
public org.gitlab4j.api.models.Commit getMergeBase(java.lang.Object projectIdOrPath, java.util.List<java.lang.String> refs) throws GitLabApiExceptionGet the common ancestor for 2 or more refs (commit SHAs, branch names or tags).GitLab Endpoint: GET /projects/:id/repository/merge_base- Parameters:
projectIdOrPath- the project in the form of an Long(ID), String(path), or Project instancerefs- a List of 2 or more refs (commit SHAs, branch names or tags)- Returns:
- the Commit instance containing the common ancestor
- Throws:
GitLabApiException- if any exception occurs
-
getOptionalMergeBase
public java.util.Optional<org.gitlab4j.api.models.Commit> getOptionalMergeBase(java.lang.Object projectIdOrPath, java.util.List<java.lang.String> refs) throws GitLabApiExceptionGet an Optional instance with the value of the common ancestor for 2 or more refs (commit SHAs, branch names or tags).GitLab Endpoint: GET /projects/:id/repository/merge_base- Parameters:
projectIdOrPath- the project in the form of an Long(ID), String(path), or Project instancerefs- a List of 2 or more refs (commit SHAs, branch names or tags)- Returns:
- an Optional instance with the Commit instance containing the common ancestor as the value
- Throws:
GitLabApiException- if any exception occurs
-
deleteMergedBranches
public void deleteMergedBranches(java.lang.Object projectIdOrPath) throws GitLabApiExceptionDelete all branches that are merged into the project’s default branch.
NOTE: Protected branches will not be deleted as part of this operation.GitLab Endpoint: /projects/:id/repository/merged_branches- Parameters:
projectIdOrPath- the project in the form of an Long(ID), String(path), or Project instance- Throws:
GitLabApiException- if any exception occurs
-
generateChangelog
public void generateChangelog(java.lang.Object projectIdOrPath, java.lang.String version) throws GitLabApiExceptionGenerate changelog data based on commits in a repository.GitLab Endpoint: POST /projects/:id/repository/changelog- Parameters:
projectIdOrPath- the project in the form of an Long(ID), String(path), or Project instanceversion- the version to generate the changelog for- Throws:
GitLabApiException- if any exception occurs
-
generateChangelog
public void generateChangelog(java.lang.Object projectIdOrPath, org.gitlab4j.api.models.ChangelogPayload payload) throws GitLabApiExceptionGenerate changelog data based on commits in a repository.GitLab Endpoint: POST /projects/:id/repository/changelog- Parameters:
projectIdOrPath- the project in the form of an Long(ID), String(path), or Project instancepayload- the payload to generate the changelog for- Throws:
GitLabApiException- if any exception occurs
-
-