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
Navigate with arrow keys.
Select fields with <Space>.
Toggle between argument selection and its value with <Tab>.
End with <Enter>.
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
{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 very well.
Fragments and unions are not implemented.
Mutations and subscriptions are not implemented.
And much more.
Ideas
Show GraphQL API documentation.
Mutations?
Subscriptions?
Arguments and variables:
For required arguments without default value:
■: non-null value $: variable
For required arguments with default value:
□: omit ■: non-null value $: variable
For optional arguments:
□: omit ■: non-null value $: variable n: null
Scalar example:
╭─ Query │ ▼ standard_library │ ▼ package │ ■ name: "" │ □ name │ ▶ packages
List example:
╭─ Query │ ▼ item │ □ kinds: │ ■ kinds2: │ [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: "foo" │ kind: │ [0] ■ a: "bar" │ ■ b: "ne" │ □ c: │ [1]
Print the variables:
$ gqt -v {"name": "foo", "kind": [{"a": "bar", "b": "ne"}]}
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.53.0.tar.gz
.
File metadata
- Download URL: gqt-0.53.0.tar.gz
- Upload date:
- Size: 9.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b383057e9fc341055e0b94dce4bc3c4f9d46b0ef4d50b67eee6642541562b7cb |
|
MD5 | e141cf78407ada41417d29d9a5ec0f9f |
|
BLAKE2b-256 | 3f354e2c633349f68eee043a58214aa2cb27d252452be63d1cf5d8ae106107ff |
File details
Details for the file gqt-0.53.0-py3-none-any.whl
.
File metadata
- Download URL: gqt-0.53.0-py3-none-any.whl
- Upload date:
- Size: 9.3 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 | 4a50dcd97a5edd665121f7fe19d7ef696f59069391205856ce6f3157a4850798 |
|
MD5 | 19a35295ff4eef9c72e7a080cebe508a |
|
BLAKE2b-256 | 0a811d9c6daec3fd653517dc8ca46c06ccc3d4072e0a6b4e44fba99301c3a618 |