active-forks icon indicating copy to clipboard operation
active-forks copied to clipboard

Github apiv4 GraphQL

Open floatas opened this issue 5 years ago • 3 comments

Hey, Not sure if this is issue, maybe question\suggestion. Looks like github will add GraphQL support to their api. Using it would solve probably all current issues, you could make one query and get all required data, maybe pagination would work, maybe sorting works. Haven't looked much in what is supported, but I think this should be reviewed, maybe it's possible to migrate.

https://developer.github.com/v4/

floatas avatar Nov 16 '18 19:11 floatas

Great point @floatas if anyone more familiar with the GraphQL based API has any suggestion, feel free to give some insights. I will take a look at this as well sometimes this weekend. Thanks @floatas

techgaun avatar Nov 16 '18 19:11 techgaun

An example schema would be:

{
  repository(owner: "techgaun", name: "github-dorks") {
    id
    forks(first: 10, orderBy: {field: UPDATED_AT, direction: DESC}) {
      edges {
        node {
          id
          name
          diskUsage
          owner {
            login
          }
          forkCount
          issues {
            totalCount
          }    
          watchers {
            totalCount
          }
          stargazers {
            totalCount
          }
          updatedAt
        }
      }
    }
  }
}

NJannasch avatar Mar 18 '19 15:03 NJannasch

Here's the schema we can use and is based off what @NJannasch posted above but includes the repository we are looking at as well (& can be used to close #21 ):

{
  repository(owner: "techgaun", name: "github-dorks") {
    id
    name
    defaultBranchRef {
      id
      name
    }
    diskUsage
    owner {
      login
    }
    forkCount
    issues(states: [OPEN]) {
      totalCount
    }
    watchers {
      totalCount
    }
    stargazers {
      totalCount
    }
    pushedAt
    forks(first: 100, orderBy: {field: STARGAZERS, direction: DESC}) {
      edges {
        node {
          id
          name
          diskUsage
          defaultBranchRef {
            id
            name
          }
          owner {
            login
          }
          forkCount
          issues(states: [OPEN]) {
            totalCount
          }    
          watchers {
            totalCount
          }
          stargazers {
            totalCount
          }
          pushedAt
        }
      }
    }
  }
}

techgaun avatar Apr 07 '19 21:04 techgaun