From 529a638d1178838da3268d5a563085019846083a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Mart=C3=ADnez?= Date: Thu, 11 Oct 2018 03:38:48 +0200 Subject: [PATCH] [C#] Fix issue #1088 with generation of enum classes referenced from other objects (#1089) * Run ./bin/utils/ensure-up-to-date to re-generate samples run in the CI. * Fixed the #1088 issue by removing the update of enumeration properties while processing objects that reference them. Launched the ./bin/csharp-petstore-all.sh script. --- .../languages/AbstractCSharpCodegen.java | 2 - .../SwaggerClient/.openapi-generator-ignore | 23 + .../SwaggerClient/.openapi-generator/VERSION | 1 + .../Lib/SwaggerClient/README.md | 131 +++++ .../Lib/SwaggerClient/compile-mono.sh | 12 + .../Lib/SwaggerClient/docs/ApiResponse.md | 11 + .../Lib/SwaggerClient/docs/Category.md | 10 + .../Lib/SwaggerClient/docs/Order.md | 14 + .../Lib/SwaggerClient/docs/Pet.md | 14 + .../Lib/SwaggerClient/docs/PetApi.md | 534 ++++++++++++++++++ .../Lib/SwaggerClient/docs/StoreApi.md | 258 +++++++++ .../Lib/SwaggerClient/docs/Tag.md | 10 + .../Lib/SwaggerClient/docs/User.md | 16 + .../Lib/SwaggerClient/docs/UserApi.md | 496 ++++++++++++++++ .../Org/OpenAPITools/Api/PetApi.cs | 429 ++++++++++++++ .../Org/OpenAPITools/Api/StoreApi.cs | 236 ++++++++ .../Org/OpenAPITools/Api/UserApi.cs | 420 ++++++++++++++ .../Org/OpenAPITools/Client/ApiClient.cs | 297 ++++++++++ .../Org/OpenAPITools/Client/ApiException.cs | 47 ++ .../Org/OpenAPITools/Client/Configuration.cs | 132 +++++ .../Org/OpenAPITools/Model/ApiResponse.cs | 60 ++ .../Org/OpenAPITools/Model/Category.cs | 52 ++ .../Org/OpenAPITools/Model/Order.cs | 85 +++ .../Org/OpenAPITools/Model/Pet.cs | 85 +++ .../Org/OpenAPITools/Model/Tag.cs | 52 ++ .../Org/OpenAPITools/Model/User.cs | 101 ++++ .../Lib/SwaggerClient/vendor/packages.config | 5 + .../.openapi-generator/VERSION | 2 +- .../csharp/OpenAPIClientNet35/README.md | 11 +- .../OpenAPIClientNet35/docs/AnotherFakeApi.md | 16 +- .../csharp/OpenAPIClientNet35/docs/FakeApi.md | 72 ++- .../csharp/OpenAPIClientNet35/docs/File.md | 9 + .../docs/FileSchemaTestClass.md | 10 + .../csharp/OpenAPIClientNet35/docs/MapTest.md | 2 + .../csharp/OpenAPIClientNet35/docs/PetApi.md | 67 +++ .../docs/StringBooleanMap.md | 8 + .../Model/FileSchemaTestClassTests.cs | 88 +++ .../Org.OpenAPITools.Test/Model/FileTests.cs | 80 +++ .../Model/StringBooleanMapTests.cs | 72 +++ .../Org.OpenAPITools/Api/AnotherFakeApi.cs | 22 +- .../src/Org.OpenAPITools/Api/FakeApi.cs | 93 +++ .../src/Org.OpenAPITools/Api/PetApi.cs | 107 ++++ .../src/Org.OpenAPITools/Model/EnumArrays.cs | 8 +- .../src/Org.OpenAPITools/Model/EnumClass.cs | 6 +- .../src/Org.OpenAPITools/Model/EnumTest.cs | 22 +- .../src/Org.OpenAPITools/Model/File.cs | 116 ++++ .../Model/FileSchemaTestClass.cs | 131 +++++ .../src/Org.OpenAPITools/Model/MapTest.cs | 38 +- .../src/Org.OpenAPITools/Model/Order.cs | 6 +- .../src/Org.OpenAPITools/Model/OuterEnum.cs | 6 +- .../src/Org.OpenAPITools/Model/Pet.cs | 6 +- .../Model/StringBooleanMap.cs | 101 ++++ .../.openapi-generator/VERSION | 2 +- .../csharp/OpenAPIClientNet40/README.md | 11 +- .../OpenAPIClientNet40/docs/AnotherFakeApi.md | 16 +- .../csharp/OpenAPIClientNet40/docs/FakeApi.md | 72 ++- .../csharp/OpenAPIClientNet40/docs/File.md | 9 + .../docs/FileSchemaTestClass.md | 10 + .../csharp/OpenAPIClientNet40/docs/MapTest.md | 2 + .../csharp/OpenAPIClientNet40/docs/PetApi.md | 67 +++ .../docs/StringBooleanMap.md | 8 + .../Model/FileSchemaTestClassTests.cs | 88 +++ .../Org.OpenAPITools.Test/Model/FileTests.cs | 80 +++ .../Model/StringBooleanMapTests.cs | 72 +++ .../Org.OpenAPITools/Api/AnotherFakeApi.cs | 22 +- .../src/Org.OpenAPITools/Api/FakeApi.cs | 93 +++ .../src/Org.OpenAPITools/Api/PetApi.cs | 107 ++++ .../src/Org.OpenAPITools/Model/EnumArrays.cs | 8 +- .../src/Org.OpenAPITools/Model/EnumClass.cs | 6 +- .../src/Org.OpenAPITools/Model/EnumTest.cs | 22 +- .../src/Org.OpenAPITools/Model/File.cs | 125 ++++ .../Model/FileSchemaTestClass.cs | 140 +++++ .../src/Org.OpenAPITools/Model/MapTest.cs | 38 +- .../src/Org.OpenAPITools/Model/Order.cs | 6 +- .../src/Org.OpenAPITools/Model/OuterEnum.cs | 6 +- .../src/Org.OpenAPITools/Model/Pet.cs | 6 +- .../Model/StringBooleanMap.cs | 110 ++++ .../.openapi-generator/VERSION | 2 +- .../csharp/OpenAPIClientNetStandard/README.md | 11 +- .../docs/AnotherFakeApi.md | 16 +- .../OpenAPIClientNetStandard/docs/FakeApi.md | 72 ++- .../OpenAPIClientNetStandard/docs/File.md | 9 + .../docs/FileSchemaTestClass.md | 10 + .../OpenAPIClientNetStandard/docs/MapTest.md | 2 + .../OpenAPIClientNetStandard/docs/PetApi.md | 67 +++ .../docs/StringBooleanMap.md | 8 + .../Org.OpenAPITools/Api/AnotherFakeApi.cs | 44 +- .../src/Org.OpenAPITools/Api/FakeApi.cs | 187 ++++++ .../src/Org.OpenAPITools/Api/PetApi.cs | 215 +++++++ .../src/Org.OpenAPITools/Model/EnumArrays.cs | 8 +- .../src/Org.OpenAPITools/Model/EnumClass.cs | 6 +- .../src/Org.OpenAPITools/Model/EnumTest.cs | 22 +- .../src/Org.OpenAPITools/Model/File.cs | 113 ++++ .../Model/FileSchemaTestClass.cs | 128 +++++ .../src/Org.OpenAPITools/Model/MapTest.cs | 38 +- .../src/Org.OpenAPITools/Model/Order.cs | 6 +- .../src/Org.OpenAPITools/Model/OuterEnum.cs | 6 +- .../src/Org.OpenAPITools/Model/Pet.cs | 6 +- .../Model/StringBooleanMap.cs | 98 ++++ .../.openapi-generator/VERSION | 2 +- .../README.md | 11 +- .../docs/AnotherFakeApi.md | 16 +- .../docs/FakeApi.md | 72 ++- .../docs/File.md | 9 + .../docs/FileSchemaTestClass.md | 10 + .../docs/MapTest.md | 2 + .../docs/PetApi.md | 67 +++ .../docs/StringBooleanMap.md | 8 + .../Model/FileSchemaTestClassTests.cs | 88 +++ .../Org.OpenAPITools.Test/Model/FileTests.cs | 80 +++ .../Model/StringBooleanMapTests.cs | 72 +++ .../Org.OpenAPITools/Api/AnotherFakeApi.cs | 44 +- .../src/Org.OpenAPITools/Api/FakeApi.cs | 187 ++++++ .../src/Org.OpenAPITools/Api/PetApi.cs | 215 +++++++ .../src/Org.OpenAPITools/Model/EnumArrays.cs | 8 +- .../src/Org.OpenAPITools/Model/EnumClass.cs | 6 +- .../src/Org.OpenAPITools/Model/EnumTest.cs | 22 +- .../src/Org.OpenAPITools/Model/File.cs | 148 +++++ .../Model/FileSchemaTestClass.cs | 163 ++++++ .../src/Org.OpenAPITools/Model/MapTest.cs | 38 +- .../src/Org.OpenAPITools/Model/Order.cs | 6 +- .../src/Org.OpenAPITools/Model/OuterEnum.cs | 6 +- .../src/Org.OpenAPITools/Model/Pet.cs | 6 +- .../Model/StringBooleanMap.cs | 133 +++++ 124 files changed, 7987 insertions(+), 264 deletions(-) create mode 100644 samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/.openapi-generator-ignore create mode 100644 samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/.openapi-generator/VERSION create mode 100644 samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/README.md create mode 100644 samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/compile-mono.sh create mode 100644 samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/ApiResponse.md create mode 100644 samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/Category.md create mode 100644 samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/Order.md create mode 100644 samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/Pet.md create mode 100644 samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/PetApi.md create mode 100644 samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/StoreApi.md create mode 100644 samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/Tag.md create mode 100644 samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/User.md create mode 100644 samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/UserApi.md create mode 100644 samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Api/PetApi.cs create mode 100644 samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Api/StoreApi.cs create mode 100644 samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Api/UserApi.cs create mode 100644 samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Client/ApiClient.cs create mode 100644 samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Client/ApiException.cs create mode 100644 samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Client/Configuration.cs create mode 100644 samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Model/ApiResponse.cs create mode 100644 samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Model/Category.cs create mode 100644 samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Model/Order.cs create mode 100644 samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Model/Pet.cs create mode 100644 samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Model/Tag.cs create mode 100644 samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Model/User.cs create mode 100644 samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/vendor/packages.config create mode 100644 samples/client/petstore/csharp/OpenAPIClientNet35/docs/File.md create mode 100644 samples/client/petstore/csharp/OpenAPIClientNet35/docs/FileSchemaTestClass.md create mode 100644 samples/client/petstore/csharp/OpenAPIClientNet35/docs/StringBooleanMap.md create mode 100644 samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools.Test/Model/FileTests.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools.Test/Model/StringBooleanMapTests.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/File.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/StringBooleanMap.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClientNet40/docs/File.md create mode 100644 samples/client/petstore/csharp/OpenAPIClientNet40/docs/FileSchemaTestClass.md create mode 100644 samples/client/petstore/csharp/OpenAPIClientNet40/docs/StringBooleanMap.md create mode 100644 samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools.Test/Model/FileTests.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools.Test/Model/StringBooleanMapTests.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/File.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/StringBooleanMap.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/File.md create mode 100644 samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/FileSchemaTestClass.md create mode 100644 samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/StringBooleanMap.md create mode 100644 samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/File.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/StringBooleanMap.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/File.md create mode 100644 samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/FileSchemaTestClass.md create mode 100644 samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/StringBooleanMap.md create mode 100644 samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/FileTests.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/StringBooleanMapTests.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/File.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/StringBooleanMap.cs diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java index 2e99417e93a3..2a8b85e13325 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java @@ -422,8 +422,6 @@ private void postProcessEnumRefs(final Map models) { var.allowableValues = refModel.allowableValues; var.isEnum = true; - updateCodegenPropertyEnum(var); - // We do these after updateCodegenPropertyEnum to avoid generalities that don't mesh with C#. var.isPrimitiveType = true; } diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/.openapi-generator-ignore b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/.openapi-generator/VERSION b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/.openapi-generator/VERSION new file mode 100644 index 000000000000..6d94c9c2e12a --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/.openapi-generator/VERSION @@ -0,0 +1 @@ +3.3.0-SNAPSHOT \ No newline at end of file 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 000000000000..6b861dfd7238 --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/README.md @@ -0,0 +1,131 @@ +# Org.OpenAPITools - the C# library for the OpenAPI Petstore + +This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + +This C# SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: 1.0.0 +- SDK version: 1.0.0 +- Build package: org.openapitools.codegen.languages.CSharpDotNet2ClientCodegen + + +## Frameworks supported +- .NET 2.0 + + +## Dependencies +- Mono compiler +- Newtonsoft.Json.7.0.1 +- RestSharp.Net2.1.1.11 + +Note: NuGet is downloaded by the mono compilation script and packages are installed with it. No dependency DLLs are bundled with this generator + + +## Installation +Run the following command to generate the DLL +- [Mac/Linux] `/bin/sh compile-mono.sh` +- [Windows] TODO + +Then include the DLL (under the `bin` folder) in the C# project, and use the namespaces: +```csharp +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; +``` + +## Getting Started + +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class Example + { + public void main() + { + + // Configure OAuth2 access token for authorization: petstore_auth + Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(); + var pet = new Pet(); // Pet | Pet object that needs to be added to the store + + try + { + // Add a new pet to the store + apiInstance.AddPet(pet); + } + catch (Exception e) + { + Debug.Print("Exception when calling PetApi.AddPet: " + e.Message ); + } + } + } +} +``` + + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*PetApi* | [**AddPet**](docs/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store +*PetApi* | [**DeletePet**](docs/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**FindPetsByStatus**](docs/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status +*PetApi* | [**FindPetsByTags**](docs/PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags +*PetApi* | [**GetPetById**](docs/PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +*PetApi* | [**UpdatePet**](docs/PetApi.md#updatepet) | **PUT** /pet | Update an existing pet +*PetApi* | [**UpdatePetWithForm**](docs/PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data +*PetApi* | [**UploadFile**](docs/PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image +*StoreApi* | [**DeleteOrder**](docs/StoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID +*StoreApi* | [**GetInventory**](docs/StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status +*StoreApi* | [**GetOrderById**](docs/StoreApi.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID +*StoreApi* | [**PlaceOrder**](docs/StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet +*UserApi* | [**CreateUser**](docs/UserApi.md#createuser) | **POST** /user | Create user +*UserApi* | [**CreateUsersWithArrayInput**](docs/UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**CreateUsersWithListInput**](docs/UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array +*UserApi* | [**DeleteUser**](docs/UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user +*UserApi* | [**GetUserByName**](docs/UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name +*UserApi* | [**LoginUser**](docs/UserApi.md#loginuser) | **GET** /user/login | Logs user into the system +*UserApi* | [**LogoutUser**](docs/UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session +*UserApi* | [**UpdateUser**](docs/UserApi.md#updateuser) | **PUT** /user/{username} | Updated user + + + +## Documentation for Models + + - [Org.OpenAPITools.Model.ApiResponse](docs/ApiResponse.md) + - [Org.OpenAPITools.Model.Category](docs/Category.md) + - [Org.OpenAPITools.Model.Order](docs/Order.md) + - [Org.OpenAPITools.Model.Pet](docs/Pet.md) + - [Org.OpenAPITools.Model.Tag](docs/Tag.md) + - [Org.OpenAPITools.Model.User](docs/User.md) + + + +## Documentation for Authorization + + +### api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + + +### petstore_auth + +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - write:pets: modify pets in your account + - read:pets: read your pets + 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 000000000000..8e6e23eba080 --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/compile-mono.sh @@ -0,0 +1,12 @@ +wget -nc https://dist.nuget.org/win-x86-commandline/latest/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/Org.OpenAPITools.dll \ +-recurse:'src/*.cs' \ +-doc:bin/Org.OpenAPITools.xml \ +-platform:anycpu diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/ApiResponse.md b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/ApiResponse.md new file mode 100644 index 000000000000..01b35815bd40 --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/ApiResponse.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.ApiResponse +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Code** | **int?** | | [optional] +**Type** | **string** | | [optional] +**Message** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/Category.md b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/Category.md new file mode 100644 index 000000000000..860a468e35c8 --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/Category.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.Category +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **long?** | | [optional] +**Name** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/Order.md b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/Order.md new file mode 100644 index 000000000000..984bd5ca063e --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/Order.md @@ -0,0 +1,14 @@ +# Org.OpenAPITools.Model.Order +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **long?** | | [optional] +**PetId** | **long?** | | [optional] +**Quantity** | **int?** | | [optional] +**ShipDate** | **DateTime?** | | [optional] +**Status** | **string** | Order Status | [optional] +**Complete** | **bool?** | | [optional] [default to false] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/Pet.md b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/Pet.md new file mode 100644 index 000000000000..ce9fe873cd29 --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/Pet.md @@ -0,0 +1,14 @@ +# Org.OpenAPITools.Model.Pet +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **long?** | | [optional] +**Category** | [**Category**](Category.md) | | [optional] +**Name** | **string** | | +**PhotoUrls** | **List** | | +**Tags** | [**List**](Tag.md) | | [optional] +**Status** | **string** | pet status in the store | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/PetApi.md b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/PetApi.md new file mode 100644 index 000000000000..0051c617a1df --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/PetApi.md @@ -0,0 +1,534 @@ +# Org.OpenAPITools.Api.PetApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**AddPet**](PetApi.md#addpet) | **POST** /pet | Add a new pet to the store +[**DeletePet**](PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet +[**FindPetsByStatus**](PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status +[**FindPetsByTags**](PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags +[**GetPetById**](PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +[**UpdatePet**](PetApi.md#updatepet) | **PUT** /pet | Update an existing pet +[**UpdatePetWithForm**](PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data +[**UploadFile**](PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image + + + +# **AddPet** +> void AddPet (Pet pet) + +Add a new pet to the store + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class AddPetExample + { + public void main() + { + + // Configure OAuth2 access token for authorization: petstore_auth + Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(); + var pet = new Pet(); // Pet | Pet object that needs to be added to the store + + try + { + // Add a new pet to the store + apiInstance.AddPet(pet); + } + catch (Exception e) + { + Debug.Print("Exception when calling PetApi.AddPet: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **DeletePet** +> void DeletePet (long? petId, string apiKey) + +Deletes a pet + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class DeletePetExample + { + public void main() + { + + // Configure OAuth2 access token for authorization: petstore_auth + Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(); + var petId = 789; // long? | Pet id to delete + var apiKey = apiKey_example; // string | (optional) + + try + { + // Deletes a pet + apiInstance.DeletePet(petId, apiKey); + } + catch (Exception e) + { + Debug.Print("Exception when calling PetApi.DeletePet: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **long?**| Pet id to delete | + **apiKey** | **string**| | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **FindPetsByStatus** +> List FindPetsByStatus (List status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class FindPetsByStatusExample + { + public void main() + { + + // Configure OAuth2 access token for authorization: petstore_auth + Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(); + var status = status_example; // List | Status values that need to be considered for filter + + try + { + // Finds Pets by status + List<Pet> result = apiInstance.FindPetsByStatus(status); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling PetApi.FindPetsByStatus: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | **List**| Status values that need to be considered for filter | + +### Return type + +[**List**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **FindPetsByTags** +> List FindPetsByTags (List tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class FindPetsByTagsExample + { + public void main() + { + + // Configure OAuth2 access token for authorization: petstore_auth + Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(); + var tags = new List(); // List | Tags to filter by + + try + { + // Finds Pets by tags + List<Pet> result = apiInstance.FindPetsByTags(tags); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling PetApi.FindPetsByTags: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tags** | [**List**](string.md)| Tags to filter by | + +### Return type + +[**List**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **GetPetById** +> Pet GetPetById (long? petId) + +Find pet by ID + +Returns a single pet + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class GetPetByIdExample + { + public void main() + { + + // Configure API key authorization: api_key + Configuration.Default.ApiKey.Add("api_key", "YOUR_API_KEY"); + // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed + // Configuration.Default.ApiKeyPrefix.Add("api_key", "Bearer"); + + var apiInstance = new PetApi(); + var petId = 789; // long? | ID of pet to return + + try + { + // Find pet by ID + Pet result = apiInstance.GetPetById(petId); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling PetApi.GetPetById: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **long?**| ID of pet to return | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **UpdatePet** +> void UpdatePet (Pet pet) + +Update an existing pet + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class UpdatePetExample + { + public void main() + { + + // Configure OAuth2 access token for authorization: petstore_auth + Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(); + var pet = new Pet(); // Pet | Pet object that needs to be added to the store + + try + { + // Update an existing pet + apiInstance.UpdatePet(pet); + } + catch (Exception e) + { + Debug.Print("Exception when calling PetApi.UpdatePet: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **UpdatePetWithForm** +> void UpdatePetWithForm (long? petId, string name, string status) + +Updates a pet in the store with form data + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class UpdatePetWithFormExample + { + public void main() + { + + // Configure OAuth2 access token for authorization: petstore_auth + Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(); + var petId = 789; // long? | ID of pet that needs to be updated + var name = name_example; // string | Updated name of the pet (optional) + var status = status_example; // string | Updated status of the pet (optional) + + try + { + // Updates a pet in the store with form data + apiInstance.UpdatePetWithForm(petId, name, status); + } + catch (Exception e) + { + Debug.Print("Exception when calling PetApi.UpdatePetWithForm: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **long?**| ID of pet that needs to be updated | + **name** | **string**| Updated name of the pet | [optional] + **status** | **string**| Updated status of the pet | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **UploadFile** +> ApiResponse UploadFile (long? petId, string additionalMetadata, System.IO.Stream file) + +uploads an image + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class UploadFileExample + { + public void main() + { + + // Configure OAuth2 access token for authorization: petstore_auth + Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(); + var petId = 789; // long? | ID of pet to update + var additionalMetadata = additionalMetadata_example; // string | Additional data to pass to server (optional) + var file = new System.IO.Stream(); // System.IO.Stream | file to upload (optional) + + try + { + // uploads an image + ApiResponse result = apiInstance.UploadFile(petId, additionalMetadata, file); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling PetApi.UploadFile: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **long?**| ID of pet to update | + **additionalMetadata** | **string**| Additional data to pass to server | [optional] + **file** | **System.IO.Stream**| file to upload | [optional] + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/StoreApi.md b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/StoreApi.md new file mode 100644 index 000000000000..76334b0ca4dc --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/StoreApi.md @@ -0,0 +1,258 @@ +# Org.OpenAPITools.Api.StoreApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**DeleteOrder**](StoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID +[**GetInventory**](StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status +[**GetOrderById**](StoreApi.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID +[**PlaceOrder**](StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet + + + +# **DeleteOrder** +> void DeleteOrder (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 + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class DeleteOrderExample + { + public void main() + { + + var apiInstance = new StoreApi(); + var orderId = orderId_example; // string | ID of the order that needs to be deleted + + try + { + // Delete purchase order by ID + apiInstance.DeleteOrder(orderId); + } + catch (Exception e) + { + Debug.Print("Exception when calling StoreApi.DeleteOrder: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **string**| ID of the order that needs to be deleted | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **GetInventory** +> Dictionary GetInventory () + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class GetInventoryExample + { + public void main() + { + + // Configure API key authorization: api_key + Configuration.Default.ApiKey.Add("api_key", "YOUR_API_KEY"); + // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed + // Configuration.Default.ApiKeyPrefix.Add("api_key", "Bearer"); + + var apiInstance = new StoreApi(); + + try + { + // Returns pet inventories by status + Dictionary<string, int?> result = apiInstance.GetInventory(); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling StoreApi.GetInventory: " + e.Message ); + } + } + } +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +**Dictionary** + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **GetOrderById** +> Order GetOrderById (long? orderId) + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class GetOrderByIdExample + { + public void main() + { + + var apiInstance = new StoreApi(); + var orderId = 789; // long? | ID of pet that needs to be fetched + + try + { + // Find purchase order by ID + Order result = apiInstance.GetOrderById(orderId); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling StoreApi.GetOrderById: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **long?**| ID of pet that needs to be fetched | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **PlaceOrder** +> Order PlaceOrder (Order order) + +Place an order for a pet + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class PlaceOrderExample + { + public void main() + { + + var apiInstance = new StoreApi(); + var order = new Order(); // Order | order placed for purchasing the pet + + try + { + // Place an order for a pet + Order result = apiInstance.PlaceOrder(order); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling StoreApi.PlaceOrder: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **order** | [**Order**](Order.md)| order placed for purchasing the pet | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/Tag.md b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/Tag.md new file mode 100644 index 000000000000..6a76c28595f7 --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/Tag.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.Tag +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **long?** | | [optional] +**Name** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/User.md b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/User.md new file mode 100644 index 000000000000..04dd24a3423c --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/User.md @@ -0,0 +1,16 @@ +# Org.OpenAPITools.Model.User +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **long?** | | [optional] +**Username** | **string** | | [optional] +**FirstName** | **string** | | [optional] +**LastName** | **string** | | [optional] +**Email** | **string** | | [optional] +**Password** | **string** | | [optional] +**Phone** | **string** | | [optional] +**UserStatus** | **int?** | User Status | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/UserApi.md b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/UserApi.md new file mode 100644 index 000000000000..dad1e5050052 --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/UserApi.md @@ -0,0 +1,496 @@ +# Org.OpenAPITools.Api.UserApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**CreateUser**](UserApi.md#createuser) | **POST** /user | Create user +[**CreateUsersWithArrayInput**](UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array +[**CreateUsersWithListInput**](UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array +[**DeleteUser**](UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user +[**GetUserByName**](UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name +[**LoginUser**](UserApi.md#loginuser) | **GET** /user/login | Logs user into the system +[**LogoutUser**](UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session +[**UpdateUser**](UserApi.md#updateuser) | **PUT** /user/{username} | Updated user + + + +# **CreateUser** +> void CreateUser (User user) + +Create user + +This can only be done by the logged in user. + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class CreateUserExample + { + public void main() + { + + var apiInstance = new UserApi(); + var user = new User(); // User | Created user object + + try + { + // Create user + apiInstance.CreateUser(user); + } + catch (Exception e) + { + Debug.Print("Exception when calling UserApi.CreateUser: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**User**](User.md)| Created user object | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **CreateUsersWithArrayInput** +> void CreateUsersWithArrayInput (List user) + +Creates list of users with given input array + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class CreateUsersWithArrayInputExample + { + public void main() + { + + var apiInstance = new UserApi(); + var user = new List(); // List | List of user object + + try + { + // Creates list of users with given input array + apiInstance.CreateUsersWithArrayInput(user); + } + catch (Exception e) + { + Debug.Print("Exception when calling UserApi.CreateUsersWithArrayInput: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**List**](List.md)| List of user object | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **CreateUsersWithListInput** +> void CreateUsersWithListInput (List user) + +Creates list of users with given input array + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class CreateUsersWithListInputExample + { + public void main() + { + + var apiInstance = new UserApi(); + var user = new List(); // List | List of user object + + try + { + // Creates list of users with given input array + apiInstance.CreateUsersWithListInput(user); + } + catch (Exception e) + { + Debug.Print("Exception when calling UserApi.CreateUsersWithListInput: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**List**](List.md)| List of user object | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **DeleteUser** +> void DeleteUser (string username) + +Delete user + +This can only be done by the logged in user. + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class DeleteUserExample + { + public void main() + { + + var apiInstance = new UserApi(); + var username = username_example; // string | The name that needs to be deleted + + try + { + // Delete user + apiInstance.DeleteUser(username); + } + catch (Exception e) + { + Debug.Print("Exception when calling UserApi.DeleteUser: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| The name that needs to be deleted | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **GetUserByName** +> User GetUserByName (string username) + +Get user by user name + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class GetUserByNameExample + { + public void main() + { + + var apiInstance = new UserApi(); + var username = username_example; // string | The name that needs to be fetched. Use user1 for testing. + + try + { + // Get user by user name + User result = apiInstance.GetUserByName(username); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling UserApi.GetUserByName: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| The name that needs to be fetched. Use user1 for testing. | + +### Return type + +[**User**](User.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **LoginUser** +> string LoginUser (string username, string password) + +Logs user into the system + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class LoginUserExample + { + public void main() + { + + var apiInstance = new UserApi(); + var username = username_example; // string | The user name for login + var password = password_example; // string | The password for login in clear text + + try + { + // Logs user into the system + string result = apiInstance.LoginUser(username, password); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling UserApi.LoginUser: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| The user name for login | + **password** | **string**| The password for login in clear text | + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **LogoutUser** +> void LogoutUser () + +Logs out current logged in user session + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class LogoutUserExample + { + public void main() + { + + var apiInstance = new UserApi(); + + try + { + // Logs out current logged in user session + apiInstance.LogoutUser(); + } + catch (Exception e) + { + Debug.Print("Exception when calling UserApi.LogoutUser: " + e.Message ); + } + } + } +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **UpdateUser** +> void UpdateUser (string username, User user) + +Updated user + +This can only be done by the logged in user. + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class UpdateUserExample + { + public void main() + { + + var apiInstance = new UserApi(); + var username = username_example; // string | name that need to be deleted + var user = new User(); // User | Updated user object + + try + { + // Updated user + apiInstance.UpdateUser(username, user); + } + catch (Exception e) + { + Debug.Print("Exception when calling UserApi.UpdateUser: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| name that need to be deleted | + **user** | [**User**](User.md)| Updated user object | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Api/PetApi.cs new file mode 100644 index 000000000000..66e0f6ab5ccd --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Api/PetApi.cs @@ -0,0 +1,429 @@ +using System; +using System.Collections.Generic; +using RestSharp; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IPetApi + { + /// + /// Add a new pet to the store + /// + /// Pet object that needs to be added to the store + /// + void AddPet (Pet pet); + /// + /// Deletes a pet + /// + /// Pet id to delete + /// + /// + 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 pet); + /// + /// 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 + /// ApiResponse + ApiResponse UploadFile (long? petId, string additionalMetadata, System.IO.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;} + + /// + /// Add a new pet to the store + /// + /// Pet object that needs to be added to the store + /// + public void AddPet (Pet pet) + { + + // verify the required parameter 'pet' is set + if (pet == null) throw new ApiException(400, "Missing required parameter 'pet' 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(pet); // 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; + } + + /// + /// 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; + } + + /// + /// 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 pet) + { + + // verify the required parameter 'pet' is set + if (pet == null) throw new ApiException(400, "Missing required parameter 'pet' 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(pet); // 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 + /// ApiResponse + public ApiResponse UploadFile (long? petId, string additionalMetadata, System.IO.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 (ApiResponse) ApiClient.Deserialize(response.Content, typeof(ApiResponse), response.Headers); + } + + } +} diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Api/StoreApi.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Api/StoreApi.cs new file mode 100644 index 000000000000..3390bbbcaba7 --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Api/StoreApi.cs @@ -0,0 +1,236 @@ +using System; +using System.Collections.Generic; +using RestSharp; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IStoreApi + { + /// + /// 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 order); + } + + /// + /// 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;} + + /// + /// 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; + } + + /// + /// 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 order) + { + + // verify the required parameter 'order' is set + if (order == null) throw new ApiException(400, "Missing required parameter 'order' 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(order); // 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/Org/OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Api/UserApi.cs new file mode 100644 index 000000000000..60a0ccac5994 --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Api/UserApi.cs @@ -0,0 +1,420 @@ +using System; +using System.Collections.Generic; +using RestSharp; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.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 user); + /// + /// Creates list of users with given input array + /// + /// List of user object + /// + void CreateUsersWithArrayInput (List user); + /// + /// Creates list of users with given input array + /// + /// List of user object + /// + void CreateUsersWithListInput (List user); + /// + /// 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 + /// + /// 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 (); + /// + /// 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 user); + } + + /// + /// 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 user) + { + + // verify the required parameter 'user' is set + if (user == null) throw new ApiException(400, "Missing required parameter 'user' 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(user); // 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 user) + { + + // verify the required parameter 'user' is set + if (user == null) throw new ApiException(400, "Missing required parameter 'user' 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(user); // 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 user) + { + + // verify the required parameter 'user' is set + if (user == null) throw new ApiException(400, "Missing required parameter 'user' 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(user); // 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; + } + + /// + /// 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; + } + + /// + /// 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 user) + { + + // 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 'user' is set + if (user == null) throw new ApiException(400, "Missing required parameter 'user' 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(user); // 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/Org/OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Client/ApiClient.cs new file mode 100644 index 000000000000..095f97997ec3 --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Client/ApiClient.cs @@ -0,0 +1,297 @@ +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 Org.OpenAPITools.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 a formatted string (default ISO 8601), customizable with Configuration.DateTime. + /// 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 a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return ((DateTime)obj).ToString (Configuration.DateTimeFormat); + 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. + /// HTTP headers. + /// 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. + /// + /// Object to be casted + /// Target type + /// Casted object + public static Object ConvertType(Object fromObject, Type toObject) { + return Convert.ChangeType(fromObject, toObject); + } + + } +} diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Client/ApiException.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Client/ApiException.cs new file mode 100644 index 000000000000..7985897b93e8 --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Client/ApiException.cs @@ -0,0 +1,47 @@ +using System; + +namespace Org.OpenAPITools.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. + /// + 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/Org/OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Client/Configuration.cs new file mode 100644 index 000000000000..8cac9c7d9db5 --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Client/Configuration.cs @@ -0,0 +1,132 @@ +using System; +using System.Reflection; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; + +namespace Org.OpenAPITools.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; + } + } + + private const string ISO8601_DATETIME_FORMAT = "o"; + + private static string _dateTimeFormat = ISO8601_DATETIME_FORMAT; + + /// + /// Gets or sets the the date time format used when serializing in the ApiClient + /// By default, it's set to ISO 8601 - "o", for others see: + /// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx + /// and https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx + /// No validation is done to ensure that the string you're providing is valid + /// + /// The DateTimeFormat string + public static String DateTimeFormat + { + get + { + return _dateTimeFormat; + } + set + { + if (string.IsNullOrEmpty(value)) + { + // Never allow a blank or null string, go back to the default + _dateTimeFormat = ISO8601_DATETIME_FORMAT; + return; + } + + // Caution, no validation when you choose date time format other than ISO 8601 + // Take a look at the above links + _dateTimeFormat = value; + } + } + + /// + /// Returns a string with essential information for debugging. + /// + public static String ToDebugReport() + { + String report = "C# SDK (Org.OpenAPITools) 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/Org/OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Model/ApiResponse.cs new file mode 100644 index 000000000000..648aaeba5b17 --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/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 Org.OpenAPITools.Model { + + /// + /// Describes the result of uploading an image resource + /// + [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/Org/OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Model/Category.cs new file mode 100644 index 000000000000..847279502e28 --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Model/Category.cs @@ -0,0 +1,52 @@ +using System; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Runtime.Serialization; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Model { + + /// + /// A category for a pet + /// + [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/Org/OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Model/Order.cs new file mode 100644 index 000000000000..c19511ca3f8a --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Model/Order.cs @@ -0,0 +1,85 @@ +using System; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Runtime.Serialization; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Model { + + /// + /// An order for a pets from the pet store + /// + [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/Org/OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Model/Pet.cs new file mode 100644 index 000000000000..71ec62aa9c84 --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Model/Pet.cs @@ -0,0 +1,85 @@ +using System; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Runtime.Serialization; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Model { + + /// + /// A pet for sale in the pet store + /// + [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/Org/OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Model/Tag.cs new file mode 100644 index 000000000000..6399695a50aa --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Model/Tag.cs @@ -0,0 +1,52 @@ +using System; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Runtime.Serialization; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Model { + + /// + /// A tag for a pet + /// + [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/Org/OpenAPITools/Model/User.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Model/User.cs new file mode 100644 index 000000000000..c6af059dcdc8 --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Model/User.cs @@ -0,0 +1,101 @@ +using System; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Runtime.Serialization; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Model { + + /// + /// A User who is purchasing from the pet store + /// + [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 000000000000..7b9cf1863031 --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/vendor/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/.openapi-generator/VERSION b/samples/client/petstore/csharp/OpenAPIClientNet35/.openapi-generator/VERSION index 096bf47efe31..6d94c9c2e12a 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/.openapi-generator/VERSION +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/.openapi-generator/VERSION @@ -1 +1 @@ -3.0.0-SNAPSHOT \ No newline at end of file +3.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/README.md b/samples/client/petstore/csharp/OpenAPIClientNet35/README.md index 441abc408817..a2b8a9b17a0f 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/README.md +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/README.md @@ -76,12 +76,12 @@ namespace Example try { // To test special tags - ModelClient result = apiInstance.TestSpecialTags(modelClient); + ModelClient result = apiInstance.Call123TestSpecialTags(modelClient); Debug.WriteLine(result); } catch (Exception e) { - Debug.Print("Exception when calling AnotherFakeApi.TestSpecialTags: " + e.Message ); + Debug.Print("Exception when calling AnotherFakeApi.Call123TestSpecialTags: " + e.Message ); } } @@ -96,11 +96,12 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- -*AnotherFakeApi* | [**TestSpecialTags**](docs/AnotherFakeApi.md#testspecialtags) | **PATCH** /another-fake/dummy | To test special tags +*AnotherFakeApi* | [**Call123TestSpecialTags**](docs/AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags *FakeApi* | [**FakeOuterBooleanSerialize**](docs/FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean | *FakeApi* | [**FakeOuterCompositeSerialize**](docs/FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | *FakeApi* | [**FakeOuterNumberSerialize**](docs/FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | *FakeApi* | [**FakeOuterStringSerialize**](docs/FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | +*FakeApi* | [**TestBodyWithFileSchema**](docs/FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | *FakeApi* | [**TestBodyWithQueryParams**](docs/FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | *FakeApi* | [**TestClientModel**](docs/FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model *FakeApi* | [**TestEndpointParameters**](docs/FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -116,6 +117,7 @@ Class | Method | HTTP request | Description *PetApi* | [**UpdatePet**](docs/PetApi.md#updatepet) | **PUT** /pet | Update an existing pet *PetApi* | [**UpdatePetWithForm**](docs/PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetApi* | [**UploadFile**](docs/PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image +*PetApi* | [**UploadFileWithRequiredFile**](docs/PetApi.md#uploadfilewithrequiredfile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) *StoreApi* | [**DeleteOrder**](docs/StoreApi.md#deleteorder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID *StoreApi* | [**GetInventory**](docs/StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status *StoreApi* | [**GetOrderById**](docs/StoreApi.md#getorderbyid) | **GET** /store/order/{order_id} | Find purchase order by ID @@ -148,6 +150,8 @@ Class | Method | HTTP request | Description - [Model.EnumArrays](docs/EnumArrays.md) - [Model.EnumClass](docs/EnumClass.md) - [Model.EnumTest](docs/EnumTest.md) + - [Model.File](docs/File.md) + - [Model.FileSchemaTestClass](docs/FileSchemaTestClass.md) - [Model.FormatTest](docs/FormatTest.md) - [Model.HasOnlyReadOnly](docs/HasOnlyReadOnly.md) - [Model.List](docs/List.md) @@ -164,6 +168,7 @@ Class | Method | HTTP request | Description - [Model.ReadOnlyFirst](docs/ReadOnlyFirst.md) - [Model.Return](docs/Return.md) - [Model.SpecialModelName](docs/SpecialModelName.md) + - [Model.StringBooleanMap](docs/StringBooleanMap.md) - [Model.Tag](docs/Tag.md) - [Model.User](docs/User.md) diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/docs/AnotherFakeApi.md b/samples/client/petstore/csharp/OpenAPIClientNet35/docs/AnotherFakeApi.md index 2dca444f2768..81cc3106d64f 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/docs/AnotherFakeApi.md +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/docs/AnotherFakeApi.md @@ -4,16 +4,16 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**TestSpecialTags**](AnotherFakeApi.md#testspecialtags) | **PATCH** /another-fake/dummy | To test special tags +[**Call123TestSpecialTags**](AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags - -# **TestSpecialTags** -> ModelClient TestSpecialTags (ModelClient modelClient) + +# **Call123TestSpecialTags** +> ModelClient Call123TestSpecialTags (ModelClient modelClient) To test special tags -To test special tags +To test special tags and operation ID starting with number ### Example ```csharp @@ -25,7 +25,7 @@ using Org.OpenAPITools.Model; namespace Example { - public class TestSpecialTagsExample + public class Call123TestSpecialTagsExample { public void main() { @@ -35,12 +35,12 @@ namespace Example try { // To test special tags - ModelClient result = apiInstance.TestSpecialTags(modelClient); + ModelClient result = apiInstance.Call123TestSpecialTags(modelClient); Debug.WriteLine(result); } catch (Exception e) { - Debug.Print("Exception when calling AnotherFakeApi.TestSpecialTags: " + e.Message ); + Debug.Print("Exception when calling AnotherFakeApi.Call123TestSpecialTags: " + e.Message ); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/docs/FakeApi.md b/samples/client/petstore/csharp/OpenAPIClientNet35/docs/FakeApi.md index 2a4fb6094ae0..d51d29c09a6b 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/docs/FakeApi.md +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/docs/FakeApi.md @@ -8,6 +8,7 @@ Method | HTTP request | Description [**FakeOuterCompositeSerialize**](FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | [**FakeOuterNumberSerialize**](FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | [**FakeOuterStringSerialize**](FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | +[**TestBodyWithFileSchema**](FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | [**TestBodyWithQueryParams**](FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | [**TestClientModel**](FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model [**TestEndpointParameters**](FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -159,7 +160,7 @@ namespace Example public void main() { var apiInstance = new FakeApi(); - var body = 1.2; // decimal? | Input number as post body (optional) + var body = 1.2D; // decimal? | Input number as post body (optional) try { @@ -256,6 +257,65 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **TestBodyWithFileSchema** +> void TestBodyWithFileSchema (FileSchemaTestClass fileSchemaTestClass) + + + +For this test, the body for this request much reference a schema named `File`. + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestBodyWithFileSchemaExample + { + public void main() + { + var apiInstance = new FakeApi(); + var fileSchemaTestClass = new FileSchemaTestClass(); // FileSchemaTestClass | + + try + { + apiInstance.TestBodyWithFileSchema(fileSchemaTestClass); + } + catch (Exception e) + { + Debug.Print("Exception when calling FakeApi.TestBodyWithFileSchema: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **fileSchemaTestClass** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **TestBodyWithQueryParams** > void TestBodyWithQueryParams (string query, User user) @@ -404,13 +464,13 @@ namespace Example var apiInstance = new FakeApi(); var number = 8.14; // decimal? | None - var _double = 1.2; // double? | None + var _double = 1.2D; // double? | None var patternWithoutDelimiter = patternWithoutDelimiter_example; // string | None var _byte = BYTE_ARRAY_DATA_HERE; // byte[] | None var integer = 56; // int? | None (optional) var int32 = 56; // int? | None (optional) var int64 = 789; // long? | None (optional) - var _float = 3.4; // float? | None (optional) + var _float = 3.4F; // float? | None (optional) var _string = _string_example; // string | None (optional) var binary = BINARY_DATA_HERE; // System.IO.Stream | None (optional) var date = 2013-10-20; // DateTime? | None (optional) @@ -494,8 +554,8 @@ namespace Example var enumQueryStringArray = enumQueryStringArray_example; // List | Query parameter enum test (string array) (optional) var enumQueryString = enumQueryString_example; // string | Query parameter enum test (string) (optional) (default to -efg) var enumQueryInteger = 56; // int? | Query parameter enum test (double) (optional) - var enumQueryDouble = 1.2; // double? | Query parameter enum test (double) (optional) - var enumFormStringArray = enumFormStringArray_example; // List | Form parameter enum test (string array) (optional) (default to $) + var enumQueryDouble = 1.2D; // double? | Query parameter enum test (double) (optional) + var enumFormStringArray = new List(); // List | Form parameter enum test (string array) (optional) (default to $) var enumFormString = enumFormString_example; // string | Form parameter enum test (string) (optional) (default to -efg) try @@ -522,7 +582,7 @@ Name | Type | Description | Notes **enumQueryString** | **string**| Query parameter enum test (string) | [optional] [default to -efg] **enumQueryInteger** | **int?**| Query parameter enum test (double) | [optional] **enumQueryDouble** | **double?**| Query parameter enum test (double) | [optional] - **enumFormStringArray** | **List<string>**| Form parameter enum test (string array) | [optional] [default to $] + **enumFormStringArray** | [**List<string>**](string.md)| Form parameter enum test (string array) | [optional] [default to $] **enumFormString** | **string**| Form parameter enum test (string) | [optional] [default to -efg] ### Return type diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/docs/File.md b/samples/client/petstore/csharp/OpenAPIClientNet35/docs/File.md new file mode 100644 index 000000000000..acf85a4c001a --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/docs/File.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.File +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**SourceURI** | **string** | Test capitalization | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/docs/FileSchemaTestClass.md b/samples/client/petstore/csharp/OpenAPIClientNet35/docs/FileSchemaTestClass.md new file mode 100644 index 000000000000..e0820fa4e650 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/docs/FileSchemaTestClass.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.FileSchemaTestClass +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**File** | **System.IO.Stream** | | [optional] +**Files** | **List<System.IO.Stream>** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/docs/MapTest.md b/samples/client/petstore/csharp/OpenAPIClientNet35/docs/MapTest.md index 2baba08d8552..ee62dbf135fa 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/docs/MapTest.md +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/docs/MapTest.md @@ -5,6 +5,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **MapMapOfString** | **Dictionary<string, Dictionary<string, string>>** | | [optional] **MapOfEnumString** | **Dictionary<string, string>** | | [optional] +**DirectMap** | **Dictionary<string, bool?>** | | [optional] +**IndirectMap** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/docs/PetApi.md b/samples/client/petstore/csharp/OpenAPIClientNet35/docs/PetApi.md index 244ece53a318..dd23df9b3683 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/docs/PetApi.md +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/docs/PetApi.md @@ -12,6 +12,7 @@ Method | HTTP request | Description [**UpdatePet**](PetApi.md#updatepet) | **PUT** /pet | Update an existing pet [**UpdatePetWithForm**](PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data [**UploadFile**](PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image +[**UploadFileWithRequiredFile**](PetApi.md#uploadfilewithrequiredfile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) @@ -524,3 +525,69 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **UploadFileWithRequiredFile** +> ApiResponse UploadFileWithRequiredFile (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null) + +uploads an image (required) + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class UploadFileWithRequiredFileExample + { + public void main() + { + // Configure OAuth2 access token for authorization: petstore_auth + Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(); + var petId = 789; // long? | ID of pet to update + var requiredFile = BINARY_DATA_HERE; // System.IO.Stream | file to upload + var additionalMetadata = additionalMetadata_example; // string | Additional data to pass to server (optional) + + try + { + // uploads an image (required) + ApiResponse result = apiInstance.UploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling PetApi.UploadFileWithRequiredFile: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **long?**| ID of pet to update | + **requiredFile** | **System.IO.Stream**| file to upload | + **additionalMetadata** | **string**| Additional data to pass to server | [optional] + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/docs/StringBooleanMap.md b/samples/client/petstore/csharp/OpenAPIClientNet35/docs/StringBooleanMap.md new file mode 100644 index 000000000000..6e7a71368df7 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/docs/StringBooleanMap.md @@ -0,0 +1,8 @@ +# Org.OpenAPITools.Model.StringBooleanMap +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs new file mode 100644 index 000000000000..bb47c43dc7a1 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs @@ -0,0 +1,88 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test +{ + /// + /// Class for testing FileSchemaTestClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + [TestFixture] + public class FileSchemaTestClassTests + { + // TODO uncomment below to declare an instance variable for FileSchemaTestClass + //private FileSchemaTestClass instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + // TODO uncomment below to create an instance of FileSchemaTestClass + //instance = new FileSchemaTestClass(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of FileSchemaTestClass + /// + [Test] + public void FileSchemaTestClassInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" FileSchemaTestClass + //Assert.IsInstanceOfType (instance, "variable 'instance' is a FileSchemaTestClass"); + } + + + /// + /// Test the property 'File' + /// + [Test] + public void FileTest() + { + // TODO unit test for the property 'File' + } + /// + /// Test the property 'Files' + /// + [Test] + public void FilesTest() + { + // TODO unit test for the property 'Files' + } + + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools.Test/Model/FileTests.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools.Test/Model/FileTests.cs new file mode 100644 index 000000000000..f1cf54c22e4d --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools.Test/Model/FileTests.cs @@ -0,0 +1,80 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test +{ + /// + /// Class for testing File + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + [TestFixture] + public class FileTests + { + // TODO uncomment below to declare an instance variable for File + //private File instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + // TODO uncomment below to create an instance of File + //instance = new File(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of File + /// + [Test] + public void FileInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" File + //Assert.IsInstanceOfType (instance, "variable 'instance' is a File"); + } + + + /// + /// Test the property 'SourceURI' + /// + [Test] + public void SourceURITest() + { + // TODO unit test for the property 'SourceURI' + } + + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools.Test/Model/StringBooleanMapTests.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools.Test/Model/StringBooleanMapTests.cs new file mode 100644 index 000000000000..efc4cd907733 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools.Test/Model/StringBooleanMapTests.cs @@ -0,0 +1,72 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test +{ + /// + /// Class for testing StringBooleanMap + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + [TestFixture] + public class StringBooleanMapTests + { + // TODO uncomment below to declare an instance variable for StringBooleanMap + //private StringBooleanMap instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + // TODO uncomment below to create an instance of StringBooleanMap + //instance = new StringBooleanMap(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of StringBooleanMap + /// + [Test] + public void StringBooleanMapInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" StringBooleanMap + //Assert.IsInstanceOfType (instance, "variable 'instance' is a StringBooleanMap"); + } + + + + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/AnotherFakeApi.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/AnotherFakeApi.cs index be68c4ede50d..193c4907a1ed 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/AnotherFakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/AnotherFakeApi.cs @@ -28,23 +28,23 @@ public interface IAnotherFakeApi : IApiAccessor /// To test special tags /// /// - /// To test special tags + /// To test special tags and operation ID starting with number /// /// Thrown when fails to make API call /// client model /// ModelClient - ModelClient TestSpecialTags (ModelClient modelClient); + ModelClient Call123TestSpecialTags (ModelClient modelClient); /// /// To test special tags /// /// - /// To test special tags + /// To test special tags and operation ID starting with number /// /// Thrown when fails to make API call /// client model /// ApiResponse of ModelClient - ApiResponse TestSpecialTagsWithHttpInfo (ModelClient modelClient); + ApiResponse Call123TestSpecialTagsWithHttpInfo (ModelClient modelClient); #endregion Synchronous Operations } @@ -146,28 +146,28 @@ public void AddDefaultHeader(string key, string value) } /// - /// To test special tags To test special tags + /// To test special tags To test special tags and operation ID starting with number /// /// Thrown when fails to make API call /// client model /// ModelClient - public ModelClient TestSpecialTags (ModelClient modelClient) + public ModelClient Call123TestSpecialTags (ModelClient modelClient) { - ApiResponse localVarResponse = TestSpecialTagsWithHttpInfo(modelClient); + ApiResponse localVarResponse = Call123TestSpecialTagsWithHttpInfo(modelClient); return localVarResponse.Data; } /// - /// To test special tags To test special tags + /// To test special tags To test special tags and operation ID starting with number /// /// Thrown when fails to make API call /// client model /// ApiResponse of ModelClient - public ApiResponse< ModelClient > TestSpecialTagsWithHttpInfo (ModelClient modelClient) + public ApiResponse< ModelClient > Call123TestSpecialTagsWithHttpInfo (ModelClient modelClient) { // verify the required parameter 'modelClient' is set if (modelClient == null) - throw new ApiException(400, "Missing required parameter 'modelClient' when calling AnotherFakeApi->TestSpecialTags"); + throw new ApiException(400, "Missing required parameter 'modelClient' when calling AnotherFakeApi->Call123TestSpecialTags"); var localVarPath = "/another-fake/dummy"; var localVarPathParams = new Dictionary(); @@ -210,7 +210,7 @@ public ApiResponse< ModelClient > TestSpecialTagsWithHttpInfo (ModelClient model if (ExceptionFactory != null) { - Exception exception = ExceptionFactory("TestSpecialTags", localVarResponse); + Exception exception = ExceptionFactory("Call123TestSpecialTags", localVarResponse); if (exception != null) throw exception; } diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/FakeApi.cs index c9d0b50be14c..20430b4bbdb7 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/FakeApi.cs @@ -112,6 +112,27 @@ public interface IFakeApi : IApiAccessor /// /// /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// + void TestBodyWithFileSchema (FileSchemaTestClass fileSchemaTestClass); + + /// + /// + /// + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of Object(void) + ApiResponse TestBodyWithFileSchemaWithHttpInfo (FileSchemaTestClass fileSchemaTestClass); + /// + /// + /// + /// /// /// /// Thrown when fails to make API call @@ -658,6 +679,78 @@ public ApiResponse< string > FakeOuterStringSerializeWithHttpInfo (string body = (string) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(string))); } + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// + public void TestBodyWithFileSchema (FileSchemaTestClass fileSchemaTestClass) + { + TestBodyWithFileSchemaWithHttpInfo(fileSchemaTestClass); + } + + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of Object(void) + public ApiResponse TestBodyWithFileSchemaWithHttpInfo (FileSchemaTestClass fileSchemaTestClass) + { + // verify the required parameter 'fileSchemaTestClass' is set + if (fileSchemaTestClass == null) + throw new ApiException(400, "Missing required parameter 'fileSchemaTestClass' when calling FakeApi->TestBodyWithFileSchema"); + + var localVarPath = "/fake/body-with-file-schema"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + "application/json" + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (fileSchemaTestClass != null && fileSchemaTestClass.GetType() != typeof(byte[])) + { + localVarPostBody = this.Configuration.ApiClient.Serialize(fileSchemaTestClass); // http body (model) parameter + } + else + { + localVarPostBody = fileSchemaTestClass; // byte array + } + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath, + Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("TestBodyWithFileSchema", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + null); + } + /// /// /// diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/PetApi.cs index c6db8f4b909f..6ec963b56ee7 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/PetApi.cs @@ -202,6 +202,31 @@ public interface IPetApi : IApiAccessor /// file to upload (optional) /// ApiResponse of ApiResponse ApiResponse UploadFileWithHttpInfo (long? petId, string additionalMetadata = null, System.IO.Stream file = null); + /// + /// uploads an image (required) + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// ApiResponse + ApiResponse UploadFileWithRequiredFile (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null); + + /// + /// uploads an image (required) + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// ApiResponse of ApiResponse + ApiResponse UploadFileWithRequiredFileWithHttpInfo (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null); #endregion Synchronous Operations } @@ -907,5 +932,87 @@ public ApiResponse< ApiResponse > UploadFileWithHttpInfo (long? petId, string ad (ApiResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(ApiResponse))); } + /// + /// uploads an image (required) + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// ApiResponse + public ApiResponse UploadFileWithRequiredFile (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null) + { + ApiResponse localVarResponse = UploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata); + return localVarResponse.Data; + } + + /// + /// uploads an image (required) + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// ApiResponse of ApiResponse + public ApiResponse< ApiResponse > UploadFileWithRequiredFileWithHttpInfo (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null) + { + // verify the required parameter 'petId' is set + if (petId == null) + throw new ApiException(400, "Missing required parameter 'petId' when calling PetApi->UploadFileWithRequiredFile"); + // verify the required parameter 'requiredFile' is set + if (requiredFile == null) + throw new ApiException(400, "Missing required parameter 'requiredFile' when calling PetApi->UploadFileWithRequiredFile"); + + var localVarPath = "/fake/{petId}/uploadImageWithRequiredFile"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + "multipart/form-data" + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/json" + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (petId != null) localVarPathParams.Add("petId", this.Configuration.ApiClient.ParameterToString(petId)); // path parameter + if (additionalMetadata != null) localVarFormParams.Add("additionalMetadata", this.Configuration.ApiClient.ParameterToString(additionalMetadata)); // form parameter + if (requiredFile != null) localVarFileParams.Add("requiredFile", this.Configuration.ApiClient.ParameterToFile("requiredFile", requiredFile)); + + // authentication (petstore_auth) required + // oauth required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath, + Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("UploadFileWithRequiredFile", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + (ApiResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(ApiResponse))); + } + } } diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/EnumArrays.cs index 77490c7b1203..b8b86f0038a5 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -36,18 +36,18 @@ public partial class EnumArrays : IEquatable [JsonConverter(typeof(StringEnumConverter))] public enum JustSymbolEnum { - /// /// Enum GreaterThanOrEqualTo for value: >= /// [EnumMember(Value = ">=")] GreaterThanOrEqualTo = 1, - + /// /// Enum Dollar for value: $ /// [EnumMember(Value = "$")] Dollar = 2 + } /// @@ -61,18 +61,18 @@ public enum JustSymbolEnum [JsonConverter(typeof(StringEnumConverter))] public enum ArrayEnumEnum { - /// /// Enum Fish for value: fish /// [EnumMember(Value = "fish")] Fish = 1, - + /// /// Enum Crab for value: crab /// [EnumMember(Value = "crab")] Crab = 2 + } diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/EnumClass.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/EnumClass.cs index 3da1bee1360c..33643e475f51 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/EnumClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/EnumClass.cs @@ -32,24 +32,24 @@ namespace Org.OpenAPITools.Model public enum EnumClass { - /// /// Enum Abc for value: _abc /// [EnumMember(Value = "_abc")] Abc = 1, - + /// /// Enum Efg for value: -efg /// [EnumMember(Value = "-efg")] Efg = 2, - + /// /// Enum Xyz for value: (xyz) /// [EnumMember(Value = "(xyz)")] Xyz = 3 + } } diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/EnumTest.cs index f887f56d9c6e..0329f3f29f84 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/EnumTest.cs @@ -36,24 +36,24 @@ public partial class EnumTest : IEquatable [JsonConverter(typeof(StringEnumConverter))] public enum EnumStringEnum { - /// /// Enum UPPER for value: UPPER /// [EnumMember(Value = "UPPER")] UPPER = 1, - + /// /// Enum Lower for value: lower /// [EnumMember(Value = "lower")] Lower = 2, - + /// /// Enum Empty for value: /// [EnumMember(Value = "")] Empty = 3 + } /// @@ -67,24 +67,24 @@ public enum EnumStringEnum [JsonConverter(typeof(StringEnumConverter))] public enum EnumStringRequiredEnum { - /// /// Enum UPPER for value: UPPER /// [EnumMember(Value = "UPPER")] UPPER = 1, - + /// /// Enum Lower for value: lower /// [EnumMember(Value = "lower")] Lower = 2, - + /// /// Enum Empty for value: /// [EnumMember(Value = "")] Empty = 3 + } /// @@ -97,18 +97,16 @@ public enum EnumStringRequiredEnum /// public enum EnumIntegerEnum { - /// /// Enum NUMBER_1 for value: 1 /// - NUMBER_1 = 1, - + /// /// Enum NUMBER_MINUS_1 for value: -1 /// - NUMBER_MINUS_1 = -1 + } /// @@ -122,18 +120,18 @@ public enum EnumIntegerEnum [JsonConverter(typeof(StringEnumConverter))] public enum EnumNumberEnum { - /// /// Enum NUMBER_1_DOT_1 for value: 1.1 /// [EnumMember(Value = "1.1")] NUMBER_1_DOT_1 = 1, - + /// /// Enum NUMBER_MINUS_1_DOT_2 for value: -1.2 /// [EnumMember(Value = "-1.2")] NUMBER_MINUS_1_DOT_2 = 2 + } /// diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/File.cs new file mode 100644 index 000000000000..22367be1c22f --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/File.cs @@ -0,0 +1,116 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// Must be named `File` for test. + /// + [DataContract] + public partial class File : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + /// Test capitalization. + public File(string sourceURI = default(string)) + { + this.SourceURI = sourceURI; + } + + /// + /// Test capitalization + /// + /// Test capitalization + [DataMember(Name="sourceURI", EmitDefaultValue=false)] + public string SourceURI { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class File {\n"); + sb.Append(" SourceURI: ").Append(SourceURI).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as File); + } + + /// + /// Returns true if File instances are equal + /// + /// Instance of File to be compared + /// Boolean + public bool Equals(File input) + { + if (input == null) + return false; + + return + ( + this.SourceURI == input.SourceURI || + (this.SourceURI != null && + this.SourceURI.Equals(input.SourceURI)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.SourceURI != null) + hashCode = hashCode * 59 + this.SourceURI.GetHashCode(); + return hashCode; + } + } + + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs new file mode 100644 index 000000000000..4e3d772816f5 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -0,0 +1,131 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// FileSchemaTestClass + /// + [DataContract] + public partial class FileSchemaTestClass : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + /// file. + /// files. + public FileSchemaTestClass(System.IO.Stream file = default(System.IO.Stream), List files = default(List)) + { + this.File = file; + this.Files = files; + } + + /// + /// Gets or Sets File + /// + [DataMember(Name="file", EmitDefaultValue=false)] + public System.IO.Stream File { get; set; } + + /// + /// Gets or Sets Files + /// + [DataMember(Name="files", EmitDefaultValue=false)] + public List Files { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class FileSchemaTestClass {\n"); + sb.Append(" File: ").Append(File).Append("\n"); + sb.Append(" Files: ").Append(Files).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as FileSchemaTestClass); + } + + /// + /// Returns true if FileSchemaTestClass instances are equal + /// + /// Instance of FileSchemaTestClass to be compared + /// Boolean + public bool Equals(FileSchemaTestClass input) + { + if (input == null) + return false; + + return + ( + this.File == input.File || + (this.File != null && + this.File.Equals(input.File)) + ) && + ( + this.Files == input.Files || + this.Files != null && + this.Files.SequenceEqual(input.Files) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.File != null) + hashCode = hashCode * 59 + this.File.GetHashCode(); + if (this.Files != null) + hashCode = hashCode * 59 + this.Files.GetHashCode(); + return hashCode; + } + } + + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/MapTest.cs index 9f3836c7e22d..b9ad7659bcb2 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/MapTest.cs @@ -36,18 +36,18 @@ public partial class MapTest : IEquatable [JsonConverter(typeof(StringEnumConverter))] public enum InnerEnum { - /// /// Enum UPPER for value: UPPER /// [EnumMember(Value = "UPPER")] UPPER = 1, - + /// /// Enum Lower for value: lower /// [EnumMember(Value = "lower")] Lower = 2 + } @@ -61,10 +61,14 @@ public enum InnerEnum /// /// mapMapOfString. /// mapOfEnumString. - public MapTest(Dictionary> mapMapOfString = default(Dictionary>), Dictionary mapOfEnumString = default(Dictionary)) + /// directMap. + /// indirectMap. + public MapTest(Dictionary> mapMapOfString = default(Dictionary>), Dictionary mapOfEnumString = default(Dictionary), Dictionary directMap = default(Dictionary), StringBooleanMap indirectMap = default(StringBooleanMap)) { this.MapMapOfString = mapMapOfString; this.MapOfEnumString = mapOfEnumString; + this.DirectMap = directMap; + this.IndirectMap = indirectMap; } /// @@ -74,6 +78,18 @@ public enum InnerEnum public Dictionary> MapMapOfString { get; set; } + /// + /// Gets or Sets DirectMap + /// + [DataMember(Name="direct_map", EmitDefaultValue=false)] + public Dictionary DirectMap { get; set; } + + /// + /// Gets or Sets IndirectMap + /// + [DataMember(Name="indirect_map", EmitDefaultValue=false)] + public StringBooleanMap IndirectMap { get; set; } + /// /// Returns the string presentation of the object /// @@ -84,6 +100,8 @@ public override string ToString() sb.Append("class MapTest {\n"); sb.Append(" MapMapOfString: ").Append(MapMapOfString).Append("\n"); sb.Append(" MapOfEnumString: ").Append(MapOfEnumString).Append("\n"); + sb.Append(" DirectMap: ").Append(DirectMap).Append("\n"); + sb.Append(" IndirectMap: ").Append(IndirectMap).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -127,6 +145,16 @@ public bool Equals(MapTest input) this.MapOfEnumString == input.MapOfEnumString || this.MapOfEnumString != null && this.MapOfEnumString.SequenceEqual(input.MapOfEnumString) + ) && + ( + this.DirectMap == input.DirectMap || + this.DirectMap != null && + this.DirectMap.SequenceEqual(input.DirectMap) + ) && + ( + this.IndirectMap == input.IndirectMap || + (this.IndirectMap != null && + this.IndirectMap.Equals(input.IndirectMap)) ); } @@ -143,6 +171,10 @@ public override int GetHashCode() hashCode = hashCode * 59 + this.MapMapOfString.GetHashCode(); if (this.MapOfEnumString != null) hashCode = hashCode * 59 + this.MapOfEnumString.GetHashCode(); + if (this.DirectMap != null) + hashCode = hashCode * 59 + this.DirectMap.GetHashCode(); + if (this.IndirectMap != null) + hashCode = hashCode * 59 + this.IndirectMap.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/Order.cs index 7e0a4287576c..80bab785b7ea 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/Order.cs @@ -37,24 +37,24 @@ public partial class Order : IEquatable [JsonConverter(typeof(StringEnumConverter))] public enum StatusEnum { - /// /// Enum Placed for value: placed /// [EnumMember(Value = "placed")] Placed = 1, - + /// /// Enum Approved for value: approved /// [EnumMember(Value = "approved")] Approved = 2, - + /// /// Enum Delivered for value: delivered /// [EnumMember(Value = "delivered")] Delivered = 3 + } /// diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/OuterEnum.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/OuterEnum.cs index 2716692ee0ec..be116aff60ab 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/OuterEnum.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/OuterEnum.cs @@ -32,24 +32,24 @@ namespace Org.OpenAPITools.Model public enum OuterEnum { - /// /// Enum Placed for value: placed /// [EnumMember(Value = "placed")] Placed = 1, - + /// /// Enum Approved for value: approved /// [EnumMember(Value = "approved")] Approved = 2, - + /// /// Enum Delivered for value: delivered /// [EnumMember(Value = "delivered")] Delivered = 3 + } } diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/Pet.cs index c496a100aec9..ade35d0936ef 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/Pet.cs @@ -37,24 +37,24 @@ public partial class Pet : IEquatable [JsonConverter(typeof(StringEnumConverter))] public enum StatusEnum { - /// /// Enum Available for value: available /// [EnumMember(Value = "available")] Available = 1, - + /// /// Enum Pending for value: pending /// [EnumMember(Value = "pending")] Pending = 2, - + /// /// Enum Sold for value: sold /// [EnumMember(Value = "sold")] Sold = 3 + } /// diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/StringBooleanMap.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/StringBooleanMap.cs new file mode 100644 index 000000000000..75ce6dca9391 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/StringBooleanMap.cs @@ -0,0 +1,101 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// StringBooleanMap + /// + [DataContract] + public partial class StringBooleanMap : Dictionary, IEquatable + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + public StringBooleanMap() : base() + { + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class StringBooleanMap {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as StringBooleanMap); + } + + /// + /// Returns true if StringBooleanMap instances are equal + /// + /// Instance of StringBooleanMap to be compared + /// Boolean + public bool Equals(StringBooleanMap input) + { + if (input == null) + return false; + + return base.Equals(input); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = base.GetHashCode(); + return hashCode; + } + } + + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/.openapi-generator/VERSION b/samples/client/petstore/csharp/OpenAPIClientNet40/.openapi-generator/VERSION index 096bf47efe31..6d94c9c2e12a 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/.openapi-generator/VERSION +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/.openapi-generator/VERSION @@ -1 +1 @@ -3.0.0-SNAPSHOT \ No newline at end of file +3.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/README.md b/samples/client/petstore/csharp/OpenAPIClientNet40/README.md index 441abc408817..a2b8a9b17a0f 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/README.md +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/README.md @@ -76,12 +76,12 @@ namespace Example try { // To test special tags - ModelClient result = apiInstance.TestSpecialTags(modelClient); + ModelClient result = apiInstance.Call123TestSpecialTags(modelClient); Debug.WriteLine(result); } catch (Exception e) { - Debug.Print("Exception when calling AnotherFakeApi.TestSpecialTags: " + e.Message ); + Debug.Print("Exception when calling AnotherFakeApi.Call123TestSpecialTags: " + e.Message ); } } @@ -96,11 +96,12 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- -*AnotherFakeApi* | [**TestSpecialTags**](docs/AnotherFakeApi.md#testspecialtags) | **PATCH** /another-fake/dummy | To test special tags +*AnotherFakeApi* | [**Call123TestSpecialTags**](docs/AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags *FakeApi* | [**FakeOuterBooleanSerialize**](docs/FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean | *FakeApi* | [**FakeOuterCompositeSerialize**](docs/FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | *FakeApi* | [**FakeOuterNumberSerialize**](docs/FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | *FakeApi* | [**FakeOuterStringSerialize**](docs/FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | +*FakeApi* | [**TestBodyWithFileSchema**](docs/FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | *FakeApi* | [**TestBodyWithQueryParams**](docs/FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | *FakeApi* | [**TestClientModel**](docs/FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model *FakeApi* | [**TestEndpointParameters**](docs/FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -116,6 +117,7 @@ Class | Method | HTTP request | Description *PetApi* | [**UpdatePet**](docs/PetApi.md#updatepet) | **PUT** /pet | Update an existing pet *PetApi* | [**UpdatePetWithForm**](docs/PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetApi* | [**UploadFile**](docs/PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image +*PetApi* | [**UploadFileWithRequiredFile**](docs/PetApi.md#uploadfilewithrequiredfile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) *StoreApi* | [**DeleteOrder**](docs/StoreApi.md#deleteorder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID *StoreApi* | [**GetInventory**](docs/StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status *StoreApi* | [**GetOrderById**](docs/StoreApi.md#getorderbyid) | **GET** /store/order/{order_id} | Find purchase order by ID @@ -148,6 +150,8 @@ Class | Method | HTTP request | Description - [Model.EnumArrays](docs/EnumArrays.md) - [Model.EnumClass](docs/EnumClass.md) - [Model.EnumTest](docs/EnumTest.md) + - [Model.File](docs/File.md) + - [Model.FileSchemaTestClass](docs/FileSchemaTestClass.md) - [Model.FormatTest](docs/FormatTest.md) - [Model.HasOnlyReadOnly](docs/HasOnlyReadOnly.md) - [Model.List](docs/List.md) @@ -164,6 +168,7 @@ Class | Method | HTTP request | Description - [Model.ReadOnlyFirst](docs/ReadOnlyFirst.md) - [Model.Return](docs/Return.md) - [Model.SpecialModelName](docs/SpecialModelName.md) + - [Model.StringBooleanMap](docs/StringBooleanMap.md) - [Model.Tag](docs/Tag.md) - [Model.User](docs/User.md) diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/docs/AnotherFakeApi.md b/samples/client/petstore/csharp/OpenAPIClientNet40/docs/AnotherFakeApi.md index 2dca444f2768..81cc3106d64f 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/docs/AnotherFakeApi.md +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/docs/AnotherFakeApi.md @@ -4,16 +4,16 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**TestSpecialTags**](AnotherFakeApi.md#testspecialtags) | **PATCH** /another-fake/dummy | To test special tags +[**Call123TestSpecialTags**](AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags - -# **TestSpecialTags** -> ModelClient TestSpecialTags (ModelClient modelClient) + +# **Call123TestSpecialTags** +> ModelClient Call123TestSpecialTags (ModelClient modelClient) To test special tags -To test special tags +To test special tags and operation ID starting with number ### Example ```csharp @@ -25,7 +25,7 @@ using Org.OpenAPITools.Model; namespace Example { - public class TestSpecialTagsExample + public class Call123TestSpecialTagsExample { public void main() { @@ -35,12 +35,12 @@ namespace Example try { // To test special tags - ModelClient result = apiInstance.TestSpecialTags(modelClient); + ModelClient result = apiInstance.Call123TestSpecialTags(modelClient); Debug.WriteLine(result); } catch (Exception e) { - Debug.Print("Exception when calling AnotherFakeApi.TestSpecialTags: " + e.Message ); + Debug.Print("Exception when calling AnotherFakeApi.Call123TestSpecialTags: " + e.Message ); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/docs/FakeApi.md b/samples/client/petstore/csharp/OpenAPIClientNet40/docs/FakeApi.md index 2a4fb6094ae0..d51d29c09a6b 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/docs/FakeApi.md +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/docs/FakeApi.md @@ -8,6 +8,7 @@ Method | HTTP request | Description [**FakeOuterCompositeSerialize**](FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | [**FakeOuterNumberSerialize**](FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | [**FakeOuterStringSerialize**](FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | +[**TestBodyWithFileSchema**](FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | [**TestBodyWithQueryParams**](FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | [**TestClientModel**](FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model [**TestEndpointParameters**](FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -159,7 +160,7 @@ namespace Example public void main() { var apiInstance = new FakeApi(); - var body = 1.2; // decimal? | Input number as post body (optional) + var body = 1.2D; // decimal? | Input number as post body (optional) try { @@ -256,6 +257,65 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **TestBodyWithFileSchema** +> void TestBodyWithFileSchema (FileSchemaTestClass fileSchemaTestClass) + + + +For this test, the body for this request much reference a schema named `File`. + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestBodyWithFileSchemaExample + { + public void main() + { + var apiInstance = new FakeApi(); + var fileSchemaTestClass = new FileSchemaTestClass(); // FileSchemaTestClass | + + try + { + apiInstance.TestBodyWithFileSchema(fileSchemaTestClass); + } + catch (Exception e) + { + Debug.Print("Exception when calling FakeApi.TestBodyWithFileSchema: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **fileSchemaTestClass** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **TestBodyWithQueryParams** > void TestBodyWithQueryParams (string query, User user) @@ -404,13 +464,13 @@ namespace Example var apiInstance = new FakeApi(); var number = 8.14; // decimal? | None - var _double = 1.2; // double? | None + var _double = 1.2D; // double? | None var patternWithoutDelimiter = patternWithoutDelimiter_example; // string | None var _byte = BYTE_ARRAY_DATA_HERE; // byte[] | None var integer = 56; // int? | None (optional) var int32 = 56; // int? | None (optional) var int64 = 789; // long? | None (optional) - var _float = 3.4; // float? | None (optional) + var _float = 3.4F; // float? | None (optional) var _string = _string_example; // string | None (optional) var binary = BINARY_DATA_HERE; // System.IO.Stream | None (optional) var date = 2013-10-20; // DateTime? | None (optional) @@ -494,8 +554,8 @@ namespace Example var enumQueryStringArray = enumQueryStringArray_example; // List | Query parameter enum test (string array) (optional) var enumQueryString = enumQueryString_example; // string | Query parameter enum test (string) (optional) (default to -efg) var enumQueryInteger = 56; // int? | Query parameter enum test (double) (optional) - var enumQueryDouble = 1.2; // double? | Query parameter enum test (double) (optional) - var enumFormStringArray = enumFormStringArray_example; // List | Form parameter enum test (string array) (optional) (default to $) + var enumQueryDouble = 1.2D; // double? | Query parameter enum test (double) (optional) + var enumFormStringArray = new List(); // List | Form parameter enum test (string array) (optional) (default to $) var enumFormString = enumFormString_example; // string | Form parameter enum test (string) (optional) (default to -efg) try @@ -522,7 +582,7 @@ Name | Type | Description | Notes **enumQueryString** | **string**| Query parameter enum test (string) | [optional] [default to -efg] **enumQueryInteger** | **int?**| Query parameter enum test (double) | [optional] **enumQueryDouble** | **double?**| Query parameter enum test (double) | [optional] - **enumFormStringArray** | **List<string>**| Form parameter enum test (string array) | [optional] [default to $] + **enumFormStringArray** | [**List<string>**](string.md)| Form parameter enum test (string array) | [optional] [default to $] **enumFormString** | **string**| Form parameter enum test (string) | [optional] [default to -efg] ### Return type diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/docs/File.md b/samples/client/petstore/csharp/OpenAPIClientNet40/docs/File.md new file mode 100644 index 000000000000..acf85a4c001a --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/docs/File.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.File +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**SourceURI** | **string** | Test capitalization | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/docs/FileSchemaTestClass.md b/samples/client/petstore/csharp/OpenAPIClientNet40/docs/FileSchemaTestClass.md new file mode 100644 index 000000000000..e0820fa4e650 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/docs/FileSchemaTestClass.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.FileSchemaTestClass +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**File** | **System.IO.Stream** | | [optional] +**Files** | **List<System.IO.Stream>** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/docs/MapTest.md b/samples/client/petstore/csharp/OpenAPIClientNet40/docs/MapTest.md index 2baba08d8552..ee62dbf135fa 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/docs/MapTest.md +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/docs/MapTest.md @@ -5,6 +5,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **MapMapOfString** | **Dictionary<string, Dictionary<string, string>>** | | [optional] **MapOfEnumString** | **Dictionary<string, string>** | | [optional] +**DirectMap** | **Dictionary<string, bool?>** | | [optional] +**IndirectMap** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/docs/PetApi.md b/samples/client/petstore/csharp/OpenAPIClientNet40/docs/PetApi.md index 244ece53a318..dd23df9b3683 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/docs/PetApi.md +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/docs/PetApi.md @@ -12,6 +12,7 @@ Method | HTTP request | Description [**UpdatePet**](PetApi.md#updatepet) | **PUT** /pet | Update an existing pet [**UpdatePetWithForm**](PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data [**UploadFile**](PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image +[**UploadFileWithRequiredFile**](PetApi.md#uploadfilewithrequiredfile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) @@ -524,3 +525,69 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **UploadFileWithRequiredFile** +> ApiResponse UploadFileWithRequiredFile (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null) + +uploads an image (required) + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class UploadFileWithRequiredFileExample + { + public void main() + { + // Configure OAuth2 access token for authorization: petstore_auth + Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(); + var petId = 789; // long? | ID of pet to update + var requiredFile = BINARY_DATA_HERE; // System.IO.Stream | file to upload + var additionalMetadata = additionalMetadata_example; // string | Additional data to pass to server (optional) + + try + { + // uploads an image (required) + ApiResponse result = apiInstance.UploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling PetApi.UploadFileWithRequiredFile: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **long?**| ID of pet to update | + **requiredFile** | **System.IO.Stream**| file to upload | + **additionalMetadata** | **string**| Additional data to pass to server | [optional] + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/docs/StringBooleanMap.md b/samples/client/petstore/csharp/OpenAPIClientNet40/docs/StringBooleanMap.md new file mode 100644 index 000000000000..6e7a71368df7 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/docs/StringBooleanMap.md @@ -0,0 +1,8 @@ +# Org.OpenAPITools.Model.StringBooleanMap +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs new file mode 100644 index 000000000000..bb47c43dc7a1 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs @@ -0,0 +1,88 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test +{ + /// + /// Class for testing FileSchemaTestClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + [TestFixture] + public class FileSchemaTestClassTests + { + // TODO uncomment below to declare an instance variable for FileSchemaTestClass + //private FileSchemaTestClass instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + // TODO uncomment below to create an instance of FileSchemaTestClass + //instance = new FileSchemaTestClass(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of FileSchemaTestClass + /// + [Test] + public void FileSchemaTestClassInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" FileSchemaTestClass + //Assert.IsInstanceOfType (instance, "variable 'instance' is a FileSchemaTestClass"); + } + + + /// + /// Test the property 'File' + /// + [Test] + public void FileTest() + { + // TODO unit test for the property 'File' + } + /// + /// Test the property 'Files' + /// + [Test] + public void FilesTest() + { + // TODO unit test for the property 'Files' + } + + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools.Test/Model/FileTests.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools.Test/Model/FileTests.cs new file mode 100644 index 000000000000..f1cf54c22e4d --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools.Test/Model/FileTests.cs @@ -0,0 +1,80 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test +{ + /// + /// Class for testing File + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + [TestFixture] + public class FileTests + { + // TODO uncomment below to declare an instance variable for File + //private File instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + // TODO uncomment below to create an instance of File + //instance = new File(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of File + /// + [Test] + public void FileInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" File + //Assert.IsInstanceOfType (instance, "variable 'instance' is a File"); + } + + + /// + /// Test the property 'SourceURI' + /// + [Test] + public void SourceURITest() + { + // TODO unit test for the property 'SourceURI' + } + + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools.Test/Model/StringBooleanMapTests.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools.Test/Model/StringBooleanMapTests.cs new file mode 100644 index 000000000000..efc4cd907733 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools.Test/Model/StringBooleanMapTests.cs @@ -0,0 +1,72 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test +{ + /// + /// Class for testing StringBooleanMap + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + [TestFixture] + public class StringBooleanMapTests + { + // TODO uncomment below to declare an instance variable for StringBooleanMap + //private StringBooleanMap instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + // TODO uncomment below to create an instance of StringBooleanMap + //instance = new StringBooleanMap(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of StringBooleanMap + /// + [Test] + public void StringBooleanMapInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" StringBooleanMap + //Assert.IsInstanceOfType (instance, "variable 'instance' is a StringBooleanMap"); + } + + + + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/AnotherFakeApi.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/AnotherFakeApi.cs index 5e074d5ee584..71bcd84a663b 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/AnotherFakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/AnotherFakeApi.cs @@ -28,23 +28,23 @@ public interface IAnotherFakeApi : IApiAccessor /// To test special tags /// /// - /// To test special tags + /// To test special tags and operation ID starting with number /// /// Thrown when fails to make API call /// client model /// ModelClient - ModelClient TestSpecialTags (ModelClient modelClient); + ModelClient Call123TestSpecialTags (ModelClient modelClient); /// /// To test special tags /// /// - /// To test special tags + /// To test special tags and operation ID starting with number /// /// Thrown when fails to make API call /// client model /// ApiResponse of ModelClient - ApiResponse TestSpecialTagsWithHttpInfo (ModelClient modelClient); + ApiResponse Call123TestSpecialTagsWithHttpInfo (ModelClient modelClient); #endregion Synchronous Operations } @@ -146,28 +146,28 @@ public void AddDefaultHeader(string key, string value) } /// - /// To test special tags To test special tags + /// To test special tags To test special tags and operation ID starting with number /// /// Thrown when fails to make API call /// client model /// ModelClient - public ModelClient TestSpecialTags (ModelClient modelClient) + public ModelClient Call123TestSpecialTags (ModelClient modelClient) { - ApiResponse localVarResponse = TestSpecialTagsWithHttpInfo(modelClient); + ApiResponse localVarResponse = Call123TestSpecialTagsWithHttpInfo(modelClient); return localVarResponse.Data; } /// - /// To test special tags To test special tags + /// To test special tags To test special tags and operation ID starting with number /// /// Thrown when fails to make API call /// client model /// ApiResponse of ModelClient - public ApiResponse< ModelClient > TestSpecialTagsWithHttpInfo (ModelClient modelClient) + public ApiResponse< ModelClient > Call123TestSpecialTagsWithHttpInfo (ModelClient modelClient) { // verify the required parameter 'modelClient' is set if (modelClient == null) - throw new ApiException(400, "Missing required parameter 'modelClient' when calling AnotherFakeApi->TestSpecialTags"); + throw new ApiException(400, "Missing required parameter 'modelClient' when calling AnotherFakeApi->Call123TestSpecialTags"); var localVarPath = "/another-fake/dummy"; var localVarPathParams = new Dictionary(); @@ -210,7 +210,7 @@ public ApiResponse< ModelClient > TestSpecialTagsWithHttpInfo (ModelClient model if (ExceptionFactory != null) { - Exception exception = ExceptionFactory("TestSpecialTags", localVarResponse); + Exception exception = ExceptionFactory("Call123TestSpecialTags", localVarResponse); if (exception != null) throw exception; } diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/FakeApi.cs index ef93f6dbcdcb..c2f338c3bb7e 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/FakeApi.cs @@ -112,6 +112,27 @@ public interface IFakeApi : IApiAccessor /// /// /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// + void TestBodyWithFileSchema (FileSchemaTestClass fileSchemaTestClass); + + /// + /// + /// + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of Object(void) + ApiResponse TestBodyWithFileSchemaWithHttpInfo (FileSchemaTestClass fileSchemaTestClass); + /// + /// + /// + /// /// /// /// Thrown when fails to make API call @@ -658,6 +679,78 @@ public ApiResponse< string > FakeOuterStringSerializeWithHttpInfo (string body = (string) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(string))); } + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// + public void TestBodyWithFileSchema (FileSchemaTestClass fileSchemaTestClass) + { + TestBodyWithFileSchemaWithHttpInfo(fileSchemaTestClass); + } + + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of Object(void) + public ApiResponse TestBodyWithFileSchemaWithHttpInfo (FileSchemaTestClass fileSchemaTestClass) + { + // verify the required parameter 'fileSchemaTestClass' is set + if (fileSchemaTestClass == null) + throw new ApiException(400, "Missing required parameter 'fileSchemaTestClass' when calling FakeApi->TestBodyWithFileSchema"); + + var localVarPath = "/fake/body-with-file-schema"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + "application/json" + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (fileSchemaTestClass != null && fileSchemaTestClass.GetType() != typeof(byte[])) + { + localVarPostBody = this.Configuration.ApiClient.Serialize(fileSchemaTestClass); // http body (model) parameter + } + else + { + localVarPostBody = fileSchemaTestClass; // byte array + } + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath, + Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("TestBodyWithFileSchema", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + null); + } + /// /// /// diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/PetApi.cs index c7aa7e2f6554..ca532940cf0b 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/PetApi.cs @@ -202,6 +202,31 @@ public interface IPetApi : IApiAccessor /// file to upload (optional) /// ApiResponse of ApiResponse ApiResponse UploadFileWithHttpInfo (long? petId, string additionalMetadata = null, System.IO.Stream file = null); + /// + /// uploads an image (required) + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// ApiResponse + ApiResponse UploadFileWithRequiredFile (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null); + + /// + /// uploads an image (required) + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// ApiResponse of ApiResponse + ApiResponse UploadFileWithRequiredFileWithHttpInfo (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null); #endregion Synchronous Operations } @@ -907,5 +932,87 @@ public ApiResponse< ApiResponse > UploadFileWithHttpInfo (long? petId, string ad (ApiResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(ApiResponse))); } + /// + /// uploads an image (required) + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// ApiResponse + public ApiResponse UploadFileWithRequiredFile (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null) + { + ApiResponse localVarResponse = UploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata); + return localVarResponse.Data; + } + + /// + /// uploads an image (required) + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// ApiResponse of ApiResponse + public ApiResponse< ApiResponse > UploadFileWithRequiredFileWithHttpInfo (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null) + { + // verify the required parameter 'petId' is set + if (petId == null) + throw new ApiException(400, "Missing required parameter 'petId' when calling PetApi->UploadFileWithRequiredFile"); + // verify the required parameter 'requiredFile' is set + if (requiredFile == null) + throw new ApiException(400, "Missing required parameter 'requiredFile' when calling PetApi->UploadFileWithRequiredFile"); + + var localVarPath = "/fake/{petId}/uploadImageWithRequiredFile"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + "multipart/form-data" + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/json" + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (petId != null) localVarPathParams.Add("petId", this.Configuration.ApiClient.ParameterToString(petId)); // path parameter + if (additionalMetadata != null) localVarFormParams.Add("additionalMetadata", this.Configuration.ApiClient.ParameterToString(additionalMetadata)); // form parameter + if (requiredFile != null) localVarFileParams.Add("requiredFile", this.Configuration.ApiClient.ParameterToFile("requiredFile", requiredFile)); + + // authentication (petstore_auth) required + // oauth required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath, + Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("UploadFileWithRequiredFile", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + (ApiResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(ApiResponse))); + } + } } diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/EnumArrays.cs index ba25e7775635..567a207068c2 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -36,18 +36,18 @@ public partial class EnumArrays : IEquatable, IValidatableObject [JsonConverter(typeof(StringEnumConverter))] public enum JustSymbolEnum { - /// /// Enum GreaterThanOrEqualTo for value: >= /// [EnumMember(Value = ">=")] GreaterThanOrEqualTo = 1, - + /// /// Enum Dollar for value: $ /// [EnumMember(Value = "$")] Dollar = 2 + } /// @@ -61,18 +61,18 @@ public enum JustSymbolEnum [JsonConverter(typeof(StringEnumConverter))] public enum ArrayEnumEnum { - /// /// Enum Fish for value: fish /// [EnumMember(Value = "fish")] Fish = 1, - + /// /// Enum Crab for value: crab /// [EnumMember(Value = "crab")] Crab = 2 + } diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/EnumClass.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/EnumClass.cs index 3da1bee1360c..33643e475f51 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/EnumClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/EnumClass.cs @@ -32,24 +32,24 @@ namespace Org.OpenAPITools.Model public enum EnumClass { - /// /// Enum Abc for value: _abc /// [EnumMember(Value = "_abc")] Abc = 1, - + /// /// Enum Efg for value: -efg /// [EnumMember(Value = "-efg")] Efg = 2, - + /// /// Enum Xyz for value: (xyz) /// [EnumMember(Value = "(xyz)")] Xyz = 3 + } } diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/EnumTest.cs index 663d01a2b23a..7099a980016f 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/EnumTest.cs @@ -36,24 +36,24 @@ public partial class EnumTest : IEquatable, IValidatableObject [JsonConverter(typeof(StringEnumConverter))] public enum EnumStringEnum { - /// /// Enum UPPER for value: UPPER /// [EnumMember(Value = "UPPER")] UPPER = 1, - + /// /// Enum Lower for value: lower /// [EnumMember(Value = "lower")] Lower = 2, - + /// /// Enum Empty for value: /// [EnumMember(Value = "")] Empty = 3 + } /// @@ -67,24 +67,24 @@ public enum EnumStringEnum [JsonConverter(typeof(StringEnumConverter))] public enum EnumStringRequiredEnum { - /// /// Enum UPPER for value: UPPER /// [EnumMember(Value = "UPPER")] UPPER = 1, - + /// /// Enum Lower for value: lower /// [EnumMember(Value = "lower")] Lower = 2, - + /// /// Enum Empty for value: /// [EnumMember(Value = "")] Empty = 3 + } /// @@ -97,18 +97,16 @@ public enum EnumStringRequiredEnum /// public enum EnumIntegerEnum { - /// /// Enum NUMBER_1 for value: 1 /// - NUMBER_1 = 1, - + /// /// Enum NUMBER_MINUS_1 for value: -1 /// - NUMBER_MINUS_1 = -1 + } /// @@ -122,18 +120,18 @@ public enum EnumIntegerEnum [JsonConverter(typeof(StringEnumConverter))] public enum EnumNumberEnum { - /// /// Enum NUMBER_1_DOT_1 for value: 1.1 /// [EnumMember(Value = "1.1")] NUMBER_1_DOT_1 = 1, - + /// /// Enum NUMBER_MINUS_1_DOT_2 for value: -1.2 /// [EnumMember(Value = "-1.2")] NUMBER_MINUS_1_DOT_2 = 2 + } /// diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/File.cs new file mode 100644 index 000000000000..68d564d17e72 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/File.cs @@ -0,0 +1,125 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// Must be named `File` for test. + /// + [DataContract] + public partial class File : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Test capitalization. + public File(string sourceURI = default(string)) + { + this.SourceURI = sourceURI; + } + + /// + /// Test capitalization + /// + /// Test capitalization + [DataMember(Name="sourceURI", EmitDefaultValue=false)] + public string SourceURI { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class File {\n"); + sb.Append(" SourceURI: ").Append(SourceURI).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as File); + } + + /// + /// Returns true if File instances are equal + /// + /// Instance of File to be compared + /// Boolean + public bool Equals(File input) + { + if (input == null) + return false; + + return + ( + this.SourceURI == input.SourceURI || + (this.SourceURI != null && + this.SourceURI.Equals(input.SourceURI)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.SourceURI != null) + hashCode = hashCode * 59 + this.SourceURI.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs new file mode 100644 index 000000000000..1505ab9c4b1c --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -0,0 +1,140 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// FileSchemaTestClass + /// + [DataContract] + public partial class FileSchemaTestClass : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// file. + /// files. + public FileSchemaTestClass(System.IO.Stream file = default(System.IO.Stream), List files = default(List)) + { + this.File = file; + this.Files = files; + } + + /// + /// Gets or Sets File + /// + [DataMember(Name="file", EmitDefaultValue=false)] + public System.IO.Stream File { get; set; } + + /// + /// Gets or Sets Files + /// + [DataMember(Name="files", EmitDefaultValue=false)] + public List Files { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class FileSchemaTestClass {\n"); + sb.Append(" File: ").Append(File).Append("\n"); + sb.Append(" Files: ").Append(Files).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as FileSchemaTestClass); + } + + /// + /// Returns true if FileSchemaTestClass instances are equal + /// + /// Instance of FileSchemaTestClass to be compared + /// Boolean + public bool Equals(FileSchemaTestClass input) + { + if (input == null) + return false; + + return + ( + this.File == input.File || + (this.File != null && + this.File.Equals(input.File)) + ) && + ( + this.Files == input.Files || + this.Files != null && + this.Files.SequenceEqual(input.Files) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.File != null) + hashCode = hashCode * 59 + this.File.GetHashCode(); + if (this.Files != null) + hashCode = hashCode * 59 + this.Files.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/MapTest.cs index 25c030067064..1c5bfa70198a 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/MapTest.cs @@ -36,18 +36,18 @@ public partial class MapTest : IEquatable, IValidatableObject [JsonConverter(typeof(StringEnumConverter))] public enum InnerEnum { - /// /// Enum UPPER for value: UPPER /// [EnumMember(Value = "UPPER")] UPPER = 1, - + /// /// Enum Lower for value: lower /// [EnumMember(Value = "lower")] Lower = 2 + } @@ -61,10 +61,14 @@ public enum InnerEnum /// /// mapMapOfString. /// mapOfEnumString. - public MapTest(Dictionary> mapMapOfString = default(Dictionary>), Dictionary mapOfEnumString = default(Dictionary)) + /// directMap. + /// indirectMap. + public MapTest(Dictionary> mapMapOfString = default(Dictionary>), Dictionary mapOfEnumString = default(Dictionary), Dictionary directMap = default(Dictionary), StringBooleanMap indirectMap = default(StringBooleanMap)) { this.MapMapOfString = mapMapOfString; this.MapOfEnumString = mapOfEnumString; + this.DirectMap = directMap; + this.IndirectMap = indirectMap; } /// @@ -74,6 +78,18 @@ public enum InnerEnum public Dictionary> MapMapOfString { get; set; } + /// + /// Gets or Sets DirectMap + /// + [DataMember(Name="direct_map", EmitDefaultValue=false)] + public Dictionary DirectMap { get; set; } + + /// + /// Gets or Sets IndirectMap + /// + [DataMember(Name="indirect_map", EmitDefaultValue=false)] + public StringBooleanMap IndirectMap { get; set; } + /// /// Returns the string presentation of the object /// @@ -84,6 +100,8 @@ public override string ToString() sb.Append("class MapTest {\n"); sb.Append(" MapMapOfString: ").Append(MapMapOfString).Append("\n"); sb.Append(" MapOfEnumString: ").Append(MapOfEnumString).Append("\n"); + sb.Append(" DirectMap: ").Append(DirectMap).Append("\n"); + sb.Append(" IndirectMap: ").Append(IndirectMap).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -127,6 +145,16 @@ public bool Equals(MapTest input) this.MapOfEnumString == input.MapOfEnumString || this.MapOfEnumString != null && this.MapOfEnumString.SequenceEqual(input.MapOfEnumString) + ) && + ( + this.DirectMap == input.DirectMap || + this.DirectMap != null && + this.DirectMap.SequenceEqual(input.DirectMap) + ) && + ( + this.IndirectMap == input.IndirectMap || + (this.IndirectMap != null && + this.IndirectMap.Equals(input.IndirectMap)) ); } @@ -143,6 +171,10 @@ public override int GetHashCode() hashCode = hashCode * 59 + this.MapMapOfString.GetHashCode(); if (this.MapOfEnumString != null) hashCode = hashCode * 59 + this.MapOfEnumString.GetHashCode(); + if (this.DirectMap != null) + hashCode = hashCode * 59 + this.DirectMap.GetHashCode(); + if (this.IndirectMap != null) + hashCode = hashCode * 59 + this.IndirectMap.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/Order.cs index 27863dccbae7..f895f035192b 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/Order.cs @@ -37,24 +37,24 @@ public partial class Order : IEquatable, IValidatableObject [JsonConverter(typeof(StringEnumConverter))] public enum StatusEnum { - /// /// Enum Placed for value: placed /// [EnumMember(Value = "placed")] Placed = 1, - + /// /// Enum Approved for value: approved /// [EnumMember(Value = "approved")] Approved = 2, - + /// /// Enum Delivered for value: delivered /// [EnumMember(Value = "delivered")] Delivered = 3 + } /// diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/OuterEnum.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/OuterEnum.cs index 2716692ee0ec..be116aff60ab 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/OuterEnum.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/OuterEnum.cs @@ -32,24 +32,24 @@ namespace Org.OpenAPITools.Model public enum OuterEnum { - /// /// Enum Placed for value: placed /// [EnumMember(Value = "placed")] Placed = 1, - + /// /// Enum Approved for value: approved /// [EnumMember(Value = "approved")] Approved = 2, - + /// /// Enum Delivered for value: delivered /// [EnumMember(Value = "delivered")] Delivered = 3 + } } diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/Pet.cs index 02628fcf1240..1e213e5006ad 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/Pet.cs @@ -37,24 +37,24 @@ public partial class Pet : IEquatable, IValidatableObject [JsonConverter(typeof(StringEnumConverter))] public enum StatusEnum { - /// /// Enum Available for value: available /// [EnumMember(Value = "available")] Available = 1, - + /// /// Enum Pending for value: pending /// [EnumMember(Value = "pending")] Pending = 2, - + /// /// Enum Sold for value: sold /// [EnumMember(Value = "sold")] Sold = 3 + } /// diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/StringBooleanMap.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/StringBooleanMap.cs new file mode 100644 index 000000000000..df4dc6e486dc --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/StringBooleanMap.cs @@ -0,0 +1,110 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// StringBooleanMap + /// + [DataContract] + public partial class StringBooleanMap : Dictionary, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + public StringBooleanMap() : base() + { + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class StringBooleanMap {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as StringBooleanMap); + } + + /// + /// Returns true if StringBooleanMap instances are equal + /// + /// Instance of StringBooleanMap to be compared + /// Boolean + public bool Equals(StringBooleanMap input) + { + if (input == null) + return false; + + return base.Equals(input); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = base.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/.openapi-generator/VERSION b/samples/client/petstore/csharp/OpenAPIClientNetStandard/.openapi-generator/VERSION index 096bf47efe31..6d94c9c2e12a 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/.openapi-generator/VERSION +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/.openapi-generator/VERSION @@ -1 +1 @@ -3.0.0-SNAPSHOT \ No newline at end of file +3.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/README.md b/samples/client/petstore/csharp/OpenAPIClientNetStandard/README.md index 2676c56acc9e..e5a4fcea2ec2 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/README.md +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/README.md @@ -54,12 +54,12 @@ namespace Example try { // To test special tags - ModelClient result = apiInstance.TestSpecialTags(modelClient); + ModelClient result = apiInstance.Call123TestSpecialTags(modelClient); Debug.WriteLine(result); } catch (Exception e) { - Debug.Print("Exception when calling AnotherFakeApi.TestSpecialTags: " + e.Message ); + Debug.Print("Exception when calling AnotherFakeApi.Call123TestSpecialTags: " + e.Message ); } } @@ -74,11 +74,12 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- -*AnotherFakeApi* | [**TestSpecialTags**](docs/AnotherFakeApi.md#testspecialtags) | **PATCH** /another-fake/dummy | To test special tags +*AnotherFakeApi* | [**Call123TestSpecialTags**](docs/AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags *FakeApi* | [**FakeOuterBooleanSerialize**](docs/FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean | *FakeApi* | [**FakeOuterCompositeSerialize**](docs/FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | *FakeApi* | [**FakeOuterNumberSerialize**](docs/FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | *FakeApi* | [**FakeOuterStringSerialize**](docs/FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | +*FakeApi* | [**TestBodyWithFileSchema**](docs/FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | *FakeApi* | [**TestBodyWithQueryParams**](docs/FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | *FakeApi* | [**TestClientModel**](docs/FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model *FakeApi* | [**TestEndpointParameters**](docs/FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -94,6 +95,7 @@ Class | Method | HTTP request | Description *PetApi* | [**UpdatePet**](docs/PetApi.md#updatepet) | **PUT** /pet | Update an existing pet *PetApi* | [**UpdatePetWithForm**](docs/PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetApi* | [**UploadFile**](docs/PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image +*PetApi* | [**UploadFileWithRequiredFile**](docs/PetApi.md#uploadfilewithrequiredfile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) *StoreApi* | [**DeleteOrder**](docs/StoreApi.md#deleteorder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID *StoreApi* | [**GetInventory**](docs/StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status *StoreApi* | [**GetOrderById**](docs/StoreApi.md#getorderbyid) | **GET** /store/order/{order_id} | Find purchase order by ID @@ -126,6 +128,8 @@ Class | Method | HTTP request | Description - [Model.EnumArrays](docs/EnumArrays.md) - [Model.EnumClass](docs/EnumClass.md) - [Model.EnumTest](docs/EnumTest.md) + - [Model.File](docs/File.md) + - [Model.FileSchemaTestClass](docs/FileSchemaTestClass.md) - [Model.FormatTest](docs/FormatTest.md) - [Model.HasOnlyReadOnly](docs/HasOnlyReadOnly.md) - [Model.List](docs/List.md) @@ -142,6 +146,7 @@ Class | Method | HTTP request | Description - [Model.ReadOnlyFirst](docs/ReadOnlyFirst.md) - [Model.Return](docs/Return.md) - [Model.SpecialModelName](docs/SpecialModelName.md) + - [Model.StringBooleanMap](docs/StringBooleanMap.md) - [Model.Tag](docs/Tag.md) - [Model.User](docs/User.md) diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/AnotherFakeApi.md b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/AnotherFakeApi.md index 2dca444f2768..81cc3106d64f 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/AnotherFakeApi.md +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/AnotherFakeApi.md @@ -4,16 +4,16 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**TestSpecialTags**](AnotherFakeApi.md#testspecialtags) | **PATCH** /another-fake/dummy | To test special tags +[**Call123TestSpecialTags**](AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags - -# **TestSpecialTags** -> ModelClient TestSpecialTags (ModelClient modelClient) + +# **Call123TestSpecialTags** +> ModelClient Call123TestSpecialTags (ModelClient modelClient) To test special tags -To test special tags +To test special tags and operation ID starting with number ### Example ```csharp @@ -25,7 +25,7 @@ using Org.OpenAPITools.Model; namespace Example { - public class TestSpecialTagsExample + public class Call123TestSpecialTagsExample { public void main() { @@ -35,12 +35,12 @@ namespace Example try { // To test special tags - ModelClient result = apiInstance.TestSpecialTags(modelClient); + ModelClient result = apiInstance.Call123TestSpecialTags(modelClient); Debug.WriteLine(result); } catch (Exception e) { - Debug.Print("Exception when calling AnotherFakeApi.TestSpecialTags: " + e.Message ); + Debug.Print("Exception when calling AnotherFakeApi.Call123TestSpecialTags: " + e.Message ); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/FakeApi.md b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/FakeApi.md index 2a4fb6094ae0..d51d29c09a6b 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/FakeApi.md +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/FakeApi.md @@ -8,6 +8,7 @@ Method | HTTP request | Description [**FakeOuterCompositeSerialize**](FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | [**FakeOuterNumberSerialize**](FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | [**FakeOuterStringSerialize**](FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | +[**TestBodyWithFileSchema**](FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | [**TestBodyWithQueryParams**](FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | [**TestClientModel**](FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model [**TestEndpointParameters**](FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -159,7 +160,7 @@ namespace Example public void main() { var apiInstance = new FakeApi(); - var body = 1.2; // decimal? | Input number as post body (optional) + var body = 1.2D; // decimal? | Input number as post body (optional) try { @@ -256,6 +257,65 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **TestBodyWithFileSchema** +> void TestBodyWithFileSchema (FileSchemaTestClass fileSchemaTestClass) + + + +For this test, the body for this request much reference a schema named `File`. + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestBodyWithFileSchemaExample + { + public void main() + { + var apiInstance = new FakeApi(); + var fileSchemaTestClass = new FileSchemaTestClass(); // FileSchemaTestClass | + + try + { + apiInstance.TestBodyWithFileSchema(fileSchemaTestClass); + } + catch (Exception e) + { + Debug.Print("Exception when calling FakeApi.TestBodyWithFileSchema: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **fileSchemaTestClass** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **TestBodyWithQueryParams** > void TestBodyWithQueryParams (string query, User user) @@ -404,13 +464,13 @@ namespace Example var apiInstance = new FakeApi(); var number = 8.14; // decimal? | None - var _double = 1.2; // double? | None + var _double = 1.2D; // double? | None var patternWithoutDelimiter = patternWithoutDelimiter_example; // string | None var _byte = BYTE_ARRAY_DATA_HERE; // byte[] | None var integer = 56; // int? | None (optional) var int32 = 56; // int? | None (optional) var int64 = 789; // long? | None (optional) - var _float = 3.4; // float? | None (optional) + var _float = 3.4F; // float? | None (optional) var _string = _string_example; // string | None (optional) var binary = BINARY_DATA_HERE; // System.IO.Stream | None (optional) var date = 2013-10-20; // DateTime? | None (optional) @@ -494,8 +554,8 @@ namespace Example var enumQueryStringArray = enumQueryStringArray_example; // List | Query parameter enum test (string array) (optional) var enumQueryString = enumQueryString_example; // string | Query parameter enum test (string) (optional) (default to -efg) var enumQueryInteger = 56; // int? | Query parameter enum test (double) (optional) - var enumQueryDouble = 1.2; // double? | Query parameter enum test (double) (optional) - var enumFormStringArray = enumFormStringArray_example; // List | Form parameter enum test (string array) (optional) (default to $) + var enumQueryDouble = 1.2D; // double? | Query parameter enum test (double) (optional) + var enumFormStringArray = new List(); // List | Form parameter enum test (string array) (optional) (default to $) var enumFormString = enumFormString_example; // string | Form parameter enum test (string) (optional) (default to -efg) try @@ -522,7 +582,7 @@ Name | Type | Description | Notes **enumQueryString** | **string**| Query parameter enum test (string) | [optional] [default to -efg] **enumQueryInteger** | **int?**| Query parameter enum test (double) | [optional] **enumQueryDouble** | **double?**| Query parameter enum test (double) | [optional] - **enumFormStringArray** | **List<string>**| Form parameter enum test (string array) | [optional] [default to $] + **enumFormStringArray** | [**List<string>**](string.md)| Form parameter enum test (string array) | [optional] [default to $] **enumFormString** | **string**| Form parameter enum test (string) | [optional] [default to -efg] ### Return type diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/File.md b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/File.md new file mode 100644 index 000000000000..acf85a4c001a --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/File.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.File +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**SourceURI** | **string** | Test capitalization | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/FileSchemaTestClass.md b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/FileSchemaTestClass.md new file mode 100644 index 000000000000..e0820fa4e650 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/FileSchemaTestClass.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.FileSchemaTestClass +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**File** | **System.IO.Stream** | | [optional] +**Files** | **List<System.IO.Stream>** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/MapTest.md b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/MapTest.md index 2baba08d8552..ee62dbf135fa 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/MapTest.md +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/MapTest.md @@ -5,6 +5,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **MapMapOfString** | **Dictionary<string, Dictionary<string, string>>** | | [optional] **MapOfEnumString** | **Dictionary<string, string>** | | [optional] +**DirectMap** | **Dictionary<string, bool?>** | | [optional] +**IndirectMap** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/PetApi.md b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/PetApi.md index 244ece53a318..dd23df9b3683 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/PetApi.md +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/PetApi.md @@ -12,6 +12,7 @@ Method | HTTP request | Description [**UpdatePet**](PetApi.md#updatepet) | **PUT** /pet | Update an existing pet [**UpdatePetWithForm**](PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data [**UploadFile**](PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image +[**UploadFileWithRequiredFile**](PetApi.md#uploadfilewithrequiredfile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) @@ -524,3 +525,69 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **UploadFileWithRequiredFile** +> ApiResponse UploadFileWithRequiredFile (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null) + +uploads an image (required) + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class UploadFileWithRequiredFileExample + { + public void main() + { + // Configure OAuth2 access token for authorization: petstore_auth + Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(); + var petId = 789; // long? | ID of pet to update + var requiredFile = BINARY_DATA_HERE; // System.IO.Stream | file to upload + var additionalMetadata = additionalMetadata_example; // string | Additional data to pass to server (optional) + + try + { + // uploads an image (required) + ApiResponse result = apiInstance.UploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling PetApi.UploadFileWithRequiredFile: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **long?**| ID of pet to update | + **requiredFile** | **System.IO.Stream**| file to upload | + **additionalMetadata** | **string**| Additional data to pass to server | [optional] + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/StringBooleanMap.md b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/StringBooleanMap.md new file mode 100644 index 000000000000..6e7a71368df7 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/StringBooleanMap.md @@ -0,0 +1,8 @@ +# Org.OpenAPITools.Model.StringBooleanMap +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/AnotherFakeApi.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/AnotherFakeApi.cs index 586ead5d2004..57dcf5ca7b34 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/AnotherFakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/AnotherFakeApi.cs @@ -28,46 +28,46 @@ public interface IAnotherFakeApi : IApiAccessor /// To test special tags /// /// - /// To test special tags + /// To test special tags and operation ID starting with number /// /// Thrown when fails to make API call /// client model /// ModelClient - ModelClient TestSpecialTags (ModelClient modelClient); + ModelClient Call123TestSpecialTags (ModelClient modelClient); /// /// To test special tags /// /// - /// To test special tags + /// To test special tags and operation ID starting with number /// /// Thrown when fails to make API call /// client model /// ApiResponse of ModelClient - ApiResponse TestSpecialTagsWithHttpInfo (ModelClient modelClient); + ApiResponse Call123TestSpecialTagsWithHttpInfo (ModelClient modelClient); #endregion Synchronous Operations #region Asynchronous Operations /// /// To test special tags /// /// - /// To test special tags + /// To test special tags and operation ID starting with number /// /// Thrown when fails to make API call /// client model /// Task of ModelClient - System.Threading.Tasks.Task TestSpecialTagsAsync (ModelClient modelClient); + System.Threading.Tasks.Task Call123TestSpecialTagsAsync (ModelClient modelClient); /// /// To test special tags /// /// - /// To test special tags + /// To test special tags and operation ID starting with number /// /// Thrown when fails to make API call /// client model /// Task of ApiResponse (ModelClient) - System.Threading.Tasks.Task> TestSpecialTagsAsyncWithHttpInfo (ModelClient modelClient); + System.Threading.Tasks.Task> Call123TestSpecialTagsAsyncWithHttpInfo (ModelClient modelClient); #endregion Asynchronous Operations } @@ -169,28 +169,28 @@ public void AddDefaultHeader(string key, string value) } /// - /// To test special tags To test special tags + /// To test special tags To test special tags and operation ID starting with number /// /// Thrown when fails to make API call /// client model /// ModelClient - public ModelClient TestSpecialTags (ModelClient modelClient) + public ModelClient Call123TestSpecialTags (ModelClient modelClient) { - ApiResponse localVarResponse = TestSpecialTagsWithHttpInfo(modelClient); + ApiResponse localVarResponse = Call123TestSpecialTagsWithHttpInfo(modelClient); return localVarResponse.Data; } /// - /// To test special tags To test special tags + /// To test special tags To test special tags and operation ID starting with number /// /// Thrown when fails to make API call /// client model /// ApiResponse of ModelClient - public ApiResponse< ModelClient > TestSpecialTagsWithHttpInfo (ModelClient modelClient) + public ApiResponse< ModelClient > Call123TestSpecialTagsWithHttpInfo (ModelClient modelClient) { // verify the required parameter 'modelClient' is set if (modelClient == null) - throw new ApiException(400, "Missing required parameter 'modelClient' when calling AnotherFakeApi->TestSpecialTags"); + throw new ApiException(400, "Missing required parameter 'modelClient' when calling AnotherFakeApi->Call123TestSpecialTags"); var localVarPath = "./another-fake/dummy"; var localVarPathParams = new Dictionary(); @@ -233,7 +233,7 @@ public ApiResponse< ModelClient > TestSpecialTagsWithHttpInfo (ModelClient model if (ExceptionFactory != null) { - Exception exception = ExceptionFactory("TestSpecialTags", localVarResponse); + Exception exception = ExceptionFactory("Call123TestSpecialTags", localVarResponse); if (exception != null) throw exception; } @@ -243,29 +243,29 @@ public ApiResponse< ModelClient > TestSpecialTagsWithHttpInfo (ModelClient model } /// - /// To test special tags To test special tags + /// To test special tags To test special tags and operation ID starting with number /// /// Thrown when fails to make API call /// client model /// Task of ModelClient - public async System.Threading.Tasks.Task TestSpecialTagsAsync (ModelClient modelClient) + public async System.Threading.Tasks.Task Call123TestSpecialTagsAsync (ModelClient modelClient) { - ApiResponse localVarResponse = await TestSpecialTagsAsyncWithHttpInfo(modelClient); + ApiResponse localVarResponse = await Call123TestSpecialTagsAsyncWithHttpInfo(modelClient); return localVarResponse.Data; } /// - /// To test special tags To test special tags + /// To test special tags To test special tags and operation ID starting with number /// /// Thrown when fails to make API call /// client model /// Task of ApiResponse (ModelClient) - public async System.Threading.Tasks.Task> TestSpecialTagsAsyncWithHttpInfo (ModelClient modelClient) + public async System.Threading.Tasks.Task> Call123TestSpecialTagsAsyncWithHttpInfo (ModelClient modelClient) { // verify the required parameter 'modelClient' is set if (modelClient == null) - throw new ApiException(400, "Missing required parameter 'modelClient' when calling AnotherFakeApi->TestSpecialTags"); + throw new ApiException(400, "Missing required parameter 'modelClient' when calling AnotherFakeApi->Call123TestSpecialTags"); var localVarPath = "./another-fake/dummy"; var localVarPathParams = new Dictionary(); @@ -308,7 +308,7 @@ public async System.Threading.Tasks.Task> TestSpecialTa if (ExceptionFactory != null) { - Exception exception = ExceptionFactory("TestSpecialTags", localVarResponse); + Exception exception = ExceptionFactory("Call123TestSpecialTags", localVarResponse); if (exception != null) throw exception; } diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/FakeApi.cs index 234c794dd412..da68811f95a7 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/FakeApi.cs @@ -112,6 +112,27 @@ public interface IFakeApi : IApiAccessor /// /// /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// + void TestBodyWithFileSchema (FileSchemaTestClass fileSchemaTestClass); + + /// + /// + /// + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of Object(void) + ApiResponse TestBodyWithFileSchemaWithHttpInfo (FileSchemaTestClass fileSchemaTestClass); + /// + /// + /// + /// /// /// /// Thrown when fails to make API call @@ -368,6 +389,27 @@ public interface IFakeApi : IApiAccessor /// /// /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// Task of void + System.Threading.Tasks.Task TestBodyWithFileSchemaAsync (FileSchemaTestClass fileSchemaTestClass); + + /// + /// + /// + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// Task of ApiResponse + System.Threading.Tasks.Task> TestBodyWithFileSchemaAsyncWithHttpInfo (FileSchemaTestClass fileSchemaTestClass); + /// + /// + /// + /// /// /// /// Thrown when fails to make API call @@ -1198,6 +1240,151 @@ public async System.Threading.Tasks.Task> FakeOuterStringSer (string) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(string))); } + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// + public void TestBodyWithFileSchema (FileSchemaTestClass fileSchemaTestClass) + { + TestBodyWithFileSchemaWithHttpInfo(fileSchemaTestClass); + } + + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of Object(void) + public ApiResponse TestBodyWithFileSchemaWithHttpInfo (FileSchemaTestClass fileSchemaTestClass) + { + // verify the required parameter 'fileSchemaTestClass' is set + if (fileSchemaTestClass == null) + throw new ApiException(400, "Missing required parameter 'fileSchemaTestClass' when calling FakeApi->TestBodyWithFileSchema"); + + var localVarPath = "./fake/body-with-file-schema"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + "application/json" + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (fileSchemaTestClass != null && fileSchemaTestClass.GetType() != typeof(byte[])) + { + localVarPostBody = this.Configuration.ApiClient.Serialize(fileSchemaTestClass); // http body (model) parameter + } + else + { + localVarPostBody = fileSchemaTestClass; // byte array + } + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath, + Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("TestBodyWithFileSchema", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), + null); + } + + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// Task of void + public async System.Threading.Tasks.Task TestBodyWithFileSchemaAsync (FileSchemaTestClass fileSchemaTestClass) + { + await TestBodyWithFileSchemaAsyncWithHttpInfo(fileSchemaTestClass); + + } + + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// Task of ApiResponse + public async System.Threading.Tasks.Task> TestBodyWithFileSchemaAsyncWithHttpInfo (FileSchemaTestClass fileSchemaTestClass) + { + // verify the required parameter 'fileSchemaTestClass' is set + if (fileSchemaTestClass == null) + throw new ApiException(400, "Missing required parameter 'fileSchemaTestClass' when calling FakeApi->TestBodyWithFileSchema"); + + var localVarPath = "./fake/body-with-file-schema"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + "application/json" + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (fileSchemaTestClass != null && fileSchemaTestClass.GetType() != typeof(byte[])) + { + localVarPostBody = this.Configuration.ApiClient.Serialize(fileSchemaTestClass); // http body (model) parameter + } + else + { + localVarPostBody = fileSchemaTestClass; // byte array + } + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath, + Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("TestBodyWithFileSchema", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), + null); + } + /// /// /// diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/PetApi.cs index f34cfb4d6a36..e07717ae436c 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/PetApi.cs @@ -202,6 +202,31 @@ public interface IPetApi : IApiAccessor /// file to upload (optional) /// ApiResponse of ApiResponse ApiResponse UploadFileWithHttpInfo (long? petId, string additionalMetadata = null, System.IO.Stream file = null); + /// + /// uploads an image (required) + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// ApiResponse + ApiResponse UploadFileWithRequiredFile (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null); + + /// + /// uploads an image (required) + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// ApiResponse of ApiResponse + ApiResponse UploadFileWithRequiredFileWithHttpInfo (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null); #endregion Synchronous Operations #region Asynchronous Operations /// @@ -382,6 +407,31 @@ public interface IPetApi : IApiAccessor /// file to upload (optional) /// Task of ApiResponse (ApiResponse) System.Threading.Tasks.Task> UploadFileAsyncWithHttpInfo (long? petId, string additionalMetadata = null, System.IO.Stream file = null); + /// + /// uploads an image (required) + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// Task of ApiResponse + System.Threading.Tasks.Task UploadFileWithRequiredFileAsync (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null); + + /// + /// uploads an image (required) + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// Task of ApiResponse (ApiResponse) + System.Threading.Tasks.Task> UploadFileWithRequiredFileAsyncWithHttpInfo (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null); #endregion Asynchronous Operations } @@ -1700,5 +1750,170 @@ public async System.Threading.Tasks.Task> UploadFileAsy (ApiResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(ApiResponse))); } + /// + /// uploads an image (required) + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// ApiResponse + public ApiResponse UploadFileWithRequiredFile (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null) + { + ApiResponse localVarResponse = UploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata); + return localVarResponse.Data; + } + + /// + /// uploads an image (required) + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// ApiResponse of ApiResponse + public ApiResponse< ApiResponse > UploadFileWithRequiredFileWithHttpInfo (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null) + { + // verify the required parameter 'petId' is set + if (petId == null) + throw new ApiException(400, "Missing required parameter 'petId' when calling PetApi->UploadFileWithRequiredFile"); + // verify the required parameter 'requiredFile' is set + if (requiredFile == null) + throw new ApiException(400, "Missing required parameter 'requiredFile' when calling PetApi->UploadFileWithRequiredFile"); + + var localVarPath = "./fake/{petId}/uploadImageWithRequiredFile"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + "multipart/form-data" + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/json" + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (petId != null) localVarPathParams.Add("petId", this.Configuration.ApiClient.ParameterToString(petId)); // path parameter + if (additionalMetadata != null) localVarFormParams.Add("additionalMetadata", this.Configuration.ApiClient.ParameterToString(additionalMetadata)); // form parameter + if (requiredFile != null) localVarFileParams.Add("requiredFile", this.Configuration.ApiClient.ParameterToFile("requiredFile", requiredFile)); + + // authentication (petstore_auth) required + // oauth required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath, + Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("UploadFileWithRequiredFile", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), + (ApiResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(ApiResponse))); + } + + /// + /// uploads an image (required) + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// Task of ApiResponse + public async System.Threading.Tasks.Task UploadFileWithRequiredFileAsync (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null) + { + ApiResponse localVarResponse = await UploadFileWithRequiredFileAsyncWithHttpInfo(petId, requiredFile, additionalMetadata); + return localVarResponse.Data; + + } + + /// + /// uploads an image (required) + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// Task of ApiResponse (ApiResponse) + public async System.Threading.Tasks.Task> UploadFileWithRequiredFileAsyncWithHttpInfo (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null) + { + // verify the required parameter 'petId' is set + if (petId == null) + throw new ApiException(400, "Missing required parameter 'petId' when calling PetApi->UploadFileWithRequiredFile"); + // verify the required parameter 'requiredFile' is set + if (requiredFile == null) + throw new ApiException(400, "Missing required parameter 'requiredFile' when calling PetApi->UploadFileWithRequiredFile"); + + var localVarPath = "./fake/{petId}/uploadImageWithRequiredFile"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + "multipart/form-data" + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/json" + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (petId != null) localVarPathParams.Add("petId", this.Configuration.ApiClient.ParameterToString(petId)); // path parameter + if (additionalMetadata != null) localVarFormParams.Add("additionalMetadata", this.Configuration.ApiClient.ParameterToString(additionalMetadata)); // form parameter + if (requiredFile != null) localVarFileParams.Add("requiredFile", this.Configuration.ApiClient.ParameterToFile("requiredFile", requiredFile)); + + // authentication (petstore_auth) required + // oauth required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath, + Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("UploadFileWithRequiredFile", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), + (ApiResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(ApiResponse))); + } + } } diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/EnumArrays.cs index 26c4194396d8..7490299730c0 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -34,18 +34,18 @@ public partial class EnumArrays : IEquatable [JsonConverter(typeof(StringEnumConverter))] public enum JustSymbolEnum { - /// /// Enum GreaterThanOrEqualTo for value: >= /// [EnumMember(Value = ">=")] GreaterThanOrEqualTo = 1, - + /// /// Enum Dollar for value: $ /// [EnumMember(Value = "$")] Dollar = 2 + } /// @@ -59,18 +59,18 @@ public enum JustSymbolEnum [JsonConverter(typeof(StringEnumConverter))] public enum ArrayEnumEnum { - /// /// Enum Fish for value: fish /// [EnumMember(Value = "fish")] Fish = 1, - + /// /// Enum Crab for value: crab /// [EnumMember(Value = "crab")] Crab = 2 + } diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/EnumClass.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/EnumClass.cs index 8065505fd747..cfeef31c19c5 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/EnumClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/EnumClass.cs @@ -30,24 +30,24 @@ namespace Org.OpenAPITools.Model public enum EnumClass { - /// /// Enum Abc for value: _abc /// [EnumMember(Value = "_abc")] Abc = 1, - + /// /// Enum Efg for value: -efg /// [EnumMember(Value = "-efg")] Efg = 2, - + /// /// Enum Xyz for value: (xyz) /// [EnumMember(Value = "(xyz)")] Xyz = 3 + } } diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/EnumTest.cs index d148da13222a..17d1f39b2be9 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/EnumTest.cs @@ -34,24 +34,24 @@ public partial class EnumTest : IEquatable [JsonConverter(typeof(StringEnumConverter))] public enum EnumStringEnum { - /// /// Enum UPPER for value: UPPER /// [EnumMember(Value = "UPPER")] UPPER = 1, - + /// /// Enum Lower for value: lower /// [EnumMember(Value = "lower")] Lower = 2, - + /// /// Enum Empty for value: /// [EnumMember(Value = "")] Empty = 3 + } /// @@ -65,24 +65,24 @@ public enum EnumStringEnum [JsonConverter(typeof(StringEnumConverter))] public enum EnumStringRequiredEnum { - /// /// Enum UPPER for value: UPPER /// [EnumMember(Value = "UPPER")] UPPER = 1, - + /// /// Enum Lower for value: lower /// [EnumMember(Value = "lower")] Lower = 2, - + /// /// Enum Empty for value: /// [EnumMember(Value = "")] Empty = 3 + } /// @@ -95,18 +95,16 @@ public enum EnumStringRequiredEnum /// public enum EnumIntegerEnum { - /// /// Enum NUMBER_1 for value: 1 /// - NUMBER_1 = 1, - + /// /// Enum NUMBER_MINUS_1 for value: -1 /// - NUMBER_MINUS_1 = -1 + } /// @@ -120,18 +118,18 @@ public enum EnumIntegerEnum [JsonConverter(typeof(StringEnumConverter))] public enum EnumNumberEnum { - /// /// Enum NUMBER_1_DOT_1 for value: 1.1 /// [EnumMember(Value = "1.1")] NUMBER_1_DOT_1 = 1, - + /// /// Enum NUMBER_MINUS_1_DOT_2 for value: -1.2 /// [EnumMember(Value = "-1.2")] NUMBER_MINUS_1_DOT_2 = 2 + } /// diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/File.cs new file mode 100644 index 000000000000..e9addc9d7e59 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/File.cs @@ -0,0 +1,113 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// Must be named `File` for test. + /// + [DataContract] + public partial class File : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + /// Test capitalization. + public File(string sourceURI = default(string)) + { + this.SourceURI = sourceURI; + } + + /// + /// Test capitalization + /// + /// Test capitalization + [DataMember(Name="sourceURI", EmitDefaultValue=false)] + public string SourceURI { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class File {\n"); + sb.Append(" SourceURI: ").Append(SourceURI).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as File); + } + + /// + /// Returns true if File instances are equal + /// + /// Instance of File to be compared + /// Boolean + public bool Equals(File input) + { + if (input == null) + return false; + + return + ( + this.SourceURI == input.SourceURI || + (this.SourceURI != null && + this.SourceURI.Equals(input.SourceURI)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.SourceURI != null) + hashCode = hashCode * 59 + this.SourceURI.GetHashCode(); + return hashCode; + } + } + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs new file mode 100644 index 000000000000..543cf492626d --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -0,0 +1,128 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// FileSchemaTestClass + /// + [DataContract] + public partial class FileSchemaTestClass : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + /// file. + /// files. + public FileSchemaTestClass(System.IO.Stream file = default(System.IO.Stream), List files = default(List)) + { + this.File = file; + this.Files = files; + } + + /// + /// Gets or Sets File + /// + [DataMember(Name="file", EmitDefaultValue=false)] + public System.IO.Stream File { get; set; } + + /// + /// Gets or Sets Files + /// + [DataMember(Name="files", EmitDefaultValue=false)] + public List Files { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class FileSchemaTestClass {\n"); + sb.Append(" File: ").Append(File).Append("\n"); + sb.Append(" Files: ").Append(Files).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as FileSchemaTestClass); + } + + /// + /// Returns true if FileSchemaTestClass instances are equal + /// + /// Instance of FileSchemaTestClass to be compared + /// Boolean + public bool Equals(FileSchemaTestClass input) + { + if (input == null) + return false; + + return + ( + this.File == input.File || + (this.File != null && + this.File.Equals(input.File)) + ) && + ( + this.Files == input.Files || + this.Files != null && + this.Files.SequenceEqual(input.Files) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.File != null) + hashCode = hashCode * 59 + this.File.GetHashCode(); + if (this.Files != null) + hashCode = hashCode * 59 + this.Files.GetHashCode(); + return hashCode; + } + } + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/MapTest.cs index 1ccbdba8adf8..18ccbc3ba9b0 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/MapTest.cs @@ -34,18 +34,18 @@ public partial class MapTest : IEquatable [JsonConverter(typeof(StringEnumConverter))] public enum InnerEnum { - /// /// Enum UPPER for value: UPPER /// [EnumMember(Value = "UPPER")] UPPER = 1, - + /// /// Enum Lower for value: lower /// [EnumMember(Value = "lower")] Lower = 2 + } @@ -59,10 +59,14 @@ public enum InnerEnum /// /// mapMapOfString. /// mapOfEnumString. - public MapTest(Dictionary> mapMapOfString = default(Dictionary>), Dictionary mapOfEnumString = default(Dictionary)) + /// directMap. + /// indirectMap. + public MapTest(Dictionary> mapMapOfString = default(Dictionary>), Dictionary mapOfEnumString = default(Dictionary), Dictionary directMap = default(Dictionary), StringBooleanMap indirectMap = default(StringBooleanMap)) { this.MapMapOfString = mapMapOfString; this.MapOfEnumString = mapOfEnumString; + this.DirectMap = directMap; + this.IndirectMap = indirectMap; } /// @@ -72,6 +76,18 @@ public enum InnerEnum public Dictionary> MapMapOfString { get; set; } + /// + /// Gets or Sets DirectMap + /// + [DataMember(Name="direct_map", EmitDefaultValue=false)] + public Dictionary DirectMap { get; set; } + + /// + /// Gets or Sets IndirectMap + /// + [DataMember(Name="indirect_map", EmitDefaultValue=false)] + public StringBooleanMap IndirectMap { get; set; } + /// /// Returns the string presentation of the object /// @@ -82,6 +98,8 @@ public override string ToString() sb.Append("class MapTest {\n"); sb.Append(" MapMapOfString: ").Append(MapMapOfString).Append("\n"); sb.Append(" MapOfEnumString: ").Append(MapOfEnumString).Append("\n"); + sb.Append(" DirectMap: ").Append(DirectMap).Append("\n"); + sb.Append(" IndirectMap: ").Append(IndirectMap).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -125,6 +143,16 @@ public bool Equals(MapTest input) this.MapOfEnumString == input.MapOfEnumString || this.MapOfEnumString != null && this.MapOfEnumString.SequenceEqual(input.MapOfEnumString) + ) && + ( + this.DirectMap == input.DirectMap || + this.DirectMap != null && + this.DirectMap.SequenceEqual(input.DirectMap) + ) && + ( + this.IndirectMap == input.IndirectMap || + (this.IndirectMap != null && + this.IndirectMap.Equals(input.IndirectMap)) ); } @@ -141,6 +169,10 @@ public override int GetHashCode() hashCode = hashCode * 59 + this.MapMapOfString.GetHashCode(); if (this.MapOfEnumString != null) hashCode = hashCode * 59 + this.MapOfEnumString.GetHashCode(); + if (this.DirectMap != null) + hashCode = hashCode * 59 + this.DirectMap.GetHashCode(); + if (this.IndirectMap != null) + hashCode = hashCode * 59 + this.IndirectMap.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/Order.cs index ef1160318b26..713657125c69 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/Order.cs @@ -35,24 +35,24 @@ public partial class Order : IEquatable [JsonConverter(typeof(StringEnumConverter))] public enum StatusEnum { - /// /// Enum Placed for value: placed /// [EnumMember(Value = "placed")] Placed = 1, - + /// /// Enum Approved for value: approved /// [EnumMember(Value = "approved")] Approved = 2, - + /// /// Enum Delivered for value: delivered /// [EnumMember(Value = "delivered")] Delivered = 3 + } /// diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/OuterEnum.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/OuterEnum.cs index e465b750cab6..cdf6a7e9161a 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/OuterEnum.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/OuterEnum.cs @@ -30,24 +30,24 @@ namespace Org.OpenAPITools.Model public enum OuterEnum { - /// /// Enum Placed for value: placed /// [EnumMember(Value = "placed")] Placed = 1, - + /// /// Enum Approved for value: approved /// [EnumMember(Value = "approved")] Approved = 2, - + /// /// Enum Delivered for value: delivered /// [EnumMember(Value = "delivered")] Delivered = 3 + } } diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/Pet.cs index 446d6e7971b7..e3951fa6681b 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/Pet.cs @@ -35,24 +35,24 @@ public partial class Pet : IEquatable [JsonConverter(typeof(StringEnumConverter))] public enum StatusEnum { - /// /// Enum Available for value: available /// [EnumMember(Value = "available")] Available = 1, - + /// /// Enum Pending for value: pending /// [EnumMember(Value = "pending")] Pending = 2, - + /// /// Enum Sold for value: sold /// [EnumMember(Value = "sold")] Sold = 3 + } /// diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/StringBooleanMap.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/StringBooleanMap.cs new file mode 100644 index 000000000000..ac60f8efc440 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/StringBooleanMap.cs @@ -0,0 +1,98 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// StringBooleanMap + /// + [DataContract] + public partial class StringBooleanMap : Dictionary, IEquatable + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + public StringBooleanMap() : base() + { + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class StringBooleanMap {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as StringBooleanMap); + } + + /// + /// Returns true if StringBooleanMap instances are equal + /// + /// Instance of StringBooleanMap to be compared + /// Boolean + public bool Equals(StringBooleanMap input) + { + if (input == null) + return false; + + return base.Equals(input); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = base.GetHashCode(); + return hashCode; + } + } + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/.openapi-generator/VERSION b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/.openapi-generator/VERSION index 096bf47efe31..6d94c9c2e12a 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/.openapi-generator/VERSION +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/.openapi-generator/VERSION @@ -1 +1 @@ -3.0.0-SNAPSHOT \ No newline at end of file +3.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/README.md b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/README.md index 441abc408817..a2b8a9b17a0f 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/README.md +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/README.md @@ -76,12 +76,12 @@ namespace Example try { // To test special tags - ModelClient result = apiInstance.TestSpecialTags(modelClient); + ModelClient result = apiInstance.Call123TestSpecialTags(modelClient); Debug.WriteLine(result); } catch (Exception e) { - Debug.Print("Exception when calling AnotherFakeApi.TestSpecialTags: " + e.Message ); + Debug.Print("Exception when calling AnotherFakeApi.Call123TestSpecialTags: " + e.Message ); } } @@ -96,11 +96,12 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- -*AnotherFakeApi* | [**TestSpecialTags**](docs/AnotherFakeApi.md#testspecialtags) | **PATCH** /another-fake/dummy | To test special tags +*AnotherFakeApi* | [**Call123TestSpecialTags**](docs/AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags *FakeApi* | [**FakeOuterBooleanSerialize**](docs/FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean | *FakeApi* | [**FakeOuterCompositeSerialize**](docs/FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | *FakeApi* | [**FakeOuterNumberSerialize**](docs/FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | *FakeApi* | [**FakeOuterStringSerialize**](docs/FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | +*FakeApi* | [**TestBodyWithFileSchema**](docs/FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | *FakeApi* | [**TestBodyWithQueryParams**](docs/FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | *FakeApi* | [**TestClientModel**](docs/FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model *FakeApi* | [**TestEndpointParameters**](docs/FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -116,6 +117,7 @@ Class | Method | HTTP request | Description *PetApi* | [**UpdatePet**](docs/PetApi.md#updatepet) | **PUT** /pet | Update an existing pet *PetApi* | [**UpdatePetWithForm**](docs/PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetApi* | [**UploadFile**](docs/PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image +*PetApi* | [**UploadFileWithRequiredFile**](docs/PetApi.md#uploadfilewithrequiredfile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) *StoreApi* | [**DeleteOrder**](docs/StoreApi.md#deleteorder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID *StoreApi* | [**GetInventory**](docs/StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status *StoreApi* | [**GetOrderById**](docs/StoreApi.md#getorderbyid) | **GET** /store/order/{order_id} | Find purchase order by ID @@ -148,6 +150,8 @@ Class | Method | HTTP request | Description - [Model.EnumArrays](docs/EnumArrays.md) - [Model.EnumClass](docs/EnumClass.md) - [Model.EnumTest](docs/EnumTest.md) + - [Model.File](docs/File.md) + - [Model.FileSchemaTestClass](docs/FileSchemaTestClass.md) - [Model.FormatTest](docs/FormatTest.md) - [Model.HasOnlyReadOnly](docs/HasOnlyReadOnly.md) - [Model.List](docs/List.md) @@ -164,6 +168,7 @@ Class | Method | HTTP request | Description - [Model.ReadOnlyFirst](docs/ReadOnlyFirst.md) - [Model.Return](docs/Return.md) - [Model.SpecialModelName](docs/SpecialModelName.md) + - [Model.StringBooleanMap](docs/StringBooleanMap.md) - [Model.Tag](docs/Tag.md) - [Model.User](docs/User.md) diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/AnotherFakeApi.md b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/AnotherFakeApi.md index 2dca444f2768..81cc3106d64f 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/AnotherFakeApi.md +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/AnotherFakeApi.md @@ -4,16 +4,16 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**TestSpecialTags**](AnotherFakeApi.md#testspecialtags) | **PATCH** /another-fake/dummy | To test special tags +[**Call123TestSpecialTags**](AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags - -# **TestSpecialTags** -> ModelClient TestSpecialTags (ModelClient modelClient) + +# **Call123TestSpecialTags** +> ModelClient Call123TestSpecialTags (ModelClient modelClient) To test special tags -To test special tags +To test special tags and operation ID starting with number ### Example ```csharp @@ -25,7 +25,7 @@ using Org.OpenAPITools.Model; namespace Example { - public class TestSpecialTagsExample + public class Call123TestSpecialTagsExample { public void main() { @@ -35,12 +35,12 @@ namespace Example try { // To test special tags - ModelClient result = apiInstance.TestSpecialTags(modelClient); + ModelClient result = apiInstance.Call123TestSpecialTags(modelClient); Debug.WriteLine(result); } catch (Exception e) { - Debug.Print("Exception when calling AnotherFakeApi.TestSpecialTags: " + e.Message ); + Debug.Print("Exception when calling AnotherFakeApi.Call123TestSpecialTags: " + e.Message ); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/FakeApi.md b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/FakeApi.md index 2a4fb6094ae0..d51d29c09a6b 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/FakeApi.md +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/FakeApi.md @@ -8,6 +8,7 @@ Method | HTTP request | Description [**FakeOuterCompositeSerialize**](FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | [**FakeOuterNumberSerialize**](FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | [**FakeOuterStringSerialize**](FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | +[**TestBodyWithFileSchema**](FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | [**TestBodyWithQueryParams**](FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | [**TestClientModel**](FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model [**TestEndpointParameters**](FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -159,7 +160,7 @@ namespace Example public void main() { var apiInstance = new FakeApi(); - var body = 1.2; // decimal? | Input number as post body (optional) + var body = 1.2D; // decimal? | Input number as post body (optional) try { @@ -256,6 +257,65 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **TestBodyWithFileSchema** +> void TestBodyWithFileSchema (FileSchemaTestClass fileSchemaTestClass) + + + +For this test, the body for this request much reference a schema named `File`. + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestBodyWithFileSchemaExample + { + public void main() + { + var apiInstance = new FakeApi(); + var fileSchemaTestClass = new FileSchemaTestClass(); // FileSchemaTestClass | + + try + { + apiInstance.TestBodyWithFileSchema(fileSchemaTestClass); + } + catch (Exception e) + { + Debug.Print("Exception when calling FakeApi.TestBodyWithFileSchema: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **fileSchemaTestClass** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **TestBodyWithQueryParams** > void TestBodyWithQueryParams (string query, User user) @@ -404,13 +464,13 @@ namespace Example var apiInstance = new FakeApi(); var number = 8.14; // decimal? | None - var _double = 1.2; // double? | None + var _double = 1.2D; // double? | None var patternWithoutDelimiter = patternWithoutDelimiter_example; // string | None var _byte = BYTE_ARRAY_DATA_HERE; // byte[] | None var integer = 56; // int? | None (optional) var int32 = 56; // int? | None (optional) var int64 = 789; // long? | None (optional) - var _float = 3.4; // float? | None (optional) + var _float = 3.4F; // float? | None (optional) var _string = _string_example; // string | None (optional) var binary = BINARY_DATA_HERE; // System.IO.Stream | None (optional) var date = 2013-10-20; // DateTime? | None (optional) @@ -494,8 +554,8 @@ namespace Example var enumQueryStringArray = enumQueryStringArray_example; // List | Query parameter enum test (string array) (optional) var enumQueryString = enumQueryString_example; // string | Query parameter enum test (string) (optional) (default to -efg) var enumQueryInteger = 56; // int? | Query parameter enum test (double) (optional) - var enumQueryDouble = 1.2; // double? | Query parameter enum test (double) (optional) - var enumFormStringArray = enumFormStringArray_example; // List | Form parameter enum test (string array) (optional) (default to $) + var enumQueryDouble = 1.2D; // double? | Query parameter enum test (double) (optional) + var enumFormStringArray = new List(); // List | Form parameter enum test (string array) (optional) (default to $) var enumFormString = enumFormString_example; // string | Form parameter enum test (string) (optional) (default to -efg) try @@ -522,7 +582,7 @@ Name | Type | Description | Notes **enumQueryString** | **string**| Query parameter enum test (string) | [optional] [default to -efg] **enumQueryInteger** | **int?**| Query parameter enum test (double) | [optional] **enumQueryDouble** | **double?**| Query parameter enum test (double) | [optional] - **enumFormStringArray** | **List<string>**| Form parameter enum test (string array) | [optional] [default to $] + **enumFormStringArray** | [**List<string>**](string.md)| Form parameter enum test (string array) | [optional] [default to $] **enumFormString** | **string**| Form parameter enum test (string) | [optional] [default to -efg] ### Return type diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/File.md b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/File.md new file mode 100644 index 000000000000..acf85a4c001a --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/File.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.File +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**SourceURI** | **string** | Test capitalization | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/FileSchemaTestClass.md b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/FileSchemaTestClass.md new file mode 100644 index 000000000000..e0820fa4e650 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/FileSchemaTestClass.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.FileSchemaTestClass +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**File** | **System.IO.Stream** | | [optional] +**Files** | **List<System.IO.Stream>** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/MapTest.md b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/MapTest.md index 2baba08d8552..ee62dbf135fa 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/MapTest.md +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/MapTest.md @@ -5,6 +5,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **MapMapOfString** | **Dictionary<string, Dictionary<string, string>>** | | [optional] **MapOfEnumString** | **Dictionary<string, string>** | | [optional] +**DirectMap** | **Dictionary<string, bool?>** | | [optional] +**IndirectMap** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/PetApi.md b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/PetApi.md index 244ece53a318..dd23df9b3683 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/PetApi.md +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/PetApi.md @@ -12,6 +12,7 @@ Method | HTTP request | Description [**UpdatePet**](PetApi.md#updatepet) | **PUT** /pet | Update an existing pet [**UpdatePetWithForm**](PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data [**UploadFile**](PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image +[**UploadFileWithRequiredFile**](PetApi.md#uploadfilewithrequiredfile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) @@ -524,3 +525,69 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **UploadFileWithRequiredFile** +> ApiResponse UploadFileWithRequiredFile (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null) + +uploads an image (required) + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class UploadFileWithRequiredFileExample + { + public void main() + { + // Configure OAuth2 access token for authorization: petstore_auth + Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(); + var petId = 789; // long? | ID of pet to update + var requiredFile = BINARY_DATA_HERE; // System.IO.Stream | file to upload + var additionalMetadata = additionalMetadata_example; // string | Additional data to pass to server (optional) + + try + { + // uploads an image (required) + ApiResponse result = apiInstance.UploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling PetApi.UploadFileWithRequiredFile: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **long?**| ID of pet to update | + **requiredFile** | **System.IO.Stream**| file to upload | + **additionalMetadata** | **string**| Additional data to pass to server | [optional] + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/StringBooleanMap.md b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/StringBooleanMap.md new file mode 100644 index 000000000000..6e7a71368df7 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/StringBooleanMap.md @@ -0,0 +1,8 @@ +# Org.OpenAPITools.Model.StringBooleanMap +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs new file mode 100644 index 000000000000..bb47c43dc7a1 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs @@ -0,0 +1,88 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test +{ + /// + /// Class for testing FileSchemaTestClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + [TestFixture] + public class FileSchemaTestClassTests + { + // TODO uncomment below to declare an instance variable for FileSchemaTestClass + //private FileSchemaTestClass instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + // TODO uncomment below to create an instance of FileSchemaTestClass + //instance = new FileSchemaTestClass(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of FileSchemaTestClass + /// + [Test] + public void FileSchemaTestClassInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" FileSchemaTestClass + //Assert.IsInstanceOfType (instance, "variable 'instance' is a FileSchemaTestClass"); + } + + + /// + /// Test the property 'File' + /// + [Test] + public void FileTest() + { + // TODO unit test for the property 'File' + } + /// + /// Test the property 'Files' + /// + [Test] + public void FilesTest() + { + // TODO unit test for the property 'Files' + } + + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/FileTests.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/FileTests.cs new file mode 100644 index 000000000000..f1cf54c22e4d --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/FileTests.cs @@ -0,0 +1,80 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test +{ + /// + /// Class for testing File + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + [TestFixture] + public class FileTests + { + // TODO uncomment below to declare an instance variable for File + //private File instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + // TODO uncomment below to create an instance of File + //instance = new File(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of File + /// + [Test] + public void FileInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" File + //Assert.IsInstanceOfType (instance, "variable 'instance' is a File"); + } + + + /// + /// Test the property 'SourceURI' + /// + [Test] + public void SourceURITest() + { + // TODO unit test for the property 'SourceURI' + } + + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/StringBooleanMapTests.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/StringBooleanMapTests.cs new file mode 100644 index 000000000000..efc4cd907733 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/StringBooleanMapTests.cs @@ -0,0 +1,72 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test +{ + /// + /// Class for testing StringBooleanMap + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + [TestFixture] + public class StringBooleanMapTests + { + // TODO uncomment below to declare an instance variable for StringBooleanMap + //private StringBooleanMap instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + // TODO uncomment below to create an instance of StringBooleanMap + //instance = new StringBooleanMap(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of StringBooleanMap + /// + [Test] + public void StringBooleanMapInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" StringBooleanMap + //Assert.IsInstanceOfType (instance, "variable 'instance' is a StringBooleanMap"); + } + + + + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/AnotherFakeApi.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/AnotherFakeApi.cs index a636d07b7219..aacccf92ca50 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/AnotherFakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/AnotherFakeApi.cs @@ -28,46 +28,46 @@ public interface IAnotherFakeApi : IApiAccessor /// To test special tags /// /// - /// To test special tags + /// To test special tags and operation ID starting with number /// /// Thrown when fails to make API call /// client model /// ModelClient - ModelClient TestSpecialTags (ModelClient modelClient); + ModelClient Call123TestSpecialTags (ModelClient modelClient); /// /// To test special tags /// /// - /// To test special tags + /// To test special tags and operation ID starting with number /// /// Thrown when fails to make API call /// client model /// ApiResponse of ModelClient - ApiResponse TestSpecialTagsWithHttpInfo (ModelClient modelClient); + ApiResponse Call123TestSpecialTagsWithHttpInfo (ModelClient modelClient); #endregion Synchronous Operations #region Asynchronous Operations /// /// To test special tags /// /// - /// To test special tags + /// To test special tags and operation ID starting with number /// /// Thrown when fails to make API call /// client model /// Task of ModelClient - System.Threading.Tasks.Task TestSpecialTagsAsync (ModelClient modelClient); + System.Threading.Tasks.Task Call123TestSpecialTagsAsync (ModelClient modelClient); /// /// To test special tags /// /// - /// To test special tags + /// To test special tags and operation ID starting with number /// /// Thrown when fails to make API call /// client model /// Task of ApiResponse (ModelClient) - System.Threading.Tasks.Task> TestSpecialTagsAsyncWithHttpInfo (ModelClient modelClient); + System.Threading.Tasks.Task> Call123TestSpecialTagsAsyncWithHttpInfo (ModelClient modelClient); #endregion Asynchronous Operations } @@ -169,28 +169,28 @@ public void AddDefaultHeader(string key, string value) } /// - /// To test special tags To test special tags + /// To test special tags To test special tags and operation ID starting with number /// /// Thrown when fails to make API call /// client model /// ModelClient - public ModelClient TestSpecialTags (ModelClient modelClient) + public ModelClient Call123TestSpecialTags (ModelClient modelClient) { - ApiResponse localVarResponse = TestSpecialTagsWithHttpInfo(modelClient); + ApiResponse localVarResponse = Call123TestSpecialTagsWithHttpInfo(modelClient); return localVarResponse.Data; } /// - /// To test special tags To test special tags + /// To test special tags To test special tags and operation ID starting with number /// /// Thrown when fails to make API call /// client model /// ApiResponse of ModelClient - public ApiResponse< ModelClient > TestSpecialTagsWithHttpInfo (ModelClient modelClient) + public ApiResponse< ModelClient > Call123TestSpecialTagsWithHttpInfo (ModelClient modelClient) { // verify the required parameter 'modelClient' is set if (modelClient == null) - throw new ApiException(400, "Missing required parameter 'modelClient' when calling AnotherFakeApi->TestSpecialTags"); + throw new ApiException(400, "Missing required parameter 'modelClient' when calling AnotherFakeApi->Call123TestSpecialTags"); var localVarPath = "/another-fake/dummy"; var localVarPathParams = new Dictionary(); @@ -233,7 +233,7 @@ public ApiResponse< ModelClient > TestSpecialTagsWithHttpInfo (ModelClient model if (ExceptionFactory != null) { - Exception exception = ExceptionFactory("TestSpecialTags", localVarResponse); + Exception exception = ExceptionFactory("Call123TestSpecialTags", localVarResponse); if (exception != null) throw exception; } @@ -243,29 +243,29 @@ public ApiResponse< ModelClient > TestSpecialTagsWithHttpInfo (ModelClient model } /// - /// To test special tags To test special tags + /// To test special tags To test special tags and operation ID starting with number /// /// Thrown when fails to make API call /// client model /// Task of ModelClient - public async System.Threading.Tasks.Task TestSpecialTagsAsync (ModelClient modelClient) + public async System.Threading.Tasks.Task Call123TestSpecialTagsAsync (ModelClient modelClient) { - ApiResponse localVarResponse = await TestSpecialTagsAsyncWithHttpInfo(modelClient); + ApiResponse localVarResponse = await Call123TestSpecialTagsAsyncWithHttpInfo(modelClient); return localVarResponse.Data; } /// - /// To test special tags To test special tags + /// To test special tags To test special tags and operation ID starting with number /// /// Thrown when fails to make API call /// client model /// Task of ApiResponse (ModelClient) - public async System.Threading.Tasks.Task> TestSpecialTagsAsyncWithHttpInfo (ModelClient modelClient) + public async System.Threading.Tasks.Task> Call123TestSpecialTagsAsyncWithHttpInfo (ModelClient modelClient) { // verify the required parameter 'modelClient' is set if (modelClient == null) - throw new ApiException(400, "Missing required parameter 'modelClient' when calling AnotherFakeApi->TestSpecialTags"); + throw new ApiException(400, "Missing required parameter 'modelClient' when calling AnotherFakeApi->Call123TestSpecialTags"); var localVarPath = "/another-fake/dummy"; var localVarPathParams = new Dictionary(); @@ -308,7 +308,7 @@ public async System.Threading.Tasks.Task> TestSpecialTa if (ExceptionFactory != null) { - Exception exception = ExceptionFactory("TestSpecialTags", localVarResponse); + Exception exception = ExceptionFactory("Call123TestSpecialTags", localVarResponse); if (exception != null) throw exception; } diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/FakeApi.cs index 8974ba425708..60e219ead9d0 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/FakeApi.cs @@ -112,6 +112,27 @@ public interface IFakeApi : IApiAccessor /// /// /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// + void TestBodyWithFileSchema (FileSchemaTestClass fileSchemaTestClass); + + /// + /// + /// + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of Object(void) + ApiResponse TestBodyWithFileSchemaWithHttpInfo (FileSchemaTestClass fileSchemaTestClass); + /// + /// + /// + /// /// /// /// Thrown when fails to make API call @@ -368,6 +389,27 @@ public interface IFakeApi : IApiAccessor /// /// /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// Task of void + System.Threading.Tasks.Task TestBodyWithFileSchemaAsync (FileSchemaTestClass fileSchemaTestClass); + + /// + /// + /// + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// Task of ApiResponse + System.Threading.Tasks.Task> TestBodyWithFileSchemaAsyncWithHttpInfo (FileSchemaTestClass fileSchemaTestClass); + /// + /// + /// + /// /// /// /// Thrown when fails to make API call @@ -1198,6 +1240,151 @@ public async System.Threading.Tasks.Task> FakeOuterStringSer (string) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(string))); } + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// + public void TestBodyWithFileSchema (FileSchemaTestClass fileSchemaTestClass) + { + TestBodyWithFileSchemaWithHttpInfo(fileSchemaTestClass); + } + + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of Object(void) + public ApiResponse TestBodyWithFileSchemaWithHttpInfo (FileSchemaTestClass fileSchemaTestClass) + { + // verify the required parameter 'fileSchemaTestClass' is set + if (fileSchemaTestClass == null) + throw new ApiException(400, "Missing required parameter 'fileSchemaTestClass' when calling FakeApi->TestBodyWithFileSchema"); + + var localVarPath = "/fake/body-with-file-schema"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + "application/json" + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (fileSchemaTestClass != null && fileSchemaTestClass.GetType() != typeof(byte[])) + { + localVarPostBody = this.Configuration.ApiClient.Serialize(fileSchemaTestClass); // http body (model) parameter + } + else + { + localVarPostBody = fileSchemaTestClass; // byte array + } + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath, + Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("TestBodyWithFileSchema", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + null); + } + + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// Task of void + public async System.Threading.Tasks.Task TestBodyWithFileSchemaAsync (FileSchemaTestClass fileSchemaTestClass) + { + await TestBodyWithFileSchemaAsyncWithHttpInfo(fileSchemaTestClass); + + } + + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// Task of ApiResponse + public async System.Threading.Tasks.Task> TestBodyWithFileSchemaAsyncWithHttpInfo (FileSchemaTestClass fileSchemaTestClass) + { + // verify the required parameter 'fileSchemaTestClass' is set + if (fileSchemaTestClass == null) + throw new ApiException(400, "Missing required parameter 'fileSchemaTestClass' when calling FakeApi->TestBodyWithFileSchema"); + + var localVarPath = "/fake/body-with-file-schema"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + "application/json" + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (fileSchemaTestClass != null && fileSchemaTestClass.GetType() != typeof(byte[])) + { + localVarPostBody = this.Configuration.ApiClient.Serialize(fileSchemaTestClass); // http body (model) parameter + } + else + { + localVarPostBody = fileSchemaTestClass; // byte array + } + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath, + Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("TestBodyWithFileSchema", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + null); + } + /// /// /// diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/PetApi.cs index 9bfb712fd455..2fb6528b32e2 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/PetApi.cs @@ -202,6 +202,31 @@ public interface IPetApi : IApiAccessor /// file to upload (optional) /// ApiResponse of ApiResponse ApiResponse UploadFileWithHttpInfo (long? petId, string additionalMetadata = null, System.IO.Stream file = null); + /// + /// uploads an image (required) + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// ApiResponse + ApiResponse UploadFileWithRequiredFile (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null); + + /// + /// uploads an image (required) + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// ApiResponse of ApiResponse + ApiResponse UploadFileWithRequiredFileWithHttpInfo (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null); #endregion Synchronous Operations #region Asynchronous Operations /// @@ -382,6 +407,31 @@ public interface IPetApi : IApiAccessor /// file to upload (optional) /// Task of ApiResponse (ApiResponse) System.Threading.Tasks.Task> UploadFileAsyncWithHttpInfo (long? petId, string additionalMetadata = null, System.IO.Stream file = null); + /// + /// uploads an image (required) + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// Task of ApiResponse + System.Threading.Tasks.Task UploadFileWithRequiredFileAsync (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null); + + /// + /// uploads an image (required) + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// Task of ApiResponse (ApiResponse) + System.Threading.Tasks.Task> UploadFileWithRequiredFileAsyncWithHttpInfo (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null); #endregion Asynchronous Operations } @@ -1700,5 +1750,170 @@ public async System.Threading.Tasks.Task> UploadFileAsy (ApiResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(ApiResponse))); } + /// + /// uploads an image (required) + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// ApiResponse + public ApiResponse UploadFileWithRequiredFile (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null) + { + ApiResponse localVarResponse = UploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata); + return localVarResponse.Data; + } + + /// + /// uploads an image (required) + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// ApiResponse of ApiResponse + public ApiResponse< ApiResponse > UploadFileWithRequiredFileWithHttpInfo (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null) + { + // verify the required parameter 'petId' is set + if (petId == null) + throw new ApiException(400, "Missing required parameter 'petId' when calling PetApi->UploadFileWithRequiredFile"); + // verify the required parameter 'requiredFile' is set + if (requiredFile == null) + throw new ApiException(400, "Missing required parameter 'requiredFile' when calling PetApi->UploadFileWithRequiredFile"); + + var localVarPath = "/fake/{petId}/uploadImageWithRequiredFile"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + "multipart/form-data" + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/json" + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (petId != null) localVarPathParams.Add("petId", this.Configuration.ApiClient.ParameterToString(petId)); // path parameter + if (additionalMetadata != null) localVarFormParams.Add("additionalMetadata", this.Configuration.ApiClient.ParameterToString(additionalMetadata)); // form parameter + if (requiredFile != null) localVarFileParams.Add("requiredFile", this.Configuration.ApiClient.ParameterToFile("requiredFile", requiredFile)); + + // authentication (petstore_auth) required + // oauth required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath, + Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("UploadFileWithRequiredFile", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + (ApiResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(ApiResponse))); + } + + /// + /// uploads an image (required) + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// Task of ApiResponse + public async System.Threading.Tasks.Task UploadFileWithRequiredFileAsync (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null) + { + ApiResponse localVarResponse = await UploadFileWithRequiredFileAsyncWithHttpInfo(petId, requiredFile, additionalMetadata); + return localVarResponse.Data; + + } + + /// + /// uploads an image (required) + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// Task of ApiResponse (ApiResponse) + public async System.Threading.Tasks.Task> UploadFileWithRequiredFileAsyncWithHttpInfo (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null) + { + // verify the required parameter 'petId' is set + if (petId == null) + throw new ApiException(400, "Missing required parameter 'petId' when calling PetApi->UploadFileWithRequiredFile"); + // verify the required parameter 'requiredFile' is set + if (requiredFile == null) + throw new ApiException(400, "Missing required parameter 'requiredFile' when calling PetApi->UploadFileWithRequiredFile"); + + var localVarPath = "/fake/{petId}/uploadImageWithRequiredFile"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + "multipart/form-data" + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/json" + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (petId != null) localVarPathParams.Add("petId", this.Configuration.ApiClient.ParameterToString(petId)); // path parameter + if (additionalMetadata != null) localVarFormParams.Add("additionalMetadata", this.Configuration.ApiClient.ParameterToString(additionalMetadata)); // form parameter + if (requiredFile != null) localVarFileParams.Add("requiredFile", this.Configuration.ApiClient.ParameterToFile("requiredFile", requiredFile)); + + // authentication (petstore_auth) required + // oauth required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath, + Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("UploadFileWithRequiredFile", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + (ApiResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(ApiResponse))); + } + } } diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/EnumArrays.cs index 84c963b541d1..3e1da9ae80d1 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -39,18 +39,18 @@ public partial class EnumArrays : IEquatable, IValidatableObject [JsonConverter(typeof(StringEnumConverter))] public enum JustSymbolEnum { - /// /// Enum GreaterThanOrEqualTo for value: >= /// [EnumMember(Value = ">=")] GreaterThanOrEqualTo = 1, - + /// /// Enum Dollar for value: $ /// [EnumMember(Value = "$")] Dollar = 2 + } /// @@ -64,18 +64,18 @@ public enum JustSymbolEnum [JsonConverter(typeof(StringEnumConverter))] public enum ArrayEnumEnum { - /// /// Enum Fish for value: fish /// [EnumMember(Value = "fish")] Fish = 1, - + /// /// Enum Crab for value: crab /// [EnumMember(Value = "crab")] Crab = 2 + } diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/EnumClass.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/EnumClass.cs index d9646f5f98a1..a5ba8367ede3 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/EnumClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/EnumClass.cs @@ -34,24 +34,24 @@ namespace Org.OpenAPITools.Model public enum EnumClass { - /// /// Enum Abc for value: _abc /// [EnumMember(Value = "_abc")] Abc = 1, - + /// /// Enum Efg for value: -efg /// [EnumMember(Value = "-efg")] Efg = 2, - + /// /// Enum Xyz for value: (xyz) /// [EnumMember(Value = "(xyz)")] Xyz = 3 + } } diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/EnumTest.cs index 3df03c5ce07e..502347c7ec9a 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/EnumTest.cs @@ -39,24 +39,24 @@ public partial class EnumTest : IEquatable, IValidatableObject [JsonConverter(typeof(StringEnumConverter))] public enum EnumStringEnum { - /// /// Enum UPPER for value: UPPER /// [EnumMember(Value = "UPPER")] UPPER = 1, - + /// /// Enum Lower for value: lower /// [EnumMember(Value = "lower")] Lower = 2, - + /// /// Enum Empty for value: /// [EnumMember(Value = "")] Empty = 3 + } /// @@ -70,24 +70,24 @@ public enum EnumStringEnum [JsonConverter(typeof(StringEnumConverter))] public enum EnumStringRequiredEnum { - /// /// Enum UPPER for value: UPPER /// [EnumMember(Value = "UPPER")] UPPER = 1, - + /// /// Enum Lower for value: lower /// [EnumMember(Value = "lower")] Lower = 2, - + /// /// Enum Empty for value: /// [EnumMember(Value = "")] Empty = 3 + } /// @@ -100,18 +100,16 @@ public enum EnumStringRequiredEnum /// public enum EnumIntegerEnum { - /// /// Enum NUMBER_1 for value: 1 /// - NUMBER_1 = 1, - + /// /// Enum NUMBER_MINUS_1 for value: -1 /// - NUMBER_MINUS_1 = -1 + } /// @@ -125,18 +123,18 @@ public enum EnumIntegerEnum [JsonConverter(typeof(StringEnumConverter))] public enum EnumNumberEnum { - /// /// Enum NUMBER_1_DOT_1 for value: 1.1 /// [EnumMember(Value = "1.1")] NUMBER_1_DOT_1 = 1, - + /// /// Enum NUMBER_MINUS_1_DOT_2 for value: -1.2 /// [EnumMember(Value = "-1.2")] NUMBER_MINUS_1_DOT_2 = 2 + } /// diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/File.cs new file mode 100644 index 000000000000..685931366a49 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/File.cs @@ -0,0 +1,148 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using PropertyChanged; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// Must be named `File` for test. + /// + [DataContract] + [ImplementPropertyChanged] + public partial class File : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Test capitalization. + public File(string sourceURI = default(string)) + { + this.SourceURI = sourceURI; + } + + /// + /// Test capitalization + /// + /// Test capitalization + [DataMember(Name="sourceURI", EmitDefaultValue=false)] + public string SourceURI { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class File {\n"); + sb.Append(" SourceURI: ").Append(SourceURI).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as File); + } + + /// + /// Returns true if File instances are equal + /// + /// Instance of File to be compared + /// Boolean + public bool Equals(File input) + { + if (input == null) + return false; + + return + ( + this.SourceURI == input.SourceURI || + (this.SourceURI != null && + this.SourceURI.Equals(input.SourceURI)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.SourceURI != null) + hashCode = hashCode * 59 + this.SourceURI.GetHashCode(); + return hashCode; + } + } + + /// + /// Property changed event handler + /// + public event PropertyChangedEventHandler PropertyChanged; + + /// + /// Trigger when a property changed + /// + /// Property Name + public virtual void OnPropertyChanged(string propertyName) + { + // NOTE: property changed is handled via "code weaving" using Fody. + // Properties with setters are modified at compile time to notify of changes. + var propertyChanged = PropertyChanged; + if (propertyChanged != null) + { + propertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs new file mode 100644 index 000000000000..dc29a2ba8784 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -0,0 +1,163 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using PropertyChanged; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// FileSchemaTestClass + /// + [DataContract] + [ImplementPropertyChanged] + public partial class FileSchemaTestClass : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// file. + /// files. + public FileSchemaTestClass(System.IO.Stream file = default(System.IO.Stream), List files = default(List)) + { + this.File = file; + this.Files = files; + } + + /// + /// Gets or Sets File + /// + [DataMember(Name="file", EmitDefaultValue=false)] + public System.IO.Stream File { get; set; } + + /// + /// Gets or Sets Files + /// + [DataMember(Name="files", EmitDefaultValue=false)] + public List Files { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class FileSchemaTestClass {\n"); + sb.Append(" File: ").Append(File).Append("\n"); + sb.Append(" Files: ").Append(Files).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as FileSchemaTestClass); + } + + /// + /// Returns true if FileSchemaTestClass instances are equal + /// + /// Instance of FileSchemaTestClass to be compared + /// Boolean + public bool Equals(FileSchemaTestClass input) + { + if (input == null) + return false; + + return + ( + this.File == input.File || + (this.File != null && + this.File.Equals(input.File)) + ) && + ( + this.Files == input.Files || + this.Files != null && + this.Files.SequenceEqual(input.Files) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.File != null) + hashCode = hashCode * 59 + this.File.GetHashCode(); + if (this.Files != null) + hashCode = hashCode * 59 + this.Files.GetHashCode(); + return hashCode; + } + } + + /// + /// Property changed event handler + /// + public event PropertyChangedEventHandler PropertyChanged; + + /// + /// Trigger when a property changed + /// + /// Property Name + public virtual void OnPropertyChanged(string propertyName) + { + // NOTE: property changed is handled via "code weaving" using Fody. + // Properties with setters are modified at compile time to notify of changes. + var propertyChanged = PropertyChanged; + if (propertyChanged != null) + { + propertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/MapTest.cs index 3605af0dea13..ddaac33ee49b 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/MapTest.cs @@ -39,18 +39,18 @@ public partial class MapTest : IEquatable, IValidatableObject [JsonConverter(typeof(StringEnumConverter))] public enum InnerEnum { - /// /// Enum UPPER for value: UPPER /// [EnumMember(Value = "UPPER")] UPPER = 1, - + /// /// Enum Lower for value: lower /// [EnumMember(Value = "lower")] Lower = 2 + } @@ -64,10 +64,14 @@ public enum InnerEnum /// /// mapMapOfString. /// mapOfEnumString. - public MapTest(Dictionary> mapMapOfString = default(Dictionary>), Dictionary mapOfEnumString = default(Dictionary)) + /// directMap. + /// indirectMap. + public MapTest(Dictionary> mapMapOfString = default(Dictionary>), Dictionary mapOfEnumString = default(Dictionary), Dictionary directMap = default(Dictionary), StringBooleanMap indirectMap = default(StringBooleanMap)) { this.MapMapOfString = mapMapOfString; this.MapOfEnumString = mapOfEnumString; + this.DirectMap = directMap; + this.IndirectMap = indirectMap; } /// @@ -77,6 +81,18 @@ public enum InnerEnum public Dictionary> MapMapOfString { get; set; } + /// + /// Gets or Sets DirectMap + /// + [DataMember(Name="direct_map", EmitDefaultValue=false)] + public Dictionary DirectMap { get; set; } + + /// + /// Gets or Sets IndirectMap + /// + [DataMember(Name="indirect_map", EmitDefaultValue=false)] + public StringBooleanMap IndirectMap { get; set; } + /// /// Returns the string presentation of the object /// @@ -87,6 +103,8 @@ public override string ToString() sb.Append("class MapTest {\n"); sb.Append(" MapMapOfString: ").Append(MapMapOfString).Append("\n"); sb.Append(" MapOfEnumString: ").Append(MapOfEnumString).Append("\n"); + sb.Append(" DirectMap: ").Append(DirectMap).Append("\n"); + sb.Append(" IndirectMap: ").Append(IndirectMap).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -130,6 +148,16 @@ public bool Equals(MapTest input) this.MapOfEnumString == input.MapOfEnumString || this.MapOfEnumString != null && this.MapOfEnumString.SequenceEqual(input.MapOfEnumString) + ) && + ( + this.DirectMap == input.DirectMap || + this.DirectMap != null && + this.DirectMap.SequenceEqual(input.DirectMap) + ) && + ( + this.IndirectMap == input.IndirectMap || + (this.IndirectMap != null && + this.IndirectMap.Equals(input.IndirectMap)) ); } @@ -146,6 +174,10 @@ public override int GetHashCode() hashCode = hashCode * 59 + this.MapMapOfString.GetHashCode(); if (this.MapOfEnumString != null) hashCode = hashCode * 59 + this.MapOfEnumString.GetHashCode(); + if (this.DirectMap != null) + hashCode = hashCode * 59 + this.DirectMap.GetHashCode(); + if (this.IndirectMap != null) + hashCode = hashCode * 59 + this.IndirectMap.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/Order.cs index 7ab47f8c1c37..235777cad543 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/Order.cs @@ -40,24 +40,24 @@ public partial class Order : IEquatable, IValidatableObject [JsonConverter(typeof(StringEnumConverter))] public enum StatusEnum { - /// /// Enum Placed for value: placed /// [EnumMember(Value = "placed")] Placed = 1, - + /// /// Enum Approved for value: approved /// [EnumMember(Value = "approved")] Approved = 2, - + /// /// Enum Delivered for value: delivered /// [EnumMember(Value = "delivered")] Delivered = 3 + } /// diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/OuterEnum.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/OuterEnum.cs index 3399c560a84e..8ac5f891d0e9 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/OuterEnum.cs +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/OuterEnum.cs @@ -34,24 +34,24 @@ namespace Org.OpenAPITools.Model public enum OuterEnum { - /// /// Enum Placed for value: placed /// [EnumMember(Value = "placed")] Placed = 1, - + /// /// Enum Approved for value: approved /// [EnumMember(Value = "approved")] Approved = 2, - + /// /// Enum Delivered for value: delivered /// [EnumMember(Value = "delivered")] Delivered = 3 + } } diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/Pet.cs index 33d8c2ef5eb6..f1ffa5540c43 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/Pet.cs @@ -40,24 +40,24 @@ public partial class Pet : IEquatable, IValidatableObject [JsonConverter(typeof(StringEnumConverter))] public enum StatusEnum { - /// /// Enum Available for value: available /// [EnumMember(Value = "available")] Available = 1, - + /// /// Enum Pending for value: pending /// [EnumMember(Value = "pending")] Pending = 2, - + /// /// Enum Sold for value: sold /// [EnumMember(Value = "sold")] Sold = 3 + } /// diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/StringBooleanMap.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/StringBooleanMap.cs new file mode 100644 index 000000000000..e8c837ad5451 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/StringBooleanMap.cs @@ -0,0 +1,133 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using PropertyChanged; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// StringBooleanMap + /// + [DataContract] + [ImplementPropertyChanged] + public partial class StringBooleanMap : Dictionary, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + public StringBooleanMap() : base() + { + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class StringBooleanMap {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as StringBooleanMap); + } + + /// + /// Returns true if StringBooleanMap instances are equal + /// + /// Instance of StringBooleanMap to be compared + /// Boolean + public bool Equals(StringBooleanMap input) + { + if (input == null) + return false; + + return base.Equals(input); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = base.GetHashCode(); + return hashCode; + } + } + + /// + /// Property changed event handler + /// + public event PropertyChangedEventHandler PropertyChanged; + + /// + /// Trigger when a property changed + /// + /// Property Name + public virtual void OnPropertyChanged(string propertyName) + { + // NOTE: property changed is handled via "code weaving" using Fody. + // Properties with setters are modified at compile time to notify of changes. + var propertyChanged = PropertyChanged; + if (propertyChanged != null) + { + propertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +}