public class RepositoryApi extends AbstractApi
| Constructor and Description |
|---|
RepositoryApi(GitLabApi gitLabApi) |
| Modifier and Type | Method and Description |
|---|---|
Branch |
createBranch(Integer projectId,
String branchName,
String ref)
Creates a branch for the project.
|
Tag |
createTag(Integer projectId,
String tagName,
String ref,
String message,
File releaseNotesFile)
Creates a tag on a particular ref of a given project.
|
Tag |
createTag(Integer projectId,
String tagName,
String ref,
String message,
String releaseNotes)
Creates a tag on a particular ref of the given project.
|
void |
deleteBranch(Integer projectId,
String branchName)
Delete a single project repository branch.
|
void |
deleteTag(Integer projectId,
String tagName)
Deletes the tag from a project with the specified tag name.
|
Branch |
getBranch(Integer projectId,
String branchName)
Get a single project repository branch.
|
List<Branch> |
getBranches(Integer projectId)
Get a list of repository branches from a project, sorted by name alphabetically.
|
String |
getRawBlobCotent(Integer projectId,
String sha)
Get the raw file contents for a blob by blob SHA.
|
String |
getRawFileContent(Integer projectId,
String commitOrBranchName,
String filepath)
Get the raw file contents for a file by commit sha and path.
|
InputStream |
getRepositoryArchive(Integer projectId,
String sha)
Get an archive of the complete repository by SHA (optional).
|
File |
getRepositoryArchive(Integer projectId,
String sha,
File directory)
Get an archive of the complete repository by SHA (optional) and saves to the specified directory.
|
List<Tag> |
getTags(Integer projectId)
Get a list of repository tags from a project, sorted by name in reverse alphabetical order.
|
List<TreeItem> |
getTree(Integer projectId)
Get a list of repository files and directories in a project.
|
List<TreeItem> |
getTree(Integer projectId,
String filePath,
String refName)
Get a list of repository files and directories in a project.
|
List<TreeItem> |
getTree(Integer projectId,
String filePath,
String refName,
Boolean recursive)
Get a list of repository files and directories in a project.
|
Branch |
protectBranch(Integer projectId,
String branchName)
Protects a single project repository branch.
|
Branch |
unprotectBranch(Integer projectId,
String branchName)
Unprotects a single project repository branch.
|
addFormParam, addFormParam, delete, delete, get, get, getApiClient, handle, post, post, post, put, put, validatepublic RepositoryApi(GitLabApi gitLabApi)
public List<Branch> getBranches(Integer projectId) throws GitLabApiException
projectId - the project to get the list of branches forGitLabApiException - if any exception occurspublic Branch getBranch(Integer projectId, String branchName) throws GitLabApiException
projectId - the project to get the branch forbranchName - the name of the branch to getGitLabApiException - if any exception occurspublic Branch createBranch(Integer projectId, String branchName, String ref) throws GitLabApiException
projectId - the project to create the branch forbranchName - the name of the branch to createref - Source to create the branch from, can be an existing branch, tag or commit SHAGitLabApiException - if any exception occurspublic void deleteBranch(Integer projectId, String branchName) throws GitLabApiException
projectId - the project that the branch belongs tobranchName - the name of the branch to deleteGitLabApiException - if any exception occurspublic Branch protectBranch(Integer projectId, String branchName) throws GitLabApiException
projectId - the ID of the project to protectbranchName - the name of the branch to protectGitLabApiException - if any exception occurspublic Branch unprotectBranch(Integer projectId, String branchName) throws GitLabApiException
projectId - the ID of the project to un-protectbranchName - the name of the branch to un-protectGitLabApiException - if any exception occurspublic List<Tag> getTags(Integer projectId) throws GitLabApiException
projectId - the ID of the project to get the tags forGitLabApiException - if any exception occurspublic Tag createTag(Integer projectId, String tagName, String ref, String message, String releaseNotes) throws GitLabApiException
projectId - the ID of the projecttagName - The name of the tag Must be unique for the projectref - the git ref to place the tag onmessage - the message to included with the tag (optional)releaseNotes - the release notes for the tag (optional)GitLabApiException - if any exception occurspublic Tag createTag(Integer projectId, String tagName, String ref, String message, File releaseNotesFile) throws GitLabApiException
createTag(Integer, String, String, String, String),
but instead allows the release notes to be supplied in a file.
POST /projects/:id/repository/tagsprojectId - the ID of the projecttagName - the name of the tag, must be unique for the projectref - the git ref to place the tag onmessage - the message to included with the tag (optional)releaseNotesFile - a whose contents are the release notes (optional)GitLabApiException - if any exception occurspublic void deleteTag(Integer projectId, String tagName) throws GitLabApiException
projectId - the ID of the projecttagName - The name of the tag to deleteGitLabApiException - if any exception occurspublic List<TreeItem> getTree(Integer projectId) throws GitLabApiException
projectId - the ID of the project to get the files forGitLabApiException - if any exception occurspublic List<TreeItem> getTree(Integer projectId, String filePath, String refName) throws GitLabApiException
projectId - the ID of the project to get the files forfilePath - the path inside repository, used to get content of subdirectoriesrefName - the name of a repository branch or tag or if not given the default branchGitLabApiException - if any exception occurspublic List<TreeItem> getTree(Integer projectId, String filePath, String refName, Boolean recursive) throws GitLabApiException
projectId - the ID of the project to get the files forfilePath - 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 notGitLabApiException - if any exception occurspublic String getRawFileContent(Integer projectId, String commitOrBranchName, String filepath) throws GitLabApiException
projectId - the ID of the projectcommitOrBranchName - the commit or branch name to get the file contents forfilepath - the path of the file to getGitLabApiException - if any exception occurspublic String getRawBlobCotent(Integer projectId, String sha) throws GitLabApiException
projectId - the ID of the projectsha - the SHA of the file to get the contents forGitLabApiException - if any exception occurspublic InputStream getRepositoryArchive(Integer projectId, String sha) throws GitLabApiException
projectId - the ID of the projectsha - the SHA of the archive to getGitLabApiException - if any exception occurspublic File getRepositoryArchive(Integer projectId, String sha, File directory) throws GitLabApiException
projectId - the ID of the projectsha - 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"GitLabApiException - if any exception occursCopyright © 2017. All rights reserved.