你如何获得 Githubs API v4 的总贡献 [英] How do you get total contributions with Githubs API v4

查看:27
本文介绍了你如何获得 Githubs API v4 的总贡献的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在浏览 Github V4 API 文档,但似乎找不到查询当年总贡献的方法(如您的 github 个人资料所示).有没有人设法使用新的 API 从您的个人资料中获取一些统计数据?

I have been looking through the Github V4 API docs and I cannot seem to find a way to query total contributions for the year (as displayed on your github profile). Has anyone managed to use the new API to grab some statistics from your personal profile?

我在 github 上使用了 graphQL 和个人访问令牌,并设法获得了最少的用户配置文件数据;用户名、个人资料名称等

I am using graphQL and a Personal Access Token on github, and managed to get minimal user profile data; username, profile name etc.

推荐答案

ContributionsCollection 对象提供两个日期之间每种贡献类型的总贡献.

The ContributionsCollection object provides total contributions for each contribution type between two dates.

注意:fromto 最多可以相隔一年,对于更长的时间范围,可以多次请求.

Note: from and to can be a maximum of one year apart, for a longer timeframe make multiple requests.

query ContributionsView($username: String!, $from: DateTime!, $to: DateTime!) {
  user(login: $username) {
    contributionsCollection(from: $from, to: $to) {
      totalCommitContributions
      totalIssueContributions
      totalPullRequestContributions
      totalPullRequestReviewContributions
    }
  }
}

这篇关于你如何获得 Githubs API v4 的总贡献的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆