Commit a05aaf1f authored by Tim Olshansky's avatar Tim Olshansky

Merge pull request #71 from openwide-java/master

minor cosmetic cleanups
parents 2243612f d3a1479b
......@@ -711,23 +711,25 @@ public class GitlabAPI {
/**
* Get raw file content
*
* @param project Project
* @param project The Project
* @param sha The commit or branch name
* @param filepath The path the file
* @throws IOException
* @param filepath The path of the file
* @throws IOException on gitlab api call error
*/
public byte[] getRawFileContent(GitlabProject project, String sha, String filepath) throws IOException {
String tailUrl = GitlabProject.URL + "/" + project.getId() + "/repository/blobs/" + sha + "?filepath=" + filepath;
Query query = new Query()
.append("filepath", filepath);
String tailUrl = GitlabProject.URL + "/" + project.getId() + "/repository/blobs/" + sha + query.toString();
return retrieve().to(tailUrl, byte[].class);
}
/**
* Get the raw file contents for a blob by blob SHA.
*
* @param project Project
* @param project The Project
* @param sha The commit or branch name
* @throws IOException
* @throws IOException on gitlab api call error
*/
public byte[] getRawBlobContent(GitlabProject project, String sha) throws IOException {
String tailUrl = GitlabProject.URL + "/" + project.getId() + "/repository/raw_blobs/" + sha;
......@@ -737,8 +739,8 @@ public class GitlabAPI {
/**
* Get an archive of the repository
*
* @param project Project
* @throws IOException
* @param project The Project
* @throws IOException on gitlab api call error
*/
public byte[] getFileArchive(GitlabProject project) throws IOException {
String tailUrl = GitlabProject.URL + "/" + project.getId() + "/repository/archive";
......@@ -748,19 +750,17 @@ public class GitlabAPI {
/**
* Get an archive of the repository
*
* @param project Project
* @param path The path inside repository. Used to get contend of subdirectories (optional)
* @param project The Project
* @param path The path inside the repository. Used to get content of subdirectories (optional)
* @param ref_name The name of a repository branch or tag or if not given the default branch (optional)
* @throws IOException
* @throws IOException on gitlab api call error
*/
public List<GitlabRepositoryTree> getRepositoryTree(GitlabProject project, String path, String ref_name) throws IOException {
String tailUrl = GitlabProject.URL + "/" + project.getId() + "/repository" + GitlabRepositoryTree.URL;
if (path != null) {
tailUrl = tailUrl + (tailUrl.indexOf('?') > 0 ? '&' : '?') + "path=" + path;
}
if (ref_name != null) {
tailUrl = tailUrl + (tailUrl.indexOf('?') > 0 ? '&' : '?') + "ref_name=" + ref_name;
}
Query query = new Query()
.appendIf("path", path)
.appendIf("ref_name", ref_name);
String tailUrl = GitlabProject.URL + "/" + project.getId() + "/repository" + GitlabRepositoryTree.URL + query.toString();
GitlabRepositoryTree[] tree = retrieve().to(tailUrl, GitlabRepositoryTree[].class);
return Arrays.asList(tree);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment