Github API 按最新关注者排序

Github API sort by latest followers

我正在尝试从 Github API 获取一些数据。

我的项目快完成了,但我还需要最后 5 个用户关注我。

我怎样才能得到这个?在官方文档上也找不到任何解决方案 google.

非常感谢

如果你使用Github GraphQL API v4,你可以在viewer中使用followers(last: 5),如果你想获得认证用户的最后5个关注者:

{
  viewer {
    followers(last: 5) {
      nodes {
        login
      }
    }
  }
}

Try it in the explorer

或针对特定用户:

{
  user(login: "bertrandmartel") {
    followers(last: 5) {
      nodes {
        login
      }
    }
  }
}

Try it in the explorer

您也可以将 API v3 与 /users/:user/followers 一起使用,但您需要执行 2 或 3 个请求: