|
1 | 1 | #AutoRest Command Line Interface Documentation |
2 | 2 |
|
3 | | -##Contents |
4 | | - |
5 | | -* [Name](#name) |
6 | | -* [Synopsis](#synopsis) |
7 | | -* [Description](#description) |
8 | | -* [Parameters](#parameters) |
9 | | -* [Examples](#examples) |
10 | | - |
11 | | - |
12 | | -##Name |
13 | | -`AutoRest.exe` The **AutoRest** tool generates client libraries for accessing RESTful web services. |
14 | | - |
15 | | -##Synopsis |
| 3 | +##Syntax |
16 | 4 | ```bash |
17 | | -'AutoRest.exe' -CodeGenerator <value> -Modeler <value> -Input <value> -BaseNamespace <value> [-OutputFolder <value>] [-OutputAsSingleFile <value>] [-Header <value>] [-AddCredentials <value>] |
| 5 | +AutoRest.exe -CodeGenerator <value> -Modeler <value> -Input <value> -BaseNamespace <value> [-OutputFolder <value>] [-OutputAsSingleFile <value>] [-Header <value>] [-AddCredentials <value>] |
18 | 6 | ``` |
19 | | -##Description |
20 | | -AutoRest is an extensible client library generator and can support multiple types of input and output. AutoRest.exe comes with the `AutoRest.json` configuration file that defines the available inputs (Modelers) and outputs (CodeGenerators). When invoking AutoRest.exe, you must specify the `-Modeler` and `-CodeGenerator` to use. |
21 | 7 |
|
22 | 8 | ##Parameters |
23 | | -**-OutputFolder** |
24 | | -Output folder for generated files. Defaults to `Generated` directory. |
| 9 | +**-OutputFolder** Output folder for generated files. Defaults to Generated directory. |
25 | 10 |
|
26 | | -**-OutputAsSingleFile** |
27 | | -Output file name. If specified, all the code will be written into this single file. Otherwise, AutoRest will split code by operations and write individual files into OutputFolder. |
| 11 | +**-OutputAsSingleFile** Output file name. If specified, all the code will be written into this single file. Otherwise, AutoRest will split code by operations and write individual files into OutputFolder. |
28 | 12 |
|
29 | | -**-CodeGenerator** |
30 | | -Code generation language. So far we have the following languages supported (the list is growing): |
| 13 | +**-CodeGenerator** Code generation language. |
31 | 14 |
|
32 | | - - C# |
| 15 | +**-Modeler** Modeler for the input specification. |
33 | 16 |
|
34 | | -**-Modeler** |
35 | | -The input specification type. So far we only support [Swagger 2.0](https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md). |
| 17 | +**-Input** Path to the input specification file. URLs are not supported at this moment. |
36 | 18 |
|
37 | | -**-Input** |
38 | | -Path to the input specification file. URLs are not supported at this moment. |
| 19 | +**-BaseNamespace** Base namespace for generated code |
39 | 20 |
|
40 | | -**-BaseNamespace** |
41 | | -Base namespace for generated code. This is a required parameter but not used for all languages. |
| 21 | +**-Header** Default file header contents. Use NONE if no header is required. |
42 | 22 |
|
43 | | -**-Header** |
44 | | -Default file header contents. Use `NONE` if no header is required. |
| 23 | +**-AddCredentials** If set to true the generated client will have ServiceClientCredentials property. A set of corresponding constructors will be generated and its ProcessHtppRequestAsync method will be called on the http requests. Users can derive from this class to add their customized authentication behaviors. |
45 | 24 |
|
46 | | -**-AddCredentials** |
47 | | -If set to true the generated client will have [ServiceClientCredentials](https://github.com/Azure/AutoRest/blob/master/Microsoft.Rest/ClientRuntime/ServiceClientCredentials.cs) property. A set of corresponding constructors will be generated and its `ProcessHtppRequestAsync` method will be called on the http requests. Users can derive from this class to add their customized authentication behaviors. |
48 | 25 |
|
49 | 26 |
|
50 | 27 | ##Examples |
51 | | -- Generate C# client library from a Swagger formatted input specification `swagger.json` with namespace `MyNamespace`: |
| 28 | +- Generate C# client library from a Swagger formatted input specification swagger.json with namespace MyNamespace: |
52 | 29 | ```bash |
53 | 30 | AutoRest.exe -CodeGenerator CSharp -Modeler Swagger -Input swagger.json -BaseNamespace MyNamespace |
54 | 31 | ``` |
55 | | -This will generate all the C# files for corresponding operations in the `Generated` directory. |
56 | 32 |
|
57 | | -- Generate C# client library from a Swagger formatted input specification `swagger.json` with namespace `MyNamespace` into one single file `client.cs` with a customized header: |
| 33 | +- Generate C# client library from a Swagger formatted input specification swagger.json with namespace MyNamespace into one single file client.cs with a customized header: |
58 | 34 | ```bash |
59 | 35 | AutoRest.exe -CodeGenerator CSharp -OutputAsSingleFile client.cs -Modeler Swagger -Input swagger.json -BaseNamespace MyNamespace -Header "Copyright Contoso Ltd" |
60 | 36 | ``` |
61 | | -This will generate one single file `client.cs` in the `Generated` directory. |
62 | 37 |
|
63 | | -- Generate C# client library from a Swagger formatted input specification `swagger.json` with namespace `MyNamespace` with credential property added: |
| 38 | +- Generate C# client library from a Swagger formatted input specification swagger.json with namespace MyNamespace with credential property added: |
64 | 39 | ```bash |
65 | 40 | AutoRest.exe -CodeGenerator CSharp -Modeler Swagger -Input swagger.json -BaseNamespace MyNamespace -AddCredentials true |
66 | | -``` |
| 41 | +``` |
0 commit comments