'How to query data from GitHub Discussions using GitHub's GraphQL API

I want to query the data from https://github.com/prisma/prisma/discussions via GitHub's GraphQL API but I don't know how to access it.

GitHub Discussions are a beta feature that's currently available only on a few repos, prisma/prisma being one of them. I would have expected that I can query the data in a similar fashion to querying issues and pull requests of a repo:

{
  repository(
    owner: "prisma"
    name: "prisma"
  ) {
    pullRequests(first: 5 orderBy: {
      field: CREATED_AT,
      direction: DESC
    }) {
      edges {
        node {
          title
        }
      }
    }
    issues(first: 5 orderBy: {
      field: CREATED_AT,
      direction: DESC
    }) {
      edges {
        node {
          title
        }
      }
    }
  }
}

I'm basically looking for a query that would allow me to do this:

{
  repository(
    owner: "prisma"
    name: "prisma"
  ) {
    # this doesn't work
    discussions(first: 5 orderBy: {
      field: CREATED_AT,
      direction: DESC
    }) {
      edges {
        node {
          title
        }
      }
    }
  }
}

But such a discussions property doesn't exist on the Repository type in the GitHub API.

EDIT (Dec 8, 2020): I learned from the GitHub team that the data is not yet available via the public GraphQL API but they're working on releasing it soon. I'll leave the question open until it's available.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source