I've had a quick go at creating a repository plugin:
At the moment it can retrieve a list of files and search them.
Unfortunately it can't download to moodle yet - I think this will require sending extra headers with the get_file method.
It also doesn't do the api auth setup.
Overall I think the biggest issue is how to share between potfolio /repo api.