Can you include an attributes based on type in GraphQL?

Viewed 40

I have this GraphQL query which retrieved the pull requests' 3 types of timeline items from Github API. Within each type alias that I have(dismissed as an example) I'm getting all the other types but as empty objects(because I'm not querying any field in case it's not from the type I want) is there a way to exclude objects that aren't of the types I needed, maybe something like @include if(__typename = something)

query ($name: String!, $owner: String!, $pr: Int!) {
  repository(name: $name, owner: $owner) {
    pullRequest(number: $pr) {
      timelineItems(first: 100) {
        dismissed: nodes {
          ... on ReviewDismissedEvent {
            actor {
              login
            }
            review {
              author {
                login
              }
            }
          }
        }
        removed: nodes {
          ... on ReviewRequestRemovedEvent {
            actor {
              login
            }
            requestedReviewer {
              ... on User {
                name
                login
                id
              }
            }
          }
        }
        added: nodes {
          ... on ReviewRequestedEvent {
            actor {
              login
            }
            requestedReviewer {
              ... on User {
                name
                login
                id
              }
            }
          }
        }
      }
    }
  }
}
0 Answers
Related