如何使用GraphQL获取GitHub存储库的提交以及已更改的文件和更改本身

jar*_*jar 13 graphql github-graphql

我能够获得提交列表(包括提交消息,oid,提交URL等字段)以及changedFilesmaster分支上的存储库中创建的数量.
但是,我无法弄清楚如何获取有关更改本身和更改的文件的任何信息.

在REST API的第3版中,有关更改的信息包含在files- > patchfiles- >中,raw_url或者blob_url在该阶段提供了有关原始文件本身的信息.

Q)在使用GraphQL的GitHub API的第4版中,我如何获得相应的信息?

查询我现在卡住了(为简洁起见只显示1次提交) -

query {
  rateLimit{
    cost
    remaining
  }
  repository(owner: "elastic", name: "elasticsearch") {
    name
    defaultBranchRef {
      name
      target {
        ... on Commit {
          history(first:1){
            nodes{
              message
              changedFiles
              id
              oid
              treeUrl
              url
              tree{
                oid
              }
            }
            pageInfo{
              hasNextPage
              startCursor
              endCursor
            }
          }
        }
      }
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

输出:

{
  "data": {
    "rateLimit": {
      "cost": 1,
      "remaining": 4999
    },
    "repository": {
      "name": "elasticsearch",
      "defaultBranchRef": {
        "name": "master",
        "target": {
          "history": {
            "nodes": [
              {
                "message": "Small corrections to HLRC doc for _termvectors (#35221)\n\nRelates to #33447",
                "changedFiles": 2,
                "id": "MDY6Q29tbWl0NTA3Nzc1OmEyYzIyYWQ3YWViMGY4ZDUxNDg2NzdkZDcyMjJhZDQzYWZlZTlhMTc=",
                "oid": "a2c22ad7aeb0f8d5148677dd7222ad43afee9a17",
                "treeUrl": "https://github.com/elastic/elasticsearch/tree/a2c22ad7aeb0f8d5148677dd7222ad43afee9a17",
                "url": "https://github.com/elastic/elasticsearch/commit/a2c22ad7aeb0f8d5148677dd7222ad43afee9a17",
                "tree": {
                  "oid": "4f5f11e0e55aeafc4677800959232726a2cd787c"
                }
              }
            ],
            "pageInfo": {
              "hasNextPage": true,
              "startCursor": "a2c22ad7aeb0f8d5148677dd7222ad43afee9a17 0",
              "endCursor": "a2c22ad7aeb0f8d5148677dd7222ad43afee9a17 0"
            }
          }
        }
      }
    }
  }
}
Run Code Online (Sandbox Code Playgroud)