public class RepositoryFileApi extends AbstractApi
Constants.ActionType, Constants.ArchiveFormat, Constants.EpicOrderBy, Constants.GroupOrderBy, Constants.ImpersonationState, Constants.IssueScope, Constants.IssueState, Constants.JobScope, Constants.LineType, Constants.MergeRequestOrderBy, Constants.MergeRequestScope, Constants.MergeRequestState, Constants.MilestoneState, Constants.PipelineOrderBy, Constants.PipelineScope, Constants.ProjectOrderBy, Constants.SortOrder, Constants.StateEvent, Constants.TargetType, Constants.TokenType
NEXT_PAGE_HEADER, PAGE_HEADER, PAGE_PARAM, PER_PAGE, PER_PAGE_PARAM, PREV_PAGE_HEADER, TOTAL_HEADER, TOTAL_PAGES_HEADER
Constructor and Description |
---|
RepositoryFileApi(GitLabApi gitLabApi) |
Modifier and Type | Method and Description |
---|---|
RepositoryFile |
createFile(RepositoryFile file,
Integer projectId,
String branchName,
String commitMessage)
Create new file in repository
POST /projects/:id/repository/files
file_path (required) - Full path to new file.
|
void |
deleteFile(String filePath,
Integer projectId,
String branchName,
String commitMessage)
Delete existing file in repository
DELETE /projects/:id/repository/files
file_path (required) - Full path to file.
|
RepositoryFile |
getFile(Object projectIdOrPath,
String filePath,
String ref)
Get file from repository.
|
RepositoryFile |
getFile(Object projectIdOrPath,
String filePath,
String ref,
boolean includeContent)
Get file from repository.
|
RepositoryFile |
getFile(String filePath,
Integer projectId,
String ref)
Deprecated.
Will be removed in version 5.0, replaced by
getFile(Object, String, String) |
RepositoryFile |
getFileInfo(Object projectIdOrPath,
String filePath,
String ref)
Get information on a file in the repository.
|
protected RepositoryFile |
getFileV3(String filePath,
Integer projectId,
String ref)
Deprecated.
Will be removed in version 5.0
|
Optional<RepositoryFile> |
getOptionalFile(Object projectIdOrPath,
String filePath,
String ref)
Get an Optional instance with the value holding information and content for a file in the repository.
|
Optional<RepositoryFile> |
getOptionalFileInfo(Object projectIdOrPath,
String filePath,
String ref)
Get an Optional instance with the value holding information on a file in the repository.
|
InputStream |
getRawFile(Integer projectId,
String commitOrBranchName,
String filepath)
Get the raw file contents for a file by commit sha and path.
|
File |
getRawFile(Integer projectId,
String commitOrBranchName,
String filepath,
File directory)
Get the raw file for the file by commit sha and path.
|
RepositoryFile |
updateFile(RepositoryFile file,
Integer projectId,
String branchName,
String commitMessage)
Update existing file in repository
PUT /projects/:id/repository/files
file_path (required) - Full path to new file.
|
addFormParam, addFormParam, delete, delete, get, get, getApiClient, getApiVersion, getDefaultPerPage, getDefaultPerPageParam, getGroupIdOrPath, getPageQueryParams, getProjectIdOrPath, getWithAccepts, handle, head, isApiVersion, post, post, post, post, post, put, put, putWithFormData, upload, upload, urlEncode, validate
public RepositoryFileApi(GitLabApi gitLabApi)
public Optional<RepositoryFile> getOptionalFileInfo(Object projectIdOrPath, String filePath, String ref)
projectIdOrPath
- the id, path of the project, or a Project instance holding the project ID or pathfilePath
- (required) - Full path to the file. Ex. lib/class.rbref
- (required) - The name of branch, tag or commitpublic RepositoryFile getFileInfo(Object projectIdOrPath, String filePath, String ref) throws GitLabApiException
projectIdOrPath
- the id, path of the project, or a Project instance holding the project ID or pathfilePath
- (required) - Full path to the file. Ex. lib/class.rbref
- (required) - The name of branch, tag or commitGitLabApiException
- if any exception occurspublic Optional<RepositoryFile> getOptionalFile(Object projectIdOrPath, String filePath, String ref)
projectIdOrPath
- the id, path of the project, or a Project instance holding the project ID or pathfilePath
- (required) - Full path to the file. Ex. lib/class.rbref
- (required) - The name of branch, tag or commitpublic RepositoryFile getFile(Object projectIdOrPath, String filePath, String ref) throws GitLabApiException
projectIdOrPath
- the id, path of the project, or a Project instance holding the project ID or pathfilePath
- (required) - Full path to the file. Ex. lib/class.rbref
- (required) - The name of branch, tag or commitGitLabApiException
- if any exception occurspublic RepositoryFile getFile(String filePath, Integer projectId, String ref) throws GitLabApiException
getFile(Object, String, String)
filePath
- (required) - Full path to the file. Ex. lib/class.rbprojectId
- (required) - the project IDref
- (required) - The name of branch, tag or commitGitLabApiException
- if any exception occurspublic RepositoryFile getFile(Object projectIdOrPath, String filePath, String ref, boolean includeContent) throws GitLabApiException
projectIdOrPath
- the id, path of the project, or a Project instance holding the project ID or pathfilePath
- (required) - Full path to the file. Ex. lib/class.rbref
- (required) - The name of branch, tag or commitincludeContent
- if true will also fetch file contentGitLabApiException
- if any exception occursprotected RepositoryFile getFileV3(String filePath, Integer projectId, String ref) throws GitLabApiException
filePath
- (required) - Full path to new file. Ex. lib/class.rbprojectId
- (required) - the project IDref
- (required) - The name of branch, tag or commitGitLabApiException
- if any exception occurspublic RepositoryFile createFile(RepositoryFile file, Integer projectId, String branchName, String commitMessage) throws GitLabApiException
file
- a ReposityoryFile instance with info for the file to createprojectId
- the project IDbranchName
- the name of branchcommitMessage
- the commit messageGitLabApiException
- if any exception occurspublic RepositoryFile updateFile(RepositoryFile file, Integer projectId, String branchName, String commitMessage) throws GitLabApiException
file
- a ReposityoryFile instance with info for the file to updateprojectId
- the project IDbranchName
- the name of branchcommitMessage
- the commit messageGitLabApiException
- if any exception occurspublic void deleteFile(String filePath, Integer projectId, String branchName, String commitMessage) throws GitLabApiException
filePath
- full path to new file. Ex. lib/class.rbprojectId
- the project IDbranchName
- the name of branchcommitMessage
- the commit messageGitLabApiException
- if any exception occurspublic File getRawFile(Integer projectId, String commitOrBranchName, String filepath, File directory) throws GitLabApiException
projectId
- the ID of the projectcommitOrBranchName
- the commit or branch name to get the file forfilepath
- the path of the file to getdirectory
- the File instance of the directory to save the file to, if null will use "java.io.tmpdir"GitLabApiException
- if any exception occurspublic InputStream getRawFile(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 occursCopyright © 2018. All rights reserved.