在GitHub API中获取用户的组织存储库

Mat*_*man 7 github github-api

我们在Stack Overflow Careers上使用GitHub API来引入用户的存储库.我们没有成功引入属于组织的用户存储库.

例如,wycats是jQuery项目的贡献者.然而,通过API 查询他的存储库并没有表明这一点 - jQuery repojQuery组织所有.

什么是API调用,以了解wycats是jQuery存储库的贡献者?正确答案将采用URL的形式,该URL返回给定用户名的组织存储库列表.如果需要多次通话,那很好.

谢谢!

Mat*_*all 4

我想这就是你要找的。

检查组织成员资格

/user/show/:user/organizations [GET]
Run Code Online (Sandbox Code Playgroud)

https://github.com/api/v2/json/user/show/wycats/organizations

列出任何组织的所有公共存储库

/organizations/:org/public_repositories [GET]
Run Code Online (Sandbox Code Playgroud)

https://github.com/api/v2/json/organizations/jquery/public_repositories

  • 这几乎就是您所追求的。你是对的,该组织“拥有”该存储库。实际上没有“给定用户名的组织存储库”的上下文......组织有存储库,组织也有用户。除此之外,这只是用户拥有什么权限的问题,据我所知,公共 API 无法提供这些权限。 (2认同)