How to get the file/folder structure on remote repository

Hi,

I’m working on a plugin that needs to be able to view the files within a remote repository in BitBucket as part of a validation check. I tried looking at ContentService but that looks like it’s focused on reading in the contents of a file where as I’d like to get the files/directory structure. Is there a method/package available to do this?

If not, I can work around the problem by having a file stored within the repository that I get the contents of on runtime for the plugin but that didn’t seem like the best option since it would rely on the file being updated regularly.

Any help would be greatly appreciated!

Have you tried using the streamDirectory() method in the contentService? There are indeed quite some methods focusses on the contents of a file but I would think this streamDirectory would work for your usecase? This is the javadoc for the method.

About you second option, you might not need it anymore but you can use hookscripts for that. It’s a script file that can run inside a repository for a given event (push, merge, etc…). We provided an API for it so updating it would be managed by the system you can find documentation here:
Hook Scripts

2 Likes