GraphQL client in the terminal.
Project description
Build and execute GraphQL queries in the terminal.
This project is inspired by https://graphiql-online.com.
Installation
pip3 install gqt
It’s recommended to install bat for pretty output.
Controls
Press h or ? for help.
Examples
Set default GraphQL endpoint:
$ export GQT_ENDPOINT=https://mys-lang.org/graphql
Interactively create a query and execute it:
$ gqt
{
"statistics": {
"numberOfGraphqlRequests": 3
}
}
Repeat last query:
$ gqt -r
{
"statistics": {
"numberOfGraphqlRequests": 4
}
}
Print the query instead of executing it:
$ gqt -q
query Query {
statistics {
numberOfGraphqlRequests
}
}
YAML output:
$ gqt -y
statistics:
numberOfGraphqlRequests: 8
Print the schema:
$ gqt --print-schema
type Query {
standardLibrary: StandardLibrary!
statistics: Statistics!
activities: [Activity!]!
}
type StandardLibrary {
package(name: String!): Package!
packages: [Package!]
numberOfPackages: Int
numberOfDownloads: Int
}
...
Known issues
Arguments does not work for scalar and input types.
Unions are not implemented.
And much more.
Ideas
Leaves with arguments:
type Query { foo(id: Int, name: String): String } Unselected: ╭─ Query │ □ foo Selected: ╭─ Query │ ■ foo │ ■ id: 5 │ □ name:
Required arguments with default value:
□: omit ■: non-null value $: variable
Check for schema modifications when starting. Do it in the background and notify the user if it was modified.
New schema fetched from the server. Use it? y/n
List argument example:
╭─ Query │ ▼ item │ ■ kinds: │ [0] ■ a: foo │ ■ b: eq │ ■ c: │ [0] ■ a: x │ ■ b: y │ [1] │ [1] ■ a: bar │ ■ b: ne │ □ c: │ [2]
Input example:
╭─ Query │ ▼ item │ ■ config: │ ■ unit: metric │ □ width: │ □ length │ □ weight
Variables example:
╭─ Query │ ▼ standardLibrary │ ▼ package │ $ name: name │ ■ id: 5 │ $ kind: kind │ □ name │ □ numberOfDownloads │ ▶ statistics ╭─ Variables │ name: time │ kind: │ [0] ■ a: bar │ ■ b: ne │ □ c: │ [1]
Print variables:
$ gqt -v {"name": "foo", "kind": [{"a": "bar", "b": "ne"}]}
Unions:
Always query __typename.
union SearchResult = Book | Author type Book { title: String! } type Author { name: String! } type Query { search(contains: String): [SearchResult!] } Unselected: ╭─ Query │ ▶ search Selected: ╭─ Query │ ▼ search │ ▶ Book │ ■ title │ ▶ Author │ ■ name
Alias?
Press a to create an alias.
Press d to delete an alias.
smallPicture and mediumPicture are aliases of picture.
╭─ Query │ ▶ Book │ ▶ picture │ ▼ smallPicture: picture │ ■ width: 320 │ ■ height: 240 │ ▼ mediumPicture: picture │ ■ width: 800 │ ■ height: 600
Subscriptions. Probably out of scope.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file gqt-0.70.0.tar.gz
.
File metadata
- Download URL: gqt-0.70.0.tar.gz
- Upload date:
- Size: 11.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50432f85bc0551aaf41e43c1358b7c895f0931513af76109509bb80fe36777e5 |
|
MD5 | 1f03b1d392b80076f6c1720aa6979ca3 |
|
BLAKE2b-256 | 431d9c55d91762e1b5bfd5f0c16efb61684033a8b10b7dd254bc27e4ab8a4ec3 |
File details
Details for the file gqt-0.70.0-py3-none-any.whl
.
File metadata
- Download URL: gqt-0.70.0-py3-none-any.whl
- Upload date:
- Size: 12.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a53e21cab57e1b58a8378967225b9730c966f961a856231c33557f0283524652 |
|
MD5 | e68cafde92cb075243bb4b1ad208040f |
|
BLAKE2b-256 | c400d7143e68897ab27ffc7f05f4d3677b6cc3b7f74dbce213e9c09a3f9dc29b |