nerdishbynature / octokit.swift

A Swift API Client for GitHub and GitHub Enterprise
MIT License
490 stars 126 forks source link

Cannot list private repositories for an organization #73

Open mxcl opened 5 years ago

mxcl commented 5 years ago

The url for org repos is:

/org/\(name)/repos

But the code only uses:

/user/\(name)/repos

Which lists public repos, but not private ones.

pietbrauer commented 5 years ago

PullRequests are welcome

mxcl commented 5 years ago

I will PR, any particular way you want this done? It could be different functions, it could be an enum parameter, boolean parameter. Or I can just choose.

phatblat commented 5 years ago

Looks like owner is just a string, but it would be ideal if there were a way to automatically determine user vs. org behind the scenes and then make the right API call. However, if it takes an extra API call to determine user type, then maybe best to have different function such as userRepositories and orgRepositories.

The /users/:username/repos and /orgs/:org/repos endpoints have slightly different parameters, but appear to have the same payload format, so should be able to use the same Repository model for parsing.