提交器上的Github GraphQL API v4查询
我试图在Githubs GraphQL api上运行以下查询:提交器上的Github GraphQL API v4查询,graphql,github-api,github-api-v4,Graphql,Github Api,Github Api V4,我试图在Githubs GraphQL api上运行以下查询: { user(login: "davekaj") { id repositories(first: 10, orderBy: {field: NAME, direction: ASC}) { nodes { ref(qualifiedName: "master") { target { ... on Commit {
{
user(login: "davekaj") {
id
repositories(first: 10, orderBy: {field: NAME, direction: ASC}) {
nodes {
ref(qualifiedName: "master") {
target {
... on Commit {
history(first: 15, author: "WHAT DO I PUT HERE") {
totalCount
nodes {
additions
author {
name
user {
id
}
}
committedDate
deletions
}
}
}
}
}
}
}
}
}
它想让我在提交人
上筛选历史记录(作者:)
。我尝试传递我的用户名或唯一用户ID,但不起作用。我实际上是在给它传递一个字符串,但它需要类型CommitAuthor
。如何传递一个CommitAuthor
值
我不清楚,我搜索了文档和模式,什么也没找到
请帮忙 啊,所以我看了graphql文档(而不仅仅是github文档)之后,答案其实非常简单
CommitAuthor
是一种输入类型,如下所述
结果是您传递了一个对象CommitAuthor
。在这种情况下,我只需要传递id,它看起来像这样:作者:{id:“MDQ6VXNlcjIyNDE3Mzgy”}
请参阅下面完整的代码
{
user(login: "davekaj") {
id
repositories(first: 10, orderBy: {field: NAME, direction: ASC}) {
nodes {
ref(qualifiedName: "master") {
target {
... on Commit {
history(first: 15, author: {id: "MDQ6VXNlcjIyNDE3Mzgy"}) {
totalCount
nodes {
additions
author {
name
user {
id
}
}
committedDate
deletions
}
}
}
}
}
}
}
}
}