【问题标题】:Querying github project cards with graphql使用 graphql 查询 github 项目卡片
【发布时间】:2018-07-20 19:16:42
【问题描述】:

我在 Github 中有一个包含一些列的项目,我正在尝试查找处于关闭状态的卡片(问题)。

使用 GraphQL,我无法构建可以过滤卡片的查询。目前我有这个查询:

query {
  organization(login:"org") {
    project(number:3) {
      columns(first:1){
        nodes{
          id,
          name,
          cards(first:1){
            nodes{
              content {
                ... on Issue {
                  url,
                  state
                }
              }
            }
          }
        }
      }
    }
  }
}

这会返回结果:

{
  "data": {
    "organization": {
      "project": {
        "columns": {
          "nodes": [
            {
              "id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
              "name": "On Deck",
              "cards": {
                "nodes": [
                  {
                    "content": {
                      "url": "https://github.com/org/repo/issues/606",
                      "state": "OPEN"
                    }
                  }
                ]
              }
            }
          ]
        }
      }
    }
  }
}

到目前为止,我收集到的是“项目卡”是 GraphQL 中的“联合”对象,我不知道如何向这些联合添加过滤器。

有什么建议吗?

谢谢!

【问题讨论】:

  • 我想做同样的事情并玩了但找不到任何东西。看起来你应该能够做这样的过滤器......

标签: github graphql querying


【解决方案1】:

我问了the same question on the GitHub Community forum。一位管理员回信:

GraphQL API 当前的构建方式,不,您不能仅使用查询语言根据项目卡所代表的问题状态过滤项目卡。您必须查询列中的所有卡片,然后自行过滤。

【讨论】:

  • 这不是打败 GraphQL 的主要优势之一吗?能够在服务器端进行大部分处理?
猜你喜欢
  • 1970-01-01
  • 2018-04-22
  • 2018-09-09
  • 2018-08-21
  • 2023-03-08
  • 1970-01-01
  • 1970-01-01
  • 2017-02-01
  • 2019-10-12
相关资源
最近更新 更多