Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RepositoryApi: get all public/private repos together without looping projects #190

Closed
mronus opened this issue Apr 15, 2019 · 7 comments · Fixed by #192
Closed

RepositoryApi: get all public/private repos together without looping projects #190

mronus opened this issue Apr 15, 2019 · 7 comments · Fixed by #192
Assignees
Labels

Comments

@mronus
Copy link
Contributor

mronus commented Apr 15, 2019

RepositoryApi#list throws exception when sending project as null. I know that Bitbucket Rest API supports listing all repos together without looping through all projects one by one.

I couldn't find anything about that, so would like to know if there is a planned roadmap about this or if it already exists, and if the exception thrown by RepositoryApi#list is thrown intentionally or if it is a bug.

One more note, Bitbucket supports creating repositories without associating with a project.

@cdancy cdancy self-assigned this Apr 15, 2019
@cdancy
Copy link
Owner

cdancy commented Apr 15, 2019

One more note, Bitbucket supports creating repositories without associating with a project.

@mronus this is true if you're creating a repo under your user name if you're not attaching it to a project. The repository has to go somewhere, under some umbrella, so it's not under a project it is assumed you want to put things under your user name which essentially acts as a project folder. This client expects you to pass in a projectId (be than an actual projectId or a user-name) and doesn't take any short-cuts one way or another. I suppose it would be possible to allow passing in a null parameter for projectId and then attempt to inject the userName part of your credentials in its place. That doesn't sound like a bad idea. But if you're currently stuck I suggest passing in your username instead of the projectId and you should be good to go.

@mronus
Copy link
Contributor Author

mronus commented Apr 15, 2019

Thanks a lot @cdancy , I got it very well in terms of repos which has no parent project; however, it is still an open question how to use the repos endpoint "/rest/api/1.0/repos". Has it been implemented in the library yet? I checked docs, libs everything but couldn't find anything. So I just want to be sure before starting investigating different solution, or maybe I can create a PR if I can spare time.

@cdancy
Copy link
Owner

cdancy commented Apr 15, 2019

@mronus we have loads of endpoints coded for in our RepositoryApi class.

@mronus
Copy link
Contributor Author

mronus commented Apr 16, 2019

@cdancy I checked it already but I think we have an inconsistency there. We have two Api (ProjectApi and RepositoryApi) classes with the same root path: "@path("/rest/api/{jclouds.api-version}/projects")" . In terms of resource ownership, I think all endpoints which has {project} parameter in RepositoryApi should have been in ProjectApi . If it would be so, it seems there is only one endpoint that can be created in RepositoryApi. So I think it doesn't seem possible to fetch all repos via single http call instead of http call per project because of this inconsistency. Just a friendly feedback :)

Edit: @cdancy nevermind, I messed up with general design and forgot that we have many Api classes with "/rest/api/{jclouds.api-version}/projects" root path :) However, I still think that we need a solution for having "/rest/api/1.0/repos" implemented. What do you think about the correct design/place for "/rest/api/1.0/repos"? I would like to implement it when I can spare some time.

@mronus
Copy link
Contributor Author

mronus commented Apr 16, 2019

I think it will be much better discussing it through a pull request. I'll create it ASAP.

@cdancy
Copy link
Owner

cdancy commented Apr 16, 2019

@mronus I'm not sure an entire new Api/Endpoint is necessary as using the RepositoryApi class that I noted above should be sufficient. What I think you want to do instead is to make the "project parameter" optional or Nullable. Something similar was done recently on THIS PR which you may be able to use and/or take away from.

@mronus
Copy link
Contributor Author

mronus commented Apr 16, 2019

@cdancy I got the resolution for listing repos under username. The thing that I want to point out is listing all repos regardless of project. So I think we need to add the endpoint "/rest/api/1.0/repos" to the RepositoryApi somehow. I created a PR as start point. Please review and let me know your thoughts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants