techgaun/active-forks

Github apiv4 GraphQL

Opened this issue · 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/

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

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
        }
      }
    }
  }
}

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
        }
      }
    }
  }
}