简体   繁体   English

Github GraphQL API:如何收集特定用户的存储库?

[英]Github GraphQL API: How can I gather specific user's repositories?

I'm trying to get repositories of user with login name "somelogin".我正在尝试获取登录名“somelogin”的用户存储库。

It returns all repositories but I'm trying to get repositories owned by him only.它返回所有存储库,但我试图获取仅由他拥有的存储库。 Because new API uses GraphQL I couldn't did it.因为新 API 使用 GraphQL,所以我做不到。

Currently I'm using:目前我正在使用:

{
   "query": "query { user(login:\"furknyavuz\") {repositories(first: 50) { nodes { name url }}}}"
}

You can use isFork: false to exclude fork.您可以使用isFork: false来排除 fork。 In the explorer :资源管理器中

{
  user(login: "furknyavuz") {
    repositories(first: 50, isFork: false) {
      nodes {
        name
        url
      }
    }
  }
}

With curl :卷曲:

curl -H "Authorization: bearer token" -d '
 {
   "query": "query { user(login: \"furknyavuz\") { repositories(first: 50, isFork: false) { nodes { name url } } } }"
 }
' https://api.github.com/graphql

It's super easy to build graph QL using the Github GraphQL explorer.使用 Github GraphQL 资源管理器构建图形 QL 非常容易。 Please refer to the attached screenshot.请参阅随附的屏幕截图。 https://docs.github.com/en/graphql/overview/explorer https://docs.github.com/en/graphql/overview/explorer

{ user(login: "leerob") { name email company bio followers { totalCount } following { totalCount } repositories(first: 50, isFork: false) { nodes { name url stargazerCount primaryLanguage { id name } } } } } { 用户(登录:“leerob”){ 名称电子邮件公司生物关注者 { totalCount } 以下 { totalCount } 存储库(第一个:50,isFork:false){ 节点 { name url stargazerCount primaryLanguage { id name } } } } }

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM