Generate the client

From http endpoint with --endpoint

plain text
genql --endpoint <https://countries.trevorblades.com> --output ./generated
You can fetch using get passing the --get flag
plain text
genql --get --endpoint <https://countries.trevorblades.com> --output ./generated

From local schema with --schema

plain text
genql --schema ./schema.graphql --output ./generated

Passing headers with -H

plain text
genql -H 'Authorization: Bearer myToken' -e <https://countries.trevorblades.com> -o ./generated

Changing scalar types with -S

This is useful if you want to map from a custom scalar to a type like string, number, etc.
By default custom scalars have type any
plain text
genql -S MyScalar:string -S AnotherScalar:number -e <https://countries.trevorblades.com> -o ./generated

Sort generated code with --sort

If you see a lot of diffs between one generation and another you can use the --sort flag to sort object properties
The order of generated object properties is taken from the schema introspection by default, so you shouldn't need this flag if using popular frameworks like Apollo server
plain text
genql --sort -e <https://countries.trevorblades.com> -o ./generated