diff --git a/bin/csharp-dotnet2-petstore.sh b/bin/csharp-dotnet2-petstore.sh
new file mode 100755
index 00000000000..fdab8bc413b
--- /dev/null
+++ b/bin/csharp-dotnet2-petstore.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+SCRIPT="$0"
+
+while [ -h "$SCRIPT" ] ; do
+ ls=`ls -ld "$SCRIPT"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ SCRIPT="$link"
+ else
+ SCRIPT=`dirname "$SCRIPT"`/"$link"
+ fi
+done
+
+if [ ! -d "${APP_DIR}" ]; then
+ APP_DIR=`dirname "$SCRIPT"`/..
+ APP_DIR=`cd "${APP_DIR}"; pwd`
+fi
+
+executable="./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar"
+
+if [ ! -f "$executable" ]
+then
+ mvn clean package
+fi
+
+# if you've executed sbt assembly previously it will use that instead.
+export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
+ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l CsharpDotNet2 -o samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient"
+
+java $JAVA_OPTS -jar $executable $ags
diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/README.md b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/README.md
new file mode 100644
index 00000000000..dea70c68364
--- /dev/null
+++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/README.md
@@ -0,0 +1,7 @@
+# Csharp-DotNet2
+
+This generator creates C# code targeting the .Net 2.0 framework. The resulting DLLs can be used in places where .Net 2.0 is the maximum supported version, such as in the Unity3d.
+
+## Compilation dependencies
+- Mono compiler
+- Note: NuGet is downloaded by the mono compilation script and packages are installed with it. No dependency DLLs are bundled with this generator.
diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/compile-mono.sh b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/compile-mono.sh
new file mode 100644
index 00000000000..bc4e0989945
--- /dev/null
+++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/compile-mono.sh
@@ -0,0 +1,12 @@
+wget -nc https://nuget.org/nuget.exe;
+mozroots --import --sync
+mono nuget.exe install vendor/packages.config -o vendor;
+mkdir -p bin;
+mcs -sdk:2 -r:vendor/Newtonsoft.Json.7.0.1/lib/net20/Newtonsoft.Json.dll,\
+vendor/RestSharp.Net2.1.1.11/lib/net20/RestSharp.Net2.dll,\
+System.Runtime.Serialization.dll \
+-target:library \
+-out:bin/IO.Swagger.dll \
+-recurse:src/*.cs \
+-doc:bin/IO.Swagger.xml \
+-platform:anycpu
\ No newline at end of file
diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Api/PetApi.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Api/PetApi.cs
new file mode 100644
index 00000000000..238f7bf75e7
--- /dev/null
+++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Api/PetApi.cs
@@ -0,0 +1,475 @@
+using System;
+using System.IO;
+using System.Collections.Generic;
+using RestSharp;
+using IO.Swagger.Client;
+using IO.Swagger.Model;
+
+namespace IO.Swagger.Api
+{
+
+ public interface IPetApi
+ {
+
+ ///
+ /// Update an existing pet
+ ///
+ /// Pet object that needs to be added to the store
+ ///
+ void UpdatePet (Pet body);
+
+ ///
+ /// Add a new pet to the store
+ ///
+ /// Pet object that needs to be added to the store
+ ///
+ void AddPet (Pet body);
+
+ ///
+ /// Finds Pets by status Multiple status values can be provided with comma seperated strings
+ ///
+ /// Status values that need to be considered for filter
+ /// List
+ List FindPetsByStatus (List status);
+
+ ///
+ /// Finds Pets by tags Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
+ ///
+ /// Tags to filter by
+ /// List
+ List FindPetsByTags (List tags);
+
+ ///
+ /// Find pet by ID Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
+ ///
+ /// ID of pet that needs to be fetched
+ /// Pet
+ Pet GetPetById (long? petId);
+
+ ///
+ /// Updates a pet in the store with form data
+ ///
+ /// ID of pet that needs to be updated
+ /// Updated name of the pet
+ /// Updated status of the pet
+ ///
+ void UpdatePetWithForm (string petId, string name, string status);
+
+ ///
+ /// Deletes a pet
+ ///
+ /// Pet id to delete
+ ///
+ ///
+ void DeletePet (long? petId, string apiKey);
+
+ ///
+ /// uploads an image
+ ///
+ /// ID of pet to update
+ /// Additional data to pass to server
+ /// file to upload
+ ///
+ void UploadFile (long? petId, string additionalMetadata, Stream file);
+
+ }
+
+ ///
+ /// Represents a collection of functions to interact with the API endpoints
+ ///
+ public class PetApi : IPetApi
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// an instance of ApiClient (optional)
+ ///
+ public PetApi(ApiClient apiClient = null)
+ {
+ if (apiClient == null) // use the default one in Configuration
+ this.ApiClient = Configuration.DefaultApiClient;
+ else
+ this.ApiClient = apiClient;
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ ///
+ public PetApi(String basePath)
+ {
+ this.ApiClient = new ApiClient(basePath);
+ }
+
+ ///
+ /// Sets the base path of the API client.
+ ///
+ /// The base path
+ /// The base path
+ public void SetBasePath(String basePath)
+ {
+ this.ApiClient.BasePath = basePath;
+ }
+
+ ///
+ /// Gets the base path of the API client.
+ ///
+ /// The base path
+ /// The base path
+ public String GetBasePath(String basePath)
+ {
+ return this.ApiClient.BasePath;
+ }
+
+ ///
+ /// Gets or sets the API client.
+ ///
+ /// An instance of the ApiClient
+ public ApiClient ApiClient {get; set;}
+
+
+ ///
+ /// Update an existing pet
+ ///
+ /// Pet object that needs to be added to the store
+ ///
+ public void UpdatePet (Pet body)
+ {
+
+
+ var path = "/pet";
+ path = path.Replace("{format}", "json");
+
+
+ var queryParams = new Dictionary();
+ var headerParams = new Dictionary();
+ var formParams = new Dictionary();
+ var fileParams = new Dictionary();
+ String postBody = null;
+
+
+
+
+ postBody = ApiClient.Serialize(body); // http body (model) parameter
+
+
+ // authentication setting, if any
+ String[] authSettings = new String[] { "petstore_auth" };
+
+ // make the HTTP request
+ IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
+
+ if (((int)response.StatusCode) >= 400)
+ throw new ApiException ((int)response.StatusCode, "Error calling UpdatePet: " + response.Content, response.Content);
+ else if (((int)response.StatusCode) == 0)
+ throw new ApiException ((int)response.StatusCode, "Error calling UpdatePet: " + response.ErrorMessage, response.ErrorMessage);
+
+ return;
+ }
+
+
+ ///
+ /// Add a new pet to the store
+ ///
+ /// Pet object that needs to be added to the store
+ ///
+ public void AddPet (Pet body)
+ {
+
+
+ var path = "/pet";
+ path = path.Replace("{format}", "json");
+
+
+ var queryParams = new Dictionary();
+ var headerParams = new Dictionary();
+ var formParams = new Dictionary();
+ var fileParams = new Dictionary();
+ String postBody = null;
+
+
+
+
+ postBody = ApiClient.Serialize(body); // http body (model) parameter
+
+
+ // authentication setting, if any
+ String[] authSettings = new String[] { "petstore_auth" };
+
+ // make the HTTP request
+ IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
+
+ if (((int)response.StatusCode) >= 400)
+ throw new ApiException ((int)response.StatusCode, "Error calling AddPet: " + response.Content, response.Content);
+ else if (((int)response.StatusCode) == 0)
+ throw new ApiException ((int)response.StatusCode, "Error calling AddPet: " + response.ErrorMessage, response.ErrorMessage);
+
+ return;
+ }
+
+
+ ///
+ /// Finds Pets by status Multiple status values can be provided with comma seperated strings
+ ///
+ /// Status values that need to be considered for filter
+ /// List
+ public List FindPetsByStatus (List status)
+ {
+
+
+ var path = "/pet/findByStatus";
+ path = path.Replace("{format}", "json");
+
+
+ var queryParams = new Dictionary();
+ var headerParams = new Dictionary();
+ var formParams = new Dictionary();
+ var fileParams = new Dictionary();
+ String postBody = null;
+
+ if (status != null) queryParams.Add("status", ApiClient.ParameterToString(status)); // query parameter
+
+
+
+
+
+ // authentication setting, if any
+ String[] authSettings = new String[] { "petstore_auth" };
+
+ // make the HTTP request
+ IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
+
+ if (((int)response.StatusCode) >= 400)
+ throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByStatus: " + response.Content, response.Content);
+ else if (((int)response.StatusCode) == 0)
+ throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByStatus: " + response.ErrorMessage, response.ErrorMessage);
+
+ return (List) ApiClient.Deserialize(response.Content, typeof(List), response.Headers);
+ }
+
+
+ ///
+ /// Finds Pets by tags Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
+ ///
+ /// Tags to filter by
+ /// List
+ public List FindPetsByTags (List tags)
+ {
+
+
+ var path = "/pet/findByTags";
+ path = path.Replace("{format}", "json");
+
+
+ var queryParams = new Dictionary();
+ var headerParams = new Dictionary();
+ var formParams = new Dictionary();
+ var fileParams = new Dictionary();
+ String postBody = null;
+
+ if (tags != null) queryParams.Add("tags", ApiClient.ParameterToString(tags)); // query parameter
+
+
+
+
+
+ // authentication setting, if any
+ String[] authSettings = new String[] { "petstore_auth" };
+
+ // make the HTTP request
+ IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
+
+ if (((int)response.StatusCode) >= 400)
+ throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByTags: " + response.Content, response.Content);
+ else if (((int)response.StatusCode) == 0)
+ throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByTags: " + response.ErrorMessage, response.ErrorMessage);
+
+ return (List) ApiClient.Deserialize(response.Content, typeof(List), response.Headers);
+ }
+
+
+ ///
+ /// Find pet by ID Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
+ ///
+ /// ID of pet that needs to be fetched
+ /// Pet
+ public Pet GetPetById (long? petId)
+ {
+
+ // verify the required parameter 'petId' is set
+ if (petId == null) throw new ApiException(400, "Missing required parameter 'petId' when calling GetPetById");
+
+
+ var path = "/pet/{petId}";
+ path = path.Replace("{format}", "json");
+ path = path.Replace("{" + "petId" + "}", ApiClient.ParameterToString(petId));
+
+
+ var queryParams = new Dictionary();
+ var headerParams = new Dictionary();
+ var formParams = new Dictionary();
+ var fileParams = new Dictionary();
+ String postBody = null;
+
+
+
+
+
+
+ // authentication setting, if any
+ String[] authSettings = new String[] { "api_key", "petstore_auth" };
+
+ // make the HTTP request
+ IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
+
+ if (((int)response.StatusCode) >= 400)
+ throw new ApiException ((int)response.StatusCode, "Error calling GetPetById: " + response.Content, response.Content);
+ else if (((int)response.StatusCode) == 0)
+ throw new ApiException ((int)response.StatusCode, "Error calling GetPetById: " + response.ErrorMessage, response.ErrorMessage);
+
+ return (Pet) ApiClient.Deserialize(response.Content, typeof(Pet), response.Headers);
+ }
+
+
+ ///
+ /// Updates a pet in the store with form data
+ ///
+ /// ID of pet that needs to be updated
+ /// Updated name of the pet
+ /// Updated status of the pet
+ ///
+ public void UpdatePetWithForm (string petId, string name, string status)
+ {
+
+ // verify the required parameter 'petId' is set
+ if (petId == null) throw new ApiException(400, "Missing required parameter 'petId' when calling UpdatePetWithForm");
+
+
+ var path = "/pet/{petId}";
+ path = path.Replace("{format}", "json");
+ path = path.Replace("{" + "petId" + "}", ApiClient.ParameterToString(petId));
+
+
+ var queryParams = new Dictionary();
+ var headerParams = new Dictionary();
+ var formParams = new Dictionary();
+ var fileParams = new Dictionary();
+ String postBody = null;
+
+
+
+ if (name != null) formParams.Add("name", ApiClient.ParameterToString(name)); // form parameter
+ if (status != null) formParams.Add("status", ApiClient.ParameterToString(status)); // form parameter
+
+
+
+ // authentication setting, if any
+ String[] authSettings = new String[] { "petstore_auth" };
+
+ // make the HTTP request
+ IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
+
+ if (((int)response.StatusCode) >= 400)
+ throw new ApiException ((int)response.StatusCode, "Error calling UpdatePetWithForm: " + response.Content, response.Content);
+ else if (((int)response.StatusCode) == 0)
+ throw new ApiException ((int)response.StatusCode, "Error calling UpdatePetWithForm: " + response.ErrorMessage, response.ErrorMessage);
+
+ return;
+ }
+
+
+ ///
+ /// Deletes a pet
+ ///
+ /// Pet id to delete
+ ///
+ ///
+ public void DeletePet (long? petId, string apiKey)
+ {
+
+ // verify the required parameter 'petId' is set
+ if (petId == null) throw new ApiException(400, "Missing required parameter 'petId' when calling DeletePet");
+
+
+ var path = "/pet/{petId}";
+ path = path.Replace("{format}", "json");
+ path = path.Replace("{" + "petId" + "}", ApiClient.ParameterToString(petId));
+
+
+ var queryParams = new Dictionary();
+ var headerParams = new Dictionary();
+ var formParams = new Dictionary();
+ var fileParams = new Dictionary();
+ String postBody = null;
+
+
+ if (apiKey != null) headerParams.Add("api_key", ApiClient.ParameterToString(apiKey)); // header parameter
+
+
+
+
+ // authentication setting, if any
+ String[] authSettings = new String[] { "petstore_auth" };
+
+ // make the HTTP request
+ IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
+
+ if (((int)response.StatusCode) >= 400)
+ throw new ApiException ((int)response.StatusCode, "Error calling DeletePet: " + response.Content, response.Content);
+ else if (((int)response.StatusCode) == 0)
+ throw new ApiException ((int)response.StatusCode, "Error calling DeletePet: " + response.ErrorMessage, response.ErrorMessage);
+
+ return;
+ }
+
+
+ ///
+ /// uploads an image
+ ///
+ /// ID of pet to update
+ /// Additional data to pass to server
+ /// file to upload
+ ///
+ public void UploadFile (long? petId, string additionalMetadata, Stream file)
+ {
+
+ // verify the required parameter 'petId' is set
+ if (petId == null) throw new ApiException(400, "Missing required parameter 'petId' when calling UploadFile");
+
+
+ var path = "/pet/{petId}/uploadImage";
+ path = path.Replace("{format}", "json");
+ path = path.Replace("{" + "petId" + "}", ApiClient.ParameterToString(petId));
+
+
+ var queryParams = new Dictionary();
+ var headerParams = new Dictionary();
+ var formParams = new Dictionary();
+ var fileParams = new Dictionary();
+ String postBody = null;
+
+
+
+ if (additionalMetadata != null) formParams.Add("additionalMetadata", ApiClient.ParameterToString(additionalMetadata)); // form parameter
+ if (file != null) fileParams.Add("file", ApiClient.ParameterToFile("file", file));
+
+
+
+ // authentication setting, if any
+ String[] authSettings = new String[] { "petstore_auth" };
+
+ // make the HTTP request
+ IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
+
+ if (((int)response.StatusCode) >= 400)
+ throw new ApiException ((int)response.StatusCode, "Error calling UploadFile: " + response.Content, response.Content);
+ else if (((int)response.StatusCode) == 0)
+ throw new ApiException ((int)response.StatusCode, "Error calling UploadFile: " + response.ErrorMessage, response.ErrorMessage);
+
+ return;
+ }
+
+
+ }
+
+}
diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Api/StoreApi.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Api/StoreApi.cs
new file mode 100644
index 00000000000..c6c90631bef
--- /dev/null
+++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Api/StoreApi.cs
@@ -0,0 +1,263 @@
+using System;
+using System.IO;
+using System.Collections.Generic;
+using RestSharp;
+using IO.Swagger.Client;
+using IO.Swagger.Model;
+
+namespace IO.Swagger.Api
+{
+
+ public interface IStoreApi
+ {
+
+ ///
+ /// Returns pet inventories by status Returns a map of status codes to quantities
+ ///
+ /// Dictionary
+ Dictionary GetInventory ();
+
+ ///
+ /// Place an order for a pet
+ ///
+ /// order placed for purchasing the pet
+ /// Order
+ Order PlaceOrder (Order body);
+
+ ///
+ /// Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
+ ///
+ /// ID of pet that needs to be fetched
+ /// Order
+ Order GetOrderById (string orderId);
+
+ ///
+ /// Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
+ ///
+ /// ID of the order that needs to be deleted
+ ///
+ void DeleteOrder (string orderId);
+
+ }
+
+ ///
+ /// Represents a collection of functions to interact with the API endpoints
+ ///
+ public class StoreApi : IStoreApi
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// an instance of ApiClient (optional)
+ ///
+ public StoreApi(ApiClient apiClient = null)
+ {
+ if (apiClient == null) // use the default one in Configuration
+ this.ApiClient = Configuration.DefaultApiClient;
+ else
+ this.ApiClient = apiClient;
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ ///
+ public StoreApi(String basePath)
+ {
+ this.ApiClient = new ApiClient(basePath);
+ }
+
+ ///
+ /// Sets the base path of the API client.
+ ///
+ /// The base path
+ /// The base path
+ public void SetBasePath(String basePath)
+ {
+ this.ApiClient.BasePath = basePath;
+ }
+
+ ///
+ /// Gets the base path of the API client.
+ ///
+ /// The base path
+ /// The base path
+ public String GetBasePath(String basePath)
+ {
+ return this.ApiClient.BasePath;
+ }
+
+ ///
+ /// Gets or sets the API client.
+ ///
+ /// An instance of the ApiClient
+ public ApiClient ApiClient {get; set;}
+
+
+ ///
+ /// Returns pet inventories by status Returns a map of status codes to quantities
+ ///
+ /// Dictionary
+ public Dictionary GetInventory ()
+ {
+
+
+ var path = "/store/inventory";
+ path = path.Replace("{format}", "json");
+
+
+ var queryParams = new Dictionary();
+ var headerParams = new Dictionary();
+ var formParams = new Dictionary();
+ var fileParams = new Dictionary();
+ String postBody = null;
+
+
+
+
+
+
+ // authentication setting, if any
+ String[] authSettings = new String[] { "api_key" };
+
+ // make the HTTP request
+ IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
+
+ if (((int)response.StatusCode) >= 400)
+ throw new ApiException ((int)response.StatusCode, "Error calling GetInventory: " + response.Content, response.Content);
+ else if (((int)response.StatusCode) == 0)
+ throw new ApiException ((int)response.StatusCode, "Error calling GetInventory: " + response.ErrorMessage, response.ErrorMessage);
+
+ return (Dictionary) ApiClient.Deserialize(response.Content, typeof(Dictionary), response.Headers);
+ }
+
+
+ ///
+ /// Place an order for a pet
+ ///
+ /// order placed for purchasing the pet
+ /// Order
+ public Order PlaceOrder (Order body)
+ {
+
+
+ var path = "/store/order";
+ path = path.Replace("{format}", "json");
+
+
+ var queryParams = new Dictionary();
+ var headerParams = new Dictionary();
+ var formParams = new Dictionary();
+ var fileParams = new Dictionary();
+ String postBody = null;
+
+
+
+
+ postBody = ApiClient.Serialize(body); // http body (model) parameter
+
+
+ // authentication setting, if any
+ String[] authSettings = new String[] { };
+
+ // make the HTTP request
+ IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
+
+ if (((int)response.StatusCode) >= 400)
+ throw new ApiException ((int)response.StatusCode, "Error calling PlaceOrder: " + response.Content, response.Content);
+ else if (((int)response.StatusCode) == 0)
+ throw new ApiException ((int)response.StatusCode, "Error calling PlaceOrder: " + response.ErrorMessage, response.ErrorMessage);
+
+ return (Order) ApiClient.Deserialize(response.Content, typeof(Order), response.Headers);
+ }
+
+
+ ///
+ /// Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
+ ///
+ /// ID of pet that needs to be fetched
+ /// Order
+ public Order GetOrderById (string orderId)
+ {
+
+ // verify the required parameter 'orderId' is set
+ if (orderId == null) throw new ApiException(400, "Missing required parameter 'orderId' when calling GetOrderById");
+
+
+ var path = "/store/order/{orderId}";
+ path = path.Replace("{format}", "json");
+ path = path.Replace("{" + "orderId" + "}", ApiClient.ParameterToString(orderId));
+
+
+ var queryParams = new Dictionary();
+ var headerParams = new Dictionary();
+ var formParams = new Dictionary();
+ var fileParams = new Dictionary();
+ String postBody = null;
+
+
+
+
+
+
+ // authentication setting, if any
+ String[] authSettings = new String[] { };
+
+ // make the HTTP request
+ IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
+
+ if (((int)response.StatusCode) >= 400)
+ throw new ApiException ((int)response.StatusCode, "Error calling GetOrderById: " + response.Content, response.Content);
+ else if (((int)response.StatusCode) == 0)
+ throw new ApiException ((int)response.StatusCode, "Error calling GetOrderById: " + response.ErrorMessage, response.ErrorMessage);
+
+ return (Order) ApiClient.Deserialize(response.Content, typeof(Order), response.Headers);
+ }
+
+
+ ///
+ /// Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
+ ///
+ /// ID of the order that needs to be deleted
+ ///
+ public void DeleteOrder (string orderId)
+ {
+
+ // verify the required parameter 'orderId' is set
+ if (orderId == null) throw new ApiException(400, "Missing required parameter 'orderId' when calling DeleteOrder");
+
+
+ var path = "/store/order/{orderId}";
+ path = path.Replace("{format}", "json");
+ path = path.Replace("{" + "orderId" + "}", ApiClient.ParameterToString(orderId));
+
+
+ var queryParams = new Dictionary();
+ var headerParams = new Dictionary();
+ var formParams = new Dictionary();
+ var fileParams = new Dictionary();
+ String postBody = null;
+
+
+
+
+
+
+ // authentication setting, if any
+ String[] authSettings = new String[] { };
+
+ // make the HTTP request
+ IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
+
+ if (((int)response.StatusCode) >= 400)
+ throw new ApiException ((int)response.StatusCode, "Error calling DeleteOrder: " + response.Content, response.Content);
+ else if (((int)response.StatusCode) == 0)
+ throw new ApiException ((int)response.StatusCode, "Error calling DeleteOrder: " + response.ErrorMessage, response.ErrorMessage);
+
+ return;
+ }
+
+
+ }
+
+}
diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Api/UserApi.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Api/UserApi.cs
new file mode 100644
index 00000000000..ae43e29ceaf
--- /dev/null
+++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Api/UserApi.cs
@@ -0,0 +1,460 @@
+using System;
+using System.IO;
+using System.Collections.Generic;
+using RestSharp;
+using IO.Swagger.Client;
+using IO.Swagger.Model;
+
+namespace IO.Swagger.Api
+{
+
+ public interface IUserApi
+ {
+
+ ///
+ /// Create user This can only be done by the logged in user.
+ ///
+ /// Created user object
+ ///
+ void CreateUser (User body);
+
+ ///
+ /// Creates list of users with given input array
+ ///
+ /// List of user object
+ ///
+ void CreateUsersWithArrayInput (List body);
+
+ ///
+ /// Creates list of users with given input array
+ ///
+ /// List of user object
+ ///
+ void CreateUsersWithListInput (List body);
+
+ ///
+ /// Logs user into the system
+ ///
+ /// The user name for login
+ /// The password for login in clear text
+ /// string
+ string LoginUser (string username, string password);
+
+ ///
+ /// Logs out current logged in user session
+ ///
+ ///
+ void LogoutUser ();
+
+ ///
+ /// Get user by user name
+ ///
+ /// The name that needs to be fetched. Use user1 for testing.
+ /// User
+ User GetUserByName (string username);
+
+ ///
+ /// Updated user This can only be done by the logged in user.
+ ///
+ /// name that need to be deleted
+ /// Updated user object
+ ///
+ void UpdateUser (string username, User body);
+
+ ///
+ /// Delete user This can only be done by the logged in user.
+ ///
+ /// The name that needs to be deleted
+ ///
+ void DeleteUser (string username);
+
+ }
+
+ ///
+ /// Represents a collection of functions to interact with the API endpoints
+ ///
+ public class UserApi : IUserApi
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// an instance of ApiClient (optional)
+ ///
+ public UserApi(ApiClient apiClient = null)
+ {
+ if (apiClient == null) // use the default one in Configuration
+ this.ApiClient = Configuration.DefaultApiClient;
+ else
+ this.ApiClient = apiClient;
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ ///
+ public UserApi(String basePath)
+ {
+ this.ApiClient = new ApiClient(basePath);
+ }
+
+ ///
+ /// Sets the base path of the API client.
+ ///
+ /// The base path
+ /// The base path
+ public void SetBasePath(String basePath)
+ {
+ this.ApiClient.BasePath = basePath;
+ }
+
+ ///
+ /// Gets the base path of the API client.
+ ///
+ /// The base path
+ /// The base path
+ public String GetBasePath(String basePath)
+ {
+ return this.ApiClient.BasePath;
+ }
+
+ ///
+ /// Gets or sets the API client.
+ ///
+ /// An instance of the ApiClient
+ public ApiClient ApiClient {get; set;}
+
+
+ ///
+ /// Create user This can only be done by the logged in user.
+ ///
+ /// Created user object
+ ///
+ public void CreateUser (User body)
+ {
+
+
+ var path = "/user";
+ path = path.Replace("{format}", "json");
+
+
+ var queryParams = new Dictionary();
+ var headerParams = new Dictionary();
+ var formParams = new Dictionary();
+ var fileParams = new Dictionary();
+ String postBody = null;
+
+
+
+
+ postBody = ApiClient.Serialize(body); // http body (model) parameter
+
+
+ // authentication setting, if any
+ String[] authSettings = new String[] { };
+
+ // make the HTTP request
+ IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
+
+ if (((int)response.StatusCode) >= 400)
+ throw new ApiException ((int)response.StatusCode, "Error calling CreateUser: " + response.Content, response.Content);
+ else if (((int)response.StatusCode) == 0)
+ throw new ApiException ((int)response.StatusCode, "Error calling CreateUser: " + response.ErrorMessage, response.ErrorMessage);
+
+ return;
+ }
+
+
+ ///
+ /// Creates list of users with given input array
+ ///
+ /// List of user object
+ ///
+ public void CreateUsersWithArrayInput (List body)
+ {
+
+
+ var path = "/user/createWithArray";
+ path = path.Replace("{format}", "json");
+
+
+ var queryParams = new Dictionary();
+ var headerParams = new Dictionary();
+ var formParams = new Dictionary();
+ var fileParams = new Dictionary();
+ String postBody = null;
+
+
+
+
+ postBody = ApiClient.Serialize(body); // http body (model) parameter
+
+
+ // authentication setting, if any
+ String[] authSettings = new String[] { };
+
+ // make the HTTP request
+ IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
+
+ if (((int)response.StatusCode) >= 400)
+ throw new ApiException ((int)response.StatusCode, "Error calling CreateUsersWithArrayInput: " + response.Content, response.Content);
+ else if (((int)response.StatusCode) == 0)
+ throw new ApiException ((int)response.StatusCode, "Error calling CreateUsersWithArrayInput: " + response.ErrorMessage, response.ErrorMessage);
+
+ return;
+ }
+
+
+ ///
+ /// Creates list of users with given input array
+ ///
+ /// List of user object
+ ///
+ public void CreateUsersWithListInput (List body)
+ {
+
+
+ var path = "/user/createWithList";
+ path = path.Replace("{format}", "json");
+
+
+ var queryParams = new Dictionary();
+ var headerParams = new Dictionary();
+ var formParams = new Dictionary();
+ var fileParams = new Dictionary();
+ String postBody = null;
+
+
+
+
+ postBody = ApiClient.Serialize(body); // http body (model) parameter
+
+
+ // authentication setting, if any
+ String[] authSettings = new String[] { };
+
+ // make the HTTP request
+ IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
+
+ if (((int)response.StatusCode) >= 400)
+ throw new ApiException ((int)response.StatusCode, "Error calling CreateUsersWithListInput: " + response.Content, response.Content);
+ else if (((int)response.StatusCode) == 0)
+ throw new ApiException ((int)response.StatusCode, "Error calling CreateUsersWithListInput: " + response.ErrorMessage, response.ErrorMessage);
+
+ return;
+ }
+
+
+ ///
+ /// Logs user into the system
+ ///
+ /// The user name for login
+ /// The password for login in clear text
+ /// string
+ public string LoginUser (string username, string password)
+ {
+
+
+ var path = "/user/login";
+ path = path.Replace("{format}", "json");
+
+
+ var queryParams = new Dictionary();
+ var headerParams = new Dictionary();
+ var formParams = new Dictionary();
+ var fileParams = new Dictionary();
+ String postBody = null;
+
+ if (username != null) queryParams.Add("username", ApiClient.ParameterToString(username)); // query parameter
+ if (password != null) queryParams.Add("password", ApiClient.ParameterToString(password)); // query parameter
+
+
+
+
+
+ // authentication setting, if any
+ String[] authSettings = new String[] { };
+
+ // make the HTTP request
+ IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
+
+ if (((int)response.StatusCode) >= 400)
+ throw new ApiException ((int)response.StatusCode, "Error calling LoginUser: " + response.Content, response.Content);
+ else if (((int)response.StatusCode) == 0)
+ throw new ApiException ((int)response.StatusCode, "Error calling LoginUser: " + response.ErrorMessage, response.ErrorMessage);
+
+ return (string) ApiClient.Deserialize(response.Content, typeof(string), response.Headers);
+ }
+
+
+ ///
+ /// Logs out current logged in user session
+ ///
+ ///
+ public void LogoutUser ()
+ {
+
+
+ var path = "/user/logout";
+ path = path.Replace("{format}", "json");
+
+
+ var queryParams = new Dictionary();
+ var headerParams = new Dictionary();
+ var formParams = new Dictionary();
+ var fileParams = new Dictionary();
+ String postBody = null;
+
+
+
+
+
+
+ // authentication setting, if any
+ String[] authSettings = new String[] { };
+
+ // make the HTTP request
+ IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
+
+ if (((int)response.StatusCode) >= 400)
+ throw new ApiException ((int)response.StatusCode, "Error calling LogoutUser: " + response.Content, response.Content);
+ else if (((int)response.StatusCode) == 0)
+ throw new ApiException ((int)response.StatusCode, "Error calling LogoutUser: " + response.ErrorMessage, response.ErrorMessage);
+
+ return;
+ }
+
+
+ ///
+ /// Get user by user name
+ ///
+ /// The name that needs to be fetched. Use user1 for testing.
+ /// User
+ public User GetUserByName (string username)
+ {
+
+ // verify the required parameter 'username' is set
+ if (username == null) throw new ApiException(400, "Missing required parameter 'username' when calling GetUserByName");
+
+
+ var path = "/user/{username}";
+ path = path.Replace("{format}", "json");
+ path = path.Replace("{" + "username" + "}", ApiClient.ParameterToString(username));
+
+
+ var queryParams = new Dictionary();
+ var headerParams = new Dictionary();
+ var formParams = new Dictionary();
+ var fileParams = new Dictionary();
+ String postBody = null;
+
+
+
+
+
+
+ // authentication setting, if any
+ String[] authSettings = new String[] { };
+
+ // make the HTTP request
+ IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
+
+ if (((int)response.StatusCode) >= 400)
+ throw new ApiException ((int)response.StatusCode, "Error calling GetUserByName: " + response.Content, response.Content);
+ else if (((int)response.StatusCode) == 0)
+ throw new ApiException ((int)response.StatusCode, "Error calling GetUserByName: " + response.ErrorMessage, response.ErrorMessage);
+
+ return (User) ApiClient.Deserialize(response.Content, typeof(User), response.Headers);
+ }
+
+
+ ///
+ /// Updated user This can only be done by the logged in user.
+ ///
+ /// name that need to be deleted
+ /// Updated user object
+ ///
+ public void UpdateUser (string username, User body)
+ {
+
+ // verify the required parameter 'username' is set
+ if (username == null) throw new ApiException(400, "Missing required parameter 'username' when calling UpdateUser");
+
+
+ var path = "/user/{username}";
+ path = path.Replace("{format}", "json");
+ path = path.Replace("{" + "username" + "}", ApiClient.ParameterToString(username));
+
+
+ var queryParams = new Dictionary();
+ var headerParams = new Dictionary();
+ var formParams = new Dictionary();
+ var fileParams = new Dictionary();
+ String postBody = null;
+
+
+
+
+ postBody = ApiClient.Serialize(body); // http body (model) parameter
+
+
+ // authentication setting, if any
+ String[] authSettings = new String[] { };
+
+ // make the HTTP request
+ IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
+
+ if (((int)response.StatusCode) >= 400)
+ throw new ApiException ((int)response.StatusCode, "Error calling UpdateUser: " + response.Content, response.Content);
+ else if (((int)response.StatusCode) == 0)
+ throw new ApiException ((int)response.StatusCode, "Error calling UpdateUser: " + response.ErrorMessage, response.ErrorMessage);
+
+ return;
+ }
+
+
+ ///
+ /// Delete user This can only be done by the logged in user.
+ ///
+ /// The name that needs to be deleted
+ ///
+ public void DeleteUser (string username)
+ {
+
+ // verify the required parameter 'username' is set
+ if (username == null) throw new ApiException(400, "Missing required parameter 'username' when calling DeleteUser");
+
+
+ var path = "/user/{username}";
+ path = path.Replace("{format}", "json");
+ path = path.Replace("{" + "username" + "}", ApiClient.ParameterToString(username));
+
+
+ var queryParams = new Dictionary();
+ var headerParams = new Dictionary();
+ var formParams = new Dictionary();
+ var fileParams = new Dictionary();
+ String postBody = null;
+
+
+
+
+
+
+ // authentication setting, if any
+ String[] authSettings = new String[] { };
+
+ // make the HTTP request
+ IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
+
+ if (((int)response.StatusCode) >= 400)
+ throw new ApiException ((int)response.StatusCode, "Error calling DeleteUser: " + response.Content, response.Content);
+ else if (((int)response.StatusCode) == 0)
+ throw new ApiException ((int)response.StatusCode, "Error calling DeleteUser: " + response.ErrorMessage, response.ErrorMessage);
+
+ return;
+ }
+
+
+ }
+
+}
diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Client/ApiClient.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Client/ApiClient.cs
new file mode 100644
index 00000000000..d4f32908b3d
--- /dev/null
+++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Client/ApiClient.cs
@@ -0,0 +1,296 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Text.RegularExpressions;
+using System.IO;
+using System.Web;
+using System.Linq;
+using System.Net;
+using System.Text;
+using Newtonsoft.Json;
+using RestSharp;
+using RestSharp.Extensions;
+
+namespace IO.Swagger.Client
+{
+ ///
+ /// API client is mainly responible for making the HTTP call to the API backend.
+ ///
+ public class ApiClient
+ {
+ private readonly Dictionary _defaultHeaderMap = new Dictionary();
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The base path.
+ public ApiClient(String basePath="http://petstore.swagger.io/v2")
+ {
+ BasePath = basePath;
+ RestClient = new RestClient(BasePath);
+ }
+
+ ///
+ /// Gets or sets the base path.
+ ///
+ /// The base path
+ public string BasePath { get; set; }
+
+ ///
+ /// Gets or sets the RestClient.
+ ///
+ /// An instance of the RestClient
+ public RestClient RestClient { get; set; }
+
+ ///
+ /// Gets the default header.
+ ///
+ public Dictionary DefaultHeader
+ {
+ get { return _defaultHeaderMap; }
+ }
+
+ ///
+ /// Makes the HTTP request (Sync).
+ ///
+ /// URL path.
+ /// HTTP method.
+ /// Query parameters.
+ /// HTTP body (POST request).
+ /// Header parameters.
+ /// Form parameters.
+ /// File parameters.
+ /// Authentication settings.
+ /// Object
+ public Object CallApi(String path, RestSharp.Method method, Dictionary queryParams, String postBody,
+ Dictionary headerParams, Dictionary formParams,
+ Dictionary fileParams, String[] authSettings)
+ {
+
+ var request = new RestRequest(path, method);
+
+ UpdateParamsForAuth(queryParams, headerParams, authSettings);
+
+ // add default header, if any
+ foreach(var defaultHeader in _defaultHeaderMap)
+ request.AddHeader(defaultHeader.Key, defaultHeader.Value);
+
+ // add header parameter, if any
+ foreach(var param in headerParams)
+ request.AddHeader(param.Key, param.Value);
+
+ // add query parameter, if any
+ foreach(var param in queryParams)
+ request.AddParameter(param.Key, param.Value, ParameterType.GetOrPost);
+
+ // add form parameter, if any
+ foreach(var param in formParams)
+ request.AddParameter(param.Key, param.Value, ParameterType.GetOrPost);
+
+ // add file parameter, if any
+ foreach(var param in fileParams)
+ request.AddFile(param.Value.Name, param.Value.Writer, param.Value.FileName, param.Value.ContentType);
+
+ if (postBody != null) // http body (model) parameter
+ request.AddParameter("application/json", postBody, ParameterType.RequestBody);
+
+ return (Object)RestClient.Execute(request);
+
+ }
+
+ ///
+ /// Add default header.
+ ///
+ /// Header field name.
+ /// Header field value.
+ ///
+ public void AddDefaultHeader(string key, string value)
+ {
+ _defaultHeaderMap.Add(key, value);
+ }
+
+ ///
+ /// Escape string (url-encoded).
+ ///
+ /// String to be escaped.
+ /// Escaped string.
+ public string EscapeString(string str)
+ {
+ return RestSharp.Contrib.HttpUtility.UrlEncode(str);
+ }
+
+ ///
+ /// Create FileParameter based on Stream.
+ ///
+ /// Parameter name.
+ /// Input stream.
+ /// FileParameter.
+ public FileParameter ParameterToFile(string name, Stream stream)
+ {
+ if (stream is FileStream)
+ return FileParameter.Create(name, stream.ReadAsBytes(), Path.GetFileName(((FileStream)stream).Name));
+ else
+ return FileParameter.Create(name, stream.ReadAsBytes(), "no_file_name_provided");
+ }
+
+ ///
+ /// If parameter is DateTime, output in ISO8601 format.
+ /// If parameter is a list of string, join the list with ",".
+ /// Otherwise just return the string.
+ ///
+ /// The parameter (header, path, query, form).
+ /// Formatted string.
+ public string ParameterToString(object obj)
+ {
+ if (obj is DateTime)
+ return ((DateTime)obj).ToString ("u");
+ else if (obj is List)
+ return String.Join(",", (obj as List).ToArray());
+ else
+ return Convert.ToString (obj);
+ }
+
+ ///
+ /// Deserialize the JSON string into a proper object.
+ ///
+ /// HTTP body (e.g. string, JSON).
+ /// Object type.
+ /// Object representation of the JSON string.
+ public object Deserialize(string content, Type type, IList headers=null)
+ {
+ if (type == typeof(Object)) // return an object
+ {
+ return content;
+ }
+
+ if (type == typeof(Stream))
+ {
+ var filePath = String.IsNullOrEmpty(Configuration.TempFolderPath)
+ ? Path.GetTempPath()
+ : Configuration.TempFolderPath;
+
+ var fileName = filePath + Guid.NewGuid();
+ if (headers != null)
+ {
+ var regex = new Regex(@"Content-Disposition:.*filename=['""]?([^'""\s]+)['""]?$");
+ var match = regex.Match(headers.ToString());
+ if (match.Success)
+ fileName = filePath + match.Value.Replace("\"", "").Replace("'", "");
+ }
+ File.WriteAllText(fileName, content);
+ return new FileStream(fileName, FileMode.Open);
+
+ }
+
+ if (type.Name.StartsWith("System.Nullable`1[[System.DateTime")) // return a datetime object
+ {
+ return DateTime.Parse(content, null, System.Globalization.DateTimeStyles.RoundtripKind);
+ }
+
+ if (type == typeof(String) || type.Name.StartsWith("System.Nullable")) // return primitive type
+ {
+ return ConvertType(content, type);
+ }
+
+ // at this point, it must be a model (json)
+ try
+ {
+ return JsonConvert.DeserializeObject(content, type);
+ }
+ catch (IOException e)
+ {
+ throw new ApiException(500, e.Message);
+ }
+ }
+
+ ///
+ /// Serialize an object into JSON string.
+ ///
+ /// Object.
+ /// JSON string.
+ public string Serialize(object obj)
+ {
+ try
+ {
+ return obj != null ? JsonConvert.SerializeObject(obj) : null;
+ }
+ catch (Exception e)
+ {
+ throw new ApiException(500, e.Message);
+ }
+ }
+
+ ///
+ /// Get the API key with prefix.
+ ///
+ /// API key identifier (authentication scheme).
+ /// API key with prefix.
+ public string GetApiKeyWithPrefix (string apiKeyIdentifier)
+ {
+ var apiKeyValue = "";
+ Configuration.ApiKey.TryGetValue (apiKeyIdentifier, out apiKeyValue);
+ var apiKeyPrefix = "";
+ if (Configuration.ApiKeyPrefix.TryGetValue (apiKeyIdentifier, out apiKeyPrefix))
+ return apiKeyPrefix + " " + apiKeyValue;
+ else
+ return apiKeyValue;
+ }
+
+ ///
+ /// Update parameters based on authentication.
+ ///
+ /// Query parameters.
+ /// Header parameters.
+ /// Authentication settings.
+ public void UpdateParamsForAuth(Dictionary queryParams, Dictionary headerParams, string[] authSettings)
+ {
+ if (authSettings == null || authSettings.Length == 0)
+ return;
+
+ foreach (string auth in authSettings)
+ {
+ // determine which one to use
+ switch(auth)
+ {
+
+ case "api_key":
+ headerParams["api_key"] = GetApiKeyWithPrefix("api_key");
+
+ break;
+
+ case "petstore_auth":
+
+ //TODO support oauth
+ break;
+
+ default:
+ //TODO show warning about security definition not found
+ break;
+ }
+ }
+ }
+
+ ///
+ /// Encode string in base64 format.
+ ///
+ /// String to be encoded.
+ /// Encoded string.
+ public static string Base64Encode(string text)
+ {
+ var textByte = System.Text.Encoding.UTF8.GetBytes(text);
+ return System.Convert.ToBase64String(textByte);
+ }
+
+ ///
+ /// Dynamically cast the object into target type.
+ /// Ref: http://stackoverflow.com/questions/4925718/c-dynamic-runtime-cast
+ ///
+ /// Object to be casted
+ /// Target type
+ /// Casted object
+ public static Object ConvertType(Object source, Type dest) {
+ return Convert.ChangeType(source, dest);
+ }
+
+ }
+}
diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Client/ApiException.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Client/ApiException.cs
new file mode 100644
index 00000000000..ff0b4be791e
--- /dev/null
+++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Client/ApiException.cs
@@ -0,0 +1,48 @@
+using System;
+
+namespace IO.Swagger.Client {
+ ///
+ /// API Exception
+ ///
+ public class ApiException : Exception {
+ ///
+ /// Gets or sets the error code (HTTP status code)
+ ///
+ /// The error code (HTTP status code).
+ public int ErrorCode { get; set; }
+
+ ///
+ /// Gets or sets the error content (body json object)
+ ///
+ /// The error content (Http response body).
+ public Object ErrorContent { get; private set; }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The base path.
+ public ApiException() {}
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// HTTP status code.
+ /// Error message.
+ public ApiException(int errorCode, string message) : base(message) {
+ this.ErrorCode = errorCode;
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// HTTP status code.
+ /// Error message.
+ /// Error content.
+ public ApiException(int errorCode, string message, Object errorContent = null) : base(message) {
+ this.ErrorCode = errorCode;
+ this.ErrorContent = errorContent;
+ }
+
+ }
+
+}
diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Client/Configuration.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Client/Configuration.cs
new file mode 100644
index 00000000000..80df0f4ec72
--- /dev/null
+++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Client/Configuration.cs
@@ -0,0 +1,99 @@
+using System;
+using System.Reflection;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+
+namespace IO.Swagger.Client
+{
+ ///
+ /// Represents a set of configuration settings
+ ///
+ public class Configuration
+ {
+
+ ///
+ /// Version of the package.
+ ///
+ /// Version of the package.
+ public const string Version = "1.0.0";
+
+ ///
+ /// Gets or sets the default API client for making HTTP calls.
+ ///
+ /// The API client.
+ public static ApiClient DefaultApiClient = new ApiClient();
+
+ ///
+ /// Gets or sets the username (HTTP basic authentication).
+ ///
+ /// The username.
+ public static String Username { get; set; }
+
+ ///
+ /// Gets or sets the password (HTTP basic authentication).
+ ///
+ /// The password.
+ public static String Password { get; set; }
+
+ ///
+ /// Gets or sets the API key based on the authentication name.
+ ///
+ /// The API key.
+ public static Dictionary ApiKey = new Dictionary();
+
+ ///
+ /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name.
+ ///
+ /// The prefix of the API key.
+ public static Dictionary ApiKeyPrefix = new Dictionary();
+
+ private static string _tempFolderPath = Path.GetTempPath();
+
+ ///
+ /// Gets or sets the temporary folder path to store the files downloaded from the server.
+ ///
+ /// Folder path.
+ public static String TempFolderPath
+ {
+ get { return _tempFolderPath; }
+
+ set
+ {
+ if (String.IsNullOrEmpty(value))
+ {
+ _tempFolderPath = value;
+ return;
+ }
+
+ // create the directory if it does not exist
+ if (!Directory.Exists(value))
+ Directory.CreateDirectory(value);
+
+ // check if the path contains directory separator at the end
+ if (value[value.Length - 1] == Path.DirectorySeparatorChar)
+ _tempFolderPath = value;
+ else
+ _tempFolderPath = value + Path.DirectorySeparatorChar;
+ }
+ }
+
+ ///
+ /// Returns a string with essential information for debugging.
+ ///
+ public static String ToDebugReport()
+ {
+ String report = "C# SDK (IO.Swagger) Debug Report:\n";
+ report += " OS: " + Environment.OSVersion + "\n";
+ report += " .NET Framework Version: " + Assembly
+ .GetExecutingAssembly()
+ .GetReferencedAssemblies()
+ .Where(x => x.Name == "System.Core").First().Version.ToString() + "\n";
+ report += " Version of the API: 1.0.0\n";
+ report += " SDK Package Version: 1.0.0\n";
+
+ return report;
+ }
+ }
+}
diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Model/Category.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Model/Category.cs
new file mode 100644
index 00000000000..a11c0761d2d
--- /dev/null
+++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Model/Category.cs
@@ -0,0 +1,58 @@
+using System;
+using System.Text;
+using System.Collections;
+using System.Collections.Generic;
+using System.Runtime.Serialization;
+using Newtonsoft.Json;
+
+namespace IO.Swagger.Model {
+
+ ///
+ ///
+ ///
+ [DataContract]
+ public class Category {
+
+ ///
+ /// Gets or Sets Id
+ ///
+ [DataMember(Name="id", EmitDefaultValue=false)]
+ [JsonProperty(PropertyName = "id")]
+ public long? Id { get; set; }
+
+
+ ///
+ /// Gets or Sets Name
+ ///
+ [DataMember(Name="name", EmitDefaultValue=false)]
+ [JsonProperty(PropertyName = "name")]
+ public string Name { get; set; }
+
+
+
+ ///
+ /// Get the string presentation of the object
+ ///
+ /// String presentation of the object
+ public override string ToString() {
+ var sb = new StringBuilder();
+ sb.Append("class Category {\n");
+
+ sb.Append(" Id: ").Append(Id).Append("\n");
+
+ sb.Append(" Name: ").Append(Name).Append("\n");
+
+ sb.Append("}\n");
+ return sb.ToString();
+ }
+
+ ///
+ /// Get the JSON string presentation of the object
+ ///
+ /// JSON string presentation of the object
+ public string ToJson() {
+ return JsonConvert.SerializeObject(this, Formatting.Indented);
+ }
+
+}
+}
diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Model/Order.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Model/Order.cs
new file mode 100644
index 00000000000..17890990aa6
--- /dev/null
+++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Model/Order.cs
@@ -0,0 +1,99 @@
+using System;
+using System.Text;
+using System.Collections;
+using System.Collections.Generic;
+using System.Runtime.Serialization;
+using Newtonsoft.Json;
+
+namespace IO.Swagger.Model {
+
+ ///
+ ///
+ ///
+ [DataContract]
+ public class Order {
+
+ ///
+ /// Gets or Sets Id
+ ///
+ [DataMember(Name="id", EmitDefaultValue=false)]
+ [JsonProperty(PropertyName = "id")]
+ public long? Id { get; set; }
+
+
+ ///
+ /// Gets or Sets PetId
+ ///
+ [DataMember(Name="petId", EmitDefaultValue=false)]
+ [JsonProperty(PropertyName = "petId")]
+ public long? PetId { get; set; }
+
+
+ ///
+ /// Gets or Sets Quantity
+ ///
+ [DataMember(Name="quantity", EmitDefaultValue=false)]
+ [JsonProperty(PropertyName = "quantity")]
+ public int? Quantity { get; set; }
+
+
+ ///
+ /// Gets or Sets ShipDate
+ ///
+ [DataMember(Name="shipDate", EmitDefaultValue=false)]
+ [JsonProperty(PropertyName = "shipDate")]
+ public DateTime? ShipDate { get; set; }
+
+
+ ///
+ /// Order Status
+ ///
+ /// Order Status
+ [DataMember(Name="status", EmitDefaultValue=false)]
+ [JsonProperty(PropertyName = "status")]
+ public string Status { get; set; }
+
+
+ ///
+ /// Gets or Sets Complete
+ ///
+ [DataMember(Name="complete", EmitDefaultValue=false)]
+ [JsonProperty(PropertyName = "complete")]
+ public bool? Complete { get; set; }
+
+
+
+ ///
+ /// Get the string presentation of the object
+ ///
+ /// String presentation of the object
+ public override string ToString() {
+ var sb = new StringBuilder();
+ sb.Append("class Order {\n");
+
+ sb.Append(" Id: ").Append(Id).Append("\n");
+
+ sb.Append(" PetId: ").Append(PetId).Append("\n");
+
+ sb.Append(" Quantity: ").Append(Quantity).Append("\n");
+
+ sb.Append(" ShipDate: ").Append(ShipDate).Append("\n");
+
+ sb.Append(" Status: ").Append(Status).Append("\n");
+
+ sb.Append(" Complete: ").Append(Complete).Append("\n");
+
+ sb.Append("}\n");
+ return sb.ToString();
+ }
+
+ ///
+ /// Get the JSON string presentation of the object
+ ///
+ /// JSON string presentation of the object
+ public string ToJson() {
+ return JsonConvert.SerializeObject(this, Formatting.Indented);
+ }
+
+}
+}
diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Model/Pet.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Model/Pet.cs
new file mode 100644
index 00000000000..14f285794ad
--- /dev/null
+++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Model/Pet.cs
@@ -0,0 +1,99 @@
+using System;
+using System.Text;
+using System.Collections;
+using System.Collections.Generic;
+using System.Runtime.Serialization;
+using Newtonsoft.Json;
+
+namespace IO.Swagger.Model {
+
+ ///
+ ///
+ ///
+ [DataContract]
+ public class Pet {
+
+ ///
+ /// Gets or Sets Id
+ ///
+ [DataMember(Name="id", EmitDefaultValue=false)]
+ [JsonProperty(PropertyName = "id")]
+ public long? Id { get; set; }
+
+
+ ///
+ /// Gets or Sets Category
+ ///
+ [DataMember(Name="category", EmitDefaultValue=false)]
+ [JsonProperty(PropertyName = "category")]
+ public Category Category { get; set; }
+
+
+ ///
+ /// Gets or Sets Name
+ ///
+ [DataMember(Name="name", EmitDefaultValue=false)]
+ [JsonProperty(PropertyName = "name")]
+ public string Name { get; set; }
+
+
+ ///
+ /// Gets or Sets PhotoUrls
+ ///
+ [DataMember(Name="photoUrls", EmitDefaultValue=false)]
+ [JsonProperty(PropertyName = "photoUrls")]
+ public List PhotoUrls { get; set; }
+
+
+ ///
+ /// Gets or Sets Tags
+ ///
+ [DataMember(Name="tags", EmitDefaultValue=false)]
+ [JsonProperty(PropertyName = "tags")]
+ public List Tags { get; set; }
+
+
+ ///
+ /// pet status in the store
+ ///
+ /// pet status in the store
+ [DataMember(Name="status", EmitDefaultValue=false)]
+ [JsonProperty(PropertyName = "status")]
+ public string Status { get; set; }
+
+
+
+ ///
+ /// Get the string presentation of the object
+ ///
+ /// String presentation of the object
+ public override string ToString() {
+ var sb = new StringBuilder();
+ sb.Append("class Pet {\n");
+
+ sb.Append(" Id: ").Append(Id).Append("\n");
+
+ sb.Append(" Category: ").Append(Category).Append("\n");
+
+ sb.Append(" Name: ").Append(Name).Append("\n");
+
+ sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n");
+
+ sb.Append(" Tags: ").Append(Tags).Append("\n");
+
+ sb.Append(" Status: ").Append(Status).Append("\n");
+
+ sb.Append("}\n");
+ return sb.ToString();
+ }
+
+ ///
+ /// Get the JSON string presentation of the object
+ ///
+ /// JSON string presentation of the object
+ public string ToJson() {
+ return JsonConvert.SerializeObject(this, Formatting.Indented);
+ }
+
+}
+}
diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Model/Tag.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Model/Tag.cs
new file mode 100644
index 00000000000..9a784e07a7e
--- /dev/null
+++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Model/Tag.cs
@@ -0,0 +1,58 @@
+using System;
+using System.Text;
+using System.Collections;
+using System.Collections.Generic;
+using System.Runtime.Serialization;
+using Newtonsoft.Json;
+
+namespace IO.Swagger.Model {
+
+ ///
+ ///
+ ///
+ [DataContract]
+ public class Tag {
+
+ ///
+ /// Gets or Sets Id
+ ///
+ [DataMember(Name="id", EmitDefaultValue=false)]
+ [JsonProperty(PropertyName = "id")]
+ public long? Id { get; set; }
+
+
+ ///
+ /// Gets or Sets Name
+ ///
+ [DataMember(Name="name", EmitDefaultValue=false)]
+ [JsonProperty(PropertyName = "name")]
+ public string Name { get; set; }
+
+
+
+ ///
+ /// Get the string presentation of the object
+ ///
+ /// String presentation of the object
+ public override string ToString() {
+ var sb = new StringBuilder();
+ sb.Append("class Tag {\n");
+
+ sb.Append(" Id: ").Append(Id).Append("\n");
+
+ sb.Append(" Name: ").Append(Name).Append("\n");
+
+ sb.Append("}\n");
+ return sb.ToString();
+ }
+
+ ///
+ /// Get the JSON string presentation of the object
+ ///
+ /// JSON string presentation of the object
+ public string ToJson() {
+ return JsonConvert.SerializeObject(this, Formatting.Indented);
+ }
+
+}
+}
diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Model/User.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Model/User.cs
new file mode 100644
index 00000000000..ee7d6b035a3
--- /dev/null
+++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Model/User.cs
@@ -0,0 +1,119 @@
+using System;
+using System.Text;
+using System.Collections;
+using System.Collections.Generic;
+using System.Runtime.Serialization;
+using Newtonsoft.Json;
+
+namespace IO.Swagger.Model {
+
+ ///
+ ///
+ ///
+ [DataContract]
+ public class User {
+
+ ///
+ /// Gets or Sets Id
+ ///
+ [DataMember(Name="id", EmitDefaultValue=false)]
+ [JsonProperty(PropertyName = "id")]
+ public long? Id { get; set; }
+
+
+ ///
+ /// Gets or Sets Username
+ ///
+ [DataMember(Name="username", EmitDefaultValue=false)]
+ [JsonProperty(PropertyName = "username")]
+ public string Username { get; set; }
+
+
+ ///
+ /// Gets or Sets FirstName
+ ///
+ [DataMember(Name="firstName", EmitDefaultValue=false)]
+ [JsonProperty(PropertyName = "firstName")]
+ public string FirstName { get; set; }
+
+
+ ///
+ /// Gets or Sets LastName
+ ///
+ [DataMember(Name="lastName", EmitDefaultValue=false)]
+ [JsonProperty(PropertyName = "lastName")]
+ public string LastName { get; set; }
+
+
+ ///
+ /// Gets or Sets Email
+ ///
+ [DataMember(Name="email", EmitDefaultValue=false)]
+ [JsonProperty(PropertyName = "email")]
+ public string Email { get; set; }
+
+
+ ///
+ /// Gets or Sets Password
+ ///
+ [DataMember(Name="password", EmitDefaultValue=false)]
+ [JsonProperty(PropertyName = "password")]
+ public string Password { get; set; }
+
+
+ ///
+ /// Gets or Sets Phone
+ ///
+ [DataMember(Name="phone", EmitDefaultValue=false)]
+ [JsonProperty(PropertyName = "phone")]
+ public string Phone { get; set; }
+
+
+ ///
+ /// User Status
+ ///
+ /// User Status
+ [DataMember(Name="userStatus", EmitDefaultValue=false)]
+ [JsonProperty(PropertyName = "userStatus")]
+ public int? UserStatus { get; set; }
+
+
+
+ ///
+ /// Get the string presentation of the object
+ ///
+ /// String presentation of the object
+ public override string ToString() {
+ var sb = new StringBuilder();
+ sb.Append("class User {\n");
+
+ sb.Append(" Id: ").Append(Id).Append("\n");
+
+ sb.Append(" Username: ").Append(Username).Append("\n");
+
+ sb.Append(" FirstName: ").Append(FirstName).Append("\n");
+
+ sb.Append(" LastName: ").Append(LastName).Append("\n");
+
+ sb.Append(" Email: ").Append(Email).Append("\n");
+
+ sb.Append(" Password: ").Append(Password).Append("\n");
+
+ sb.Append(" Phone: ").Append(Phone).Append("\n");
+
+ sb.Append(" UserStatus: ").Append(UserStatus).Append("\n");
+
+ sb.Append("}\n");
+ return sb.ToString();
+ }
+
+ ///
+ /// Get the JSON string presentation of the object
+ ///
+ /// JSON string presentation of the object
+ public string ToJson() {
+ return JsonConvert.SerializeObject(this, Formatting.Indented);
+ }
+
+}
+}
diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/vendor/packages.config b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/vendor/packages.config
new file mode 100644
index 00000000000..7b9cf186303
--- /dev/null
+++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/vendor/packages.config
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file