Cli reference

Generate the client

From http endpoint with --endpoint

plain text
genql --endpoint <> --output ./generated
You can fetch using get passing the --get flag
plain text
genql --get --endpoint <> --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 <> -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 <> -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 <> -o ./generated