Generate the client
From http endpoint with --endpoint
plain textgenql --endpoint <https://countries.trevorblades.com> --output ./generated
You can fetch using get passing the
--get
flagplain textgenql --get --endpoint <https://countries.trevorblades.com> --output ./generated
From local schema with --schema
plain textgenql --schema ./schema.graphql --output ./generated
Passing headers with -H
plain textgenql -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 textgenql -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 propertiesThe 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 textgenql --sort -e <https://countries.trevorblades.com> -o ./generated