fragment TreeEntry on Entry {
  __typename
  id
  sha
  name
  flatPath
  type
}

query getPaginatedTree($projectPath: ID!, $path: String, $ref: String!, $nextPageCursor: String) {
  project(fullPath: $projectPath) {
    id
    __typename
    repository {
      __typename
      paginatedTree(path: $path, ref: $ref, after: $nextPageCursor) {
        __typename
        pageInfo {
          __typename
          endCursor
          startCursor
          hasNextPage
        }
        nodes {
          __typename
          trees {
            __typename
            nodes {
              ...TreeEntry
              webPath
            }
          }
          submodules {
            __typename
            nodes {
              ...TreeEntry
              webUrl
              treeUrl
            }
          }
          blobs {
            __typename
            nodes {
              ...TreeEntry
              mode
              webPath
              lfsOid
            }
          }
        }
      }
    }
  }
}
