size in bytes per language in api v4?

Hi,

I’m trying to get the size in bytes written in each language for each repo. 
According to the documentaton: https://developer.github.com/v4/object/languageconnection/
It seems to be feasible… but for some reason, I can’t get it to work as I get the total size in bytes irrespective of the language for a given repo. See query below.
Would anyone mind helping me?

{
  search(query: "atom", type: REPOSITORY, first: 10) {
    repositoryCount
    edges {
      node {
        ... on Repository {
          name
          languages
          {
            totalSize
          }
        }
      }
    }
  }
}

Thanks!

Guillaume

Hey @guillaumemillot!

I believe you can get the data you’re looking for by looking on the LanguageEdge, as documented here: https://developer.github.com/v4/object/languageedge/

This query would look like this:

{
  search(query: "atom", type: REPOSITORY, first: 10) {
    repositoryCount
    nodes {
      ... on Repository {
        languages(first: 10) {
          edges {
            node {
              name
            }
            size
          }
        }
      }
    }
  }
}

Let me know if this gets you what you want, or if I’m misread the question!

2 Likes