diff --git a/Documentation/using-clients.md b/Documentation/using-clients.md index 7bb19c8a12..27a7d3d7f4 100644 --- a/Documentation/using-clients.md +++ b/Documentation/using-clients.md @@ -1,4 +1,4 @@ -#Using Generated Clients +#Using Generated Clients (C#) ##Contents @@ -6,4 +6,33 @@ TODO ##Overview -AutoRest generates a client type based on a name defined in the specification (see [swagger specification parsing](swagger.md) overview). The generated client inherits from [`ServiceClient`](../Microsoft.Rest/ClientRuntime/ServiceClient.cs). \ No newline at end of file +AutoRest generated code can currently work in a variety of .NET project types including: + + * Desktop applications (.NET 4.0 and .NET 4.5) + * Web applications (.NET 4.0 and .NET 4.5) + * Windows Phone (8.1) + * Windows Store App (8.1) + * Portable Class Libraries + +Before being able to compile generated code *Microsoft.Rest.ClientRuntime* nuget package needs to be added to the project. This package will include several dependent packages based on project profile such as Newtonsoft Json.Net. + +After that, the client can be used as such: +``` +var myClient = new MyClient(); +var salutation = myClient.GetGreeting(); +Console.WriteLine(salutation); +``` + +##Initialization +AutoRest generates a client type based on a name defined in the specification (see [swagger specification parsing](swagger.md) overview). The generated client inherits from [`ServiceClient`](../Microsoft.Rest/ClientRuntime/ServiceClient.cs) base type available in *Microsoft.Rest.ClientRuntime* nuget package. + +Client is generated with a number of constructors: + +* Default constructor that sets Base URL of the client to the one specified in the specification and configures the client to use anonymous authentication +* Constructor that accepts Base URL +* Constructor that accepts Credentials object (see [authentication](#Authentication) section) + +##Authentication +The client will support authentication if it was generated using [-AddCredentials](cli.md) flag. + +##Tracing \ No newline at end of file diff --git a/README.md b/README.md index 1a832d3e2b..3785e96faa 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ using MyNamespace; We now access the REST API with the fact that `GetGreeting` will throw an exception if the response is not a 200 OK, we can access the REST API with very little code (see [using generated clients](Documentation/using-clients.md) for details). ``` var myClient = new MyClient(); -var salutation = myClient.GetGreeting().Body(); +var salutation = myClient.GetGreeting(); Console.WriteLine(salutation); ``` Running the console app shows the greeting retrieved from the service API.