Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jclem/graphsh
An interactive shell for GraphQL APIs
https://github.com/jclem/graphsh
Last synced: about 1 month ago
JSON representation
An interactive shell for GraphQL APIs
- Host: GitHub
- URL: https://github.com/jclem/graphsh
- Owner: jclem
- License: mit
- Created: 2019-06-20T18:06:39.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-06-20T23:46:27.000Z (over 5 years ago)
- Last Synced: 2023-04-09T20:53:45.457Z (over 1 year ago)
- Language: Go
- Size: 102 KB
- Stars: 12
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# graphsh
Graphsh (pronounced "graphsh") is an interactive shell for exploring GraphQL APIs.
## Installation
```console
$ go get github.com/jclem/graphsh
```## Usage
To start a `graphsh` session, supply a GraphQL endpoint and optional headers.
```console
$ 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"
}
}
}
}
```