Reputation: 217
How to read all the files with a different extension (say .txt, .yml, etc) from the GitLab repository?
I'm using GitLabApi
and below is the code that I have done so far. This is basically fetching a single file.
public class GitLabRepoService {
@Value("${gitlab.accessToken}")
private String strAccessToken;
@Value("${gitlab.perfScript.projectId}")
private String strProjectId;
public RepositoryFile readFilesFromGitLabRepo(String hostUrl,String fileName,String strBranch) throws Exception {
GitLabApi gitLabApi = new GitLabApi(hostUrl, strAccessToken);
gitLabApi.setIgnoreCertificateErrors(true);
gitLabApi.getRepositoryFileApi().
return gitLabApi.getRepositoryFileApi().getFile(strProjectId, fileName, strBranch);
}
}
Upvotes: 0
Views: 160
Reputation: 649
What you want to request is the repositories tree if I understand correctly. For that you should use this endpoint https://docs.gitlab.com/ee/api/repositories.html
I could not properly test it but according to the docs it looks like RepositoryApi.getTree()
is what you are looking for getTree()
Upvotes: 2