Skip to content
This repository was archived by the owner on Jun 23, 2019. It is now read-only.

Get locations of elm users from Github #4

Open
shishkin opened this issue Apr 24, 2018 · 0 comments
Open

Get locations of elm users from Github #4

shishkin opened this issue Apr 24, 2018 · 0 comments

Comments

@shishkin
Copy link
Collaborator

Github provides GraphQL API. It's possible to use it to search for users that have Elm contributions:

{
  search(query: "language:elm", type: USER, first: 100) {
    userCount
    nodes {
      ... on User {
        login
        name
        location
      }
    }
  }
}

Which will give something like:

{
  "data": {
    "search": {
      "userCount": 882,
      "nodes": [
        {
          "login": "evancz",
          "name": "Evan Czaplicki",
          "location": null
        },
        {
          "login": "rtfeldman",
          "name": "Richard Feldman",
          "location": "Philadelphia, PA"
        },
        {
          "login": "jessitron",
          "name": "Jessica Kerr",
          "location": "St. Louis, MO"
        },
        {
          "login": "lukewestby",
          "name": "Luke Westby",
          "location": "Los Angeles, CA"
        },
        {
          "login": "krisajenkins",
          "name": "Kris Jenkins",
          "location": "London"
        }
      ]
    }
  }
}

We can use Graphqelm package to generate Elm types and for the Github API like this (after following package installation instructions):

npx graphqelm https://api.github.com/graphql --header 'Authorization: bearer <INSERT YOUR GITHUB ACCESS TOKEN>' --base Github --output src/

There is an example of how to search for repos using the library and the Github GraphQL API: https://github.com/dillonkearns/graphqelm/blob/master/examples/src/ElmReposRequest.elm.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant