From 2dca8b003d0008b5a73f19b61476c80daeb724d7 Mon Sep 17 00:00:00 2001 From: Guo Huang Date: Wed, 13 Apr 2016 16:56:36 -0700 Subject: [PATCH] issue#2589: added fully qualified names memory stream for C# --- bin/csharp-dotnet2-petstore.sh | 2 +- .../languages/CsharpDotNet2ClientCodegen.java | 4 +- .../main/resources/CsharpDotNet2/api.mustache | 1 - .../CsharpDotNet2/IO/Swagger/Api/PetApi.cs | 521 ++++++++---------- .../CsharpDotNet2/IO/Swagger/Api/StoreApi.cs | 278 +++++----- .../CsharpDotNet2/IO/Swagger/Api/UserApi.cs | 405 ++++++-------- .../IO/Swagger/Client/ApiClient.cs | 11 +- .../IO/Swagger/Model/ApiResponse.cs | 60 ++ .../IO/Swagger/Model/Category.cs | 6 - .../CsharpDotNet2/IO/Swagger/Model/Order.cs | 14 - .../CsharpDotNet2/IO/Swagger/Model/Pet.cs | 14 - .../CsharpDotNet2/IO/Swagger/Model/Tag.cs | 6 - .../CsharpDotNet2/IO/Swagger/Model/User.cs | 18 - 13 files changed, 608 insertions(+), 732 deletions(-) create mode 100644 samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Model/ApiResponse.cs diff --git a/bin/csharp-dotnet2-petstore.sh b/bin/csharp-dotnet2-petstore.sh index fdab8bc413b..a63bfa35bfd 100755 --- a/bin/csharp-dotnet2-petstore.sh +++ b/bin/csharp-dotnet2-petstore.sh @@ -26,6 +26,6 @@ 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" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l CsharpDotNet2 -o samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient" java $JAVA_OPTS -jar $executable $ags diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CsharpDotNet2ClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CsharpDotNet2ClientCodegen.java index c08ae3456b1..05654eebe5c 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CsharpDotNet2ClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CsharpDotNet2ClientCodegen.java @@ -60,7 +60,7 @@ public class CsharpDotNet2ClientCodegen extends DefaultCodegen implements Codege "Integer", "Long", "Float", - "Stream", // not really a primitive, we include it to avoid model import + "System.IO.Stream", // not really a primitive, we include it to avoid model import "Object") ); instantiationTypes.put("array", "List"); @@ -76,7 +76,7 @@ public class CsharpDotNet2ClientCodegen extends DefaultCodegen implements Codege typeMapping.put("number", "double?"); typeMapping.put("datetime", "DateTime?"); typeMapping.put("date", "DateTime?"); - typeMapping.put("file", "Stream"); + typeMapping.put("file", "System.IO.Stream"); typeMapping.put("array", "List"); typeMapping.put("list", "List"); typeMapping.put("map", "Dictionary"); diff --git a/modules/swagger-codegen/src/main/resources/CsharpDotNet2/api.mustache b/modules/swagger-codegen/src/main/resources/CsharpDotNet2/api.mustache index c3fb85acb4f..f1756813ef4 100644 --- a/modules/swagger-codegen/src/main/resources/CsharpDotNet2/api.mustache +++ b/modules/swagger-codegen/src/main/resources/CsharpDotNet2/api.mustache @@ -1,5 +1,4 @@ using System; -using System.IO; using System.Collections.Generic; using RestSharp; using {{packageName}}.Client; 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 index b09b31264c3..2a513818a31 100644 --- 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 @@ -1,5 +1,4 @@ using System; -using System.IO; using System.Collections.Generic; using RestSharp; using IO.Swagger.Client; @@ -7,57 +6,17 @@ using IO.Swagger.Model; namespace IO.Swagger.Api { - /// /// Represents a collection of functions to interact with the API endpoints /// 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<Pet> - 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<Pet> - 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 /// @@ -65,16 +24,46 @@ namespace IO.Swagger.Api /// /// void DeletePet (long? petId, string apiKey); - + /// + /// Finds Pets by status Multiple status values can be provided with comma separated strings + /// + /// Status values that need to be considered for filter + /// List<Pet> + List FindPetsByStatus (List status); + /// + /// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Tags to filter by + /// List<Pet> + List FindPetsByTags (List tags); + /// + /// Find pet by ID Returns a single pet + /// + /// ID of pet to return + /// Pet + Pet GetPetById (long? petId); + /// + /// Update an existing pet + /// + /// Pet object that needs to be added to the store + /// + void UpdatePet (Pet body); + /// + /// 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 (long? petId, string name, string status); /// /// 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); - + /// ApiResponse + ApiResponse UploadFile (long? petId, string additionalMetadata, System.IO.Stream file); } /// @@ -130,47 +119,6 @@ namespace IO.Swagger.Api /// 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 /// @@ -179,22 +127,20 @@ namespace IO.Swagger.Api public void AddPet (Pet body) { + // verify the required parameter 'body' is set + if (body == null) throw new ApiException(400, "Missing required parameter 'body' when calling AddPet"); + 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 - + postBody = ApiClient.Serialize(body); // http body (model) parameter // authentication setting, if any String[] authSettings = new String[] { "petstore_auth" }; @@ -210,177 +156,6 @@ namespace IO.Swagger.Api 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<Pet> - 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<Pet> - 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" }; - - // 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 /// @@ -397,7 +172,6 @@ namespace IO.Swagger.Api var path = "/pet/{petId}"; path = path.Replace("{format}", "json"); path = path.Replace("{" + "petId" + "}", ApiClient.ParameterToString(petId)); - var queryParams = new Dictionary(); var headerParams = new Dictionary(); @@ -405,12 +179,8 @@ namespace IO.Swagger.Api var fileParams = new Dictionary(); String postBody = null; - - if (apiKey != null) headerParams.Add("api_key", ApiClient.ParameterToString(apiKey)); // header parameter - - - - + if (apiKey != null) headerParams.Add("api_key", ApiClient.ParameterToString(apiKey)); // header parameter + // authentication setting, if any String[] authSettings = new String[] { "petstore_auth" }; @@ -425,15 +195,203 @@ namespace IO.Swagger.Api return; } - + /// + /// Finds Pets by status Multiple status values can be provided with comma separated strings + /// + /// Status values that need to be considered for filter + /// List<Pet> + public List FindPetsByStatus (List status) + { + + // verify the required parameter 'status' is set + if (status == null) throw new ApiException(400, "Missing required parameter 'status' when calling FindPetsByStatus"); + + + 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 Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Tags to filter by + /// List<Pet> + public List FindPetsByTags (List tags) + { + + // verify the required parameter 'tags' is set + if (tags == null) throw new ApiException(400, "Missing required parameter 'tags' when calling FindPetsByTags"); + + + 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 single pet + /// + /// ID of pet to return + /// 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" }; + + // 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); + } + + /// + /// Update an existing pet + /// + /// Pet object that needs to be added to the store + /// + public void UpdatePet (Pet body) + { + + // verify the required parameter 'body' is set + if (body == null) throw new ApiException(400, "Missing required parameter 'body' when calling UpdatePet"); + + + 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; + } + + /// + /// 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 (long? 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; + } + /// /// 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) + /// ApiResponse + public ApiResponse UploadFile (long? petId, string additionalMetadata, System.IO.Stream file) { // verify the required parameter 'petId' is set @@ -443,7 +401,6 @@ namespace IO.Swagger.Api 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(); @@ -451,13 +408,9 @@ namespace IO.Swagger.Api 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)); - - - + 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" }; @@ -469,10 +422,8 @@ namespace IO.Swagger.Api else if (((int)response.StatusCode) == 0) throw new ApiException ((int)response.StatusCode, "Error calling UploadFile: " + response.ErrorMessage, response.ErrorMessage); - return; + return (ApiResponse) ApiClient.Deserialize(response.Content, typeof(ApiResponse), response.Headers); } - } - } 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 index ba269cc2b0c..0f9cb2339be 100644 --- 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 @@ -1,5 +1,4 @@ using System; -using System.IO; using System.Collections.Generic; using RestSharp; using IO.Swagger.Client; @@ -7,40 +6,34 @@ using IO.Swagger.Model; namespace IO.Swagger.Api { - /// /// Represents a collection of functions to interact with the API endpoints /// public interface IStoreApi { - - /// - /// Returns pet inventories by status Returns a map of status codes to quantities - /// - /// Dictionary<String, int?> - 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); - + /// + /// Returns pet inventories by status Returns a map of status codes to quantities + /// + /// Dictionary<String, int?> + Dictionary GetInventory (); + /// + /// 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 (long? orderId); + /// + /// Place an order for a pet + /// + /// order placed for purchasing the pet + /// Order + Order PlaceOrder (Order body); } /// @@ -96,128 +89,6 @@ namespace IO.Swagger.Api /// An instance of the ApiClient public ApiClient ApiClient {get; set;} - - /// - /// Returns pet inventories by status Returns a map of status codes to quantities - /// - /// Dictionary<String, int?> - 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 /// @@ -233,7 +104,6 @@ namespace IO.Swagger.Api 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(); @@ -241,11 +111,7 @@ namespace IO.Swagger.Api var fileParams = new Dictionary(); String postBody = null; - - - - - + // authentication setting, if any String[] authSettings = new String[] { }; @@ -260,7 +126,111 @@ namespace IO.Swagger.Api return; } - - } + /// + /// Returns pet inventories by status Returns a map of status codes to quantities + /// + /// Dictionary<String, int?> + 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); + } + + /// + /// 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 (long? 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); + } + + /// + /// Place an order for a pet + /// + /// order placed for purchasing the pet + /// Order + public Order PlaceOrder (Order body) + { + + // verify the required parameter 'body' is set + if (body == null) throw new ApiException(400, "Missing required parameter 'body' when calling PlaceOrder"); + + + 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); + } + + } } 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 index 1374556698e..e57bd2f8873 100644 --- 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 @@ -1,5 +1,4 @@ using System; -using System.IO; using System.Collections.Generic; using RestSharp; using IO.Swagger.Client; @@ -7,34 +6,41 @@ using IO.Swagger.Model; namespace IO.Swagger.Api { - /// /// Represents a collection of functions to interact with the API endpoints /// 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); - + /// + /// Delete user This can only be done by the logged in user. + /// + /// The name that needs to be deleted + /// + void DeleteUser (string username); + /// + /// Get user by user name + /// + /// The name that needs to be fetched. Use user1 for testing. + /// User + User GetUserByName (string username); /// /// Logs user into the system /// @@ -42,20 +48,11 @@ namespace IO.Swagger.Api /// 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. /// @@ -63,14 +60,6 @@ namespace IO.Swagger.Api /// 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); - } /// @@ -126,7 +115,6 @@ namespace IO.Swagger.Api /// An instance of the ApiClient public ApiClient ApiClient {get; set;} - /// /// Create user This can only be done by the logged in user. /// @@ -135,22 +123,20 @@ namespace IO.Swagger.Api public void CreateUser (User body) { + // verify the required parameter 'body' is set + if (body == null) throw new ApiException(400, "Missing required parameter 'body' when calling CreateUser"); + 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 - + postBody = ApiClient.Serialize(body); // http body (model) parameter // authentication setting, if any String[] authSettings = new String[] { }; @@ -166,7 +152,6 @@ namespace IO.Swagger.Api return; } - /// /// Creates list of users with given input array /// @@ -175,22 +160,20 @@ namespace IO.Swagger.Api public void CreateUsersWithArrayInput (List body) { + // verify the required parameter 'body' is set + if (body == null) throw new ApiException(400, "Missing required parameter 'body' when calling CreateUsersWithArrayInput"); + 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 - + postBody = ApiClient.Serialize(body); // http body (model) parameter // authentication setting, if any String[] authSettings = new String[] { }; @@ -206,7 +189,6 @@ namespace IO.Swagger.Api return; } - /// /// Creates list of users with given input array /// @@ -215,22 +197,20 @@ namespace IO.Swagger.Api public void CreateUsersWithListInput (List body) { + // verify the required parameter 'body' is set + if (body == null) throw new ApiException(400, "Missing required parameter 'body' when calling CreateUsersWithListInput"); + 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 - + postBody = ApiClient.Serialize(body); // http body (model) parameter // authentication setting, if any String[] authSettings = new String[] { }; @@ -246,175 +226,6 @@ namespace IO.Swagger.Api 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. /// @@ -430,7 +241,6 @@ namespace IO.Swagger.Api var path = "/user/{username}"; path = path.Replace("{format}", "json"); path = path.Replace("{" + "username" + "}", ApiClient.ParameterToString(username)); - var queryParams = new Dictionary(); var headerParams = new Dictionary(); @@ -438,11 +248,7 @@ namespace IO.Swagger.Api var fileParams = new Dictionary(); String postBody = null; - - - - - + // authentication setting, if any String[] authSettings = new String[] { }; @@ -457,7 +263,158 @@ namespace IO.Swagger.Api 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); + } + + /// + /// 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) + { + + // verify the required parameter 'username' is set + if (username == null) throw new ApiException(400, "Missing required parameter 'username' when calling LoginUser"); + + // verify the required parameter 'password' is set + if (password == null) throw new ApiException(400, "Missing required parameter 'password' when calling LoginUser"); + + + 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; + } + + /// + /// 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"); + + // verify the required parameter 'body' is set + if (body == null) throw new ApiException(400, "Missing required parameter 'body' 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; + } + + } } 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 index 3041cde567e..4f55f130134 100644 --- 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 @@ -257,17 +257,14 @@ namespace IO.Swagger.Client // determine which one to use switch(auth) { - - case "api_key": - headerParams["api_key"] = GetApiKeyWithPrefix("api_key"); - - break; - case "petstore_auth": //TODO support oauth break; - + case "api_key": + headerParams["api_key"] = GetApiKeyWithPrefix("api_key"); + + break; default: //TODO show warning about security definition not found break; diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Model/ApiResponse.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Model/ApiResponse.cs new file mode 100644 index 00000000000..42e259da68a --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Model/ApiResponse.cs @@ -0,0 +1,60 @@ +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 ApiResponse { + /// + /// Gets or Sets Code + /// + [DataMember(Name="code", EmitDefaultValue=false)] + [JsonProperty(PropertyName = "code")] + public int? Code { get; set; } + + /// + /// Gets or Sets Type + /// + [DataMember(Name="type", EmitDefaultValue=false)] + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets or Sets Message + /// + [DataMember(Name="message", EmitDefaultValue=false)] + [JsonProperty(PropertyName = "message")] + public string Message { 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 ApiResponse {\n"); + sb.Append(" Code: ").Append(Code).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" Message: ").Append(Message).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/Category.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Model/Category.cs index a11c0761d2d..3e2508259db 100644 --- 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 @@ -12,7 +12,6 @@ namespace IO.Swagger.Model { /// [DataContract] public class Category { - /// /// Gets or Sets Id /// @@ -20,7 +19,6 @@ namespace IO.Swagger.Model { [JsonProperty(PropertyName = "id")] public long? Id { get; set; } - /// /// Gets or Sets Name /// @@ -28,7 +26,6 @@ namespace IO.Swagger.Model { [JsonProperty(PropertyName = "name")] public string Name { get; set; } - /// /// Get the string presentation of the object @@ -37,11 +34,8 @@ namespace IO.Swagger.Model { 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(); } 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 index 17890990aa6..0f667d9c46d 100644 --- 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 @@ -12,7 +12,6 @@ namespace IO.Swagger.Model { /// [DataContract] public class Order { - /// /// Gets or Sets Id /// @@ -20,7 +19,6 @@ namespace IO.Swagger.Model { [JsonProperty(PropertyName = "id")] public long? Id { get; set; } - /// /// Gets or Sets PetId /// @@ -28,7 +26,6 @@ namespace IO.Swagger.Model { [JsonProperty(PropertyName = "petId")] public long? PetId { get; set; } - /// /// Gets or Sets Quantity /// @@ -36,7 +33,6 @@ namespace IO.Swagger.Model { [JsonProperty(PropertyName = "quantity")] public int? Quantity { get; set; } - /// /// Gets or Sets ShipDate /// @@ -44,7 +40,6 @@ namespace IO.Swagger.Model { [JsonProperty(PropertyName = "shipDate")] public DateTime? ShipDate { get; set; } - /// /// Order Status /// @@ -53,7 +48,6 @@ namespace IO.Swagger.Model { [JsonProperty(PropertyName = "status")] public string Status { get; set; } - /// /// Gets or Sets Complete /// @@ -61,7 +55,6 @@ namespace IO.Swagger.Model { [JsonProperty(PropertyName = "complete")] public bool? Complete { get; set; } - /// /// Get the string presentation of the object @@ -70,19 +63,12 @@ namespace IO.Swagger.Model { 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(); } 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 index 14f285794ad..27ab53d3767 100644 --- 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 @@ -12,7 +12,6 @@ namespace IO.Swagger.Model { /// [DataContract] public class Pet { - /// /// Gets or Sets Id /// @@ -20,7 +19,6 @@ namespace IO.Swagger.Model { [JsonProperty(PropertyName = "id")] public long? Id { get; set; } - /// /// Gets or Sets Category /// @@ -28,7 +26,6 @@ namespace IO.Swagger.Model { [JsonProperty(PropertyName = "category")] public Category Category { get; set; } - /// /// Gets or Sets Name /// @@ -36,7 +33,6 @@ namespace IO.Swagger.Model { [JsonProperty(PropertyName = "name")] public string Name { get; set; } - /// /// Gets or Sets PhotoUrls /// @@ -44,7 +40,6 @@ namespace IO.Swagger.Model { [JsonProperty(PropertyName = "photoUrls")] public List PhotoUrls { get; set; } - /// /// Gets or Sets Tags /// @@ -52,7 +47,6 @@ namespace IO.Swagger.Model { [JsonProperty(PropertyName = "tags")] public List Tags { get; set; } - /// /// pet status in the store /// @@ -61,7 +55,6 @@ namespace IO.Swagger.Model { [JsonProperty(PropertyName = "status")] public string Status { get; set; } - /// /// Get the string presentation of the object @@ -70,19 +63,12 @@ namespace IO.Swagger.Model { 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(); } 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 index 9a784e07a7e..639e1d79eaf 100644 --- 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 @@ -12,7 +12,6 @@ namespace IO.Swagger.Model { /// [DataContract] public class Tag { - /// /// Gets or Sets Id /// @@ -20,7 +19,6 @@ namespace IO.Swagger.Model { [JsonProperty(PropertyName = "id")] public long? Id { get; set; } - /// /// Gets or Sets Name /// @@ -28,7 +26,6 @@ namespace IO.Swagger.Model { [JsonProperty(PropertyName = "name")] public string Name { get; set; } - /// /// Get the string presentation of the object @@ -37,11 +34,8 @@ namespace IO.Swagger.Model { 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(); } 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 index ee7d6b035a3..f3367f341b9 100644 --- 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 @@ -12,7 +12,6 @@ namespace IO.Swagger.Model { /// [DataContract] public class User { - /// /// Gets or Sets Id /// @@ -20,7 +19,6 @@ namespace IO.Swagger.Model { [JsonProperty(PropertyName = "id")] public long? Id { get; set; } - /// /// Gets or Sets Username /// @@ -28,7 +26,6 @@ namespace IO.Swagger.Model { [JsonProperty(PropertyName = "username")] public string Username { get; set; } - /// /// Gets or Sets FirstName /// @@ -36,7 +33,6 @@ namespace IO.Swagger.Model { [JsonProperty(PropertyName = "firstName")] public string FirstName { get; set; } - /// /// Gets or Sets LastName /// @@ -44,7 +40,6 @@ namespace IO.Swagger.Model { [JsonProperty(PropertyName = "lastName")] public string LastName { get; set; } - /// /// Gets or Sets Email /// @@ -52,7 +47,6 @@ namespace IO.Swagger.Model { [JsonProperty(PropertyName = "email")] public string Email { get; set; } - /// /// Gets or Sets Password /// @@ -60,7 +54,6 @@ namespace IO.Swagger.Model { [JsonProperty(PropertyName = "password")] public string Password { get; set; } - /// /// Gets or Sets Phone /// @@ -68,7 +61,6 @@ namespace IO.Swagger.Model { [JsonProperty(PropertyName = "phone")] public string Phone { get; set; } - /// /// User Status /// @@ -77,7 +69,6 @@ namespace IO.Swagger.Model { [JsonProperty(PropertyName = "userStatus")] public int? UserStatus { get; set; } - /// /// Get the string presentation of the object @@ -86,23 +77,14 @@ namespace IO.Swagger.Model { 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(); }