[repoapi] move get_repository function into a new repoapi module
This new module aims to host the function of the new API replacing the old
DBAPI. `get_repository` is still needed hence moved to the new module.
Related to #2503918
Upstream Author:
%(author)s <%(author-email)s>
Copyright:
Copyright (c) %(year)s %(author)s.
%(author-web-site)s -- mailto:%(author-email)s