Coder Social home page Coder Social logo

graphsh's Introduction

graphsh

Graphsh (pronounced "graphsh") is an interactive shell for exploring GraphQL APIs.

Installation

$ go get github.com/jclem/graphsh

Usage

To start a graphsh session, supply a GraphQL endpoint and optional headers.

$ graphsh https://api.github.com/graphql -H "Authorization: Bearer $token"
› ▋

Commands

help

The help command prints information about each command in graphsh, or can be provided a command name for help for a specific command.

Path traversal

Since Graphsh represents nested fields as something akin to directories, use the path traversal syntax to set your current path, relative to the current path.

› .repository(owner: "jclem", name: "graphsh")
› pp
.query.repository(owner: "jclem", name: "graphsh")
› .owner
› pp
.query.repository(owner: "jclem", name: "graphsh").owner

You can use .. to traverse upwards:

› .repository(owner: "jclem", name: "graphsh").owner
› pp
.query.repository(owner: "jclem", name: "graphsh").owner
› ..
› pp
.query.repository(owner: "jclem", name: "graphsh")
› .owner.repositories
› pp
.query.repository(owner: "jclem", name: "graphsh").owner.repositories
› ../..
› pp
.query.repository(owner: "jclem", name: "graphsh")

on

The on {ConcreteType} command applies a concrete type to your current query. Passing no concrete type removes one.

› .repository(owner: "jclem", name: "graphsh").object(expression: "HEAD")
› pq
query {
  repository( name: "graphsh", owner: "jclem") {
    object(expression: "HEAD") {

    }
  }
}
› on Commit
› pq
query {
  repository( name: "graphsh", owner: "jclem") {
    object(expression: "HEAD") {
      ... on Commit {

      }
    }
  }
}
› on
› pq
query {
  repository( name: "graphsh", owner: "jclem") {
    object(expression: "HEAD") {

    }
  }
}

pp

The pp command shows your present path.

› .repository(owner: "jclem", name: "graphsh")
› pp
.query.repository(owner: "jclem", name: "graphsh")
› .owner
› pp
.query.repository(owner: "jclem", name: "graphsh").owner

pq

The pq command shows the current state of your query, which is a reflection of your present path.

› .repository(owner: "jclem", name: "graphsh").owner
› pq
query {
  repository(owner: "jclem", name: "graphsh") {
    owner {

    }
  }
}

ls

The ls command shows information about each field on the current node.

› .meta
› ls
gitHubServicesSha                  Returns a String that's a SHA of `github-services`
gitIpAddresses                     IP addresses that users connect to for git operations
hookIpAddresses                    IP addresses that service hooks are sent from
importerIpAddresses                IP addresses that the importer connects from
isPasswordAuthenticationVerifiable Whether or not users are verified
pagesIpAddresses                   IP addresses for GitHub Pages' A records

Querying

In order to query, use an expression surrounded by brackets.

› .repository(owner: "jclem", name: "graphsh")
› {name, owner {login}}
{
  "data": {
    "repository": {
      "name": "graphsh",
      "owner": {
        "login": "jclem"
      }
    }
  }
}

graphsh's People

Contributors

jclem avatar

Stargazers

netop://ウエハ avatar Michael Demarais avatar Kelsey Yim avatar Evgeny avatar Maryanne Wachter avatar Femi avatar John Barker avatar Juri Hahn avatar Nick Beattie avatar Hal Lee avatar Margaret avatar Iheanyi Ekechukwu avatar

Watchers

James Cloos avatar Michael Demarais avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.