Commit ee7bc843 authored by Pokerkoffer's avatar Pokerkoffer Committed by Tim Olshansky

Recursive file tree from repo (#184)

* Recursive option on repository tree

* added path attribute to Repoclass
parent 36e858e3
...@@ -1243,10 +1243,11 @@ public class GitlabAPI { ...@@ -1243,10 +1243,11 @@ public class GitlabAPI {
* @param ref_name The name of a repository branch or tag or if not given the default branch (optional) * @param ref_name The name of a repository branch or tag or if not given the default branch (optional)
* @throws IOException on gitlab api call error * @throws IOException on gitlab api call error
*/ */
public List<GitlabRepositoryTree> getRepositoryTree(GitlabProject project, String path, String ref_name) throws IOException { public List<GitlabRepositoryTree> getRepositoryTree(GitlabProject project, String path, String ref_name, boolean recursive) throws IOException {
Query query = new Query() Query query = new Query()
.appendIf("path", path) .appendIf("path", path)
.appendIf("ref_name", ref_name); .appendIf("ref_name", ref_name)
.appendIf("recursive", recursive);
String tailUrl = GitlabProject.URL + "/" + project.getId() + "/repository" + GitlabRepositoryTree.URL + query.toString(); String tailUrl = GitlabProject.URL + "/" + project.getId() + "/repository" + GitlabRepositoryTree.URL + query.toString();
GitlabRepositoryTree[] tree = retrieve().to(tailUrl, GitlabRepositoryTree[].class); GitlabRepositoryTree[] tree = retrieve().to(tailUrl, GitlabRepositoryTree[].class);
......
...@@ -7,6 +7,7 @@ public class GitlabRepositoryTree { ...@@ -7,6 +7,7 @@ public class GitlabRepositoryTree {
private String type; private String type;
private String mode; private String mode;
private String id; private String id;
private String path;
public String getName() { public String getName() {
return name; return name;
...@@ -40,4 +41,11 @@ public class GitlabRepositoryTree { ...@@ -40,4 +41,11 @@ public class GitlabRepositoryTree {
this.id = id; this.id = id;
} }
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
} }
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