public class RepositoryFileApi extends AbstractApi
Constants.ActionType, Constants.IssueScope, Constants.IssueState, Constants.JobScope, Constants.LineType, 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(String filePath,
Integer projectId,
String ref)
Get file from repository.
|
protected RepositoryFile |
getFileV3(String filePath,
Integer projectId,
String ref)
Get file from 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, getPageQueryParams, getWithAccepts, handle, isApiVersion, post, post, post, put, put, putWithFormData, urlEncode, validate
public RepositoryFileApi(GitLabApi gitLabApi)
public RepositoryFile getFile(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 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 © 2017. All rights reserved.