How to get the content of a specific discussion comment graphql query?

63 views Asked by At

Given a link to a discussion comment ex: https://github.com/orgName/repoName/discussions/discussionId#discussioncomment-discussionCommentId, How can I use the discussionCommentId to target the graphql query to return the content of the specific discussion comment?

Currently I'm querying to get 100 comments and 100 replies for each comment since that's the max record the API allows but the issue is if the discussionCommentId is in index 101 then I'm missing it. What's the best way to structure the query to target the specific discussion comment given that my service doesn't have any information besides a link to the specific discussion comment?

Example of the query I'm currently using

{
  repository(owner: "orgName", name: "repoName") {
    discussion(number: discussionId) {
      title
      comments(first: 100) {
        edges {
          node {
            body
            replies(first: 100) {
              edges {
                node {
                  body
                }
              }
            }
          }
        }
      }
    }
  }
}

Thank you in advance.

I've tried to use the cursor but I'm not sure how to get the cursorId for a specific discussion comment via API call?

{
  repository(owner: "orgName", name: "repoName") {
    discussion(number: discussionId) {
      title
      comments(after: "cursorId", first: 100) {
        edges {
          node {
            body
            replies(first: 100) {
              edges {
                node {
                  body
                }
              }
            }
          }
        }
      }
    }
  }
}
0

There are 0 answers