如何使用GraphQL在GitHub上查询项目注释?

huangapple go评论61阅读模式
英文:

How to query project notes on Github using GraphQL?

问题

I found a project at the address https://github.com/delbaoliveira/website/projects/1. I am using the GitHub GraphQL API to retrieve the desired notes.

I also created a similar project, but the returned result is undefined. I suspect that the variable columnId is incorrect.

So, how can I obtain the columnId? Please help me!

英文:

I found a project at the address https://github.com/delbaoliveira/website/projects/1. I am using the GitHub GraphQL API to retrieve the desired notes.
如何使用GraphQL在GitHub上查询项目注释?
I also created a similar project, but the returned result is undefined. I suspect that the variable columnId is incorrect.

如何使用GraphQL在GitHub上查询项目注释?

So, how can I obtain the columnId? Please help me!

答案1

得分: 0

你可以使用以下查询获取columnId

query { 
  repository(name: "website", owner: "delbaoliveira") {
    project(number: 1) {
      name
      columns(first: 1) {
        nodes {
          id
          name
        }
      }
    }
  }
}

但你也可以在没有columnId的情况下获取列数据,像这样:

query { 
  repository(name: "website", owner: "delbaoliveira") {
    project(number: 1) {
      name
      columns(first: 1) {
        nodes {
          name
          cards {
            nodes {
              note
            }
          }
        }
      }
    }
  }
}
英文:

You can get columnId with this query:

query { 
  repository(name: "website", owner: "delbaoliveira") {
    project(number: 1) {
      name
      columns(first: 1) {
        nodes {
          id
          name
        }
      }
    }
  }
}

But also you can go ahead and get column data without columnId like this:

query { 
  repository(name: "website", owner: "delbaoliveira") {
    project(number: 1) {
      name
      columns(first: 1) {
        nodes {
          name
          cards {
            nodes {
              note
            }
          }
        }
      }
    }
  }
}

huangapple
  • 本文由 发表于 2023年6月13日 16:58:13
  • 转载请务必保留本文链接:https://go.coder-hub.com/76463256.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定