|
1 | 1 | # GraphQL client CLI
|
2 | 2 |
|
3 | 3 | This is still a WIP, the main use for it now is to download the `schema.json` from a GraphQL endpoint, which you can also do with [apollo-codegen](https://github.com/apollographql/apollo-cli).
|
| 4 | + |
| 5 | +## Install |
| 6 | + |
| 7 | +``` |
| 8 | +cargo install graphql-client-cli |
| 9 | +``` |
| 10 | + |
| 11 | +## introsect schema |
| 12 | + |
| 13 | +``` |
| 14 | +USAGE: |
| 15 | + graphql-client introspect-schema [OPTIONS] <schema_location> |
| 16 | +
|
| 17 | +FLAGS: |
| 18 | + -h, --help Prints help information |
| 19 | + -V, --version Prints version information |
| 20 | +
|
| 21 | +OPTIONS: |
| 22 | + --authorization <authorization> |
| 23 | + --output <output> Where to write the JSON for the introspected schema. |
| 24 | +
|
| 25 | +ARGS: |
| 26 | + <schema_location> The URL of a GraphQL endpoint to introspect. |
| 27 | +``` |
| 28 | + |
| 29 | +## generate client code |
| 30 | + |
| 31 | +``` |
| 32 | +USAGE: |
| 33 | + graphql-client generate [FLAGS] [OPTIONS] <query_path> <schema_path> <module_name> <output> |
| 34 | +
|
| 35 | +FLAGS: |
| 36 | + -h, --help Prints help information |
| 37 | + --no-formatting If you don't want to execute rustfmt to generated code, set this option. Default value is |
| 38 | + false. Formating feature is disabled as default installation. |
| 39 | + -V, --version Prints version information |
| 40 | +
|
| 41 | +OPTIONS: |
| 42 | + -a, --additional-derives <additional_derives> |
| 43 | + Additional derives that will be added to the generated structs and enums for the response and the variables. |
| 44 | + --additional-derives='Serialize,PartialEq' |
| 45 | + -d, --deprecation-strategy <deprecation_strategy> |
| 46 | + You can choose deprecation strategy from allow, deny, or warn. Default value is warn. |
| 47 | +
|
| 48 | + -o, --selected-operation <selected_operation> |
| 49 | + Name of target query. If you don't set this parameter, cli generate all queries in query file. |
| 50 | +
|
| 51 | +
|
| 52 | +ARGS: |
| 53 | + <query_path> Path to graphql query file. |
| 54 | + <schema_path> Path to graphql schema file. |
| 55 | + <module_name> Name of module. |
| 56 | + <output> Path you want to output to. |
| 57 | +``` |
| 58 | + |
| 59 | +If you want to use formatting feature, you should install like this. |
| 60 | + |
| 61 | +`cargo install graphql-client-cli --features rustfmt` |
0 commit comments