diff --git a/CI/samples.ci/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/CI/samples.ci/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index 0dcd528d4c6..629d78c375f 100644 --- a/CI/samples.ci/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/CI/samples.ci/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -7,85 +7,30 @@ This spec is mainly for testing Petstore server and contains fake endpoints, mod OpenAPI spec version: 1.0.0 --> - + + - Debug - AnyCPU - {19F1DEBC-DE5E-4517-8062-F000CD499087} - Library - Properties - Org.OpenAPITools.Test - Org.OpenAPITools.Test - v4.5.2 - 512 + netcoreapp2.0 + + false - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - $(SolutionDir)\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll - ..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll - ..\..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll - ..\..\vendor\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll - - - $(SolutionDir)\packages\JsonSubTypes.1.5.1\lib\net45\JsonSubTypes.dll - ..\packages\JsonSubTypes.1.5.1\lib\net45\JsonSubTypes.dll - ..\..\packages\JsonSubTypes.1.5.1\lib\net45\JsonSubTypes.dll - ..\..\vendor\JsonSubTypes.1.5.1\lib\net45\JsonSubTypes.dll - - - $(SolutionDir)\packages\RestSharp.106.5.4\lib\net452\RestSharp.dll - ..\packages\RestSharp.106.5.4\lib\net452\RestSharp.dll - ..\..\packages\RestSharp.106.5.4\lib\net452\RestSharp.dll - ..\..\vendor\RestSharp.106.5.4\lib\net452\RestSharp.dll - - - $(SolutionDir)\packages\NUnit.2.6.4\lib\nunit.framework.dll - ..\packages\NUnit.2.6.4\lib\nunit.framework.dll - ..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll - ..\..\vendor\NUnit.2.6.4\lib\nunit.framework.dll - - - - - - - - - + - {321C8C3F-0156-40C1-AE42-D59761FB9B6C} Org.OpenAPITools + + + + + + + + + + - diff --git a/CI/samples.ci/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/CI/samples.ci/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj new file mode 100644 index 00000000000..629d78c375f --- /dev/null +++ b/CI/samples.ci/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -0,0 +1,36 @@ + + + + + + netcoreapp2.0 + + false + + + + + Org.OpenAPITools + + + + + + + + + + + + + + + + diff --git a/appveyor.yml b/appveyor.yml index 5fad62b9aa5..298ccf96844 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,7 +1,7 @@ # for CI with appveyor.yml # Ref: http://www.yegor256.com/2015/01/10/windows-appveyor-maven.html version: '{branch}-{build}' -os: Windows Server 2012 +image: Visual Studio 2017 hosts: petstore.swagger.io: 127.0.0.1 install: @@ -23,9 +23,10 @@ install: - git clone https://github.com/wing328/swagger-samples - ps: Start-Process -FilePath 'C:\maven\apache-maven-3.2.5\bin\mvn' -ArgumentList 'jetty:run' -WorkingDirectory "$env:appveyor_build_folder\swagger-samples\java\java-jersey-jaxrs-ci" build_script: + - dotnet --info # build C# API client (refactor) - - nuget restore samples\client\petstore\csharp-refactor\OpenAPIClient\Org.OpenAPITools.sln - - msbuild samples\client\petstore\csharp-refactor\OpenAPIClient\Org.OpenAPITools.sln /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" + - dotnet build samples\client\petstore\csharp-refactor\OpenAPIClient\Org.OpenAPITools.sln + - dotnet build samples\client\petstore\csharp-refactor\OpenAPIClientCore\Org.OpenAPITools.sln # build C# API client - nuget restore samples\client\petstore\csharp\OpenAPIClient\Org.OpenAPITools.sln - msbuild samples\client\petstore\csharp\OpenAPIClient\Org.OpenAPITools.sln /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" @@ -41,7 +42,8 @@ test_script: # restore test-related files - copy /b/v/y CI\samples.ci\client\petstore\csharp\OpenAPIClient\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj samples\client\petstore\csharp\OpenAPIClient\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj # test c# API client (refactor) - - nunit-console samples\client\petstore\csharp-refactor\OpenAPIClient\src\Org.OpenAPITools.Test\bin\Debug\Org.OpenAPITools.Test.dll --result=myresults.xml;format=AppVeyor + - dotnet test samples\client\petstore\csharp-refactor\OpenAPIClient\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj + - dotnet test samples\client\petstore\csharp-refactor\OpenAPIClientCore\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj # test c# API client - nunit-console samples\client\petstore\csharp\OpenAPIClient\src\Org.OpenAPITools.Test\bin\Debug\Org.OpenAPITools.Test.dll --result=myresults.xml;format=AppVeyor # test c# API client (with PropertyChanged) diff --git a/bin/csharp-refactor-petstore-all.sh b/bin/csharp-refactor-petstore-all.sh index 635a8d7220b..ea4afcff5e1 100755 --- a/bin/csharp-refactor-petstore-all.sh +++ b/bin/csharp-refactor-petstore-all.sh @@ -1,17 +1,7 @@ #!/bin/sh -# C# Petstore API client (.NET 3.5) +# C# Petstore API client .NET Standard 2.0 ./bin/csharp-refactor-petstore.sh -# C# Petstore API client with PropertyChanged -./bin/csharp-refactor-property-changed-petstore.sh - -# C# Petstore API client (v5.0 for .net standarnd 1.3+) -./bin/csharp-refactor-petstore-net-standard.sh - -# C# Petstore API client (.NET 4.0) -./bin/csharp-refactor-petstore-net-40.sh - -# C# Petstore API client (.NET 3.5) -./bin/csharp-refactor-petstore-net-35.sh - +# C# Petstore API client .NET Core 2.0 +./bin/csharp-refactor-petstore-netcore.sh diff --git a/bin/csharp-refactor-petstore-netcore.sh b/bin/csharp-refactor-petstore-netcore.sh new file mode 100755 index 00000000000..fd764a6a920 --- /dev/null +++ b/bin/csharp-refactor-petstore-netcore.sh @@ -0,0 +1,38 @@ +#!/bin/sh + +SCRIPT="$0" +echo "# START SCRIPT: $SCRIPT" + +while [ -h "$SCRIPT" ] ; do + ls=`ls -ld "$SCRIPT"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + SCRIPT="$link" + else + SCRIPT=`dirname "$SCRIPT"`/"$link" + fi +done + +if [ ! -d "${APP_DIR}" ]; then + APP_DIR=`dirname "$SCRIPT"`/.. + APP_DIR=`cd "${APP_DIR}"; pwd` +fi + +executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar" +outdir="samples/client/petstore/csharp-refactor/OpenAPIClientCore" + +if [ ! -f "$executable" ] +then + mvn -B clean package +fi + +# if you've executed sbt assembly previously it will use that instead. +export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" +ags="generate -t modules/openapi-generator/src/main/resources/csharp-refactor/ -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g csharp-refactor -o ${outdir} --additional-properties packageGuid={321C8C3F-0156-40C1-AE42-D59761FB9B6C},useCompareNetObjects=true,targetFramework=netcoreapp2.0 $@" + +java $JAVA_OPTS -jar $executable $ags + +# restore csproj file +echo "restore csproject file: CI/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj" +cp ./CI/samples.ci/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj ./samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/ + diff --git a/docs/generators/csharp-refactor.md b/docs/generators/csharp-refactor.md index 34c55c16390..d9f57149000 100644 --- a/docs/generators/csharp-refactor.md +++ b/docs/generators/csharp-refactor.md @@ -12,7 +12,7 @@ sidebar_label: csharp-refactor |sourceFolder|source folder for generated code| |src| |packageGuid|The GUID that will be associated with the C# project| |null| |interfacePrefix|Prefix interfaces with a community standard or widely accepted prefix.| |I| -|targetFramework|The target .NET framework version.|
**v3.5**
.NET Framework 3.5 compatible
**v4.0**
.NET Framework 4.0 compatible
**v4.5.2**
.NET Framework 4.5.2+ compatible
**v5.0**
.NET Standard 1.3 compatible
**uwp**
Universal Windows Platform (IMPORTANT: this will be decommissioned and replaced by v5.0)
|v4.5.2| +|targetFramework|The target .NET framework version.|
**netstandard1.3**
.NET Standard 1.3 compatible
**netstandard1.4**
.NET Standard 1.4 compatible
**netstandard1.5**
.NET Standard 1.5 compatible
**netstandard1.6**
.NET Standard 1.6 compatible
**netstandard2.0**
.NET Standard 2.0 compatible
**netcoreapp2.0**
.NET Core 2.0 compatible
|v4.6.1| |modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |PascalCase| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true| |sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true| @@ -23,7 +23,6 @@ sidebar_label: csharp-refactor |optionalAssemblyInfo|Generate AssemblyInfo.cs.| |true| |optionalProjectFile|Generate {PackageName}.csproj.| |true| |optionalEmitDefaultValues|Set DataMember's EmitDefaultValue.| |false| -|generatePropertyChanged|Specifies a AssemblyDescription for the .NET Framework global assembly attributes stored in the AssemblyInfo file.| |false| |nonPublicApi|Generates code with reduced access modifiers; allows embedding elsewhere without exposing non-public API calls to consumers.| |false| |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |netCoreProjectFile|Use the new format (.NET Core) for .NET project files (.csproj).| |false| diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpRefactorClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpRefactorClientCodegen.java index a785fa340ac..00f74726d15 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpRefactorClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpRefactorClientCodegen.java @@ -27,26 +27,38 @@ import org.slf4j.LoggerFactory; import java.io.File; import java.util.*; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Consumer; import static org.apache.commons.lang3.StringUtils.isEmpty; import static org.openapitools.codegen.utils.StringUtils.camelize; import static org.openapitools.codegen.utils.StringUtils.underscore; +@SuppressWarnings("Duplicates") public class CSharpRefactorClientCodegen extends AbstractCSharpCodegen { + // Defines the sdk option for targeted frameworks, which differs from targetFramework and targetFrameworkNuget + protected static final String MCS_NET_VERSION_KEY = "x-mcs-sdk"; + protected static final String SUPPORTS_UWP = "supportsUWP"; + + protected static final String NET_STANDARD = "netStandard"; + + // Project Variable, determined from target framework. Not intended to be user-settable. + protected static final String TARGET_FRAMEWORK_IDENTIFIER = "targetFrameworkIdentifier"; + // Project Variable, determined from target framework. Not intended to be user-settable. + protected static final String TARGET_FRAMEWORK_VERSION = "targetFrameworkVersion"; + @SuppressWarnings({"hiding"}) private static final Logger LOGGER = LoggerFactory.getLogger(CSharpClientCodegen.class); - private static final String NET45 = "v4.5.2"; - private static final String NET40 = "v4.0"; - private static final String NET35 = "v3.5"; - // TODO: v5.0 is PCL, not netstandard version 1.3, and not a specific .NET Framework. This needs to be updated, - // especially because it will conflict with .NET Framework 5.0 when released, and PCL 5 refers to Framework 4.0. - // We should support either NETSTANDARD, PCL, or Both… but the concepts shouldn't be mixed. - private static final String NETSTANDARD = "v5.0"; - private static final String UWP = "uwp"; - - // Defines the sdk option for targeted frameworks, which differs from targetFramework and targetFrameworkNuget - private static final String MCS_NET_VERSION_KEY = "x-mcs-sdk"; - + private static final List frameworkStrategies = Arrays.asList( + FrameworkStrategy.NETSTANDARD_1_3, + FrameworkStrategy.NETSTANDARD_1_4, + FrameworkStrategy.NETSTANDARD_1_5, + FrameworkStrategy.NETSTANDARD_1_6, + FrameworkStrategy.NETSTANDARD_2_0, + FrameworkStrategy.NETCOREAPP_2_0 + ); + private static FrameworkStrategy defaultFramework = FrameworkStrategy.NETSTANDARD_2_0; + protected final Map frameworks; protected String packageGuid = "{" + java.util.UUID.randomUUID().toString().toUpperCase(Locale.ROOT) + "}"; protected String clientPackage = "Org.OpenAPITools.Client"; protected String localVariablePrefix = ""; @@ -54,23 +66,19 @@ public class CSharpRefactorClientCodegen extends AbstractCSharpCodegen { protected String modelDocPath = "docs/"; // Defines TargetFrameworkVersion in csproj files - protected String targetFramework = NET45; + protected String targetFramework = defaultFramework.dotNetFrameworkVersion; // Defines nuget identifiers for target framework - protected String targetFrameworkNuget = "net45"; + protected String targetFrameworkNuget = targetFramework; + protected boolean supportsAsync = Boolean.TRUE; - protected boolean supportsUWP = Boolean.FALSE; protected boolean netStandard = Boolean.FALSE; - protected boolean generatePropertyChanged = Boolean.FALSE; protected boolean validatable = Boolean.TRUE; protected Map regexModifiers; - protected final Map frameworks; - // By default, generated code is considered public protected boolean nonPublicApi = Boolean.FALSE; - public CSharpRefactorClientCodegen() { super(); @@ -130,13 +138,14 @@ public class CSharpRefactorClientCodegen extends AbstractCSharpCodegen { CodegenConstants.DOTNET_FRAMEWORK, CodegenConstants.DOTNET_FRAMEWORK_DESC ); - frameworks = new ImmutableMap.Builder() - .put(NET35, ".NET Framework 3.5 compatible") - .put(NET40, ".NET Framework 4.0 compatible") - .put(NET45, ".NET Framework 4.5.2+ compatible") - .put(NETSTANDARD, ".NET Standard 1.3 compatible") - .put(UWP, "Universal Windows Platform (IMPORTANT: this will be decommissioned and replaced by v5.0)") - .build(); + + ImmutableMap.Builder frameworkBuilder = new ImmutableMap.Builder<>(); + for (FrameworkStrategy frameworkStrategy : frameworkStrategies) { + frameworkBuilder.put(frameworkStrategy.name, frameworkStrategy.description); + } + + frameworks = frameworkBuilder.build(); + framework.defaultValue(this.targetFramework); framework.setEnum(frameworks); cliOptions.add(framework); @@ -181,10 +190,6 @@ public class CSharpRefactorClientCodegen extends AbstractCSharpCodegen { CodegenConstants.OPTIONAL_EMIT_DEFAULT_VALUES_DESC, this.optionalEmitDefaultValue); - addSwitch(CodegenConstants.GENERATE_PROPERTY_CHANGED, - CodegenConstants.PACKAGE_DESCRIPTION_DESC, - this.generatePropertyChanged); - // NOTE: This will reduce visibility of all public members in templates. Users can use InternalsVisibleTo // https://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.internalsvisibletoattribute(v=vs.110).aspx // to expose to shared code if the generated code is not embedded into another project. Otherwise, users of codegen @@ -205,7 +210,7 @@ public class CSharpRefactorClientCodegen extends AbstractCSharpCodegen { CodegenConstants.VALIDATABLE_DESC, this.validatable); - regexModifiers = new HashMap(); + regexModifiers = new HashMap<>(); regexModifiers.put('i', "IgnoreCase"); regexModifiers.put('m', "Multiline"); regexModifiers.put('s', "Singleline"); @@ -213,337 +218,13 @@ public class CSharpRefactorClientCodegen extends AbstractCSharpCodegen { } @Override - public void processOpts() { - super.processOpts(); - - /* - * NOTE: When supporting boolean additionalProperties, you should read the value and write it back as a boolean. - * This avoids oddities where additionalProperties contains "false" rather than false, which will cause the - * templating engine to behave unexpectedly. - * - * Use the pattern: - * if (additionalProperties.containsKey(prop)) convertPropertyToBooleanAndWriteBack(prop); - */ - - if (additionalProperties.containsKey(CodegenConstants.MODEL_PROPERTY_NAMING)) { - setModelPropertyNaming((String) additionalProperties.get(CodegenConstants.MODEL_PROPERTY_NAMING)); - } - - if (isEmpty(apiPackage)) { - setApiPackage("Api"); - } - if (isEmpty(modelPackage)) { - setModelPackage("Model"); - } - clientPackage = "Client"; - - Boolean excludeTests = false; - if (additionalProperties.containsKey(CodegenConstants.EXCLUDE_TESTS)) { - excludeTests = convertPropertyToBooleanAndWriteBack(CodegenConstants.EXCLUDE_TESTS); - } - - if (additionalProperties.containsKey(CodegenConstants.VALIDATABLE)) { - setValidatable(convertPropertyToBooleanAndWriteBack(CodegenConstants.VALIDATABLE)); - } else { - additionalProperties.put(CodegenConstants.VALIDATABLE, validatable); - } - - if (additionalProperties.containsKey(CodegenConstants.DOTNET_FRAMEWORK)) { - setTargetFramework((String) additionalProperties.get(CodegenConstants.DOTNET_FRAMEWORK)); - } else { - // Ensure default is set. - setTargetFramework(NET45); - additionalProperties.put(CodegenConstants.DOTNET_FRAMEWORK, this.targetFramework); - } - - if (NET35.equals(this.targetFramework)) { - // This is correct, mono will require you build .NET 3.5 sources using 4.0 SDK - additionalProperties.put(MCS_NET_VERSION_KEY, "4"); - additionalProperties.put("net35", true); - if (additionalProperties.containsKey(CodegenConstants.SUPPORTS_ASYNC)) { - LOGGER.warn(".NET 3.5 generator does not support async."); - additionalProperties.remove(CodegenConstants.SUPPORTS_ASYNC); - } - - setTargetFrameworkNuget("net35"); - setValidatable(Boolean.FALSE); - setSupportsAsync(Boolean.FALSE); - } else if (NETSTANDARD.equals(this.targetFramework)) { - // TODO: NETSTANDARD here is misrepresenting a PCL v5.0 which supports .NET Framework 4.6+, .NET Core 1.0, and Windows Universal 10.0 - additionalProperties.put(MCS_NET_VERSION_KEY, "4.6-api"); - if (additionalProperties.containsKey("supportsUWP")) { - LOGGER.warn(".NET " + NETSTANDARD + " generator does not support UWP."); - additionalProperties.remove("supportsUWP"); - } - - // TODO: NETSTANDARD=v5.0 and targetFrameworkNuget=netstandard1.3. These need to sync. - setTargetFrameworkNuget("netstandard1.3"); - setSupportsAsync(Boolean.TRUE); - setSupportsUWP(Boolean.FALSE); - setNetStandard(Boolean.TRUE); - - //Tests not yet implemented for .NET Standard codegen - //Todo implement it - excludeTests = true; - } else if (UWP.equals(this.targetFramework)) { - setTargetFrameworkNuget("uwp"); - setSupportsAsync(Boolean.TRUE); - setSupportsUWP(Boolean.TRUE); - } else if (NET40.equals(this.targetFramework)) { - additionalProperties.put(MCS_NET_VERSION_KEY, "4"); - additionalProperties.put("isNet40", true); - - if (additionalProperties.containsKey(CodegenConstants.SUPPORTS_ASYNC)) { - LOGGER.warn(".NET " + NET40 + " generator does not support async."); - additionalProperties.remove(CodegenConstants.SUPPORTS_ASYNC); - } - - setTargetFrameworkNuget("net40"); - setSupportsAsync(Boolean.FALSE); - } else { // 4.5+ - additionalProperties.put(MCS_NET_VERSION_KEY, "4.5.2-api"); - // some libs need 452 isntead of 45 in the config - additionalProperties.put("isNet452", true); - setTargetFrameworkNuget("net45"); - setSupportsAsync(Boolean.TRUE); - } - - if (additionalProperties.containsKey(CodegenConstants.GENERATE_PROPERTY_CHANGED)) { - if (NET35.equals(targetFramework)) { - LOGGER.warn(CodegenConstants.GENERATE_PROPERTY_CHANGED + " is only supported by generated code for .NET 4+."); - additionalProperties.remove(CodegenConstants.GENERATE_PROPERTY_CHANGED); - } else if (NETSTANDARD.equals(targetFramework)) { - LOGGER.warn(CodegenConstants.GENERATE_PROPERTY_CHANGED + " is not supported in .NET Standard generated code."); - additionalProperties.remove(CodegenConstants.GENERATE_PROPERTY_CHANGED); - } else if (Boolean.TRUE.equals(netCoreProjectFileFlag)) { - LOGGER.warn(CodegenConstants.GENERATE_PROPERTY_CHANGED + " is not supported in .NET Core csproj project format."); - additionalProperties.remove(CodegenConstants.GENERATE_PROPERTY_CHANGED); - } else { - setGeneratePropertyChanged(convertPropertyToBooleanAndWriteBack(CodegenConstants.GENERATE_PROPERTY_CHANGED)); - } - } - - additionalProperties.put(CodegenConstants.API_PACKAGE, apiPackage); - additionalProperties.put(CodegenConstants.MODEL_PACKAGE, modelPackage); - additionalProperties.put("clientPackage", clientPackage); - - additionalProperties.put(CodegenConstants.EXCLUDE_TESTS, excludeTests); - additionalProperties.put(CodegenConstants.VALIDATABLE, this.validatable); - additionalProperties.put(CodegenConstants.SUPPORTS_ASYNC, this.supportsAsync); - additionalProperties.put("supportsUWP", this.supportsUWP); - additionalProperties.put("netStandard", this.netStandard); - additionalProperties.put("targetFrameworkNuget", this.targetFrameworkNuget); - - // TODO: either remove this and update templates to match the "optionalEmitDefaultValues" property, or rename that property. - additionalProperties.put("emitDefaultValue", optionalEmitDefaultValue); - - if (additionalProperties.containsKey(CodegenConstants.OPTIONAL_PROJECT_FILE)) { - setOptionalProjectFileFlag(convertPropertyToBooleanAndWriteBack(CodegenConstants.OPTIONAL_PROJECT_FILE)); - } else { - additionalProperties.put(CodegenConstants.OPTIONAL_PROJECT_FILE, optionalProjectFileFlag); - } - - if (additionalProperties.containsKey(CodegenConstants.OPTIONAL_PROJECT_GUID)) { - setPackageGuid((String) additionalProperties.get(CodegenConstants.OPTIONAL_PROJECT_GUID)); - } else { - additionalProperties.put(CodegenConstants.OPTIONAL_PROJECT_GUID, packageGuid); - } - - if (additionalProperties.containsKey(CodegenConstants.OPTIONAL_METHOD_ARGUMENT)) { - setOptionalMethodArgumentFlag(convertPropertyToBooleanAndWriteBack(CodegenConstants.OPTIONAL_METHOD_ARGUMENT)); - } else { - additionalProperties.put(CodegenConstants.OPTIONAL_METHOD_ARGUMENT, optionalMethodArgumentFlag); - } - - if (additionalProperties.containsKey(CodegenConstants.OPTIONAL_ASSEMBLY_INFO)) { - setOptionalAssemblyInfoFlag(convertPropertyToBooleanAndWriteBack(CodegenConstants.OPTIONAL_ASSEMBLY_INFO)); - } else { - additionalProperties.put(CodegenConstants.OPTIONAL_ASSEMBLY_INFO, optionalAssemblyInfoFlag); - } - - if (additionalProperties.containsKey(CodegenConstants.NON_PUBLIC_API)) { - setNonPublicApi(convertPropertyToBooleanAndWriteBack(CodegenConstants.NON_PUBLIC_API)); - } else { - additionalProperties.put(CodegenConstants.NON_PUBLIC_API, isNonPublicApi()); - } - - final String testPackageName = testPackageName(); - String packageFolder = sourceFolder + File.separator + packageName; - String clientPackageDir = packageFolder + File.separator + clientPackage; - String testPackageFolder = testFolder + File.separator + testPackageName; - - additionalProperties.put("testPackageName", testPackageName); - - //Compute the relative path to the bin directory where the external assemblies live - //This is necessary to properly generate the project file - int packageDepth = packageFolder.length() - packageFolder.replace(java.io.File.separator, "").length(); - String binRelativePath = "..\\"; - for (int i = 0; i < packageDepth; i = i + 1) - binRelativePath += "..\\"; - binRelativePath += "vendor"; - additionalProperties.put("binRelativePath", binRelativePath); - - supportingFiles.add(new SupportingFile("IApiAccessor.mustache", - clientPackageDir, "IApiAccessor.cs")); - supportingFiles.add(new SupportingFile("Configuration.mustache", - clientPackageDir, "Configuration.cs")); - supportingFiles.add(new SupportingFile("ApiClient.mustache", - clientPackageDir, "ApiClient.cs")); - supportingFiles.add(new SupportingFile("ApiException.mustache", - clientPackageDir, "ApiException.cs")); - supportingFiles.add(new SupportingFile("ApiResponse.mustache", - clientPackageDir, "ApiResponse.cs")); - supportingFiles.add(new SupportingFile("ExceptionFactory.mustache", - clientPackageDir, "ExceptionFactory.cs")); - supportingFiles.add(new SupportingFile("OpenAPIDateConverter.mustache", - clientPackageDir, "OpenAPIDateConverter.cs")); - - supportingFiles.add(new SupportingFile("ClientUtils.mustache", - clientPackageDir, "ClientUtils.cs")); - supportingFiles.add(new SupportingFile("HttpMethod.mustache", - clientPackageDir, "HttpMethod.cs")); - supportingFiles.add(new SupportingFile("IAsynchronousClient.mustache", - clientPackageDir, "IAsynchronousClient.cs")); - supportingFiles.add(new SupportingFile("ISynchronousClient.mustache", - clientPackageDir, "ISynchronousClient.cs")); - supportingFiles.add(new SupportingFile("RequestOptions.mustache", - clientPackageDir, "RequestOptions.cs")); - supportingFiles.add(new SupportingFile("Multimap.mustache", - clientPackageDir, "Multimap.cs")); - - if (Boolean.FALSE.equals(this.netStandard) && Boolean.FALSE.equals(this.netCoreProjectFileFlag)) { - supportingFiles.add(new SupportingFile("compile.mustache", "", "build.bat")); - supportingFiles.add(new SupportingFile("compile-mono.sh.mustache", "", "build.sh")); - - // copy package.config to nuget's standard location for project-level installs - supportingFiles.add(new SupportingFile("packages.config.mustache", packageFolder + File.separator, "packages.config")); - // .travis.yml for travis-ci.org CI - supportingFiles.add(new SupportingFile("travis.mustache", "", ".travis.yml")); - } else if (Boolean.FALSE.equals(this.netCoreProjectFileFlag)) { - supportingFiles.add(new SupportingFile("project.json.mustache", packageFolder + File.separator, "project.json")); - } - - supportingFiles.add(new SupportingFile("IReadableConfiguration.mustache", - clientPackageDir, "IReadableConfiguration.cs")); - supportingFiles.add(new SupportingFile("GlobalConfiguration.mustache", - clientPackageDir, "GlobalConfiguration.cs")); - - // Only write out test related files if excludeTests is unset or explicitly set to false (see start of this method) - if (Boolean.FALSE.equals(excludeTests)) { - // shell script to run the nunit test - supportingFiles.add(new SupportingFile("mono_nunit_test.mustache", "", "mono_nunit_test.sh")); - - modelTestTemplateFiles.put("model_test.mustache", ".cs"); - apiTestTemplateFiles.put("api_test.mustache", ".cs"); - - if (Boolean.FALSE.equals(this.netCoreProjectFileFlag)) { - supportingFiles.add(new SupportingFile("packages_test.config.mustache", testPackageFolder + File.separator, "packages.config")); - } - - if (NET40.equals(this.targetFramework)) { - // Include minimal tests for modifications made to JsonSubTypes, since code is quite different for .net 4.0 from original implementation - supportingFiles.add(new SupportingFile("JsonSubTypesTests.mustache", - testPackageFolder + File.separator + "Client", - "JsonSubTypesTests.cs")); - } - } - - if (Boolean.TRUE.equals(generatePropertyChanged)) { - supportingFiles.add(new SupportingFile("FodyWeavers.xml", packageFolder, "FodyWeavers.xml")); - } - - supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); - supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); - supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore")); - - if (optionalAssemblyInfoFlag && Boolean.FALSE.equals(this.netCoreProjectFileFlag)) { - supportingFiles.add(new SupportingFile("AssemblyInfo.mustache", packageFolder + File.separator + "Properties", "AssemblyInfo.cs")); - } - if (optionalProjectFileFlag) { - supportingFiles.add(new SupportingFile("Solution.mustache", "", packageName + ".sln")); - - if (Boolean.TRUE.equals(this.netCoreProjectFileFlag)) { - supportingFiles.add(new SupportingFile("netcore_project.mustache", packageFolder, packageName + ".csproj")); - } else { - supportingFiles.add(new SupportingFile("Project.mustache", packageFolder, packageName + ".csproj")); - if (Boolean.FALSE.equals(this.netStandard)) { - supportingFiles.add(new SupportingFile("nuspec.mustache", packageFolder, packageName + ".nuspec")); - } - } - - if (Boolean.FALSE.equals(excludeTests)) { - // NOTE: This exists here rather than previous excludeTests block because the test project is considered an optional project file. - if (Boolean.TRUE.equals(this.netCoreProjectFileFlag)) { - supportingFiles.add(new SupportingFile("netcore_testproject.mustache", testPackageFolder, testPackageName + ".csproj")); - } else { - supportingFiles.add(new SupportingFile("TestProject.mustache", testPackageFolder, testPackageName + ".csproj")); - } - } - } - - additionalProperties.put("apiDocPath", apiDocPath); - additionalProperties.put("modelDocPath", modelDocPath); - } - - public void setModelPropertyNaming(String naming) { - if ("original".equals(naming) || "camelCase".equals(naming) || - "PascalCase".equals(naming) || "snake_case".equals(naming)) { - this.modelPropertyNaming = naming; - } else { - throw new IllegalArgumentException("Invalid model property naming '" + - naming + "'. Must be 'original', 'camelCase', " + - "'PascalCase' or 'snake_case'"); - } - } - - public String getModelPropertyNaming() { - return this.modelPropertyNaming; + public String apiDocFileFolder() { + return (outputFolder + "/" + apiDocPath).replace('/', File.separatorChar); } @Override - public Map postProcessOperationsWithModels(Map objs, List allModels) { - super.postProcessOperationsWithModels(objs, allModels); - if (objs != null) { - Map operations = (Map) objs.get("operations"); - if (operations != null) { - List ops = (List) operations.get("operation"); - for (CodegenOperation operation : ops) { - if (operation.returnType != null) { - operation.returnContainer = operation.returnType; - if (this.returnICollection && ( - operation.returnType.startsWith("List") || - operation.returnType.startsWith("Collection"))) { - // NOTE: ICollection works for both List and Collection - int genericStart = operation.returnType.indexOf("<"); - if (genericStart > 0) { - operation.returnType = "ICollection" + operation.returnType.substring(genericStart); - } - } - } - } - } - } - - return objs; - } - - @Override - public CodegenType getTag() { - return CodegenType.CLIENT; - } - - @Override - public String getName() { - return "csharp-refactor"; - } - - @Override - public String getHelp() { - return "Generates a CSharp client library."; - } - - public void setOptionalAssemblyInfoFlag(boolean flag) { - this.optionalAssemblyInfoFlag = flag; + public String apiTestFileFolder() { + return outputFolder + File.separator + testFolder + File.separator + testPackageName() + File.separator + apiPackage(); } @Override @@ -603,12 +284,117 @@ public class CSharpRefactorClientCodegen extends AbstractCSharpCodegen { return codegenModel; } - public void setOptionalProjectFileFlag(boolean flag) { - this.optionalProjectFileFlag = flag; + @Override + public String getHelp() { + return "Generates a CSharp client library."; } - public void setPackageGuid(String packageGuid) { - this.packageGuid = packageGuid; +// private void syncStringProperty(Map properties, String key) + + public String getModelPropertyNaming() { + return this.modelPropertyNaming; + } + + public void setModelPropertyNaming(String naming) { + if ("original".equals(naming) || "camelCase".equals(naming) || + "PascalCase".equals(naming) || "snake_case".equals(naming)) { + this.modelPropertyNaming = naming; + } else { + throw new IllegalArgumentException("Invalid model property naming '" + + naming + "'. Must be 'original', 'camelCase', " + + "'PascalCase' or 'snake_case'"); + } + } + + @Override + public String getName() { + return "csharp-refactor"; + } + + public String getNameUsingModelPropertyNaming(String name) { + switch (CodegenConstants.MODEL_PROPERTY_NAMING_TYPE.valueOf(getModelPropertyNaming())) { + case original: + return name; + case camelCase: + return camelize(name, true); + case PascalCase: + return camelize(name); + case snake_case: + return underscore(name); + default: + throw new IllegalArgumentException("Invalid model property naming '" + + name + "'. Must be 'original', 'camelCase', " + + "'PascalCase' or 'snake_case'"); + } + } + + @Override + public String getNullableType(Schema p, String type) { + if (languageSpecificPrimitives.contains(type)) { + if (isSupportNullable() && ModelUtils.isNullable(p) && nullableType.contains(type)) { + return type + "?"; + } else { + return type; + } + } else { + return null; + } + } + + @Override + public CodegenType getTag() { + return CodegenType.CLIENT; + } + + public boolean isNonPublicApi() { + return nonPublicApi; + } + + public void setNonPublicApi(final boolean nonPublicApi) { + this.nonPublicApi = nonPublicApi; + } + + @Override + public String modelDocFileFolder() { + return (outputFolder + "/" + modelDocPath).replace('/', File.separatorChar); + } + + @Override + public String modelTestFileFolder() { + return outputFolder + File.separator + testFolder + File.separator + testPackageName() + File.separator + modelPackage(); + } + + @Override + public void postProcessModelProperty(CodegenModel model, CodegenProperty property) { + postProcessPattern(property.pattern, property.vendorExtensions); + super.postProcessModelProperty(model, property); + } + + @Override + public Map postProcessOperationsWithModels(Map objs, List allModels) { + super.postProcessOperationsWithModels(objs, allModels); + if (objs != null) { + Map operations = (Map) objs.get("operations"); + if (operations != null) { + List ops = (List) operations.get("operation"); + for (CodegenOperation operation : ops) { + if (operation.returnType != null) { + operation.returnContainer = operation.returnType; + if (this.returnICollection && ( + operation.returnType.startsWith("List") || + operation.returnType.startsWith("Collection"))) { + // NOTE: ICollection works for both List and Collection + int genericStart = operation.returnType.indexOf("<"); + if (genericStart > 0) { + operation.returnType = "ICollection" + operation.returnType.substring(genericStart); + } + } + } + } + } + } + + return objs; } @Override @@ -621,12 +407,6 @@ public class CSharpRefactorClientCodegen extends AbstractCSharpCodegen { } } - @Override - public void postProcessModelProperty(CodegenModel model, CodegenProperty property) { - postProcessPattern(property.pattern, property.vendorExtensions); - super.postProcessModelProperty(model, property); - } - /* * The pattern spec follows the Perl convention and style of modifiers. .NET * does not support this syntax directly so we need to convert the pattern to a .NET compatible @@ -663,6 +443,192 @@ public class CSharpRefactorClientCodegen extends AbstractCSharpCodegen { } } + @Override + public Mustache.Compiler processCompiler(Mustache.Compiler compiler) { + // To avoid unexpected behaviors when options are passed programmatically such as { "supportsAsync": "" } + return super.processCompiler(compiler).emptyStringIsFalse(true); + } + + @Override + public void processOpts() { + super.processOpts(); + + /* + * NOTE: When supporting boolean additionalProperties, you should read the value and write it back as a boolean. + * This avoids oddities where additionalProperties contains "false" rather than false, which will cause the + * templating engine to behave unexpectedly. + * + * Use the pattern: + * if (additionalProperties.containsKey(prop)) convertPropertyToBooleanAndWriteBack(prop); + */ + + if (additionalProperties.containsKey(CodegenConstants.MODEL_PROPERTY_NAMING)) { + setModelPropertyNaming((String) additionalProperties.get(CodegenConstants.MODEL_PROPERTY_NAMING)); + } + + if (isEmpty(apiPackage)) { + setApiPackage("Api"); + } + if (isEmpty(modelPackage)) { + setModelPackage("Model"); + } + clientPackage = "Client"; + + String framework = (String) additionalProperties.getOrDefault(CodegenConstants.DOTNET_FRAMEWORK, defaultFramework.dotNetFrameworkVersion); + FrameworkStrategy strategy = defaultFramework; + for (FrameworkStrategy frameworkStrategy : frameworkStrategies) { + if (framework.equals(frameworkStrategy.name)) { + strategy = frameworkStrategy; + } + } + + strategy.configureAdditionalProperties(additionalProperties); + + setTargetFrameworkNuget(strategy.getNugetFrameworkIdentifier()); + setTargetFramework(strategy.dotNetFrameworkVersion); + + if (strategy != FrameworkStrategy.NETSTANDARD_2_0) { + LOGGER.warn("If using built-in templates-RestSharp only supports netstandard 2.0 or later."); + } + + setSupportsAsync(Boolean.TRUE); + setNetStandard(strategy.isNetStandard); + setNetCoreProjectFileFlag(!strategy.isNetStandard); + + if (additionalProperties.containsKey(CodegenConstants.GENERATE_PROPERTY_CHANGED)) { + LOGGER.warn(CodegenConstants.GENERATE_PROPERTY_CHANGED + " is not supported in the .NET Standard generator."); + additionalProperties.remove(CodegenConstants.GENERATE_PROPERTY_CHANGED); + } + + final AtomicReference excludeTests = new AtomicReference<>(); + syncBooleanProperty(additionalProperties, CodegenConstants.EXCLUDE_TESTS, excludeTests::set, false); + + syncStringProperty(additionalProperties, "clientPackage", (s) -> { }, clientPackage); + + syncStringProperty(additionalProperties, CodegenConstants.API_PACKAGE, this::setApiPackage, apiPackage); + syncStringProperty(additionalProperties, CodegenConstants.MODEL_PACKAGE, this::setModelPackage, modelPackage); + syncStringProperty(additionalProperties, CodegenConstants.OPTIONAL_PROJECT_GUID, this::setPackageGuid, packageGuid); + syncStringProperty(additionalProperties, "targetFrameworkNuget", this::setTargetFrameworkNuget, this.targetFrameworkNuget); + + syncBooleanProperty(additionalProperties, "netStandard", this::setNetStandard, this.netStandard); + + // TODO: either remove this and update templates to match the "optionalEmitDefaultValues" property, or rename that property. + syncBooleanProperty(additionalProperties, "emitDefaultValue", this::setOptionalEmitDefaultValue, optionalEmitDefaultValue); + syncBooleanProperty(additionalProperties, CodegenConstants.VALIDATABLE, this::setValidatable, this.validatable); + syncBooleanProperty(additionalProperties, CodegenConstants.SUPPORTS_ASYNC, this::setSupportsAsync, this.supportsAsync); + syncBooleanProperty(additionalProperties, CodegenConstants.OPTIONAL_PROJECT_FILE, this::setOptionalProjectFileFlag, optionalProjectFileFlag); + syncBooleanProperty(additionalProperties, CodegenConstants.OPTIONAL_METHOD_ARGUMENT, this::setOptionalMethodArgumentFlag, optionalMethodArgumentFlag); + syncBooleanProperty(additionalProperties, CodegenConstants.OPTIONAL_ASSEMBLY_INFO, this::setOptionalAssemblyInfoFlag, optionalAssemblyInfoFlag); + syncBooleanProperty(additionalProperties, CodegenConstants.NON_PUBLIC_API, this::setNonPublicApi, isNonPublicApi()); + + final String testPackageName = testPackageName(); + String packageFolder = sourceFolder + File.separator + packageName; + String clientPackageDir = packageFolder + File.separator + clientPackage; + String testPackageFolder = testFolder + File.separator + testPackageName; + + additionalProperties.put("testPackageName", testPackageName); + + //Compute the relative path to the bin directory where the external assemblies live + //This is necessary to properly generate the project file + int packageDepth = packageFolder.length() - packageFolder.replace(java.io.File.separator, "").length(); + String binRelativePath = "..\\"; + for (int i = 0; i < packageDepth; i = i + 1) { + binRelativePath += "..\\"; + } + binRelativePath += "vendor"; + additionalProperties.put("binRelativePath", binRelativePath); + + supportingFiles.add(new SupportingFile("IApiAccessor.mustache", clientPackageDir, "IApiAccessor.cs")); + supportingFiles.add(new SupportingFile("Configuration.mustache", clientPackageDir, "Configuration.cs")); + supportingFiles.add(new SupportingFile("ApiClient.mustache", clientPackageDir, "ApiClient.cs")); + supportingFiles.add(new SupportingFile("ApiException.mustache", clientPackageDir, "ApiException.cs")); + supportingFiles.add(new SupportingFile("ApiResponse.mustache", clientPackageDir, "ApiResponse.cs")); + supportingFiles.add(new SupportingFile("ExceptionFactory.mustache", clientPackageDir, "ExceptionFactory.cs")); + supportingFiles.add(new SupportingFile("OpenAPIDateConverter.mustache", clientPackageDir, "OpenAPIDateConverter.cs")); + supportingFiles.add(new SupportingFile("ClientUtils.mustache", clientPackageDir, "ClientUtils.cs")); + supportingFiles.add(new SupportingFile("HttpMethod.mustache", clientPackageDir, "HttpMethod.cs")); + supportingFiles.add(new SupportingFile("IAsynchronousClient.mustache", clientPackageDir, "IAsynchronousClient.cs")); + supportingFiles.add(new SupportingFile("ISynchronousClient.mustache", clientPackageDir, "ISynchronousClient.cs")); + supportingFiles.add(new SupportingFile("RequestOptions.mustache", clientPackageDir, "RequestOptions.cs")); + supportingFiles.add(new SupportingFile("Multimap.mustache", clientPackageDir, "Multimap.cs")); + + if (Boolean.FALSE.equals(this.netCoreProjectFileFlag)) { + supportingFiles.add(new SupportingFile("project.json.mustache", packageFolder + File.separator, "project.json")); + } + + supportingFiles.add(new SupportingFile("IReadableConfiguration.mustache", + clientPackageDir, "IReadableConfiguration.cs")); + supportingFiles.add(new SupportingFile("GlobalConfiguration.mustache", + clientPackageDir, "GlobalConfiguration.cs")); + + // Only write out test related files if excludeTests is unset or explicitly set to false (see start of this method) + if (Boolean.FALSE.equals(excludeTests.get())) { + modelTestTemplateFiles.put("model_test.mustache", ".cs"); + apiTestTemplateFiles.put("api_test.mustache", ".cs"); + } + + supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); + supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); + supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore")); + + if (optionalAssemblyInfoFlag && Boolean.FALSE.equals(this.netCoreProjectFileFlag)) { + supportingFiles.add(new SupportingFile("AssemblyInfo.mustache", packageFolder + File.separator + "Properties", "AssemblyInfo.cs")); + } + + if (optionalProjectFileFlag) { + supportingFiles.add(new SupportingFile("Solution.mustache", "", packageName + ".sln")); + + if (Boolean.TRUE.equals(this.netCoreProjectFileFlag)) { + supportingFiles.add(new SupportingFile("netcore_project.mustache", packageFolder, packageName + ".csproj")); + } else { + supportingFiles.add(new SupportingFile("Project.mustache", packageFolder, packageName + ".csproj")); + if (Boolean.FALSE.equals(this.netStandard)) { + supportingFiles.add(new SupportingFile("nuspec.mustache", packageFolder, packageName + ".nuspec")); + } + } + + if (Boolean.FALSE.equals(excludeTests.get())) { + // NOTE: This exists here rather than previous excludeTests block because the test project is considered an optional project file. + if (Boolean.TRUE.equals(this.netCoreProjectFileFlag)) { + supportingFiles.add(new SupportingFile("netcore_testproject.mustache", testPackageFolder, testPackageName + ".csproj")); + } else { + supportingFiles.add(new SupportingFile("TestProject.mustache", testPackageFolder, testPackageName + ".csproj")); + } + } + } + + additionalProperties.put("apiDocPath", apiDocPath); + additionalProperties.put("modelDocPath", modelDocPath); + } + + public void setNetStandard(Boolean netStandard) { + this.netStandard = netStandard; + } + + public void setOptionalAssemblyInfoFlag(boolean flag) { + this.optionalAssemblyInfoFlag = flag; + } + + public void setOptionalProjectFileFlag(boolean flag) { + this.optionalProjectFileFlag = flag; + } + + public void setPackageGuid(String packageGuid) { + this.packageGuid = packageGuid; + } + + public void setPackageName(String packageName) { + this.packageName = packageName; + } + + public void setPackageVersion(String packageVersion) { + this.packageVersion = packageVersion; + } + + public void setSupportsAsync(Boolean supportsAsync) { + this.supportsAsync = supportsAsync; + } + public void setTargetFramework(String dotnetFramework) { if (!frameworks.containsKey(dotnetFramework)) { LOGGER.warn("Invalid .NET framework version, defaulting to " + this.targetFramework); @@ -672,6 +638,73 @@ public class CSharpRefactorClientCodegen extends AbstractCSharpCodegen { LOGGER.info("Generating code for .NET Framework " + this.targetFramework); } + public void setTargetFrameworkNuget(String targetFrameworkNuget) { + this.targetFrameworkNuget = targetFrameworkNuget; + } + + public void setValidatable(boolean validatable) { + this.validatable = validatable; + } + + @Override + public String toEnumVarName(String value, String datatype) { + if (value.length() == 0) { + return "Empty"; + } + + // for symbol, e.g. $, # + if (getSymbolName(value) != null) { + return camelize(getSymbolName(value)); + } + + // number + if (datatype.startsWith("int") || datatype.startsWith("long") || + datatype.startsWith("double") || datatype.startsWith("float")) { + String varName = "NUMBER_" + value; + varName = varName.replaceAll("-", "MINUS_"); + varName = varName.replaceAll("\\+", "PLUS_"); + varName = varName.replaceAll("\\.", "_DOT_"); + return varName; + } + + // string + String var = value.replaceAll("_", " "); + //var = WordUtils.capitalizeFully(var); + var = camelize(var); + var = var.replaceAll("\\W+", ""); + + if (var.matches("\\d.*")) { + return "_" + var; + } else { + return var; + } + } + + @Override + public String toModelDocFilename(String name) { + return toModelFilename(name); + } + + @Override + public String toVarName(String name) { + // sanitize name + name = sanitizeName(name); + + // if it's all uppper case, do nothing + if (name.matches("^[A-Z_]*$")) { + return name; + } + + name = getNameUsingModelPropertyNaming(name); + + // for reserved word or word starting with number, append _ + if (isReservedWord(name) || name.matches("^\\d.*")) { + name = escapeReservedWord(name); + } + + return name; + } + private CodegenModel reconcileInlineEnums(CodegenModel codegenModel, CodegenModel parentCodegenModel) { // This generator uses inline classes to define enums, which breaks when // dealing with models that have subTypes. To clean this up, we will analyze @@ -720,159 +753,85 @@ public class CSharpRefactorClientCodegen extends AbstractCSharpCodegen { return codegenModel; } - @Override - public String toEnumVarName(String value, String datatype) { - if (value.length() == 0) { - return "Empty"; - } - - // for symbol, e.g. $, # - if (getSymbolName(value) != null) { - return camelize(getSymbolName(value)); - } - - // number - if (datatype.startsWith("int") || datatype.startsWith("long") || - datatype.startsWith("double") || datatype.startsWith("float")) { - String varName = "NUMBER_" + value; - varName = varName.replaceAll("-", "MINUS_"); - varName = varName.replaceAll("\\+", "PLUS_"); - varName = varName.replaceAll("\\.", "_DOT_"); - return varName; - } - - // string - String var = value.replaceAll("_", " "); - //var = WordUtils.capitalizeFully(var); - var = camelize(var); - var = var.replaceAll("\\W+", ""); - - if (var.matches("\\d.*")) { - return "_" + var; + private void syncBooleanProperty(final Map additionalProperties, final String key, final Consumer setter, final Boolean defaultValue) { + if (additionalProperties.containsKey(key)) { + setter.accept(convertPropertyToBooleanAndWriteBack(key)); } else { - return var; + additionalProperties.put(key, defaultValue); + setter.accept(defaultValue); } } - @Override - public String toVarName(String name) { - // sanitize name - name = sanitizeName(name); - - // if it's all uppper case, do nothing - if (name.matches("^[A-Z_]*$")) { - return name; - } - - name = getNameUsingModelPropertyNaming(name); - - // for reserved word or word starting with number, append _ - if (isReservedWord(name) || name.matches("^\\d.*")) { - name = escapeReservedWord(name); - } - - return name; - } - - public String getNameUsingModelPropertyNaming(String name) { - switch (CodegenConstants.MODEL_PROPERTY_NAMING_TYPE.valueOf(getModelPropertyNaming())) { - case original: - return name; - case camelCase: - return camelize(name, true); - case PascalCase: - return camelize(name); - case snake_case: - return underscore(name); - default: - throw new IllegalArgumentException("Invalid model property naming '" + - name + "'. Must be 'original', 'camelCase', " + - "'PascalCase' or 'snake_case'"); + private void syncStringProperty(final Map additionalProperties, final String key, final Consumer setter, final String defaultValue) { + if (additionalProperties.containsKey(key)) { + setter.accept((String) additionalProperties.get(key)); + } else { + additionalProperties.put(key, defaultValue); + setter.accept(defaultValue); } } + // https://docs.microsoft.com/en-us/dotnet/standard/net-standard + @SuppressWarnings("Duplicates") + private static abstract class FrameworkStrategy { + static FrameworkStrategy NETSTANDARD_1_3 = new FrameworkStrategy("netstandard1.3", ".NET Standard 1.3 compatible", "v4.6.1") { + }; + static FrameworkStrategy NETSTANDARD_1_4 = new FrameworkStrategy("netstandard1.4", ".NET Standard 1.4 compatible", "v4.6.1") { + }; + static FrameworkStrategy NETSTANDARD_1_5 = new FrameworkStrategy("netstandard1.5", ".NET Standard 1.5 compatible", "v4.6.1") { + }; + static FrameworkStrategy NETSTANDARD_1_6 = new FrameworkStrategy("netstandard1.6", ".NET Standard 1.6 compatible", "v4.6.1") { + }; + static FrameworkStrategy NETSTANDARD_2_0 = new FrameworkStrategy("netstandard2.0", ".NET Standard 2.0 compatible", "v4.6.1") { + }; + static FrameworkStrategy NETCOREAPP_2_0 = new FrameworkStrategy("netcoreapp2.0", ".NET Core 2.0 compatible", "v4.6.1", Boolean.FALSE) { - public void setPackageName(String packageName) { - this.packageName = packageName; - } + }; + protected String name; + protected String description; + protected String dotNetFrameworkVersion; + private Boolean isNetStandard = Boolean.TRUE; - public void setPackageVersion(String packageVersion) { - this.packageVersion = packageVersion; - } + FrameworkStrategy(String name, String description, String dotNetFrameworkVersion) { + this.name = name; + this.description = description; + this.dotNetFrameworkVersion = dotNetFrameworkVersion; + } - public void setTargetFrameworkNuget(String targetFrameworkNuget) { - this.targetFrameworkNuget = targetFrameworkNuget; - } + FrameworkStrategy(String name, String description, String dotNetFrameworkVersion, Boolean isNetStandard) { + this.name = name; + this.description = description; + this.dotNetFrameworkVersion = dotNetFrameworkVersion; + this.isNetStandard = isNetStandard; + } - public void setSupportsAsync(Boolean supportsAsync) { - this.supportsAsync = supportsAsync; - } + protected void configureAdditionalProperties(final Map properties) { + properties.putIfAbsent(CodegenConstants.DOTNET_FRAMEWORK, this.dotNetFrameworkVersion); - public void setSupportsUWP(Boolean supportsUWP) { - this.supportsUWP = supportsUWP; - } + // not intended to be user-settable + properties.put(TARGET_FRAMEWORK_IDENTIFIER, this.getTargetFrameworkIdentifier()); + properties.put(TARGET_FRAMEWORK_VERSION, this.getTargetFrameworkVersion()); + properties.putIfAbsent(MCS_NET_VERSION_KEY, "4.6-api"); - public void setNetStandard(Boolean netStandard) { - this.netStandard = netStandard; - } - - public void setGeneratePropertyChanged(final Boolean generatePropertyChanged) { - this.generatePropertyChanged = generatePropertyChanged; - } - - public boolean isNonPublicApi() { - return nonPublicApi; - } - - public void setNonPublicApi(final boolean nonPublicApi) { - this.nonPublicApi = nonPublicApi; - } - - public void setValidatable(boolean validatable) { - this.validatable = validatable; - } - - @Override - public String toModelDocFilename(String name) { - return toModelFilename(name); - } - - @Override - public String apiDocFileFolder() { - return (outputFolder + "/" + apiDocPath).replace('/', File.separatorChar); - } - - @Override - public String modelDocFileFolder() { - return (outputFolder + "/" + modelDocPath).replace('/', File.separatorChar); - } - - @Override - public String apiTestFileFolder() { - return outputFolder + File.separator + testFolder + File.separator + testPackageName() + File.separator + apiPackage(); - } - - @Override - public String modelTestFileFolder() { - return outputFolder + File.separator + testFolder + File.separator + testPackageName() + File.separator + modelPackage(); - } - - @Override - public Mustache.Compiler processCompiler(Mustache.Compiler compiler) { - // To avoid unexpected behaviors when options are passed programmatically such as { "supportsAsync": "" } - return super.processCompiler(compiler).emptyStringIsFalse(true); - } - - @Override - public String getNullableType(Schema p, String type) { - if (languageSpecificPrimitives.contains(type)) { - if (isSupportNullable() && ModelUtils.isNullable(p) && nullableType.contains(type)) { - return type + "?"; - } else { - return type; + properties.put(NET_STANDARD, this.isNetStandard); + if (properties.containsKey(SUPPORTS_UWP)) { + LOGGER.warn(".NET " + this.name + " generator does not support the UWP option. Use the csharp generator instead."); + properties.remove(SUPPORTS_UWP); } - } else { - return null; + } + + protected String getNugetFrameworkIdentifier() { + return this.name.toLowerCase(Locale.ROOT); + } + + protected String getTargetFrameworkIdentifier() { + if (this.isNetStandard) return ".NETStandard"; + else return ".NETCoreApp"; + } + + protected String getTargetFrameworkVersion() { + if (this.isNetStandard) return "v" + this.name.replace("netstandard", ""); + else return "v" + this.name.replace("netcoreapp", ""); } } } diff --git a/modules/openapi-generator/src/main/resources/csharp-refactor/ApiClient.mustache b/modules/openapi-generator/src/main/resources/csharp-refactor/ApiClient.mustache index 1fa1f851535..f3232ec5f16 100644 --- a/modules/openapi-generator/src/main/resources/csharp-refactor/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/csharp-refactor/ApiClient.mustache @@ -19,17 +19,10 @@ using System.Runtime.Serialization.Formatters; using System.Text; using Newtonsoft.Json; using Newtonsoft.Json.Serialization; -{{#netStandard}} -using RestSharp.Portable; -using RestSharp.Portable.HttpClient; -using RestSharpMethod = RestSharp.Portable.Method; -{{/netStandard}} -{{^netStandard}} using RestSharp; using RestSharp.Deserializers; using ErrorEventArgs = Newtonsoft.Json.Serialization.ErrorEventArgs; using RestSharpMethod = RestSharp.Method; -{{/netStandard}} namespace {{packageName}}.Client { diff --git a/modules/openapi-generator/src/main/resources/csharp-refactor/FodyWeavers.xml b/modules/openapi-generator/src/main/resources/csharp-refactor/FodyWeavers.xml deleted file mode 100644 index da017fcbf60..00000000000 --- a/modules/openapi-generator/src/main/resources/csharp-refactor/FodyWeavers.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/modules/openapi-generator/src/main/resources/csharp-refactor/Project.mustache b/modules/openapi-generator/src/main/resources/csharp-refactor/Project.mustache index a10f4ee3a45..ea39c204b13 100644 --- a/modules/openapi-generator/src/main/resources/csharp-refactor/Project.mustache +++ b/modules/openapi-generator/src/main/resources/csharp-refactor/Project.mustache @@ -11,9 +11,10 @@ {{#version}}OpenAPI spec version: {{version}}{{/version}} {{#infoEmail}}Contact: {{{infoEmail}}}{{/infoEmail}} --> - + - {{#netStandard}}14.0{{/netStandard}} + false + 14.0 Debug AnyCPU {{packageGuid}} @@ -21,107 +22,23 @@ Properties {{packageName}} {{packageName}} - {{#netStandard}} {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - {{targetFramework}} - {{/netStandard}} - {{^netStandard}} - {{^supportsUWP}} - {{targetFramework}} - {{/supportsUWP}} - {{#supportsUWP}} - UAP - 10.0.10240.0 - 10.0.10240.0 - 14 - {{/supportsUWP}} - {{/netStandard}} + + {{targetFrameworkVersion}} + {{targetFrameworkIdentifier}} 512 - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - {{^netStandard}} - - - - - - - - - - - $(SolutionDir)\packages\Newtonsoft.Json.12.0.1\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll - ..\packages\Newtonsoft.Json.12.0.1\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll - ..\..\packages\Newtonsoft.Json.12.0.1\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll - {{binRelativePath}}\Newtonsoft.Json.12.0.1\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll - - - $(SolutionDir)\packages\JsonSubTypes.1.5.1\lib\{{targetFrameworkNuget}}\JsonSubTypes.dll - ..\packages\JsonSubTypes.1.5.1\lib\{{targetFrameworkNuget}}\JsonSubTypes.dll - ..\..\packages\JsonSubTypes.1.5.1\lib\{{targetFrameworkNuget}}\JsonSubTypes.dll - {{binRelativePath}}\JsonSubTypes.1.5.1\lib\{{targetFrameworkNuget}}\JsonSubTypes.dll - - - $(SolutionDir)\packages\RestSharp.106.5.4\lib\{{#isNet40}}net4{{/isNet40}}{{^isNet40}}{{#isNet452}}net452{{/isNet452}}{{^isNet452}}{{targetFrameworkNuget}}{{/isNet452}}{{/isNet40}}\RestSharp.dll - ..\packages\RestSharp.106.5.4\lib\{{#isNet40}}net4{{/isNet40}}{{^isNet40}}{{#isNet452}}net452{{/isNet452}}{{^isNet452}}{{targetFrameworkNuget}}{{/isNet452}}{{/isNet40}}\RestSharp.dll - ..\..\packages\RestSharp.106.5.4\lib\{{#isNet40}}net4{{/isNet40}}{{^isNet40}}{{#isNet452}}net452{{/isNet452}}{{^isNet452}}{{targetFrameworkNuget}}{{/isNet452}}{{/isNet40}}\RestSharp.dll - {{binRelativePath}}\RestSharp.106.5.4\lib\{{#isNet40}}net4{{/isNet40}}{{^isNet40}}{{#isNet452}}net452{{/isNet452}}{{^isNet452}}{{targetFrameworkNuget}}{{/isNet452}}{{/isNet40}}\RestSharp.dll - - {{#useCompareNetObjects}} - - $(SolutionDir)\packages\CompareNETObjects.4.57.0\lib\{{#isNet40}}net4{{/isNet40}}{{^isNet40}}{{#isNet452}}net452{{/isNet452}}{{^isNet452}}{{targetFrameworkNuget}}{{/isNet452}}{{/isNet40}}\KellermanSoftware.Compare-NET-Objects.dll - ..\packages\CompareNETObjects.4.57.0\lib\{{#isNet40}}net4{{/isNet40}}{{^isNet40}}{{#isNet452}}net452{{/isNet452}}{{^isNet452}}{{targetFrameworkNuget}}{{/isNet452}}{{/isNet40}}\KellermanSoftware.Compare-NET-Objects.dll - ..\..\packages\CompareNETObjects.4.57.0\lib\{{#isNet40}}net4{{/isNet40}}{{^isNet40}}{{#isNet452}}net452{{/isNet452}}{{^isNet452}}{{targetFrameworkNuget}}{{/isNet452}}{{/isNet40}}\KellermanSoftware.Compare-NET-Objects.dll - {{binRelativePath}}\CompareNETObjects.4.57.0\lib\{{#isNet40}}net4{{/isNet40}}{{^isNet40}}{{#isNet452}}net452{{/isNet452}}{{^isNet452}}{{targetFrameworkNuget}}{{/isNet452}}{{/isNet40}}\KellermanSoftware.Compare-NET-Objects.dll - - {{/useCompareNetObjects}} - {{#generatePropertyChanged}} - - ..\..\packages\PropertyChanged.Fody.1.51.3\Lib\portable-net4+sl4+wp8+win8+wpa81+MonoAndroid16+MonoTouch40\PropertyChanged.dll - - {{/generatePropertyChanged}} - {{/netStandard}} - {{#netStandard}} - {{/netStandard}} - + + + + + - {{^netStandard}} - - - {{#generatePropertyChanged}} - - {{/generatePropertyChanged}} - - - {{#generatePropertyChanged}} - - {{/generatePropertyChanged}} - {{/netStandard}} - {{#netStandard}} - - - {{/netStandard}} + diff --git a/modules/openapi-generator/src/main/resources/csharp-refactor/README.mustache b/modules/openapi-generator/src/main/resources/csharp-refactor/README.mustache index ecd5a80e37a..ffe56a5a0b7 100644 --- a/modules/openapi-generator/src/main/resources/csharp-refactor/README.mustache +++ b/modules/openapi-generator/src/main/resources/csharp-refactor/README.mustache @@ -22,44 +22,32 @@ This C# SDK is automatically generated by the [OpenAPI Generator](https://openap - .NET Core >=1.0 - .NET Framework >=4.6 - Mono/Xamarin >=vNext -- UWP >=10.0 -{{/netStandard}} -{{^netStandard}} -{{^supportsUWP}} -- .NET 4.0 or later -- Windows Phone 7.1 (Mango) -{{/supportsUWP}} -{{#supportsUWP}} -- UWP -{{/supportsUWP}} {{/netStandard}} ## Dependencies -{{#netStandard}} -- FubarCoder.RestSharp.Portable.Core >=4.0.7 -- FubarCoder.RestSharp.Portable.HttpClient >=4.0.7 -- Newtonsoft.Json >=10.0.3 -{{/netStandard}} -{{^netStandard}} -- [RestSharp](https://www.nuget.org/packages/RestSharp) - 105.1.0 or later -- [Json.NET](https://www.nuget.org/packages/Newtonsoft.Json/) - 7.0.0 or later -- [JsonSubTypes](https://www.nuget.org/packages/JsonSubTypes/) - 1.2.0 or later + +- [RestSharp](https://www.nuget.org/packages/RestSharp) - 106.6.7 or later +- [Json.NET](https://www.nuget.org/packages/Newtonsoft.Json/) - 12.0.1 or later +- [JsonSubTypes](https://www.nuget.org/packages/JsonSubTypes/) - 1.5.2 or later +- [CompareNETObjects](https://www.nuget.org/packages/CompareNETObjects) - 4.57.0 or later +- [System.ComponentModel.Annotations](https://www.nuget.org/packages/System.ComponentModel.Annotations) - 4.5.0 or later The DLLs included in the package may not be the latest version. We recommend using [NuGet](https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages: ``` Install-Package RestSharp Install-Package Newtonsoft.Json Install-Package JsonSubTypes +Install-Package System.ComponentModel.Annotations +Install-Package CompareNETObjects ``` NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See [RestSharp#742](https://github.com/restsharp/RestSharp/issues/742) -{{/netStandard}} ## Installation {{#netStandard}} -Generate the DLL using your preferred tool +Generate the DLL using your preferred tool (e.g. `dotnet build`) {{/netStandard}} {{^netStandard}} Run the following command to generate the DLL diff --git a/modules/openapi-generator/src/main/resources/csharp-refactor/TestProject.mustache b/modules/openapi-generator/src/main/resources/csharp-refactor/TestProject.mustache index ea030a5b52a..0c8fae72298 100644 --- a/modules/openapi-generator/src/main/resources/csharp-refactor/TestProject.mustache +++ b/modules/openapi-generator/src/main/resources/csharp-refactor/TestProject.mustache @@ -11,91 +11,39 @@ {{#version}}OpenAPI spec version: {{{version}}}{{/version}} {{#infoEmail}}Contact: {{{infoEmail}}}{{/infoEmail}} --> - + - Debug - AnyCPU - {19F1DEBC-DE5E-4517-8062-F000CD499087} - Library + false Properties {{testPackageName}} {{testPackageName}} - {{^supportsUWP}} - {{targetFramework}} - {{/supportsUWP}} - {{#supportsUWP}} - UAP - 10.0.10240.0 - 10.0.10240.0 - 14 - {{/supportsUWP}} + + netcoreapp2.0 + false 512 - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - $(SolutionDir)\packages\Newtonsoft.Json.12.0.1\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll - ..\packages\Newtonsoft.Json.12.0.1\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll - ..\..\packages\Newtonsoft.Json.12.0.1\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll - {{binRelativePath}}\Newtonsoft.Json.12.0.1\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll - - - $(SolutionDir)\packages\JsonSubTypes.1.5.1\lib\{{targetFrameworkNuget}}\JsonSubTypes.dll - ..\packages\JsonSubTypes.1.5.1\lib\{{targetFrameworkNuget}}\JsonSubTypes.dll - ..\..\packages\JsonSubTypes.1.5.1\lib\{{targetFrameworkNuget}}\JsonSubTypes.dll - {{binRelativePath}}\JsonSubTypes.1.5.1\lib\{{targetFrameworkNuget}}\JsonSubTypes.dll - - - $(SolutionDir)\packages\RestSharp.106.5.4\lib\{{#isNet40}}net4{{/isNet40}}{{^isNet40}}{{#isNet452}}net452{{/isNet452}}{{^isNet452}}{{targetFrameworkNuget}}{{/isNet452}}{{/isNet40}}\RestSharp.dll - ..\packages\RestSharp.106.5.4\lib\{{#isNet40}}net4{{/isNet40}}{{^isNet40}}{{#isNet452}}net452{{/isNet452}}{{^isNet452}}{{targetFrameworkNuget}}{{/isNet452}}{{/isNet40}}\RestSharp.dll - ..\..\packages\RestSharp.106.5.4\lib\{{#isNet40}}net4{{/isNet40}}{{^isNet40}}{{#isNet452}}net452{{/isNet452}}{{^isNet452}}{{targetFrameworkNuget}}{{/isNet452}}{{/isNet40}}\RestSharp.dll - {{binRelativePath}}\RestSharp.106.5.4\lib\{{#isNet40}}net4{{/isNet40}}{{^isNet40}}{{#isNet452}}net452{{/isNet452}}{{^isNet452}}{{targetFrameworkNuget}}{{/isNet452}}{{/isNet40}}\RestSharp.dll - - - $(SolutionDir)\packages\NUnit.2.6.4\lib\nunit.framework.dll - ..\packages\NUnit.2.6.4\lib\nunit.framework.dll - ..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll - {{binRelativePath}}\NUnit.2.6.4\lib\nunit.framework.dll - + + + + + + + + - - - - - - - + {{packageGuid}} {{packageName}} + + + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105.The missing file is {0}. + + + diff --git a/modules/openapi-generator/src/main/resources/csharp-refactor/api_test.mustache b/modules/openapi-generator/src/main/resources/csharp-refactor/api_test.mustache index 4b58b5b49f7..e22c159b671 100644 --- a/modules/openapi-generator/src/main/resources/csharp-refactor/api_test.mustache +++ b/modules/openapi-generator/src/main/resources/csharp-refactor/api_test.mustache @@ -6,7 +6,7 @@ using System.Collections.ObjectModel; using System.Linq; using System.Reflection; using RestSharp; -using NUnit.Framework; +using Xunit; using {{packageName}}.Client; using {{packageName}}.{{apiPackage}}; @@ -22,44 +22,35 @@ namespace {{packageName}}.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the API endpoint. /// - [TestFixture] - public class {{classname}}Tests + public class {{classname}}Tests : IDisposable { private {{classname}} instance; - /// - /// Setup before each unit test - /// - [SetUp] - public void Init() + public {{classname}}Tests() { instance = new {{classname}}(); } - /// - /// Clean up after each unit test - /// - [TearDown] - public void Cleanup() + public void Dispose() { - + // Cleanup when everything is done. } /// /// Test an instance of {{classname}} /// - [Test] + [Fact] public void {{operationId}}InstanceTest() { // TODO uncomment below to test 'IsInstanceOfType' {{classname}} - //Assert.IsInstanceOfType(typeof({{classname}}), instance, "instance is a {{classname}}"); + //Assert.IsType(typeof({{classname}}), instance, "instance is a {{classname}}"); } {{#operations}}{{#operation}} /// /// Test {{operationId}} /// - [Test] + [Fact] public void {{operationId}}Test() { // TODO uncomment below to test the method and replace null with proper value @@ -67,7 +58,7 @@ namespace {{packageName}}.Test //{{{dataType}}} {{paramName}} = null; {{/allParams}} //{{#returnType}}var response = {{/returnType}}instance.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); - {{#returnType}}//Assert.IsInstanceOf<{{{returnType}}}> (response, "response is {{{returnType}}}");{{/returnType}} + {{#returnType}}//Assert.IsType<{{{returnType}}}> (response, "response is {{{returnType}}}");{{/returnType}} } {{/operation}}{{/operations}} } diff --git a/modules/openapi-generator/src/main/resources/csharp-refactor/compile-mono.sh.mustache b/modules/openapi-generator/src/main/resources/csharp-refactor/compile-mono.sh.mustache deleted file mode 100644 index c575f9f4ff9..00000000000 --- a/modules/openapi-generator/src/main/resources/csharp-refactor/compile-mono.sh.mustache +++ /dev/null @@ -1,84 +0,0 @@ -#!/usr/bin/env bash -# -# Generated by: https://github.com/openapitools/openapi-generator.git -# - -frameworkVersion={{targetFrameworkNuget}} - -# sdk must match installed framworks under PREFIX/lib/mono/[value] -sdk={{x-mcs-sdk}} - -# langversion refers to C# language features. see man mcs for details. -langversion=${sdk} -nuget_cmd=nuget - -# Match against our known SDK possibilities -case "${sdk}" in - 4) - langversion=4 - ;; - 4.5*) - langversion=5 - ;; - 4.6*) - langversion=6 - ;; - 4.7*) - langversion=7 # ignoring 7.1 for now. - ;; - *) - langversion=6 - ;; -esac - -echo "[INFO] Target framework: ${frameworkVersion}" - -if ! type nuget &>/dev/null; then - echo "[INFO] Download nuget and packages" - wget -nc https://dist.nuget.org/win-x86-commandline/latest/nuget.exe; - nuget_cmd="mono nuget.exe" -fi - -mozroots --import --sync -${nuget_cmd} install src/{{packageName}}/packages.config -o packages; - -echo "[INFO] Copy DLLs to the 'bin' folder" -mkdir -p bin; -{{#useCompareNetObjects}} -cp packages/CompareNETObjects.4.57.0/lib/{{#isNet40}}net4{{/isNet40}}{{^isNet40}}{{#isNet452}}net452{{/isNet452}}{{^isNet452}}{{targetFrameworkNuget}}{{/isNet452}}{{/isNet40}}/KellermanSoftware.Compare-NET-Objects.dll bin/KellermanSoftware.Compare-NET-Objects.dll; -{{/useCompareNetObjects}} -cp packages/Newtonsoft.Json.12.0.1/lib/{{targetFrameworkNuget}}/Newtonsoft.Json.dll bin/Newtonsoft.Json.dll; -cp packages/RestSharp.106.5.4/lib/{{#isNet40}}net4{{/isNet40}}{{^isNet40}}{{#isNet452}}net452{{/isNet452}}{{^isNet452}}{{targetFrameworkNuget}}{{/isNet452}}{{/isNet40}}/RestSharp.dll bin/RestSharp.dll; -cp packages/JsonSubTypes.1.5.1/lib/{{targetFrameworkNuget}}/JsonSubTypes.dll bin/JsonSubTypes.dll -{{#generatePropertyChanged}} -cp packages/Fody.1.29.4/Fody.dll bin/Fody.dll -cp packages/PropertyChanged.Fody.1.51.3/PropertyChanged.Fody.dll bin/PropertyChanged.Fody.dll -cp packages/PropertyChanged.Fody.1.51.3/Lib/dotnet/PropertyChanged.dll bin/PropertyChanged.dll -{{/generatePropertyChanged}} - -echo "[INFO] Run 'mcs' to build bin/{{{packageName}}}.dll" -mcs -langversion:${langversion} -sdk:${sdk} -r:bin/Newtonsoft.Json.dll,bin/JsonSubTypes.dll,\ -{{#generatePropertyChanged}} -bin/Fody.dll,\ -bin/PropertyChanged.Fody.dll,\ -bin/PropertyChanged.dll,\ -{{/generatePropertyChanged}} -{{#useCompareNetObjects}} -bin/KellermanSoftware.Compare-NET-Objects.dll,\ -{{/useCompareNetObjects}} -bin/RestSharp.dll,\ -System.ComponentModel.DataAnnotations.dll,\ -System.Runtime.Serialization.dll \ --target:library \ --out:bin/{{packageName}}.dll \ --recurse:'src/{{packageName}}/*.cs' \ --doc:bin/{{packageName}}.xml \ --platform:anycpu - -if [ $? -ne 0 ] -then - echo "[ERROR] Compilation failed with exit code $?" - exit 1 -else - echo "[INFO] bin/{{{packageName}}}.dll was created successfully" -fi diff --git a/modules/openapi-generator/src/main/resources/csharp-refactor/compile.mustache b/modules/openapi-generator/src/main/resources/csharp-refactor/compile.mustache deleted file mode 100644 index 9b3b4a5e385..00000000000 --- a/modules/openapi-generator/src/main/resources/csharp-refactor/compile.mustache +++ /dev/null @@ -1,29 +0,0 @@ -:: Generated by: https://github.com/openapitools/openapi-generator.git -:: - -@echo off - -{{#supportsAsync}} -SET CSCPATH=%SYSTEMROOT%\Microsoft.NET\Framework\v4.0.30319 -{{/supportsAsync}} -{{^supportsAsync}} -SET CSCPATH=%SYSTEMROOT%\Microsoft.NET\Framework\v3.5 -{{/supportsAsync}} - -if not exist ".\nuget.exe" powershell -Command "(new-object System.Net.WebClient).DownloadFile('https://dist.nuget.org/win-x86-commandline/latest/nuget.exe', '.\nuget.exe')" -.\nuget.exe install src\{{packageName}}\packages.config -o packages - -if not exist ".\bin" mkdir bin -{{#CompareNetObjects}} -copy packages\CompareNETObjects.4.57.0\lib\{{#isNet40}}net4{{/isNet40}}{{^isNet40}}{{#isNet452}}net452{{/isNet452}}{{^isNet452}}{{targetFrameworkNuget}}{{/isNet452}}{{/isNet40}}\KellermanSoftware.Compare-NET-Objects.dll bin\KellermanSoftware.Compare-NET-Objects.dll -{{/CompareNetObjects}} -copy packages\Newtonsoft.Json.12.0.1\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll bin\Newtonsoft.Json.dll -copy packages\JsonSubTypes.1.5.1\lib\{{targetFrameworkNuget}}\JsonSubTypes.dll bin\JsonSubTypes.dll -copy packages\RestSharp.106.5.4\lib\{{#isNet40}}net4{{/isNet40}}{{^isNet40}}{{#isNet452}}net452{{/isNet452}}{{^isNet452}}{{targetFrameworkNuget}}{{/isNet452}}{{/isNet40}}\RestSharp.dll bin\RestSharp.dll -{{#generatePropertyChanged}} -copy packages\Fody.1.29.4\Fody.dll bin\Fody.dll -copy packages\PropertyChanged.Fody.1.51.3\PropertyChanged.Fody.dll bin\PropertyChanged.Fody.dll -copy packages\PropertyChanged.Fody.1.51.3\Lib\dotnet\PropertyChanged.dll bin\PropertyChanged.dll -{{/generatePropertyChanged}} -%CSCPATH%\csc /reference:bin\Newtonsoft.Json.dll;bin\JsonSubTypes.dll;bin\RestSharp.dll;{{#CompareNetObjects}}bin\KellermanSoftware.Compare-NET-Objects.dll;{{/CompareNetObjects}}System.ComponentModel.DataAnnotations.dll {{#generatePropertyChanged}}/r:bin\Fody.dll;bin\PropertyChanged.Fody.dll;bin\PropertyChanged.dll{{/generatePropertyChanged}} /target:library /out:bin\{{packageName}}.dll /recurse:src\{{packageName}}\*.cs /doc:bin\{{packageName}}.xml - diff --git a/modules/openapi-generator/src/main/resources/csharp-refactor/model.mustache b/modules/openapi-generator/src/main/resources/csharp-refactor/model.mustache index 41580d6d0ac..4576e9a8a85 100644 --- a/modules/openapi-generator/src/main/resources/csharp-refactor/model.mustache +++ b/modules/openapi-generator/src/main/resources/csharp-refactor/model.mustache @@ -4,9 +4,7 @@ using System; using System.Linq; using System.IO; using System.Text; -{{^netStandard}} using System.Text.RegularExpressions; -{{/netStandard}} using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; @@ -20,13 +18,9 @@ using JsonSubTypes; {{/discriminator}} {{/model}} {{/models}} -{{^netStandard}} -{{#generatePropertyChanged}} -using PropertyChanged; -using System.ComponentModel; -{{/generatePropertyChanged}} +{{#validatable}} using System.ComponentModel.DataAnnotations; -{{/netStandard}} +{{/validatable}} using OpenAPIDateConverter = {{packageName}}.Client.OpenAPIDateConverter; {{#useCompareNetObjects}} using OpenAPIClientUtils = {{packageName}}.Client.ClientUtils; diff --git a/modules/openapi-generator/src/main/resources/csharp-refactor/modelGeneric.mustache b/modules/openapi-generator/src/main/resources/csharp-refactor/modelGeneric.mustache index 36f99b42405..6d0abdd2cd7 100644 --- a/modules/openapi-generator/src/main/resources/csharp-refactor/modelGeneric.mustache +++ b/modules/openapi-generator/src/main/resources/csharp-refactor/modelGeneric.mustache @@ -11,10 +11,7 @@ [JsonSubtypes.KnownSubType(typeof({{{modelName}}}), "{{{mappingName}}}")] {{/mappedModels}} {{/discriminator}} - {{#generatePropertyChanged}} - [ImplementPropertyChanged] - {{/generatePropertyChanged}} - {{>visibility}} partial class {{classname}} : {{#parent}}{{{parent}}}, {{/parent}} IEquatable<{{classname}}>{{^netStandard}}{{#validatable}}, IValidatableObject{{/validatable}}{{/netStandard}} + {{>visibility}} partial class {{classname}} : {{#parent}}{{{parent}}}, {{/parent}} IEquatable<{{classname}}>{{#validatable}}, IValidatableObject{{/validatable}} { {{#vars}} {{#items.isEnum}} @@ -227,30 +224,7 @@ return hashCode; } } -{{^netStandard}} -{{#generatePropertyChanged}} - /// - /// 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)); - } - } - -{{/generatePropertyChanged}} {{#validatable}} {{#discriminator}} /// @@ -337,5 +311,4 @@ yield break; } {{/validatable}} -{{/netStandard}} } diff --git a/modules/openapi-generator/src/main/resources/csharp-refactor/model_test.mustache b/modules/openapi-generator/src/main/resources/csharp-refactor/model_test.mustache index 8bdab50696c..fe65f41d199 100644 --- a/modules/openapi-generator/src/main/resources/csharp-refactor/model_test.mustache +++ b/modules/openapi-generator/src/main/resources/csharp-refactor/model_test.mustache @@ -1,6 +1,6 @@ {{>partial_header}} -using NUnit.Framework; +using Xunit; using System; using System.Linq; @@ -23,35 +23,26 @@ namespace {{packageName}}.Test /// 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 {{classname}}Tests + public class {{classname}}Tests : IDisposable { // TODO uncomment below to declare an instance variable for {{classname}} //private {{classname}} instance; - /// - /// Setup before each test - /// - [SetUp] - public void Init() + public {{classname}}Tests() { // TODO uncomment below to create an instance of {{classname}} //instance = new {{classname}}(); } - /// - /// Clean up after each test - /// - [TearDown] - public void Cleanup() + public void Dispose() { - + // Cleanup when everything is done. } /// /// Test an instance of {{classname}} /// - [Test] + [Fact] public void {{classname}}InstanceTest() { // TODO uncomment below to test "IsInstanceOfType" {{classname}} @@ -63,7 +54,7 @@ namespace {{packageName}}.Test /// /// Test deserialize a {{classname}} from type {{parent}} /// - [Test] + [Fact] public void {{classname}}DeserializeFrom{{parent}}Test() { // TODO uncomment below to test deserialize a {{classname}} from type {{parent}} @@ -76,7 +67,7 @@ namespace {{packageName}}.Test /// /// Test the property '{{name}}' /// - [Test] + [Fact] public void {{name}}Test() { // TODO unit test for the property '{{name}}' diff --git a/modules/openapi-generator/src/main/resources/csharp-refactor/mono_nunit_test.mustache b/modules/openapi-generator/src/main/resources/csharp-refactor/mono_nunit_test.mustache deleted file mode 100644 index f3e03dc803e..00000000000 --- a/modules/openapi-generator/src/main/resources/csharp-refactor/mono_nunit_test.mustache +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash -# -# Generated by: https://github.com/openapitools/openapi-generator.git -# - -wget -nc https://dist.nuget.org/win-x86-commandline/latest/nuget.exe -mozroots --import --sync - -echo "[INFO] remove bin/Debug/{{{packageName}}}.Test.dll" -rm src/{{{packageName}}}.Test/bin/Debug/{{{packageName}}}.Test.dll 2> /dev/null - -echo "[INFO] install NUnit runners via NuGet" -wget -nc https://dist.nuget.org/win-x86-commandline/latest/nuget.exe -mozroots --import --sync -mono nuget.exe install src/{{{packageName}}}.Test/packages.config -o packages - -echo "[INFO] Install NUnit runners via NuGet" -mono nuget.exe install NUnit.Runners -Version 2.6.4 -OutputDirectory packages - -echo "[INFO] Build the solution and run the unit test" -xbuild {{{packageName}}}.sln && \ - mono ./packages/NUnit.Runners.2.6.4/tools/nunit-console.exe src/{{{packageName}}}.Test/bin/Debug/{{{packageName}}}.Test.dll diff --git a/modules/openapi-generator/src/main/resources/csharp-refactor/netcore_project.mustache b/modules/openapi-generator/src/main/resources/csharp-refactor/netcore_project.mustache index d072b0e2914..6c4a9927efc 100644 --- a/modules/openapi-generator/src/main/resources/csharp-refactor/netcore_project.mustache +++ b/modules/openapi-generator/src/main/resources/csharp-refactor/netcore_project.mustache @@ -1,7 +1,10 @@ - {{targetFrameworkNuget}} + false + {{targetFramework}} + {{targetFrameworkVersion}} + {{targetFrameworkIdentifier}} {{packageName}} {{packageName}} Library @@ -18,15 +21,11 @@ - {{#netStandard}} - - - {{/netStandard}} - {{^netStandard}} - - {{/netStandard}} - - + + + + + {{^netStandard}} diff --git a/modules/openapi-generator/src/main/resources/csharp-refactor/netcore_testproject.mustache b/modules/openapi-generator/src/main/resources/csharp-refactor/netcore_testproject.mustache index 7470bc8b27a..c1d1c2e0c11 100644 --- a/modules/openapi-generator/src/main/resources/csharp-refactor/netcore_testproject.mustache +++ b/modules/openapi-generator/src/main/resources/csharp-refactor/netcore_testproject.mustache @@ -1,7 +1,6 @@ - {{targetFrameworkNuget}} {{testPackageName}} {{testPackageName}} Library @@ -14,18 +13,16 @@ true true {{testPackageName}} + netcoreapp2.0 + false - - {{#netStandard}} - - {{/netStandard}} - {{^netStandard}} - - {{/netStandard}} - - + + + + + {{^netStandard}} diff --git a/modules/openapi-generator/src/main/resources/csharp-refactor/nuspec.mustache b/modules/openapi-generator/src/main/resources/csharp-refactor/nuspec.mustache index a754341d780..46fd49331ec 100644 --- a/modules/openapi-generator/src/main/resources/csharp-refactor/nuspec.mustache +++ b/modules/openapi-generator/src/main/resources/csharp-refactor/nuspec.mustache @@ -32,11 +32,10 @@ - - {{#generatePropertyChanged}} - - - {{/generatePropertyChanged}} + + + + @@ -45,9 +44,6 @@ - {{#generatePropertyChanged}} - - {{/generatePropertyChanged}} diff --git a/modules/openapi-generator/src/main/resources/csharp-refactor/packages.config.mustache b/modules/openapi-generator/src/main/resources/csharp-refactor/packages.config.mustache index 247758248d2..6f2e656b238 100644 --- a/modules/openapi-generator/src/main/resources/csharp-refactor/packages.config.mustache +++ b/modules/openapi-generator/src/main/resources/csharp-refactor/packages.config.mustache @@ -1,13 +1,10 @@ {{#useCompareNetObjects}} - + {{/useCompareNetObjects}} - - - - {{#generatePropertyChanged}} - - - {{/generatePropertyChanged}} + + + + diff --git a/modules/openapi-generator/src/main/resources/csharp-refactor/packages_test.config.mustache b/modules/openapi-generator/src/main/resources/csharp-refactor/packages_test.config.mustache deleted file mode 100644 index f894da23792..00000000000 --- a/modules/openapi-generator/src/main/resources/csharp-refactor/packages_test.config.mustache +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/modules/openapi-generator/src/main/resources/csharp-refactor/project.json.mustache b/modules/openapi-generator/src/main/resources/csharp-refactor/project.json.mustache index 0feb8e86af4..38ade237ec3 100644 --- a/modules/openapi-generator/src/main/resources/csharp-refactor/project.json.mustache +++ b/modules/openapi-generator/src/main/resources/csharp-refactor/project.json.mustache @@ -1,13 +1,12 @@ { "supports": {}, "dependencies": { - "FubarCoder.RestSharp.Portable.Core": "4.0.7", - "FubarCoder.RestSharp.Portable.HttpClient": "4.0.7", "Newtonsoft.Json": "12.0.1", {{#useCompareNetObjects}} - "KellermanSoftware.Compare-NET-Objects": "4.57.0", + "CompareNETObjects": "4.57.0", {{/useCompareNetObjects}} - "JsonSubTypes": "1.5.1" + "JsonSubTypes": "1.5.2", + "RestSharp": "106.6.7" }, "frameworks": { "{{targetFrameworkNuget}}": {} diff --git a/modules/openapi-generator/src/main/resources/csharp-refactor/travis.mustache b/modules/openapi-generator/src/main/resources/csharp-refactor/travis.mustache deleted file mode 100644 index 645c72d06d6..00000000000 --- a/modules/openapi-generator/src/main/resources/csharp-refactor/travis.mustache +++ /dev/null @@ -1,9 +0,0 @@ -# -# Generated by: https://github.com/openapitools/openapi-generator.git -# -language: csharp -mono: - - latest -solution: {{{packageName}}}.sln -script: - - /bin/sh ./mono_nunit_test.sh diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/Org.OpenAPITools.sln b/samples/client/petstore/csharp-refactor/OpenAPIClient/Org.OpenAPITools.sln index 5b15451c9dc..61278f3ea0b 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/Org.OpenAPITools.sln +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/Org.OpenAPITools.sln @@ -1,7 +1,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -VisualStudioVersion = 12.0.0.0 -MinimumVisualStudioVersion = 10.0.0.1 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.OpenAPITools", "src\Org.OpenAPITools\Org.OpenAPITools.csproj", "{321C8C3F-0156-40C1-AE42-D59761FB9B6C}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.OpenAPITools.Test", "src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}" diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/README.md b/samples/client/petstore/csharp-refactor/OpenAPIClient/README.md index 9636dbeec5f..1cf53220161 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/README.md +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/README.md @@ -10,29 +10,33 @@ This C# SDK is automatically generated by the [OpenAPI Generator](https://openap ## Frameworks supported -- .NET 4.0 or later -- Windows Phone 7.1 (Mango) +- .NET Core >=1.0 +- .NET Framework >=4.6 +- Mono/Xamarin >=vNext ## Dependencies -- [RestSharp](https://www.nuget.org/packages/RestSharp) - 105.1.0 or later -- [Json.NET](https://www.nuget.org/packages/Newtonsoft.Json/) - 7.0.0 or later -- [JsonSubTypes](https://www.nuget.org/packages/JsonSubTypes/) - 1.2.0 or later + +- [RestSharp](https://www.nuget.org/packages/RestSharp) - 106.6.7 or later +- [Json.NET](https://www.nuget.org/packages/Newtonsoft.Json/) - 12.0.1 or later +- [JsonSubTypes](https://www.nuget.org/packages/JsonSubTypes/) - 1.5.2 or later +- [CompareNETObjects](https://www.nuget.org/packages/CompareNETObjects) - 4.57.0 or later +- [System.ComponentModel.Annotations](https://www.nuget.org/packages/System.ComponentModel.Annotations) - 4.5.0 or later The DLLs included in the package may not be the latest version. We recommend using [NuGet](https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages: ``` Install-Package RestSharp Install-Package Newtonsoft.Json Install-Package JsonSubTypes +Install-Package System.ComponentModel.Annotations +Install-Package CompareNETObjects ``` NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See [RestSharp#742](https://github.com/restsharp/RestSharp/issues/742) ## Installation -Run the following command to generate the DLL -- [Mac/Linux] `/bin/sh build.sh` -- [Windows] `build.bat` +Generate the DLL using your preferred tool (e.g. `dotnet build`) Then include the DLL (under the `bin` folder) in the C# project, and use the namespaces: ```csharp @@ -40,19 +44,6 @@ using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; using Org.OpenAPITools.Model; ``` - -## Packaging - -A `.nuspec` is included with the project. You can follow the Nuget quickstart to [create](https://docs.microsoft.com/en-us/nuget/quickstart/create-and-publish-a-package#create-the-package) and [publish](https://docs.microsoft.com/en-us/nuget/quickstart/create-and-publish-a-package#publish-the-package) packages. - -This `.nuspec` uses placeholders from the `.csproj`, so build the `.csproj` directly: - -``` -nuget pack -Build -OutputDirectory out Org.OpenAPITools.csproj -``` - -Then, publish to a [local feed](https://docs.microsoft.com/en-us/nuget/hosting-packages/local-feeds) or [other host](https://docs.microsoft.com/en-us/nuget/hosting-packages/overview) and consume the new package via Nuget as usual. - ## Getting Started @@ -97,6 +88,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *AnotherFakeApi* | [**Call123TestSpecialTags**](docs/AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags +*FakeApi* | [**CreateXmlItem**](docs/FakeApi.md#createxmlitem) | **POST** /fake/create_xml_item | creates an XmlItem *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 | @@ -172,6 +164,7 @@ Class | Method | HTTP request | Description - [Model.TypeHolderDefault](docs/TypeHolderDefault.md) - [Model.TypeHolderExample](docs/TypeHolderExample.md) - [Model.User](docs/User.md) + - [Model.XmlItem](docs/XmlItem.md) diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/build.bat b/samples/client/petstore/csharp-refactor/OpenAPIClient/build.bat deleted file mode 100644 index 14c1b86cd44..00000000000 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/build.bat +++ /dev/null @@ -1,16 +0,0 @@ -:: Generated by: https://github.com/openapitools/openapi-generator.git -:: - -@echo off - -SET CSCPATH=%SYSTEMROOT%\Microsoft.NET\Framework\v4.0.30319 - -if not exist ".\nuget.exe" powershell -Command "(new-object System.Net.WebClient).DownloadFile('https://dist.nuget.org/win-x86-commandline/latest/nuget.exe', '.\nuget.exe')" -.\nuget.exe install src\Org.OpenAPITools\packages.config -o packages - -if not exist ".\bin" mkdir bin -copy packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll bin\Newtonsoft.Json.dll -copy packages\JsonSubTypes.1.5.1\lib\net45\JsonSubTypes.dll bin\JsonSubTypes.dll -copy packages\RestSharp.106.5.4\lib\net452\RestSharp.dll bin\RestSharp.dll -%CSCPATH%\csc /reference:bin\Newtonsoft.Json.dll;bin\JsonSubTypes.dll;bin\RestSharp.dll;System.ComponentModel.DataAnnotations.dll /target:library /out:bin\Org.OpenAPITools.dll /recurse:src\Org.OpenAPITools\*.cs /doc:bin\Org.OpenAPITools.xml - diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/build.sh b/samples/client/petstore/csharp-refactor/OpenAPIClient/build.sh deleted file mode 100644 index 65dd35fa148..00000000000 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/build.sh +++ /dev/null @@ -1,70 +0,0 @@ -#!/usr/bin/env bash -# -# Generated by: https://github.com/openapitools/openapi-generator.git -# - -frameworkVersion=net45 - -# sdk must match installed framworks under PREFIX/lib/mono/[value] -sdk=4.5.2-api - -# langversion refers to C# language features. see man mcs for details. -langversion=${sdk} -nuget_cmd=nuget - -# Match against our known SDK possibilities -case "${sdk}" in - 4) - langversion=4 - ;; - 4.5*) - langversion=5 - ;; - 4.6*) - langversion=6 - ;; - 4.7*) - langversion=7 # ignoring 7.1 for now. - ;; - *) - langversion=6 - ;; -esac - -echo "[INFO] Target framework: ${frameworkVersion}" - -if ! type nuget &>/dev/null; then - echo "[INFO] Download nuget and packages" - wget -nc https://dist.nuget.org/win-x86-commandline/latest/nuget.exe; - nuget_cmd="mono nuget.exe" -fi - -mozroots --import --sync -${nuget_cmd} install src/Org.OpenAPITools/packages.config -o packages; - -echo "[INFO] Copy DLLs to the 'bin' folder" -mkdir -p bin; -cp packages/CompareNETObjects.4.57.0/lib/net452/KellermanSoftware.Compare-NET-Objects.dll bin/KellermanSoftware.Compare-NET-Objects.dll; -cp packages/Newtonsoft.Json.12.0.1/lib/net45/Newtonsoft.Json.dll bin/Newtonsoft.Json.dll; -cp packages/RestSharp.106.5.4/lib/net452/RestSharp.dll bin/RestSharp.dll; -cp packages/JsonSubTypes.1.5.1/lib/net45/JsonSubTypes.dll bin/JsonSubTypes.dll - -echo "[INFO] Run 'mcs' to build bin/Org.OpenAPITools.dll" -mcs -langversion:${langversion} -sdk:${sdk} -r:bin/Newtonsoft.Json.dll,bin/JsonSubTypes.dll,\ -bin/KellermanSoftware.Compare-NET-Objects.dll,\ -bin/RestSharp.dll,\ -System.ComponentModel.DataAnnotations.dll,\ -System.Runtime.Serialization.dll \ --target:library \ --out:bin/Org.OpenAPITools.dll \ --recurse:'src/Org.OpenAPITools/*.cs' \ --doc:bin/Org.OpenAPITools.xml \ --platform:anycpu - -if [ $? -ne 0 ] -then - echo "[ERROR] Compilation failed with exit code $?" - exit 1 -else - echo "[INFO] bin/Org.OpenAPITools.dll was created successfully" -fi diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/docs/FakeApi.md b/samples/client/petstore/csharp-refactor/OpenAPIClient/docs/FakeApi.md index 9ed98a04c58..8a11d6461f2 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/docs/FakeApi.md +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/docs/FakeApi.md @@ -4,6 +4,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- +[**CreateXmlItem**](FakeApi.md#createxmlitem) | **POST** /fake/create_xml_item | creates an XmlItem [**FakeOuterBooleanSerialize**](FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean | [**FakeOuterCompositeSerialize**](FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | [**FakeOuterNumberSerialize**](FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | @@ -18,6 +19,66 @@ Method | HTTP request | Description [**TestJsonFormData**](FakeApi.md#testjsonformdata) | **GET** /fake/jsonFormData | test json serialization of form data + +# **CreateXmlItem** +> void CreateXmlItem (XmlItem xmlItem) + +creates an XmlItem + +this route creates an XmlItem + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class CreateXmlItemExample + { + public void main() + { + var apiInstance = new FakeApi(); + var xmlItem = new XmlItem(); // XmlItem | XmlItem Body + + try + { + // creates an XmlItem + apiInstance.CreateXmlItem(xmlItem); + } + catch (Exception e) + { + Debug.Print("Exception when calling FakeApi.CreateXmlItem: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xmlItem** | [**XmlItem**](XmlItem.md)| XmlItem Body | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/xml, application/xml; charset=utf-8, application/xml; charset=utf-16, text/xml, text/xml; charset=utf-8, text/xml; charset=utf-16 + - **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) + # **FakeOuterBooleanSerialize** > bool FakeOuterBooleanSerialize (bool? body = null) @@ -161,7 +222,7 @@ namespace Example public void main() { var apiInstance = new FakeApi(); - var body = 1.2D; // decimal? | Input number as post body (optional) + var body = 8.14; // decimal? | Input number as post body (optional) try { diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/docs/XmlItem.md b/samples/client/petstore/csharp-refactor/OpenAPIClient/docs/XmlItem.md new file mode 100644 index 00000000000..679fd2c3d11 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/docs/XmlItem.md @@ -0,0 +1,37 @@ +# Org.OpenAPITools.Model.XmlItem +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**AttributeString** | **string** | | [optional] +**AttributeNumber** | **decimal** | | [optional] +**AttributeInteger** | **int** | | [optional] +**AttributeBoolean** | **bool** | | [optional] +**WrappedArray** | **List<int>** | | [optional] +**NameString** | **string** | | [optional] +**NameNumber** | **decimal** | | [optional] +**NameInteger** | **int** | | [optional] +**NameBoolean** | **bool** | | [optional] +**NameArray** | **List<int>** | | [optional] +**NameWrappedArray** | **List<int>** | | [optional] +**PrefixString** | **string** | | [optional] +**PrefixNumber** | **decimal** | | [optional] +**PrefixInteger** | **int** | | [optional] +**PrefixBoolean** | **bool** | | [optional] +**PrefixArray** | **List<int>** | | [optional] +**PrefixWrappedArray** | **List<int>** | | [optional] +**NamespaceString** | **string** | | [optional] +**NamespaceNumber** | **decimal** | | [optional] +**NamespaceInteger** | **int** | | [optional] +**NamespaceBoolean** | **bool** | | [optional] +**NamespaceArray** | **List<int>** | | [optional] +**NamespaceWrappedArray** | **List<int>** | | [optional] +**PrefixNsString** | **string** | | [optional] +**PrefixNsNumber** | **decimal** | | [optional] +**PrefixNsInteger** | **int** | | [optional] +**PrefixNsBoolean** | **bool** | | [optional] +**PrefixNsArray** | **List<int>** | | [optional] +**PrefixNsWrappedArray** | **List<int>** | | [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-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Api/AnotherFakeApiTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Api/AnotherFakeApiTests.cs index e888d01f446..7ca3b32befe 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Api/AnotherFakeApiTests.cs +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Api/AnotherFakeApiTests.cs @@ -15,7 +15,7 @@ using System.Collections.ObjectModel; using System.Linq; using System.Reflection; using RestSharp; -using NUnit.Framework; +using Xunit; using Org.OpenAPITools.Client; using Org.OpenAPITools.Api; @@ -30,50 +30,36 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the API endpoint. /// - [TestFixture] public class AnotherFakeApiTests { private AnotherFakeApi instance; - /// - /// Setup before each unit test - /// - [SetUp] - public void Init() - { + public AnotherFakeApiTests() + { instance = new AnotherFakeApi(); } - /// - /// Clean up after each unit test - /// - [TearDown] - public void Cleanup() - { - - } - /// /// Test an instance of AnotherFakeApi /// - [Test] + [Fact] public void InstanceTest() { // TODO uncomment below to test 'IsInstanceOfType' AnotherFakeApi - //Assert.IsInstanceOfType(typeof(AnotherFakeApi), instance, "instance is a AnotherFakeApi"); + //Assert.IsType(typeof(AnotherFakeApi), instance, "instance is a AnotherFakeApi"); } /// /// Test Call123TestSpecialTags /// - [Test] + [Fact] public void Call123TestSpecialTagsTest() { // TODO uncomment below to test the method and replace null with proper value //ModelClient modelClient = null; //var response = instance.Call123TestSpecialTags(modelClient); - //Assert.IsInstanceOf (response, "response is ModelClient"); + //Assert.IsType (response, "response is ModelClient"); } } diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs index 79feb5e5d8f..738f109a203 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs @@ -15,7 +15,7 @@ using System.Collections.ObjectModel; using System.Linq; using System.Reflection; using RestSharp; -using NUnit.Framework; +using Xunit; using Org.OpenAPITools.Client; using Org.OpenAPITools.Api; @@ -30,92 +30,78 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the API endpoint. /// - [TestFixture] public class FakeApiTests { private FakeApi instance; - /// - /// Setup before each unit test - /// - [SetUp] - public void Init() + public FakeApiTests() { instance = new FakeApi(); } - /// - /// Clean up after each unit test - /// - [TearDown] - public void Cleanup() - { - - } - /// /// Test an instance of FakeApi /// - [Test] + [Fact] public void InstanceTest() { // TODO uncomment below to test 'IsInstanceOfType' FakeApi - //Assert.IsInstanceOfType(typeof(FakeApi), instance, "instance is a FakeApi"); + //Assert.IsType(typeof(FakeApi), instance, "instance is a FakeApi"); } /// /// Test FakeOuterBooleanSerialize /// - [Test] + [Fact] public void FakeOuterBooleanSerializeTest() { // TODO uncomment below to test the method and replace null with proper value //bool? body = null; //var response = instance.FakeOuterBooleanSerialize(body); - //Assert.IsInstanceOf (response, "response is bool?"); + //Assert.IsType (response, "response is bool?"); } /// /// Test FakeOuterCompositeSerialize /// - [Test] + [Fact] public void FakeOuterCompositeSerializeTest() { // TODO uncomment below to test the method and replace null with proper value //OuterComposite outerComposite = null; //var response = instance.FakeOuterCompositeSerialize(outerComposite); - //Assert.IsInstanceOf (response, "response is OuterComposite"); + //Assert.IsType (response, "response is OuterComposite"); } /// /// Test FakeOuterNumberSerialize /// - [Test] + [Fact] public void FakeOuterNumberSerializeTest() { // TODO uncomment below to test the method and replace null with proper value //decimal? body = null; //var response = instance.FakeOuterNumberSerialize(body); - //Assert.IsInstanceOf (response, "response is decimal?"); + //Assert.IsType (response, "response is decimal?"); } /// /// Test FakeOuterStringSerialize /// - [Test] + [Fact] public void FakeOuterStringSerializeTest() { // TODO uncomment below to test the method and replace null with proper value //string body = null; //var response = instance.FakeOuterStringSerialize(body); - //Assert.IsInstanceOf (response, "response is string"); + //Assert.IsType (response, "response is string"); } /// /// Test TestBodyWithFileSchema /// - [Test] + [Fact] public void TestBodyWithFileSchemaTest() { // TODO uncomment below to test the method and replace null with proper value @@ -127,7 +113,7 @@ namespace Org.OpenAPITools.Test /// /// Test TestBodyWithQueryParams /// - [Test] + [Fact] public void TestBodyWithQueryParamsTest() { // TODO uncomment below to test the method and replace null with proper value @@ -140,19 +126,19 @@ namespace Org.OpenAPITools.Test /// /// Test TestClientModel /// - [Test] + [Fact] public void TestClientModelTest() { // TODO uncomment below to test the method and replace null with proper value //ModelClient modelClient = null; //var response = instance.TestClientModel(modelClient); - //Assert.IsInstanceOf (response, "response is ModelClient"); + //Assert.IsType (response, "response is ModelClient"); } /// /// Test TestEndpointParameters /// - [Test] + [Fact] public void TestEndpointParametersTest() { // TODO uncomment below to test the method and replace null with proper value @@ -177,7 +163,7 @@ namespace Org.OpenAPITools.Test /// /// Test TestEnumParameters /// - [Test] + [Fact] public void TestEnumParametersTest() { // TODO uncomment below to test the method and replace null with proper value @@ -196,7 +182,7 @@ namespace Org.OpenAPITools.Test /// /// Test TestInlineAdditionalProperties /// - [Test] + [Fact] public void TestInlineAdditionalPropertiesTest() { // TODO uncomment below to test the method and replace null with proper value @@ -208,7 +194,7 @@ namespace Org.OpenAPITools.Test /// /// Test TestJsonFormData /// - [Test] + [Fact] public void TestJsonFormDataTest() { // TODO uncomment below to test the method and replace null with proper value diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Api/FakeClassnameTags123ApiTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Api/FakeClassnameTags123ApiTests.cs index 57afc7f80ad..e1272d442ab 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Api/FakeClassnameTags123ApiTests.cs +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Api/FakeClassnameTags123ApiTests.cs @@ -15,7 +15,7 @@ using System.Collections.ObjectModel; using System.Linq; using System.Reflection; using RestSharp; -using NUnit.Framework; +using Xunit; using Org.OpenAPITools.Client; using Org.OpenAPITools.Api; @@ -30,50 +30,36 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the API endpoint. /// - [TestFixture] public class FakeClassnameTags123ApiTests { private FakeClassnameTags123Api instance; - /// - /// Setup before each unit test - /// - [SetUp] - public void Init() + public FakeClassnameTags123ApiTests() { instance = new FakeClassnameTags123Api(); } - /// - /// Clean up after each unit test - /// - [TearDown] - public void Cleanup() - { - - } - /// /// Test an instance of FakeClassnameTags123Api /// - [Test] + [Fact] public void InstanceTest() { // TODO uncomment below to test 'IsInstanceOfType' FakeClassnameTags123Api - //Assert.IsInstanceOfType(typeof(FakeClassnameTags123Api), instance, "instance is a FakeClassnameTags123Api"); + //Assert.IsType(typeof(FakeClassnameTags123Api), instance, "instance is a FakeClassnameTags123Api"); } /// /// Test TestClassname /// - [Test] + [Fact] public void TestClassnameTest() { // TODO uncomment below to test the method and replace null with proper value //ModelClient modelClient = null; //var response = instance.TestClassname(modelClient); - //Assert.IsInstanceOf (response, "response is ModelClient"); + //Assert.IsType (response, "response is ModelClient"); } } diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Api/PetApiTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Api/PetApiTests.cs index f431631efab..4d946eca6a8 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Api/PetApiTests.cs +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Api/PetApiTests.cs @@ -15,7 +15,7 @@ using System.Collections.ObjectModel; using System.Linq; using System.Reflection; using RestSharp; -using NUnit.Framework; +using Xunit; using Org.OpenAPITools.Client; using Org.OpenAPITools.Api; @@ -30,8 +30,7 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the API endpoint. /// - [TestFixture] - public class PetApiTests + public class PetApiTests : IDisposable { private PetApi instance; @@ -74,12 +73,8 @@ namespace Org.OpenAPITools.Test return bytes; } - /// - /// Setup before each unit test - /// - [SetUp] - public void Init() - { + public PetApiTests() + { instance = new PetApi(); // create pet @@ -89,32 +84,21 @@ namespace Org.OpenAPITools.Test PetApi petApi = new PetApi("http://petstore.swagger.io/v2/"); petApi.AddPet(p); } - - /// - /// Clean up after each unit test - /// - [TearDown] - public void Cleanup() - { - // remove the pet after testing - PetApi petApi = new PetApi(); - petApi.DeletePet(petId, "test key"); - } - + /// /// Test an instance of PetApi /// - [Test] + [Fact] public void InstanceTest() { - Assert.IsInstanceOf(instance); + Assert.IsType(instance); } /// /// Test AddPet /// - [Test] + [Fact] public void AddPetTest() { // create pet @@ -125,7 +109,7 @@ namespace Org.OpenAPITools.Test /// /// Test DeletePet /// - [Test] + [Fact] public void DeletePetTest() { // no need to test as it'c covered by Cleanup() already @@ -134,7 +118,7 @@ namespace Org.OpenAPITools.Test /// /// Test FindPetsByStatus /// - [Test] + [Fact] public void FindPetsByStatusTest() { PetApi petApi = new PetApi(); @@ -143,26 +127,26 @@ namespace Org.OpenAPITools.Test List listPet = petApi.FindPetsByTags(tagsList); foreach (Pet pet in listPet) // Loop through List with foreach. { - Assert.IsInstanceOf(pet); - Assert.AreEqual("csharp sample tag name1", pet.Tags[0]); + Assert.IsType(pet); + Assert.Equal("available", pet.Tags[0].Name); } } /// /// Test FindPetsByTags /// - [Test] + [Fact] public void FindPetsByTagsTest() { List tags = new List(new String[] { "pet" }); var response = instance.FindPetsByTags(tags); - Assert.IsInstanceOf>(response); + Assert.IsType>(response); } /// /// Test GetPetById /// - [Test] + [Fact] public void GetPetByIdTest() { // set timeout to 10 seconds @@ -172,84 +156,84 @@ namespace Org.OpenAPITools.Test PetApi petApi = new PetApi(c1); Pet response = petApi.GetPetById(petId); - Assert.IsInstanceOf(response); + Assert.IsType(response); - Assert.AreEqual("Csharp test", response.Name); - Assert.AreEqual(Pet.StatusEnum.Available, response.Status); + Assert.Equal("Csharp test", response.Name); + Assert.Equal(Pet.StatusEnum.Available, response.Status); - Assert.IsInstanceOf>(response.Tags); - Assert.AreEqual(petId, response.Tags[0].Id); - Assert.AreEqual("csharp sample tag name1", response.Tags[0].Name); + Assert.IsType>(response.Tags); + Assert.Equal(petId, response.Tags[0].Id); + Assert.Equal("csharp sample tag name1", response.Tags[0].Name); - Assert.IsInstanceOf>(response.PhotoUrls); - Assert.AreEqual("sample photoUrls", response.PhotoUrls[0]); + Assert.IsType>(response.PhotoUrls); + Assert.Equal("sample photoUrls", response.PhotoUrls[0]); - Assert.IsInstanceOf(response.Category); - Assert.AreEqual(56, response.Category.Id); - Assert.AreEqual("sample category name2", response.Category.Name); + Assert.IsType(response.Category); + Assert.Equal(56, response.Category.Id); + Assert.Equal("sample category name2", response.Category.Name); } /// /// Test GetPetByIdAsync /// - [Test()] + [Fact] public void TestGetPetByIdAsync() { PetApi petApi = new PetApi(); var task = petApi.GetPetByIdAsync(petId); Pet response = task.Result; - Assert.IsInstanceOf(response); + Assert.IsType(response); - Assert.AreEqual("Csharp test", response.Name); - Assert.AreEqual(Pet.StatusEnum.Available, response.Status); + Assert.Equal("Csharp test", response.Name); + Assert.Equal(Pet.StatusEnum.Available, response.Status); - Assert.IsInstanceOf>(response.Tags); - Assert.AreEqual(petId, response.Tags[0].Id); - Assert.AreEqual("csharp sample tag name1", response.Tags[0].Name); + Assert.IsType>(response.Tags); + Assert.Equal(petId, response.Tags[0].Id); + Assert.Equal("csharp sample tag name1", response.Tags[0].Name); - Assert.IsInstanceOf>(response.PhotoUrls); - Assert.AreEqual("sample photoUrls", response.PhotoUrls[0]); + Assert.IsType>(response.PhotoUrls); + Assert.Equal("sample photoUrls", response.PhotoUrls[0]); - Assert.IsInstanceOf(response.Category); - Assert.AreEqual(56, response.Category.Id); - Assert.AreEqual("sample category name2", response.Category.Name); + Assert.IsType(response.Category); + Assert.Equal(56, response.Category.Id); + Assert.Equal("sample category name2", response.Category.Name); } /// /// Test GetPetByIdAsyncWithHttpInfo /// - [Test()] + [Fact] public void TestGetPetByIdAsyncWithHttpInfo() { PetApi petApi = new PetApi(); var task = petApi.GetPetByIdAsyncWithHttpInfo(petId); - Assert.AreEqual(200, (int)task.Result.StatusCode); - Assert.IsTrue(task.Result.Headers.ContainsKey("Content-Type")); - Assert.AreEqual("application/json", task.Result.Headers["Content-Type"][0]); + Assert.Equal(200, (int)task.Result.StatusCode); + Assert.True(task.Result.Headers.ContainsKey("Content-Type")); + Assert.Equal("application/json", task.Result.Headers["Content-Type"][0]); Pet response = task.Result.Data; - Assert.IsInstanceOf(response); + Assert.IsType(response); - Assert.AreEqual("Csharp test", response.Name); - Assert.AreEqual(Pet.StatusEnum.Available, response.Status); + Assert.Equal("Csharp test", response.Name); + Assert.Equal(Pet.StatusEnum.Available, response.Status); - Assert.IsInstanceOf>(response.Tags); - Assert.AreEqual(petId, response.Tags[0].Id); - Assert.AreEqual("csharp sample tag name1", response.Tags[0].Name); + Assert.IsType>(response.Tags); + Assert.Equal(petId, response.Tags[0].Id); + Assert.Equal("csharp sample tag name1", response.Tags[0].Name); - Assert.IsInstanceOf>(response.PhotoUrls); - Assert.AreEqual("sample photoUrls", response.PhotoUrls[0]); + Assert.IsType>(response.PhotoUrls); + Assert.Equal("sample photoUrls", response.PhotoUrls[0]); - Assert.IsInstanceOf(response.Category); - Assert.AreEqual(56, response.Category.Id); - Assert.AreEqual("sample category name2", response.Category.Name); + Assert.IsType(response.Category); + Assert.Equal(56, response.Category.Id); + Assert.Equal("sample category name2", response.Category.Name); } /// /// Test UpdatePet /// - [Test] + [Fact] public void UpdatePetTest() { // TODO uncomment below to test the method and replace null with proper value @@ -262,33 +246,33 @@ namespace Org.OpenAPITools.Test /// /// Test UpdatePetWithForm /// - [Test] + [Fact] public void UpdatePetWithFormTest() { PetApi petApi = new PetApi(); petApi.UpdatePetWithForm(petId, "new form name", "pending"); Pet response = petApi.GetPetById(petId); - Assert.IsInstanceOf(response); - Assert.IsInstanceOf(response.Category); - Assert.IsInstanceOf>(response.Tags); + Assert.IsType(response); + Assert.IsType(response.Category); + Assert.IsType>(response.Tags); - Assert.AreEqual("new form name", response.Name); - Assert.AreEqual(Pet.StatusEnum.Pending, response.Status); + Assert.Equal("new form name", response.Name); + Assert.Equal(Pet.StatusEnum.Pending, response.Status); - Assert.AreEqual(petId, response.Tags[0].Id); - Assert.AreEqual(56, response.Category.Id); + Assert.Equal(petId, response.Tags[0].Id); + Assert.Equal(56, response.Category.Id); // test optional parameter petApi.UpdatePetWithForm(petId, "new form name2"); Pet response2 = petApi.GetPetById(petId); - Assert.AreEqual("new form name2", response2.Name); + Assert.Equal("new form name2", response2.Name); } /// /// Test UploadFile /// - [Test] + [Fact] public void UploadFileTest() { Assembly _assembly = Assembly.GetExecutingAssembly(); @@ -305,7 +289,7 @@ namespace Org.OpenAPITools.Test /// /// Test UploadFileWithRequiredFile /// - [Test] + [Fact] public void UploadFileWithRequiredFileTest() { // TODO uncomment below to test the method and replace null with proper value @@ -313,27 +297,27 @@ namespace Org.OpenAPITools.Test //System.IO.Stream requiredFile = null; //string additionalMetadata = null; //var response = instance.UploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); - //Assert.IsInstanceOf (response, "response is ApiResponse"); + //Assert.IsType (response, "response is ApiResponse"); } /// /// Test status code /// - [Test()] + [Fact] public void TestStatusCodeAndHeader() { PetApi petApi = new PetApi(); var response = petApi.GetPetByIdWithHttpInfo(petId); - //Assert.AreEqual("OK", response.StatusCode); - Assert.AreEqual(200, (int)response.StatusCode); - Assert.IsTrue(response.Headers.ContainsKey("Content-Type")); - Assert.AreEqual("application/json", response.Headers["Content-Type"][0]); + //Assert.Equal("OK", response.StatusCode); + Assert.Equal(200, (int)response.StatusCode); + Assert.True(response.Headers.ContainsKey("Content-Type")); + Assert.Equal("application/json", response.Headers["Content-Type"][0]); } /// /// Test default header (should be deprecated) /// - [Test()] + [Fact] public void TestDefaultHeader() { //PetApi petApi = new PetApi(); @@ -343,7 +327,13 @@ namespace Org.OpenAPITools.Test // the following should be used instead as suggested in the doc //petApi.Configuration.AddDefaultHeader("header_key2", "header_value2"); } - + + public void Dispose() + { + // remove the pet after testing + PetApi petApi = new PetApi(); + petApi.DeletePet(petId, "test key"); + } } } diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Api/StoreApiTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Api/StoreApiTests.cs index 20a28424ae0..e748042141b 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Api/StoreApiTests.cs +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Api/StoreApiTests.cs @@ -15,7 +15,7 @@ using System.Collections.ObjectModel; using System.Linq; using System.Reflection; using RestSharp; -using NUnit.Framework; +using Xunit; using Org.OpenAPITools.Client; using Org.OpenAPITools.Api; @@ -30,44 +30,30 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the API endpoint. /// - [TestFixture] public class StoreApiTests { private StoreApi instance; - /// - /// Setup before each unit test - /// - [SetUp] - public void Init() + public StoreApiTests() { instance = new StoreApi(); } - /// - /// Clean up after each unit test - /// - [TearDown] - public void Cleanup() - { - - } - /// /// Test an instance of StoreApi /// - [Test] + [Fact] public void InstanceTest() { // TODO uncomment below to test 'IsInstanceOfType' StoreApi - //Assert.IsInstanceOfType(typeof(StoreApi), instance, "instance is a StoreApi"); + //Assert.IsType(typeof(StoreApi), instance, "instance is a StoreApi"); } /// /// Test DeleteOrder /// - [Test] + [Fact] public void DeleteOrderTest() { // TODO uncomment below to test the method and replace null with proper value @@ -79,36 +65,36 @@ namespace Org.OpenAPITools.Test /// /// Test GetInventory /// - [Test] + [Fact] public void GetInventoryTest() { // TODO uncomment below to test the method and replace null with proper value //var response = instance.GetInventory(); - //Assert.IsInstanceOf> (response, "response is Dictionary"); + //Assert.IsType> (response, "response is Dictionary"); } /// /// Test GetOrderById /// - [Test] + [Fact] public void GetOrderByIdTest() { // TODO uncomment below to test the method and replace null with proper value //long? orderId = null; //var response = instance.GetOrderById(orderId); - //Assert.IsInstanceOf (response, "response is Order"); + //Assert.IsType (response, "response is Order"); } /// /// Test PlaceOrder /// - [Test] + [Fact] public void PlaceOrderTest() { // TODO uncomment below to test the method and replace null with proper value //Order order = null; //var response = instance.PlaceOrder(order); - //Assert.IsInstanceOf (response, "response is Order"); + //Assert.IsType (response, "response is Order"); } } diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Api/UserApiTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Api/UserApiTests.cs index 6abe2c9b542..b6ef54ae346 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Api/UserApiTests.cs +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Api/UserApiTests.cs @@ -15,7 +15,7 @@ using System.Collections.ObjectModel; using System.Linq; using System.Reflection; using RestSharp; -using NUnit.Framework; +using Xunit; using Org.OpenAPITools.Client; using Org.OpenAPITools.Api; @@ -30,44 +30,30 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the API endpoint. /// - [TestFixture] public class UserApiTests { private UserApi instance; - /// - /// Setup before each unit test - /// - [SetUp] - public void Init() + public UserApiTests() { instance = new UserApi(); } - /// - /// Clean up after each unit test - /// - [TearDown] - public void Cleanup() - { - - } - /// /// Test an instance of UserApi /// - [Test] + [Fact] public void InstanceTest() { // TODO uncomment below to test 'IsInstanceOfType' UserApi - //Assert.IsInstanceOfType(typeof(UserApi), instance, "instance is a UserApi"); + //Assert.IsType(typeof(UserApi), instance, "instance is a UserApi"); } /// /// Test CreateUser /// - [Test] + [Fact] public void CreateUserTest() { // TODO uncomment below to test the method and replace null with proper value @@ -79,7 +65,7 @@ namespace Org.OpenAPITools.Test /// /// Test CreateUsersWithArrayInput /// - [Test] + [Fact] public void CreateUsersWithArrayInputTest() { // TODO uncomment below to test the method and replace null with proper value @@ -91,7 +77,7 @@ namespace Org.OpenAPITools.Test /// /// Test CreateUsersWithListInput /// - [Test] + [Fact] public void CreateUsersWithListInputTest() { // TODO uncomment below to test the method and replace null with proper value @@ -103,7 +89,7 @@ namespace Org.OpenAPITools.Test /// /// Test DeleteUser /// - [Test] + [Fact] public void DeleteUserTest() { // TODO uncomment below to test the method and replace null with proper value @@ -115,32 +101,32 @@ namespace Org.OpenAPITools.Test /// /// Test GetUserByName /// - [Test] + [Fact] public void GetUserByNameTest() { // TODO uncomment below to test the method and replace null with proper value //string username = null; //var response = instance.GetUserByName(username); - //Assert.IsInstanceOf (response, "response is User"); + //Assert.IsType (response, "response is User"); } /// /// Test LoginUser /// - [Test] + [Fact] public void LoginUserTest() { // TODO uncomment below to test the method and replace null with proper value //string username = null; //string password = null; //var response = instance.LoginUser(username, password); - //Assert.IsInstanceOf (response, "response is string"); + //Assert.IsType (response, "response is string"); } /// /// Test LogoutUser /// - [Test] + [Fact] public void LogoutUserTest() { // TODO uncomment below to test the method and replace null with proper value @@ -151,7 +137,7 @@ namespace Org.OpenAPITools.Test /// /// Test UpdateUser /// - [Test] + [Fact] public void UpdateUserTest() { // TODO uncomment below to test the method and replace null with proper value diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesClassTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesClassTests.cs index e4435f13ab2..9db802aa098 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesClassTests.cs +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesClassTests.cs @@ -9,7 +9,7 @@ */ -using NUnit.Framework; +using Xunit; using System; using System.Linq; @@ -30,46 +30,26 @@ namespace Org.OpenAPITools.Test /// 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 AdditionalPropertiesClassTests { // TODO uncomment below to declare an instance variable for AdditionalPropertiesClass //private AdditionalPropertiesClass instance; - /// - /// Setup before each test - /// - [SetUp] - public void Init() - { - // TODO uncomment below to create an instance of AdditionalPropertiesClass - //instance = new AdditionalPropertiesClass(); - } - - /// - /// Clean up after each test - /// - [TearDown] - public void Cleanup() - { - - } - /// /// Test an instance of AdditionalPropertiesClass /// - [Test] + [Fact] public void AdditionalPropertiesClassInstanceTest() { // TODO uncomment below to test "IsInstanceOfType" AdditionalPropertiesClass - //Assert.IsInstanceOfType (instance, "variable 'instance' is a AdditionalPropertiesClass"); + //Assert.IsType (instance, "variable 'instance' is a AdditionalPropertiesClass"); } /// /// Test the property 'MapProperty' /// - [Test] + [Fact] public void MapPropertyTest() { // TODO unit test for the property 'MapProperty' @@ -77,7 +57,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'MapOfMapProperty' /// - [Test] + [Fact] public void MapOfMapPropertyTest() { // TODO unit test for the property 'MapOfMapProperty' diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/AnimalFarmTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/AnimalFarmTests.cs index cf61e423436..c101b67c92a 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/AnimalFarmTests.cs +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/AnimalFarmTests.cs @@ -9,7 +9,7 @@ */ -using NUnit.Framework; +using Xunit; using System; using System.Linq; @@ -30,39 +30,16 @@ namespace Org.OpenAPITools.Test /// 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 AnimalFarmTests { - // TODO uncomment below to declare an instance variable for AnimalFarm - //private AnimalFarm instance; - - /// - /// Setup before each test - /// - [SetUp] - public void Init() - { - // TODO uncomment below to create an instance of AnimalFarm - //instance = new AnimalFarm(); - } - - /// - /// Clean up after each test - /// - [TearDown] - public void Cleanup() - { - - } - /// /// Test an instance of AnimalFarm /// - [Test] + [Fact] public void AnimalFarmInstanceTest() { // TODO uncomment below to test "IsInstanceOfType" AnimalFarm - //Assert.IsInstanceOfType (instance, "variable 'instance' is a AnimalFarm"); + //Assert.IsType (instance, "variable 'instance' is a AnimalFarm"); } diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/AnimalTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/AnimalTests.cs index 2849d780c8d..9b53b47f8ec 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/AnimalTests.cs +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/AnimalTests.cs @@ -9,7 +9,7 @@ */ -using NUnit.Framework; +using Xunit; using System; using System.Linq; @@ -30,64 +30,41 @@ namespace Org.OpenAPITools.Test /// 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 AnimalTests { - // TODO uncomment below to declare an instance variable for Animal - //private Animal instance; - - /// - /// Setup before each test - /// - [SetUp] - public void Init() - { - // TODO uncomment below to create an instance of Animal - //instance = new Animal(); - } - - /// - /// Clean up after each test - /// - [TearDown] - public void Cleanup() - { - - } - /// /// Test an instance of Animal /// - [Test] + [Fact] public void AnimalInstanceTest() { // TODO uncomment below to test "IsInstanceOfType" Animal - //Assert.IsInstanceOfType (instance, "variable 'instance' is a Animal"); + //Assert.IsType (instance, "variable 'instance' is a Animal"); } /// /// Test deserialize a Dog from type Animal /// - [Test] + [Fact] public void DogDeserializeFromAnimalTest() { // TODO uncomment below to test deserialize a Dog from type Animal - //Assert.IsInstanceOf(JsonConvert.DeserializeObject(new Dog().ToJson())); + //Assert.IsType(JsonConvert.DeserializeObject(new Dog().ToJson())); } /// /// Test deserialize a Cat from type Animal /// - [Test] + [Fact] public void CatDeserializeFromAnimalTest() { // TODO uncomment below to test deserialize a Cat from type Animal - //Assert.IsInstanceOf(JsonConvert.DeserializeObject(new Cat().ToJson())); + //Assert.IsType(JsonConvert.DeserializeObject(new Cat().ToJson())); } /// /// Test the property 'ClassName' /// - [Test] + [Fact] public void ClassNameTest() { // TODO unit test for the property 'ClassName' @@ -95,7 +72,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'Color' /// - [Test] + [Fact] public void ColorTest() { // TODO unit test for the property 'Color' diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ApiResponseTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ApiResponseTests.cs index 70c07575145..53bef990ae8 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ApiResponseTests.cs +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ApiResponseTests.cs @@ -9,7 +9,7 @@ */ -using NUnit.Framework; +using Xunit; using System; using System.Linq; @@ -30,46 +30,23 @@ namespace Org.OpenAPITools.Test /// 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 ApiResponseTests { - // TODO uncomment below to declare an instance variable for ApiResponse - //private ApiResponse instance; - - /// - /// Setup before each test - /// - [SetUp] - public void Init() - { - // TODO uncomment below to create an instance of ApiResponse - //instance = new ApiResponse(); - } - - /// - /// Clean up after each test - /// - [TearDown] - public void Cleanup() - { - - } - /// /// Test an instance of ApiResponse /// - [Test] + [Fact] public void ApiResponseInstanceTest() { // TODO uncomment below to test "IsInstanceOfType" ApiResponse - //Assert.IsInstanceOfType (instance, "variable 'instance' is a ApiResponse"); + //Assert.IsType (instance, "variable 'instance' is a ApiResponse"); } /// /// Test the property 'Code' /// - [Test] + [Fact] public void CodeTest() { // TODO unit test for the property 'Code' @@ -77,7 +54,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'Type' /// - [Test] + [Fact] public void TypeTest() { // TODO unit test for the property 'Type' @@ -85,7 +62,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'Message' /// - [Test] + [Fact] public void MessageTest() { // TODO unit test for the property 'Message' diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ArrayOfArrayOfNumberOnlyTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ArrayOfArrayOfNumberOnlyTests.cs index 6fc0d974e35..884eb8b1e08 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ArrayOfArrayOfNumberOnlyTests.cs +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ArrayOfArrayOfNumberOnlyTests.cs @@ -9,7 +9,7 @@ */ -using NUnit.Framework; +using Xunit; using System; using System.Linq; @@ -30,46 +30,23 @@ namespace Org.OpenAPITools.Test /// 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 ArrayOfArrayOfNumberOnlyTests { - // TODO uncomment below to declare an instance variable for ArrayOfArrayOfNumberOnly - //private ArrayOfArrayOfNumberOnly instance; - - /// - /// Setup before each test - /// - [SetUp] - public void Init() - { - // TODO uncomment below to create an instance of ArrayOfArrayOfNumberOnly - //instance = new ArrayOfArrayOfNumberOnly(); - } - - /// - /// Clean up after each test - /// - [TearDown] - public void Cleanup() - { - - } - /// /// Test an instance of ArrayOfArrayOfNumberOnly /// - [Test] + [Fact] public void ArrayOfArrayOfNumberOnlyInstanceTest() { // TODO uncomment below to test "IsInstanceOfType" ArrayOfArrayOfNumberOnly - //Assert.IsInstanceOfType (instance, "variable 'instance' is a ArrayOfArrayOfNumberOnly"); + //Assert.IsType (instance, "variable 'instance' is a ArrayOfArrayOfNumberOnly"); } /// /// Test the property 'ArrayArrayNumber' /// - [Test] + [Fact] public void ArrayArrayNumberTest() { // 1st instance @@ -94,11 +71,11 @@ namespace Org.OpenAPITools.Test instance2.ArrayArrayNumber = listOfList2; - Assert.IsTrue(instance1.Equals(instance2)); + Assert.True(instance1.Equals(instance2)); // add one more element to list2 list2.Add(183.3m); - Assert.IsFalse(instance1.Equals(instance2)); + Assert.False(instance1.Equals(instance2)); // 3rd instance ArrayOfArrayOfNumberOnly instance3 = new ArrayOfArrayOfNumberOnly(); @@ -109,7 +86,7 @@ namespace Org.OpenAPITools.Test List> listOfList3 = new List>(); instance2.ArrayArrayNumber = listOfList3; - Assert.IsFalse(instance1.Equals(instance3)); + Assert.False(instance1.Equals(instance3)); } } diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ArrayOfNumberOnlyTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ArrayOfNumberOnlyTests.cs index cd7074afaa1..a4d155a0ae1 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ArrayOfNumberOnlyTests.cs +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ArrayOfNumberOnlyTests.cs @@ -9,7 +9,7 @@ */ -using NUnit.Framework; +using Xunit; using System; using System.Linq; @@ -30,46 +30,23 @@ namespace Org.OpenAPITools.Test /// 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 ArrayOfNumberOnlyTests { - // TODO uncomment below to declare an instance variable for ArrayOfNumberOnly - //private ArrayOfNumberOnly instance; - - /// - /// Setup before each test - /// - [SetUp] - public void Init() - { - // TODO uncomment below to create an instance of ArrayOfNumberOnly - //instance = new ArrayOfNumberOnly(); - } - - /// - /// Clean up after each test - /// - [TearDown] - public void Cleanup() - { - - } - /// /// Test an instance of ArrayOfNumberOnly /// - [Test] + [Fact] public void ArrayOfNumberOnlyInstanceTest() { // TODO uncomment below to test "IsInstanceOfType" ArrayOfNumberOnly - //Assert.IsInstanceOfType (instance, "variable 'instance' is a ArrayOfNumberOnly"); + //Assert.IsType (instance, "variable 'instance' is a ArrayOfNumberOnly"); } /// /// Test the property 'ArrayNumber' /// - [Test] + [Fact] public void ArrayNumberTest() { // TODO unit test for the property 'ArrayNumber' diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ArrayTestTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ArrayTestTests.cs index f1f286ce448..73f88865878 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ArrayTestTests.cs +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ArrayTestTests.cs @@ -9,7 +9,7 @@ */ -using NUnit.Framework; +using Xunit; using System; using System.Linq; @@ -30,46 +30,23 @@ namespace Org.OpenAPITools.Test /// 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 ArrayTestTests { - // TODO uncomment below to declare an instance variable for ArrayTest - //private ArrayTest instance; - - /// - /// Setup before each test - /// - [SetUp] - public void Init() - { - // TODO uncomment below to create an instance of ArrayTest - //instance = new ArrayTest(); - } - - /// - /// Clean up after each test - /// - [TearDown] - public void Cleanup() - { - - } - /// /// Test an instance of ArrayTest /// - [Test] + [Fact] public void ArrayTestInstanceTest() { // TODO uncomment below to test "IsInstanceOfType" ArrayTest - //Assert.IsInstanceOfType (instance, "variable 'instance' is a ArrayTest"); + //Assert.IsType (instance, "variable 'instance' is a ArrayTest"); } /// /// Test the property 'ArrayOfString' /// - [Test] + [Fact] public void ArrayOfStringTest() { // TODO unit test for the property 'ArrayOfString' @@ -77,7 +54,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'ArrayArrayOfInteger' /// - [Test] + [Fact] public void ArrayArrayOfIntegerTest() { // TODO unit test for the property 'ArrayArrayOfInteger' @@ -85,7 +62,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'ArrayArrayOfModel' /// - [Test] + [Fact] public void ArrayArrayOfModelTest() { // TODO unit test for the property 'ArrayArrayOfModel' diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/CapitalizationTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/CapitalizationTests.cs index cb003b2abee..ec1d66fc2c7 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/CapitalizationTests.cs +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/CapitalizationTests.cs @@ -9,7 +9,7 @@ */ -using NUnit.Framework; +using Xunit; using System; using System.Linq; @@ -30,46 +30,23 @@ namespace Org.OpenAPITools.Test /// 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 CapitalizationTests { - // TODO uncomment below to declare an instance variable for Capitalization - //private Capitalization instance; - - /// - /// Setup before each test - /// - [SetUp] - public void Init() - { - // TODO uncomment below to create an instance of Capitalization - //instance = new Capitalization(); - } - - /// - /// Clean up after each test - /// - [TearDown] - public void Cleanup() - { - - } - /// /// Test an instance of Capitalization /// - [Test] + [Fact] public void CapitalizationInstanceTest() { // TODO uncomment below to test "IsInstanceOfType" Capitalization - //Assert.IsInstanceOfType (instance, "variable 'instance' is a Capitalization"); + //Assert.IsType (instance, "variable 'instance' is a Capitalization"); } /// /// Test the property 'SmallCamel' /// - [Test] + [Fact] public void SmallCamelTest() { // TODO unit test for the property 'SmallCamel' @@ -77,7 +54,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'CapitalCamel' /// - [Test] + [Fact] public void CapitalCamelTest() { // TODO unit test for the property 'CapitalCamel' @@ -85,7 +62,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'SmallSnake' /// - [Test] + [Fact] public void SmallSnakeTest() { // TODO unit test for the property 'SmallSnake' @@ -93,7 +70,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'CapitalSnake' /// - [Test] + [Fact] public void CapitalSnakeTest() { // TODO unit test for the property 'CapitalSnake' @@ -101,7 +78,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'SCAETHFlowPoints' /// - [Test] + [Fact] public void SCAETHFlowPointsTest() { // TODO unit test for the property 'SCAETHFlowPoints' @@ -109,7 +86,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'ATT_NAME' /// - [Test] + [Fact] public void ATT_NAMETest() { // TODO unit test for the property 'ATT_NAME' diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/CatTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/CatTests.cs index 6cd18d546ed..0f021d67e35 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/CatTests.cs +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/CatTests.cs @@ -9,7 +9,7 @@ */ -using NUnit.Framework; +using Xunit; using System; using System.Linq; @@ -30,46 +30,23 @@ namespace Org.OpenAPITools.Test /// 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 CatTests { - // TODO uncomment below to declare an instance variable for Cat - //private Cat instance; - - /// - /// Setup before each test - /// - [SetUp] - public void Init() - { - // TODO uncomment below to create an instance of Cat - //instance = new Cat(); - } - - /// - /// Clean up after each test - /// - [TearDown] - public void Cleanup() - { - - } - /// /// Test an instance of Cat /// - [Test] + [Fact] public void CatInstanceTest() { // TODO uncomment below to test "IsInstanceOfType" Cat - //Assert.IsInstanceOfType (instance, "variable 'instance' is a Cat"); + //Assert.IsType (instance, "variable 'instance' is a Cat"); } /// /// Test the property 'Declawed' /// - [Test] + [Fact] public void DeclawedTest() { // TODO unit test for the property 'Declawed' diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/CategoryTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/CategoryTests.cs index f964723517e..2f593355590 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/CategoryTests.cs +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/CategoryTests.cs @@ -9,7 +9,7 @@ */ -using NUnit.Framework; +using Xunit; using System; using System.Linq; @@ -30,46 +30,23 @@ namespace Org.OpenAPITools.Test /// 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 CategoryTests { - // TODO uncomment below to declare an instance variable for Category - //private Category instance; - - /// - /// Setup before each test - /// - [SetUp] - public void Init() - { - // TODO uncomment below to create an instance of Category - //instance = new Category(); - } - - /// - /// Clean up after each test - /// - [TearDown] - public void Cleanup() - { - - } - /// /// Test an instance of Category /// - [Test] + [Fact] public void CategoryInstanceTest() { // TODO uncomment below to test "IsInstanceOfType" Category - //Assert.IsInstanceOfType (instance, "variable 'instance' is a Category"); + //Assert.IsType (instance, "variable 'instance' is a Category"); } /// /// Test the property 'Id' /// - [Test] + [Fact] public void IdTest() { // TODO unit test for the property 'Id' @@ -77,7 +54,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'Name' /// - [Test] + [Fact] public void NameTest() { // TODO unit test for the property 'Name' diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ClassModelTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ClassModelTests.cs index 0a6de083da5..953fd93f460 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ClassModelTests.cs +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ClassModelTests.cs @@ -9,7 +9,7 @@ */ -using NUnit.Framework; +using Xunit; using System; using System.Linq; @@ -30,46 +30,24 @@ namespace Org.OpenAPITools.Test /// 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 ClassModelTests { - // TODO uncomment below to declare an instance variable for ClassModel - //private ClassModel instance; - - /// - /// Setup before each test - /// - [SetUp] - public void Init() - { - // TODO uncomment below to create an instance of ClassModel - //instance = new ClassModel(); - } - - /// - /// Clean up after each test - /// - [TearDown] - public void Cleanup() - { - - } /// /// Test an instance of ClassModel /// - [Test] + [Fact] public void ClassModelInstanceTest() { // TODO uncomment below to test "IsInstanceOfType" ClassModel - //Assert.IsInstanceOfType (instance, "variable 'instance' is a ClassModel"); + //Assert.IsType (instance, "variable 'instance' is a ClassModel"); } /// /// Test the property 'Class' /// - [Test] + [Fact] public void ClassTest() { // TODO unit test for the property 'Class' diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/DogTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/DogTests.cs index fbae571470b..0cd4d9125f2 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/DogTests.cs +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/DogTests.cs @@ -9,7 +9,7 @@ */ -using NUnit.Framework; +using Xunit; using System; using System.Linq; @@ -30,46 +30,23 @@ namespace Org.OpenAPITools.Test /// 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 DogTests { - // TODO uncomment below to declare an instance variable for Dog - //private Dog instance; - - /// - /// Setup before each test - /// - [SetUp] - public void Init() - { - // TODO uncomment below to create an instance of Dog - //instance = new Dog(); - } - - /// - /// Clean up after each test - /// - [TearDown] - public void Cleanup() - { - - } - /// /// Test an instance of Dog /// - [Test] + [Fact] public void DogInstanceTest() { // TODO uncomment below to test "IsInstanceOfType" Dog - //Assert.IsInstanceOfType (instance, "variable 'instance' is a Dog"); + //Assert.IsType (instance, "variable 'instance' is a Dog"); } /// /// Test the property 'Breed' /// - [Test] + [Fact] public void BreedTest() { // TODO unit test for the property 'Breed' diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs index 1760e0d4ef3..20c1eb2712f 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs @@ -9,7 +9,7 @@ */ -using NUnit.Framework; +using Xunit; using System; using System.Linq; @@ -30,46 +30,23 @@ namespace Org.OpenAPITools.Test /// 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 EnumArraysTests { - // TODO uncomment below to declare an instance variable for EnumArrays - //private EnumArrays instance; - - /// - /// Setup before each test - /// - [SetUp] - public void Init() - { - // TODO uncomment below to create an instance of EnumArrays - //instance = new EnumArrays(); - } - - /// - /// Clean up after each test - /// - [TearDown] - public void Cleanup() - { - - } - /// /// Test an instance of EnumArrays /// - [Test] + [Fact] public void EnumArraysInstanceTest() { // TODO uncomment below to test "IsInstanceOfType" EnumArrays - //Assert.IsInstanceOfType (instance, "variable 'instance' is a EnumArrays"); + //Assert.IsType (instance, "variable 'instance' is a EnumArrays"); } /// /// Test the property 'JustSymbol' /// - [Test] + [Fact] public void JustSymbolTest() { // TODO unit test for the property 'JustSymbol' @@ -77,7 +54,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'ArrayEnum' /// - [Test] + [Fact] public void ArrayEnumTest() { // TODO unit test for the property 'ArrayEnum' diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/EnumClassTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/EnumClassTests.cs index f1c67fe1914..cd1fb3a70fe 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/EnumClassTests.cs +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/EnumClassTests.cs @@ -9,7 +9,7 @@ */ -using NUnit.Framework; +using Xunit; using System; using System.Linq; @@ -30,39 +30,17 @@ namespace Org.OpenAPITools.Test /// 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 EnumClassTests { - // TODO uncomment below to declare an instance variable for EnumClass - //private EnumClass instance; - - /// - /// Setup before each test - /// - [SetUp] - public void Init() - { - // TODO uncomment below to create an instance of EnumClass - //instance = new EnumClass(); - } - - /// - /// Clean up after each test - /// - [TearDown] - public void Cleanup() - { - - } /// /// Test an instance of EnumClass /// - [Test] + [Fact] public void EnumClassInstanceTest() { // TODO uncomment below to test "IsInstanceOfType" EnumClass - //Assert.IsInstanceOfType (instance, "variable 'instance' is a EnumClass"); + //Assert.IsType (instance, "variable 'instance' is a EnumClass"); } diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs index 6ba0c31db41..215bdb2d3d8 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs @@ -9,7 +9,7 @@ */ -using NUnit.Framework; +using Xunit; using System; using System.Linq; @@ -30,46 +30,23 @@ namespace Org.OpenAPITools.Test /// 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 EnumTestTests { - // TODO uncomment below to declare an instance variable for EnumTest - //private EnumTest instance; - - /// - /// Setup before each test - /// - [SetUp] - public void Init() - { - // TODO uncomment below to create an instance of EnumTest - //instance = new EnumTest(); - } - - /// - /// Clean up after each test - /// - [TearDown] - public void Cleanup() - { - - } - /// /// Test an instance of EnumTest /// - [Test] + [Fact] public void EnumTestInstanceTest() { // TODO uncomment below to test "IsInstanceOfType" EnumTest - //Assert.IsInstanceOfType (instance, "variable 'instance' is a EnumTest"); + //Assert.IsType (instance, "variable 'instance' is a EnumTest"); } /// /// Test the property 'EnumString' /// - [Test] + [Fact] public void EnumStringTest() { // TODO unit test for the property 'EnumString' @@ -77,7 +54,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'EnumStringRequired' /// - [Test] + [Fact] public void EnumStringRequiredTest() { // TODO unit test for the property 'EnumStringRequired' @@ -85,7 +62,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'EnumInteger' /// - [Test] + [Fact] public void EnumIntegerTest() { // TODO unit test for the property 'EnumInteger' @@ -93,7 +70,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'EnumNumber' /// - [Test] + [Fact] public void EnumNumberTest() { // TODO unit test for the property 'EnumNumber' @@ -101,7 +78,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'OuterEnum' /// - [Test] + [Fact] public void OuterEnumTest() { // TODO unit test for the property 'OuterEnum' diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs index bb47c43dc7a..ee350d994ee 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs @@ -9,7 +9,7 @@ */ -using NUnit.Framework; +using Xunit; using System; using System.Linq; @@ -30,46 +30,23 @@ namespace Org.OpenAPITools.Test /// 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] + [Fact] public void FileSchemaTestClassInstanceTest() { // TODO uncomment below to test "IsInstanceOfType" FileSchemaTestClass - //Assert.IsInstanceOfType (instance, "variable 'instance' is a FileSchemaTestClass"); + //Assert.IsType (instance, "variable 'instance' is a FileSchemaTestClass"); } /// /// Test the property 'File' /// - [Test] + [Fact] public void FileTest() { // TODO unit test for the property 'File' @@ -77,7 +54,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'Files' /// - [Test] + [Fact] public void FilesTest() { // TODO unit test for the property 'Files' diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/FileTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/FileTests.cs index f1cf54c22e4..d4a0d4f1eb4 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/FileTests.cs +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/FileTests.cs @@ -9,7 +9,7 @@ */ -using NUnit.Framework; +using Xunit; using System; using System.Linq; @@ -30,46 +30,23 @@ namespace Org.OpenAPITools.Test /// 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] + [Fact] public void FileInstanceTest() { // TODO uncomment below to test "IsInstanceOfType" File - //Assert.IsInstanceOfType (instance, "variable 'instance' is a File"); + //Assert.IsType (instance, "variable 'instance' is a File"); } /// /// Test the property 'SourceURI' /// - [Test] + [Fact] public void SourceURITest() { // TODO unit test for the property 'SourceURI' diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs index cca85ec5b2a..ddde2296c95 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs @@ -9,7 +9,7 @@ */ -using NUnit.Framework; +using Xunit; using System; using System.Linq; @@ -30,46 +30,23 @@ namespace Org.OpenAPITools.Test /// 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 FormatTestTests { - // TODO uncomment below to declare an instance variable for FormatTest - //private FormatTest instance; - - /// - /// Setup before each test - /// - [SetUp] - public void Init() - { - // TODO uncomment below to create an instance of FormatTest - //instance = new FormatTest(); - } - - /// - /// Clean up after each test - /// - [TearDown] - public void Cleanup() - { - - } - /// /// Test an instance of FormatTest /// - [Test] + [Fact] public void FormatTestInstanceTest() { // TODO uncomment below to test "IsInstanceOfType" FormatTest - //Assert.IsInstanceOfType (instance, "variable 'instance' is a FormatTest"); + //Assert.IsType (instance, "variable 'instance' is a FormatTest"); } /// /// Test the property 'Integer' /// - [Test] + [Fact] public void IntegerTest() { // TODO unit test for the property 'Integer' @@ -77,7 +54,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'Int32' /// - [Test] + [Fact] public void Int32Test() { // TODO unit test for the property 'Int32' @@ -85,7 +62,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'Int64' /// - [Test] + [Fact] public void Int64Test() { // TODO unit test for the property 'Int64' @@ -93,7 +70,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'Number' /// - [Test] + [Fact] public void NumberTest() { // TODO unit test for the property 'Number' @@ -101,7 +78,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'Float' /// - [Test] + [Fact] public void FloatTest() { // TODO unit test for the property 'Float' @@ -109,7 +86,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'Double' /// - [Test] + [Fact] public void DoubleTest() { // TODO unit test for the property 'Double' @@ -117,7 +94,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'String' /// - [Test] + [Fact] public void StringTest() { // TODO unit test for the property 'String' @@ -125,7 +102,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'Byte' /// - [Test] + [Fact] public void ByteTest() { // TODO unit test for the property 'Byte' @@ -133,7 +110,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'Binary' /// - [Test] + [Fact] public void BinaryTest() { // TODO unit test for the property 'Binary' @@ -141,7 +118,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'Date' /// - [Test] + [Fact] public void DateTest() { // TODO unit test for the property 'Date' @@ -149,7 +126,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'DateTime' /// - [Test] + [Fact] public void DateTimeTest() { // TODO unit test for the property 'DateTime' @@ -157,7 +134,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'Uuid' /// - [Test] + [Fact] public void UuidTest() { // TODO unit test for the property 'Uuid' @@ -165,7 +142,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'Password' /// - [Test] + [Fact] public void PasswordTest() { // TODO unit test for the property 'Password' diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/HasOnlyReadOnlyTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/HasOnlyReadOnlyTests.cs index 1fef4b1371e..ba33b63963d 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/HasOnlyReadOnlyTests.cs +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/HasOnlyReadOnlyTests.cs @@ -9,7 +9,7 @@ */ -using NUnit.Framework; +using Xunit; using System; using System.Linq; @@ -30,46 +30,23 @@ namespace Org.OpenAPITools.Test /// 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 HasOnlyReadOnlyTests { - // TODO uncomment below to declare an instance variable for HasOnlyReadOnly - //private HasOnlyReadOnly instance; - - /// - /// Setup before each test - /// - [SetUp] - public void Init() - { - // TODO uncomment below to create an instance of HasOnlyReadOnly - //instance = new HasOnlyReadOnly(); - } - - /// - /// Clean up after each test - /// - [TearDown] - public void Cleanup() - { - - } - /// /// Test an instance of HasOnlyReadOnly /// - [Test] + [Fact] public void HasOnlyReadOnlyInstanceTest() { // TODO uncomment below to test "IsInstanceOfType" HasOnlyReadOnly - //Assert.IsInstanceOfType (instance, "variable 'instance' is a HasOnlyReadOnly"); + //Assert.IsType (instance, "variable 'instance' is a HasOnlyReadOnly"); } /// /// Test the property 'Bar' /// - [Test] + [Fact] public void BarTest() { // TODO unit test for the property 'Bar' @@ -77,7 +54,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'Foo' /// - [Test] + [Fact] public void FooTest() { // TODO unit test for the property 'Foo' diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ListTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ListTests.cs index 983fd757c32..121957b0e4f 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ListTests.cs +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ListTests.cs @@ -9,7 +9,7 @@ */ -using NUnit.Framework; +using Xunit; using System; using System.Linq; @@ -30,46 +30,23 @@ namespace Org.OpenAPITools.Test /// 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 ListTests { - // TODO uncomment below to declare an instance variable for List - //private List instance; - - /// - /// Setup before each test - /// - [SetUp] - public void Init() - { - // TODO uncomment below to create an instance of List - //instance = new List(); - } - - /// - /// Clean up after each test - /// - [TearDown] - public void Cleanup() - { - - } - /// /// Test an instance of List /// - [Test] + [Fact] public void ListInstanceTest() { // TODO uncomment below to test "IsInstanceOfType" List - //Assert.IsInstanceOfType (instance, "variable 'instance' is a List"); + //Assert.IsType (instance, "variable 'instance' is a List"); } /// /// Test the property '_123List' /// - [Test] + [Fact] public void _123ListTest() { // TODO unit test for the property '_123List' diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/MapTestTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/MapTestTests.cs index 9bb76bde239..6a63cb95660 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/MapTestTests.cs +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/MapTestTests.cs @@ -9,7 +9,7 @@ */ -using NUnit.Framework; +using Xunit; using System; using System.Linq; @@ -30,46 +30,23 @@ namespace Org.OpenAPITools.Test /// 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 MapTestTests { - // TODO uncomment below to declare an instance variable for MapTest - //private MapTest instance; - - /// - /// Setup before each test - /// - [SetUp] - public void Init() - { - // TODO uncomment below to create an instance of MapTest - //instance = new MapTest(); - } - - /// - /// Clean up after each test - /// - [TearDown] - public void Cleanup() - { - - } - /// /// Test an instance of MapTest /// - [Test] + [Fact] public void MapTestInstanceTest() { // TODO uncomment below to test "IsInstanceOfType" MapTest - //Assert.IsInstanceOfType (instance, "variable 'instance' is a MapTest"); + //Assert.IsType (instance, "variable 'instance' is a MapTest"); } /// /// Test the property 'MapMapOfString' /// - [Test] + [Fact] public void MapMapOfStringTest() { // TODO unit test for the property 'MapMapOfString' @@ -77,7 +54,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'MapOfEnumString' /// - [Test] + [Fact] public void MapOfEnumStringTest() { // TODO unit test for the property 'MapOfEnumString' @@ -85,7 +62,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'DirectMap' /// - [Test] + [Fact] public void DirectMapTest() { // TODO unit test for the property 'DirectMap' @@ -93,7 +70,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'IndirectMap' /// - [Test] + [Fact] public void IndirectMapTest() { // TODO unit test for the property 'IndirectMap' diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/MixedPropertiesAndAdditionalPropertiesClassTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/MixedPropertiesAndAdditionalPropertiesClassTests.cs index 72e5a9130b9..338537287c2 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/MixedPropertiesAndAdditionalPropertiesClassTests.cs +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/MixedPropertiesAndAdditionalPropertiesClassTests.cs @@ -9,7 +9,7 @@ */ -using NUnit.Framework; +using Xunit; using System; using System.Linq; @@ -30,46 +30,23 @@ namespace Org.OpenAPITools.Test /// 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 MixedPropertiesAndAdditionalPropertiesClassTests { - // TODO uncomment below to declare an instance variable for MixedPropertiesAndAdditionalPropertiesClass - //private MixedPropertiesAndAdditionalPropertiesClass instance; - - /// - /// Setup before each test - /// - [SetUp] - public void Init() - { - // TODO uncomment below to create an instance of MixedPropertiesAndAdditionalPropertiesClass - //instance = new MixedPropertiesAndAdditionalPropertiesClass(); - } - - /// - /// Clean up after each test - /// - [TearDown] - public void Cleanup() - { - - } - /// /// Test an instance of MixedPropertiesAndAdditionalPropertiesClass /// - [Test] + [Fact] public void MixedPropertiesAndAdditionalPropertiesClassInstanceTest() { // TODO uncomment below to test "IsInstanceOfType" MixedPropertiesAndAdditionalPropertiesClass - //Assert.IsInstanceOfType (instance, "variable 'instance' is a MixedPropertiesAndAdditionalPropertiesClass"); + //Assert.IsType (instance, "variable 'instance' is a MixedPropertiesAndAdditionalPropertiesClass"); } /// /// Test the property 'Uuid' /// - [Test] + [Fact] public void UuidTest() { // TODO unit test for the property 'Uuid' @@ -77,7 +54,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'DateTime' /// - [Test] + [Fact] public void DateTimeTest() { // TODO unit test for the property 'DateTime' @@ -85,7 +62,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'Map' /// - [Test] + [Fact] public void MapTest() { // TODO unit test for the property 'Map' diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/Model200ResponseTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/Model200ResponseTests.cs index f85a9a6a581..6b830deb1ad 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/Model200ResponseTests.cs +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/Model200ResponseTests.cs @@ -9,7 +9,7 @@ */ -using NUnit.Framework; +using Xunit; using System; using System.Linq; @@ -30,46 +30,23 @@ namespace Org.OpenAPITools.Test /// 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 Model200ResponseTests { - // TODO uncomment below to declare an instance variable for Model200Response - //private Model200Response instance; - - /// - /// Setup before each test - /// - [SetUp] - public void Init() - { - // TODO uncomment below to create an instance of Model200Response - //instance = new Model200Response(); - } - - /// - /// Clean up after each test - /// - [TearDown] - public void Cleanup() - { - - } - /// /// Test an instance of Model200Response /// - [Test] + [Fact] public void Model200ResponseInstanceTest() { // TODO uncomment below to test "IsInstanceOfType" Model200Response - //Assert.IsInstanceOfType (instance, "variable 'instance' is a Model200Response"); + //Assert.IsType (instance, "variable 'instance' is a Model200Response"); } /// /// Test the property 'Name' /// - [Test] + [Fact] public void NameTest() { // TODO unit test for the property 'Name' @@ -77,7 +54,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'Class' /// - [Test] + [Fact] public void ClassTest() { // TODO unit test for the property 'Class' diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ModelClientTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ModelClientTests.cs index db4530153a8..a74c816320b 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ModelClientTests.cs +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ModelClientTests.cs @@ -9,7 +9,7 @@ */ -using NUnit.Framework; +using Xunit; using System; using System.Linq; @@ -30,46 +30,23 @@ namespace Org.OpenAPITools.Test /// 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 ModelClientTests { - // TODO uncomment below to declare an instance variable for ModelClient - //private ModelClient instance; - - /// - /// Setup before each test - /// - [SetUp] - public void Init() - { - // TODO uncomment below to create an instance of ModelClient - //instance = new ModelClient(); - } - - /// - /// Clean up after each test - /// - [TearDown] - public void Cleanup() - { - - } - /// /// Test an instance of ModelClient /// - [Test] + [Fact] public void ModelClientInstanceTest() { // TODO uncomment below to test "IsInstanceOfType" ModelClient - //Assert.IsInstanceOfType (instance, "variable 'instance' is a ModelClient"); + //Assert.IsType (instance, "variable 'instance' is a ModelClient"); } /// /// Test the property '__Client' /// - [Test] + [Fact] public void __ClientTest() { // TODO unit test for the property '__Client' diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/NameTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/NameTests.cs index 5575f11af51..14812bc5932 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/NameTests.cs +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/NameTests.cs @@ -9,7 +9,7 @@ */ -using NUnit.Framework; +using Xunit; using System; using System.Linq; @@ -30,46 +30,24 @@ namespace Org.OpenAPITools.Test /// 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 NameTests { - // TODO uncomment below to declare an instance variable for Name - //private Name instance; - - /// - /// Setup before each test - /// - [SetUp] - public void Init() - { - // TODO uncomment below to create an instance of Name - //instance = new Name(); - } - - /// - /// Clean up after each test - /// - [TearDown] - public void Cleanup() - { - - } /// /// Test an instance of Name /// - [Test] + [Fact] public void NameInstanceTest() { // TODO uncomment below to test "IsInstanceOfType" Name - //Assert.IsInstanceOfType (instance, "variable 'instance' is a Name"); + //Assert.IsType (instance, "variable 'instance' is a Name"); } /// /// Test the property '_Name' /// - [Test] + [Fact] public void _NameTest() { // TODO unit test for the property '_Name' @@ -77,7 +55,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'SnakeCase' /// - [Test] + [Fact] public void SnakeCaseTest() { // TODO unit test for the property 'SnakeCase' @@ -85,7 +63,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'Property' /// - [Test] + [Fact] public void PropertyTest() { // TODO unit test for the property 'Property' @@ -93,7 +71,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property '_123Number' /// - [Test] + [Fact] public void _123NumberTest() { // TODO unit test for the property '_123Number' diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/NumberOnlyTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/NumberOnlyTests.cs index d9b5c4ea499..4e6b6674d41 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/NumberOnlyTests.cs +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/NumberOnlyTests.cs @@ -9,7 +9,7 @@ */ -using NUnit.Framework; +using Xunit; using System; using System.Linq; @@ -30,46 +30,23 @@ namespace Org.OpenAPITools.Test /// 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 NumberOnlyTests { - // TODO uncomment below to declare an instance variable for NumberOnly - //private NumberOnly instance; - - /// - /// Setup before each test - /// - [SetUp] - public void Init() - { - // TODO uncomment below to create an instance of NumberOnly - //instance = new NumberOnly(); - } - - /// - /// Clean up after each test - /// - [TearDown] - public void Cleanup() - { - - } - /// /// Test an instance of NumberOnly /// - [Test] + [Fact] public void NumberOnlyInstanceTest() { // TODO uncomment below to test "IsInstanceOfType" NumberOnly - //Assert.IsInstanceOfType (instance, "variable 'instance' is a NumberOnly"); + //Assert.IsType (instance, "variable 'instance' is a NumberOnly"); } /// /// Test the property 'JustNumber' /// - [Test] + [Fact] public void JustNumberTest() { // TODO unit test for the property 'JustNumber' diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/OrderTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/OrderTests.cs index 36853bd0d17..52c21c54943 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/OrderTests.cs +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/OrderTests.cs @@ -9,7 +9,7 @@ */ -using NUnit.Framework; +using Xunit; using System; using System.Linq; @@ -30,46 +30,24 @@ namespace Org.OpenAPITools.Test /// 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 OrderTests { - // TODO uncomment below to declare an instance variable for Order - //private Order instance; - - /// - /// Setup before each test - /// - [SetUp] - public void Init() - { - // TODO uncomment below to create an instance of Order - //instance = new Order(); - } - - /// - /// Clean up after each test - /// - [TearDown] - public void Cleanup() - { - - } /// /// Test an instance of Order /// - [Test] + [Fact] public void OrderInstanceTest() { // TODO uncomment below to test "IsInstanceOfType" Order - //Assert.IsInstanceOfType (instance, "variable 'instance' is a Order"); + //Assert.IsType (instance, "variable 'instance' is a Order"); } /// /// Test the property 'Id' /// - [Test] + [Fact] public void IdTest() { // TODO unit test for the property 'Id' @@ -77,7 +55,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'PetId' /// - [Test] + [Fact] public void PetIdTest() { // TODO unit test for the property 'PetId' @@ -85,7 +63,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'Quantity' /// - [Test] + [Fact] public void QuantityTest() { // TODO unit test for the property 'Quantity' @@ -93,7 +71,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'ShipDate' /// - [Test] + [Fact] public void ShipDateTest() { // TODO unit test for the property 'ShipDate' @@ -101,7 +79,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'Status' /// - [Test] + [Fact] public void StatusTest() { // TODO unit test for the property 'Status' @@ -109,7 +87,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'Complete' /// - [Test] + [Fact] public void CompleteTest() { // TODO unit test for the property 'Complete' diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/OuterCompositeTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/OuterCompositeTests.cs index 7069f4e9554..2d95d9b8ef2 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/OuterCompositeTests.cs +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/OuterCompositeTests.cs @@ -9,7 +9,7 @@ */ -using NUnit.Framework; +using Xunit; using System; using System.Linq; @@ -30,46 +30,23 @@ namespace Org.OpenAPITools.Test /// 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 OuterCompositeTests { - // TODO uncomment below to declare an instance variable for OuterComposite - //private OuterComposite instance; - - /// - /// Setup before each test - /// - [SetUp] - public void Init() - { - // TODO uncomment below to create an instance of OuterComposite - //instance = new OuterComposite(); - } - - /// - /// Clean up after each test - /// - [TearDown] - public void Cleanup() - { - - } - /// /// Test an instance of OuterComposite /// - [Test] + [Fact] public void OuterCompositeInstanceTest() { // TODO uncomment below to test "IsInstanceOfType" OuterComposite - //Assert.IsInstanceOfType (instance, "variable 'instance' is a OuterComposite"); + //Assert.IsType (instance, "variable 'instance' is a OuterComposite"); } /// /// Test the property 'MyNumber' /// - [Test] + [Fact] public void MyNumberTest() { // TODO unit test for the property 'MyNumber' @@ -77,7 +54,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'MyString' /// - [Test] + [Fact] public void MyStringTest() { // TODO unit test for the property 'MyString' @@ -85,7 +62,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'MyBoolean' /// - [Test] + [Fact] public void MyBooleanTest() { // TODO unit test for the property 'MyBoolean' diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/OuterEnumTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/OuterEnumTests.cs index f482ff479ec..00f93e5e859 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/OuterEnumTests.cs +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/OuterEnumTests.cs @@ -9,7 +9,7 @@ */ -using NUnit.Framework; +using Xunit; using System; using System.Linq; @@ -30,39 +30,17 @@ namespace Org.OpenAPITools.Test /// 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 OuterEnumTests { - // TODO uncomment below to declare an instance variable for OuterEnum - //private OuterEnum instance; - - /// - /// Setup before each test - /// - [SetUp] - public void Init() - { - // TODO uncomment below to create an instance of OuterEnum - //instance = new OuterEnum(); - } - - /// - /// Clean up after each test - /// - [TearDown] - public void Cleanup() - { - - } /// /// Test an instance of OuterEnum /// - [Test] + [Fact] public void OuterEnumInstanceTest() { // TODO uncomment below to test "IsInstanceOfType" OuterEnum - //Assert.IsInstanceOfType (instance, "variable 'instance' is a OuterEnum"); + //Assert.IsType (instance, "variable 'instance' is a OuterEnum"); } diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/PetTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/PetTests.cs index 0eb60b7b6f9..a680938da9c 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/PetTests.cs +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/PetTests.cs @@ -9,7 +9,7 @@ */ -using NUnit.Framework; +using Xunit; using System; using System.Linq; @@ -30,47 +30,27 @@ namespace Org.OpenAPITools.Test /// 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 PetTests { //private Pet instance; private long petId = 11088; - /// - /// Setup before each test - /// - [SetUp] - public void Init() - { - // TODO uncomment below to create an instance of Pet - //instance = new Pet(); - } - - /// - /// Clean up after each test - /// - [TearDown] - public void Cleanup() - { - - } - /// /// Test an instance of Pet /// - [Test] + [Fact] public void PetInstanceTest() { // TODO uncomment below to test "IsInstanceOfType" Pet - //Assert.IsInstanceOfType (instance, "variable 'instance' is a Pet"); + //Assert.IsType (instance, "variable 'instance' is a Pet"); } /// /// Test the property 'Id' /// - [Test] + [Fact] public void IdTest() { // TODO unit test for the property 'Id' @@ -78,7 +58,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'Category' /// - [Test] + [Fact] public void CategoryTest() { // TODO unit test for the property 'Category' @@ -86,7 +66,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'Name' /// - [Test] + [Fact] public void NameTest() { // TODO unit test for the property 'Name' @@ -94,7 +74,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'PhotoUrls' /// - [Test] + [Fact] public void PhotoUrlsTest() { // TODO unit test for the property 'PhotoUrls' @@ -102,7 +82,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'Tags' /// - [Test] + [Fact] public void TagsTest() { // TODO unit test for the property 'Tags' @@ -110,7 +90,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'Status' /// - [Test] + [Fact] public void StatusTest() { // TODO unit test for the property 'Status' @@ -119,18 +99,18 @@ namespace Org.OpenAPITools.Test /// /// Test serialization /// - [Test()] + [Fact] public void TestSerialization() { // create pet Pet p1 = new Pet(name: "Csharp test", photoUrls: new List { "http://petstore.com/csharp_test" }); - Assert.AreEqual("{\"name\":\"Csharp test\",\"photoUrls\":[\"http://petstore.com/csharp_test\"]}", JsonConvert.SerializeObject(p1)); + Assert.Equal("{\"name\":\"Csharp test\",\"photoUrls\":[\"http://petstore.com/csharp_test\"]}", JsonConvert.SerializeObject(p1)); } /// /// Test Equal /// - [Test()] + [Fact] public void TestEqual() { // create pet @@ -172,23 +152,23 @@ namespace Org.OpenAPITools.Test p2.PhotoUrls = photoUrls2; // p1 and p2 should be equal (both object and attribute level) - Assert.IsTrue(category1.Equals(category2)); - Assert.IsTrue(tags1.SequenceEqual(tags2)); - Assert.IsTrue(p1.PhotoUrls.SequenceEqual(p2.PhotoUrls)); + Assert.True(category1.Equals(category2)); + Assert.True(tags1.SequenceEqual(tags2)); + Assert.True(p1.PhotoUrls.SequenceEqual(p2.PhotoUrls)); - Assert.IsTrue(p1.Equals(p2)); + Assert.True(p1.Equals(p2)); // update attribute to that p1 and p2 are not equal category2.Name = "new category name"; - Assert.IsFalse(category1.Equals(category2)); + Assert.False(category1.Equals(category2)); tags2 = new List(); - Assert.IsFalse(tags1.SequenceEqual(tags2)); + Assert.False(tags1.SequenceEqual(tags2)); // photoUrls has not changed so it should be equal - Assert.IsTrue(p1.PhotoUrls.SequenceEqual(p2.PhotoUrls)); + Assert.True(p1.PhotoUrls.SequenceEqual(p2.PhotoUrls)); - Assert.IsFalse(p1.Equals(p2)); + Assert.False(p1.Equals(p2)); } } diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ReadOnlyFirstTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ReadOnlyFirstTests.cs index cf1a8f54bb8..30122560856 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ReadOnlyFirstTests.cs +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ReadOnlyFirstTests.cs @@ -9,7 +9,7 @@ */ -using NUnit.Framework; +using Xunit; using System; using System.Linq; @@ -30,46 +30,23 @@ namespace Org.OpenAPITools.Test /// 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 ReadOnlyFirstTests { - // TODO uncomment below to declare an instance variable for ReadOnlyFirst - //private ReadOnlyFirst instance; - - /// - /// Setup before each test - /// - [SetUp] - public void Init() - { - // TODO uncomment below to create an instance of ReadOnlyFirst - //instance = new ReadOnlyFirst(); - } - - /// - /// Clean up after each test - /// - [TearDown] - public void Cleanup() - { - - } - /// /// Test an instance of ReadOnlyFirst /// - [Test] + [Fact] public void ReadOnlyFirstInstanceTest() { // TODO uncomment below to test "IsInstanceOfType" ReadOnlyFirst - //Assert.IsInstanceOfType (instance, "variable 'instance' is a ReadOnlyFirst"); + //Assert.IsType (instance, "variable 'instance' is a ReadOnlyFirst"); } /// /// Test the property 'Bar' /// - [Test] + [Fact] public void BarTest() { // TODO unit test for the property 'Bar' @@ -77,7 +54,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'Baz' /// - [Test] + [Fact] public void BazTest() { // TODO unit test for the property 'Baz' diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ReturnTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ReturnTests.cs index 1ac79a9f910..ce4d43f26d1 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ReturnTests.cs +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ReturnTests.cs @@ -9,7 +9,7 @@ */ -using NUnit.Framework; +using Xunit; using System; using System.Linq; @@ -30,46 +30,23 @@ namespace Org.OpenAPITools.Test /// 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 ReturnTests { - // TODO uncomment below to declare an instance variable for Return - //private Return instance; - - /// - /// Setup before each test - /// - [SetUp] - public void Init() - { - // TODO uncomment below to create an instance of Return - //instance = new Return(); - } - - /// - /// Clean up after each test - /// - [TearDown] - public void Cleanup() - { - - } - /// /// Test an instance of Return /// - [Test] + [Fact] public void ReturnInstanceTest() { // TODO uncomment below to test "IsInstanceOfType" Return - //Assert.IsInstanceOfType (instance, "variable 'instance' is a Return"); + //Assert.IsType (instance, "variable 'instance' is a Return"); } /// /// Test the property '_Return' /// - [Test] + [Fact] public void _ReturnTest() { // TODO unit test for the property '_Return' diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/SpecialModelNameTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/SpecialModelNameTests.cs index 0a4dcb6a7bc..506fb3738b2 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/SpecialModelNameTests.cs +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/SpecialModelNameTests.cs @@ -9,7 +9,7 @@ */ -using NUnit.Framework; +using Xunit; using System; using System.Linq; @@ -30,46 +30,23 @@ namespace Org.OpenAPITools.Test /// 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 SpecialModelNameTests { - // TODO uncomment below to declare an instance variable for SpecialModelName - //private SpecialModelName instance; - - /// - /// Setup before each test - /// - [SetUp] - public void Init() - { - // TODO uncomment below to create an instance of SpecialModelName - //instance = new SpecialModelName(); - } - - /// - /// Clean up after each test - /// - [TearDown] - public void Cleanup() - { - - } - /// /// Test an instance of SpecialModelName /// - [Test] + [Fact] public void SpecialModelNameInstanceTest() { // TODO uncomment below to test "IsInstanceOfType" SpecialModelName - //Assert.IsInstanceOfType (instance, "variable 'instance' is a SpecialModelName"); + //Assert.IsType (instance, "variable 'instance' is a SpecialModelName"); } /// /// Test the property 'SpecialPropertyName' /// - [Test] + [Fact] public void SpecialPropertyNameTest() { // TODO unit test for the property 'SpecialPropertyName' diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/StringBooleanMapTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/StringBooleanMapTests.cs index efc4cd90773..b26045d4145 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/StringBooleanMapTests.cs +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/StringBooleanMapTests.cs @@ -9,7 +9,7 @@ */ -using NUnit.Framework; +using Xunit; using System; using System.Linq; @@ -30,39 +30,16 @@ namespace Org.OpenAPITools.Test /// 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] + [Fact] public void StringBooleanMapInstanceTest() { // TODO uncomment below to test "IsInstanceOfType" StringBooleanMap - //Assert.IsInstanceOfType (instance, "variable 'instance' is a StringBooleanMap"); + //Assert.IsType (instance, "variable 'instance' is a StringBooleanMap"); } diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/TagTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/TagTests.cs index 52ee4ca988f..07921f122ae 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/TagTests.cs +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/TagTests.cs @@ -9,7 +9,7 @@ */ -using NUnit.Framework; +using Xunit; using System; using System.Linq; @@ -30,46 +30,23 @@ namespace Org.OpenAPITools.Test /// 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 TagTests { - // TODO uncomment below to declare an instance variable for Tag - //private Tag instance; - - /// - /// Setup before each test - /// - [SetUp] - public void Init() - { - // TODO uncomment below to create an instance of Tag - //instance = new Tag(); - } - - /// - /// Clean up after each test - /// - [TearDown] - public void Cleanup() - { - - } - /// /// Test an instance of Tag /// - [Test] + [Fact] public void TagInstanceTest() { // TODO uncomment below to test "IsInstanceOfType" Tag - //Assert.IsInstanceOfType (instance, "variable 'instance' is a Tag"); + //Assert.IsType (instance, "variable 'instance' is a Tag"); } /// /// Test the property 'Id' /// - [Test] + [Fact] public void IdTest() { // TODO unit test for the property 'Id' @@ -77,7 +54,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'Name' /// - [Test] + [Fact] public void NameTest() { // TODO unit test for the property 'Name' diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/TypeHolderDefaultTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/TypeHolderDefaultTests.cs index f4c78879bf0..9bd2b1afb1c 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/TypeHolderDefaultTests.cs +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/TypeHolderDefaultTests.cs @@ -9,7 +9,7 @@ */ -using NUnit.Framework; +using Xunit; using System; using System.Linq; @@ -30,46 +30,23 @@ namespace Org.OpenAPITools.Test /// 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 TypeHolderDefaultTests { - // TODO uncomment below to declare an instance variable for TypeHolderDefault - //private TypeHolderDefault instance; - - /// - /// Setup before each test - /// - [SetUp] - public void Init() - { - // TODO uncomment below to create an instance of TypeHolderDefault - //instance = new TypeHolderDefault(); - } - - /// - /// Clean up after each test - /// - [TearDown] - public void Cleanup() - { - - } - /// /// Test an instance of TypeHolderDefault /// - [Test] + [Fact] public void TypeHolderDefaultInstanceTest() { // TODO uncomment below to test "IsInstanceOfType" TypeHolderDefault - //Assert.IsInstanceOfType (instance, "variable 'instance' is a TypeHolderDefault"); + //Assert.IsType (instance, "variable 'instance' is a TypeHolderDefault"); } /// /// Test the property 'StringItem' /// - [Test] + [Fact] public void StringItemTest() { // TODO unit test for the property 'StringItem' @@ -77,7 +54,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'NumberItem' /// - [Test] + [Fact] public void NumberItemTest() { // TODO unit test for the property 'NumberItem' @@ -85,7 +62,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'IntegerItem' /// - [Test] + [Fact] public void IntegerItemTest() { // TODO unit test for the property 'IntegerItem' @@ -93,7 +70,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'BoolItem' /// - [Test] + [Fact] public void BoolItemTest() { // TODO unit test for the property 'BoolItem' @@ -101,7 +78,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'ArrayItem' /// - [Test] + [Fact] public void ArrayItemTest() { // TODO unit test for the property 'ArrayItem' diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/TypeHolderExampleTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/TypeHolderExampleTests.cs index a4760f2c4c9..7503d7a7d7d 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/TypeHolderExampleTests.cs +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/TypeHolderExampleTests.cs @@ -9,7 +9,7 @@ */ -using NUnit.Framework; +using Xunit; using System; using System.Linq; @@ -30,46 +30,23 @@ namespace Org.OpenAPITools.Test /// 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 TypeHolderExampleTests { - // TODO uncomment below to declare an instance variable for TypeHolderExample - //private TypeHolderExample instance; - - /// - /// Setup before each test - /// - [SetUp] - public void Init() - { - // TODO uncomment below to create an instance of TypeHolderExample - //instance = new TypeHolderExample(); - } - - /// - /// Clean up after each test - /// - [TearDown] - public void Cleanup() - { - - } - /// /// Test an instance of TypeHolderExample /// - [Test] + [Fact] public void TypeHolderExampleInstanceTest() { // TODO uncomment below to test "IsInstanceOfType" TypeHolderExample - //Assert.IsInstanceOfType (instance, "variable 'instance' is a TypeHolderExample"); + //Assert.IsType (instance, "variable 'instance' is a TypeHolderExample"); } /// /// Test the property 'StringItem' /// - [Test] + [Fact] public void StringItemTest() { // TODO unit test for the property 'StringItem' @@ -77,7 +54,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'NumberItem' /// - [Test] + [Fact] public void NumberItemTest() { // TODO unit test for the property 'NumberItem' @@ -85,7 +62,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'IntegerItem' /// - [Test] + [Fact] public void IntegerItemTest() { // TODO unit test for the property 'IntegerItem' @@ -93,7 +70,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'BoolItem' /// - [Test] + [Fact] public void BoolItemTest() { // TODO unit test for the property 'BoolItem' @@ -101,7 +78,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'ArrayItem' /// - [Test] + [Fact] public void ArrayItemTest() { // TODO unit test for the property 'ArrayItem' diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/UserTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/UserTests.cs index 8e073d2aa0e..6a71925c5c2 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/UserTests.cs +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/UserTests.cs @@ -9,7 +9,7 @@ */ -using NUnit.Framework; +using Xunit; using System; using System.Linq; @@ -30,46 +30,23 @@ namespace Org.OpenAPITools.Test /// 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 UserTests { - // TODO uncomment below to declare an instance variable for User - //private User instance; - - /// - /// Setup before each test - /// - [SetUp] - public void Init() - { - // TODO uncomment below to create an instance of User - //instance = new User(); - } - - /// - /// Clean up after each test - /// - [TearDown] - public void Cleanup() - { - - } - /// /// Test an instance of User /// - [Test] + [Fact] public void UserInstanceTest() { // TODO uncomment below to test "IsInstanceOfType" User - //Assert.IsInstanceOfType (instance, "variable 'instance' is a User"); + //Assert.IsType (instance, "variable 'instance' is a User"); } /// /// Test the property 'Id' /// - [Test] + [Fact] public void IdTest() { // TODO unit test for the property 'Id' @@ -77,7 +54,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'Username' /// - [Test] + [Fact] public void UsernameTest() { // TODO unit test for the property 'Username' @@ -85,7 +62,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'FirstName' /// - [Test] + [Fact] public void FirstNameTest() { // TODO unit test for the property 'FirstName' @@ -93,7 +70,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'LastName' /// - [Test] + [Fact] public void LastNameTest() { // TODO unit test for the property 'LastName' @@ -101,7 +78,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'Email' /// - [Test] + [Fact] public void EmailTest() { // TODO unit test for the property 'Email' @@ -109,7 +86,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'Password' /// - [Test] + [Fact] public void PasswordTest() { // TODO unit test for the property 'Password' @@ -117,7 +94,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'Phone' /// - [Test] + [Fact] public void PhoneTest() { // TODO unit test for the property 'Phone' @@ -125,7 +102,7 @@ namespace Org.OpenAPITools.Test /// /// Test the property 'UserStatus' /// - [Test] + [Fact] public void UserStatusTest() { // TODO unit test for the property 'UserStatus' diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/XmlItemTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/XmlItemTests.cs new file mode 100644 index 00000000000..bdd6c6be6a0 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Model/XmlItemTests.cs @@ -0,0 +1,281 @@ +/* + * 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 Xunit; + +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 XmlItem + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class XmlItemTests + { + /// + /// Test an instance of XmlItem + /// + [Fact] + public void XmlItemInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" XmlItem + //Assert.IsType (instance, "variable 'instance' is a XmlItem"); + } + + + /// + /// Test the property 'AttributeString' + /// + [Fact] + public void AttributeStringTest() + { + // TODO unit test for the property 'AttributeString' + } + /// + /// Test the property 'AttributeNumber' + /// + [Fact] + public void AttributeNumberTest() + { + // TODO unit test for the property 'AttributeNumber' + } + /// + /// Test the property 'AttributeInteger' + /// + [Fact] + public void AttributeIntegerTest() + { + // TODO unit test for the property 'AttributeInteger' + } + /// + /// Test the property 'AttributeBoolean' + /// + [Fact] + public void AttributeBooleanTest() + { + // TODO unit test for the property 'AttributeBoolean' + } + /// + /// Test the property 'WrappedArray' + /// + [Fact] + public void WrappedArrayTest() + { + // TODO unit test for the property 'WrappedArray' + } + /// + /// Test the property 'NameString' + /// + [Fact] + public void NameStringTest() + { + // TODO unit test for the property 'NameString' + } + /// + /// Test the property 'NameNumber' + /// + [Fact] + public void NameNumberTest() + { + // TODO unit test for the property 'NameNumber' + } + /// + /// Test the property 'NameInteger' + /// + [Fact] + public void NameIntegerTest() + { + // TODO unit test for the property 'NameInteger' + } + /// + /// Test the property 'NameBoolean' + /// + [Fact] + public void NameBooleanTest() + { + // TODO unit test for the property 'NameBoolean' + } + /// + /// Test the property 'NameArray' + /// + [Fact] + public void NameArrayTest() + { + // TODO unit test for the property 'NameArray' + } + /// + /// Test the property 'NameWrappedArray' + /// + [Fact] + public void NameWrappedArrayTest() + { + // TODO unit test for the property 'NameWrappedArray' + } + /// + /// Test the property 'PrefixString' + /// + [Fact] + public void PrefixStringTest() + { + // TODO unit test for the property 'PrefixString' + } + /// + /// Test the property 'PrefixNumber' + /// + [Fact] + public void PrefixNumberTest() + { + // TODO unit test for the property 'PrefixNumber' + } + /// + /// Test the property 'PrefixInteger' + /// + [Fact] + public void PrefixIntegerTest() + { + // TODO unit test for the property 'PrefixInteger' + } + /// + /// Test the property 'PrefixBoolean' + /// + [Fact] + public void PrefixBooleanTest() + { + // TODO unit test for the property 'PrefixBoolean' + } + /// + /// Test the property 'PrefixArray' + /// + [Fact] + public void PrefixArrayTest() + { + // TODO unit test for the property 'PrefixArray' + } + /// + /// Test the property 'PrefixWrappedArray' + /// + [Fact] + public void PrefixWrappedArrayTest() + { + // TODO unit test for the property 'PrefixWrappedArray' + } + /// + /// Test the property 'NamespaceString' + /// + [Fact] + public void NamespaceStringTest() + { + // TODO unit test for the property 'NamespaceString' + } + /// + /// Test the property 'NamespaceNumber' + /// + [Fact] + public void NamespaceNumberTest() + { + // TODO unit test for the property 'NamespaceNumber' + } + /// + /// Test the property 'NamespaceInteger' + /// + [Fact] + public void NamespaceIntegerTest() + { + // TODO unit test for the property 'NamespaceInteger' + } + /// + /// Test the property 'NamespaceBoolean' + /// + [Fact] + public void NamespaceBooleanTest() + { + // TODO unit test for the property 'NamespaceBoolean' + } + /// + /// Test the property 'NamespaceArray' + /// + [Fact] + public void NamespaceArrayTest() + { + // TODO unit test for the property 'NamespaceArray' + } + /// + /// Test the property 'NamespaceWrappedArray' + /// + [Fact] + public void NamespaceWrappedArrayTest() + { + // TODO unit test for the property 'NamespaceWrappedArray' + } + /// + /// Test the property 'PrefixNsString' + /// + [Fact] + public void PrefixNsStringTest() + { + // TODO unit test for the property 'PrefixNsString' + } + /// + /// Test the property 'PrefixNsNumber' + /// + [Fact] + public void PrefixNsNumberTest() + { + // TODO unit test for the property 'PrefixNsNumber' + } + /// + /// Test the property 'PrefixNsInteger' + /// + [Fact] + public void PrefixNsIntegerTest() + { + // TODO unit test for the property 'PrefixNsInteger' + } + /// + /// Test the property 'PrefixNsBoolean' + /// + [Fact] + public void PrefixNsBooleanTest() + { + // TODO unit test for the property 'PrefixNsBoolean' + } + /// + /// Test the property 'PrefixNsArray' + /// + [Fact] + public void PrefixNsArrayTest() + { + // TODO unit test for the property 'PrefixNsArray' + } + /// + /// Test the property 'PrefixNsWrappedArray' + /// + [Fact] + public void PrefixNsWrappedArrayTest() + { + // TODO unit test for the property 'PrefixNsWrappedArray' + } + + } + +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index 0dcd528d4c6..629d78c375f 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -7,85 +7,30 @@ This spec is mainly for testing Petstore server and contains fake endpoints, mod OpenAPI spec version: 1.0.0 --> - + + - Debug - AnyCPU - {19F1DEBC-DE5E-4517-8062-F000CD499087} - Library - Properties - Org.OpenAPITools.Test - Org.OpenAPITools.Test - v4.5.2 - 512 + netcoreapp2.0 + + false - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - $(SolutionDir)\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll - ..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll - ..\..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll - ..\..\vendor\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll - - - $(SolutionDir)\packages\JsonSubTypes.1.5.1\lib\net45\JsonSubTypes.dll - ..\packages\JsonSubTypes.1.5.1\lib\net45\JsonSubTypes.dll - ..\..\packages\JsonSubTypes.1.5.1\lib\net45\JsonSubTypes.dll - ..\..\vendor\JsonSubTypes.1.5.1\lib\net45\JsonSubTypes.dll - - - $(SolutionDir)\packages\RestSharp.106.5.4\lib\net452\RestSharp.dll - ..\packages\RestSharp.106.5.4\lib\net452\RestSharp.dll - ..\..\packages\RestSharp.106.5.4\lib\net452\RestSharp.dll - ..\..\vendor\RestSharp.106.5.4\lib\net452\RestSharp.dll - - - $(SolutionDir)\packages\NUnit.2.6.4\lib\nunit.framework.dll - ..\packages\NUnit.2.6.4\lib\nunit.framework.dll - ..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll - ..\..\vendor\NUnit.2.6.4\lib\nunit.framework.dll - - - - - - - - - + - {321C8C3F-0156-40C1-AE42-D59761FB9B6C} Org.OpenAPITools + + + + + + + + + + - diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/packages.config b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/packages.config deleted file mode 100644 index 1e4b3f2707d..00000000000 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools.Test/packages.config +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools/Api/FakeApi.cs index f4b6d78714d..d45e4931b8f 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools/Api/FakeApi.cs @@ -28,6 +28,27 @@ namespace Org.OpenAPITools.Api { #region Synchronous Operations /// + /// creates an XmlItem + /// + /// + /// this route creates an XmlItem + /// + /// Thrown when fails to make API call + /// XmlItem Body + /// + void CreateXmlItem (XmlItem xmlItem); + + /// + /// creates an XmlItem + /// + /// + /// this route creates an XmlItem + /// + /// Thrown when fails to make API call + /// XmlItem Body + /// ApiResponse of Object(void) + ApiResponse CreateXmlItemWithHttpInfo (XmlItem xmlItem); + /// /// /// /// @@ -343,6 +364,27 @@ namespace Org.OpenAPITools.Api { #region Asynchronous Operations /// + /// creates an XmlItem + /// + /// + /// this route creates an XmlItem + /// + /// Thrown when fails to make API call + /// XmlItem Body + /// Task of void + System.Threading.Tasks.Task CreateXmlItemAsync (XmlItem xmlItem); + + /// + /// creates an XmlItem + /// + /// + /// this route creates an XmlItem + /// + /// Thrown when fails to make API call + /// XmlItem Body + /// Task of ApiResponse + System.Threading.Tasks.Task> CreateXmlItemAsyncWithHttpInfo (XmlItem xmlItem); + /// /// /// /// @@ -768,6 +810,128 @@ namespace Org.OpenAPITools.Api set { _exceptionFactory = value; } } + /// + /// creates an XmlItem this route creates an XmlItem + /// + /// Thrown when fails to make API call + /// XmlItem Body + /// + public void CreateXmlItem (XmlItem xmlItem) + { + CreateXmlItemWithHttpInfo(xmlItem); + } + + /// + /// creates an XmlItem this route creates an XmlItem + /// + /// Thrown when fails to make API call + /// XmlItem Body + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse CreateXmlItemWithHttpInfo (XmlItem xmlItem) + { + // verify the required parameter 'xmlItem' is set + if (xmlItem == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'xmlItem' when calling FakeApi->CreateXmlItem"); + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + "application/xml", + "application/xml; charset=utf-8", + "application/xml; charset=utf-16", + "text/xml", + "text/xml; charset=utf-8", + "text/xml; charset=utf-16" + }; + + // to determine the Accept header + String[] @accepts = new String[] { + }; + + var localVarConentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(@contentTypes); + if (localVarConentType != null) requestOptions.HeaderParameters.Add("Content-Type", localVarConentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(@accepts); + if (localVarAccept != null) requestOptions.HeaderParameters.Add("Accept", localVarAccept); + + requestOptions.Data = xmlItem; + + + // make the HTTP request + + var response = this.Client.Post("/fake/create_xml_item", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("CreateXmlItem", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// creates an XmlItem this route creates an XmlItem + /// + /// Thrown when fails to make API call + /// XmlItem Body + /// Task of void + public async System.Threading.Tasks.Task CreateXmlItemAsync (XmlItem xmlItem) + { + await CreateXmlItemAsyncWithHttpInfo(xmlItem); + + } + + /// + /// creates an XmlItem this route creates an XmlItem + /// + /// Thrown when fails to make API call + /// XmlItem Body + /// Task of ApiResponse + public async System.Threading.Tasks.Task> CreateXmlItemAsyncWithHttpInfo (XmlItem xmlItem) + { + // verify the required parameter 'xmlItem' is set + if (xmlItem == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'xmlItem' when calling FakeApi->CreateXmlItem"); + + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + "application/xml", + "application/xml; charset=utf-8", + "application/xml; charset=utf-16", + "text/xml", + "text/xml; charset=utf-8", + "text/xml; charset=utf-16" + }; + + // to determine the Accept header + String[] @accepts = new String[] { + }; + + foreach (var contentType in @contentTypes) + requestOptions.HeaderParameters.Add("Content-Type", contentType); + + foreach (var accept in @accepts) + requestOptions.HeaderParameters.Add("Accept", accept); + + requestOptions.Data = xmlItem; + + + // make the HTTP request + + var response = await this.AsynchronousClient.PostAsync("/fake/create_xml_item", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("CreateXmlItem", response); + if (exception != null) throw exception; + } + + return response; + } + /// /// Test serialization of outer boolean types /// diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools/Client/ApiClient.cs index 6879cf00a65..c8dc1035fb9 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools/Client/ApiClient.cs @@ -16,7 +16,6 @@ using System.Globalization; using System.Text.RegularExpressions; using System.Threading.Tasks; using System.IO; -using System.Web; using System.Linq; using System.Net; using System.Runtime.Serialization; diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools/Client/Configuration.cs index ca0b52df6ae..55159099d79 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools/Client/Configuration.cs @@ -55,11 +55,7 @@ namespace Org.OpenAPITools.Client string.Format("Error calling {0}: {1}", methodName, response.Content), response.Content); } - if (status == 0) - { - return new ApiException(status, - string.Format("Error calling {0}: {1}", methodName, response.ErrorText), response.ErrorText); - } + return null; }; @@ -330,8 +326,7 @@ namespace Org.OpenAPITools.Client public static String ToDebugReport() { String report = "C# SDK (Org.OpenAPITools) Debug Report:\n"; - report += " OS: " + System.Environment.OSVersion + "\n"; - report += " .NET Framework Version: " + System.Environment.Version + "\n"; + report += " OS: " + System.Runtime.InteropServices.RuntimeInformation.OSDescription + "\n"; report += " Version of the API: 1.0.0\n"; report += " SDK Package Version: 1.0.0\n"; diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools/Model/Animal.cs index 05f7b55a424..55afaa13084 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools/Model/Animal.cs @@ -34,6 +34,8 @@ namespace Org.OpenAPITools.Model [JsonConverter(typeof(JsonSubtypes), "ClassName")] [JsonSubtypes.KnownSubType(typeof(Dog), "Dog")] [JsonSubtypes.KnownSubType(typeof(Cat), "Cat")] + [JsonSubtypes.KnownSubType(typeof(Dog), "Dog")] + [JsonSubtypes.KnownSubType(typeof(Cat), "Cat")] public partial class Animal : IEquatable, IValidatableObject { /// diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools/Model/XmlItem.cs b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools/Model/XmlItem.cs new file mode 100644 index 00000000000..e09b9dde360 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools/Model/XmlItem.cs @@ -0,0 +1,426 @@ +/* + * 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; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// XmlItem + /// + [DataContract] + public partial class XmlItem : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// attributeString. + /// attributeNumber. + /// attributeInteger. + /// attributeBoolean. + /// wrappedArray. + /// nameString. + /// nameNumber. + /// nameInteger. + /// nameBoolean. + /// nameArray. + /// nameWrappedArray. + /// prefixString. + /// prefixNumber. + /// prefixInteger. + /// prefixBoolean. + /// prefixArray. + /// prefixWrappedArray. + /// namespaceString. + /// namespaceNumber. + /// namespaceInteger. + /// namespaceBoolean. + /// namespaceArray. + /// namespaceWrappedArray. + /// prefixNsString. + /// prefixNsNumber. + /// prefixNsInteger. + /// prefixNsBoolean. + /// prefixNsArray. + /// prefixNsWrappedArray. + public XmlItem(string attributeString = default(string), decimal attributeNumber = default(decimal), int attributeInteger = default(int), bool attributeBoolean = default(bool), List wrappedArray = default(List), string nameString = default(string), decimal nameNumber = default(decimal), int nameInteger = default(int), bool nameBoolean = default(bool), List nameArray = default(List), List nameWrappedArray = default(List), string prefixString = default(string), decimal prefixNumber = default(decimal), int prefixInteger = default(int), bool prefixBoolean = default(bool), List prefixArray = default(List), List prefixWrappedArray = default(List), string namespaceString = default(string), decimal namespaceNumber = default(decimal), int namespaceInteger = default(int), bool namespaceBoolean = default(bool), List namespaceArray = default(List), List namespaceWrappedArray = default(List), string prefixNsString = default(string), decimal prefixNsNumber = default(decimal), int prefixNsInteger = default(int), bool prefixNsBoolean = default(bool), List prefixNsArray = default(List), List prefixNsWrappedArray = default(List)) + { + this.AttributeString = attributeString; + this.AttributeNumber = attributeNumber; + this.AttributeInteger = attributeInteger; + this.AttributeBoolean = attributeBoolean; + this.WrappedArray = wrappedArray; + this.NameString = nameString; + this.NameNumber = nameNumber; + this.NameInteger = nameInteger; + this.NameBoolean = nameBoolean; + this.NameArray = nameArray; + this.NameWrappedArray = nameWrappedArray; + this.PrefixString = prefixString; + this.PrefixNumber = prefixNumber; + this.PrefixInteger = prefixInteger; + this.PrefixBoolean = prefixBoolean; + this.PrefixArray = prefixArray; + this.PrefixWrappedArray = prefixWrappedArray; + this.NamespaceString = namespaceString; + this.NamespaceNumber = namespaceNumber; + this.NamespaceInteger = namespaceInteger; + this.NamespaceBoolean = namespaceBoolean; + this.NamespaceArray = namespaceArray; + this.NamespaceWrappedArray = namespaceWrappedArray; + this.PrefixNsString = prefixNsString; + this.PrefixNsNumber = prefixNsNumber; + this.PrefixNsInteger = prefixNsInteger; + this.PrefixNsBoolean = prefixNsBoolean; + this.PrefixNsArray = prefixNsArray; + this.PrefixNsWrappedArray = prefixNsWrappedArray; + } + + /// + /// Gets or Sets AttributeString + /// + [DataMember(Name="attribute_string", EmitDefaultValue=false)] + public string AttributeString { get; set; } + + /// + /// Gets or Sets AttributeNumber + /// + [DataMember(Name="attribute_number", EmitDefaultValue=false)] + public decimal AttributeNumber { get; set; } + + /// + /// Gets or Sets AttributeInteger + /// + [DataMember(Name="attribute_integer", EmitDefaultValue=false)] + public int AttributeInteger { get; set; } + + /// + /// Gets or Sets AttributeBoolean + /// + [DataMember(Name="attribute_boolean", EmitDefaultValue=false)] + public bool AttributeBoolean { get; set; } + + /// + /// Gets or Sets WrappedArray + /// + [DataMember(Name="wrapped_array", EmitDefaultValue=false)] + public List WrappedArray { get; set; } + + /// + /// Gets or Sets NameString + /// + [DataMember(Name="name_string", EmitDefaultValue=false)] + public string NameString { get; set; } + + /// + /// Gets or Sets NameNumber + /// + [DataMember(Name="name_number", EmitDefaultValue=false)] + public decimal NameNumber { get; set; } + + /// + /// Gets or Sets NameInteger + /// + [DataMember(Name="name_integer", EmitDefaultValue=false)] + public int NameInteger { get; set; } + + /// + /// Gets or Sets NameBoolean + /// + [DataMember(Name="name_boolean", EmitDefaultValue=false)] + public bool NameBoolean { get; set; } + + /// + /// Gets or Sets NameArray + /// + [DataMember(Name="name_array", EmitDefaultValue=false)] + public List NameArray { get; set; } + + /// + /// Gets or Sets NameWrappedArray + /// + [DataMember(Name="name_wrapped_array", EmitDefaultValue=false)] + public List NameWrappedArray { get; set; } + + /// + /// Gets or Sets PrefixString + /// + [DataMember(Name="prefix_string", EmitDefaultValue=false)] + public string PrefixString { get; set; } + + /// + /// Gets or Sets PrefixNumber + /// + [DataMember(Name="prefix_number", EmitDefaultValue=false)] + public decimal PrefixNumber { get; set; } + + /// + /// Gets or Sets PrefixInteger + /// + [DataMember(Name="prefix_integer", EmitDefaultValue=false)] + public int PrefixInteger { get; set; } + + /// + /// Gets or Sets PrefixBoolean + /// + [DataMember(Name="prefix_boolean", EmitDefaultValue=false)] + public bool PrefixBoolean { get; set; } + + /// + /// Gets or Sets PrefixArray + /// + [DataMember(Name="prefix_array", EmitDefaultValue=false)] + public List PrefixArray { get; set; } + + /// + /// Gets or Sets PrefixWrappedArray + /// + [DataMember(Name="prefix_wrapped_array", EmitDefaultValue=false)] + public List PrefixWrappedArray { get; set; } + + /// + /// Gets or Sets NamespaceString + /// + [DataMember(Name="namespace_string", EmitDefaultValue=false)] + public string NamespaceString { get; set; } + + /// + /// Gets or Sets NamespaceNumber + /// + [DataMember(Name="namespace_number", EmitDefaultValue=false)] + public decimal NamespaceNumber { get; set; } + + /// + /// Gets or Sets NamespaceInteger + /// + [DataMember(Name="namespace_integer", EmitDefaultValue=false)] + public int NamespaceInteger { get; set; } + + /// + /// Gets or Sets NamespaceBoolean + /// + [DataMember(Name="namespace_boolean", EmitDefaultValue=false)] + public bool NamespaceBoolean { get; set; } + + /// + /// Gets or Sets NamespaceArray + /// + [DataMember(Name="namespace_array", EmitDefaultValue=false)] + public List NamespaceArray { get; set; } + + /// + /// Gets or Sets NamespaceWrappedArray + /// + [DataMember(Name="namespace_wrapped_array", EmitDefaultValue=false)] + public List NamespaceWrappedArray { get; set; } + + /// + /// Gets or Sets PrefixNsString + /// + [DataMember(Name="prefix_ns_string", EmitDefaultValue=false)] + public string PrefixNsString { get; set; } + + /// + /// Gets or Sets PrefixNsNumber + /// + [DataMember(Name="prefix_ns_number", EmitDefaultValue=false)] + public decimal PrefixNsNumber { get; set; } + + /// + /// Gets or Sets PrefixNsInteger + /// + [DataMember(Name="prefix_ns_integer", EmitDefaultValue=false)] + public int PrefixNsInteger { get; set; } + + /// + /// Gets or Sets PrefixNsBoolean + /// + [DataMember(Name="prefix_ns_boolean", EmitDefaultValue=false)] + public bool PrefixNsBoolean { get; set; } + + /// + /// Gets or Sets PrefixNsArray + /// + [DataMember(Name="prefix_ns_array", EmitDefaultValue=false)] + public List PrefixNsArray { get; set; } + + /// + /// Gets or Sets PrefixNsWrappedArray + /// + [DataMember(Name="prefix_ns_wrapped_array", EmitDefaultValue=false)] + public List PrefixNsWrappedArray { 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 XmlItem {\n"); + sb.Append(" AttributeString: ").Append(AttributeString).Append("\n"); + sb.Append(" AttributeNumber: ").Append(AttributeNumber).Append("\n"); + sb.Append(" AttributeInteger: ").Append(AttributeInteger).Append("\n"); + sb.Append(" AttributeBoolean: ").Append(AttributeBoolean).Append("\n"); + sb.Append(" WrappedArray: ").Append(WrappedArray).Append("\n"); + sb.Append(" NameString: ").Append(NameString).Append("\n"); + sb.Append(" NameNumber: ").Append(NameNumber).Append("\n"); + sb.Append(" NameInteger: ").Append(NameInteger).Append("\n"); + sb.Append(" NameBoolean: ").Append(NameBoolean).Append("\n"); + sb.Append(" NameArray: ").Append(NameArray).Append("\n"); + sb.Append(" NameWrappedArray: ").Append(NameWrappedArray).Append("\n"); + sb.Append(" PrefixString: ").Append(PrefixString).Append("\n"); + sb.Append(" PrefixNumber: ").Append(PrefixNumber).Append("\n"); + sb.Append(" PrefixInteger: ").Append(PrefixInteger).Append("\n"); + sb.Append(" PrefixBoolean: ").Append(PrefixBoolean).Append("\n"); + sb.Append(" PrefixArray: ").Append(PrefixArray).Append("\n"); + sb.Append(" PrefixWrappedArray: ").Append(PrefixWrappedArray).Append("\n"); + sb.Append(" NamespaceString: ").Append(NamespaceString).Append("\n"); + sb.Append(" NamespaceNumber: ").Append(NamespaceNumber).Append("\n"); + sb.Append(" NamespaceInteger: ").Append(NamespaceInteger).Append("\n"); + sb.Append(" NamespaceBoolean: ").Append(NamespaceBoolean).Append("\n"); + sb.Append(" NamespaceArray: ").Append(NamespaceArray).Append("\n"); + sb.Append(" NamespaceWrappedArray: ").Append(NamespaceWrappedArray).Append("\n"); + sb.Append(" PrefixNsString: ").Append(PrefixNsString).Append("\n"); + sb.Append(" PrefixNsNumber: ").Append(PrefixNsNumber).Append("\n"); + sb.Append(" PrefixNsInteger: ").Append(PrefixNsInteger).Append("\n"); + sb.Append(" PrefixNsBoolean: ").Append(PrefixNsBoolean).Append("\n"); + sb.Append(" PrefixNsArray: ").Append(PrefixNsArray).Append("\n"); + sb.Append(" PrefixNsWrappedArray: ").Append(PrefixNsWrappedArray).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 OpenAPIClientUtils.compareLogic.Compare(this, input as XmlItem).AreEqual; + } + + /// + /// Returns true if XmlItem instances are equal + /// + /// Instance of XmlItem to be compared + /// Boolean + public bool Equals(XmlItem input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.AttributeString != null) + hashCode = hashCode * 59 + this.AttributeString.GetHashCode(); + if (this.AttributeNumber != null) + hashCode = hashCode * 59 + this.AttributeNumber.GetHashCode(); + if (this.AttributeInteger != null) + hashCode = hashCode * 59 + this.AttributeInteger.GetHashCode(); + if (this.AttributeBoolean != null) + hashCode = hashCode * 59 + this.AttributeBoolean.GetHashCode(); + if (this.WrappedArray != null) + hashCode = hashCode * 59 + this.WrappedArray.GetHashCode(); + if (this.NameString != null) + hashCode = hashCode * 59 + this.NameString.GetHashCode(); + if (this.NameNumber != null) + hashCode = hashCode * 59 + this.NameNumber.GetHashCode(); + if (this.NameInteger != null) + hashCode = hashCode * 59 + this.NameInteger.GetHashCode(); + if (this.NameBoolean != null) + hashCode = hashCode * 59 + this.NameBoolean.GetHashCode(); + if (this.NameArray != null) + hashCode = hashCode * 59 + this.NameArray.GetHashCode(); + if (this.NameWrappedArray != null) + hashCode = hashCode * 59 + this.NameWrappedArray.GetHashCode(); + if (this.PrefixString != null) + hashCode = hashCode * 59 + this.PrefixString.GetHashCode(); + if (this.PrefixNumber != null) + hashCode = hashCode * 59 + this.PrefixNumber.GetHashCode(); + if (this.PrefixInteger != null) + hashCode = hashCode * 59 + this.PrefixInteger.GetHashCode(); + if (this.PrefixBoolean != null) + hashCode = hashCode * 59 + this.PrefixBoolean.GetHashCode(); + if (this.PrefixArray != null) + hashCode = hashCode * 59 + this.PrefixArray.GetHashCode(); + if (this.PrefixWrappedArray != null) + hashCode = hashCode * 59 + this.PrefixWrappedArray.GetHashCode(); + if (this.NamespaceString != null) + hashCode = hashCode * 59 + this.NamespaceString.GetHashCode(); + if (this.NamespaceNumber != null) + hashCode = hashCode * 59 + this.NamespaceNumber.GetHashCode(); + if (this.NamespaceInteger != null) + hashCode = hashCode * 59 + this.NamespaceInteger.GetHashCode(); + if (this.NamespaceBoolean != null) + hashCode = hashCode * 59 + this.NamespaceBoolean.GetHashCode(); + if (this.NamespaceArray != null) + hashCode = hashCode * 59 + this.NamespaceArray.GetHashCode(); + if (this.NamespaceWrappedArray != null) + hashCode = hashCode * 59 + this.NamespaceWrappedArray.GetHashCode(); + if (this.PrefixNsString != null) + hashCode = hashCode * 59 + this.PrefixNsString.GetHashCode(); + if (this.PrefixNsNumber != null) + hashCode = hashCode * 59 + this.PrefixNsNumber.GetHashCode(); + if (this.PrefixNsInteger != null) + hashCode = hashCode * 59 + this.PrefixNsInteger.GetHashCode(); + if (this.PrefixNsBoolean != null) + hashCode = hashCode * 59 + this.PrefixNsBoolean.GetHashCode(); + if (this.PrefixNsArray != null) + hashCode = hashCode * 59 + this.PrefixNsArray.GetHashCode(); + if (this.PrefixNsWrappedArray != null) + hashCode = hashCode * 59 + this.PrefixNsWrappedArray.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-refactor/OpenAPIClient/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools/Org.OpenAPITools.csproj index 0c300832cbd..ce789e2e0cb 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -7,9 +7,10 @@ This spec is mainly for testing Petstore server and contains fake endpoints, mod OpenAPI spec version: 1.0.0 --> - + - + false + 14.0 Debug AnyCPU {321C8C3F-0156-40C1-AE42-D59761FB9B6C} @@ -17,68 +18,23 @@ OpenAPI spec version: 1.0.0 Properties Org.OpenAPITools Org.OpenAPITools - v4.5.2 + {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + + v2.0 + .NETStandard 512 - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - $(SolutionDir)\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll - ..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll - ..\..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll - ..\..\vendor\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll - - - $(SolutionDir)\packages\JsonSubTypes.1.5.1\lib\net45\JsonSubTypes.dll - ..\packages\JsonSubTypes.1.5.1\lib\net45\JsonSubTypes.dll - ..\..\packages\JsonSubTypes.1.5.1\lib\net45\JsonSubTypes.dll - ..\..\vendor\JsonSubTypes.1.5.1\lib\net45\JsonSubTypes.dll - - - $(SolutionDir)\packages\RestSharp.106.5.4\lib\net452\RestSharp.dll - ..\packages\RestSharp.106.5.4\lib\net452\RestSharp.dll - ..\..\packages\RestSharp.106.5.4\lib\net452\RestSharp.dll - ..\..\vendor\RestSharp.106.5.4\lib\net452\RestSharp.dll - - - $(SolutionDir)\packages\CompareNETObjects.4.57.0\lib\net452\KellermanSoftware.Compare-NET-Objects.dll - ..\packages\CompareNETObjects.4.57.0\lib\net452\KellermanSoftware.Compare-NET-Objects.dll - ..\..\packages\CompareNETObjects.4.57.0\lib\net452\KellermanSoftware.Compare-NET-Objects.dll - ..\..\vendor\CompareNETObjects.4.57.0\lib\net452\KellermanSoftware.Compare-NET-Objects.dll - + + - + + + + + - - - - + diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools/Org.OpenAPITools.nuspec b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools/Org.OpenAPITools.nuspec index 63ec21d7657..b4429e9b506 100644 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools/Org.OpenAPITools.nuspec +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools/Org.OpenAPITools.nuspec @@ -27,7 +27,7 @@ - + diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools/packages.config b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools/packages.config deleted file mode 100644 index 00b66b33503..00000000000 --- a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools/packages.config +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools/project.json b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools/project.json new file mode 100644 index 00000000000..70f54d09b06 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClient/src/Org.OpenAPITools/project.json @@ -0,0 +1,12 @@ +{ + "supports": {}, + "dependencies": { + "Newtonsoft.Json": "12.0.1", + "CompareNETObjects": "4.57.0", + "JsonSubTypes": "1.5.2", + "RestSharp": "106.6.7" + }, + "frameworks": { + "netstandard2.0": {} + } +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/.gitignore b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/.gitignore new file mode 100644 index 00000000000..17302c93bf0 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/.gitignore @@ -0,0 +1,186 @@ +# Ref: https://gist.github.com/kmorcinek/2710267 +# Download this file using PowerShell v3 under Windows with the following comand +# Invoke-WebRequest https://gist.githubusercontent.com/kmorcinek/2710267/raw/ -OutFile .gitignore + +# User-specific files +*.suo +*.user +*.sln.docstates +./nuget + +# Build results + +[Dd]ebug/ +[Rr]elease/ +x64/ +build/ +[Bb]in/ +[Oo]bj/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +*_i.c +*_p.c +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.log +*.scc + +# OS generated files # +.DS_Store* +ehthumbs.db +Icon? +Thumbs.db + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf +*.cachefile + +# Visual Studio profiler +*.psess +*.vsp +*.vspx + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +*.ncrunch* +.*crunch*.local.xml + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.Publish.xml + +# Windows Azure Build Output +csx +*.build.csdef + +# Windows Store app package directory +AppPackages/ + +# Others +sql/ +*.Cache +ClientBin/ +[Ss]tyle[Cc]op.* +~$* +*~ +*.dbmdl +*.[Pp]ublish.xml +*.pfx +*.publishsettings +modulesbin/ +tempbin/ + +# EPiServer Site file (VPP) +AppData/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file to a newer +# Visual Studio version. Backup files are not needed, because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# vim +*.txt~ +*.swp +*.swo + +# svn +.svn + +# SQL Server files +**/App_Data/*.mdf +**/App_Data/*.ldf +**/App_Data/*.sdf + + +#LightSwitch generated files +GeneratedArtifacts/ +_Pvt_Extensions/ +ModelManifest.xml + +# ========================= +# Windows detritus +# ========================= + +# Windows image file caches +Thumbs.db +ehthumbs.db + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Mac desktop service store files +.DS_Store + +# SASS Compiler cache +.sass-cache + +# Visual Studio 2014 CTP +**/*.sln.ide diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/.openapi-generator-ignore b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/.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-refactor/OpenAPIClientCore/.openapi-generator/VERSION b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/.openapi-generator/VERSION new file mode 100644 index 00000000000..afa63656064 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/.openapi-generator/VERSION @@ -0,0 +1 @@ +4.0.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/.travis.yml b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/.travis.yml similarity index 100% rename from samples/client/petstore/csharp-refactor/OpenAPIClient/.travis.yml rename to samples/client/petstore/csharp-refactor/OpenAPIClientCore/.travis.yml diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/Org.OpenAPITools.sln b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/Org.OpenAPITools.sln new file mode 100644 index 00000000000..5b15451c9dc --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/Org.OpenAPITools.sln @@ -0,0 +1,27 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +VisualStudioVersion = 12.0.0.0 +MinimumVisualStudioVersion = 10.0.0.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.OpenAPITools", "src\Org.OpenAPITools\Org.OpenAPITools.csproj", "{321C8C3F-0156-40C1-AE42-D59761FB9B6C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.OpenAPITools.Test", "src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Release|Any CPU.Build.0 = Release|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal \ No newline at end of file diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/README.md b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/README.md new file mode 100644 index 00000000000..94591821013 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/README.md @@ -0,0 +1,213 @@ +# Org.OpenAPITools - the C# library for the 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: \" \\ + +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.CSharpRefactorClientCodegen + + +## Frameworks supported + + +## Dependencies + +- [RestSharp](https://www.nuget.org/packages/RestSharp) - 106.6.7 or later +- [Json.NET](https://www.nuget.org/packages/Newtonsoft.Json/) - 12.0.1 or later +- [JsonSubTypes](https://www.nuget.org/packages/JsonSubTypes/) - 1.5.2 or later +- [CompareNETObjects](https://www.nuget.org/packages/CompareNETObjects) - 4.57.0 or later +- [System.ComponentModel.Annotations](https://www.nuget.org/packages/System.ComponentModel.Annotations) - 4.5.0 or later + +The DLLs included in the package may not be the latest version. We recommend using [NuGet](https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages: +``` +Install-Package RestSharp +Install-Package Newtonsoft.Json +Install-Package JsonSubTypes +Install-Package System.ComponentModel.Annotations +Install-Package CompareNETObjects +``` + +NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See [RestSharp#742](https://github.com/restsharp/RestSharp/issues/742) + + +## Installation +Run the following command to generate the DLL +- [Mac/Linux] `/bin/sh build.sh` +- [Windows] `build.bat` + +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; +``` + +## Packaging + +A `.nuspec` is included with the project. You can follow the Nuget quickstart to [create](https://docs.microsoft.com/en-us/nuget/quickstart/create-and-publish-a-package#create-the-package) and [publish](https://docs.microsoft.com/en-us/nuget/quickstart/create-and-publish-a-package#publish-the-package) packages. + +This `.nuspec` uses placeholders from the `.csproj`, so build the `.csproj` directly: + +``` +nuget pack -Build -OutputDirectory out Org.OpenAPITools.csproj +``` + +Then, publish to a [local feed](https://docs.microsoft.com/en-us/nuget/hosting-packages/local-feeds) or [other host](https://docs.microsoft.com/en-us/nuget/hosting-packages/overview) and consume the new package via Nuget as usual. + + +## 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() + { + + var apiInstance = new AnotherFakeApi(); + var body = new ModelClient(); // ModelClient | client model + + try + { + // To test special tags + ModelClient result = apiInstance.Call123TestSpecialTags(body); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling AnotherFakeApi.Call123TestSpecialTags: " + e.Message ); + } + + } + } +} +``` + + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*AnotherFakeApi* | [**Call123TestSpecialTags**](docs/AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags +*FakeApi* | [**CreateXmlItem**](docs/FakeApi.md#createxmlitem) | **POST** /fake/create_xml_item | creates an XmlItem +*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 假端點 偽のエンドポイント 가짜 엔드 포인트 +*FakeApi* | [**TestEnumParameters**](docs/FakeApi.md#testenumparameters) | **GET** /fake | To test enum parameters +*FakeApi* | [**TestGroupParameters**](docs/FakeApi.md#testgroupparameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) +*FakeApi* | [**TestInlineAdditionalProperties**](docs/FakeApi.md#testinlineadditionalproperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties +*FakeApi* | [**TestJsonFormData**](docs/FakeApi.md#testjsonformdata) | **GET** /fake/jsonFormData | test json serialization of form data +*FakeClassnameTags123Api* | [**TestClassname**](docs/FakeClassnameTags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case +*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 +*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 +*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 + + - [Model.AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md) + - [Model.Animal](docs/Animal.md) + - [Model.ApiResponse](docs/ApiResponse.md) + - [Model.ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md) + - [Model.ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md) + - [Model.ArrayTest](docs/ArrayTest.md) + - [Model.Capitalization](docs/Capitalization.md) + - [Model.Cat](docs/Cat.md) + - [Model.Category](docs/Category.md) + - [Model.ClassModel](docs/ClassModel.md) + - [Model.Dog](docs/Dog.md) + - [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) + - [Model.MapTest](docs/MapTest.md) + - [Model.MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) + - [Model.Model200Response](docs/Model200Response.md) + - [Model.ModelClient](docs/ModelClient.md) + - [Model.Name](docs/Name.md) + - [Model.NumberOnly](docs/NumberOnly.md) + - [Model.Order](docs/Order.md) + - [Model.OuterComposite](docs/OuterComposite.md) + - [Model.OuterEnum](docs/OuterEnum.md) + - [Model.Pet](docs/Pet.md) + - [Model.ReadOnlyFirst](docs/ReadOnlyFirst.md) + - [Model.Return](docs/Return.md) + - [Model.SpecialModelName](docs/SpecialModelName.md) + - [Model.Tag](docs/Tag.md) + - [Model.TypeHolderDefault](docs/TypeHolderDefault.md) + - [Model.TypeHolderExample](docs/TypeHolderExample.md) + - [Model.User](docs/User.md) + - [Model.XmlItem](docs/XmlItem.md) + + + +## Documentation for Authorization + + +### api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + + +### api_key_query + +- **Type**: API key +- **API key parameter name**: api_key_query +- **Location**: URL query string + + +### http_basic_test + +- **Type**: HTTP basic authentication + + +### 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-refactor/OpenAPIClientCore/build.bat b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/build.bat new file mode 100644 index 00000000000..a5c1f4c5764 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/build.bat @@ -0,0 +1,6 @@ +:: Generated by: https://github.com/openapitools/openapi-generator.git +:: + +@echo off + +dotnet build diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/build.sh b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/build.sh new file mode 100644 index 00000000000..2d32c2c18f8 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/build.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +# +# Generated by: https://github.com/openapitools/openapi-generator.git +# + +for cmd in {dotnet}; do + if ! command -v ${cmd} > /dev/null; then + >&2 echo "This script requires '${cmd}' to be installed." + exit 1 + fi +done + +dotnet build + +if [ $? -ne 0 ] +then + echo "[ERROR] Compilation failed with exit code $?" + exit 1 +else + echo "[INFO] dotnet build was successful." +fi diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/AdditionalPropertiesClass.md b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/AdditionalPropertiesClass.md new file mode 100644 index 00000000000..057f5bd65df --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/AdditionalPropertiesClass.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.AdditionalPropertiesClass +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**MapProperty** | **Dictionary<string, string>** | | [optional] +**MapOfMapProperty** | **Dictionary<string, Dictionary<string, 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-refactor/OpenAPIClientCore/docs/Animal.md b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/Animal.md new file mode 100644 index 00000000000..a97ce49b801 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/Animal.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.Animal +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | +**Color** | **string** | | [optional] [default to "red"] + +[[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-refactor/OpenAPIClientCore/docs/AnotherFakeApi.md b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/AnotherFakeApi.md new file mode 100644 index 00000000000..612293b48bb --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/AnotherFakeApi.md @@ -0,0 +1,70 @@ +# Org.OpenAPITools.Api.AnotherFakeApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**Call123TestSpecialTags**](AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags + + + +# **Call123TestSpecialTags** +> ModelClient Call123TestSpecialTags (ModelClient body) + +To test special tags + +To test special tags and operation ID starting with number + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class Call123TestSpecialTagsExample + { + public void main() + { + var apiInstance = new AnotherFakeApi(); + var body = new ModelClient(); // ModelClient | client model + + try + { + // To test special tags + ModelClient result = apiInstance.Call123TestSpecialTags(body); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling AnotherFakeApi.Call123TestSpecialTags: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**ModelClient**](ModelClient.md)| client model | + +### Return type + +[**ModelClient**](ModelClient.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **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-refactor/OpenAPIClientCore/docs/ApiResponse.md b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/ApiResponse.md new file mode 100644 index 00000000000..1ac0bfc8acd --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/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-refactor/OpenAPIClientCore/docs/ArrayOfArrayOfNumberOnly.md b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/ArrayOfArrayOfNumberOnly.md new file mode 100644 index 00000000000..a4acb4dfa7c --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/ArrayOfArrayOfNumberOnly.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.ArrayOfArrayOfNumberOnly +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ArrayArrayNumber** | **List<List<decimal>>** | | [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-refactor/OpenAPIClientCore/docs/ArrayOfNumberOnly.md b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/ArrayOfNumberOnly.md new file mode 100644 index 00000000000..c61636e3585 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/ArrayOfNumberOnly.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.ArrayOfNumberOnly +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ArrayNumber** | **List<decimal>** | | [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-refactor/OpenAPIClientCore/docs/ArrayTest.md b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/ArrayTest.md new file mode 100644 index 00000000000..a5e9e5c244c --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/ArrayTest.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.ArrayTest +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ArrayOfString** | **List<string>** | | [optional] +**ArrayArrayOfInteger** | **List<List<long>>** | | [optional] +**ArrayArrayOfModel** | **List<List<ReadOnlyFirst>>** | | [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-refactor/OpenAPIClientCore/docs/Capitalization.md b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/Capitalization.md new file mode 100644 index 00000000000..74c1ab66db2 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/Capitalization.md @@ -0,0 +1,14 @@ +# Org.OpenAPITools.Model.Capitalization +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**SmallCamel** | **string** | | [optional] +**CapitalCamel** | **string** | | [optional] +**SmallSnake** | **string** | | [optional] +**CapitalSnake** | **string** | | [optional] +**SCAETHFlowPoints** | **string** | | [optional] +**ATT_NAME** | **string** | Name of the pet | [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-refactor/OpenAPIClientCore/docs/Cat.md b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/Cat.md new file mode 100644 index 00000000000..8975864ba12 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/Cat.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.Cat +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | +**Color** | **string** | | [optional] [default to "red"] +**Declawed** | **bool** | | [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-refactor/OpenAPIClientCore/docs/Category.md b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/Category.md new file mode 100644 index 00000000000..f7b8d4ebf74 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/Category.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.Category +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **long** | | [optional] +**Name** | **string** | | [default to "default-name"] + +[[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-refactor/OpenAPIClientCore/docs/ClassModel.md b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/ClassModel.md new file mode 100644 index 00000000000..556b05db241 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/ClassModel.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.ClassModel +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Class** | **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-refactor/OpenAPIClientCore/docs/Dog.md b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/Dog.md new file mode 100644 index 00000000000..aa5df1a927a --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/Dog.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.Dog +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | +**Color** | **string** | | [optional] [default to "red"] +**Breed** | **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-refactor/OpenAPIClientCore/docs/EnumArrays.md b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/EnumArrays.md new file mode 100644 index 00000000000..2dfe0e22388 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/EnumArrays.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.EnumArrays +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**JustSymbol** | **string** | | [optional] +**ArrayEnum** | **List<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-refactor/OpenAPIClientCore/docs/EnumClass.md b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/EnumClass.md new file mode 100644 index 00000000000..4fb1eae9c06 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/EnumClass.md @@ -0,0 +1,8 @@ +# Org.OpenAPITools.Model.EnumClass +## 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-refactor/OpenAPIClientCore/docs/EnumTest.md b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/EnumTest.md new file mode 100644 index 00000000000..3251659917f --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/EnumTest.md @@ -0,0 +1,13 @@ +# Org.OpenAPITools.Model.EnumTest +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**EnumString** | **string** | | [optional] +**EnumStringRequired** | **string** | | +**EnumInteger** | **int** | | [optional] +**EnumNumber** | **double** | | [optional] +**OuterEnum** | [**OuterEnum**](OuterEnum.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-refactor/OpenAPIClientCore/docs/FakeApi.md b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/FakeApi.md new file mode 100644 index 00000000000..8a11d6461f2 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/FakeApi.md @@ -0,0 +1,852 @@ +# Org.OpenAPITools.Api.FakeApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**CreateXmlItem**](FakeApi.md#createxmlitem) | **POST** /fake/create_xml_item | creates an XmlItem +[**FakeOuterBooleanSerialize**](FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean | +[**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 假端點 偽のエンドポイント 가짜 엔드 포인트 +[**TestEnumParameters**](FakeApi.md#testenumparameters) | **GET** /fake | To test enum parameters +[**TestGroupParameters**](FakeApi.md#testgroupparameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) +[**TestInlineAdditionalProperties**](FakeApi.md#testinlineadditionalproperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties +[**TestJsonFormData**](FakeApi.md#testjsonformdata) | **GET** /fake/jsonFormData | test json serialization of form data + + + +# **CreateXmlItem** +> void CreateXmlItem (XmlItem xmlItem) + +creates an XmlItem + +this route creates an XmlItem + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class CreateXmlItemExample + { + public void main() + { + var apiInstance = new FakeApi(); + var xmlItem = new XmlItem(); // XmlItem | XmlItem Body + + try + { + // creates an XmlItem + apiInstance.CreateXmlItem(xmlItem); + } + catch (Exception e) + { + Debug.Print("Exception when calling FakeApi.CreateXmlItem: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xmlItem** | [**XmlItem**](XmlItem.md)| XmlItem Body | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/xml, application/xml; charset=utf-8, application/xml; charset=utf-16, text/xml, text/xml; charset=utf-8, text/xml; charset=utf-16 + - **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) + + +# **FakeOuterBooleanSerialize** +> bool FakeOuterBooleanSerialize (bool? body = null) + + + +Test serialization of outer boolean types + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class FakeOuterBooleanSerializeExample + { + public void main() + { + var apiInstance = new FakeApi(); + var body = true; // bool? | Input boolean as post body (optional) + + try + { + bool result = apiInstance.FakeOuterBooleanSerialize(body); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling FakeApi.FakeOuterBooleanSerialize: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **bool?**| Input boolean as post body | [optional] + +### Return type + +**bool** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: */* + +[[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) + + +# **FakeOuterCompositeSerialize** +> OuterComposite FakeOuterCompositeSerialize (OuterComposite body = null) + + + +Test serialization of object with outer number type + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class FakeOuterCompositeSerializeExample + { + public void main() + { + var apiInstance = new FakeApi(); + var body = new OuterComposite(); // OuterComposite | Input composite as post body (optional) + + try + { + OuterComposite result = apiInstance.FakeOuterCompositeSerialize(body); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling FakeApi.FakeOuterCompositeSerialize: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] + +### Return type + +[**OuterComposite**](OuterComposite.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: */* + +[[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) + + +# **FakeOuterNumberSerialize** +> decimal FakeOuterNumberSerialize (decimal? body = null) + + + +Test serialization of outer number types + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class FakeOuterNumberSerializeExample + { + public void main() + { + var apiInstance = new FakeApi(); + var body = 8.14; // decimal? | Input number as post body (optional) + + try + { + decimal result = apiInstance.FakeOuterNumberSerialize(body); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling FakeApi.FakeOuterNumberSerialize: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **decimal?**| Input number as post body | [optional] + +### Return type + +**decimal** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: */* + +[[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) + + +# **FakeOuterStringSerialize** +> string FakeOuterStringSerialize (string body = null) + + + +Test serialization of outer string types + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class FakeOuterStringSerializeExample + { + public void main() + { + var apiInstance = new FakeApi(); + var body = body_example; // string | Input string as post body (optional) + + try + { + string result = apiInstance.FakeOuterStringSerialize(body); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling FakeApi.FakeOuterStringSerialize: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **string**| Input string as post body | [optional] + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: */* + +[[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 body) + + + +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 body = new FileSchemaTestClass(); // FileSchemaTestClass | + + try + { + apiInstance.TestBodyWithFileSchema(body); + } + catch (Exception e) + { + Debug.Print("Exception when calling FakeApi.TestBodyWithFileSchema: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**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 body) + + + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestBodyWithQueryParamsExample + { + public void main() + { + var apiInstance = new FakeApi(); + var query = query_example; // string | + var body = new User(); // User | + + try + { + apiInstance.TestBodyWithQueryParams(query, body); + } + catch (Exception e) + { + Debug.Print("Exception when calling FakeApi.TestBodyWithQueryParams: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **query** | **string**| | + **body** | [**User**](User.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) + + +# **TestClientModel** +> ModelClient TestClientModel (ModelClient body) + +To test \"client\" model + +To test \"client\" model + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestClientModelExample + { + public void main() + { + var apiInstance = new FakeApi(); + var body = new ModelClient(); // ModelClient | client model + + try + { + // To test \"client\" model + ModelClient result = apiInstance.TestClientModel(body); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling FakeApi.TestClientModel: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**ModelClient**](ModelClient.md)| client model | + +### Return type + +[**ModelClient**](ModelClient.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **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) + + +# **TestEndpointParameters** +> void TestEndpointParameters (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, string _string = null, System.IO.Stream binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null, string callback = null) + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestEndpointParametersExample + { + public void main() + { + // Configure HTTP basic authorization: http_basic_test + Configuration.Default.Username = "YOUR_USERNAME"; + Configuration.Default.Password = "YOUR_PASSWORD"; + + var apiInstance = new FakeApi(); + var number = 8.14; // decimal | 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.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) + var dateTime = 2013-10-20T19:20:30+01:00; // DateTime? | None (optional) + var password = password_example; // string | None (optional) + var callback = callback_example; // string | None (optional) + + try + { + // Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + apiInstance.TestEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, _string, binary, date, dateTime, password, callback); + } + catch (Exception e) + { + Debug.Print("Exception when calling FakeApi.TestEndpointParameters: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **number** | **decimal**| None | + **_double** | **double**| None | + **patternWithoutDelimiter** | **string**| None | + **_byte** | **byte[]**| None | + **integer** | **int?**| None | [optional] + **int32** | **int?**| None | [optional] + **int64** | **long?**| None | [optional] + **_float** | **float?**| None | [optional] + **_string** | **string**| None | [optional] + **binary** | **System.IO.Stream****System.IO.Stream**| None | [optional] + **date** | **DateTime?**| None | [optional] + **dateTime** | **DateTime?**| None | [optional] + **password** | **string**| None | [optional] + **callback** | **string**| None | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[http_basic_test](../README.md#http_basic_test) + +### 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) + + +# **TestEnumParameters** +> void TestEnumParameters (List enumHeaderStringArray = null, string enumHeaderString = null, List enumQueryStringArray = null, string enumQueryString = null, int? enumQueryInteger = null, double? enumQueryDouble = null, List enumFormStringArray = null, string enumFormString = null) + +To test enum parameters + +To test enum parameters + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestEnumParametersExample + { + public void main() + { + var apiInstance = new FakeApi(); + var enumHeaderStringArray = enumHeaderStringArray_example; // List | Header parameter enum test (string array) (optional) + var enumHeaderString = enumHeaderString_example; // string | Header parameter enum test (string) (optional) (default to -efg) + 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.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 + { + // To test enum parameters + apiInstance.TestEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + } + catch (Exception e) + { + Debug.Print("Exception when calling FakeApi.TestEnumParameters: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **enumHeaderStringArray** | **List<string>**| Header parameter enum test (string array) | [optional] + **enumHeaderString** | **string**| Header parameter enum test (string) | [optional] [default to -efg] + **enumQueryStringArray** | **List<string>**| Query parameter enum test (string array) | [optional] + **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>**](string.md)| Form parameter enum test (string array) | [optional] [default to $] + **enumFormString** | **string**| Form parameter enum test (string) | [optional] [default to -efg] + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### 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) + + +# **TestGroupParameters** +> void TestGroupParameters (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = null, bool? booleanGroup = null, long? int64Group = null) + +Fake endpoint to test group parameters (optional) + +Fake endpoint to test group parameters (optional) + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestGroupParametersExample + { + public void main() + { + var apiInstance = new FakeApi(); + var requiredStringGroup = 56; // int | Required String in group parameters + var requiredBooleanGroup = true; // bool | Required Boolean in group parameters + var requiredInt64Group = 789; // long | Required Integer in group parameters + var stringGroup = 56; // int? | String in group parameters (optional) + var booleanGroup = true; // bool? | Boolean in group parameters (optional) + var int64Group = 789; // long? | Integer in group parameters (optional) + + try + { + // Fake endpoint to test group parameters (optional) + apiInstance.TestGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + } + catch (Exception e) + { + Debug.Print("Exception when calling FakeApi.TestGroupParameters: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **requiredStringGroup** | **int**| Required String in group parameters | + **requiredBooleanGroup** | **bool**| Required Boolean in group parameters | + **requiredInt64Group** | **long**| Required Integer in group parameters | + **stringGroup** | **int?**| String in group parameters | [optional] + **booleanGroup** | **bool?**| Boolean in group parameters | [optional] + **int64Group** | **long?**| Integer in group parameters | [optional] + +### 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) + + +# **TestInlineAdditionalProperties** +> void TestInlineAdditionalProperties (Dictionary param) + +test inline additionalProperties + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestInlineAdditionalPropertiesExample + { + public void main() + { + var apiInstance = new FakeApi(); + var param = new Dictionary(); // Dictionary | request body + + try + { + // test inline additionalProperties + apiInstance.TestInlineAdditionalProperties(param); + } + catch (Exception e) + { + Debug.Print("Exception when calling FakeApi.TestInlineAdditionalProperties: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **param** | [**Dictionary<string, string>**](string.md)| request body | + +### 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) + + +# **TestJsonFormData** +> void TestJsonFormData (string param, string param2) + +test json serialization of 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 TestJsonFormDataExample + { + public void main() + { + var apiInstance = new FakeApi(); + var param = param_example; // string | field1 + var param2 = param2_example; // string | field2 + + try + { + // test json serialization of form data + apiInstance.TestJsonFormData(param, param2); + } + catch (Exception e) + { + Debug.Print("Exception when calling FakeApi.TestJsonFormData: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **param** | **string**| field1 | + **param2** | **string**| field2 | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### 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) + diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/FakeClassnameTags123Api.md b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/FakeClassnameTags123Api.md new file mode 100644 index 00000000000..abea3cb9977 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/FakeClassnameTags123Api.md @@ -0,0 +1,75 @@ +# Org.OpenAPITools.Api.FakeClassnameTags123Api + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**TestClassname**](FakeClassnameTags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case + + + +# **TestClassname** +> ModelClient TestClassname (ModelClient body) + +To test class name in snake case + +To test class name in snake case + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestClassnameExample + { + public void main() + { + // Configure API key authorization: api_key_query + Configuration.Default.AddApiKey("api_key_query", "YOUR_API_KEY"); + // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed + // Configuration.Default.AddApiKeyPrefix("api_key_query", "Bearer"); + + var apiInstance = new FakeClassnameTags123Api(); + var body = new ModelClient(); // ModelClient | client model + + try + { + // To test class name in snake case + ModelClient result = apiInstance.TestClassname(body); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling FakeClassnameTags123Api.TestClassname: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**ModelClient**](ModelClient.md)| client model | + +### Return type + +[**ModelClient**](ModelClient.md) + +### Authorization + +[api_key_query](../README.md#api_key_query) + +### HTTP request headers + + - **Content-Type**: application/json + - **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-refactor/OpenAPIClientCore/docs/File.md b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/File.md new file mode 100644 index 00000000000..acf85a4c001 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/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-refactor/OpenAPIClientCore/docs/FileSchemaTestClass.md b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/FileSchemaTestClass.md new file mode 100644 index 00000000000..244164accbe --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/FileSchemaTestClass.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.FileSchemaTestClass +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**File** | [**File**](File.md) | | [optional] +**Files** | [**List<File>**](File.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-refactor/OpenAPIClientCore/docs/FormatTest.md b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/FormatTest.md new file mode 100644 index 00000000000..909ceff242c --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/FormatTest.md @@ -0,0 +1,21 @@ +# Org.OpenAPITools.Model.FormatTest +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Integer** | **int** | | [optional] +**Int32** | **int** | | [optional] +**Int64** | **long** | | [optional] +**Number** | **decimal** | | +**Float** | **float** | | [optional] +**Double** | **double** | | [optional] +**String** | **string** | | [optional] +**Byte** | **byte[]** | | +**Binary** | **System.IO.Stream** | | [optional] +**Date** | **DateTime** | | +**DateTime** | **DateTime** | | [optional] +**Uuid** | [**Guid**](Guid.md) | | [optional] +**Password** | **string** | | + +[[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-refactor/OpenAPIClientCore/docs/HasOnlyReadOnly.md b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/HasOnlyReadOnly.md new file mode 100644 index 00000000000..95f49de194c --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/HasOnlyReadOnly.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.HasOnlyReadOnly +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Bar** | **string** | | [optional] +**Foo** | **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-refactor/OpenAPIClientCore/docs/List.md b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/List.md new file mode 100644 index 00000000000..484c2a0992c --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/List.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.List +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**_123List** | **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-refactor/OpenAPIClientCore/docs/MapTest.md b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/MapTest.md new file mode 100644 index 00000000000..b2e30bde4c3 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/MapTest.md @@ -0,0 +1,12 @@ +# Org.OpenAPITools.Model.MapTest +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**MapMapOfString** | **Dictionary<string, Dictionary<string, string>>** | | [optional] +**MapOfEnumString** | **Dictionary<string, string>** | | [optional] +**DirectMap** | **Dictionary<string, bool>** | | [optional] +**IndirectMap** | **Dictionary<string, bool>** | | [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-refactor/OpenAPIClientCore/docs/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/MixedPropertiesAndAdditionalPropertiesClass.md new file mode 100644 index 00000000000..f1d3323922e --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.MixedPropertiesAndAdditionalPropertiesClass +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Uuid** | [**Guid**](Guid.md) | | [optional] +**DateTime** | **DateTime** | | [optional] +**Map** | [**Dictionary<string, Animal>**](Animal.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-refactor/OpenAPIClientCore/docs/Model200Response.md b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/Model200Response.md new file mode 100644 index 00000000000..d155a4debd1 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/Model200Response.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.Model200Response +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **int** | | [optional] +**Class** | **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-refactor/OpenAPIClientCore/docs/ModelClient.md b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/ModelClient.md new file mode 100644 index 00000000000..ecc7b60ce55 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/ModelClient.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.ModelClient +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**__Client** | **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-refactor/OpenAPIClientCore/docs/Name.md b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/Name.md new file mode 100644 index 00000000000..ca82e46fe5b --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/Name.md @@ -0,0 +1,12 @@ +# Org.OpenAPITools.Model.Name +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**_Name** | **int** | | +**SnakeCase** | **int** | | [optional] +**Property** | **string** | | [optional] +**_123Number** | **int** | | [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-refactor/OpenAPIClientCore/docs/NumberOnly.md b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/NumberOnly.md new file mode 100644 index 00000000000..a2ca39cc52b --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/NumberOnly.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.NumberOnly +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**JustNumber** | **decimal** | | [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-refactor/OpenAPIClientCore/docs/Order.md b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/Order.md new file mode 100644 index 00000000000..13eb4a56bd5 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/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-refactor/OpenAPIClientCore/docs/OuterComposite.md b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/OuterComposite.md new file mode 100644 index 00000000000..4f026f75b74 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/OuterComposite.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.OuterComposite +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**MyNumber** | **decimal** | | [optional] +**MyString** | **string** | | [optional] +**MyBoolean** | **bool** | | [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-refactor/OpenAPIClientCore/docs/OuterEnum.md b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/OuterEnum.md new file mode 100644 index 00000000000..22713352ca0 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/OuterEnum.md @@ -0,0 +1,8 @@ +# Org.OpenAPITools.Model.OuterEnum +## 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-refactor/OpenAPIClientCore/docs/Pet.md b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/Pet.md new file mode 100644 index 00000000000..348d5c8d221 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/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<string>** | | +**Tags** | [**List<Tag>**](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-refactor/OpenAPIClientCore/docs/PetApi.md b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/PetApi.md new file mode 100644 index 00000000000..a7b361f05ab --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/PetApi.md @@ -0,0 +1,593 @@ +# Org.OpenAPITools.Api.PetApi + +All URIs are relative to *http://petstore.swagger.io:80/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 +[**UploadFileWithRequiredFile**](PetApi.md#uploadfilewithrequiredfile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) + + + +# **AddPet** +> void AddPet (Pet body) + +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 body = new Pet(); // Pet | Pet object that needs to be added to the store + + try + { + // Add a new pet to the store + apiInstance.AddPet(body); + } + catch (Exception e) + { + Debug.Print("Exception when calling PetApi.AddPet: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**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 = null) + +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<string>**| 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>**](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.AddApiKey("api_key", "YOUR_API_KEY"); + // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed + // Configuration.Default.AddApiKeyPrefix("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 body) + +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 body = new Pet(); // Pet | Pet object that needs to be added to the store + + try + { + // Update an existing pet + apiInstance.UpdatePet(body); + } + catch (Exception e) + { + Debug.Print("Exception when calling PetApi.UpdatePet: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**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 = null, string status = null) + +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 = null, System.IO.Stream file = null) + +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 = BINARY_DATA_HERE; // 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****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) + + +# **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****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-refactor/OpenAPIClientCore/docs/ReadOnlyFirst.md b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/ReadOnlyFirst.md new file mode 100644 index 00000000000..6c2571cb48f --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/ReadOnlyFirst.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.ReadOnlyFirst +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Bar** | **string** | | [optional] +**Baz** | **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-refactor/OpenAPIClientCore/docs/Return.md b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/Return.md new file mode 100644 index 00000000000..d7266acb7d7 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/Return.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.Return +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**_Return** | **int** | | [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-refactor/OpenAPIClientCore/docs/SpecialModelName.md b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/SpecialModelName.md new file mode 100644 index 00000000000..e0008731e60 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/SpecialModelName.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.SpecialModelName +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**SpecialPropertyName** | **long** | | [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-refactor/OpenAPIClientCore/docs/StoreApi.md b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/StoreApi.md new file mode 100644 index 00000000000..947a0304ce8 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/StoreApi.md @@ -0,0 +1,254 @@ +# Org.OpenAPITools.Api.StoreApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**DeleteOrder**](StoreApi.md#deleteorder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID +[**GetInventory**](StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status +[**GetOrderById**](StoreApi.md#getorderbyid) | **GET** /store/order/{order_id} | 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.AddApiKey("api_key", "YOUR_API_KEY"); + // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed + // Configuration.Default.AddApiKeyPrefix("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 body) + +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 body = new Order(); // Order | order placed for purchasing the pet + + try + { + // Place an order for a pet + Order result = apiInstance.PlaceOrder(body); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling StoreApi.PlaceOrder: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**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-refactor/OpenAPIClientCore/docs/Tag.md b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/Tag.md new file mode 100644 index 00000000000..718effdb02a --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/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-refactor/OpenAPIClientCore/docs/TypeHolderDefault.md b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/TypeHolderDefault.md new file mode 100644 index 00000000000..ccf43c723ec --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/TypeHolderDefault.md @@ -0,0 +1,13 @@ +# Org.OpenAPITools.Model.TypeHolderDefault +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**StringItem** | **string** | | [default to "what"] +**NumberItem** | **decimal** | | +**IntegerItem** | **int** | | +**BoolItem** | **bool** | | [default to true] +**ArrayItem** | **List<int>** | | + +[[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-refactor/OpenAPIClientCore/docs/TypeHolderExample.md b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/TypeHolderExample.md new file mode 100644 index 00000000000..c1b5b77f960 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/TypeHolderExample.md @@ -0,0 +1,13 @@ +# Org.OpenAPITools.Model.TypeHolderExample +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**StringItem** | **string** | | +**NumberItem** | **decimal** | | +**IntegerItem** | **int** | | +**BoolItem** | **bool** | | +**ArrayItem** | **List<int>** | | + +[[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-refactor/OpenAPIClientCore/docs/User.md b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/User.md new file mode 100644 index 00000000000..e3deddebc20 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/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-refactor/OpenAPIClientCore/docs/UserApi.md b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/UserApi.md new file mode 100644 index 00000000000..9a535e16a82 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/UserApi.md @@ -0,0 +1,488 @@ +# Org.OpenAPITools.Api.UserApi + +All URIs are relative to *http://petstore.swagger.io:80/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 body) + +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 body = new User(); // User | Created user object + + try + { + // Create user + apiInstance.CreateUser(body); + } + catch (Exception e) + { + Debug.Print("Exception when calling UserApi.CreateUser: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**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 body) + +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 body = new List(); // List | List of user object + + try + { + // Creates list of users with given input array + apiInstance.CreateUsersWithArrayInput(body); + } + catch (Exception e) + { + Debug.Print("Exception when calling UserApi.CreateUsersWithArrayInput: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**List<User>**](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 body) + +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 body = new List(); // List | List of user object + + try + { + // Creates list of users with given input array + apiInstance.CreateUsersWithListInput(body); + } + catch (Exception e) + { + Debug.Print("Exception when calling UserApi.CreateUsersWithListInput: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**List<User>**](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 body) + +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 body = new User(); // User | Updated user object + + try + { + // Updated user + apiInstance.UpdateUser(username, body); + } + 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 | + **body** | [**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-refactor/OpenAPIClientCore/docs/XmlItem.md b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/XmlItem.md new file mode 100644 index 00000000000..679fd2c3d11 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/docs/XmlItem.md @@ -0,0 +1,37 @@ +# Org.OpenAPITools.Model.XmlItem +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**AttributeString** | **string** | | [optional] +**AttributeNumber** | **decimal** | | [optional] +**AttributeInteger** | **int** | | [optional] +**AttributeBoolean** | **bool** | | [optional] +**WrappedArray** | **List<int>** | | [optional] +**NameString** | **string** | | [optional] +**NameNumber** | **decimal** | | [optional] +**NameInteger** | **int** | | [optional] +**NameBoolean** | **bool** | | [optional] +**NameArray** | **List<int>** | | [optional] +**NameWrappedArray** | **List<int>** | | [optional] +**PrefixString** | **string** | | [optional] +**PrefixNumber** | **decimal** | | [optional] +**PrefixInteger** | **int** | | [optional] +**PrefixBoolean** | **bool** | | [optional] +**PrefixArray** | **List<int>** | | [optional] +**PrefixWrappedArray** | **List<int>** | | [optional] +**NamespaceString** | **string** | | [optional] +**NamespaceNumber** | **decimal** | | [optional] +**NamespaceInteger** | **int** | | [optional] +**NamespaceBoolean** | **bool** | | [optional] +**NamespaceArray** | **List<int>** | | [optional] +**NamespaceWrappedArray** | **List<int>** | | [optional] +**PrefixNsString** | **string** | | [optional] +**PrefixNsNumber** | **decimal** | | [optional] +**PrefixNsInteger** | **int** | | [optional] +**PrefixNsBoolean** | **bool** | | [optional] +**PrefixNsArray** | **List<int>** | | [optional] +**PrefixNsWrappedArray** | **List<int>** | | [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-refactor/OpenAPIClientCore/git_push.sh b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/git_push.sh new file mode 100644 index 00000000000..4d22bfef4d7 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/git_push.sh @@ -0,0 +1,52 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClient/mono_nunit_test.sh b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/mono_nunit_test.sh similarity index 100% rename from samples/client/petstore/csharp-refactor/OpenAPIClient/mono_nunit_test.sh rename to samples/client/petstore/csharp-refactor/OpenAPIClientCore/mono_nunit_test.sh diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Api/AnotherFakeApiTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Api/AnotherFakeApiTests.cs new file mode 100644 index 00000000000..77f35e992a1 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Api/AnotherFakeApiTests.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 System; +using System.IO; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Reflection; +using RestSharp; +using Xunit; + +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Test +{ + /// + /// Class for testing AnotherFakeApi + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the API endpoint. + /// + public class AnotherFakeApiTests : IDisposable + { + private AnotherFakeApi instance; + + public AnotherFakeApiTests() + { + instance = new AnotherFakeApi(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of AnotherFakeApi + /// + [Fact] + public void InstanceTest() + { + // TODO uncomment below to test 'IsInstanceOfType' AnotherFakeApi + //Assert.IsType(typeof(AnotherFakeApi), instance, "instance is a AnotherFakeApi"); + } + + + /// + /// Test Call123TestSpecialTags + /// + [Fact] + public void Call123TestSpecialTagsTest() + { + // TODO uncomment below to test the method and replace null with proper value + //ModelClient body = null; + //var response = instance.Call123TestSpecialTags(body); + //Assert.IsType (response, "response is ModelClient"); + } + + } + +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs new file mode 100644 index 00000000000..50079e99c26 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs @@ -0,0 +1,243 @@ +/* + * 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.IO; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Reflection; +using RestSharp; +using Xunit; + +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Test +{ + /// + /// Class for testing FakeApi + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the API endpoint. + /// + public class FakeApiTests : IDisposable + { + private FakeApi instance; + + public FakeApiTests() + { + instance = new FakeApi(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of FakeApi + /// + [Fact] + public void InstanceTest() + { + // TODO uncomment below to test 'IsInstanceOfType' FakeApi + //Assert.IsType(typeof(FakeApi), instance, "instance is a FakeApi"); + } + + + /// + /// Test CreateXmlItem + /// + [Fact] + public void CreateXmlItemTest() + { + // TODO uncomment below to test the method and replace null with proper value + //XmlItem xmlItem = null; + //instance.CreateXmlItem(xmlItem); + + } + + /// + /// Test FakeOuterBooleanSerialize + /// + [Fact] + public void FakeOuterBooleanSerializeTest() + { + // TODO uncomment below to test the method and replace null with proper value + //bool? body = null; + //var response = instance.FakeOuterBooleanSerialize(body); + //Assert.IsType (response, "response is bool"); + } + + /// + /// Test FakeOuterCompositeSerialize + /// + [Fact] + public void FakeOuterCompositeSerializeTest() + { + // TODO uncomment below to test the method and replace null with proper value + //OuterComposite body = null; + //var response = instance.FakeOuterCompositeSerialize(body); + //Assert.IsType (response, "response is OuterComposite"); + } + + /// + /// Test FakeOuterNumberSerialize + /// + [Fact] + public void FakeOuterNumberSerializeTest() + { + // TODO uncomment below to test the method and replace null with proper value + //decimal? body = null; + //var response = instance.FakeOuterNumberSerialize(body); + //Assert.IsType (response, "response is decimal"); + } + + /// + /// Test FakeOuterStringSerialize + /// + [Fact] + public void FakeOuterStringSerializeTest() + { + // TODO uncomment below to test the method and replace null with proper value + //string body = null; + //var response = instance.FakeOuterStringSerialize(body); + //Assert.IsType (response, "response is string"); + } + + /// + /// Test TestBodyWithFileSchema + /// + [Fact] + public void TestBodyWithFileSchemaTest() + { + // TODO uncomment below to test the method and replace null with proper value + //FileSchemaTestClass body = null; + //instance.TestBodyWithFileSchema(body); + + } + + /// + /// Test TestBodyWithQueryParams + /// + [Fact] + public void TestBodyWithQueryParamsTest() + { + // TODO uncomment below to test the method and replace null with proper value + //string query = null; + //User body = null; + //instance.TestBodyWithQueryParams(query, body); + + } + + /// + /// Test TestClientModel + /// + [Fact] + public void TestClientModelTest() + { + // TODO uncomment below to test the method and replace null with proper value + //ModelClient body = null; + //var response = instance.TestClientModel(body); + //Assert.IsType (response, "response is ModelClient"); + } + + /// + /// Test TestEndpointParameters + /// + [Fact] + public void TestEndpointParametersTest() + { + // TODO uncomment below to test the method and replace null with proper value + //decimal number = null; + //double _double = null; + //string patternWithoutDelimiter = null; + //byte[] _byte = null; + //int? integer = null; + //int? int32 = null; + //long? int64 = null; + //float? _float = null; + //string _string = null; + //System.IO.Stream binary = null; + //DateTime? date = null; + //DateTime? dateTime = null; + //string password = null; + //string callback = null; + //instance.TestEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, _string, binary, date, dateTime, password, callback); + + } + + /// + /// Test TestEnumParameters + /// + [Fact] + public void TestEnumParametersTest() + { + // TODO uncomment below to test the method and replace null with proper value + //List enumHeaderStringArray = null; + //string enumHeaderString = null; + //List enumQueryStringArray = null; + //string enumQueryString = null; + //int? enumQueryInteger = null; + //double? enumQueryDouble = null; + //List enumFormStringArray = null; + //string enumFormString = null; + //instance.TestEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + + } + + /// + /// Test TestGroupParameters + /// + [Fact] + public void TestGroupParametersTest() + { + // TODO uncomment below to test the method and replace null with proper value + //int requiredStringGroup = null; + //bool requiredBooleanGroup = null; + //long requiredInt64Group = null; + //int? stringGroup = null; + //bool? booleanGroup = null; + //long? int64Group = null; + //instance.TestGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + + } + + /// + /// Test TestInlineAdditionalProperties + /// + [Fact] + public void TestInlineAdditionalPropertiesTest() + { + // TODO uncomment below to test the method and replace null with proper value + //Dictionary param = null; + //instance.TestInlineAdditionalProperties(param); + + } + + /// + /// Test TestJsonFormData + /// + [Fact] + public void TestJsonFormDataTest() + { + // TODO uncomment below to test the method and replace null with proper value + //string param = null; + //string param2 = null; + //instance.TestJsonFormData(param, param2); + + } + + } + +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Api/FakeClassnameTags123ApiTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Api/FakeClassnameTags123ApiTests.cs new file mode 100644 index 00000000000..647a66e3100 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Api/FakeClassnameTags123ApiTests.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 System; +using System.IO; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Reflection; +using RestSharp; +using Xunit; + +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Test +{ + /// + /// Class for testing FakeClassnameTags123Api + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the API endpoint. + /// + public class FakeClassnameTags123ApiTests : IDisposable + { + private FakeClassnameTags123Api instance; + + public FakeClassnameTags123ApiTests() + { + instance = new FakeClassnameTags123Api(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of FakeClassnameTags123Api + /// + [Fact] + public void InstanceTest() + { + // TODO uncomment below to test 'IsInstanceOfType' FakeClassnameTags123Api + //Assert.IsType(typeof(FakeClassnameTags123Api), instance, "instance is a FakeClassnameTags123Api"); + } + + + /// + /// Test TestClassname + /// + [Fact] + public void TestClassnameTest() + { + // TODO uncomment below to test the method and replace null with proper value + //ModelClient body = null; + //var response = instance.TestClassname(body); + //Assert.IsType (response, "response is ModelClient"); + } + + } + +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Api/PetApiTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Api/PetApiTests.cs new file mode 100644 index 00000000000..bb77b505124 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Api/PetApiTests.cs @@ -0,0 +1,175 @@ +/* + * 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.IO; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Reflection; +using RestSharp; +using Xunit; + +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Test +{ + /// + /// Class for testing PetApi + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the API endpoint. + /// + public class PetApiTests : IDisposable + { + private PetApi instance; + + public PetApiTests() + { + instance = new PetApi(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of PetApi + /// + [Fact] + public void InstanceTest() + { + // TODO uncomment below to test 'IsInstanceOfType' PetApi + //Assert.IsType(typeof(PetApi), instance, "instance is a PetApi"); + } + + + /// + /// Test AddPet + /// + [Fact] + public void AddPetTest() + { + // TODO uncomment below to test the method and replace null with proper value + //Pet body = null; + //instance.AddPet(body); + + } + + /// + /// Test DeletePet + /// + [Fact] + public void DeletePetTest() + { + // TODO uncomment below to test the method and replace null with proper value + //long petId = null; + //string apiKey = null; + //instance.DeletePet(petId, apiKey); + + } + + /// + /// Test FindPetsByStatus + /// + [Fact] + public void FindPetsByStatusTest() + { + // TODO uncomment below to test the method and replace null with proper value + //List status = null; + //var response = instance.FindPetsByStatus(status); + //Assert.IsType> (response, "response is List"); + } + + /// + /// Test FindPetsByTags + /// + [Fact] + public void FindPetsByTagsTest() + { + // TODO uncomment below to test the method and replace null with proper value + //List tags = null; + //var response = instance.FindPetsByTags(tags); + //Assert.IsType> (response, "response is List"); + } + + /// + /// Test GetPetById + /// + [Fact] + public void GetPetByIdTest() + { + // TODO uncomment below to test the method and replace null with proper value + //long petId = null; + //var response = instance.GetPetById(petId); + //Assert.IsType (response, "response is Pet"); + } + + /// + /// Test UpdatePet + /// + [Fact] + public void UpdatePetTest() + { + // TODO uncomment below to test the method and replace null with proper value + //Pet body = null; + //instance.UpdatePet(body); + + } + + /// + /// Test UpdatePetWithForm + /// + [Fact] + public void UpdatePetWithFormTest() + { + // TODO uncomment below to test the method and replace null with proper value + //long petId = null; + //string name = null; + //string status = null; + //instance.UpdatePetWithForm(petId, name, status); + + } + + /// + /// Test UploadFile + /// + [Fact] + public void UploadFileTest() + { + // TODO uncomment below to test the method and replace null with proper value + //long petId = null; + //string additionalMetadata = null; + //System.IO.Stream file = null; + //var response = instance.UploadFile(petId, additionalMetadata, file); + //Assert.IsType (response, "response is ApiResponse"); + } + + /// + /// Test UploadFileWithRequiredFile + /// + [Fact] + public void UploadFileWithRequiredFileTest() + { + // TODO uncomment below to test the method and replace null with proper value + //long petId = null; + //System.IO.Stream requiredFile = null; + //string additionalMetadata = null; + //var response = instance.UploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + //Assert.IsType (response, "response is ApiResponse"); + } + + } + +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Api/StoreApiTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Api/StoreApiTests.cs new file mode 100644 index 00000000000..ac61d7e7c94 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Api/StoreApiTests.cs @@ -0,0 +1,107 @@ +/* + * 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.IO; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Reflection; +using RestSharp; +using Xunit; + +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Test +{ + /// + /// Class for testing StoreApi + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the API endpoint. + /// + public class StoreApiTests : IDisposable + { + private StoreApi instance; + + public StoreApiTests() + { + instance = new StoreApi(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of StoreApi + /// + [Fact] + public void InstanceTest() + { + // TODO uncomment below to test 'IsInstanceOfType' StoreApi + //Assert.IsType(typeof(StoreApi), instance, "instance is a StoreApi"); + } + + + /// + /// Test DeleteOrder + /// + [Fact] + public void DeleteOrderTest() + { + // TODO uncomment below to test the method and replace null with proper value + //string orderId = null; + //instance.DeleteOrder(orderId); + + } + + /// + /// Test GetInventory + /// + [Fact] + public void GetInventoryTest() + { + // TODO uncomment below to test the method and replace null with proper value + //var response = instance.GetInventory(); + //Assert.IsType> (response, "response is Dictionary"); + } + + /// + /// Test GetOrderById + /// + [Fact] + public void GetOrderByIdTest() + { + // TODO uncomment below to test the method and replace null with proper value + //long orderId = null; + //var response = instance.GetOrderById(orderId); + //Assert.IsType (response, "response is Order"); + } + + /// + /// Test PlaceOrder + /// + [Fact] + public void PlaceOrderTest() + { + // TODO uncomment below to test the method and replace null with proper value + //Order body = null; + //var response = instance.PlaceOrder(body); + //Assert.IsType (response, "response is Order"); + } + + } + +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Api/UserApiTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Api/UserApiTests.cs new file mode 100644 index 00000000000..dfd9e7b3402 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Api/UserApiTests.cs @@ -0,0 +1,157 @@ +/* + * 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.IO; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Reflection; +using RestSharp; +using Xunit; + +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Test +{ + /// + /// Class for testing UserApi + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the API endpoint. + /// + public class UserApiTests : IDisposable + { + private UserApi instance; + + public UserApiTests() + { + instance = new UserApi(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of UserApi + /// + [Fact] + public void InstanceTest() + { + // TODO uncomment below to test 'IsInstanceOfType' UserApi + //Assert.IsType(typeof(UserApi), instance, "instance is a UserApi"); + } + + + /// + /// Test CreateUser + /// + [Fact] + public void CreateUserTest() + { + // TODO uncomment below to test the method and replace null with proper value + //User body = null; + //instance.CreateUser(body); + + } + + /// + /// Test CreateUsersWithArrayInput + /// + [Fact] + public void CreateUsersWithArrayInputTest() + { + // TODO uncomment below to test the method and replace null with proper value + //List body = null; + //instance.CreateUsersWithArrayInput(body); + + } + + /// + /// Test CreateUsersWithListInput + /// + [Fact] + public void CreateUsersWithListInputTest() + { + // TODO uncomment below to test the method and replace null with proper value + //List body = null; + //instance.CreateUsersWithListInput(body); + + } + + /// + /// Test DeleteUser + /// + [Fact] + public void DeleteUserTest() + { + // TODO uncomment below to test the method and replace null with proper value + //string username = null; + //instance.DeleteUser(username); + + } + + /// + /// Test GetUserByName + /// + [Fact] + public void GetUserByNameTest() + { + // TODO uncomment below to test the method and replace null with proper value + //string username = null; + //var response = instance.GetUserByName(username); + //Assert.IsType (response, "response is User"); + } + + /// + /// Test LoginUser + /// + [Fact] + public void LoginUserTest() + { + // TODO uncomment below to test the method and replace null with proper value + //string username = null; + //string password = null; + //var response = instance.LoginUser(username, password); + //Assert.IsType (response, "response is string"); + } + + /// + /// Test LogoutUser + /// + [Fact] + public void LogoutUserTest() + { + // TODO uncomment below to test the method and replace null with proper value + //instance.LogoutUser(); + + } + + /// + /// Test UpdateUser + /// + [Fact] + public void UpdateUserTest() + { + // TODO uncomment below to test the method and replace null with proper value + //string username = null; + //User body = null; + //instance.UpdateUser(username, body); + + } + + } + +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesClassTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesClassTests.cs new file mode 100644 index 00000000000..2c07d9ce2ea --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesClassTests.cs @@ -0,0 +1,79 @@ +/* + * 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 Xunit; + +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 AdditionalPropertiesClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class AdditionalPropertiesClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for AdditionalPropertiesClass + //private AdditionalPropertiesClass instance; + + public AdditionalPropertiesClassTests() + { + // TODO uncomment below to create an instance of AdditionalPropertiesClass + //instance = new AdditionalPropertiesClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of AdditionalPropertiesClass + /// + [Fact] + public void AdditionalPropertiesClassInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" AdditionalPropertiesClass + //Assert.IsInstanceOfType (instance, "variable 'instance' is a AdditionalPropertiesClass"); + } + + + /// + /// Test the property 'MapProperty' + /// + [Fact] + public void MapPropertyTest() + { + // TODO unit test for the property 'MapProperty' + } + /// + /// Test the property 'MapOfMapProperty' + /// + [Fact] + public void MapOfMapPropertyTest() + { + // TODO unit test for the property 'MapOfMapProperty' + } + + } + +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/AnimalTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/AnimalTests.cs new file mode 100644 index 00000000000..a7109a57881 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/AnimalTests.cs @@ -0,0 +1,97 @@ +/* + * 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 Xunit; + +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 Animal + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class AnimalTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Animal + //private Animal instance; + + public AnimalTests() + { + // TODO uncomment below to create an instance of Animal + //instance = new Animal(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Animal + /// + [Fact] + public void AnimalInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" Animal + //Assert.IsInstanceOfType (instance, "variable 'instance' is a Animal"); + } + + /// + /// Test deserialize a Dog from type Animal + /// + [Fact] + public void DogDeserializeFromAnimalTest() + { + // TODO uncomment below to test deserialize a Dog from type Animal + //Assert.IsInstanceOf(JsonConvert.DeserializeObject(new Dog().ToJson())); + } + /// + /// Test deserialize a Cat from type Animal + /// + [Fact] + public void CatDeserializeFromAnimalTest() + { + // TODO uncomment below to test deserialize a Cat from type Animal + //Assert.IsInstanceOf(JsonConvert.DeserializeObject(new Cat().ToJson())); + } + + /// + /// Test the property 'ClassName' + /// + [Fact] + public void ClassNameTest() + { + // TODO unit test for the property 'ClassName' + } + /// + /// Test the property 'Color' + /// + [Fact] + public void ColorTest() + { + // TODO unit test for the property 'Color' + } + + } + +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/ApiResponseTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/ApiResponseTests.cs new file mode 100644 index 00000000000..de50416f945 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/ApiResponseTests.cs @@ -0,0 +1,87 @@ +/* + * 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 Xunit; + +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 ApiResponse + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ApiResponseTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ApiResponse + //private ApiResponse instance; + + public ApiResponseTests() + { + // TODO uncomment below to create an instance of ApiResponse + //instance = new ApiResponse(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ApiResponse + /// + [Fact] + public void ApiResponseInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" ApiResponse + //Assert.IsInstanceOfType (instance, "variable 'instance' is a ApiResponse"); + } + + + /// + /// Test the property 'Code' + /// + [Fact] + public void CodeTest() + { + // TODO unit test for the property 'Code' + } + /// + /// Test the property 'Type' + /// + [Fact] + public void TypeTest() + { + // TODO unit test for the property 'Type' + } + /// + /// Test the property 'Message' + /// + [Fact] + public void MessageTest() + { + // TODO unit test for the property 'Message' + } + + } + +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/ArrayOfArrayOfNumberOnlyTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/ArrayOfArrayOfNumberOnlyTests.cs new file mode 100644 index 00000000000..646f03444d6 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/ArrayOfArrayOfNumberOnlyTests.cs @@ -0,0 +1,71 @@ +/* + * 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 Xunit; + +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 ArrayOfArrayOfNumberOnly + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ArrayOfArrayOfNumberOnlyTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ArrayOfArrayOfNumberOnly + //private ArrayOfArrayOfNumberOnly instance; + + public ArrayOfArrayOfNumberOnlyTests() + { + // TODO uncomment below to create an instance of ArrayOfArrayOfNumberOnly + //instance = new ArrayOfArrayOfNumberOnly(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ArrayOfArrayOfNumberOnly + /// + [Fact] + public void ArrayOfArrayOfNumberOnlyInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" ArrayOfArrayOfNumberOnly + //Assert.IsInstanceOfType (instance, "variable 'instance' is a ArrayOfArrayOfNumberOnly"); + } + + + /// + /// Test the property 'ArrayArrayNumber' + /// + [Fact] + public void ArrayArrayNumberTest() + { + // TODO unit test for the property 'ArrayArrayNumber' + } + + } + +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/ArrayOfNumberOnlyTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/ArrayOfNumberOnlyTests.cs new file mode 100644 index 00000000000..3fcab83fc87 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/ArrayOfNumberOnlyTests.cs @@ -0,0 +1,71 @@ +/* + * 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 Xunit; + +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 ArrayOfNumberOnly + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ArrayOfNumberOnlyTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ArrayOfNumberOnly + //private ArrayOfNumberOnly instance; + + public ArrayOfNumberOnlyTests() + { + // TODO uncomment below to create an instance of ArrayOfNumberOnly + //instance = new ArrayOfNumberOnly(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ArrayOfNumberOnly + /// + [Fact] + public void ArrayOfNumberOnlyInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" ArrayOfNumberOnly + //Assert.IsInstanceOfType (instance, "variable 'instance' is a ArrayOfNumberOnly"); + } + + + /// + /// Test the property 'ArrayNumber' + /// + [Fact] + public void ArrayNumberTest() + { + // TODO unit test for the property 'ArrayNumber' + } + + } + +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/ArrayTestTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/ArrayTestTests.cs new file mode 100644 index 00000000000..d14287a5251 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/ArrayTestTests.cs @@ -0,0 +1,87 @@ +/* + * 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 Xunit; + +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 ArrayTest + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ArrayTestTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ArrayTest + //private ArrayTest instance; + + public ArrayTestTests() + { + // TODO uncomment below to create an instance of ArrayTest + //instance = new ArrayTest(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ArrayTest + /// + [Fact] + public void ArrayTestInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" ArrayTest + //Assert.IsInstanceOfType (instance, "variable 'instance' is a ArrayTest"); + } + + + /// + /// Test the property 'ArrayOfString' + /// + [Fact] + public void ArrayOfStringTest() + { + // TODO unit test for the property 'ArrayOfString' + } + /// + /// Test the property 'ArrayArrayOfInteger' + /// + [Fact] + public void ArrayArrayOfIntegerTest() + { + // TODO unit test for the property 'ArrayArrayOfInteger' + } + /// + /// Test the property 'ArrayArrayOfModel' + /// + [Fact] + public void ArrayArrayOfModelTest() + { + // TODO unit test for the property 'ArrayArrayOfModel' + } + + } + +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/CapitalizationTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/CapitalizationTests.cs new file mode 100644 index 00000000000..006dbfb657b --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/CapitalizationTests.cs @@ -0,0 +1,111 @@ +/* + * 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 Xunit; + +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 Capitalization + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class CapitalizationTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Capitalization + //private Capitalization instance; + + public CapitalizationTests() + { + // TODO uncomment below to create an instance of Capitalization + //instance = new Capitalization(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Capitalization + /// + [Fact] + public void CapitalizationInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" Capitalization + //Assert.IsInstanceOfType (instance, "variable 'instance' is a Capitalization"); + } + + + /// + /// Test the property 'SmallCamel' + /// + [Fact] + public void SmallCamelTest() + { + // TODO unit test for the property 'SmallCamel' + } + /// + /// Test the property 'CapitalCamel' + /// + [Fact] + public void CapitalCamelTest() + { + // TODO unit test for the property 'CapitalCamel' + } + /// + /// Test the property 'SmallSnake' + /// + [Fact] + public void SmallSnakeTest() + { + // TODO unit test for the property 'SmallSnake' + } + /// + /// Test the property 'CapitalSnake' + /// + [Fact] + public void CapitalSnakeTest() + { + // TODO unit test for the property 'CapitalSnake' + } + /// + /// Test the property 'SCAETHFlowPoints' + /// + [Fact] + public void SCAETHFlowPointsTest() + { + // TODO unit test for the property 'SCAETHFlowPoints' + } + /// + /// Test the property 'ATT_NAME' + /// + [Fact] + public void ATT_NAMETest() + { + // TODO unit test for the property 'ATT_NAME' + } + + } + +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/CatTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/CatTests.cs new file mode 100644 index 00000000000..466be23b55d --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/CatTests.cs @@ -0,0 +1,71 @@ +/* + * 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 Xunit; + +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 Cat + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class CatTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Cat + //private Cat instance; + + public CatTests() + { + // TODO uncomment below to create an instance of Cat + //instance = new Cat(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Cat + /// + [Fact] + public void CatInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" Cat + //Assert.IsInstanceOfType (instance, "variable 'instance' is a Cat"); + } + + + /// + /// Test the property 'Declawed' + /// + [Fact] + public void DeclawedTest() + { + // TODO unit test for the property 'Declawed' + } + + } + +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/CategoryTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/CategoryTests.cs new file mode 100644 index 00000000000..b7f7d7a8e9b --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/CategoryTests.cs @@ -0,0 +1,79 @@ +/* + * 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 Xunit; + +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 Category + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class CategoryTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Category + //private Category instance; + + public CategoryTests() + { + // TODO uncomment below to create an instance of Category + //instance = new Category(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Category + /// + [Fact] + public void CategoryInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" Category + //Assert.IsInstanceOfType (instance, "variable 'instance' is a Category"); + } + + + /// + /// Test the property 'Id' + /// + [Fact] + public void IdTest() + { + // TODO unit test for the property 'Id' + } + /// + /// Test the property 'Name' + /// + [Fact] + public void NameTest() + { + // TODO unit test for the property 'Name' + } + + } + +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/ClassModelTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/ClassModelTests.cs new file mode 100644 index 00000000000..ee76348d664 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/ClassModelTests.cs @@ -0,0 +1,71 @@ +/* + * 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 Xunit; + +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 ClassModel + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ClassModelTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ClassModel + //private ClassModel instance; + + public ClassModelTests() + { + // TODO uncomment below to create an instance of ClassModel + //instance = new ClassModel(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ClassModel + /// + [Fact] + public void ClassModelInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" ClassModel + //Assert.IsInstanceOfType (instance, "variable 'instance' is a ClassModel"); + } + + + /// + /// Test the property 'Class' + /// + [Fact] + public void ClassTest() + { + // TODO unit test for the property 'Class' + } + + } + +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/DogTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/DogTests.cs new file mode 100644 index 00000000000..c3520c9cb5c --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/DogTests.cs @@ -0,0 +1,71 @@ +/* + * 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 Xunit; + +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 Dog + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class DogTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Dog + //private Dog instance; + + public DogTests() + { + // TODO uncomment below to create an instance of Dog + //instance = new Dog(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Dog + /// + [Fact] + public void DogInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" Dog + //Assert.IsInstanceOfType (instance, "variable 'instance' is a Dog"); + } + + + /// + /// Test the property 'Breed' + /// + [Fact] + public void BreedTest() + { + // TODO unit test for the property 'Breed' + } + + } + +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs new file mode 100644 index 00000000000..a525a8908b0 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs @@ -0,0 +1,79 @@ +/* + * 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 Xunit; + +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 EnumArrays + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class EnumArraysTests : IDisposable + { + // TODO uncomment below to declare an instance variable for EnumArrays + //private EnumArrays instance; + + public EnumArraysTests() + { + // TODO uncomment below to create an instance of EnumArrays + //instance = new EnumArrays(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of EnumArrays + /// + [Fact] + public void EnumArraysInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" EnumArrays + //Assert.IsInstanceOfType (instance, "variable 'instance' is a EnumArrays"); + } + + + /// + /// Test the property 'JustSymbol' + /// + [Fact] + public void JustSymbolTest() + { + // TODO unit test for the property 'JustSymbol' + } + /// + /// Test the property 'ArrayEnum' + /// + [Fact] + public void ArrayEnumTest() + { + // TODO unit test for the property 'ArrayEnum' + } + + } + +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/EnumClassTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/EnumClassTests.cs new file mode 100644 index 00000000000..14a9b8174e7 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/EnumClassTests.cs @@ -0,0 +1,63 @@ +/* + * 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 Xunit; + +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 EnumClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class EnumClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for EnumClass + //private EnumClass instance; + + public EnumClassTests() + { + // TODO uncomment below to create an instance of EnumClass + //instance = new EnumClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of EnumClass + /// + [Fact] + public void EnumClassInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" EnumClass + //Assert.IsInstanceOfType (instance, "variable 'instance' is a EnumClass"); + } + + + + } + +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs new file mode 100644 index 00000000000..65695bc71f3 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs @@ -0,0 +1,103 @@ +/* + * 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 Xunit; + +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 EnumTest + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class EnumTestTests : IDisposable + { + // TODO uncomment below to declare an instance variable for EnumTest + //private EnumTest instance; + + public EnumTestTests() + { + // TODO uncomment below to create an instance of EnumTest + //instance = new EnumTest(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of EnumTest + /// + [Fact] + public void EnumTestInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" EnumTest + //Assert.IsInstanceOfType (instance, "variable 'instance' is a EnumTest"); + } + + + /// + /// Test the property 'EnumString' + /// + [Fact] + public void EnumStringTest() + { + // TODO unit test for the property 'EnumString' + } + /// + /// Test the property 'EnumStringRequired' + /// + [Fact] + public void EnumStringRequiredTest() + { + // TODO unit test for the property 'EnumStringRequired' + } + /// + /// Test the property 'EnumInteger' + /// + [Fact] + public void EnumIntegerTest() + { + // TODO unit test for the property 'EnumInteger' + } + /// + /// Test the property 'EnumNumber' + /// + [Fact] + public void EnumNumberTest() + { + // TODO unit test for the property 'EnumNumber' + } + /// + /// Test the property 'OuterEnum' + /// + [Fact] + public void OuterEnumTest() + { + // TODO unit test for the property 'OuterEnum' + } + + } + +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs new file mode 100644 index 00000000000..cc0f3dcefe8 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs @@ -0,0 +1,79 @@ +/* + * 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 Xunit; + +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. + /// + public class FileSchemaTestClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for FileSchemaTestClass + //private FileSchemaTestClass instance; + + public FileSchemaTestClassTests() + { + // TODO uncomment below to create an instance of FileSchemaTestClass + //instance = new FileSchemaTestClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of FileSchemaTestClass + /// + [Fact] + public void FileSchemaTestClassInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" FileSchemaTestClass + //Assert.IsInstanceOfType (instance, "variable 'instance' is a FileSchemaTestClass"); + } + + + /// + /// Test the property 'File' + /// + [Fact] + public void FileTest() + { + // TODO unit test for the property 'File' + } + /// + /// Test the property 'Files' + /// + [Fact] + public void FilesTest() + { + // TODO unit test for the property 'Files' + } + + } + +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/FileTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/FileTests.cs new file mode 100644 index 00000000000..ed014dd754a --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/FileTests.cs @@ -0,0 +1,71 @@ +/* + * 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 Xunit; + +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. + /// + public class FileTests : IDisposable + { + // TODO uncomment below to declare an instance variable for File + //private File instance; + + public FileTests() + { + // TODO uncomment below to create an instance of File + //instance = new File(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of File + /// + [Fact] + public void FileInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" File + //Assert.IsInstanceOfType (instance, "variable 'instance' is a File"); + } + + + /// + /// Test the property 'SourceURI' + /// + [Fact] + public void SourceURITest() + { + // TODO unit test for the property 'SourceURI' + } + + } + +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs new file mode 100644 index 00000000000..169d4277d69 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs @@ -0,0 +1,167 @@ +/* + * 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 Xunit; + +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 FormatTest + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class FormatTestTests : IDisposable + { + // TODO uncomment below to declare an instance variable for FormatTest + //private FormatTest instance; + + public FormatTestTests() + { + // TODO uncomment below to create an instance of FormatTest + //instance = new FormatTest(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of FormatTest + /// + [Fact] + public void FormatTestInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" FormatTest + //Assert.IsInstanceOfType (instance, "variable 'instance' is a FormatTest"); + } + + + /// + /// Test the property 'Integer' + /// + [Fact] + public void IntegerTest() + { + // TODO unit test for the property 'Integer' + } + /// + /// Test the property 'Int32' + /// + [Fact] + public void Int32Test() + { + // TODO unit test for the property 'Int32' + } + /// + /// Test the property 'Int64' + /// + [Fact] + public void Int64Test() + { + // TODO unit test for the property 'Int64' + } + /// + /// Test the property 'Number' + /// + [Fact] + public void NumberTest() + { + // TODO unit test for the property 'Number' + } + /// + /// Test the property 'Float' + /// + [Fact] + public void FloatTest() + { + // TODO unit test for the property 'Float' + } + /// + /// Test the property 'Double' + /// + [Fact] + public void DoubleTest() + { + // TODO unit test for the property 'Double' + } + /// + /// Test the property 'String' + /// + [Fact] + public void StringTest() + { + // TODO unit test for the property 'String' + } + /// + /// Test the property 'Byte' + /// + [Fact] + public void ByteTest() + { + // TODO unit test for the property 'Byte' + } + /// + /// Test the property 'Binary' + /// + [Fact] + public void BinaryTest() + { + // TODO unit test for the property 'Binary' + } + /// + /// Test the property 'Date' + /// + [Fact] + public void DateTest() + { + // TODO unit test for the property 'Date' + } + /// + /// Test the property 'DateTime' + /// + [Fact] + public void DateTimeTest() + { + // TODO unit test for the property 'DateTime' + } + /// + /// Test the property 'Uuid' + /// + [Fact] + public void UuidTest() + { + // TODO unit test for the property 'Uuid' + } + /// + /// Test the property 'Password' + /// + [Fact] + public void PasswordTest() + { + // TODO unit test for the property 'Password' + } + + } + +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/HasOnlyReadOnlyTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/HasOnlyReadOnlyTests.cs new file mode 100644 index 00000000000..45cf05b3c7f --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/HasOnlyReadOnlyTests.cs @@ -0,0 +1,79 @@ +/* + * 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 Xunit; + +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 HasOnlyReadOnly + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class HasOnlyReadOnlyTests : IDisposable + { + // TODO uncomment below to declare an instance variable for HasOnlyReadOnly + //private HasOnlyReadOnly instance; + + public HasOnlyReadOnlyTests() + { + // TODO uncomment below to create an instance of HasOnlyReadOnly + //instance = new HasOnlyReadOnly(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of HasOnlyReadOnly + /// + [Fact] + public void HasOnlyReadOnlyInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" HasOnlyReadOnly + //Assert.IsInstanceOfType (instance, "variable 'instance' is a HasOnlyReadOnly"); + } + + + /// + /// Test the property 'Bar' + /// + [Fact] + public void BarTest() + { + // TODO unit test for the property 'Bar' + } + /// + /// Test the property 'Foo' + /// + [Fact] + public void FooTest() + { + // TODO unit test for the property 'Foo' + } + + } + +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/ListTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/ListTests.cs new file mode 100644 index 00000000000..b779b3b13fa --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/ListTests.cs @@ -0,0 +1,71 @@ +/* + * 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 Xunit; + +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 List + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ListTests : IDisposable + { + // TODO uncomment below to declare an instance variable for List + //private List instance; + + public ListTests() + { + // TODO uncomment below to create an instance of List + //instance = new List(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of List + /// + [Fact] + public void ListInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" List + //Assert.IsInstanceOfType (instance, "variable 'instance' is a List"); + } + + + /// + /// Test the property '_123List' + /// + [Fact] + public void _123ListTest() + { + // TODO unit test for the property '_123List' + } + + } + +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/MapTestTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/MapTestTests.cs new file mode 100644 index 00000000000..2b6c365c396 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/MapTestTests.cs @@ -0,0 +1,95 @@ +/* + * 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 Xunit; + +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 MapTest + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class MapTestTests : IDisposable + { + // TODO uncomment below to declare an instance variable for MapTest + //private MapTest instance; + + public MapTestTests() + { + // TODO uncomment below to create an instance of MapTest + //instance = new MapTest(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of MapTest + /// + [Fact] + public void MapTestInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" MapTest + //Assert.IsInstanceOfType (instance, "variable 'instance' is a MapTest"); + } + + + /// + /// Test the property 'MapMapOfString' + /// + [Fact] + public void MapMapOfStringTest() + { + // TODO unit test for the property 'MapMapOfString' + } + /// + /// Test the property 'MapOfEnumString' + /// + [Fact] + public void MapOfEnumStringTest() + { + // TODO unit test for the property 'MapOfEnumString' + } + /// + /// Test the property 'DirectMap' + /// + [Fact] + public void DirectMapTest() + { + // TODO unit test for the property 'DirectMap' + } + /// + /// Test the property 'IndirectMap' + /// + [Fact] + public void IndirectMapTest() + { + // TODO unit test for the property 'IndirectMap' + } + + } + +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/MixedPropertiesAndAdditionalPropertiesClassTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/MixedPropertiesAndAdditionalPropertiesClassTests.cs new file mode 100644 index 00000000000..61cd08e2d86 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/MixedPropertiesAndAdditionalPropertiesClassTests.cs @@ -0,0 +1,87 @@ +/* + * 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 Xunit; + +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 MixedPropertiesAndAdditionalPropertiesClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class MixedPropertiesAndAdditionalPropertiesClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for MixedPropertiesAndAdditionalPropertiesClass + //private MixedPropertiesAndAdditionalPropertiesClass instance; + + public MixedPropertiesAndAdditionalPropertiesClassTests() + { + // TODO uncomment below to create an instance of MixedPropertiesAndAdditionalPropertiesClass + //instance = new MixedPropertiesAndAdditionalPropertiesClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of MixedPropertiesAndAdditionalPropertiesClass + /// + [Fact] + public void MixedPropertiesAndAdditionalPropertiesClassInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" MixedPropertiesAndAdditionalPropertiesClass + //Assert.IsInstanceOfType (instance, "variable 'instance' is a MixedPropertiesAndAdditionalPropertiesClass"); + } + + + /// + /// Test the property 'Uuid' + /// + [Fact] + public void UuidTest() + { + // TODO unit test for the property 'Uuid' + } + /// + /// Test the property 'DateTime' + /// + [Fact] + public void DateTimeTest() + { + // TODO unit test for the property 'DateTime' + } + /// + /// Test the property 'Map' + /// + [Fact] + public void MapTest() + { + // TODO unit test for the property 'Map' + } + + } + +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/Model200ResponseTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/Model200ResponseTests.cs new file mode 100644 index 00000000000..3af4348b640 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/Model200ResponseTests.cs @@ -0,0 +1,79 @@ +/* + * 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 Xunit; + +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 Model200Response + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class Model200ResponseTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Model200Response + //private Model200Response instance; + + public Model200ResponseTests() + { + // TODO uncomment below to create an instance of Model200Response + //instance = new Model200Response(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Model200Response + /// + [Fact] + public void Model200ResponseInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" Model200Response + //Assert.IsInstanceOfType (instance, "variable 'instance' is a Model200Response"); + } + + + /// + /// Test the property 'Name' + /// + [Fact] + public void NameTest() + { + // TODO unit test for the property 'Name' + } + /// + /// Test the property 'Class' + /// + [Fact] + public void ClassTest() + { + // TODO unit test for the property 'Class' + } + + } + +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/ModelClientTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/ModelClientTests.cs new file mode 100644 index 00000000000..b4644ef02bf --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/ModelClientTests.cs @@ -0,0 +1,71 @@ +/* + * 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 Xunit; + +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 ModelClient + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ModelClientTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ModelClient + //private ModelClient instance; + + public ModelClientTests() + { + // TODO uncomment below to create an instance of ModelClient + //instance = new ModelClient(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ModelClient + /// + [Fact] + public void ModelClientInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" ModelClient + //Assert.IsInstanceOfType (instance, "variable 'instance' is a ModelClient"); + } + + + /// + /// Test the property '__Client' + /// + [Fact] + public void __ClientTest() + { + // TODO unit test for the property '__Client' + } + + } + +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/NameTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/NameTests.cs new file mode 100644 index 00000000000..940465046c7 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/NameTests.cs @@ -0,0 +1,95 @@ +/* + * 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 Xunit; + +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 Name + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class NameTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Name + //private Name instance; + + public NameTests() + { + // TODO uncomment below to create an instance of Name + //instance = new Name(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Name + /// + [Fact] + public void NameInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" Name + //Assert.IsInstanceOfType (instance, "variable 'instance' is a Name"); + } + + + /// + /// Test the property '_Name' + /// + [Fact] + public void _NameTest() + { + // TODO unit test for the property '_Name' + } + /// + /// Test the property 'SnakeCase' + /// + [Fact] + public void SnakeCaseTest() + { + // TODO unit test for the property 'SnakeCase' + } + /// + /// Test the property 'Property' + /// + [Fact] + public void PropertyTest() + { + // TODO unit test for the property 'Property' + } + /// + /// Test the property '_123Number' + /// + [Fact] + public void _123NumberTest() + { + // TODO unit test for the property '_123Number' + } + + } + +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/NumberOnlyTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/NumberOnlyTests.cs new file mode 100644 index 00000000000..b166001e800 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/NumberOnlyTests.cs @@ -0,0 +1,71 @@ +/* + * 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 Xunit; + +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 NumberOnly + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class NumberOnlyTests : IDisposable + { + // TODO uncomment below to declare an instance variable for NumberOnly + //private NumberOnly instance; + + public NumberOnlyTests() + { + // TODO uncomment below to create an instance of NumberOnly + //instance = new NumberOnly(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of NumberOnly + /// + [Fact] + public void NumberOnlyInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" NumberOnly + //Assert.IsInstanceOfType (instance, "variable 'instance' is a NumberOnly"); + } + + + /// + /// Test the property 'JustNumber' + /// + [Fact] + public void JustNumberTest() + { + // TODO unit test for the property 'JustNumber' + } + + } + +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/OrderTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/OrderTests.cs new file mode 100644 index 00000000000..43e1c8371c5 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/OrderTests.cs @@ -0,0 +1,111 @@ +/* + * 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 Xunit; + +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 Order + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class OrderTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Order + //private Order instance; + + public OrderTests() + { + // TODO uncomment below to create an instance of Order + //instance = new Order(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Order + /// + [Fact] + public void OrderInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" Order + //Assert.IsInstanceOfType (instance, "variable 'instance' is a Order"); + } + + + /// + /// Test the property 'Id' + /// + [Fact] + public void IdTest() + { + // TODO unit test for the property 'Id' + } + /// + /// Test the property 'PetId' + /// + [Fact] + public void PetIdTest() + { + // TODO unit test for the property 'PetId' + } + /// + /// Test the property 'Quantity' + /// + [Fact] + public void QuantityTest() + { + // TODO unit test for the property 'Quantity' + } + /// + /// Test the property 'ShipDate' + /// + [Fact] + public void ShipDateTest() + { + // TODO unit test for the property 'ShipDate' + } + /// + /// Test the property 'Status' + /// + [Fact] + public void StatusTest() + { + // TODO unit test for the property 'Status' + } + /// + /// Test the property 'Complete' + /// + [Fact] + public void CompleteTest() + { + // TODO unit test for the property 'Complete' + } + + } + +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/OuterCompositeTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/OuterCompositeTests.cs new file mode 100644 index 00000000000..0b6b81edeb3 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/OuterCompositeTests.cs @@ -0,0 +1,87 @@ +/* + * 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 Xunit; + +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 OuterComposite + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class OuterCompositeTests : IDisposable + { + // TODO uncomment below to declare an instance variable for OuterComposite + //private OuterComposite instance; + + public OuterCompositeTests() + { + // TODO uncomment below to create an instance of OuterComposite + //instance = new OuterComposite(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of OuterComposite + /// + [Fact] + public void OuterCompositeInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" OuterComposite + //Assert.IsInstanceOfType (instance, "variable 'instance' is a OuterComposite"); + } + + + /// + /// Test the property 'MyNumber' + /// + [Fact] + public void MyNumberTest() + { + // TODO unit test for the property 'MyNumber' + } + /// + /// Test the property 'MyString' + /// + [Fact] + public void MyStringTest() + { + // TODO unit test for the property 'MyString' + } + /// + /// Test the property 'MyBoolean' + /// + [Fact] + public void MyBooleanTest() + { + // TODO unit test for the property 'MyBoolean' + } + + } + +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/OuterEnumTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/OuterEnumTests.cs new file mode 100644 index 00000000000..6fc33f0d80b --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/OuterEnumTests.cs @@ -0,0 +1,63 @@ +/* + * 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 Xunit; + +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 OuterEnum + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class OuterEnumTests : IDisposable + { + // TODO uncomment below to declare an instance variable for OuterEnum + //private OuterEnum instance; + + public OuterEnumTests() + { + // TODO uncomment below to create an instance of OuterEnum + //instance = new OuterEnum(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of OuterEnum + /// + [Fact] + public void OuterEnumInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" OuterEnum + //Assert.IsInstanceOfType (instance, "variable 'instance' is a OuterEnum"); + } + + + + } + +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/PetTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/PetTests.cs new file mode 100644 index 00000000000..69ee044f537 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/PetTests.cs @@ -0,0 +1,111 @@ +/* + * 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 Xunit; + +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 Pet + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class PetTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Pet + //private Pet instance; + + public PetTests() + { + // TODO uncomment below to create an instance of Pet + //instance = new Pet(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Pet + /// + [Fact] + public void PetInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" Pet + //Assert.IsInstanceOfType (instance, "variable 'instance' is a Pet"); + } + + + /// + /// Test the property 'Id' + /// + [Fact] + public void IdTest() + { + // TODO unit test for the property 'Id' + } + /// + /// Test the property 'Category' + /// + [Fact] + public void CategoryTest() + { + // TODO unit test for the property 'Category' + } + /// + /// Test the property 'Name' + /// + [Fact] + public void NameTest() + { + // TODO unit test for the property 'Name' + } + /// + /// Test the property 'PhotoUrls' + /// + [Fact] + public void PhotoUrlsTest() + { + // TODO unit test for the property 'PhotoUrls' + } + /// + /// Test the property 'Tags' + /// + [Fact] + public void TagsTest() + { + // TODO unit test for the property 'Tags' + } + /// + /// Test the property 'Status' + /// + [Fact] + public void StatusTest() + { + // TODO unit test for the property 'Status' + } + + } + +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/ReadOnlyFirstTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/ReadOnlyFirstTests.cs new file mode 100644 index 00000000000..eaf0f7cd4d4 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/ReadOnlyFirstTests.cs @@ -0,0 +1,79 @@ +/* + * 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 Xunit; + +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 ReadOnlyFirst + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ReadOnlyFirstTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ReadOnlyFirst + //private ReadOnlyFirst instance; + + public ReadOnlyFirstTests() + { + // TODO uncomment below to create an instance of ReadOnlyFirst + //instance = new ReadOnlyFirst(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ReadOnlyFirst + /// + [Fact] + public void ReadOnlyFirstInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" ReadOnlyFirst + //Assert.IsInstanceOfType (instance, "variable 'instance' is a ReadOnlyFirst"); + } + + + /// + /// Test the property 'Bar' + /// + [Fact] + public void BarTest() + { + // TODO unit test for the property 'Bar' + } + /// + /// Test the property 'Baz' + /// + [Fact] + public void BazTest() + { + // TODO unit test for the property 'Baz' + } + + } + +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/ReturnTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/ReturnTests.cs new file mode 100644 index 00000000000..cc0784b9b06 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/ReturnTests.cs @@ -0,0 +1,71 @@ +/* + * 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 Xunit; + +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 Return + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ReturnTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Return + //private Return instance; + + public ReturnTests() + { + // TODO uncomment below to create an instance of Return + //instance = new Return(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Return + /// + [Fact] + public void ReturnInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" Return + //Assert.IsInstanceOfType (instance, "variable 'instance' is a Return"); + } + + + /// + /// Test the property '_Return' + /// + [Fact] + public void _ReturnTest() + { + // TODO unit test for the property '_Return' + } + + } + +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/SpecialModelNameTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/SpecialModelNameTests.cs new file mode 100644 index 00000000000..3c078f18a41 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/SpecialModelNameTests.cs @@ -0,0 +1,71 @@ +/* + * 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 Xunit; + +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 SpecialModelName + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class SpecialModelNameTests : IDisposable + { + // TODO uncomment below to declare an instance variable for SpecialModelName + //private SpecialModelName instance; + + public SpecialModelNameTests() + { + // TODO uncomment below to create an instance of SpecialModelName + //instance = new SpecialModelName(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of SpecialModelName + /// + [Fact] + public void SpecialModelNameInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" SpecialModelName + //Assert.IsInstanceOfType (instance, "variable 'instance' is a SpecialModelName"); + } + + + /// + /// Test the property 'SpecialPropertyName' + /// + [Fact] + public void SpecialPropertyNameTest() + { + // TODO unit test for the property 'SpecialPropertyName' + } + + } + +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/TagTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/TagTests.cs new file mode 100644 index 00000000000..f7249595357 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/TagTests.cs @@ -0,0 +1,79 @@ +/* + * 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 Xunit; + +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 Tag + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class TagTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Tag + //private Tag instance; + + public TagTests() + { + // TODO uncomment below to create an instance of Tag + //instance = new Tag(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Tag + /// + [Fact] + public void TagInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" Tag + //Assert.IsInstanceOfType (instance, "variable 'instance' is a Tag"); + } + + + /// + /// Test the property 'Id' + /// + [Fact] + public void IdTest() + { + // TODO unit test for the property 'Id' + } + /// + /// Test the property 'Name' + /// + [Fact] + public void NameTest() + { + // TODO unit test for the property 'Name' + } + + } + +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/TypeHolderDefaultTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/TypeHolderDefaultTests.cs new file mode 100644 index 00000000000..06a678c0ef2 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/TypeHolderDefaultTests.cs @@ -0,0 +1,103 @@ +/* + * 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 Xunit; + +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 TypeHolderDefault + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class TypeHolderDefaultTests : IDisposable + { + // TODO uncomment below to declare an instance variable for TypeHolderDefault + //private TypeHolderDefault instance; + + public TypeHolderDefaultTests() + { + // TODO uncomment below to create an instance of TypeHolderDefault + //instance = new TypeHolderDefault(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of TypeHolderDefault + /// + [Fact] + public void TypeHolderDefaultInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" TypeHolderDefault + //Assert.IsInstanceOfType (instance, "variable 'instance' is a TypeHolderDefault"); + } + + + /// + /// Test the property 'StringItem' + /// + [Fact] + public void StringItemTest() + { + // TODO unit test for the property 'StringItem' + } + /// + /// Test the property 'NumberItem' + /// + [Fact] + public void NumberItemTest() + { + // TODO unit test for the property 'NumberItem' + } + /// + /// Test the property 'IntegerItem' + /// + [Fact] + public void IntegerItemTest() + { + // TODO unit test for the property 'IntegerItem' + } + /// + /// Test the property 'BoolItem' + /// + [Fact] + public void BoolItemTest() + { + // TODO unit test for the property 'BoolItem' + } + /// + /// Test the property 'ArrayItem' + /// + [Fact] + public void ArrayItemTest() + { + // TODO unit test for the property 'ArrayItem' + } + + } + +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/TypeHolderExampleTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/TypeHolderExampleTests.cs new file mode 100644 index 00000000000..0b48fb2c73b --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/TypeHolderExampleTests.cs @@ -0,0 +1,103 @@ +/* + * 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 Xunit; + +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 TypeHolderExample + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class TypeHolderExampleTests : IDisposable + { + // TODO uncomment below to declare an instance variable for TypeHolderExample + //private TypeHolderExample instance; + + public TypeHolderExampleTests() + { + // TODO uncomment below to create an instance of TypeHolderExample + //instance = new TypeHolderExample(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of TypeHolderExample + /// + [Fact] + public void TypeHolderExampleInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" TypeHolderExample + //Assert.IsInstanceOfType (instance, "variable 'instance' is a TypeHolderExample"); + } + + + /// + /// Test the property 'StringItem' + /// + [Fact] + public void StringItemTest() + { + // TODO unit test for the property 'StringItem' + } + /// + /// Test the property 'NumberItem' + /// + [Fact] + public void NumberItemTest() + { + // TODO unit test for the property 'NumberItem' + } + /// + /// Test the property 'IntegerItem' + /// + [Fact] + public void IntegerItemTest() + { + // TODO unit test for the property 'IntegerItem' + } + /// + /// Test the property 'BoolItem' + /// + [Fact] + public void BoolItemTest() + { + // TODO unit test for the property 'BoolItem' + } + /// + /// Test the property 'ArrayItem' + /// + [Fact] + public void ArrayItemTest() + { + // TODO unit test for the property 'ArrayItem' + } + + } + +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/UserTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/UserTests.cs new file mode 100644 index 00000000000..9a86e5f0fae --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/UserTests.cs @@ -0,0 +1,127 @@ +/* + * 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 Xunit; + +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 User + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class UserTests : IDisposable + { + // TODO uncomment below to declare an instance variable for User + //private User instance; + + public UserTests() + { + // TODO uncomment below to create an instance of User + //instance = new User(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of User + /// + [Fact] + public void UserInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" User + //Assert.IsInstanceOfType (instance, "variable 'instance' is a User"); + } + + + /// + /// Test the property 'Id' + /// + [Fact] + public void IdTest() + { + // TODO unit test for the property 'Id' + } + /// + /// Test the property 'Username' + /// + [Fact] + public void UsernameTest() + { + // TODO unit test for the property 'Username' + } + /// + /// Test the property 'FirstName' + /// + [Fact] + public void FirstNameTest() + { + // TODO unit test for the property 'FirstName' + } + /// + /// Test the property 'LastName' + /// + [Fact] + public void LastNameTest() + { + // TODO unit test for the property 'LastName' + } + /// + /// Test the property 'Email' + /// + [Fact] + public void EmailTest() + { + // TODO unit test for the property 'Email' + } + /// + /// Test the property 'Password' + /// + [Fact] + public void PasswordTest() + { + // TODO unit test for the property 'Password' + } + /// + /// Test the property 'Phone' + /// + [Fact] + public void PhoneTest() + { + // TODO unit test for the property 'Phone' + } + /// + /// Test the property 'UserStatus' + /// + [Fact] + public void UserStatusTest() + { + // TODO unit test for the property 'UserStatus' + } + + } + +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/XmlItemTests.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/XmlItemTests.cs new file mode 100644 index 00000000000..2e14da3de26 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/XmlItemTests.cs @@ -0,0 +1,295 @@ +/* + * 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 Xunit; + +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 XmlItem + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class XmlItemTests : IDisposable + { + // TODO uncomment below to declare an instance variable for XmlItem + //private XmlItem instance; + + public XmlItemTests() + { + // TODO uncomment below to create an instance of XmlItem + //instance = new XmlItem(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of XmlItem + /// + [Fact] + public void XmlItemInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" XmlItem + //Assert.IsInstanceOfType (instance, "variable 'instance' is a XmlItem"); + } + + + /// + /// Test the property 'AttributeString' + /// + [Fact] + public void AttributeStringTest() + { + // TODO unit test for the property 'AttributeString' + } + /// + /// Test the property 'AttributeNumber' + /// + [Fact] + public void AttributeNumberTest() + { + // TODO unit test for the property 'AttributeNumber' + } + /// + /// Test the property 'AttributeInteger' + /// + [Fact] + public void AttributeIntegerTest() + { + // TODO unit test for the property 'AttributeInteger' + } + /// + /// Test the property 'AttributeBoolean' + /// + [Fact] + public void AttributeBooleanTest() + { + // TODO unit test for the property 'AttributeBoolean' + } + /// + /// Test the property 'WrappedArray' + /// + [Fact] + public void WrappedArrayTest() + { + // TODO unit test for the property 'WrappedArray' + } + /// + /// Test the property 'NameString' + /// + [Fact] + public void NameStringTest() + { + // TODO unit test for the property 'NameString' + } + /// + /// Test the property 'NameNumber' + /// + [Fact] + public void NameNumberTest() + { + // TODO unit test for the property 'NameNumber' + } + /// + /// Test the property 'NameInteger' + /// + [Fact] + public void NameIntegerTest() + { + // TODO unit test for the property 'NameInteger' + } + /// + /// Test the property 'NameBoolean' + /// + [Fact] + public void NameBooleanTest() + { + // TODO unit test for the property 'NameBoolean' + } + /// + /// Test the property 'NameArray' + /// + [Fact] + public void NameArrayTest() + { + // TODO unit test for the property 'NameArray' + } + /// + /// Test the property 'NameWrappedArray' + /// + [Fact] + public void NameWrappedArrayTest() + { + // TODO unit test for the property 'NameWrappedArray' + } + /// + /// Test the property 'PrefixString' + /// + [Fact] + public void PrefixStringTest() + { + // TODO unit test for the property 'PrefixString' + } + /// + /// Test the property 'PrefixNumber' + /// + [Fact] + public void PrefixNumberTest() + { + // TODO unit test for the property 'PrefixNumber' + } + /// + /// Test the property 'PrefixInteger' + /// + [Fact] + public void PrefixIntegerTest() + { + // TODO unit test for the property 'PrefixInteger' + } + /// + /// Test the property 'PrefixBoolean' + /// + [Fact] + public void PrefixBooleanTest() + { + // TODO unit test for the property 'PrefixBoolean' + } + /// + /// Test the property 'PrefixArray' + /// + [Fact] + public void PrefixArrayTest() + { + // TODO unit test for the property 'PrefixArray' + } + /// + /// Test the property 'PrefixWrappedArray' + /// + [Fact] + public void PrefixWrappedArrayTest() + { + // TODO unit test for the property 'PrefixWrappedArray' + } + /// + /// Test the property 'NamespaceString' + /// + [Fact] + public void NamespaceStringTest() + { + // TODO unit test for the property 'NamespaceString' + } + /// + /// Test the property 'NamespaceNumber' + /// + [Fact] + public void NamespaceNumberTest() + { + // TODO unit test for the property 'NamespaceNumber' + } + /// + /// Test the property 'NamespaceInteger' + /// + [Fact] + public void NamespaceIntegerTest() + { + // TODO unit test for the property 'NamespaceInteger' + } + /// + /// Test the property 'NamespaceBoolean' + /// + [Fact] + public void NamespaceBooleanTest() + { + // TODO unit test for the property 'NamespaceBoolean' + } + /// + /// Test the property 'NamespaceArray' + /// + [Fact] + public void NamespaceArrayTest() + { + // TODO unit test for the property 'NamespaceArray' + } + /// + /// Test the property 'NamespaceWrappedArray' + /// + [Fact] + public void NamespaceWrappedArrayTest() + { + // TODO unit test for the property 'NamespaceWrappedArray' + } + /// + /// Test the property 'PrefixNsString' + /// + [Fact] + public void PrefixNsStringTest() + { + // TODO unit test for the property 'PrefixNsString' + } + /// + /// Test the property 'PrefixNsNumber' + /// + [Fact] + public void PrefixNsNumberTest() + { + // TODO unit test for the property 'PrefixNsNumber' + } + /// + /// Test the property 'PrefixNsInteger' + /// + [Fact] + public void PrefixNsIntegerTest() + { + // TODO unit test for the property 'PrefixNsInteger' + } + /// + /// Test the property 'PrefixNsBoolean' + /// + [Fact] + public void PrefixNsBooleanTest() + { + // TODO unit test for the property 'PrefixNsBoolean' + } + /// + /// Test the property 'PrefixNsArray' + /// + [Fact] + public void PrefixNsArrayTest() + { + // TODO unit test for the property 'PrefixNsArray' + } + /// + /// Test the property 'PrefixNsWrappedArray' + /// + [Fact] + public void PrefixNsWrappedArrayTest() + { + // TODO unit test for the property 'PrefixNsWrappedArray' + } + + } + +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj new file mode 100644 index 00000000000..629d78c375f --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -0,0 +1,36 @@ + + + + + + netcoreapp2.0 + + false + + + + + Org.OpenAPITools + + + + + + + + + + + + + + + + diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/linux-logo.png b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/linux-logo.png new file mode 100644 index 00000000000..8269538b1ac Binary files /dev/null and b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools.Test/linux-logo.png differ diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs new file mode 100644 index 00000000000..10817d7dbac --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs @@ -0,0 +1,318 @@ +/* + * 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.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Net; +using System.Net.Mime; +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 IAnotherFakeApiSync : IApiAccessor + { + #region Synchronous Operations + /// + /// 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 Call123TestSpecialTags (ModelClient body); + + /// + /// 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 Call123TestSpecialTagsWithHttpInfo (ModelClient body); + #endregion Synchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IAnotherFakeApiAsync : IApiAccessor + { + #region Asynchronous Operations + /// + /// 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 Call123TestSpecialTagsAsync (ModelClient body); + + /// + /// 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> Call123TestSpecialTagsAsyncWithHttpInfo (ModelClient body); + #endregion Asynchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IAnotherFakeApi : IAnotherFakeApiSync, IAnotherFakeApiAsync + { + + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class AnotherFakeApi : IAnotherFakeApi + { + private Org.OpenAPITools.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + + /// + /// Initializes a new instance of the class. + /// + /// + public AnotherFakeApi() : this((string) null) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// + public AnotherFakeApi(String basePath) + { + this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( + Org.OpenAPITools.Client.GlobalConfiguration.Instance, + new Org.OpenAPITools.Client.Configuration { BasePath = basePath } + ); + this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using Configuration object + /// + /// An instance of Configuration + /// + public AnotherFakeApi(Org.OpenAPITools.Client.Configuration configuration) + { + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( + Org.OpenAPITools.Client.GlobalConfiguration.Instance, + configuration + ); + this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using a Configuration object and client instance. + /// + /// The client interface for synchronous API access. + /// The client interface for asynchronous API access. + /// The configuration object. + public AnotherFakeApi(Org.OpenAPITools.Client.ISynchronousClient client,Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration) + { + if(client == null) throw new ArgumentNullException("client"); + if(asyncClient == null) throw new ArgumentNullException("asyncClient"); + if(configuration == null) throw new ArgumentNullException("configuration"); + + this.Client = client; + this.AsynchronousClient = asyncClient; + this.Configuration = configuration; + this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// The client for accessing this underlying API asynchronously. + /// + public Org.OpenAPITools.Client.IAsynchronousClient AsynchronousClient { get; set; } + + /// + /// The client for accessing this underlying API synchronously. + /// + public Org.OpenAPITools.Client.ISynchronousClient Client { get; set; } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public String GetBasePath() + { + return this.Configuration.BasePath; + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Org.OpenAPITools.Client.IReadableConfiguration Configuration {get; set;} + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + + /// + /// 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 Call123TestSpecialTags (ModelClient body) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = Call123TestSpecialTagsWithHttpInfo(body); + return localVarResponse.Data; + } + + /// + /// 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 Org.OpenAPITools.Client.ApiResponse< ModelClient > Call123TestSpecialTagsWithHttpInfo (ModelClient body) + { + // verify the required parameter 'body' is set + if (body == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'body' when calling AnotherFakeApi->Call123TestSpecialTags"); + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + "application/json" + }; + + // to determine the Accept header + String[] @accepts = new String[] { + "application/json" + }; + + var localVarConentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(@contentTypes); + if (localVarConentType != null) requestOptions.HeaderParameters.Add("Content-Type", localVarConentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(@accepts); + if (localVarAccept != null) requestOptions.HeaderParameters.Add("Accept", localVarAccept); + + requestOptions.Data = body; + + + // make the HTTP request + + var response = this.Client.Patch< ModelClient >("/another-fake/dummy", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("Call123TestSpecialTags", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// 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 Call123TestSpecialTagsAsync (ModelClient body) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await Call123TestSpecialTagsAsyncWithHttpInfo(body); + return localVarResponse.Data; + + } + + /// + /// 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> Call123TestSpecialTagsAsyncWithHttpInfo (ModelClient body) + { + // verify the required parameter 'body' is set + if (body == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'body' when calling AnotherFakeApi->Call123TestSpecialTags"); + + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + "application/json" + }; + + // to determine the Accept header + String[] @accepts = new String[] { + "application/json" + }; + + foreach (var contentType in @contentTypes) + requestOptions.HeaderParameters.Add("Content-Type", contentType); + + foreach (var accept in @accepts) + requestOptions.HeaderParameters.Add("Accept", accept); + + requestOptions.Data = body; + + + // make the HTTP request + + var response = await this.AsynchronousClient.PatchAsync("/another-fake/dummy", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("Call123TestSpecialTags", response); + if (exception != null) throw exception; + } + + return response; + } + + } +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Api/FakeApi.cs new file mode 100644 index 00000000000..d45e4931b8f --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Api/FakeApi.cs @@ -0,0 +1,2758 @@ +/* + * 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.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Net; +using System.Net.Mime; +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 IFakeApiSync : IApiAccessor + { + #region Synchronous Operations + /// + /// creates an XmlItem + /// + /// + /// this route creates an XmlItem + /// + /// Thrown when fails to make API call + /// XmlItem Body + /// + void CreateXmlItem (XmlItem xmlItem); + + /// + /// creates an XmlItem + /// + /// + /// this route creates an XmlItem + /// + /// Thrown when fails to make API call + /// XmlItem Body + /// ApiResponse of Object(void) + ApiResponse CreateXmlItemWithHttpInfo (XmlItem xmlItem); + /// + /// + /// + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// bool + bool FakeOuterBooleanSerialize (bool? body = null); + + /// + /// + /// + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// ApiResponse of bool + ApiResponse FakeOuterBooleanSerializeWithHttpInfo (bool? body = null); + /// + /// + /// + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// OuterComposite + OuterComposite FakeOuterCompositeSerialize (OuterComposite body = null); + + /// + /// + /// + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// ApiResponse of OuterComposite + ApiResponse FakeOuterCompositeSerializeWithHttpInfo (OuterComposite body = null); + /// + /// + /// + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// decimal + decimal FakeOuterNumberSerialize (decimal? body = null); + + /// + /// + /// + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// ApiResponse of decimal + ApiResponse FakeOuterNumberSerializeWithHttpInfo (decimal? body = null); + /// + /// + /// + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Input string as post body (optional) + /// string + string FakeOuterStringSerialize (string body = null); + + /// + /// + /// + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Input string as post body (optional) + /// ApiResponse of string + ApiResponse FakeOuterStringSerializeWithHttpInfo (string body = null); + /// + /// + /// + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// + void TestBodyWithFileSchema (FileSchemaTestClass body); + + /// + /// + /// + /// + /// 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 body); + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// + void TestBodyWithQueryParams (string query, User body); + + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// ApiResponse of Object(void) + ApiResponse TestBodyWithQueryParamsWithHttpInfo (string query, User body); + /// + /// To test \"client\" model + /// + /// + /// To test \"client\" model + /// + /// Thrown when fails to make API call + /// client model + /// ModelClient + ModelClient TestClientModel (ModelClient body); + + /// + /// To test \"client\" model + /// + /// + /// To test \"client\" model + /// + /// Thrown when fails to make API call + /// client model + /// ApiResponse of ModelClient + ApiResponse TestClientModelWithHttpInfo (ModelClient body); + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Thrown when fails to make API call + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// + void TestEndpointParameters (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, string _string = null, System.IO.Stream binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null, string callback = null); + + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Thrown when fails to make API call + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// ApiResponse of Object(void) + ApiResponse TestEndpointParametersWithHttpInfo (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, string _string = null, System.IO.Stream binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null, string callback = null); + /// + /// To test enum parameters + /// + /// + /// To test enum parameters + /// + /// Thrown when fails to make API call + /// Header parameter enum test (string array) (optional) + /// Header parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (string array) (optional) + /// Query parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (double) (optional) + /// Form parameter enum test (string array) (optional, default to $) + /// Form parameter enum test (string) (optional, default to -efg) + /// + void TestEnumParameters (List enumHeaderStringArray = null, string enumHeaderString = null, List enumQueryStringArray = null, string enumQueryString = null, int? enumQueryInteger = null, double? enumQueryDouble = null, List enumFormStringArray = null, string enumFormString = null); + + /// + /// To test enum parameters + /// + /// + /// To test enum parameters + /// + /// Thrown when fails to make API call + /// Header parameter enum test (string array) (optional) + /// Header parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (string array) (optional) + /// Query parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (double) (optional) + /// Form parameter enum test (string array) (optional, default to $) + /// Form parameter enum test (string) (optional, default to -efg) + /// ApiResponse of Object(void) + ApiResponse TestEnumParametersWithHttpInfo (List enumHeaderStringArray = null, string enumHeaderString = null, List enumQueryStringArray = null, string enumQueryString = null, int? enumQueryInteger = null, double? enumQueryDouble = null, List enumFormStringArray = null, string enumFormString = null); + /// + /// Fake endpoint to test group parameters (optional) + /// + /// + /// Fake endpoint to test group parameters (optional) + /// + /// Thrown when fails to make API call + /// Required String in group parameters + /// Required Boolean in group parameters + /// Required Integer in group parameters + /// String in group parameters (optional) + /// Boolean in group parameters (optional) + /// Integer in group parameters (optional) + /// + void TestGroupParameters (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = null, bool? booleanGroup = null, long? int64Group = null); + + /// + /// Fake endpoint to test group parameters (optional) + /// + /// + /// Fake endpoint to test group parameters (optional) + /// + /// Thrown when fails to make API call + /// Required String in group parameters + /// Required Boolean in group parameters + /// Required Integer in group parameters + /// String in group parameters (optional) + /// Boolean in group parameters (optional) + /// Integer in group parameters (optional) + /// ApiResponse of Object(void) + ApiResponse TestGroupParametersWithHttpInfo (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = null, bool? booleanGroup = null, long? int64Group = null); + /// + /// test inline additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// + void TestInlineAdditionalProperties (Dictionary param); + + /// + /// test inline additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// ApiResponse of Object(void) + ApiResponse TestInlineAdditionalPropertiesWithHttpInfo (Dictionary param); + /// + /// test json serialization of form data + /// + /// + /// + /// + /// Thrown when fails to make API call + /// field1 + /// field2 + /// + void TestJsonFormData (string param, string param2); + + /// + /// test json serialization of form data + /// + /// + /// + /// + /// Thrown when fails to make API call + /// field1 + /// field2 + /// ApiResponse of Object(void) + ApiResponse TestJsonFormDataWithHttpInfo (string param, string param2); + #endregion Synchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IFakeApiAsync : IApiAccessor + { + #region Asynchronous Operations + /// + /// creates an XmlItem + /// + /// + /// this route creates an XmlItem + /// + /// Thrown when fails to make API call + /// XmlItem Body + /// Task of void + System.Threading.Tasks.Task CreateXmlItemAsync (XmlItem xmlItem); + + /// + /// creates an XmlItem + /// + /// + /// this route creates an XmlItem + /// + /// Thrown when fails to make API call + /// XmlItem Body + /// Task of ApiResponse + System.Threading.Tasks.Task> CreateXmlItemAsyncWithHttpInfo (XmlItem xmlItem); + /// + /// + /// + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// Task of bool + System.Threading.Tasks.Task FakeOuterBooleanSerializeAsync (bool? body = null); + + /// + /// + /// + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// Task of ApiResponse (bool) + System.Threading.Tasks.Task> FakeOuterBooleanSerializeAsyncWithHttpInfo (bool? body = null); + /// + /// + /// + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// Task of OuterComposite + System.Threading.Tasks.Task FakeOuterCompositeSerializeAsync (OuterComposite body = null); + + /// + /// + /// + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// Task of ApiResponse (OuterComposite) + System.Threading.Tasks.Task> FakeOuterCompositeSerializeAsyncWithHttpInfo (OuterComposite body = null); + /// + /// + /// + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// Task of decimal + System.Threading.Tasks.Task FakeOuterNumberSerializeAsync (decimal? body = null); + + /// + /// + /// + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// Task of ApiResponse (decimal) + System.Threading.Tasks.Task> FakeOuterNumberSerializeAsyncWithHttpInfo (decimal? body = null); + /// + /// + /// + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Input string as post body (optional) + /// Task of string + System.Threading.Tasks.Task FakeOuterStringSerializeAsync (string body = null); + + /// + /// + /// + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Input string as post body (optional) + /// Task of ApiResponse (string) + System.Threading.Tasks.Task> FakeOuterStringSerializeAsyncWithHttpInfo (string body = 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 + System.Threading.Tasks.Task TestBodyWithFileSchemaAsync (FileSchemaTestClass body); + + /// + /// + /// + /// + /// 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 body); + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// Task of void + System.Threading.Tasks.Task TestBodyWithQueryParamsAsync (string query, User body); + + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// Task of ApiResponse + System.Threading.Tasks.Task> TestBodyWithQueryParamsAsyncWithHttpInfo (string query, User body); + /// + /// To test \"client\" model + /// + /// + /// To test \"client\" model + /// + /// Thrown when fails to make API call + /// client model + /// Task of ModelClient + System.Threading.Tasks.Task TestClientModelAsync (ModelClient body); + + /// + /// To test \"client\" model + /// + /// + /// To test \"client\" model + /// + /// Thrown when fails to make API call + /// client model + /// Task of ApiResponse (ModelClient) + System.Threading.Tasks.Task> TestClientModelAsyncWithHttpInfo (ModelClient body); + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Thrown when fails to make API call + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// Task of void + System.Threading.Tasks.Task TestEndpointParametersAsync (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, string _string = null, System.IO.Stream binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null, string callback = null); + + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Thrown when fails to make API call + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// Task of ApiResponse + System.Threading.Tasks.Task> TestEndpointParametersAsyncWithHttpInfo (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, string _string = null, System.IO.Stream binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null, string callback = null); + /// + /// To test enum parameters + /// + /// + /// To test enum parameters + /// + /// Thrown when fails to make API call + /// Header parameter enum test (string array) (optional) + /// Header parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (string array) (optional) + /// Query parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (double) (optional) + /// Form parameter enum test (string array) (optional, default to $) + /// Form parameter enum test (string) (optional, default to -efg) + /// Task of void + System.Threading.Tasks.Task TestEnumParametersAsync (List enumHeaderStringArray = null, string enumHeaderString = null, List enumQueryStringArray = null, string enumQueryString = null, int? enumQueryInteger = null, double? enumQueryDouble = null, List enumFormStringArray = null, string enumFormString = null); + + /// + /// To test enum parameters + /// + /// + /// To test enum parameters + /// + /// Thrown when fails to make API call + /// Header parameter enum test (string array) (optional) + /// Header parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (string array) (optional) + /// Query parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (double) (optional) + /// Form parameter enum test (string array) (optional, default to $) + /// Form parameter enum test (string) (optional, default to -efg) + /// Task of ApiResponse + System.Threading.Tasks.Task> TestEnumParametersAsyncWithHttpInfo (List enumHeaderStringArray = null, string enumHeaderString = null, List enumQueryStringArray = null, string enumQueryString = null, int? enumQueryInteger = null, double? enumQueryDouble = null, List enumFormStringArray = null, string enumFormString = null); + /// + /// Fake endpoint to test group parameters (optional) + /// + /// + /// Fake endpoint to test group parameters (optional) + /// + /// Thrown when fails to make API call + /// Required String in group parameters + /// Required Boolean in group parameters + /// Required Integer in group parameters + /// String in group parameters (optional) + /// Boolean in group parameters (optional) + /// Integer in group parameters (optional) + /// Task of void + System.Threading.Tasks.Task TestGroupParametersAsync (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = null, bool? booleanGroup = null, long? int64Group = null); + + /// + /// Fake endpoint to test group parameters (optional) + /// + /// + /// Fake endpoint to test group parameters (optional) + /// + /// Thrown when fails to make API call + /// Required String in group parameters + /// Required Boolean in group parameters + /// Required Integer in group parameters + /// String in group parameters (optional) + /// Boolean in group parameters (optional) + /// Integer in group parameters (optional) + /// Task of ApiResponse + System.Threading.Tasks.Task> TestGroupParametersAsyncWithHttpInfo (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = null, bool? booleanGroup = null, long? int64Group = null); + /// + /// test inline additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Task of void + System.Threading.Tasks.Task TestInlineAdditionalPropertiesAsync (Dictionary param); + + /// + /// test inline additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Task of ApiResponse + System.Threading.Tasks.Task> TestInlineAdditionalPropertiesAsyncWithHttpInfo (Dictionary param); + /// + /// test json serialization of form data + /// + /// + /// + /// + /// Thrown when fails to make API call + /// field1 + /// field2 + /// Task of void + System.Threading.Tasks.Task TestJsonFormDataAsync (string param, string param2); + + /// + /// test json serialization of form data + /// + /// + /// + /// + /// Thrown when fails to make API call + /// field1 + /// field2 + /// Task of ApiResponse + System.Threading.Tasks.Task> TestJsonFormDataAsyncWithHttpInfo (string param, string param2); + #endregion Asynchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IFakeApi : IFakeApiSync, IFakeApiAsync + { + + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class FakeApi : IFakeApi + { + private Org.OpenAPITools.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + + /// + /// Initializes a new instance of the class. + /// + /// + public FakeApi() : this((string) null) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// + public FakeApi(String basePath) + { + this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( + Org.OpenAPITools.Client.GlobalConfiguration.Instance, + new Org.OpenAPITools.Client.Configuration { BasePath = basePath } + ); + this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using Configuration object + /// + /// An instance of Configuration + /// + public FakeApi(Org.OpenAPITools.Client.Configuration configuration) + { + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( + Org.OpenAPITools.Client.GlobalConfiguration.Instance, + configuration + ); + this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using a Configuration object and client instance. + /// + /// The client interface for synchronous API access. + /// The client interface for asynchronous API access. + /// The configuration object. + public FakeApi(Org.OpenAPITools.Client.ISynchronousClient client,Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration) + { + if(client == null) throw new ArgumentNullException("client"); + if(asyncClient == null) throw new ArgumentNullException("asyncClient"); + if(configuration == null) throw new ArgumentNullException("configuration"); + + this.Client = client; + this.AsynchronousClient = asyncClient; + this.Configuration = configuration; + this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// The client for accessing this underlying API asynchronously. + /// + public Org.OpenAPITools.Client.IAsynchronousClient AsynchronousClient { get; set; } + + /// + /// The client for accessing this underlying API synchronously. + /// + public Org.OpenAPITools.Client.ISynchronousClient Client { get; set; } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public String GetBasePath() + { + return this.Configuration.BasePath; + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Org.OpenAPITools.Client.IReadableConfiguration Configuration {get; set;} + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + + /// + /// creates an XmlItem this route creates an XmlItem + /// + /// Thrown when fails to make API call + /// XmlItem Body + /// + public void CreateXmlItem (XmlItem xmlItem) + { + CreateXmlItemWithHttpInfo(xmlItem); + } + + /// + /// creates an XmlItem this route creates an XmlItem + /// + /// Thrown when fails to make API call + /// XmlItem Body + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse CreateXmlItemWithHttpInfo (XmlItem xmlItem) + { + // verify the required parameter 'xmlItem' is set + if (xmlItem == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'xmlItem' when calling FakeApi->CreateXmlItem"); + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + "application/xml", + "application/xml; charset=utf-8", + "application/xml; charset=utf-16", + "text/xml", + "text/xml; charset=utf-8", + "text/xml; charset=utf-16" + }; + + // to determine the Accept header + String[] @accepts = new String[] { + }; + + var localVarConentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(@contentTypes); + if (localVarConentType != null) requestOptions.HeaderParameters.Add("Content-Type", localVarConentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(@accepts); + if (localVarAccept != null) requestOptions.HeaderParameters.Add("Accept", localVarAccept); + + requestOptions.Data = xmlItem; + + + // make the HTTP request + + var response = this.Client.Post("/fake/create_xml_item", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("CreateXmlItem", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// creates an XmlItem this route creates an XmlItem + /// + /// Thrown when fails to make API call + /// XmlItem Body + /// Task of void + public async System.Threading.Tasks.Task CreateXmlItemAsync (XmlItem xmlItem) + { + await CreateXmlItemAsyncWithHttpInfo(xmlItem); + + } + + /// + /// creates an XmlItem this route creates an XmlItem + /// + /// Thrown when fails to make API call + /// XmlItem Body + /// Task of ApiResponse + public async System.Threading.Tasks.Task> CreateXmlItemAsyncWithHttpInfo (XmlItem xmlItem) + { + // verify the required parameter 'xmlItem' is set + if (xmlItem == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'xmlItem' when calling FakeApi->CreateXmlItem"); + + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + "application/xml", + "application/xml; charset=utf-8", + "application/xml; charset=utf-16", + "text/xml", + "text/xml; charset=utf-8", + "text/xml; charset=utf-16" + }; + + // to determine the Accept header + String[] @accepts = new String[] { + }; + + foreach (var contentType in @contentTypes) + requestOptions.HeaderParameters.Add("Content-Type", contentType); + + foreach (var accept in @accepts) + requestOptions.HeaderParameters.Add("Accept", accept); + + requestOptions.Data = xmlItem; + + + // make the HTTP request + + var response = await this.AsynchronousClient.PostAsync("/fake/create_xml_item", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("CreateXmlItem", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// bool + public bool FakeOuterBooleanSerialize (bool? body = null) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = FakeOuterBooleanSerializeWithHttpInfo(body); + return localVarResponse.Data; + } + + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// ApiResponse of bool + public Org.OpenAPITools.Client.ApiResponse< bool > FakeOuterBooleanSerializeWithHttpInfo (bool? body = null) + { + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + }; + + // to determine the Accept header + String[] @accepts = new String[] { + "*/*" + }; + + var localVarConentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(@contentTypes); + if (localVarConentType != null) requestOptions.HeaderParameters.Add("Content-Type", localVarConentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(@accepts); + if (localVarAccept != null) requestOptions.HeaderParameters.Add("Accept", localVarAccept); + + requestOptions.Data = body; + + + // make the HTTP request + + var response = this.Client.Post< bool >("/fake/outer/boolean", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("FakeOuterBooleanSerialize", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// Task of bool + public async System.Threading.Tasks.Task FakeOuterBooleanSerializeAsync (bool? body = null) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await FakeOuterBooleanSerializeAsyncWithHttpInfo(body); + return localVarResponse.Data; + + } + + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// Task of ApiResponse (bool) + public async System.Threading.Tasks.Task> FakeOuterBooleanSerializeAsyncWithHttpInfo (bool? body = null) + { + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + }; + + // to determine the Accept header + String[] @accepts = new String[] { + "*/*" + }; + + foreach (var contentType in @contentTypes) + requestOptions.HeaderParameters.Add("Content-Type", contentType); + + foreach (var accept in @accepts) + requestOptions.HeaderParameters.Add("Accept", accept); + + requestOptions.Data = body; + + + // make the HTTP request + + var response = await this.AsynchronousClient.PostAsync("/fake/outer/boolean", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("FakeOuterBooleanSerialize", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// OuterComposite + public OuterComposite FakeOuterCompositeSerialize (OuterComposite body = null) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = FakeOuterCompositeSerializeWithHttpInfo(body); + return localVarResponse.Data; + } + + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// ApiResponse of OuterComposite + public Org.OpenAPITools.Client.ApiResponse< OuterComposite > FakeOuterCompositeSerializeWithHttpInfo (OuterComposite body = null) + { + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + }; + + // to determine the Accept header + String[] @accepts = new String[] { + "*/*" + }; + + var localVarConentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(@contentTypes); + if (localVarConentType != null) requestOptions.HeaderParameters.Add("Content-Type", localVarConentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(@accepts); + if (localVarAccept != null) requestOptions.HeaderParameters.Add("Accept", localVarAccept); + + requestOptions.Data = body; + + + // make the HTTP request + + var response = this.Client.Post< OuterComposite >("/fake/outer/composite", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("FakeOuterCompositeSerialize", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// Task of OuterComposite + public async System.Threading.Tasks.Task FakeOuterCompositeSerializeAsync (OuterComposite body = null) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await FakeOuterCompositeSerializeAsyncWithHttpInfo(body); + return localVarResponse.Data; + + } + + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// Task of ApiResponse (OuterComposite) + public async System.Threading.Tasks.Task> FakeOuterCompositeSerializeAsyncWithHttpInfo (OuterComposite body = null) + { + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + }; + + // to determine the Accept header + String[] @accepts = new String[] { + "*/*" + }; + + foreach (var contentType in @contentTypes) + requestOptions.HeaderParameters.Add("Content-Type", contentType); + + foreach (var accept in @accepts) + requestOptions.HeaderParameters.Add("Accept", accept); + + requestOptions.Data = body; + + + // make the HTTP request + + var response = await this.AsynchronousClient.PostAsync("/fake/outer/composite", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("FakeOuterCompositeSerialize", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// decimal + public decimal FakeOuterNumberSerialize (decimal? body = null) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = FakeOuterNumberSerializeWithHttpInfo(body); + return localVarResponse.Data; + } + + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// ApiResponse of decimal + public Org.OpenAPITools.Client.ApiResponse< decimal > FakeOuterNumberSerializeWithHttpInfo (decimal? body = null) + { + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + }; + + // to determine the Accept header + String[] @accepts = new String[] { + "*/*" + }; + + var localVarConentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(@contentTypes); + if (localVarConentType != null) requestOptions.HeaderParameters.Add("Content-Type", localVarConentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(@accepts); + if (localVarAccept != null) requestOptions.HeaderParameters.Add("Accept", localVarAccept); + + requestOptions.Data = body; + + + // make the HTTP request + + var response = this.Client.Post< decimal >("/fake/outer/number", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("FakeOuterNumberSerialize", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// Task of decimal + public async System.Threading.Tasks.Task FakeOuterNumberSerializeAsync (decimal? body = null) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await FakeOuterNumberSerializeAsyncWithHttpInfo(body); + return localVarResponse.Data; + + } + + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// Task of ApiResponse (decimal) + public async System.Threading.Tasks.Task> FakeOuterNumberSerializeAsyncWithHttpInfo (decimal? body = null) + { + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + }; + + // to determine the Accept header + String[] @accepts = new String[] { + "*/*" + }; + + foreach (var contentType in @contentTypes) + requestOptions.HeaderParameters.Add("Content-Type", contentType); + + foreach (var accept in @accepts) + requestOptions.HeaderParameters.Add("Accept", accept); + + requestOptions.Data = body; + + + // make the HTTP request + + var response = await this.AsynchronousClient.PostAsync("/fake/outer/number", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("FakeOuterNumberSerialize", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Input string as post body (optional) + /// string + public string FakeOuterStringSerialize (string body = null) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = FakeOuterStringSerializeWithHttpInfo(body); + return localVarResponse.Data; + } + + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Input string as post body (optional) + /// ApiResponse of string + public Org.OpenAPITools.Client.ApiResponse< string > FakeOuterStringSerializeWithHttpInfo (string body = null) + { + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + }; + + // to determine the Accept header + String[] @accepts = new String[] { + "*/*" + }; + + var localVarConentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(@contentTypes); + if (localVarConentType != null) requestOptions.HeaderParameters.Add("Content-Type", localVarConentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(@accepts); + if (localVarAccept != null) requestOptions.HeaderParameters.Add("Accept", localVarAccept); + + requestOptions.Data = body; + + + // make the HTTP request + + var response = this.Client.Post< string >("/fake/outer/string", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("FakeOuterStringSerialize", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Input string as post body (optional) + /// Task of string + public async System.Threading.Tasks.Task FakeOuterStringSerializeAsync (string body = null) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await FakeOuterStringSerializeAsyncWithHttpInfo(body); + return localVarResponse.Data; + + } + + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Input string as post body (optional) + /// Task of ApiResponse (string) + public async System.Threading.Tasks.Task> FakeOuterStringSerializeAsyncWithHttpInfo (string body = null) + { + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + }; + + // to determine the Accept header + String[] @accepts = new String[] { + "*/*" + }; + + foreach (var contentType in @contentTypes) + requestOptions.HeaderParameters.Add("Content-Type", contentType); + + foreach (var accept in @accepts) + requestOptions.HeaderParameters.Add("Accept", accept); + + requestOptions.Data = body; + + + // make the HTTP request + + var response = await this.AsynchronousClient.PostAsync("/fake/outer/string", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("FakeOuterStringSerialize", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// 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 body) + { + TestBodyWithFileSchemaWithHttpInfo(body); + } + + /// + /// 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 Org.OpenAPITools.Client.ApiResponse TestBodyWithFileSchemaWithHttpInfo (FileSchemaTestClass body) + { + // verify the required parameter 'body' is set + if (body == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'body' when calling FakeApi->TestBodyWithFileSchema"); + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + "application/json" + }; + + // to determine the Accept header + String[] @accepts = new String[] { + }; + + var localVarConentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(@contentTypes); + if (localVarConentType != null) requestOptions.HeaderParameters.Add("Content-Type", localVarConentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(@accepts); + if (localVarAccept != null) requestOptions.HeaderParameters.Add("Accept", localVarAccept); + + requestOptions.Data = body; + + + // make the HTTP request + + var response = this.Client.Put("/fake/body-with-file-schema", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("TestBodyWithFileSchema", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// 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 body) + { + await TestBodyWithFileSchemaAsyncWithHttpInfo(body); + + } + + /// + /// 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 body) + { + // verify the required parameter 'body' is set + if (body == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'body' when calling FakeApi->TestBodyWithFileSchema"); + + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + "application/json" + }; + + // to determine the Accept header + String[] @accepts = new String[] { + }; + + foreach (var contentType in @contentTypes) + requestOptions.HeaderParameters.Add("Content-Type", contentType); + + foreach (var accept in @accepts) + requestOptions.HeaderParameters.Add("Accept", accept); + + requestOptions.Data = body; + + + // make the HTTP request + + var response = await this.AsynchronousClient.PutAsync("/fake/body-with-file-schema", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("TestBodyWithFileSchema", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// + public void TestBodyWithQueryParams (string query, User body) + { + TestBodyWithQueryParamsWithHttpInfo(query, body); + } + + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse TestBodyWithQueryParamsWithHttpInfo (string query, User body) + { + // verify the required parameter 'query' is set + if (query == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'query' when calling FakeApi->TestBodyWithQueryParams"); + + // verify the required parameter 'body' is set + if (body == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'body' when calling FakeApi->TestBodyWithQueryParams"); + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + "application/json" + }; + + // to determine the Accept header + String[] @accepts = new String[] { + }; + + var localVarConentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(@contentTypes); + if (localVarConentType != null) requestOptions.HeaderParameters.Add("Content-Type", localVarConentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(@accepts); + if (localVarAccept != null) requestOptions.HeaderParameters.Add("Accept", localVarAccept); + + if (query != null) + { + foreach (var kvp in Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "query", query)) + { + foreach (var value in kvp.Value) + { + requestOptions.QueryParameters.Add(kvp.Key, value); + } + } + } + requestOptions.Data = body; + + + // make the HTTP request + + var response = this.Client.Put("/fake/body-with-query-params", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("TestBodyWithQueryParams", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// Task of void + public async System.Threading.Tasks.Task TestBodyWithQueryParamsAsync (string query, User body) + { + await TestBodyWithQueryParamsAsyncWithHttpInfo(query, body); + + } + + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// Task of ApiResponse + public async System.Threading.Tasks.Task> TestBodyWithQueryParamsAsyncWithHttpInfo (string query, User body) + { + // verify the required parameter 'query' is set + if (query == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'query' when calling FakeApi->TestBodyWithQueryParams"); + + // verify the required parameter 'body' is set + if (body == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'body' when calling FakeApi->TestBodyWithQueryParams"); + + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + "application/json" + }; + + // to determine the Accept header + String[] @accepts = new String[] { + }; + + foreach (var contentType in @contentTypes) + requestOptions.HeaderParameters.Add("Content-Type", contentType); + + foreach (var accept in @accepts) + requestOptions.HeaderParameters.Add("Accept", accept); + + if (query != null) + { + foreach (var kvp in Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "query", query)) + { + foreach (var value in kvp.Value) + { + requestOptions.QueryParameters.Add(kvp.Key, value); + } + } + } + requestOptions.Data = body; + + + // make the HTTP request + + var response = await this.AsynchronousClient.PutAsync("/fake/body-with-query-params", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("TestBodyWithQueryParams", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// To test \"client\" model To test \"client\" model + /// + /// Thrown when fails to make API call + /// client model + /// ModelClient + public ModelClient TestClientModel (ModelClient body) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = TestClientModelWithHttpInfo(body); + return localVarResponse.Data; + } + + /// + /// To test \"client\" model To test \"client\" model + /// + /// Thrown when fails to make API call + /// client model + /// ApiResponse of ModelClient + public Org.OpenAPITools.Client.ApiResponse< ModelClient > TestClientModelWithHttpInfo (ModelClient body) + { + // verify the required parameter 'body' is set + if (body == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'body' when calling FakeApi->TestClientModel"); + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + "application/json" + }; + + // to determine the Accept header + String[] @accepts = new String[] { + "application/json" + }; + + var localVarConentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(@contentTypes); + if (localVarConentType != null) requestOptions.HeaderParameters.Add("Content-Type", localVarConentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(@accepts); + if (localVarAccept != null) requestOptions.HeaderParameters.Add("Accept", localVarAccept); + + requestOptions.Data = body; + + + // make the HTTP request + + var response = this.Client.Patch< ModelClient >("/fake", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("TestClientModel", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// To test \"client\" model To test \"client\" model + /// + /// Thrown when fails to make API call + /// client model + /// Task of ModelClient + public async System.Threading.Tasks.Task TestClientModelAsync (ModelClient body) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await TestClientModelAsyncWithHttpInfo(body); + return localVarResponse.Data; + + } + + /// + /// To test \"client\" model To test \"client\" model + /// + /// Thrown when fails to make API call + /// client model + /// Task of ApiResponse (ModelClient) + public async System.Threading.Tasks.Task> TestClientModelAsyncWithHttpInfo (ModelClient body) + { + // verify the required parameter 'body' is set + if (body == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'body' when calling FakeApi->TestClientModel"); + + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + "application/json" + }; + + // to determine the Accept header + String[] @accepts = new String[] { + "application/json" + }; + + foreach (var contentType in @contentTypes) + requestOptions.HeaderParameters.Add("Content-Type", contentType); + + foreach (var accept in @accepts) + requestOptions.HeaderParameters.Add("Accept", accept); + + requestOptions.Data = body; + + + // make the HTTP request + + var response = await this.AsynchronousClient.PatchAsync("/fake", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("TestClientModel", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Thrown when fails to make API call + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// + public void TestEndpointParameters (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, string _string = null, System.IO.Stream binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null, string callback = null) + { + TestEndpointParametersWithHttpInfo(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, _string, binary, date, dateTime, password, callback); + } + + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Thrown when fails to make API call + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse TestEndpointParametersWithHttpInfo (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, string _string = null, System.IO.Stream binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null, string callback = null) + { + // verify the required parameter 'number' is set + if (number == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'number' when calling FakeApi->TestEndpointParameters"); + + // verify the required parameter '_double' is set + if (_double == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter '_double' when calling FakeApi->TestEndpointParameters"); + + // verify the required parameter 'patternWithoutDelimiter' is set + if (patternWithoutDelimiter == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'patternWithoutDelimiter' when calling FakeApi->TestEndpointParameters"); + + // verify the required parameter '_byte' is set + if (_byte == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter '_byte' when calling FakeApi->TestEndpointParameters"); + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + "application/x-www-form-urlencoded" + }; + + // to determine the Accept header + String[] @accepts = new String[] { + }; + + var localVarConentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(@contentTypes); + if (localVarConentType != null) requestOptions.HeaderParameters.Add("Content-Type", localVarConentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(@accepts); + if (localVarAccept != null) requestOptions.HeaderParameters.Add("Accept", localVarAccept); + + if (integer != null) + { + requestOptions.FormParameters.Add("integer", Org.OpenAPITools.Client.ClientUtils.ParameterToString(integer)); // form parameter + } + if (int32 != null) + { + requestOptions.FormParameters.Add("int32", Org.OpenAPITools.Client.ClientUtils.ParameterToString(int32)); // form parameter + } + if (int64 != null) + { + requestOptions.FormParameters.Add("int64", Org.OpenAPITools.Client.ClientUtils.ParameterToString(int64)); // form parameter + } + if (number != null) + { + requestOptions.FormParameters.Add("number", Org.OpenAPITools.Client.ClientUtils.ParameterToString(number)); // form parameter + } + if (_float != null) + { + requestOptions.FormParameters.Add("float", Org.OpenAPITools.Client.ClientUtils.ParameterToString(_float)); // form parameter + } + if (_double != null) + { + requestOptions.FormParameters.Add("double", Org.OpenAPITools.Client.ClientUtils.ParameterToString(_double)); // form parameter + } + if (_string != null) + { + requestOptions.FormParameters.Add("string", Org.OpenAPITools.Client.ClientUtils.ParameterToString(_string)); // form parameter + } + if (patternWithoutDelimiter != null) + { + requestOptions.FormParameters.Add("pattern_without_delimiter", Org.OpenAPITools.Client.ClientUtils.ParameterToString(patternWithoutDelimiter)); // form parameter + } + if (_byte != null) + { + requestOptions.FormParameters.Add("byte", Org.OpenAPITools.Client.ClientUtils.ParameterToString(_byte)); // form parameter + } + if (binary != null) + { + requestOptions.FileParameters.Add("binary", binary); + } + if (date != null) + { + requestOptions.FormParameters.Add("date", Org.OpenAPITools.Client.ClientUtils.ParameterToString(date)); // form parameter + } + if (dateTime != null) + { + requestOptions.FormParameters.Add("dateTime", Org.OpenAPITools.Client.ClientUtils.ParameterToString(dateTime)); // form parameter + } + if (password != null) + { + requestOptions.FormParameters.Add("password", Org.OpenAPITools.Client.ClientUtils.ParameterToString(password)); // form parameter + } + if (callback != null) + { + requestOptions.FormParameters.Add("callback", Org.OpenAPITools.Client.ClientUtils.ParameterToString(callback)); // form parameter + } + + // authentication (http_basic_test) required + // http basic authentication required + if (!String.IsNullOrEmpty(this.Configuration.Username) || !String.IsNullOrEmpty(this.Configuration.Password)) + { + requestOptions.HeaderParameters.Add("Authorization", "Basic " + Org.OpenAPITools.Client.ClientUtils.Base64Encode(this.Configuration.Username + ":" + this.Configuration.Password)); + } + + // make the HTTP request + + var response = this.Client.Post("/fake", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("TestEndpointParameters", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Thrown when fails to make API call + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// Task of void + public async System.Threading.Tasks.Task TestEndpointParametersAsync (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, string _string = null, System.IO.Stream binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null, string callback = null) + { + await TestEndpointParametersAsyncWithHttpInfo(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, _string, binary, date, dateTime, password, callback); + + } + + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Thrown when fails to make API call + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// Task of ApiResponse + public async System.Threading.Tasks.Task> TestEndpointParametersAsyncWithHttpInfo (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, string _string = null, System.IO.Stream binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null, string callback = null) + { + // verify the required parameter 'number' is set + if (number == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'number' when calling FakeApi->TestEndpointParameters"); + + // verify the required parameter '_double' is set + if (_double == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter '_double' when calling FakeApi->TestEndpointParameters"); + + // verify the required parameter 'patternWithoutDelimiter' is set + if (patternWithoutDelimiter == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'patternWithoutDelimiter' when calling FakeApi->TestEndpointParameters"); + + // verify the required parameter '_byte' is set + if (_byte == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter '_byte' when calling FakeApi->TestEndpointParameters"); + + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + "application/x-www-form-urlencoded" + }; + + // to determine the Accept header + String[] @accepts = new String[] { + }; + + foreach (var contentType in @contentTypes) + requestOptions.HeaderParameters.Add("Content-Type", contentType); + + foreach (var accept in @accepts) + requestOptions.HeaderParameters.Add("Accept", accept); + + if (integer != null) + { + requestOptions.FormParameters.Add("integer", Org.OpenAPITools.Client.ClientUtils.ParameterToString(integer)); // form parameter + } + if (int32 != null) + { + requestOptions.FormParameters.Add("int32", Org.OpenAPITools.Client.ClientUtils.ParameterToString(int32)); // form parameter + } + if (int64 != null) + { + requestOptions.FormParameters.Add("int64", Org.OpenAPITools.Client.ClientUtils.ParameterToString(int64)); // form parameter + } + if (number != null) + { + requestOptions.FormParameters.Add("number", Org.OpenAPITools.Client.ClientUtils.ParameterToString(number)); // form parameter + } + if (_float != null) + { + requestOptions.FormParameters.Add("float", Org.OpenAPITools.Client.ClientUtils.ParameterToString(_float)); // form parameter + } + if (_double != null) + { + requestOptions.FormParameters.Add("double", Org.OpenAPITools.Client.ClientUtils.ParameterToString(_double)); // form parameter + } + if (_string != null) + { + requestOptions.FormParameters.Add("string", Org.OpenAPITools.Client.ClientUtils.ParameterToString(_string)); // form parameter + } + if (patternWithoutDelimiter != null) + { + requestOptions.FormParameters.Add("pattern_without_delimiter", Org.OpenAPITools.Client.ClientUtils.ParameterToString(patternWithoutDelimiter)); // form parameter + } + if (_byte != null) + { + requestOptions.FormParameters.Add("byte", Org.OpenAPITools.Client.ClientUtils.ParameterToString(_byte)); // form parameter + } + if (binary != null) + { + requestOptions.FileParameters.Add("binary", binary); + } + if (date != null) + { + requestOptions.FormParameters.Add("date", Org.OpenAPITools.Client.ClientUtils.ParameterToString(date)); // form parameter + } + if (dateTime != null) + { + requestOptions.FormParameters.Add("dateTime", Org.OpenAPITools.Client.ClientUtils.ParameterToString(dateTime)); // form parameter + } + if (password != null) + { + requestOptions.FormParameters.Add("password", Org.OpenAPITools.Client.ClientUtils.ParameterToString(password)); // form parameter + } + if (callback != null) + { + requestOptions.FormParameters.Add("callback", Org.OpenAPITools.Client.ClientUtils.ParameterToString(callback)); // form parameter + } + + // authentication (http_basic_test) required + // http basic authentication required + if (!String.IsNullOrEmpty(this.Configuration.Username) || !String.IsNullOrEmpty(this.Configuration.Password)) + { + requestOptions.HeaderParameters.Add("Authorization", "Basic " + Org.OpenAPITools.Client.ClientUtils.Base64Encode(this.Configuration.Username + ":" + this.Configuration.Password)); + } + + // make the HTTP request + + var response = await this.AsynchronousClient.PostAsync("/fake", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("TestEndpointParameters", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// To test enum parameters To test enum parameters + /// + /// Thrown when fails to make API call + /// Header parameter enum test (string array) (optional) + /// Header parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (string array) (optional) + /// Query parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (double) (optional) + /// Form parameter enum test (string array) (optional, default to $) + /// Form parameter enum test (string) (optional, default to -efg) + /// + public void TestEnumParameters (List enumHeaderStringArray = null, string enumHeaderString = null, List enumQueryStringArray = null, string enumQueryString = null, int? enumQueryInteger = null, double? enumQueryDouble = null, List enumFormStringArray = null, string enumFormString = null) + { + TestEnumParametersWithHttpInfo(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + } + + /// + /// To test enum parameters To test enum parameters + /// + /// Thrown when fails to make API call + /// Header parameter enum test (string array) (optional) + /// Header parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (string array) (optional) + /// Query parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (double) (optional) + /// Form parameter enum test (string array) (optional, default to $) + /// Form parameter enum test (string) (optional, default to -efg) + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse TestEnumParametersWithHttpInfo (List enumHeaderStringArray = null, string enumHeaderString = null, List enumQueryStringArray = null, string enumQueryString = null, int? enumQueryInteger = null, double? enumQueryDouble = null, List enumFormStringArray = null, string enumFormString = null) + { + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + "application/x-www-form-urlencoded" + }; + + // to determine the Accept header + String[] @accepts = new String[] { + }; + + var localVarConentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(@contentTypes); + if (localVarConentType != null) requestOptions.HeaderParameters.Add("Content-Type", localVarConentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(@accepts); + if (localVarAccept != null) requestOptions.HeaderParameters.Add("Accept", localVarAccept); + + if (enumQueryStringArray != null) + { + foreach (var kvp in Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "enum_query_string_array", enumQueryStringArray)) + { + foreach (var value in kvp.Value) + { + requestOptions.QueryParameters.Add(kvp.Key, value); + } + } + } + if (enumQueryString != null) + { + foreach (var kvp in Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "enum_query_string", enumQueryString)) + { + foreach (var value in kvp.Value) + { + requestOptions.QueryParameters.Add(kvp.Key, value); + } + } + } + if (enumQueryInteger != null) + { + foreach (var kvp in Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "enum_query_integer", enumQueryInteger)) + { + foreach (var value in kvp.Value) + { + requestOptions.QueryParameters.Add(kvp.Key, value); + } + } + } + if (enumQueryDouble != null) + { + foreach (var kvp in Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "enum_query_double", enumQueryDouble)) + { + foreach (var value in kvp.Value) + { + requestOptions.QueryParameters.Add(kvp.Key, value); + } + } + } + if (enumHeaderStringArray != null) + requestOptions.HeaderParameters.Add("enum_header_string_array", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumHeaderStringArray)); // header parameter + if (enumHeaderString != null) + requestOptions.HeaderParameters.Add("enum_header_string", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumHeaderString)); // header parameter + if (enumFormStringArray != null) + { + requestOptions.FormParameters.Add("enum_form_string_array", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumFormStringArray)); // form parameter + } + if (enumFormString != null) + { + requestOptions.FormParameters.Add("enum_form_string", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumFormString)); // form parameter + } + + + // make the HTTP request + + var response = this.Client.Get("/fake", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("TestEnumParameters", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// To test enum parameters To test enum parameters + /// + /// Thrown when fails to make API call + /// Header parameter enum test (string array) (optional) + /// Header parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (string array) (optional) + /// Query parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (double) (optional) + /// Form parameter enum test (string array) (optional, default to $) + /// Form parameter enum test (string) (optional, default to -efg) + /// Task of void + public async System.Threading.Tasks.Task TestEnumParametersAsync (List enumHeaderStringArray = null, string enumHeaderString = null, List enumQueryStringArray = null, string enumQueryString = null, int? enumQueryInteger = null, double? enumQueryDouble = null, List enumFormStringArray = null, string enumFormString = null) + { + await TestEnumParametersAsyncWithHttpInfo(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + + } + + /// + /// To test enum parameters To test enum parameters + /// + /// Thrown when fails to make API call + /// Header parameter enum test (string array) (optional) + /// Header parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (string array) (optional) + /// Query parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (double) (optional) + /// Form parameter enum test (string array) (optional, default to $) + /// Form parameter enum test (string) (optional, default to -efg) + /// Task of ApiResponse + public async System.Threading.Tasks.Task> TestEnumParametersAsyncWithHttpInfo (List enumHeaderStringArray = null, string enumHeaderString = null, List enumQueryStringArray = null, string enumQueryString = null, int? enumQueryInteger = null, double? enumQueryDouble = null, List enumFormStringArray = null, string enumFormString = null) + { + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + "application/x-www-form-urlencoded" + }; + + // to determine the Accept header + String[] @accepts = new String[] { + }; + + foreach (var contentType in @contentTypes) + requestOptions.HeaderParameters.Add("Content-Type", contentType); + + foreach (var accept in @accepts) + requestOptions.HeaderParameters.Add("Accept", accept); + + if (enumQueryStringArray != null) + { + foreach (var kvp in Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "enum_query_string_array", enumQueryStringArray)) + { + foreach (var value in kvp.Value) + { + requestOptions.QueryParameters.Add(kvp.Key, value); + } + } + } + if (enumQueryString != null) + { + foreach (var kvp in Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "enum_query_string", enumQueryString)) + { + foreach (var value in kvp.Value) + { + requestOptions.QueryParameters.Add(kvp.Key, value); + } + } + } + if (enumQueryInteger != null) + { + foreach (var kvp in Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "enum_query_integer", enumQueryInteger)) + { + foreach (var value in kvp.Value) + { + requestOptions.QueryParameters.Add(kvp.Key, value); + } + } + } + if (enumQueryDouble != null) + { + foreach (var kvp in Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "enum_query_double", enumQueryDouble)) + { + foreach (var value in kvp.Value) + { + requestOptions.QueryParameters.Add(kvp.Key, value); + } + } + } + if (enumHeaderStringArray != null) + requestOptions.HeaderParameters.Add("enum_header_string_array", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumHeaderStringArray)); // header parameter + if (enumHeaderString != null) + requestOptions.HeaderParameters.Add("enum_header_string", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumHeaderString)); // header parameter + if (enumFormStringArray != null) + { + requestOptions.FormParameters.Add("enum_form_string_array", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumFormStringArray)); // form parameter + } + if (enumFormString != null) + { + requestOptions.FormParameters.Add("enum_form_string", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumFormString)); // form parameter + } + + + // make the HTTP request + + var response = await this.AsynchronousClient.GetAsync("/fake", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("TestEnumParameters", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// Fake endpoint to test group parameters (optional) Fake endpoint to test group parameters (optional) + /// + /// Thrown when fails to make API call + /// Required String in group parameters + /// Required Boolean in group parameters + /// Required Integer in group parameters + /// String in group parameters (optional) + /// Boolean in group parameters (optional) + /// Integer in group parameters (optional) + /// + public void TestGroupParameters (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = null, bool? booleanGroup = null, long? int64Group = null) + { + TestGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + } + + /// + /// Fake endpoint to test group parameters (optional) Fake endpoint to test group parameters (optional) + /// + /// Thrown when fails to make API call + /// Required String in group parameters + /// Required Boolean in group parameters + /// Required Integer in group parameters + /// String in group parameters (optional) + /// Boolean in group parameters (optional) + /// Integer in group parameters (optional) + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse TestGroupParametersWithHttpInfo (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = null, bool? booleanGroup = null, long? int64Group = null) + { + // verify the required parameter 'requiredStringGroup' is set + if (requiredStringGroup == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredStringGroup' when calling FakeApi->TestGroupParameters"); + + // verify the required parameter 'requiredBooleanGroup' is set + if (requiredBooleanGroup == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredBooleanGroup' when calling FakeApi->TestGroupParameters"); + + // verify the required parameter 'requiredInt64Group' is set + if (requiredInt64Group == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredInt64Group' when calling FakeApi->TestGroupParameters"); + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + }; + + // to determine the Accept header + String[] @accepts = new String[] { + }; + + var localVarConentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(@contentTypes); + if (localVarConentType != null) requestOptions.HeaderParameters.Add("Content-Type", localVarConentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(@accepts); + if (localVarAccept != null) requestOptions.HeaderParameters.Add("Accept", localVarAccept); + + if (requiredStringGroup != null) + { + foreach (var kvp in Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "required_string_group", requiredStringGroup)) + { + foreach (var value in kvp.Value) + { + requestOptions.QueryParameters.Add(kvp.Key, value); + } + } + } + if (requiredInt64Group != null) + { + foreach (var kvp in Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "required_int64_group", requiredInt64Group)) + { + foreach (var value in kvp.Value) + { + requestOptions.QueryParameters.Add(kvp.Key, value); + } + } + } + if (stringGroup != null) + { + foreach (var kvp in Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "string_group", stringGroup)) + { + foreach (var value in kvp.Value) + { + requestOptions.QueryParameters.Add(kvp.Key, value); + } + } + } + if (int64Group != null) + { + foreach (var kvp in Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "int64_group", int64Group)) + { + foreach (var value in kvp.Value) + { + requestOptions.QueryParameters.Add(kvp.Key, value); + } + } + } + if (requiredBooleanGroup != null) + requestOptions.HeaderParameters.Add("required_boolean_group", Org.OpenAPITools.Client.ClientUtils.ParameterToString(requiredBooleanGroup)); // header parameter + if (booleanGroup != null) + requestOptions.HeaderParameters.Add("boolean_group", Org.OpenAPITools.Client.ClientUtils.ParameterToString(booleanGroup)); // header parameter + + + // make the HTTP request + + var response = this.Client.Delete("/fake", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("TestGroupParameters", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// Fake endpoint to test group parameters (optional) Fake endpoint to test group parameters (optional) + /// + /// Thrown when fails to make API call + /// Required String in group parameters + /// Required Boolean in group parameters + /// Required Integer in group parameters + /// String in group parameters (optional) + /// Boolean in group parameters (optional) + /// Integer in group parameters (optional) + /// Task of void + public async System.Threading.Tasks.Task TestGroupParametersAsync (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = null, bool? booleanGroup = null, long? int64Group = null) + { + await TestGroupParametersAsyncWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + + } + + /// + /// Fake endpoint to test group parameters (optional) Fake endpoint to test group parameters (optional) + /// + /// Thrown when fails to make API call + /// Required String in group parameters + /// Required Boolean in group parameters + /// Required Integer in group parameters + /// String in group parameters (optional) + /// Boolean in group parameters (optional) + /// Integer in group parameters (optional) + /// Task of ApiResponse + public async System.Threading.Tasks.Task> TestGroupParametersAsyncWithHttpInfo (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = null, bool? booleanGroup = null, long? int64Group = null) + { + // verify the required parameter 'requiredStringGroup' is set + if (requiredStringGroup == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredStringGroup' when calling FakeApi->TestGroupParameters"); + + // verify the required parameter 'requiredBooleanGroup' is set + if (requiredBooleanGroup == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredBooleanGroup' when calling FakeApi->TestGroupParameters"); + + // verify the required parameter 'requiredInt64Group' is set + if (requiredInt64Group == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredInt64Group' when calling FakeApi->TestGroupParameters"); + + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + }; + + // to determine the Accept header + String[] @accepts = new String[] { + }; + + foreach (var contentType in @contentTypes) + requestOptions.HeaderParameters.Add("Content-Type", contentType); + + foreach (var accept in @accepts) + requestOptions.HeaderParameters.Add("Accept", accept); + + if (requiredStringGroup != null) + { + foreach (var kvp in Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "required_string_group", requiredStringGroup)) + { + foreach (var value in kvp.Value) + { + requestOptions.QueryParameters.Add(kvp.Key, value); + } + } + } + if (requiredInt64Group != null) + { + foreach (var kvp in Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "required_int64_group", requiredInt64Group)) + { + foreach (var value in kvp.Value) + { + requestOptions.QueryParameters.Add(kvp.Key, value); + } + } + } + if (stringGroup != null) + { + foreach (var kvp in Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "string_group", stringGroup)) + { + foreach (var value in kvp.Value) + { + requestOptions.QueryParameters.Add(kvp.Key, value); + } + } + } + if (int64Group != null) + { + foreach (var kvp in Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "int64_group", int64Group)) + { + foreach (var value in kvp.Value) + { + requestOptions.QueryParameters.Add(kvp.Key, value); + } + } + } + if (requiredBooleanGroup != null) + requestOptions.HeaderParameters.Add("required_boolean_group", Org.OpenAPITools.Client.ClientUtils.ParameterToString(requiredBooleanGroup)); // header parameter + if (booleanGroup != null) + requestOptions.HeaderParameters.Add("boolean_group", Org.OpenAPITools.Client.ClientUtils.ParameterToString(booleanGroup)); // header parameter + + + // make the HTTP request + + var response = await this.AsynchronousClient.DeleteAsync("/fake", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("TestGroupParameters", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// test inline additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// + public void TestInlineAdditionalProperties (Dictionary param) + { + TestInlineAdditionalPropertiesWithHttpInfo(param); + } + + /// + /// test inline additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse TestInlineAdditionalPropertiesWithHttpInfo (Dictionary param) + { + // verify the required parameter 'param' is set + if (param == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'param' when calling FakeApi->TestInlineAdditionalProperties"); + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + "application/json" + }; + + // to determine the Accept header + String[] @accepts = new String[] { + }; + + var localVarConentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(@contentTypes); + if (localVarConentType != null) requestOptions.HeaderParameters.Add("Content-Type", localVarConentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(@accepts); + if (localVarAccept != null) requestOptions.HeaderParameters.Add("Accept", localVarAccept); + + requestOptions.Data = param; + + + // make the HTTP request + + var response = this.Client.Post("/fake/inline-additionalProperties", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("TestInlineAdditionalProperties", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// test inline additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Task of void + public async System.Threading.Tasks.Task TestInlineAdditionalPropertiesAsync (Dictionary param) + { + await TestInlineAdditionalPropertiesAsyncWithHttpInfo(param); + + } + + /// + /// test inline additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Task of ApiResponse + public async System.Threading.Tasks.Task> TestInlineAdditionalPropertiesAsyncWithHttpInfo (Dictionary param) + { + // verify the required parameter 'param' is set + if (param == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'param' when calling FakeApi->TestInlineAdditionalProperties"); + + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + "application/json" + }; + + // to determine the Accept header + String[] @accepts = new String[] { + }; + + foreach (var contentType in @contentTypes) + requestOptions.HeaderParameters.Add("Content-Type", contentType); + + foreach (var accept in @accepts) + requestOptions.HeaderParameters.Add("Accept", accept); + + requestOptions.Data = param; + + + // make the HTTP request + + var response = await this.AsynchronousClient.PostAsync("/fake/inline-additionalProperties", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("TestInlineAdditionalProperties", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// test json serialization of form data + /// + /// Thrown when fails to make API call + /// field1 + /// field2 + /// + public void TestJsonFormData (string param, string param2) + { + TestJsonFormDataWithHttpInfo(param, param2); + } + + /// + /// test json serialization of form data + /// + /// Thrown when fails to make API call + /// field1 + /// field2 + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse TestJsonFormDataWithHttpInfo (string param, string param2) + { + // verify the required parameter 'param' is set + if (param == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'param' when calling FakeApi->TestJsonFormData"); + + // verify the required parameter 'param2' is set + if (param2 == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'param2' when calling FakeApi->TestJsonFormData"); + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + "application/x-www-form-urlencoded" + }; + + // to determine the Accept header + String[] @accepts = new String[] { + }; + + var localVarConentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(@contentTypes); + if (localVarConentType != null) requestOptions.HeaderParameters.Add("Content-Type", localVarConentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(@accepts); + if (localVarAccept != null) requestOptions.HeaderParameters.Add("Accept", localVarAccept); + + if (param != null) + { + requestOptions.FormParameters.Add("param", Org.OpenAPITools.Client.ClientUtils.ParameterToString(param)); // form parameter + } + if (param2 != null) + { + requestOptions.FormParameters.Add("param2", Org.OpenAPITools.Client.ClientUtils.ParameterToString(param2)); // form parameter + } + + + // make the HTTP request + + var response = this.Client.Get("/fake/jsonFormData", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("TestJsonFormData", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// test json serialization of form data + /// + /// Thrown when fails to make API call + /// field1 + /// field2 + /// Task of void + public async System.Threading.Tasks.Task TestJsonFormDataAsync (string param, string param2) + { + await TestJsonFormDataAsyncWithHttpInfo(param, param2); + + } + + /// + /// test json serialization of form data + /// + /// Thrown when fails to make API call + /// field1 + /// field2 + /// Task of ApiResponse + public async System.Threading.Tasks.Task> TestJsonFormDataAsyncWithHttpInfo (string param, string param2) + { + // verify the required parameter 'param' is set + if (param == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'param' when calling FakeApi->TestJsonFormData"); + + // verify the required parameter 'param2' is set + if (param2 == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'param2' when calling FakeApi->TestJsonFormData"); + + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + "application/x-www-form-urlencoded" + }; + + // to determine the Accept header + String[] @accepts = new String[] { + }; + + foreach (var contentType in @contentTypes) + requestOptions.HeaderParameters.Add("Content-Type", contentType); + + foreach (var accept in @accepts) + requestOptions.HeaderParameters.Add("Accept", accept); + + if (param != null) + { + requestOptions.FormParameters.Add("param", Org.OpenAPITools.Client.ClientUtils.ParameterToString(param)); // form parameter + } + if (param2 != null) + { + requestOptions.FormParameters.Add("param2", Org.OpenAPITools.Client.ClientUtils.ParameterToString(param2)); // form parameter + } + + + // make the HTTP request + + var response = await this.AsynchronousClient.GetAsync("/fake/jsonFormData", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("TestJsonFormData", response); + if (exception != null) throw exception; + } + + return response; + } + + } +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs new file mode 100644 index 00000000000..61b5a0d404f --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs @@ -0,0 +1,340 @@ +/* + * 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.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Net; +using System.Net.Mime; +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 IFakeClassnameTags123ApiSync : IApiAccessor + { + #region Synchronous Operations + /// + /// To test class name in snake case + /// + /// + /// To test class name in snake case + /// + /// Thrown when fails to make API call + /// client model + /// ModelClient + ModelClient TestClassname (ModelClient body); + + /// + /// To test class name in snake case + /// + /// + /// To test class name in snake case + /// + /// Thrown when fails to make API call + /// client model + /// ApiResponse of ModelClient + ApiResponse TestClassnameWithHttpInfo (ModelClient body); + #endregion Synchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IFakeClassnameTags123ApiAsync : IApiAccessor + { + #region Asynchronous Operations + /// + /// To test class name in snake case + /// + /// + /// To test class name in snake case + /// + /// Thrown when fails to make API call + /// client model + /// Task of ModelClient + System.Threading.Tasks.Task TestClassnameAsync (ModelClient body); + + /// + /// To test class name in snake case + /// + /// + /// To test class name in snake case + /// + /// Thrown when fails to make API call + /// client model + /// Task of ApiResponse (ModelClient) + System.Threading.Tasks.Task> TestClassnameAsyncWithHttpInfo (ModelClient body); + #endregion Asynchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IFakeClassnameTags123Api : IFakeClassnameTags123ApiSync, IFakeClassnameTags123ApiAsync + { + + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class FakeClassnameTags123Api : IFakeClassnameTags123Api + { + private Org.OpenAPITools.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + + /// + /// Initializes a new instance of the class. + /// + /// + public FakeClassnameTags123Api() : this((string) null) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// + public FakeClassnameTags123Api(String basePath) + { + this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( + Org.OpenAPITools.Client.GlobalConfiguration.Instance, + new Org.OpenAPITools.Client.Configuration { BasePath = basePath } + ); + this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using Configuration object + /// + /// An instance of Configuration + /// + public FakeClassnameTags123Api(Org.OpenAPITools.Client.Configuration configuration) + { + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( + Org.OpenAPITools.Client.GlobalConfiguration.Instance, + configuration + ); + this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using a Configuration object and client instance. + /// + /// The client interface for synchronous API access. + /// The client interface for asynchronous API access. + /// The configuration object. + public FakeClassnameTags123Api(Org.OpenAPITools.Client.ISynchronousClient client,Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration) + { + if(client == null) throw new ArgumentNullException("client"); + if(asyncClient == null) throw new ArgumentNullException("asyncClient"); + if(configuration == null) throw new ArgumentNullException("configuration"); + + this.Client = client; + this.AsynchronousClient = asyncClient; + this.Configuration = configuration; + this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// The client for accessing this underlying API asynchronously. + /// + public Org.OpenAPITools.Client.IAsynchronousClient AsynchronousClient { get; set; } + + /// + /// The client for accessing this underlying API synchronously. + /// + public Org.OpenAPITools.Client.ISynchronousClient Client { get; set; } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public String GetBasePath() + { + return this.Configuration.BasePath; + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Org.OpenAPITools.Client.IReadableConfiguration Configuration {get; set;} + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + + /// + /// To test class name in snake case To test class name in snake case + /// + /// Thrown when fails to make API call + /// client model + /// ModelClient + public ModelClient TestClassname (ModelClient body) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = TestClassnameWithHttpInfo(body); + return localVarResponse.Data; + } + + /// + /// To test class name in snake case To test class name in snake case + /// + /// Thrown when fails to make API call + /// client model + /// ApiResponse of ModelClient + public Org.OpenAPITools.Client.ApiResponse< ModelClient > TestClassnameWithHttpInfo (ModelClient body) + { + // verify the required parameter 'body' is set + if (body == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'body' when calling FakeClassnameTags123Api->TestClassname"); + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + "application/json" + }; + + // to determine the Accept header + String[] @accepts = new String[] { + "application/json" + }; + + var localVarConentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(@contentTypes); + if (localVarConentType != null) requestOptions.HeaderParameters.Add("Content-Type", localVarConentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(@accepts); + if (localVarAccept != null) requestOptions.HeaderParameters.Add("Accept", localVarAccept); + + requestOptions.Data = body; + + // authentication (api_key_query) required + if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key_query"))) + { + foreach (var kvp in Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "api_key_query", this.Configuration.GetApiKeyWithPrefix("api_key_query"))) + { + foreach (var value in kvp.Value) + { + requestOptions.QueryParameters.Add(kvp.Key, value); + } + } + } + + // make the HTTP request + + var response = this.Client.Patch< ModelClient >("/fake_classname_test", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("TestClassname", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// To test class name in snake case To test class name in snake case + /// + /// Thrown when fails to make API call + /// client model + /// Task of ModelClient + public async System.Threading.Tasks.Task TestClassnameAsync (ModelClient body) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await TestClassnameAsyncWithHttpInfo(body); + return localVarResponse.Data; + + } + + /// + /// To test class name in snake case To test class name in snake case + /// + /// Thrown when fails to make API call + /// client model + /// Task of ApiResponse (ModelClient) + public async System.Threading.Tasks.Task> TestClassnameAsyncWithHttpInfo (ModelClient body) + { + // verify the required parameter 'body' is set + if (body == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'body' when calling FakeClassnameTags123Api->TestClassname"); + + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + "application/json" + }; + + // to determine the Accept header + String[] @accepts = new String[] { + "application/json" + }; + + foreach (var contentType in @contentTypes) + requestOptions.HeaderParameters.Add("Content-Type", contentType); + + foreach (var accept in @accepts) + requestOptions.HeaderParameters.Add("Accept", accept); + + requestOptions.Data = body; + + // authentication (api_key_query) required + if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key_query"))) + { + foreach (var kvp in Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "api_key_query", this.Configuration.GetApiKeyWithPrefix("api_key_query"))) + { + foreach (var value in kvp.Value) + { + requestOptions.QueryParameters.Add(kvp.Key, value); + } + } + } + + // make the HTTP request + + var response = await this.AsynchronousClient.PatchAsync("/fake_classname_test", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("TestClassname", response); + if (exception != null) throw exception; + } + + return response; + } + + } +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Api/PetApi.cs new file mode 100644 index 00000000000..0068cdbccb9 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Api/PetApi.cs @@ -0,0 +1,1836 @@ +/* + * 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.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Net; +using System.Net.Mime; +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 IPetApiSync : IApiAccessor + { + #region Synchronous Operations + /// + /// Add a new pet to the store + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// + void AddPet (Pet body); + + /// + /// Add a new pet to the store + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// ApiResponse of Object(void) + ApiResponse AddPetWithHttpInfo (Pet body); + /// + /// Deletes a pet + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Pet id to delete + /// (optional) + /// + void DeletePet (long petId, string apiKey = null); + + /// + /// Deletes a pet + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Pet id to delete + /// (optional) + /// ApiResponse of Object(void) + ApiResponse DeletePetWithHttpInfo (long petId, string apiKey = null); + /// + /// Finds Pets by status + /// + /// + /// Multiple status values can be provided with comma separated strings + /// + /// Thrown when fails to make API call + /// Status values that need to be considered for filter + /// List<Pet> + List FindPetsByStatus (List status); + + /// + /// Finds Pets by status + /// + /// + /// Multiple status values can be provided with comma separated strings + /// + /// Thrown when fails to make API call + /// Status values that need to be considered for filter + /// ApiResponse of List<Pet> + ApiResponse> FindPetsByStatusWithHttpInfo (List status); + /// + /// Finds Pets by tags + /// + /// + /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Thrown when fails to make API call + /// Tags to filter by + /// List<Pet> + List FindPetsByTags (List tags); + + /// + /// Finds Pets by tags + /// + /// + /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Thrown when fails to make API call + /// Tags to filter by + /// ApiResponse of List<Pet> + ApiResponse> FindPetsByTagsWithHttpInfo (List tags); + /// + /// Find pet by ID + /// + /// + /// Returns a single pet + /// + /// Thrown when fails to make API call + /// ID of pet to return + /// Pet + Pet GetPetById (long petId); + + /// + /// Find pet by ID + /// + /// + /// Returns a single pet + /// + /// Thrown when fails to make API call + /// ID of pet to return + /// ApiResponse of Pet + ApiResponse GetPetByIdWithHttpInfo (long petId); + /// + /// Update an existing pet + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// + void UpdatePet (Pet body); + + /// + /// Update an existing pet + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// ApiResponse of Object(void) + ApiResponse UpdatePetWithHttpInfo (Pet body); + /// + /// Updates a pet in the store with form data + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be updated + /// Updated name of the pet (optional) + /// Updated status of the pet (optional) + /// + void UpdatePetWithForm (long petId, string name = null, string status = null); + + /// + /// Updates a pet in the store with form data + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be updated + /// Updated name of the pet (optional) + /// Updated status of the pet (optional) + /// ApiResponse of Object(void) + ApiResponse UpdatePetWithFormWithHttpInfo (long petId, string name = null, string status = null); + /// + /// uploads an image + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// Additional data to pass to server (optional) + /// file to upload (optional) + /// ApiResponse + ApiResponse UploadFile (long petId, string additionalMetadata = null, System.IO.Stream file = null); + + /// + /// uploads an image + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// Additional data to pass to server (optional) + /// 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 + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IPetApiAsync : IApiAccessor + { + #region Asynchronous Operations + /// + /// Add a new pet to the store + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Task of void + System.Threading.Tasks.Task AddPetAsync (Pet body); + + /// + /// Add a new pet to the store + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Task of ApiResponse + System.Threading.Tasks.Task> AddPetAsyncWithHttpInfo (Pet body); + /// + /// Deletes a pet + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Pet id to delete + /// (optional) + /// Task of void + System.Threading.Tasks.Task DeletePetAsync (long petId, string apiKey = null); + + /// + /// Deletes a pet + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Pet id to delete + /// (optional) + /// Task of ApiResponse + System.Threading.Tasks.Task> DeletePetAsyncWithHttpInfo (long petId, string apiKey = null); + /// + /// Finds Pets by status + /// + /// + /// Multiple status values can be provided with comma separated strings + /// + /// Thrown when fails to make API call + /// Status values that need to be considered for filter + /// Task of List<Pet> + System.Threading.Tasks.Task> FindPetsByStatusAsync (List status); + + /// + /// Finds Pets by status + /// + /// + /// Multiple status values can be provided with comma separated strings + /// + /// Thrown when fails to make API call + /// Status values that need to be considered for filter + /// Task of ApiResponse (List<Pet>) + System.Threading.Tasks.Task>> FindPetsByStatusAsyncWithHttpInfo (List status); + /// + /// Finds Pets by tags + /// + /// + /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Thrown when fails to make API call + /// Tags to filter by + /// Task of List<Pet> + System.Threading.Tasks.Task> FindPetsByTagsAsync (List tags); + + /// + /// Finds Pets by tags + /// + /// + /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Thrown when fails to make API call + /// Tags to filter by + /// Task of ApiResponse (List<Pet>) + System.Threading.Tasks.Task>> FindPetsByTagsAsyncWithHttpInfo (List tags); + /// + /// Find pet by ID + /// + /// + /// Returns a single pet + /// + /// Thrown when fails to make API call + /// ID of pet to return + /// Task of Pet + System.Threading.Tasks.Task GetPetByIdAsync (long petId); + + /// + /// Find pet by ID + /// + /// + /// Returns a single pet + /// + /// Thrown when fails to make API call + /// ID of pet to return + /// Task of ApiResponse (Pet) + System.Threading.Tasks.Task> GetPetByIdAsyncWithHttpInfo (long petId); + /// + /// Update an existing pet + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Task of void + System.Threading.Tasks.Task UpdatePetAsync (Pet body); + + /// + /// Update an existing pet + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Task of ApiResponse + System.Threading.Tasks.Task> UpdatePetAsyncWithHttpInfo (Pet body); + /// + /// Updates a pet in the store with form data + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be updated + /// Updated name of the pet (optional) + /// Updated status of the pet (optional) + /// Task of void + System.Threading.Tasks.Task UpdatePetWithFormAsync (long petId, string name = null, string status = null); + + /// + /// Updates a pet in the store with form data + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be updated + /// Updated name of the pet (optional) + /// Updated status of the pet (optional) + /// Task of ApiResponse + System.Threading.Tasks.Task> UpdatePetWithFormAsyncWithHttpInfo (long petId, string name = null, string status = null); + /// + /// uploads an image + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// Additional data to pass to server (optional) + /// file to upload (optional) + /// Task of ApiResponse + System.Threading.Tasks.Task UploadFileAsync (long petId, string additionalMetadata = null, System.IO.Stream file = null); + + /// + /// uploads an image + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// Additional data to pass to server (optional) + /// 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 + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IPetApi : IPetApiSync, IPetApiAsync + { + + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class PetApi : IPetApi + { + private Org.OpenAPITools.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + + /// + /// Initializes a new instance of the class. + /// + /// + public PetApi() : this((string) null) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// + public PetApi(String basePath) + { + this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( + Org.OpenAPITools.Client.GlobalConfiguration.Instance, + new Org.OpenAPITools.Client.Configuration { BasePath = basePath } + ); + this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using Configuration object + /// + /// An instance of Configuration + /// + public PetApi(Org.OpenAPITools.Client.Configuration configuration) + { + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( + Org.OpenAPITools.Client.GlobalConfiguration.Instance, + configuration + ); + this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using a Configuration object and client instance. + /// + /// The client interface for synchronous API access. + /// The client interface for asynchronous API access. + /// The configuration object. + public PetApi(Org.OpenAPITools.Client.ISynchronousClient client,Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration) + { + if(client == null) throw new ArgumentNullException("client"); + if(asyncClient == null) throw new ArgumentNullException("asyncClient"); + if(configuration == null) throw new ArgumentNullException("configuration"); + + this.Client = client; + this.AsynchronousClient = asyncClient; + this.Configuration = configuration; + this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// The client for accessing this underlying API asynchronously. + /// + public Org.OpenAPITools.Client.IAsynchronousClient AsynchronousClient { get; set; } + + /// + /// The client for accessing this underlying API synchronously. + /// + public Org.OpenAPITools.Client.ISynchronousClient Client { get; set; } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public String GetBasePath() + { + return this.Configuration.BasePath; + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Org.OpenAPITools.Client.IReadableConfiguration Configuration {get; set;} + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + + /// + /// Add a new pet to the store + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// + public void AddPet (Pet body) + { + AddPetWithHttpInfo(body); + } + + /// + /// Add a new pet to the store + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse AddPetWithHttpInfo (Pet body) + { + // verify the required parameter 'body' is set + if (body == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'body' when calling PetApi->AddPet"); + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + "application/json", + "application/xml" + }; + + // to determine the Accept header + String[] @accepts = new String[] { + }; + + var localVarConentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(@contentTypes); + if (localVarConentType != null) requestOptions.HeaderParameters.Add("Content-Type", localVarConentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(@accepts); + if (localVarAccept != null) requestOptions.HeaderParameters.Add("Accept", localVarAccept); + + requestOptions.Data = body; + + // authentication (petstore_auth) required + // oauth required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + requestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + + // make the HTTP request + + var response = this.Client.Post("/pet", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("AddPet", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// Add a new pet to the store + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Task of void + public async System.Threading.Tasks.Task AddPetAsync (Pet body) + { + await AddPetAsyncWithHttpInfo(body); + + } + + /// + /// Add a new pet to the store + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Task of ApiResponse + public async System.Threading.Tasks.Task> AddPetAsyncWithHttpInfo (Pet body) + { + // verify the required parameter 'body' is set + if (body == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'body' when calling PetApi->AddPet"); + + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + "application/json", + "application/xml" + }; + + // to determine the Accept header + String[] @accepts = new String[] { + }; + + foreach (var contentType in @contentTypes) + requestOptions.HeaderParameters.Add("Content-Type", contentType); + + foreach (var accept in @accepts) + requestOptions.HeaderParameters.Add("Accept", accept); + + requestOptions.Data = body; + + // authentication (petstore_auth) required + // oauth required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + requestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + + // make the HTTP request + + var response = await this.AsynchronousClient.PostAsync("/pet", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("AddPet", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// Deletes a pet + /// + /// Thrown when fails to make API call + /// Pet id to delete + /// (optional) + /// + public void DeletePet (long petId, string apiKey = null) + { + DeletePetWithHttpInfo(petId, apiKey); + } + + /// + /// Deletes a pet + /// + /// Thrown when fails to make API call + /// Pet id to delete + /// (optional) + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse DeletePetWithHttpInfo (long petId, string apiKey = null) + { + // verify the required parameter 'petId' is set + if (petId == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'petId' when calling PetApi->DeletePet"); + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + }; + + // to determine the Accept header + String[] @accepts = new String[] { + }; + + var localVarConentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(@contentTypes); + if (localVarConentType != null) requestOptions.HeaderParameters.Add("Content-Type", localVarConentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(@accepts); + if (localVarAccept != null) requestOptions.HeaderParameters.Add("Accept", localVarAccept); + + if (petId != null) + requestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter + if (apiKey != null) + requestOptions.HeaderParameters.Add("api_key", Org.OpenAPITools.Client.ClientUtils.ParameterToString(apiKey)); // header parameter + + // authentication (petstore_auth) required + // oauth required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + requestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + + // make the HTTP request + + var response = this.Client.Delete("/pet/{petId}", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("DeletePet", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// Deletes a pet + /// + /// Thrown when fails to make API call + /// Pet id to delete + /// (optional) + /// Task of void + public async System.Threading.Tasks.Task DeletePetAsync (long petId, string apiKey = null) + { + await DeletePetAsyncWithHttpInfo(petId, apiKey); + + } + + /// + /// Deletes a pet + /// + /// Thrown when fails to make API call + /// Pet id to delete + /// (optional) + /// Task of ApiResponse + public async System.Threading.Tasks.Task> DeletePetAsyncWithHttpInfo (long petId, string apiKey = null) + { + // verify the required parameter 'petId' is set + if (petId == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'petId' when calling PetApi->DeletePet"); + + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + }; + + // to determine the Accept header + String[] @accepts = new String[] { + }; + + foreach (var contentType in @contentTypes) + requestOptions.HeaderParameters.Add("Content-Type", contentType); + + foreach (var accept in @accepts) + requestOptions.HeaderParameters.Add("Accept", accept); + + if (petId != null) + requestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter + if (apiKey != null) + requestOptions.HeaderParameters.Add("api_key", Org.OpenAPITools.Client.ClientUtils.ParameterToString(apiKey)); // header parameter + + // authentication (petstore_auth) required + // oauth required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + requestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + + // make the HTTP request + + var response = await this.AsynchronousClient.DeleteAsync("/pet/{petId}", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("DeletePet", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// Finds Pets by status Multiple status values can be provided with comma separated strings + /// + /// Thrown when fails to make API call + /// Status values that need to be considered for filter + /// List<Pet> + public List FindPetsByStatus (List status) + { + Org.OpenAPITools.Client.ApiResponse> localVarResponse = FindPetsByStatusWithHttpInfo(status); + return localVarResponse.Data; + } + + /// + /// Finds Pets by status Multiple status values can be provided with comma separated strings + /// + /// Thrown when fails to make API call + /// Status values that need to be considered for filter + /// ApiResponse of List<Pet> + public Org.OpenAPITools.Client.ApiResponse< List > FindPetsByStatusWithHttpInfo (List status) + { + // verify the required parameter 'status' is set + if (status == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'status' when calling PetApi->FindPetsByStatus"); + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + }; + + // to determine the Accept header + String[] @accepts = new String[] { + "application/xml", + "application/json" + }; + + var localVarConentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(@contentTypes); + if (localVarConentType != null) requestOptions.HeaderParameters.Add("Content-Type", localVarConentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(@accepts); + if (localVarAccept != null) requestOptions.HeaderParameters.Add("Accept", localVarAccept); + + if (status != null) + { + foreach (var kvp in Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "status", status)) + { + foreach (var value in kvp.Value) + { + requestOptions.QueryParameters.Add(kvp.Key, value); + } + } + } + + // authentication (petstore_auth) required + // oauth required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + requestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + + // make the HTTP request + + var response = this.Client.Get< List >("/pet/findByStatus", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("FindPetsByStatus", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// Finds Pets by status Multiple status values can be provided with comma separated strings + /// + /// Thrown when fails to make API call + /// Status values that need to be considered for filter + /// Task of List<Pet> + public async System.Threading.Tasks.Task> FindPetsByStatusAsync (List status) + { + Org.OpenAPITools.Client.ApiResponse> localVarResponse = await FindPetsByStatusAsyncWithHttpInfo(status); + return localVarResponse.Data; + + } + + /// + /// Finds Pets by status Multiple status values can be provided with comma separated strings + /// + /// Thrown when fails to make API call + /// Status values that need to be considered for filter + /// Task of ApiResponse (List<Pet>) + public async System.Threading.Tasks.Task>> FindPetsByStatusAsyncWithHttpInfo (List status) + { + // verify the required parameter 'status' is set + if (status == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'status' when calling PetApi->FindPetsByStatus"); + + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + }; + + // to determine the Accept header + String[] @accepts = new String[] { + "application/xml", + "application/json" + }; + + foreach (var contentType in @contentTypes) + requestOptions.HeaderParameters.Add("Content-Type", contentType); + + foreach (var accept in @accepts) + requestOptions.HeaderParameters.Add("Accept", accept); + + if (status != null) + { + foreach (var kvp in Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "status", status)) + { + foreach (var value in kvp.Value) + { + requestOptions.QueryParameters.Add(kvp.Key, value); + } + } + } + + // authentication (petstore_auth) required + // oauth required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + requestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + + // make the HTTP request + + var response = await this.AsynchronousClient.GetAsync>("/pet/findByStatus", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("FindPetsByStatus", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Thrown when fails to make API call + /// Tags to filter by + /// List<Pet> + public List FindPetsByTags (List tags) + { + Org.OpenAPITools.Client.ApiResponse> localVarResponse = FindPetsByTagsWithHttpInfo(tags); + return localVarResponse.Data; + } + + /// + /// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Thrown when fails to make API call + /// Tags to filter by + /// ApiResponse of List<Pet> + public Org.OpenAPITools.Client.ApiResponse< List > FindPetsByTagsWithHttpInfo (List tags) + { + // verify the required parameter 'tags' is set + if (tags == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'tags' when calling PetApi->FindPetsByTags"); + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + }; + + // to determine the Accept header + String[] @accepts = new String[] { + "application/xml", + "application/json" + }; + + var localVarConentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(@contentTypes); + if (localVarConentType != null) requestOptions.HeaderParameters.Add("Content-Type", localVarConentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(@accepts); + if (localVarAccept != null) requestOptions.HeaderParameters.Add("Accept", localVarAccept); + + if (tags != null) + { + foreach (var kvp in Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "tags", tags)) + { + foreach (var value in kvp.Value) + { + requestOptions.QueryParameters.Add(kvp.Key, value); + } + } + } + + // authentication (petstore_auth) required + // oauth required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + requestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + + // make the HTTP request + + var response = this.Client.Get< List >("/pet/findByTags", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("FindPetsByTags", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Thrown when fails to make API call + /// Tags to filter by + /// Task of List<Pet> + public async System.Threading.Tasks.Task> FindPetsByTagsAsync (List tags) + { + Org.OpenAPITools.Client.ApiResponse> localVarResponse = await FindPetsByTagsAsyncWithHttpInfo(tags); + return localVarResponse.Data; + + } + + /// + /// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Thrown when fails to make API call + /// Tags to filter by + /// Task of ApiResponse (List<Pet>) + public async System.Threading.Tasks.Task>> FindPetsByTagsAsyncWithHttpInfo (List tags) + { + // verify the required parameter 'tags' is set + if (tags == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'tags' when calling PetApi->FindPetsByTags"); + + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + }; + + // to determine the Accept header + String[] @accepts = new String[] { + "application/xml", + "application/json" + }; + + foreach (var contentType in @contentTypes) + requestOptions.HeaderParameters.Add("Content-Type", contentType); + + foreach (var accept in @accepts) + requestOptions.HeaderParameters.Add("Accept", accept); + + if (tags != null) + { + foreach (var kvp in Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "tags", tags)) + { + foreach (var value in kvp.Value) + { + requestOptions.QueryParameters.Add(kvp.Key, value); + } + } + } + + // authentication (petstore_auth) required + // oauth required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + requestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + + // make the HTTP request + + var response = await this.AsynchronousClient.GetAsync>("/pet/findByTags", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("FindPetsByTags", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// Find pet by ID Returns a single pet + /// + /// Thrown when fails to make API call + /// ID of pet to return + /// Pet + public Pet GetPetById (long petId) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = GetPetByIdWithHttpInfo(petId); + return localVarResponse.Data; + } + + /// + /// Find pet by ID Returns a single pet + /// + /// Thrown when fails to make API call + /// ID of pet to return + /// ApiResponse of Pet + public Org.OpenAPITools.Client.ApiResponse< Pet > GetPetByIdWithHttpInfo (long petId) + { + // verify the required parameter 'petId' is set + if (petId == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'petId' when calling PetApi->GetPetById"); + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + }; + + // to determine the Accept header + String[] @accepts = new String[] { + "application/xml", + "application/json" + }; + + var localVarConentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(@contentTypes); + if (localVarConentType != null) requestOptions.HeaderParameters.Add("Content-Type", localVarConentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(@accepts); + if (localVarAccept != null) requestOptions.HeaderParameters.Add("Accept", localVarAccept); + + if (petId != null) + requestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter + + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key"))) + { + requestOptions.HeaderParameters.Add("api_key", this.Configuration.GetApiKeyWithPrefix("api_key")); + } + + // make the HTTP request + + var response = this.Client.Get< Pet >("/pet/{petId}", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("GetPetById", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// Find pet by ID Returns a single pet + /// + /// Thrown when fails to make API call + /// ID of pet to return + /// Task of Pet + public async System.Threading.Tasks.Task GetPetByIdAsync (long petId) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await GetPetByIdAsyncWithHttpInfo(petId); + return localVarResponse.Data; + + } + + /// + /// Find pet by ID Returns a single pet + /// + /// Thrown when fails to make API call + /// ID of pet to return + /// Task of ApiResponse (Pet) + public async System.Threading.Tasks.Task> GetPetByIdAsyncWithHttpInfo (long petId) + { + // verify the required parameter 'petId' is set + if (petId == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'petId' when calling PetApi->GetPetById"); + + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + }; + + // to determine the Accept header + String[] @accepts = new String[] { + "application/xml", + "application/json" + }; + + foreach (var contentType in @contentTypes) + requestOptions.HeaderParameters.Add("Content-Type", contentType); + + foreach (var accept in @accepts) + requestOptions.HeaderParameters.Add("Accept", accept); + + if (petId != null) + requestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter + + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key"))) + { + requestOptions.HeaderParameters.Add("api_key", this.Configuration.GetApiKeyWithPrefix("api_key")); + } + + // make the HTTP request + + var response = await this.AsynchronousClient.GetAsync("/pet/{petId}", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("GetPetById", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// Update an existing pet + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// + public void UpdatePet (Pet body) + { + UpdatePetWithHttpInfo(body); + } + + /// + /// Update an existing pet + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse UpdatePetWithHttpInfo (Pet body) + { + // verify the required parameter 'body' is set + if (body == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'body' when calling PetApi->UpdatePet"); + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + "application/json", + "application/xml" + }; + + // to determine the Accept header + String[] @accepts = new String[] { + }; + + var localVarConentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(@contentTypes); + if (localVarConentType != null) requestOptions.HeaderParameters.Add("Content-Type", localVarConentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(@accepts); + if (localVarAccept != null) requestOptions.HeaderParameters.Add("Accept", localVarAccept); + + requestOptions.Data = body; + + // authentication (petstore_auth) required + // oauth required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + requestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + + // make the HTTP request + + var response = this.Client.Put("/pet", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("UpdatePet", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// Update an existing pet + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Task of void + public async System.Threading.Tasks.Task UpdatePetAsync (Pet body) + { + await UpdatePetAsyncWithHttpInfo(body); + + } + + /// + /// Update an existing pet + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Task of ApiResponse + public async System.Threading.Tasks.Task> UpdatePetAsyncWithHttpInfo (Pet body) + { + // verify the required parameter 'body' is set + if (body == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'body' when calling PetApi->UpdatePet"); + + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + "application/json", + "application/xml" + }; + + // to determine the Accept header + String[] @accepts = new String[] { + }; + + foreach (var contentType in @contentTypes) + requestOptions.HeaderParameters.Add("Content-Type", contentType); + + foreach (var accept in @accepts) + requestOptions.HeaderParameters.Add("Accept", accept); + + requestOptions.Data = body; + + // authentication (petstore_auth) required + // oauth required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + requestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + + // make the HTTP request + + var response = await this.AsynchronousClient.PutAsync("/pet", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("UpdatePet", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// Updates a pet in the store with form data + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be updated + /// Updated name of the pet (optional) + /// Updated status of the pet (optional) + /// + public void UpdatePetWithForm (long petId, string name = null, string status = null) + { + UpdatePetWithFormWithHttpInfo(petId, name, status); + } + + /// + /// Updates a pet in the store with form data + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be updated + /// Updated name of the pet (optional) + /// Updated status of the pet (optional) + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse UpdatePetWithFormWithHttpInfo (long petId, string name = null, string status = null) + { + // verify the required parameter 'petId' is set + if (petId == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'petId' when calling PetApi->UpdatePetWithForm"); + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + "application/x-www-form-urlencoded" + }; + + // to determine the Accept header + String[] @accepts = new String[] { + }; + + var localVarConentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(@contentTypes); + if (localVarConentType != null) requestOptions.HeaderParameters.Add("Content-Type", localVarConentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(@accepts); + if (localVarAccept != null) requestOptions.HeaderParameters.Add("Accept", localVarAccept); + + if (petId != null) + requestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter + if (name != null) + { + requestOptions.FormParameters.Add("name", Org.OpenAPITools.Client.ClientUtils.ParameterToString(name)); // form parameter + } + if (status != null) + { + requestOptions.FormParameters.Add("status", Org.OpenAPITools.Client.ClientUtils.ParameterToString(status)); // form parameter + } + + // authentication (petstore_auth) required + // oauth required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + requestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + + // make the HTTP request + + var response = this.Client.Post("/pet/{petId}", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("UpdatePetWithForm", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// Updates a pet in the store with form data + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be updated + /// Updated name of the pet (optional) + /// Updated status of the pet (optional) + /// Task of void + public async System.Threading.Tasks.Task UpdatePetWithFormAsync (long petId, string name = null, string status = null) + { + await UpdatePetWithFormAsyncWithHttpInfo(petId, name, status); + + } + + /// + /// Updates a pet in the store with form data + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be updated + /// Updated name of the pet (optional) + /// Updated status of the pet (optional) + /// Task of ApiResponse + public async System.Threading.Tasks.Task> UpdatePetWithFormAsyncWithHttpInfo (long petId, string name = null, string status = null) + { + // verify the required parameter 'petId' is set + if (petId == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'petId' when calling PetApi->UpdatePetWithForm"); + + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + "application/x-www-form-urlencoded" + }; + + // to determine the Accept header + String[] @accepts = new String[] { + }; + + foreach (var contentType in @contentTypes) + requestOptions.HeaderParameters.Add("Content-Type", contentType); + + foreach (var accept in @accepts) + requestOptions.HeaderParameters.Add("Accept", accept); + + if (petId != null) + requestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter + if (name != null) + { + requestOptions.FormParameters.Add("name", Org.OpenAPITools.Client.ClientUtils.ParameterToString(name)); // form parameter + } + if (status != null) + { + requestOptions.FormParameters.Add("status", Org.OpenAPITools.Client.ClientUtils.ParameterToString(status)); // form parameter + } + + // authentication (petstore_auth) required + // oauth required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + requestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + + // make the HTTP request + + var response = await this.AsynchronousClient.PostAsync("/pet/{petId}", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("UpdatePetWithForm", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// uploads an image + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// Additional data to pass to server (optional) + /// file to upload (optional) + /// ApiResponse + public ApiResponse UploadFile (long petId, string additionalMetadata = null, System.IO.Stream file = null) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = UploadFileWithHttpInfo(petId, additionalMetadata, file); + return localVarResponse.Data; + } + + /// + /// uploads an image + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// Additional data to pass to server (optional) + /// file to upload (optional) + /// ApiResponse of ApiResponse + public Org.OpenAPITools.Client.ApiResponse< ApiResponse > UploadFileWithHttpInfo (long petId, string additionalMetadata = null, System.IO.Stream file = null) + { + // verify the required parameter 'petId' is set + if (petId == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'petId' when calling PetApi->UploadFile"); + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + "multipart/form-data" + }; + + // to determine the Accept header + String[] @accepts = new String[] { + "application/json" + }; + + var localVarConentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(@contentTypes); + if (localVarConentType != null) requestOptions.HeaderParameters.Add("Content-Type", localVarConentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(@accepts); + if (localVarAccept != null) requestOptions.HeaderParameters.Add("Accept", localVarAccept); + + if (petId != null) + requestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter + if (additionalMetadata != null) + { + requestOptions.FormParameters.Add("additionalMetadata", Org.OpenAPITools.Client.ClientUtils.ParameterToString(additionalMetadata)); // form parameter + } + if (file != null) + { + requestOptions.FileParameters.Add("file", file); + } + + // authentication (petstore_auth) required + // oauth required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + requestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + + // make the HTTP request + + var response = this.Client.Post< ApiResponse >("/pet/{petId}/uploadImage", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("UploadFile", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// uploads an image + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// Additional data to pass to server (optional) + /// file to upload (optional) + /// Task of ApiResponse + public async System.Threading.Tasks.Task UploadFileAsync (long petId, string additionalMetadata = null, System.IO.Stream file = null) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await UploadFileAsyncWithHttpInfo(petId, additionalMetadata, file); + return localVarResponse.Data; + + } + + /// + /// uploads an image + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// Additional data to pass to server (optional) + /// file to upload (optional) + /// Task of ApiResponse (ApiResponse) + public async System.Threading.Tasks.Task> UploadFileAsyncWithHttpInfo (long petId, string additionalMetadata = null, System.IO.Stream file = null) + { + // verify the required parameter 'petId' is set + if (petId == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'petId' when calling PetApi->UploadFile"); + + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + "multipart/form-data" + }; + + // to determine the Accept header + String[] @accepts = new String[] { + "application/json" + }; + + foreach (var contentType in @contentTypes) + requestOptions.HeaderParameters.Add("Content-Type", contentType); + + foreach (var accept in @accepts) + requestOptions.HeaderParameters.Add("Accept", accept); + + if (petId != null) + requestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter + if (additionalMetadata != null) + { + requestOptions.FormParameters.Add("additionalMetadata", Org.OpenAPITools.Client.ClientUtils.ParameterToString(additionalMetadata)); // form parameter + } + if (file != null) + { + requestOptions.FileParameters.Add("file", file); + } + + // authentication (petstore_auth) required + // oauth required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + requestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + + // make the HTTP request + + var response = await this.AsynchronousClient.PostAsync("/pet/{petId}/uploadImage", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("UploadFile", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// 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) + { + Org.OpenAPITools.Client.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 Org.OpenAPITools.Client.ApiResponse< ApiResponse > UploadFileWithRequiredFileWithHttpInfo (long petId, System.IO.Stream requiredFile, string additionalMetadata = null) + { + // verify the required parameter 'petId' is set + if (petId == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'petId' when calling PetApi->UploadFileWithRequiredFile"); + + // verify the required parameter 'requiredFile' is set + if (requiredFile == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredFile' when calling PetApi->UploadFileWithRequiredFile"); + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + "multipart/form-data" + }; + + // to determine the Accept header + String[] @accepts = new String[] { + "application/json" + }; + + var localVarConentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(@contentTypes); + if (localVarConentType != null) requestOptions.HeaderParameters.Add("Content-Type", localVarConentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(@accepts); + if (localVarAccept != null) requestOptions.HeaderParameters.Add("Accept", localVarAccept); + + if (petId != null) + requestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter + if (additionalMetadata != null) + { + requestOptions.FormParameters.Add("additionalMetadata", Org.OpenAPITools.Client.ClientUtils.ParameterToString(additionalMetadata)); // form parameter + } + if (requiredFile != null) + { + requestOptions.FileParameters.Add("requiredFile", requiredFile); + } + + // authentication (petstore_auth) required + // oauth required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + requestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + + // make the HTTP request + + var response = this.Client.Post< ApiResponse >("/fake/{petId}/uploadImageWithRequiredFile", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("UploadFileWithRequiredFile", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// 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) + { + Org.OpenAPITools.Client.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 Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'petId' when calling PetApi->UploadFileWithRequiredFile"); + + // verify the required parameter 'requiredFile' is set + if (requiredFile == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredFile' when calling PetApi->UploadFileWithRequiredFile"); + + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + "multipart/form-data" + }; + + // to determine the Accept header + String[] @accepts = new String[] { + "application/json" + }; + + foreach (var contentType in @contentTypes) + requestOptions.HeaderParameters.Add("Content-Type", contentType); + + foreach (var accept in @accepts) + requestOptions.HeaderParameters.Add("Accept", accept); + + if (petId != null) + requestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter + if (additionalMetadata != null) + { + requestOptions.FormParameters.Add("additionalMetadata", Org.OpenAPITools.Client.ClientUtils.ParameterToString(additionalMetadata)); // form parameter + } + if (requiredFile != null) + { + requestOptions.FileParameters.Add("requiredFile", requiredFile); + } + + // authentication (petstore_auth) required + // oauth required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + requestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + + // make the HTTP request + + var response = await this.AsynchronousClient.PostAsync("/fake/{petId}/uploadImageWithRequiredFile", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("UploadFileWithRequiredFile", response); + if (exception != null) throw exception; + } + + return response; + } + + } +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Api/StoreApi.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Api/StoreApi.cs new file mode 100644 index 00000000000..25d14b5a549 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Api/StoreApi.cs @@ -0,0 +1,780 @@ +/* + * 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.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Net; +using System.Net.Mime; +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 IStoreApiSync : IApiAccessor + { + #region Synchronous Operations + /// + /// Delete purchase order by ID + /// + /// + /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// Thrown when fails to make API call + /// ID of the order that needs to be deleted + /// + 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 + /// + /// Thrown when fails to make API call + /// ID of the order that needs to be deleted + /// ApiResponse of Object(void) + ApiResponse DeleteOrderWithHttpInfo (string orderId); + /// + /// Returns pet inventories by status + /// + /// + /// Returns a map of status codes to quantities + /// + /// Thrown when fails to make API call + /// Dictionary<string, int> + Dictionary GetInventory (); + + /// + /// Returns pet inventories by status + /// + /// + /// Returns a map of status codes to quantities + /// + /// Thrown when fails to make API call + /// ApiResponse of Dictionary<string, int> + ApiResponse> GetInventoryWithHttpInfo (); + /// + /// Find purchase order by ID + /// + /// + /// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be fetched + /// Order + 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 + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be fetched + /// ApiResponse of Order + ApiResponse GetOrderByIdWithHttpInfo (long orderId); + /// + /// Place an order for a pet + /// + /// + /// + /// + /// Thrown when fails to make API call + /// order placed for purchasing the pet + /// Order + Order PlaceOrder (Order body); + + /// + /// Place an order for a pet + /// + /// + /// + /// + /// Thrown when fails to make API call + /// order placed for purchasing the pet + /// ApiResponse of Order + ApiResponse PlaceOrderWithHttpInfo (Order body); + #endregion Synchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IStoreApiAsync : IApiAccessor + { + #region Asynchronous Operations + /// + /// Delete purchase order by ID + /// + /// + /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// Thrown when fails to make API call + /// ID of the order that needs to be deleted + /// Task of void + System.Threading.Tasks.Task DeleteOrderAsync (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 + /// + /// Thrown when fails to make API call + /// ID of the order that needs to be deleted + /// Task of ApiResponse + System.Threading.Tasks.Task> DeleteOrderAsyncWithHttpInfo (string orderId); + /// + /// Returns pet inventories by status + /// + /// + /// Returns a map of status codes to quantities + /// + /// Thrown when fails to make API call + /// Task of Dictionary<string, int> + System.Threading.Tasks.Task> GetInventoryAsync (); + + /// + /// Returns pet inventories by status + /// + /// + /// Returns a map of status codes to quantities + /// + /// Thrown when fails to make API call + /// Task of ApiResponse (Dictionary<string, int>) + System.Threading.Tasks.Task>> GetInventoryAsyncWithHttpInfo (); + /// + /// Find purchase order by ID + /// + /// + /// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be fetched + /// Task of Order + System.Threading.Tasks.Task GetOrderByIdAsync (long orderId); + + /// + /// Find purchase order by ID + /// + /// + /// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be fetched + /// Task of ApiResponse (Order) + System.Threading.Tasks.Task> GetOrderByIdAsyncWithHttpInfo (long orderId); + /// + /// Place an order for a pet + /// + /// + /// + /// + /// Thrown when fails to make API call + /// order placed for purchasing the pet + /// Task of Order + System.Threading.Tasks.Task PlaceOrderAsync (Order body); + + /// + /// Place an order for a pet + /// + /// + /// + /// + /// Thrown when fails to make API call + /// order placed for purchasing the pet + /// Task of ApiResponse (Order) + System.Threading.Tasks.Task> PlaceOrderAsyncWithHttpInfo (Order body); + #endregion Asynchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IStoreApi : IStoreApiSync, IStoreApiAsync + { + + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class StoreApi : IStoreApi + { + private Org.OpenAPITools.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + + /// + /// Initializes a new instance of the class. + /// + /// + public StoreApi() : this((string) null) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// + public StoreApi(String basePath) + { + this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( + Org.OpenAPITools.Client.GlobalConfiguration.Instance, + new Org.OpenAPITools.Client.Configuration { BasePath = basePath } + ); + this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using Configuration object + /// + /// An instance of Configuration + /// + public StoreApi(Org.OpenAPITools.Client.Configuration configuration) + { + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( + Org.OpenAPITools.Client.GlobalConfiguration.Instance, + configuration + ); + this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using a Configuration object and client instance. + /// + /// The client interface for synchronous API access. + /// The client interface for asynchronous API access. + /// The configuration object. + public StoreApi(Org.OpenAPITools.Client.ISynchronousClient client,Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration) + { + if(client == null) throw new ArgumentNullException("client"); + if(asyncClient == null) throw new ArgumentNullException("asyncClient"); + if(configuration == null) throw new ArgumentNullException("configuration"); + + this.Client = client; + this.AsynchronousClient = asyncClient; + this.Configuration = configuration; + this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// The client for accessing this underlying API asynchronously. + /// + public Org.OpenAPITools.Client.IAsynchronousClient AsynchronousClient { get; set; } + + /// + /// The client for accessing this underlying API synchronously. + /// + public Org.OpenAPITools.Client.ISynchronousClient Client { get; set; } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public String GetBasePath() + { + return this.Configuration.BasePath; + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Org.OpenAPITools.Client.IReadableConfiguration Configuration {get; set;} + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + + /// + /// Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// Thrown when fails to make API call + /// ID of the order that needs to be deleted + /// + public void DeleteOrder (string orderId) + { + DeleteOrderWithHttpInfo(orderId); + } + + /// + /// Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// Thrown when fails to make API call + /// ID of the order that needs to be deleted + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse DeleteOrderWithHttpInfo (string orderId) + { + // verify the required parameter 'orderId' is set + if (orderId == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'orderId' when calling StoreApi->DeleteOrder"); + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + }; + + // to determine the Accept header + String[] @accepts = new String[] { + }; + + var localVarConentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(@contentTypes); + if (localVarConentType != null) requestOptions.HeaderParameters.Add("Content-Type", localVarConentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(@accepts); + if (localVarAccept != null) requestOptions.HeaderParameters.Add("Accept", localVarAccept); + + if (orderId != null) + requestOptions.PathParameters.Add("order_id", Org.OpenAPITools.Client.ClientUtils.ParameterToString(orderId)); // path parameter + + + // make the HTTP request + + var response = this.Client.Delete("/store/order/{order_id}", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("DeleteOrder", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// Thrown when fails to make API call + /// ID of the order that needs to be deleted + /// Task of void + public async System.Threading.Tasks.Task DeleteOrderAsync (string orderId) + { + await DeleteOrderAsyncWithHttpInfo(orderId); + + } + + /// + /// Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// Thrown when fails to make API call + /// ID of the order that needs to be deleted + /// Task of ApiResponse + public async System.Threading.Tasks.Task> DeleteOrderAsyncWithHttpInfo (string orderId) + { + // verify the required parameter 'orderId' is set + if (orderId == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'orderId' when calling StoreApi->DeleteOrder"); + + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + }; + + // to determine the Accept header + String[] @accepts = new String[] { + }; + + foreach (var contentType in @contentTypes) + requestOptions.HeaderParameters.Add("Content-Type", contentType); + + foreach (var accept in @accepts) + requestOptions.HeaderParameters.Add("Accept", accept); + + if (orderId != null) + requestOptions.PathParameters.Add("order_id", Org.OpenAPITools.Client.ClientUtils.ParameterToString(orderId)); // path parameter + + + // make the HTTP request + + var response = await this.AsynchronousClient.DeleteAsync("/store/order/{order_id}", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("DeleteOrder", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// Returns pet inventories by status Returns a map of status codes to quantities + /// + /// Thrown when fails to make API call + /// Dictionary<string, int> + public Dictionary GetInventory () + { + Org.OpenAPITools.Client.ApiResponse> localVarResponse = GetInventoryWithHttpInfo(); + return localVarResponse.Data; + } + + /// + /// Returns pet inventories by status Returns a map of status codes to quantities + /// + /// Thrown when fails to make API call + /// ApiResponse of Dictionary<string, int> + public Org.OpenAPITools.Client.ApiResponse< Dictionary > GetInventoryWithHttpInfo () + { + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + }; + + // to determine the Accept header + String[] @accepts = new String[] { + "application/json" + }; + + var localVarConentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(@contentTypes); + if (localVarConentType != null) requestOptions.HeaderParameters.Add("Content-Type", localVarConentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(@accepts); + if (localVarAccept != null) requestOptions.HeaderParameters.Add("Accept", localVarAccept); + + + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key"))) + { + requestOptions.HeaderParameters.Add("api_key", this.Configuration.GetApiKeyWithPrefix("api_key")); + } + + // make the HTTP request + + var response = this.Client.Get< Dictionary >("/store/inventory", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("GetInventory", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// Returns pet inventories by status Returns a map of status codes to quantities + /// + /// Thrown when fails to make API call + /// Task of Dictionary<string, int> + public async System.Threading.Tasks.Task> GetInventoryAsync () + { + Org.OpenAPITools.Client.ApiResponse> localVarResponse = await GetInventoryAsyncWithHttpInfo(); + return localVarResponse.Data; + + } + + /// + /// Returns pet inventories by status Returns a map of status codes to quantities + /// + /// Thrown when fails to make API call + /// Task of ApiResponse (Dictionary<string, int>) + public async System.Threading.Tasks.Task>> GetInventoryAsyncWithHttpInfo () + { + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + }; + + // to determine the Accept header + String[] @accepts = new String[] { + "application/json" + }; + + foreach (var contentType in @contentTypes) + requestOptions.HeaderParameters.Add("Content-Type", contentType); + + foreach (var accept in @accepts) + requestOptions.HeaderParameters.Add("Accept", accept); + + + // authentication (api_key) required + if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key"))) + { + requestOptions.HeaderParameters.Add("api_key", this.Configuration.GetApiKeyWithPrefix("api_key")); + } + + // make the HTTP request + + var response = await this.AsynchronousClient.GetAsync>("/store/inventory", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("GetInventory", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be fetched + /// Order + public Order GetOrderById (long orderId) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = GetOrderByIdWithHttpInfo(orderId); + return localVarResponse.Data; + } + + /// + /// Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be fetched + /// ApiResponse of Order + public Org.OpenAPITools.Client.ApiResponse< Order > GetOrderByIdWithHttpInfo (long orderId) + { + // verify the required parameter 'orderId' is set + if (orderId == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'orderId' when calling StoreApi->GetOrderById"); + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + }; + + // to determine the Accept header + String[] @accepts = new String[] { + "application/xml", + "application/json" + }; + + var localVarConentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(@contentTypes); + if (localVarConentType != null) requestOptions.HeaderParameters.Add("Content-Type", localVarConentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(@accepts); + if (localVarAccept != null) requestOptions.HeaderParameters.Add("Accept", localVarAccept); + + if (orderId != null) + requestOptions.PathParameters.Add("order_id", Org.OpenAPITools.Client.ClientUtils.ParameterToString(orderId)); // path parameter + + + // make the HTTP request + + var response = this.Client.Get< Order >("/store/order/{order_id}", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("GetOrderById", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be fetched + /// Task of Order + public async System.Threading.Tasks.Task GetOrderByIdAsync (long orderId) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await GetOrderByIdAsyncWithHttpInfo(orderId); + return localVarResponse.Data; + + } + + /// + /// Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be fetched + /// Task of ApiResponse (Order) + public async System.Threading.Tasks.Task> GetOrderByIdAsyncWithHttpInfo (long orderId) + { + // verify the required parameter 'orderId' is set + if (orderId == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'orderId' when calling StoreApi->GetOrderById"); + + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + }; + + // to determine the Accept header + String[] @accepts = new String[] { + "application/xml", + "application/json" + }; + + foreach (var contentType in @contentTypes) + requestOptions.HeaderParameters.Add("Content-Type", contentType); + + foreach (var accept in @accepts) + requestOptions.HeaderParameters.Add("Accept", accept); + + if (orderId != null) + requestOptions.PathParameters.Add("order_id", Org.OpenAPITools.Client.ClientUtils.ParameterToString(orderId)); // path parameter + + + // make the HTTP request + + var response = await this.AsynchronousClient.GetAsync("/store/order/{order_id}", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("GetOrderById", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// Place an order for a pet + /// + /// Thrown when fails to make API call + /// order placed for purchasing the pet + /// Order + public Order PlaceOrder (Order body) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = PlaceOrderWithHttpInfo(body); + return localVarResponse.Data; + } + + /// + /// Place an order for a pet + /// + /// Thrown when fails to make API call + /// order placed for purchasing the pet + /// ApiResponse of Order + public Org.OpenAPITools.Client.ApiResponse< Order > PlaceOrderWithHttpInfo (Order body) + { + // verify the required parameter 'body' is set + if (body == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'body' when calling StoreApi->PlaceOrder"); + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + }; + + // to determine the Accept header + String[] @accepts = new String[] { + "application/xml", + "application/json" + }; + + var localVarConentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(@contentTypes); + if (localVarConentType != null) requestOptions.HeaderParameters.Add("Content-Type", localVarConentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(@accepts); + if (localVarAccept != null) requestOptions.HeaderParameters.Add("Accept", localVarAccept); + + requestOptions.Data = body; + + + // make the HTTP request + + var response = this.Client.Post< Order >("/store/order", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("PlaceOrder", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// Place an order for a pet + /// + /// Thrown when fails to make API call + /// order placed for purchasing the pet + /// Task of Order + public async System.Threading.Tasks.Task PlaceOrderAsync (Order body) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await PlaceOrderAsyncWithHttpInfo(body); + return localVarResponse.Data; + + } + + /// + /// Place an order for a pet + /// + /// Thrown when fails to make API call + /// order placed for purchasing the pet + /// Task of ApiResponse (Order) + public async System.Threading.Tasks.Task> PlaceOrderAsyncWithHttpInfo (Order body) + { + // verify the required parameter 'body' is set + if (body == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'body' when calling StoreApi->PlaceOrder"); + + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + }; + + // to determine the Accept header + String[] @accepts = new String[] { + "application/xml", + "application/json" + }; + + foreach (var contentType in @contentTypes) + requestOptions.HeaderParameters.Add("Content-Type", contentType); + + foreach (var accept in @accepts) + requestOptions.HeaderParameters.Add("Accept", accept); + + requestOptions.Data = body; + + + // make the HTTP request + + var response = await this.AsynchronousClient.PostAsync("/store/order", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("PlaceOrder", response); + if (exception != null) throw exception; + } + + return response; + } + + } +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Api/UserApi.cs new file mode 100644 index 00000000000..58721f5e62e --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Api/UserApi.cs @@ -0,0 +1,1448 @@ +/* + * 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.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Net; +using System.Net.Mime; +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 IUserApiSync : IApiAccessor + { + #region Synchronous Operations + /// + /// Create user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// Created user object + /// + void CreateUser (User body); + + /// + /// Create user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// Created user object + /// ApiResponse of Object(void) + ApiResponse CreateUserWithHttpInfo (User body); + /// + /// Creates list of users with given input array + /// + /// + /// + /// + /// Thrown when fails to make API call + /// List of user object + /// + void CreateUsersWithArrayInput (List body); + + /// + /// Creates list of users with given input array + /// + /// + /// + /// + /// Thrown when fails to make API call + /// List of user object + /// ApiResponse of Object(void) + ApiResponse CreateUsersWithArrayInputWithHttpInfo (List body); + /// + /// Creates list of users with given input array + /// + /// + /// + /// + /// Thrown when fails to make API call + /// List of user object + /// + void CreateUsersWithListInput (List body); + + /// + /// Creates list of users with given input array + /// + /// + /// + /// + /// Thrown when fails to make API call + /// List of user object + /// ApiResponse of Object(void) + ApiResponse CreateUsersWithListInputWithHttpInfo (List body); + /// + /// Delete user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// The name that needs to be deleted + /// + void DeleteUser (string username); + + /// + /// Delete user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// The name that needs to be deleted + /// ApiResponse of Object(void) + ApiResponse DeleteUserWithHttpInfo (string username); + /// + /// Get user by user name + /// + /// + /// + /// + /// Thrown when fails to make API call + /// The name that needs to be fetched. Use user1 for testing. + /// User + User GetUserByName (string username); + + /// + /// Get user by user name + /// + /// + /// + /// + /// Thrown when fails to make API call + /// The name that needs to be fetched. Use user1 for testing. + /// ApiResponse of User + ApiResponse GetUserByNameWithHttpInfo (string username); + /// + /// Logs user into the system + /// + /// + /// + /// + /// Thrown when fails to make API call + /// The user name for login + /// The password for login in clear text + /// string + string LoginUser (string username, string password); + + /// + /// Logs user into the system + /// + /// + /// + /// + /// Thrown when fails to make API call + /// The user name for login + /// The password for login in clear text + /// ApiResponse of string + ApiResponse LoginUserWithHttpInfo (string username, string password); + /// + /// Logs out current logged in user session + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + void LogoutUser (); + + /// + /// Logs out current logged in user session + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ApiResponse of Object(void) + ApiResponse LogoutUserWithHttpInfo (); + /// + /// Updated user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// name that need to be deleted + /// Updated user object + /// + void UpdateUser (string username, User body); + + /// + /// Updated user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// name that need to be deleted + /// Updated user object + /// ApiResponse of Object(void) + ApiResponse UpdateUserWithHttpInfo (string username, User body); + #endregion Synchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IUserApiAsync : IApiAccessor + { + #region Asynchronous Operations + /// + /// Create user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// Created user object + /// Task of void + System.Threading.Tasks.Task CreateUserAsync (User body); + + /// + /// Create user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// Created user object + /// Task of ApiResponse + System.Threading.Tasks.Task> CreateUserAsyncWithHttpInfo (User body); + /// + /// Creates list of users with given input array + /// + /// + /// + /// + /// Thrown when fails to make API call + /// List of user object + /// Task of void + System.Threading.Tasks.Task CreateUsersWithArrayInputAsync (List body); + + /// + /// Creates list of users with given input array + /// + /// + /// + /// + /// Thrown when fails to make API call + /// List of user object + /// Task of ApiResponse + System.Threading.Tasks.Task> CreateUsersWithArrayInputAsyncWithHttpInfo (List body); + /// + /// Creates list of users with given input array + /// + /// + /// + /// + /// Thrown when fails to make API call + /// List of user object + /// Task of void + System.Threading.Tasks.Task CreateUsersWithListInputAsync (List body); + + /// + /// Creates list of users with given input array + /// + /// + /// + /// + /// Thrown when fails to make API call + /// List of user object + /// Task of ApiResponse + System.Threading.Tasks.Task> CreateUsersWithListInputAsyncWithHttpInfo (List body); + /// + /// Delete user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// The name that needs to be deleted + /// Task of void + System.Threading.Tasks.Task DeleteUserAsync (string username); + + /// + /// Delete user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// The name that needs to be deleted + /// Task of ApiResponse + System.Threading.Tasks.Task> DeleteUserAsyncWithHttpInfo (string username); + /// + /// Get user by user name + /// + /// + /// + /// + /// Thrown when fails to make API call + /// The name that needs to be fetched. Use user1 for testing. + /// Task of User + System.Threading.Tasks.Task GetUserByNameAsync (string username); + + /// + /// Get user by user name + /// + /// + /// + /// + /// Thrown when fails to make API call + /// The name that needs to be fetched. Use user1 for testing. + /// Task of ApiResponse (User) + System.Threading.Tasks.Task> GetUserByNameAsyncWithHttpInfo (string username); + /// + /// Logs user into the system + /// + /// + /// + /// + /// Thrown when fails to make API call + /// The user name for login + /// The password for login in clear text + /// Task of string + System.Threading.Tasks.Task LoginUserAsync (string username, string password); + + /// + /// Logs user into the system + /// + /// + /// + /// + /// Thrown when fails to make API call + /// The user name for login + /// The password for login in clear text + /// Task of ApiResponse (string) + System.Threading.Tasks.Task> LoginUserAsyncWithHttpInfo (string username, string password); + /// + /// Logs out current logged in user session + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Task of void + System.Threading.Tasks.Task LogoutUserAsync (); + + /// + /// Logs out current logged in user session + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Task of ApiResponse + System.Threading.Tasks.Task> LogoutUserAsyncWithHttpInfo (); + /// + /// Updated user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// name that need to be deleted + /// Updated user object + /// Task of void + System.Threading.Tasks.Task UpdateUserAsync (string username, User body); + + /// + /// Updated user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// name that need to be deleted + /// Updated user object + /// Task of ApiResponse + System.Threading.Tasks.Task> UpdateUserAsyncWithHttpInfo (string username, User body); + #endregion Asynchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IUserApi : IUserApiSync, IUserApiAsync + { + + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class UserApi : IUserApi + { + private Org.OpenAPITools.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + + /// + /// Initializes a new instance of the class. + /// + /// + public UserApi() : this((string) null) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// + public UserApi(String basePath) + { + this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( + Org.OpenAPITools.Client.GlobalConfiguration.Instance, + new Org.OpenAPITools.Client.Configuration { BasePath = basePath } + ); + this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using Configuration object + /// + /// An instance of Configuration + /// + public UserApi(Org.OpenAPITools.Client.Configuration configuration) + { + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( + Org.OpenAPITools.Client.GlobalConfiguration.Instance, + configuration + ); + this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using a Configuration object and client instance. + /// + /// The client interface for synchronous API access. + /// The client interface for asynchronous API access. + /// The configuration object. + public UserApi(Org.OpenAPITools.Client.ISynchronousClient client,Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration) + { + if(client == null) throw new ArgumentNullException("client"); + if(asyncClient == null) throw new ArgumentNullException("asyncClient"); + if(configuration == null) throw new ArgumentNullException("configuration"); + + this.Client = client; + this.AsynchronousClient = asyncClient; + this.Configuration = configuration; + this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// The client for accessing this underlying API asynchronously. + /// + public Org.OpenAPITools.Client.IAsynchronousClient AsynchronousClient { get; set; } + + /// + /// The client for accessing this underlying API synchronously. + /// + public Org.OpenAPITools.Client.ISynchronousClient Client { get; set; } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public String GetBasePath() + { + return this.Configuration.BasePath; + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Org.OpenAPITools.Client.IReadableConfiguration Configuration {get; set;} + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + + /// + /// Create user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// Created user object + /// + public void CreateUser (User body) + { + CreateUserWithHttpInfo(body); + } + + /// + /// Create user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// Created user object + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse CreateUserWithHttpInfo (User body) + { + // verify the required parameter 'body' is set + if (body == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'body' when calling UserApi->CreateUser"); + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + }; + + // to determine the Accept header + String[] @accepts = new String[] { + }; + + var localVarConentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(@contentTypes); + if (localVarConentType != null) requestOptions.HeaderParameters.Add("Content-Type", localVarConentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(@accepts); + if (localVarAccept != null) requestOptions.HeaderParameters.Add("Accept", localVarAccept); + + requestOptions.Data = body; + + + // make the HTTP request + + var response = this.Client.Post("/user", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("CreateUser", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// Create user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// Created user object + /// Task of void + public async System.Threading.Tasks.Task CreateUserAsync (User body) + { + await CreateUserAsyncWithHttpInfo(body); + + } + + /// + /// Create user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// Created user object + /// Task of ApiResponse + public async System.Threading.Tasks.Task> CreateUserAsyncWithHttpInfo (User body) + { + // verify the required parameter 'body' is set + if (body == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'body' when calling UserApi->CreateUser"); + + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + }; + + // to determine the Accept header + String[] @accepts = new String[] { + }; + + foreach (var contentType in @contentTypes) + requestOptions.HeaderParameters.Add("Content-Type", contentType); + + foreach (var accept in @accepts) + requestOptions.HeaderParameters.Add("Accept", accept); + + requestOptions.Data = body; + + + // make the HTTP request + + var response = await this.AsynchronousClient.PostAsync("/user", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("CreateUser", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// Creates list of users with given input array + /// + /// Thrown when fails to make API call + /// List of user object + /// + public void CreateUsersWithArrayInput (List body) + { + CreateUsersWithArrayInputWithHttpInfo(body); + } + + /// + /// Creates list of users with given input array + /// + /// Thrown when fails to make API call + /// List of user object + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse CreateUsersWithArrayInputWithHttpInfo (List body) + { + // verify the required parameter 'body' is set + if (body == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'body' when calling UserApi->CreateUsersWithArrayInput"); + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + }; + + // to determine the Accept header + String[] @accepts = new String[] { + }; + + var localVarConentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(@contentTypes); + if (localVarConentType != null) requestOptions.HeaderParameters.Add("Content-Type", localVarConentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(@accepts); + if (localVarAccept != null) requestOptions.HeaderParameters.Add("Accept", localVarAccept); + + requestOptions.Data = body; + + + // make the HTTP request + + var response = this.Client.Post("/user/createWithArray", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("CreateUsersWithArrayInput", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// Creates list of users with given input array + /// + /// Thrown when fails to make API call + /// List of user object + /// Task of void + public async System.Threading.Tasks.Task CreateUsersWithArrayInputAsync (List body) + { + await CreateUsersWithArrayInputAsyncWithHttpInfo(body); + + } + + /// + /// Creates list of users with given input array + /// + /// Thrown when fails to make API call + /// List of user object + /// Task of ApiResponse + public async System.Threading.Tasks.Task> CreateUsersWithArrayInputAsyncWithHttpInfo (List body) + { + // verify the required parameter 'body' is set + if (body == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'body' when calling UserApi->CreateUsersWithArrayInput"); + + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + }; + + // to determine the Accept header + String[] @accepts = new String[] { + }; + + foreach (var contentType in @contentTypes) + requestOptions.HeaderParameters.Add("Content-Type", contentType); + + foreach (var accept in @accepts) + requestOptions.HeaderParameters.Add("Accept", accept); + + requestOptions.Data = body; + + + // make the HTTP request + + var response = await this.AsynchronousClient.PostAsync("/user/createWithArray", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("CreateUsersWithArrayInput", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// Creates list of users with given input array + /// + /// Thrown when fails to make API call + /// List of user object + /// + public void CreateUsersWithListInput (List body) + { + CreateUsersWithListInputWithHttpInfo(body); + } + + /// + /// Creates list of users with given input array + /// + /// Thrown when fails to make API call + /// List of user object + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse CreateUsersWithListInputWithHttpInfo (List body) + { + // verify the required parameter 'body' is set + if (body == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'body' when calling UserApi->CreateUsersWithListInput"); + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + }; + + // to determine the Accept header + String[] @accepts = new String[] { + }; + + var localVarConentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(@contentTypes); + if (localVarConentType != null) requestOptions.HeaderParameters.Add("Content-Type", localVarConentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(@accepts); + if (localVarAccept != null) requestOptions.HeaderParameters.Add("Accept", localVarAccept); + + requestOptions.Data = body; + + + // make the HTTP request + + var response = this.Client.Post("/user/createWithList", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("CreateUsersWithListInput", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// Creates list of users with given input array + /// + /// Thrown when fails to make API call + /// List of user object + /// Task of void + public async System.Threading.Tasks.Task CreateUsersWithListInputAsync (List body) + { + await CreateUsersWithListInputAsyncWithHttpInfo(body); + + } + + /// + /// Creates list of users with given input array + /// + /// Thrown when fails to make API call + /// List of user object + /// Task of ApiResponse + public async System.Threading.Tasks.Task> CreateUsersWithListInputAsyncWithHttpInfo (List body) + { + // verify the required parameter 'body' is set + if (body == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'body' when calling UserApi->CreateUsersWithListInput"); + + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + }; + + // to determine the Accept header + String[] @accepts = new String[] { + }; + + foreach (var contentType in @contentTypes) + requestOptions.HeaderParameters.Add("Content-Type", contentType); + + foreach (var accept in @accepts) + requestOptions.HeaderParameters.Add("Accept", accept); + + requestOptions.Data = body; + + + // make the HTTP request + + var response = await this.AsynchronousClient.PostAsync("/user/createWithList", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("CreateUsersWithListInput", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// Delete user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// The name that needs to be deleted + /// + public void DeleteUser (string username) + { + DeleteUserWithHttpInfo(username); + } + + /// + /// Delete user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// The name that needs to be deleted + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse DeleteUserWithHttpInfo (string username) + { + // verify the required parameter 'username' is set + if (username == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'username' when calling UserApi->DeleteUser"); + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + }; + + // to determine the Accept header + String[] @accepts = new String[] { + }; + + var localVarConentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(@contentTypes); + if (localVarConentType != null) requestOptions.HeaderParameters.Add("Content-Type", localVarConentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(@accepts); + if (localVarAccept != null) requestOptions.HeaderParameters.Add("Accept", localVarAccept); + + if (username != null) + requestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter + + + // make the HTTP request + + var response = this.Client.Delete("/user/{username}", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("DeleteUser", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// Delete user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// The name that needs to be deleted + /// Task of void + public async System.Threading.Tasks.Task DeleteUserAsync (string username) + { + await DeleteUserAsyncWithHttpInfo(username); + + } + + /// + /// Delete user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// The name that needs to be deleted + /// Task of ApiResponse + public async System.Threading.Tasks.Task> DeleteUserAsyncWithHttpInfo (string username) + { + // verify the required parameter 'username' is set + if (username == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'username' when calling UserApi->DeleteUser"); + + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + }; + + // to determine the Accept header + String[] @accepts = new String[] { + }; + + foreach (var contentType in @contentTypes) + requestOptions.HeaderParameters.Add("Content-Type", contentType); + + foreach (var accept in @accepts) + requestOptions.HeaderParameters.Add("Accept", accept); + + if (username != null) + requestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter + + + // make the HTTP request + + var response = await this.AsynchronousClient.DeleteAsync("/user/{username}", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("DeleteUser", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// Get user by user name + /// + /// Thrown when fails to make API call + /// The name that needs to be fetched. Use user1 for testing. + /// User + public User GetUserByName (string username) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = GetUserByNameWithHttpInfo(username); + return localVarResponse.Data; + } + + /// + /// Get user by user name + /// + /// Thrown when fails to make API call + /// The name that needs to be fetched. Use user1 for testing. + /// ApiResponse of User + public Org.OpenAPITools.Client.ApiResponse< User > GetUserByNameWithHttpInfo (string username) + { + // verify the required parameter 'username' is set + if (username == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'username' when calling UserApi->GetUserByName"); + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + }; + + // to determine the Accept header + String[] @accepts = new String[] { + "application/xml", + "application/json" + }; + + var localVarConentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(@contentTypes); + if (localVarConentType != null) requestOptions.HeaderParameters.Add("Content-Type", localVarConentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(@accepts); + if (localVarAccept != null) requestOptions.HeaderParameters.Add("Accept", localVarAccept); + + if (username != null) + requestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter + + + // make the HTTP request + + var response = this.Client.Get< User >("/user/{username}", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("GetUserByName", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// Get user by user name + /// + /// Thrown when fails to make API call + /// The name that needs to be fetched. Use user1 for testing. + /// Task of User + public async System.Threading.Tasks.Task GetUserByNameAsync (string username) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await GetUserByNameAsyncWithHttpInfo(username); + return localVarResponse.Data; + + } + + /// + /// Get user by user name + /// + /// Thrown when fails to make API call + /// The name that needs to be fetched. Use user1 for testing. + /// Task of ApiResponse (User) + public async System.Threading.Tasks.Task> GetUserByNameAsyncWithHttpInfo (string username) + { + // verify the required parameter 'username' is set + if (username == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'username' when calling UserApi->GetUserByName"); + + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + }; + + // to determine the Accept header + String[] @accepts = new String[] { + "application/xml", + "application/json" + }; + + foreach (var contentType in @contentTypes) + requestOptions.HeaderParameters.Add("Content-Type", contentType); + + foreach (var accept in @accepts) + requestOptions.HeaderParameters.Add("Accept", accept); + + if (username != null) + requestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter + + + // make the HTTP request + + var response = await this.AsynchronousClient.GetAsync("/user/{username}", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("GetUserByName", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// Logs user into the system + /// + /// Thrown when fails to make API call + /// The user name for login + /// The password for login in clear text + /// string + public string LoginUser (string username, string password) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = LoginUserWithHttpInfo(username, password); + return localVarResponse.Data; + } + + /// + /// Logs user into the system + /// + /// Thrown when fails to make API call + /// The user name for login + /// The password for login in clear text + /// ApiResponse of string + public Org.OpenAPITools.Client.ApiResponse< string > LoginUserWithHttpInfo (string username, string password) + { + // verify the required parameter 'username' is set + if (username == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'username' when calling UserApi->LoginUser"); + + // verify the required parameter 'password' is set + if (password == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'password' when calling UserApi->LoginUser"); + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + }; + + // to determine the Accept header + String[] @accepts = new String[] { + "application/xml", + "application/json" + }; + + var localVarConentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(@contentTypes); + if (localVarConentType != null) requestOptions.HeaderParameters.Add("Content-Type", localVarConentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(@accepts); + if (localVarAccept != null) requestOptions.HeaderParameters.Add("Accept", localVarAccept); + + if (username != null) + { + foreach (var kvp in Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "username", username)) + { + foreach (var value in kvp.Value) + { + requestOptions.QueryParameters.Add(kvp.Key, value); + } + } + } + if (password != null) + { + foreach (var kvp in Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "password", password)) + { + foreach (var value in kvp.Value) + { + requestOptions.QueryParameters.Add(kvp.Key, value); + } + } + } + + + // make the HTTP request + + var response = this.Client.Get< string >("/user/login", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("LoginUser", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// Logs user into the system + /// + /// Thrown when fails to make API call + /// The user name for login + /// The password for login in clear text + /// Task of string + public async System.Threading.Tasks.Task LoginUserAsync (string username, string password) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await LoginUserAsyncWithHttpInfo(username, password); + return localVarResponse.Data; + + } + + /// + /// Logs user into the system + /// + /// Thrown when fails to make API call + /// The user name for login + /// The password for login in clear text + /// Task of ApiResponse (string) + public async System.Threading.Tasks.Task> LoginUserAsyncWithHttpInfo (string username, string password) + { + // verify the required parameter 'username' is set + if (username == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'username' when calling UserApi->LoginUser"); + + // verify the required parameter 'password' is set + if (password == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'password' when calling UserApi->LoginUser"); + + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + }; + + // to determine the Accept header + String[] @accepts = new String[] { + "application/xml", + "application/json" + }; + + foreach (var contentType in @contentTypes) + requestOptions.HeaderParameters.Add("Content-Type", contentType); + + foreach (var accept in @accepts) + requestOptions.HeaderParameters.Add("Accept", accept); + + if (username != null) + { + foreach (var kvp in Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "username", username)) + { + foreach (var value in kvp.Value) + { + requestOptions.QueryParameters.Add(kvp.Key, value); + } + } + } + if (password != null) + { + foreach (var kvp in Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "password", password)) + { + foreach (var value in kvp.Value) + { + requestOptions.QueryParameters.Add(kvp.Key, value); + } + } + } + + + // make the HTTP request + + var response = await this.AsynchronousClient.GetAsync("/user/login", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("LoginUser", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// Logs out current logged in user session + /// + /// Thrown when fails to make API call + /// + public void LogoutUser () + { + LogoutUserWithHttpInfo(); + } + + /// + /// Logs out current logged in user session + /// + /// Thrown when fails to make API call + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse LogoutUserWithHttpInfo () + { + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + }; + + // to determine the Accept header + String[] @accepts = new String[] { + }; + + var localVarConentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(@contentTypes); + if (localVarConentType != null) requestOptions.HeaderParameters.Add("Content-Type", localVarConentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(@accepts); + if (localVarAccept != null) requestOptions.HeaderParameters.Add("Accept", localVarAccept); + + + + // make the HTTP request + + var response = this.Client.Get("/user/logout", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("LogoutUser", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// Logs out current logged in user session + /// + /// Thrown when fails to make API call + /// Task of void + public async System.Threading.Tasks.Task LogoutUserAsync () + { + await LogoutUserAsyncWithHttpInfo(); + + } + + /// + /// Logs out current logged in user session + /// + /// Thrown when fails to make API call + /// Task of ApiResponse + public async System.Threading.Tasks.Task> LogoutUserAsyncWithHttpInfo () + { + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + }; + + // to determine the Accept header + String[] @accepts = new String[] { + }; + + foreach (var contentType in @contentTypes) + requestOptions.HeaderParameters.Add("Content-Type", contentType); + + foreach (var accept in @accepts) + requestOptions.HeaderParameters.Add("Accept", accept); + + + + // make the HTTP request + + var response = await this.AsynchronousClient.GetAsync("/user/logout", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("LogoutUser", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// Updated user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// name that need to be deleted + /// Updated user object + /// + public void UpdateUser (string username, User body) + { + UpdateUserWithHttpInfo(username, body); + } + + /// + /// Updated user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// name that need to be deleted + /// Updated user object + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse UpdateUserWithHttpInfo (string username, User body) + { + // verify the required parameter 'username' is set + if (username == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'username' when calling UserApi->UpdateUser"); + + // verify the required parameter 'body' is set + if (body == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'body' when calling UserApi->UpdateUser"); + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + }; + + // to determine the Accept header + String[] @accepts = new String[] { + }; + + var localVarConentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(@contentTypes); + if (localVarConentType != null) requestOptions.HeaderParameters.Add("Content-Type", localVarConentType); + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(@accepts); + if (localVarAccept != null) requestOptions.HeaderParameters.Add("Accept", localVarAccept); + + if (username != null) + requestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter + requestOptions.Data = body; + + + // make the HTTP request + + var response = this.Client.Put("/user/{username}", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("UpdateUser", response); + if (exception != null) throw exception; + } + + return response; + } + + /// + /// Updated user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// name that need to be deleted + /// Updated user object + /// Task of void + public async System.Threading.Tasks.Task UpdateUserAsync (string username, User body) + { + await UpdateUserAsyncWithHttpInfo(username, body); + + } + + /// + /// Updated user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// name that need to be deleted + /// Updated user object + /// Task of ApiResponse + public async System.Threading.Tasks.Task> UpdateUserAsyncWithHttpInfo (string username, User body) + { + // verify the required parameter 'username' is set + if (username == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'username' when calling UserApi->UpdateUser"); + + // verify the required parameter 'body' is set + if (body == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'body' when calling UserApi->UpdateUser"); + + + Org.OpenAPITools.Client.RequestOptions requestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + String[] @contentTypes = new String[] { + }; + + // to determine the Accept header + String[] @accepts = new String[] { + }; + + foreach (var contentType in @contentTypes) + requestOptions.HeaderParameters.Add("Content-Type", contentType); + + foreach (var accept in @accepts) + requestOptions.HeaderParameters.Add("Accept", accept); + + if (username != null) + requestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter + requestOptions.Data = body; + + + // make the HTTP request + + var response = await this.AsynchronousClient.PutAsync("/user/{username}", requestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception exception = this.ExceptionFactory("UpdateUser", response); + if (exception != null) throw exception; + } + + return response; + } + + } +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Client/ApiClient.cs new file mode 100644 index 00000000000..6879cf00a65 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Client/ApiClient.cs @@ -0,0 +1,634 @@ +/* + * 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.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using System.IO; +using System.Web; +using System.Linq; +using System.Net; +using System.Runtime.Serialization; +using System.Runtime.Serialization.Formatters; +using System.Text; +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; +using RestSharp; +using RestSharp.Deserializers; +using ErrorEventArgs = Newtonsoft.Json.Serialization.ErrorEventArgs; +using RestSharpMethod = RestSharp.Method; + +namespace Org.OpenAPITools.Client +{ + /// + /// Allows RestSharp to Serialize/Deserialize JSON using our custom logic, but only when ContentType is JSON. + /// + internal class CustomJsonCodec : RestSharp.Serializers.ISerializer, RestSharp.Deserializers.IDeserializer + { + private readonly IReadableConfiguration _configuration; + private readonly JsonSerializer _serializer; + private string _contentType = "application/json"; + private readonly JsonSerializerSettings _serializerSettings = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy() + { + OverrideSpecifiedNames = true + } + } + }; + + public CustomJsonCodec(IReadableConfiguration configuration) + { + _configuration = configuration; + _serializer = JsonSerializer.Create(_serializerSettings); + } + + public CustomJsonCodec(JsonSerializerSettings serializerSettings, IReadableConfiguration configuration) + { + _serializerSettings = serializerSettings; + _serializer = JsonSerializer.Create(_serializerSettings); + _configuration = configuration; + } + + public string Serialize(object obj) + { + String result = JsonConvert.SerializeObject(obj, _serializerSettings); + return result; + } + + public T Deserialize(IRestResponse response) + { + var result = (T) Deserialize(response, typeof(T)); + return result; + } + + /// + /// Deserialize the JSON string into a proper object. + /// + /// The HTTP response. + /// Object type. + /// Object representation of the JSON string. + internal object Deserialize(IRestResponse response, Type type) + { + IList headers = response.Headers; + if (type == typeof(byte[])) // return byte array + { + return response.RawBytes; + } + + // TODO: ? if (type.IsAssignableFrom(typeof(Stream))) + if (type == typeof(Stream)) + { + if (headers != null) + { + var filePath = String.IsNullOrEmpty(_configuration.TempFolderPath) + ? Path.GetTempPath() + : _configuration.TempFolderPath; + var regex = new Regex(@"Content-Disposition=.*filename=['""]?([^'""\s]+)['""]?$"); + foreach (var header in headers) + { + var match = regex.Match(header.ToString()); + if (match.Success) + { + string fileName = filePath + ClientUtils.SanitizeFilename(match.Groups[1].Value.Replace("\"", "").Replace("'", "")); + File.WriteAllBytes(fileName, response.RawBytes); + return new FileStream(fileName, FileMode.Open); + } + } + } + var stream = new MemoryStream(response.RawBytes); + return stream; + } + + if (type.Name.StartsWith("System.Nullable`1[[System.DateTime")) // return a datetime object + { + return DateTime.Parse(response.Content, null, System.Globalization.DateTimeStyles.RoundtripKind); + } + + if (type == typeof(String) || type.Name.StartsWith("System.Nullable")) // return primitive type + { + return ClientUtils.ConvertType(response.Content, type); + } + + // at this point, it must be a model (json) + try + { + return JsonConvert.DeserializeObject(response.Content, type, _serializerSettings); + } + catch (Exception e) + { + throw new ApiException(500, e.Message); + } + } + + public string RootElement { get; set; } + public string Namespace { get; set; } + public string DateFormat { get; set; } + + public string ContentType + { + get { return _contentType; } + set { throw new InvalidOperationException("Not allowed to set content type."); } + } + } + /// + /// Provides a default implementation of an Api client (both synchronous and asynchronous implementatios), + /// encapsulating general REST accessor use cases. + /// + public partial class ApiClient : ISynchronousClient, IAsynchronousClient + { + private readonly String _baseUrl; + + /// + /// Allows for extending request processing for generated code. + /// + /// The RestSharp request object + partial void InterceptRequest(IRestRequest request); + + /// + /// Allows for extending response processing for generated code. + /// + /// The RestSharp request object + /// The RestSharp response object + partial void InterceptResponse(IRestRequest request, IRestResponse response); + + /// + /// Initializes a new instance of the , defaulting to the global configurations' base url. + /// + public ApiClient() + { + _baseUrl = Org.OpenAPITools.Client.GlobalConfiguration.Instance.BasePath; + } + + /// + /// Initializes a new instance of the + /// + /// The target service's base path in URL format. + /// + public ApiClient(String basePath) + { + if (String.IsNullOrEmpty(basePath)) + throw new ArgumentException("basePath cannot be empty"); + + _baseUrl = basePath; + } + + /// + /// Constructs the RestSharp version of an http method + /// + /// Swagger Client Custom HttpMethod + /// RestSharp's HttpMethod instance. + /// + private RestSharpMethod Method(HttpMethod method) + { + RestSharpMethod other; + switch (method) + { + case HttpMethod.Get: + other = RestSharpMethod.GET; + break; + case HttpMethod.Post: + other = RestSharpMethod.POST; + break; + case HttpMethod.Put: + other = RestSharpMethod.PUT; + break; + case HttpMethod.Delete: + other = RestSharpMethod.DELETE; + break; + case HttpMethod.Head: + other = RestSharpMethod.HEAD; + break; + case HttpMethod.Options: + other = RestSharpMethod.OPTIONS; + break; + case HttpMethod.Patch: + other = RestSharpMethod.PATCH; + break; + default: + throw new ArgumentOutOfRangeException("method", method, null); + } + + return other; + } + + /// + /// Provides all logic for constructing a new RestSharp . + /// At this point, all information for querying the service is known. Here, it is simply + /// mapped into the RestSharp request. + /// + /// The http verb. + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// [private] A new RestRequest instance. + /// + private RestRequest newRequest( + HttpMethod method, + String path, + RequestOptions options, + IReadableConfiguration configuration) + { + if (path == null) throw new ArgumentNullException("path"); + if (options == null) throw new ArgumentNullException("options"); + if (configuration == null) throw new ArgumentNullException("configuration"); + + RestRequest request = new RestRequest(Method(method)) + { + Resource = path, + JsonSerializer = new CustomJsonCodec(configuration) + }; + + if (options.PathParameters != null) + { + foreach (var pathParam in options.PathParameters) + { + request.AddParameter(pathParam.Key, pathParam.Value, ParameterType.UrlSegment); + } + } + + if (options.QueryParameters != null) + { + foreach (var queryParam in options.QueryParameters) + { + foreach (var value in queryParam.Value) + { + request.AddQueryParameter(queryParam.Key, value); + } + } + } + + if (options.HeaderParameters != null) + { + foreach (var headerParam in options.HeaderParameters) + { + foreach (var value in headerParam.Value) + { + request.AddHeader(headerParam.Key, value); + } + } + } + + if (options.FormParameters != null) + { + foreach (var formParam in options.FormParameters) + { + request.AddParameter(formParam.Key, formParam.Value); + } + } + + if (options.Data != null) + { + if (options.HeaderParameters != null) + { + var contentTypes = options.HeaderParameters["Content-Type"]; + if (contentTypes == null || contentTypes.Any(header => header.Contains("application/json"))) + { + request.RequestFormat = DataFormat.Json; + } + else + { + // TODO: Generated client user should add additional handlers. RestSharp only supports XML and JSON, with XML as default. + } + } + else + { + // Here, we'll assume JSON APIs are more common. XML can be forced by adding produces/consumes to openapi spec explicitly. + request.RequestFormat = DataFormat.Json; + } + + request.AddBody(options.Data); + } + + if (options.FileParameters != null) + { + foreach (var fileParam in options.FileParameters) + { + var bytes = ClientUtils.ReadAsBytes(fileParam.Value); + var fileStream = fileParam.Value as FileStream; + if (fileStream != null) + FileParameter.Create(fileParam.Key, bytes, System.IO.Path.GetFileName(fileStream.Name)); + else + FileParameter.Create(fileParam.Key, bytes, "no_file_name_provided"); + } + } + + if (options.Cookies != null && options.Cookies.Count > 0) + { + foreach (var cookie in options.Cookies) + { + request.AddCookie(cookie.Name, cookie.Value); + } + } + + return request; + } + + private ApiResponse toApiResponse(IRestResponse response) + { + T result = response.Data; + var transformed = new ApiResponse(response.StatusCode, new Multimap(), result) + { + ErrorText = response.ErrorMessage, + Cookies = new List() + }; + + if (response.Headers != null) + { + foreach (var responseHeader in response.Headers) + { + transformed.Headers.Add(responseHeader.Name, ClientUtils.ParameterToString(responseHeader.Value)); + } + } + + if (response.Cookies != null) + { + foreach (var responseCookies in response.Cookies) + { + transformed.Cookies.Add( + new Cookie( + responseCookies.Name, + responseCookies.Value, + responseCookies.Path, + responseCookies.Domain) + ); + } + } + + return transformed; + } + + private async Task> Exec(RestRequest req, IReadableConfiguration configuration) + { + RestClient client = new RestClient(_baseUrl); + + client.ClearHandlers(); + var existingDeserializer = req.JsonSerializer as IDeserializer; + if (existingDeserializer != null) + { + client.AddHandler(existingDeserializer, "application/json", "text/json", "text/x-json", "text/javascript", "*+json"); + } + else + { + var codec = new CustomJsonCodec(configuration); + client.AddHandler(codec, "application/json", "text/json", "text/x-json", "text/javascript", "*+json"); + } + + client.AddHandler(new XmlDeserializer(), "application/xml", "text/xml", "*+xml", "*"); + + client.Timeout = configuration.Timeout; + + if (configuration.UserAgent != null) + { + client.UserAgent = configuration.UserAgent; + } + + InterceptRequest(req); + var response = await client.ExecuteTaskAsync(req); + InterceptResponse(req, response); + + var result = toApiResponse(response); + if (response.ErrorMessage != null) + { + result.ErrorText = response.ErrorMessage; + } + + if (response.Cookies != null && response.Cookies.Count > 0) + { + if(result.Cookies == null) result.Cookies = new List(); + foreach (var restResponseCookie in response.Cookies) + { + var cookie = new Cookie( + restResponseCookie.Name, + restResponseCookie.Value, + restResponseCookie.Path, + restResponseCookie.Domain + ) + { + Comment = restResponseCookie.Comment, + CommentUri = restResponseCookie.CommentUri, + Discard = restResponseCookie.Discard, + Expired = restResponseCookie.Expired, + Expires = restResponseCookie.Expires, + HttpOnly = restResponseCookie.HttpOnly, + Port = restResponseCookie.Port, + Secure = restResponseCookie.Secure, + Version = restResponseCookie.Version + }; + + result.Cookies.Add(cookie); + } + } + return result; + } + + #region IAsynchronousClient + /// + /// Make a HTTP GET request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public async Task> GetAsync(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return await Exec(newRequest(HttpMethod.Get, path, options, config), config); + } + + /// + /// Make a HTTP POST request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public async Task> PostAsync(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return await Exec(newRequest(HttpMethod.Post, path, options, config), config); + } + + /// + /// Make a HTTP PUT request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public async Task> PutAsync(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return await Exec(newRequest(HttpMethod.Put, path, options, config), config); + } + + /// + /// Make a HTTP DELETE request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public async Task> DeleteAsync(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return await Exec(newRequest(HttpMethod.Delete, path, options, config), config); + } + + /// + /// Make a HTTP HEAD request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public async Task> HeadAsync(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return await Exec(newRequest(HttpMethod.Head, path, options, config), config); + } + + /// + /// Make a HTTP OPTION request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public async Task> OptionsAsync(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return await Exec(newRequest(HttpMethod.Options, path, options, config), config); + } + + /// + /// Make a HTTP PATCH request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public async Task> PatchAsync(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return await Exec(newRequest(HttpMethod.Patch, path, options, config), config); + } + #endregion IAsynchronousClient + + #region ISynchronousClient + /// + /// Make a HTTP GET request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Get(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + return GetAsync(path, options, configuration).Result; + } + + /// + /// Make a HTTP POST request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Post(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + return PostAsync(path, options, configuration).Result; + } + + /// + /// Make a HTTP PUT request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Put(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + return PutAsync(path, options, configuration).Result; + } + + /// + /// Make a HTTP DELETE request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Delete(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + return DeleteAsync(path, options, configuration).Result; + } + + /// + /// Make a HTTP HEAD request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Head(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + return HeadAsync(path, options, configuration).Result; + } + + /// + /// Make a HTTP OPTION request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Options(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + return OptionsAsync(path, options, configuration).Result; + } + + /// + /// Make a HTTP PATCH request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Patch(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + return PatchAsync(path, options, configuration).Result; + } + #endregion ISynchronousClient + } +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Client/ApiException.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Client/ApiException.cs new file mode 100644 index 00000000000..c419432a04f --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Client/ApiException.cs @@ -0,0 +1,61 @@ +/* + * 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; + +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 dynamic 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, dynamic errorContent = null) : base(message) + { + this.ErrorCode = errorCode; + this.ErrorContent = errorContent; + } + } + +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Client/ApiResponse.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Client/ApiResponse.cs new file mode 100644 index 00000000000..7d5adfe9954 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Client/ApiResponse.cs @@ -0,0 +1,137 @@ +/* + * 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.Collections.Generic; +using System.Net; + +namespace Org.OpenAPITools.Client +{ + /// + /// Provides a non-generic contract for the ApiResponse wrapper. + /// + public interface IApiResponse + { + /// + /// The data type of + /// + Type ResponseType { get; } + + /// + /// The content of this response + /// + Object Content { get; } + + /// + /// Gets or sets the status code (HTTP status code) + /// + /// The status code. + HttpStatusCode StatusCode { get; } + + /// + /// Gets or sets the HTTP headers + /// + /// HTTP headers + Multimap Headers { get; } + + /// + /// Gets or sets any error text defined by the calling client. + /// + String ErrorText { get; set; } + + /// + /// Gets or sets any cookies passed along on the response. + /// + List Cookies { get; set; } + } + + /// + /// API Response + /// + public class ApiResponse : IApiResponse + { + #region Properties + + /// + /// Gets or sets the status code (HTTP status code) + /// + /// The status code. + public HttpStatusCode StatusCode { get; } + + /// + /// Gets or sets the HTTP headers + /// + /// HTTP headers + public Multimap Headers { get; } + + /// + /// Gets or sets the data (parsed HTTP body) + /// + /// The data. + public T Data { get; } + + /// + /// Gets or sets any error text defined by the calling client. + /// + public String ErrorText { get; set; } + + /// + /// Gets or sets any cookies passed along on the response. + /// + public List Cookies { get; set; } + + /// + /// The content of this response + /// + public Type ResponseType + { + get { return typeof(T); } + } + + /// + /// The data type of + /// + public object Content + { + get { return Data; } + } + + #endregion Properties + + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// HTTP headers. + /// Data (parsed HTTP body) + public ApiResponse(HttpStatusCode statusCode, Multimap headers, T data) + { + StatusCode = statusCode; + Headers = headers; + Data = data; + } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Data (parsed HTTP body) + public ApiResponse(HttpStatusCode statusCode, T data) + { + StatusCode = statusCode; + Data = data; + } + + #endregion Constructors + } +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Client/ClientUtils.cs new file mode 100644 index 00000000000..5825b8e790d --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -0,0 +1,272 @@ +/* + * 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.Collections; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using KellermanSoftware.CompareNetObjects; + +namespace Org.OpenAPITools.Client +{ + /// + /// Utility functions providing some benefit to API client consumers. + /// + public static class ClientUtils + { + /// + /// An instance of CompareLogic. + /// + public static CompareLogic compareLogic; + + /// + /// Static contstructor to initialise compareLogic. + /// + static ClientUtils() + { + compareLogic = new CompareLogic(); + } + + /// + /// Sanitize filename by removing the path + /// + /// Filename + /// Filename + public static string SanitizeFilename(string filename) + { + Match match = Regex.Match(filename, @".*[/\\](.*)$"); + return match.Success ? match.Groups[1].Value : filename; + } + + /// + /// Convert params to key/value pairs. + /// Use collectionFormat to properly format lists and collections. + /// + /// The swagger-supported collection format, one of: csv, tsv, ssv, pipes, multi + /// Key name. + /// Value object. + /// A multimap of keys with 1..n associated values. + public static Multimap ParameterToMultiMap(string collectionFormat, string name, object value) + { + var parameters = new Multimap(); + + if (IsCollection(value) && collectionFormat == "multi") + { + var valueCollection = value as IEnumerable; + if (valueCollection != null) + { + foreach (var item in valueCollection) + { + parameters.Add(name, ParameterToString(item)); + } + } + } + else + { + parameters.Add(name, ParameterToString(value)); + } + + return parameters; + } + + /// + /// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime. + /// If parameter is a list, join the list with ",". + /// Otherwise just return the string. + /// + /// The parameter (header, path, query, form). + /// An optional configuration instance, providing formatting options used in processing. + /// Formatted string. + public static string ParameterToString(object obj, IReadableConfiguration configuration = null) + { + 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 ?? GlobalConfiguration.Instance).DateTimeFormat); + else if (obj is DateTimeOffset) + // 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 ((DateTimeOffset)obj).ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); + else + { + if (obj is IList) + { + var list = obj as IList; + var flattenedString = new StringBuilder(); + foreach (var param in list) + { + if (flattenedString.Length > 0) + flattenedString.Append(","); + flattenedString.Append(param); + } + return flattenedString.ToString(); + } + + return Convert.ToString (obj); + } + } + + /// + /// Check if generic object is a collection. + /// + /// + /// True if object is a collection type + private static bool IsCollection(object value) + { + return value is IList || value is ICollection; + } + + /// + /// URL encode a string + /// Credit/Ref: https://github.com/restsharp/RestSharp/blob/master/RestSharp/Extensions/StringExtensions.cs#L50 + /// + /// String to be URL encoded + /// Byte array + public static string UrlEncode(string input) + { + const int maxLength = 32766; + + if (input == null) + { + throw new ArgumentNullException("input"); + } + + if (input.Length <= maxLength) + { + return Uri.EscapeDataString(input); + } + + StringBuilder sb = new StringBuilder(input.Length * 2); + int index = 0; + + while (index < input.Length) + { + int length = Math.Min(input.Length - index, maxLength); + string subString = input.Substring(index, length); + + sb.Append(Uri.EscapeDataString(subString)); + index += subString.Length; + } + + return sb.ToString(); + } + + /// + /// Encode string in base64 format. + /// + /// String to be encoded. + /// Encoded string. + public static string Base64Encode(string text) + { + return System.Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(text)); + } + + /// + /// Convert stream to byte array + /// + /// Input stream to be converted + /// Byte array + public static byte[] ReadAsBytes(Stream inputStream) + { + byte[] buf = new byte[16*1024]; + using (MemoryStream ms = new MemoryStream()) + { + int count; + while ((count = inputStream.Read(buf, 0, buf.Length)) > 0) + { + ms.Write(buf, 0, count); + } + return ms.ToArray(); + } + } + + /// + /// Dynamically cast the object into target type. + /// + /// Object to be casted + /// Target type + /// Casted object + public static dynamic ConvertType(dynamic fromObject, Type toObject) + { + return Convert.ChangeType(fromObject, toObject); + } + + /// + /// Select the Content-Type header's value from the given content-type array: + /// if JSON type exists in the given array, use it; + /// otherwise use the first one defined in 'consumes' + /// + /// The Content-Type array to select from. + /// The Content-Type header to use. + public static String SelectHeaderContentType(String[] contentTypes) + { + if (contentTypes.Length == 0) + return "application/json"; + + foreach (var contentType in contentTypes) + { + if (IsJsonMime(contentType)) + return contentType; + } + + return contentTypes[0]; // use the first content type specified in 'consumes' + } + + /// + /// Select the Accept header's value from the given accepts array: + /// if JSON exists in the given array, use it; + /// otherwise use all of them (joining into a string) + /// + /// The accepts array to select from. + /// The Accept header to use. + public static String SelectHeaderAccept(String[] accepts) + { + if (accepts.Length == 0) + return null; + + if (accepts.Contains("application/json", StringComparer.OrdinalIgnoreCase)) + return "application/json"; + + return String.Join(",", accepts); + } + + /// + /// Provides a case-insensitive check that a provided content type is a known JSON-like content type. + /// + public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"); + + /// + /// Check if the given MIME is a JSON MIME. + /// JSON MIME examples: + /// application/json + /// application/json; charset=UTF8 + /// APPLICATION/JSON + /// application/vnd.company+json + /// + /// MIME + /// Returns True if MIME type is json. + public static bool IsJsonMime(String mime) + { + if (String.IsNullOrWhiteSpace(mime)) return false; + + return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json"); + } + } +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Client/Configuration.cs new file mode 100644 index 00000000000..ca0b52df6ae --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Client/Configuration.cs @@ -0,0 +1,401 @@ +/* + * 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.Reflection; +using System.Collections.Concurrent; +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 : IReadableConfiguration + { + #region Constants + + /// + /// Version of the package. + /// + /// Version of the package. + public const string Version = "1.0.0"; + + /// + /// Identifier for ISO 8601 DateTime Format + /// + /// See https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 for more information. + // ReSharper disable once InconsistentNaming + public const string ISO8601_DATETIME_FORMAT = "o"; + + #endregion Constants + + #region Static Members + + /// + /// Default creation of exceptions for a given method name and response object + /// + public static readonly ExceptionFactory DefaultExceptionFactory = (methodName, response) => + { + var status = (int)response.StatusCode; + if (status >= 400) + { + return new ApiException(status, + string.Format("Error calling {0}: {1}", methodName, response.Content), + response.Content); + } + if (status == 0) + { + return new ApiException(status, + string.Format("Error calling {0}: {1}", methodName, response.ErrorText), response.ErrorText); + } + return null; + }; + + #endregion Static Members + + #region Private Members + + /// + /// Defines the base path of the target API server. + /// Example: http://localhost:3000/v1/ + /// + private String _basePath; + + /// + /// Gets or sets the API key based on the authentication name. + /// This is the key and value comprising the "secret" for acessing an API. + /// + /// The API key. + private IDictionary _apiKey; + + /// + /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. + /// + /// The prefix of the API key. + private IDictionary _apiKeyPrefix; + + private string _dateTimeFormat = ISO8601_DATETIME_FORMAT; + private string _tempFolderPath = Path.GetTempPath(); + + #endregion Private Members + + #region Constructors + + /// + /// Initializes a new instance of the class + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "VirtualMemberCallInConstructor")] + public Configuration() + { + UserAgent = "OpenAPI-Generator/1.0.0/csharp"; + BasePath = "http://petstore.swagger.io:80/v2"; + DefaultHeader = new ConcurrentDictionary(); + ApiKey = new ConcurrentDictionary(); + ApiKeyPrefix = new ConcurrentDictionary(); + + // Setting Timeout has side effects (forces ApiClient creation). + Timeout = 100000; + } + + /// + /// Initializes a new instance of the class + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "VirtualMemberCallInConstructor")] + public Configuration( + IDictionary defaultHeader, + IDictionary apiKey, + IDictionary apiKeyPrefix, + string basePath = "http://petstore.swagger.io:80/v2") : this() + { + if (string.IsNullOrWhiteSpace(basePath)) + throw new ArgumentException("The provided basePath is invalid.", "basePath"); + if (defaultHeader == null) + throw new ArgumentNullException("defaultHeader"); + if (apiKey == null) + throw new ArgumentNullException("apiKey"); + if (apiKeyPrefix == null) + throw new ArgumentNullException("apiKeyPrefix"); + + BasePath = basePath; + + foreach (var keyValuePair in defaultHeader) + { + DefaultHeader.Add(keyValuePair); + } + + foreach (var keyValuePair in apiKey) + { + ApiKey.Add(keyValuePair); + } + + foreach (var keyValuePair in apiKeyPrefix) + { + ApiKeyPrefix.Add(keyValuePair); + } + } + + #endregion Constructors + + #region Properties + + /// + /// Gets or sets the base path for API access. + /// + public virtual string BasePath { + get { return _basePath; } + set { + _basePath = value; + } + } + + /// + /// Gets or sets the default header. + /// + public virtual IDictionary DefaultHeader { get; set; } + + /// + /// Gets or sets the HTTP timeout (milliseconds) of ApiClient. Default to 100000 milliseconds. + /// + public virtual int Timeout { get; set; } + + /// + /// Gets or sets the HTTP user agent. + /// + /// Http user agent. + public virtual string UserAgent { get; set; } + + /// + /// Gets or sets the username (HTTP basic authentication). + /// + /// The username. + public virtual string Username { get; set; } + + /// + /// Gets or sets the password (HTTP basic authentication). + /// + /// The password. + public virtual string Password { get; set; } + + /// + /// Gets the API key with prefix. + /// + /// API key identifier (authentication scheme). + /// API key with prefix. + public string GetApiKeyWithPrefix(string apiKeyIdentifier) + { + string apiKeyValue; + ApiKey.TryGetValue (apiKeyIdentifier, out apiKeyValue); + string apiKeyPrefix; + if (ApiKeyPrefix.TryGetValue(apiKeyIdentifier, out apiKeyPrefix)) + { + return apiKeyPrefix + " " + apiKeyValue; + } + + return apiKeyValue; + } + + /// + /// Gets or sets the access token for OAuth2 authentication. + /// + /// This helper property simplifies code generation. + /// + /// The access token. + public virtual string AccessToken { get; set; } + + /// + /// Gets or sets the temporary folder path to store the files downloaded from the server. + /// + /// Folder path. + public virtual string TempFolderPath + { + get { return _tempFolderPath; } + + set + { + if (string.IsNullOrEmpty(value)) + { + _tempFolderPath = Path.GetTempPath(); + 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; + } + } + } + + /// + /// Gets or sets 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 virtual 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; + } + } + + /// + /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. + /// + /// Whatever you set here will be prepended to the value defined in AddApiKey. + /// + /// An example invocation here might be: + /// + /// ApiKeyPrefix["Authorization"] = "Bearer"; + /// + /// … where ApiKey["Authorization"] would then be used to set the value of your bearer token. + /// + /// + /// OAuth2 workflows should set tokens via AccessToken. + /// + /// + /// The prefix of the API key. + public virtual IDictionary ApiKeyPrefix + { + get { return _apiKeyPrefix; } + set + { + if (value == null) + { + throw new InvalidOperationException("ApiKeyPrefix collection may not be null."); + } + _apiKeyPrefix = value; + } + } + + /// + /// Gets or sets the API key based on the authentication name. + /// + /// The API key. + public virtual IDictionary ApiKey + { + get { return _apiKey; } + set + { + if (value == null) + { + throw new InvalidOperationException("ApiKey collection may not be null."); + } + _apiKey = value; + } + } + + #endregion Properties + + #region Methods + + /// + /// Returns a string with essential information for debugging. + /// + public static String ToDebugReport() + { + String report = "C# SDK (Org.OpenAPITools) Debug Report:\n"; + report += " OS: " + System.Environment.OSVersion + "\n"; + report += " .NET Framework Version: " + System.Environment.Version + "\n"; + report += " Version of the API: 1.0.0\n"; + report += " SDK Package Version: 1.0.0\n"; + + return report; + } + + /// + /// Add Api Key Header. + /// + /// Api Key name. + /// Api Key value. + /// + public void AddApiKey(string key, string value) + { + ApiKey[key] = value; + } + + /// + /// Sets the API key prefix. + /// + /// Api Key name. + /// Api Key value. + public void AddApiKeyPrefix(string key, string value) + { + ApiKeyPrefix[key] = value; + } + + #endregion Methods + + #region Static Members + /// + /// Merge configurations. + /// + /// First configuration. + /// Second configuration. + /// Merged configuration. + public static IReadableConfiguration MergeConfigurations(IReadableConfiguration first, IReadableConfiguration second) + { + if (second == null) return first ?? GlobalConfiguration.Instance; + + Dictionary apiKey = first.ApiKey.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + Dictionary apiKeyPrefix = first.ApiKeyPrefix.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + Dictionary defaultHeader = first.DefaultHeader.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + foreach (var kvp in second.ApiKey) apiKey[kvp.Key] = kvp.Value; + foreach (var kvp in second.ApiKeyPrefix) apiKeyPrefix[kvp.Key] = kvp.Value; + foreach (var kvp in second.DefaultHeader) defaultHeader[kvp.Key] = kvp.Value; + + var config = new Configuration + { + ApiKey = apiKey, + ApiKeyPrefix = apiKeyPrefix, + DefaultHeader = defaultHeader, + BasePath = second.BasePath ?? first.BasePath, + Timeout = second.Timeout, + UserAgent = second.UserAgent ?? first.UserAgent, + Username = second.Username ?? first.Username, + Password = second.Password ?? first.Password, + AccessToken = second.AccessToken ?? first.AccessToken, + TempFolderPath = second.TempFolderPath ?? first.TempFolderPath, + DateTimeFormat = second.DateTimeFormat ?? first.DateTimeFormat + }; + return config; + } + #endregion Static Members + } +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Client/ExceptionFactory.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Client/ExceptionFactory.cs new file mode 100644 index 00000000000..6969e6cd321 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Client/ExceptionFactory.cs @@ -0,0 +1,23 @@ +/* + * 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; + +namespace Org.OpenAPITools.Client +{ + /// + /// A delegate to ExceptionFactory method + /// + /// Method name + /// Response + /// Exceptions + public delegate Exception ExceptionFactory(string methodName, IApiResponse response); +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Client/GlobalConfiguration.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Client/GlobalConfiguration.cs new file mode 100644 index 00000000000..3e118b15fa3 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Client/GlobalConfiguration.cs @@ -0,0 +1,68 @@ +/* + * 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.Collections.Generic; + +namespace Org.OpenAPITools.Client +{ + /// + /// provides a compile-time extension point for globally configuring + /// API Clients. + /// + /// + /// A customized implementation via partial class may reside in another file and may + /// be excluded from automatic generation via a .openapi-generator-ignore file. + /// + public partial class GlobalConfiguration : Configuration + { + #region Private Members + + private static readonly object GlobalConfigSync = new { }; + private static IReadableConfiguration _globalConfiguration; + + #endregion Private Members + + #region Constructors + + /// + private GlobalConfiguration() + { + } + + /// + public GlobalConfiguration(IDictionary defaultHeader, IDictionary apiKey, IDictionary apiKeyPrefix, string basePath = "http://localhost:3000/api") : base(defaultHeader, apiKey, apiKeyPrefix, basePath) + { + } + + static GlobalConfiguration() + { + Instance = new GlobalConfiguration(); + } + + #endregion Constructors + + /// + /// Gets or sets the default Configuration. + /// + /// Configuration. + public static IReadableConfiguration Instance + { + get { return _globalConfiguration; } + set + { + lock (GlobalConfigSync) + { + _globalConfiguration = value; + } + } + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Client/HttpMethod.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Client/HttpMethod.cs new file mode 100644 index 00000000000..9200edf9f8b --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Client/HttpMethod.cs @@ -0,0 +1,34 @@ +/* + * 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 + */ + + +namespace Org.OpenAPITools.Client +{ + /// + /// Http methods supported by swagger + /// + public enum HttpMethod + { + /// HTTP GET request. + Get, + /// HTTP POST request. + Post, + /// HTTP PUT request. + Put, + /// HTTP DELETE request. + Delete, + /// HTTP HEAD request. + Head, + /// HTTP OPTIONS request. + Options, + /// HTTP PATCH request. + Patch + } +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Client/IApiAccessor.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Client/IApiAccessor.cs new file mode 100644 index 00000000000..0fdb137c34c --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Client/IApiAccessor.cs @@ -0,0 +1,38 @@ +/* + * 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; + +namespace Org.OpenAPITools.Client +{ + /// + /// Represents configuration aspects required to interact with the API endpoints. + /// + public interface IApiAccessor + { + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + IReadableConfiguration Configuration {get; set;} + + /// + /// Gets the base path of the API client. + /// + /// The base path + String GetBasePath(); + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + ExceptionFactory ExceptionFactory { get; set; } + } +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Client/IAsynchronousClient.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Client/IAsynchronousClient.cs new file mode 100644 index 00000000000..fdd9f05c730 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Client/IAsynchronousClient.cs @@ -0,0 +1,96 @@ +/* + * 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.Threading.Tasks; + +namespace Org.OpenAPITools.Client +{ + /// + /// Contract for Asynchronous RESTful API interactions. + /// + /// This interface allows consumers to provide a custom API accessor client. + /// + public interface IAsynchronousClient + { + /// + /// Executes a non-blocking call to some using the GET http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> GetAsync(String path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a non-blocking call to some using the POST http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> PostAsync(String path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a non-blocking call to some using the PUT http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> PutAsync(String path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a non-blocking call to some using the DELETE http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> DeleteAsync(String path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a non-blocking call to some using the HEAD http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> HeadAsync(String path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a non-blocking call to some using the OPTIONS http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> OptionsAsync(String path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a non-blocking call to some using the PATCH http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> PatchAsync(String path, RequestOptions options, IReadableConfiguration configuration = null); + } +} + diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Client/IReadableConfiguration.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Client/IReadableConfiguration.cs new file mode 100644 index 00000000000..76a5f5124fd --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Client/IReadableConfiguration.cs @@ -0,0 +1,94 @@ +/* + * 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.Collections.Generic; + +namespace Org.OpenAPITools.Client +{ + /// + /// Represents a readable-only configuration contract. + /// + public interface IReadableConfiguration + { + /// + /// Gets the access token. + /// + /// Access token. + string AccessToken { get; } + + /// + /// Gets the API key. + /// + /// API key. + IDictionary ApiKey { get; } + + /// + /// Gets the API key prefix. + /// + /// API key prefix. + IDictionary ApiKeyPrefix { get; } + + /// + /// Gets the base path. + /// + /// Base path. + string BasePath { get; } + + /// + /// Gets the date time format. + /// + /// Date time foramt. + string DateTimeFormat { get; } + + /// + /// Gets the default header. + /// + /// Default header. + IDictionary DefaultHeader { get; } + + /// + /// Gets the temp folder path. + /// + /// Temp folder path. + string TempFolderPath { get; } + + /// + /// Gets the HTTP connection timeout (in milliseconds) + /// + /// HTTP connection timeout. + int Timeout { get; } + + /// + /// Gets the user agent. + /// + /// User agent. + string UserAgent { get; } + + /// + /// Gets the username. + /// + /// Username. + string Username { get; } + + /// + /// Gets the password. + /// + /// Password. + string Password { get; } + + /// + /// Gets the API key with prefix. + /// + /// API key identifier (authentication scheme). + /// API key with prefix. + string GetApiKeyWithPrefix(string apiKeyIdentifier); + } +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Client/ISynchronousClient.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Client/ISynchronousClient.cs new file mode 100644 index 00000000000..7b837ca506f --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Client/ISynchronousClient.cs @@ -0,0 +1,94 @@ +/* + * 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.IO; + +namespace Org.OpenAPITools.Client +{ + /// + /// Contract for Synchronous RESTful API interactions. + /// + /// This interface allows consumers to provide a custom API accessor client. + /// + public interface ISynchronousClient + { + /// + /// Executes a blocking call to some using the GET http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Get(String path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the POST http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Post(String path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the PUT http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Put(String path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the DELETE http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Delete(String path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the HEAD http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Head(String path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the OPTIONS http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Options(String path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the PATCH http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Patch(String path, RequestOptions options, IReadableConfiguration configuration = null); + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Client/Multimap.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Client/Multimap.cs new file mode 100644 index 00000000000..d0b3ad9b4ad --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Client/Multimap.cs @@ -0,0 +1,210 @@ +/* + * 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.Collections; +using System.Collections.Concurrent; +using System.Collections.Generic; + +namespace Org.OpenAPITools.Client +{ + /// + /// A dictionary in which one key has many associated values. + /// + /// The type of the key + /// The type of the value associated with the key. + public class Multimap : IDictionary> + { + #region Private Fields + + private readonly ConcurrentDictionary> _dictionary = + new ConcurrentDictionary>(); + + #endregion Private Fields + + #region Enumerators + + /// + /// To get the enumerator. + /// + /// Enumerator + public IEnumerator>> GetEnumerator() + { + return _dictionary.GetEnumerator(); + } + + /// + /// To get the enumerator. + /// + /// Enumerator + IEnumerator IEnumerable.GetEnumerator() + { + return _dictionary.GetEnumerator(); + } + + #endregion Enumerators + + #region Public Members + /// + /// Add values to Multimap + /// + /// Key value pair + public void Add(KeyValuePair> item) + { + if (!TryAdd(item.Key, item.Value)) + throw new InvalidOperationException("Could not add values to Multimap."); + } + + /// + /// Clear Multimap + /// + public void Clear() + { + _dictionary.Clear(); + } + + public bool Contains(KeyValuePair> item) + { + throw new NotImplementedException(); + } + + public void CopyTo(KeyValuePair>[] array, int arrayIndex) + { + throw new NotImplementedException(); + } + + public bool Remove(KeyValuePair> item) + { + throw new NotImplementedException(); + } + + public int Count + { + get + { + return _dictionary.Count; + } + } + + public bool IsReadOnly + { + get + { + return false; + } + } + + public void Add(T key, IList value) + { + if (value != null && value.Count > 0) + { + IList list; + if (_dictionary.TryGetValue(key, out list)) + { + foreach (var k in value) list.Add(k); + } + else + { + list = new List(value); + if (!TryAdd(key, list)) + throw new InvalidOperationException("Could not add values to Multimap."); + } + } + } + + public bool ContainsKey(T key) + { + return _dictionary.ContainsKey(key); + } + + public bool Remove(T key) + { + IList list; + return TryRemove(key, out list); + } + + public bool TryGetValue(T key, out IList value) + { + return _dictionary.TryGetValue(key, out value); + } + + public IList this[T key] + { + get + { + return _dictionary[key]; + } + set { _dictionary[key] = value; } + } + + public ICollection Keys + { + get + { + return _dictionary.Keys; + } + } + + public ICollection> Values + { + get + { + return _dictionary.Values; + } + } + + public void CopyTo(Array array, int index) + { + ((ICollection) _dictionary).CopyTo(array, index); + } + + public void Add(T key, TValue value) + { + if (value != null) + { + IList list; + if (_dictionary.TryGetValue(key, out list)) + { + list.Add(value); + } + else + { + list = new List(); + list.Add(value); + if (!TryAdd(key, list)) + throw new InvalidOperationException("Could not add value to Multimap."); + } + } + } + + #endregion Public Members + + #region Private Members + + /** + * Helper method to encapsulate generator differences between dictioary types. + */ + private bool TryRemove(T key, out IList value) + { + return _dictionary.TryRemove(key, out value); + + } + + /** + * Helper method to encapsulate generator differences between dictioary types. + */ + private bool TryAdd(T key, IList value) + { + return _dictionary.TryAdd(key, value); + } + #endregion Private Members + } +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Client/OpenAPIDateConverter.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Client/OpenAPIDateConverter.cs new file mode 100644 index 00000000000..4f5c219d5c6 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Client/OpenAPIDateConverter.cs @@ -0,0 +1,30 @@ +/* + * 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 Newtonsoft.Json.Converters; + +namespace Org.OpenAPITools.Client +{ + /// + /// Formatter for 'date' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class OpenAPIDateConverter : IsoDateTimeConverter + { + /// + /// Initializes a new instance of the class. + /// + public OpenAPIDateConverter() + { + // full-date = date-fullyear "-" date-month "-" date-mday + DateTimeFormat = "yyyy-MM-dd"; + } + } +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Client/RequestOptions.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Client/RequestOptions.cs new file mode 100644 index 00000000000..3e7846f24e2 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Client/RequestOptions.cs @@ -0,0 +1,75 @@ +/* + * 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.Collections.Generic; +using System.IO; +using System.Net; + +namespace Org.OpenAPITools.Client +{ + /// + /// A container for generalized request inputs. This type allows consumers to extend the request functionality + /// by abstracting away from the default (built-in) request framework (e.g. RestSharp). + /// + public class RequestOptions + { + /// + /// Parameters to be bound to path parts of the Request's URL + /// + public Dictionary PathParameters { get; set; } + + /// + /// Query parameters to be applied to the request. + /// Keys may have 1 or more values associated. + /// + public Multimap QueryParameters { get; set; } + + /// + /// Header parameters to be applied to to the request. + /// Keys may have 1 or more values associated. + /// + public Multimap HeaderParameters { get; set; } + + /// + /// Form parameters to be sent along with the request. + /// + public Dictionary FormParameters { get; set; } + + /// + /// File parameters to be sent along with the request. + /// + public Dictionary FileParameters { get; set; } + + /// + /// Cookies to be sent along with the request. + /// + public List Cookies { get; set; } + + /// + /// Any data associated with a request body. + /// + public Object Data { get; set; } + + /// + /// Constructs a new instance of + /// + public RequestOptions() + { + PathParameters = new Dictionary(); + QueryParameters = new Multimap(); + HeaderParameters = new Multimap(); + FormParameters = new Dictionary(); + FileParameters = new Dictionary(); + Cookies = new List(); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs new file mode 100644 index 00000000000..32a19a7cc33 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -0,0 +1,129 @@ +/* + * 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; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// AdditionalPropertiesClass + /// + [DataContract] + public partial class AdditionalPropertiesClass : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// mapProperty. + /// mapOfMapProperty. + public AdditionalPropertiesClass(Dictionary mapProperty = default(Dictionary), Dictionary> mapOfMapProperty = default(Dictionary>)) + { + this.MapProperty = mapProperty; + this.MapOfMapProperty = mapOfMapProperty; + } + + /// + /// Gets or Sets MapProperty + /// + [DataMember(Name="map_property", EmitDefaultValue=false)] + public Dictionary MapProperty { get; set; } + + /// + /// Gets or Sets MapOfMapProperty + /// + [DataMember(Name="map_of_map_property", EmitDefaultValue=false)] + public Dictionary> MapOfMapProperty { 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 AdditionalPropertiesClass {\n"); + sb.Append(" MapProperty: ").Append(MapProperty).Append("\n"); + sb.Append(" MapOfMapProperty: ").Append(MapOfMapProperty).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 OpenAPIClientUtils.compareLogic.Compare(this, input as AdditionalPropertiesClass).AreEqual; + } + + /// + /// Returns true if AdditionalPropertiesClass instances are equal + /// + /// Instance of AdditionalPropertiesClass to be compared + /// Boolean + public bool Equals(AdditionalPropertiesClass input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.MapProperty != null) + hashCode = hashCode * 59 + this.MapProperty.GetHashCode(); + if (this.MapOfMapProperty != null) + hashCode = hashCode * 59 + this.MapOfMapProperty.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-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/Animal.cs new file mode 100644 index 00000000000..55afaa13084 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/Animal.cs @@ -0,0 +1,167 @@ +/* + * 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 JsonSubTypes; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// Animal + /// + [DataContract] + [JsonConverter(typeof(JsonSubtypes), "ClassName")] + [JsonSubtypes.KnownSubType(typeof(Dog), "Dog")] + [JsonSubtypes.KnownSubType(typeof(Cat), "Cat")] + [JsonSubtypes.KnownSubType(typeof(Dog), "Dog")] + [JsonSubtypes.KnownSubType(typeof(Cat), "Cat")] + public partial class Animal : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected Animal() { } + /// + /// Initializes a new instance of the class. + /// + /// className (required). + /// color (default to "red"). + public Animal(string className = default(string), string color = "red") + { + // to ensure "className" is required (not null) + if (className == null) + { + throw new InvalidDataException("className is a required property for Animal and cannot be null"); + } + else + { + this.ClassName = className; + } + + // use default value if no "color" provided + if (color == null) + { + this.Color = "red"; + } + else + { + this.Color = color; + } + } + + /// + /// Gets or Sets ClassName + /// + [DataMember(Name="className", EmitDefaultValue=false)] + public string ClassName { get; set; } + + /// + /// Gets or Sets Color + /// + [DataMember(Name="color", EmitDefaultValue=false)] + public string Color { 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 Animal {\n"); + sb.Append(" ClassName: ").Append(ClassName).Append("\n"); + sb.Append(" Color: ").Append(Color).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 OpenAPIClientUtils.compareLogic.Compare(this, input as Animal).AreEqual; + } + + /// + /// Returns true if Animal instances are equal + /// + /// Instance of Animal to be compared + /// Boolean + public bool Equals(Animal input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ClassName != null) + hashCode = hashCode * 59 + this.ClassName.GetHashCode(); + if (this.Color != null) + hashCode = hashCode * 59 + this.Color.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/ApiResponse.cs new file mode 100644 index 00000000000..e28fc9795de --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/ApiResponse.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; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// ApiResponse + /// + [DataContract] + public partial class ApiResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// code. + /// type. + /// message. + public ApiResponse(int code = default(int), string type = default(string), string message = default(string)) + { + this.Code = code; + this.Type = type; + this.Message = message; + } + + /// + /// Gets or Sets Code + /// + [DataMember(Name="code", EmitDefaultValue=false)] + public int Code { get; set; } + + /// + /// Gets or Sets Type + /// + [DataMember(Name="type", EmitDefaultValue=false)] + public string Type { get; set; } + + /// + /// Gets or Sets Message + /// + [DataMember(Name="message", EmitDefaultValue=false)] + public string Message { 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 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(); + } + + /// + /// 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 OpenAPIClientUtils.compareLogic.Compare(this, input as ApiResponse).AreEqual; + } + + /// + /// Returns true if ApiResponse instances are equal + /// + /// Instance of ApiResponse to be compared + /// Boolean + public bool Equals(ApiResponse input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Code != null) + hashCode = hashCode * 59 + this.Code.GetHashCode(); + if (this.Type != null) + hashCode = hashCode * 59 + this.Type.GetHashCode(); + if (this.Message != null) + hashCode = hashCode * 59 + this.Message.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-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs new file mode 100644 index 00000000000..4de9ac9adf6 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -0,0 +1,118 @@ +/* + * 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; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// ArrayOfArrayOfNumberOnly + /// + [DataContract] + public partial class ArrayOfArrayOfNumberOnly : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// arrayArrayNumber. + public ArrayOfArrayOfNumberOnly(List> arrayArrayNumber = default(List>)) + { + this.ArrayArrayNumber = arrayArrayNumber; + } + + /// + /// Gets or Sets ArrayArrayNumber + /// + [DataMember(Name="ArrayArrayNumber", EmitDefaultValue=false)] + public List> ArrayArrayNumber { 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 ArrayOfArrayOfNumberOnly {\n"); + sb.Append(" ArrayArrayNumber: ").Append(ArrayArrayNumber).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 OpenAPIClientUtils.compareLogic.Compare(this, input as ArrayOfArrayOfNumberOnly).AreEqual; + } + + /// + /// Returns true if ArrayOfArrayOfNumberOnly instances are equal + /// + /// Instance of ArrayOfArrayOfNumberOnly to be compared + /// Boolean + public bool Equals(ArrayOfArrayOfNumberOnly input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ArrayArrayNumber != null) + hashCode = hashCode * 59 + this.ArrayArrayNumber.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-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs new file mode 100644 index 00000000000..2ee74e404a9 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -0,0 +1,118 @@ +/* + * 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; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// ArrayOfNumberOnly + /// + [DataContract] + public partial class ArrayOfNumberOnly : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// arrayNumber. + public ArrayOfNumberOnly(List arrayNumber = default(List)) + { + this.ArrayNumber = arrayNumber; + } + + /// + /// Gets or Sets ArrayNumber + /// + [DataMember(Name="ArrayNumber", EmitDefaultValue=false)] + public List ArrayNumber { 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 ArrayOfNumberOnly {\n"); + sb.Append(" ArrayNumber: ").Append(ArrayNumber).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 OpenAPIClientUtils.compareLogic.Compare(this, input as ArrayOfNumberOnly).AreEqual; + } + + /// + /// Returns true if ArrayOfNumberOnly instances are equal + /// + /// Instance of ArrayOfNumberOnly to be compared + /// Boolean + public bool Equals(ArrayOfNumberOnly input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ArrayNumber != null) + hashCode = hashCode * 59 + this.ArrayNumber.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-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/ArrayTest.cs new file mode 100644 index 00000000000..334cc67e618 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/ArrayTest.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; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// ArrayTest + /// + [DataContract] + public partial class ArrayTest : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// arrayOfString. + /// arrayArrayOfInteger. + /// arrayArrayOfModel. + public ArrayTest(List arrayOfString = default(List), List> arrayArrayOfInteger = default(List>), List> arrayArrayOfModel = default(List>)) + { + this.ArrayOfString = arrayOfString; + this.ArrayArrayOfInteger = arrayArrayOfInteger; + this.ArrayArrayOfModel = arrayArrayOfModel; + } + + /// + /// Gets or Sets ArrayOfString + /// + [DataMember(Name="array_of_string", EmitDefaultValue=false)] + public List ArrayOfString { get; set; } + + /// + /// Gets or Sets ArrayArrayOfInteger + /// + [DataMember(Name="array_array_of_integer", EmitDefaultValue=false)] + public List> ArrayArrayOfInteger { get; set; } + + /// + /// Gets or Sets ArrayArrayOfModel + /// + [DataMember(Name="array_array_of_model", EmitDefaultValue=false)] + public List> ArrayArrayOfModel { 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 ArrayTest {\n"); + sb.Append(" ArrayOfString: ").Append(ArrayOfString).Append("\n"); + sb.Append(" ArrayArrayOfInteger: ").Append(ArrayArrayOfInteger).Append("\n"); + sb.Append(" ArrayArrayOfModel: ").Append(ArrayArrayOfModel).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 OpenAPIClientUtils.compareLogic.Compare(this, input as ArrayTest).AreEqual; + } + + /// + /// Returns true if ArrayTest instances are equal + /// + /// Instance of ArrayTest to be compared + /// Boolean + public bool Equals(ArrayTest input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ArrayOfString != null) + hashCode = hashCode * 59 + this.ArrayOfString.GetHashCode(); + if (this.ArrayArrayOfInteger != null) + hashCode = hashCode * 59 + this.ArrayArrayOfInteger.GetHashCode(); + if (this.ArrayArrayOfModel != null) + hashCode = hashCode * 59 + this.ArrayArrayOfModel.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-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/Capitalization.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/Capitalization.cs new file mode 100644 index 00000000000..8af54f1e73e --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/Capitalization.cs @@ -0,0 +1,174 @@ +/* + * 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; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// Capitalization + /// + [DataContract] + public partial class Capitalization : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// smallCamel. + /// capitalCamel. + /// smallSnake. + /// capitalSnake. + /// sCAETHFlowPoints. + /// Name of the pet . + public Capitalization(string smallCamel = default(string), string capitalCamel = default(string), string smallSnake = default(string), string capitalSnake = default(string), string sCAETHFlowPoints = default(string), string aTTNAME = default(string)) + { + this.SmallCamel = smallCamel; + this.CapitalCamel = capitalCamel; + this.SmallSnake = smallSnake; + this.CapitalSnake = capitalSnake; + this.SCAETHFlowPoints = sCAETHFlowPoints; + this.ATT_NAME = aTTNAME; + } + + /// + /// Gets or Sets SmallCamel + /// + [DataMember(Name="smallCamel", EmitDefaultValue=false)] + public string SmallCamel { get; set; } + + /// + /// Gets or Sets CapitalCamel + /// + [DataMember(Name="CapitalCamel", EmitDefaultValue=false)] + public string CapitalCamel { get; set; } + + /// + /// Gets or Sets SmallSnake + /// + [DataMember(Name="small_Snake", EmitDefaultValue=false)] + public string SmallSnake { get; set; } + + /// + /// Gets or Sets CapitalSnake + /// + [DataMember(Name="Capital_Snake", EmitDefaultValue=false)] + public string CapitalSnake { get; set; } + + /// + /// Gets or Sets SCAETHFlowPoints + /// + [DataMember(Name="SCA_ETH_Flow_Points", EmitDefaultValue=false)] + public string SCAETHFlowPoints { get; set; } + + /// + /// Name of the pet + /// + /// Name of the pet + [DataMember(Name="ATT_NAME", EmitDefaultValue=false)] + public string ATT_NAME { 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 Capitalization {\n"); + sb.Append(" SmallCamel: ").Append(SmallCamel).Append("\n"); + sb.Append(" CapitalCamel: ").Append(CapitalCamel).Append("\n"); + sb.Append(" SmallSnake: ").Append(SmallSnake).Append("\n"); + sb.Append(" CapitalSnake: ").Append(CapitalSnake).Append("\n"); + sb.Append(" SCAETHFlowPoints: ").Append(SCAETHFlowPoints).Append("\n"); + sb.Append(" ATT_NAME: ").Append(ATT_NAME).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 OpenAPIClientUtils.compareLogic.Compare(this, input as Capitalization).AreEqual; + } + + /// + /// Returns true if Capitalization instances are equal + /// + /// Instance of Capitalization to be compared + /// Boolean + public bool Equals(Capitalization input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.SmallCamel != null) + hashCode = hashCode * 59 + this.SmallCamel.GetHashCode(); + if (this.CapitalCamel != null) + hashCode = hashCode * 59 + this.CapitalCamel.GetHashCode(); + if (this.SmallSnake != null) + hashCode = hashCode * 59 + this.SmallSnake.GetHashCode(); + if (this.CapitalSnake != null) + hashCode = hashCode * 59 + this.CapitalSnake.GetHashCode(); + if (this.SCAETHFlowPoints != null) + hashCode = hashCode * 59 + this.SCAETHFlowPoints.GetHashCode(); + if (this.ATT_NAME != null) + hashCode = hashCode * 59 + this.ATT_NAME.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-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/Cat.cs new file mode 100644 index 00000000000..053b9409fdb --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/Cat.cs @@ -0,0 +1,127 @@ +/* + * 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; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// Cat + /// + [DataContract] + public partial class Cat : Animal, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected Cat() { } + /// + /// Initializes a new instance of the class. + /// + /// declawed. + /// className (required). + /// color (default to "red"). + public Cat(bool declawed = default(bool), string className = default(string), string color = "red") : base(className, color) + { + this.Declawed = declawed; + } + + /// + /// Gets or Sets Declawed + /// + [DataMember(Name="declawed", EmitDefaultValue=false)] + public bool Declawed { 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 Cat {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); + sb.Append(" Declawed: ").Append(Declawed).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override 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 OpenAPIClientUtils.compareLogic.Compare(this, input as Cat).AreEqual; + } + + /// + /// Returns true if Cat instances are equal + /// + /// Instance of Cat to be compared + /// Boolean + public bool Equals(Cat input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = base.GetHashCode(); + if (this.Declawed != null) + hashCode = hashCode * 59 + this.Declawed.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + foreach(var x in BaseValidate(validationContext)) yield return x; + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/Category.cs new file mode 100644 index 00000000000..c847814bf1a --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/Category.cs @@ -0,0 +1,143 @@ +/* + * 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; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// Category + /// + [DataContract] + public partial class Category : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected Category() { } + /// + /// Initializes a new instance of the class. + /// + /// id. + /// name (required) (default to "default-name"). + public Category(long id = default(long), string name = "default-name") + { + // to ensure "name" is required (not null) + if (name == null) + { + throw new InvalidDataException("name is a required property for Category and cannot be null"); + } + else + { + this.Name = name; + } + + this.Id = id; + } + + /// + /// Gets or Sets Id + /// + [DataMember(Name="id", EmitDefaultValue=false)] + public long Id { get; set; } + + /// + /// Gets or Sets Name + /// + [DataMember(Name="name", EmitDefaultValue=false)] + public string Name { 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 Category {\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Name: ").Append(Name).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 OpenAPIClientUtils.compareLogic.Compare(this, input as Category).AreEqual; + } + + /// + /// Returns true if Category instances are equal + /// + /// Instance of Category to be compared + /// Boolean + public bool Equals(Category input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Id != null) + hashCode = hashCode * 59 + this.Id.GetHashCode(); + if (this.Name != null) + hashCode = hashCode * 59 + this.Name.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-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/ClassModel.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/ClassModel.cs new file mode 100644 index 00000000000..5eccb61a4a3 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/ClassModel.cs @@ -0,0 +1,118 @@ +/* + * 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; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// Model for testing model with \"_class\" property + /// + [DataContract] + public partial class ClassModel : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// _class. + public ClassModel(string _class = default(string)) + { + this.Class = _class; + } + + /// + /// Gets or Sets Class + /// + [DataMember(Name="_class", EmitDefaultValue=false)] + public string Class { 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 ClassModel {\n"); + sb.Append(" Class: ").Append(Class).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 OpenAPIClientUtils.compareLogic.Compare(this, input as ClassModel).AreEqual; + } + + /// + /// Returns true if ClassModel instances are equal + /// + /// Instance of ClassModel to be compared + /// Boolean + public bool Equals(ClassModel input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Class != null) + hashCode = hashCode * 59 + this.Class.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-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/Dog.cs new file mode 100644 index 00000000000..dc3e2b596e0 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/Dog.cs @@ -0,0 +1,127 @@ +/* + * 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; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// Dog + /// + [DataContract] + public partial class Dog : Animal, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected Dog() { } + /// + /// Initializes a new instance of the class. + /// + /// breed. + /// className (required). + /// color (default to "red"). + public Dog(string breed = default(string), string className = default(string), string color = "red") : base(className, color) + { + this.Breed = breed; + } + + /// + /// Gets or Sets Breed + /// + [DataMember(Name="breed", EmitDefaultValue=false)] + public string Breed { 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 Dog {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); + sb.Append(" Breed: ").Append(Breed).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override 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 OpenAPIClientUtils.compareLogic.Compare(this, input as Dog).AreEqual; + } + + /// + /// Returns true if Dog instances are equal + /// + /// Instance of Dog to be compared + /// Boolean + public bool Equals(Dog input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = base.GetHashCode(); + if (this.Breed != null) + hashCode = hashCode * 59 + this.Breed.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + foreach(var x in BaseValidate(validationContext)) yield return x; + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/EnumArrays.cs new file mode 100644 index 00000000000..63fabba7f44 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -0,0 +1,166 @@ +/* + * 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; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// EnumArrays + /// + [DataContract] + public partial class EnumArrays : IEquatable, IValidatableObject + { + /// + /// Defines JustSymbol + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum JustSymbolEnum + { + /// + /// Enum GreaterThanOrEqualTo for value: >= + /// + [EnumMember(Value = ">=")] + GreaterThanOrEqualTo = 1, + + /// + /// Enum Dollar for value: $ + /// + [EnumMember(Value = "$")] + Dollar = 2 + + } + + /// + /// Gets or Sets JustSymbol + /// + [DataMember(Name="just_symbol", EmitDefaultValue=false)] + public JustSymbolEnum? JustSymbol { get; set; } + /// + /// Defines ArrayEnum + /// + [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 + + } + + + /// + /// Gets or Sets ArrayEnum + /// + [DataMember(Name="array_enum", EmitDefaultValue=false)] + public List ArrayEnum { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// justSymbol. + /// arrayEnum. + public EnumArrays(JustSymbolEnum? justSymbol = default(JustSymbolEnum?), List arrayEnum = default(List)) + { + this.JustSymbol = justSymbol; + this.ArrayEnum = arrayEnum; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class EnumArrays {\n"); + sb.Append(" JustSymbol: ").Append(JustSymbol).Append("\n"); + sb.Append(" ArrayEnum: ").Append(ArrayEnum).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 OpenAPIClientUtils.compareLogic.Compare(this, input as EnumArrays).AreEqual; + } + + /// + /// Returns true if EnumArrays instances are equal + /// + /// Instance of EnumArrays to be compared + /// Boolean + public bool Equals(EnumArrays input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = hashCode * 59 + this.JustSymbol.GetHashCode(); + hashCode = hashCode * 59 + this.ArrayEnum.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-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/EnumClass.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/EnumClass.cs new file mode 100644 index 00000000000..db151c2c773 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/EnumClass.cs @@ -0,0 +1,57 @@ +/* + * 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; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// Defines EnumClass + /// + + [JsonConverter(typeof(StringEnumConverter))] + + 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-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/EnumTest.cs new file mode 100644 index 00000000000..d45d1ad623b --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/EnumTest.cs @@ -0,0 +1,248 @@ +/* + * 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; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// EnumTest + /// + [DataContract] + public partial class EnumTest : IEquatable, IValidatableObject + { + /// + /// Defines EnumString + /// + [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 + + } + + /// + /// Gets or Sets EnumString + /// + [DataMember(Name="enum_string", EmitDefaultValue=false)] + public EnumStringEnum? EnumString { get; set; } + /// + /// Defines EnumStringRequired + /// + [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 + + } + + /// + /// Gets or Sets EnumStringRequired + /// + [DataMember(Name="enum_string_required", EmitDefaultValue=false)] + public EnumStringRequiredEnum EnumStringRequired { get; set; } + /// + /// Defines EnumInteger + /// + public enum EnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + + } + + /// + /// Gets or Sets EnumInteger + /// + [DataMember(Name="enum_integer", EmitDefaultValue=false)] + public EnumIntegerEnum? EnumInteger { get; set; } + /// + /// Defines EnumNumber + /// + [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 + + } + + /// + /// Gets or Sets EnumNumber + /// + [DataMember(Name="enum_number", EmitDefaultValue=false)] + public EnumNumberEnum? EnumNumber { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected EnumTest() { } + /// + /// Initializes a new instance of the class. + /// + /// enumString. + /// enumStringRequired (required). + /// enumInteger. + /// enumNumber. + /// outerEnum. + public EnumTest(EnumStringEnum? enumString = default(EnumStringEnum?), EnumStringRequiredEnum enumStringRequired = default(EnumStringRequiredEnum), EnumIntegerEnum? enumInteger = default(EnumIntegerEnum?), EnumNumberEnum? enumNumber = default(EnumNumberEnum?), OuterEnum outerEnum = default(OuterEnum)) + { + this.EnumStringRequired = enumStringRequired; + this.EnumString = enumString; + this.EnumInteger = enumInteger; + this.EnumNumber = enumNumber; + this.OuterEnum = outerEnum; + } + + /// + /// Gets or Sets OuterEnum + /// + [DataMember(Name="outerEnum", EmitDefaultValue=false)] + public OuterEnum OuterEnum { 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 EnumTest {\n"); + sb.Append(" EnumString: ").Append(EnumString).Append("\n"); + sb.Append(" EnumStringRequired: ").Append(EnumStringRequired).Append("\n"); + sb.Append(" EnumInteger: ").Append(EnumInteger).Append("\n"); + sb.Append(" EnumNumber: ").Append(EnumNumber).Append("\n"); + sb.Append(" OuterEnum: ").Append(OuterEnum).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 OpenAPIClientUtils.compareLogic.Compare(this, input as EnumTest).AreEqual; + } + + /// + /// Returns true if EnumTest instances are equal + /// + /// Instance of EnumTest to be compared + /// Boolean + public bool Equals(EnumTest input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = hashCode * 59 + this.EnumString.GetHashCode(); + hashCode = hashCode * 59 + this.EnumStringRequired.GetHashCode(); + hashCode = hashCode * 59 + this.EnumInteger.GetHashCode(); + hashCode = hashCode * 59 + this.EnumNumber.GetHashCode(); + if (this.OuterEnum != null) + hashCode = hashCode * 59 + this.OuterEnum.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-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/File.cs new file mode 100644 index 00000000000..dabb0d97d3e --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/File.cs @@ -0,0 +1,119 @@ +/* + * 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; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +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 OpenAPIClientUtils.compareLogic.Compare(this, input as File).AreEqual; + } + + /// + /// Returns true if File instances are equal + /// + /// Instance of File to be compared + /// Boolean + public bool Equals(File input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// 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-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs new file mode 100644 index 00000000000..5cdb9b7e3a3 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -0,0 +1,129 @@ +/* + * 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; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// FileSchemaTestClass + /// + [DataContract] + public partial class FileSchemaTestClass : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// file. + /// files. + public FileSchemaTestClass(File file = default(File), List files = default(List)) + { + this.File = file; + this.Files = files; + } + + /// + /// Gets or Sets File + /// + [DataMember(Name="file", EmitDefaultValue=false)] + public File 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 OpenAPIClientUtils.compareLogic.Compare(this, input as FileSchemaTestClass).AreEqual; + } + + /// + /// Returns true if FileSchemaTestClass instances are equal + /// + /// Instance of FileSchemaTestClass to be compared + /// Boolean + public bool Equals(FileSchemaTestClass input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// 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-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/FormatTest.cs new file mode 100644 index 00000000000..88f748b828d --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/FormatTest.cs @@ -0,0 +1,371 @@ +/* + * 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; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// FormatTest + /// + [DataContract] + public partial class FormatTest : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected FormatTest() { } + /// + /// Initializes a new instance of the class. + /// + /// integer. + /// int32. + /// int64. + /// number (required). + /// _float. + /// _double. + /// _string. + /// _byte (required). + /// binary. + /// date (required). + /// dateTime. + /// uuid. + /// password (required). + public FormatTest(int integer = default(int), int int32 = default(int), long int64 = default(long), decimal number = default(decimal), float _float = default(float), double _double = default(double), string _string = default(string), byte[] _byte = default(byte[]), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), Guid uuid = default(Guid), string password = default(string)) + { + // to ensure "number" is required (not null) + if (number == null) + { + throw new InvalidDataException("number is a required property for FormatTest and cannot be null"); + } + else + { + this.Number = number; + } + + // to ensure "_byte" is required (not null) + if (_byte == null) + { + throw new InvalidDataException("_byte is a required property for FormatTest and cannot be null"); + } + else + { + this.Byte = _byte; + } + + // to ensure "date" is required (not null) + if (date == null) + { + throw new InvalidDataException("date is a required property for FormatTest and cannot be null"); + } + else + { + this.Date = date; + } + + // to ensure "password" is required (not null) + if (password == null) + { + throw new InvalidDataException("password is a required property for FormatTest and cannot be null"); + } + else + { + this.Password = password; + } + + this.Integer = integer; + this.Int32 = int32; + this.Int64 = int64; + this.Float = _float; + this.Double = _double; + this.String = _string; + this.Binary = binary; + this.DateTime = dateTime; + this.Uuid = uuid; + } + + /// + /// Gets or Sets Integer + /// + [DataMember(Name="integer", EmitDefaultValue=false)] + public int Integer { get; set; } + + /// + /// Gets or Sets Int32 + /// + [DataMember(Name="int32", EmitDefaultValue=false)] + public int Int32 { get; set; } + + /// + /// Gets or Sets Int64 + /// + [DataMember(Name="int64", EmitDefaultValue=false)] + public long Int64 { get; set; } + + /// + /// Gets or Sets Number + /// + [DataMember(Name="number", EmitDefaultValue=false)] + public decimal Number { get; set; } + + /// + /// Gets or Sets Float + /// + [DataMember(Name="float", EmitDefaultValue=false)] + public float Float { get; set; } + + /// + /// Gets or Sets Double + /// + [DataMember(Name="double", EmitDefaultValue=false)] + public double Double { get; set; } + + /// + /// Gets or Sets String + /// + [DataMember(Name="string", EmitDefaultValue=false)] + public string String { get; set; } + + /// + /// Gets or Sets Byte + /// + [DataMember(Name="byte", EmitDefaultValue=false)] + public byte[] Byte { get; set; } + + /// + /// Gets or Sets Binary + /// + [DataMember(Name="binary", EmitDefaultValue=false)] + public System.IO.Stream Binary { get; set; } + + /// + /// Gets or Sets Date + /// + [DataMember(Name="date", EmitDefaultValue=false)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime Date { get; set; } + + /// + /// Gets or Sets DateTime + /// + [DataMember(Name="dateTime", EmitDefaultValue=false)] + public DateTime DateTime { get; set; } + + /// + /// Gets or Sets Uuid + /// + [DataMember(Name="uuid", EmitDefaultValue=false)] + public Guid Uuid { get; set; } + + /// + /// Gets or Sets Password + /// + [DataMember(Name="password", EmitDefaultValue=false)] + public string Password { 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 FormatTest {\n"); + sb.Append(" Integer: ").Append(Integer).Append("\n"); + sb.Append(" Int32: ").Append(Int32).Append("\n"); + sb.Append(" Int64: ").Append(Int64).Append("\n"); + sb.Append(" Number: ").Append(Number).Append("\n"); + sb.Append(" Float: ").Append(Float).Append("\n"); + sb.Append(" Double: ").Append(Double).Append("\n"); + sb.Append(" String: ").Append(String).Append("\n"); + sb.Append(" Byte: ").Append(Byte).Append("\n"); + sb.Append(" Binary: ").Append(Binary).Append("\n"); + sb.Append(" Date: ").Append(Date).Append("\n"); + sb.Append(" DateTime: ").Append(DateTime).Append("\n"); + sb.Append(" Uuid: ").Append(Uuid).Append("\n"); + sb.Append(" Password: ").Append(Password).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 OpenAPIClientUtils.compareLogic.Compare(this, input as FormatTest).AreEqual; + } + + /// + /// Returns true if FormatTest instances are equal + /// + /// Instance of FormatTest to be compared + /// Boolean + public bool Equals(FormatTest input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Integer != null) + hashCode = hashCode * 59 + this.Integer.GetHashCode(); + if (this.Int32 != null) + hashCode = hashCode * 59 + this.Int32.GetHashCode(); + if (this.Int64 != null) + hashCode = hashCode * 59 + this.Int64.GetHashCode(); + if (this.Number != null) + hashCode = hashCode * 59 + this.Number.GetHashCode(); + if (this.Float != null) + hashCode = hashCode * 59 + this.Float.GetHashCode(); + if (this.Double != null) + hashCode = hashCode * 59 + this.Double.GetHashCode(); + if (this.String != null) + hashCode = hashCode * 59 + this.String.GetHashCode(); + if (this.Byte != null) + hashCode = hashCode * 59 + this.Byte.GetHashCode(); + if (this.Binary != null) + hashCode = hashCode * 59 + this.Binary.GetHashCode(); + if (this.Date != null) + hashCode = hashCode * 59 + this.Date.GetHashCode(); + if (this.DateTime != null) + hashCode = hashCode * 59 + this.DateTime.GetHashCode(); + if (this.Uuid != null) + hashCode = hashCode * 59 + this.Uuid.GetHashCode(); + if (this.Password != null) + hashCode = hashCode * 59 + this.Password.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Integer (int) maximum + if(this.Integer > (int)100) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Integer, must be a value less than or equal to 100.", new [] { "Integer" }); + } + + // Integer (int) minimum + if(this.Integer < (int)10) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Integer, must be a value greater than or equal to 10.", new [] { "Integer" }); + } + + // Int32 (int) maximum + if(this.Int32 > (int)200) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Int32, must be a value less than or equal to 200.", new [] { "Int32" }); + } + + // Int32 (int) minimum + if(this.Int32 < (int)20) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Int32, must be a value greater than or equal to 20.", new [] { "Int32" }); + } + + // Number (decimal) maximum + if(this.Number > (decimal)543.2) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value less than or equal to 543.2.", new [] { "Number" }); + } + + // Number (decimal) minimum + if(this.Number < (decimal)32.1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value greater than or equal to 32.1.", new [] { "Number" }); + } + + // Float (float) maximum + if(this.Float > (float)987.6) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Float, must be a value less than or equal to 987.6.", new [] { "Float" }); + } + + // Float (float) minimum + if(this.Float < (float)54.3) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Float, must be a value greater than or equal to 54.3.", new [] { "Float" }); + } + + // Double (double) maximum + if(this.Double > (double)123.4) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Double, must be a value less than or equal to 123.4.", new [] { "Double" }); + } + + // Double (double) minimum + if(this.Double < (double)67.8) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Double, must be a value greater than or equal to 67.8.", new [] { "Double" }); + } + + // String (string) pattern + Regex regexString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + if (false == regexString.Match(this.String).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for String, must match a pattern of " + regexString, new [] { "String" }); + } + + // Password (string) maxLength + if(this.Password != null && this.Password.Length > 64) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be less than 64.", new [] { "Password" }); + } + + // Password (string) minLength + if(this.Password != null && this.Password.Length < 10) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be greater than 10.", new [] { "Password" }); + } + + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs new file mode 100644 index 00000000000..6174cd37653 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs @@ -0,0 +1,126 @@ +/* + * 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; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// HasOnlyReadOnly + /// + [DataContract] + public partial class HasOnlyReadOnly : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + public HasOnlyReadOnly() + { + } + + /// + /// Gets or Sets Bar + /// + [DataMember(Name="bar", EmitDefaultValue=false)] + public string Bar { get; private set; } + + /// + /// Gets or Sets Foo + /// + [DataMember(Name="foo", EmitDefaultValue=false)] + public string Foo { get; private set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class HasOnlyReadOnly {\n"); + sb.Append(" Bar: ").Append(Bar).Append("\n"); + sb.Append(" Foo: ").Append(Foo).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 OpenAPIClientUtils.compareLogic.Compare(this, input as HasOnlyReadOnly).AreEqual; + } + + /// + /// Returns true if HasOnlyReadOnly instances are equal + /// + /// Instance of HasOnlyReadOnly to be compared + /// Boolean + public bool Equals(HasOnlyReadOnly input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Bar != null) + hashCode = hashCode * 59 + this.Bar.GetHashCode(); + if (this.Foo != null) + hashCode = hashCode * 59 + this.Foo.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-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/List.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/List.cs new file mode 100644 index 00000000000..0a4caa3d950 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/List.cs @@ -0,0 +1,118 @@ +/* + * 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; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// List + /// + [DataContract] + public partial class List : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// _123list. + public List(string _123list = default(string)) + { + this._123List = _123list; + } + + /// + /// Gets or Sets _123List + /// + [DataMember(Name="123-list", EmitDefaultValue=false)] + public string _123List { 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 List {\n"); + sb.Append(" _123List: ").Append(_123List).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 OpenAPIClientUtils.compareLogic.Compare(this, input as List).AreEqual; + } + + /// + /// Returns true if List instances are equal + /// + /// Instance of List to be compared + /// Boolean + public bool Equals(List input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this._123List != null) + hashCode = hashCode * 59 + this._123List.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-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/MapTest.cs new file mode 100644 index 00000000000..b04d1ed442f --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/MapTest.cs @@ -0,0 +1,170 @@ +/* + * 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; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// MapTest + /// + [DataContract] + public partial class MapTest : IEquatable, IValidatableObject + { + /// + /// Defines Inner + /// + [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 + + } + + + /// + /// Gets or Sets MapOfEnumString + /// + [DataMember(Name="map_of_enum_string", EmitDefaultValue=false)] + public Dictionary MapOfEnumString { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// mapMapOfString. + /// mapOfEnumString. + /// directMap. + /// indirectMap. + public MapTest(Dictionary> mapMapOfString = default(Dictionary>), Dictionary mapOfEnumString = default(Dictionary), Dictionary directMap = default(Dictionary), Dictionary indirectMap = default(Dictionary)) + { + this.MapMapOfString = mapMapOfString; + this.MapOfEnumString = mapOfEnumString; + this.DirectMap = directMap; + this.IndirectMap = indirectMap; + } + + /// + /// Gets or Sets MapMapOfString + /// + [DataMember(Name="map_map_of_string", EmitDefaultValue=false)] + 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 Dictionary IndirectMap { 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 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(); + } + + /// + /// 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 OpenAPIClientUtils.compareLogic.Compare(this, input as MapTest).AreEqual; + } + + /// + /// Returns true if MapTest instances are equal + /// + /// Instance of MapTest to be compared + /// Boolean + public bool Equals(MapTest input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.MapMapOfString != null) + hashCode = hashCode * 59 + this.MapMapOfString.GetHashCode(); + 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; + } + } + + /// + /// 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-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs new file mode 100644 index 00000000000..8ae71edaf8b --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.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; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// MixedPropertiesAndAdditionalPropertiesClass + /// + [DataContract] + public partial class MixedPropertiesAndAdditionalPropertiesClass : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// uuid. + /// dateTime. + /// map. + public MixedPropertiesAndAdditionalPropertiesClass(Guid uuid = default(Guid), DateTime dateTime = default(DateTime), Dictionary map = default(Dictionary)) + { + this.Uuid = uuid; + this.DateTime = dateTime; + this.Map = map; + } + + /// + /// Gets or Sets Uuid + /// + [DataMember(Name="uuid", EmitDefaultValue=false)] + public Guid Uuid { get; set; } + + /// + /// Gets or Sets DateTime + /// + [DataMember(Name="dateTime", EmitDefaultValue=false)] + public DateTime DateTime { get; set; } + + /// + /// Gets or Sets Map + /// + [DataMember(Name="map", EmitDefaultValue=false)] + public Dictionary Map { 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 MixedPropertiesAndAdditionalPropertiesClass {\n"); + sb.Append(" Uuid: ").Append(Uuid).Append("\n"); + sb.Append(" DateTime: ").Append(DateTime).Append("\n"); + sb.Append(" Map: ").Append(Map).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 OpenAPIClientUtils.compareLogic.Compare(this, input as MixedPropertiesAndAdditionalPropertiesClass).AreEqual; + } + + /// + /// Returns true if MixedPropertiesAndAdditionalPropertiesClass instances are equal + /// + /// Instance of MixedPropertiesAndAdditionalPropertiesClass to be compared + /// Boolean + public bool Equals(MixedPropertiesAndAdditionalPropertiesClass input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Uuid != null) + hashCode = hashCode * 59 + this.Uuid.GetHashCode(); + if (this.DateTime != null) + hashCode = hashCode * 59 + this.DateTime.GetHashCode(); + if (this.Map != null) + hashCode = hashCode * 59 + this.Map.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-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/Model200Response.cs new file mode 100644 index 00000000000..56010fc7923 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/Model200Response.cs @@ -0,0 +1,129 @@ +/* + * 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; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// Model for testing model name starting with number + /// + [DataContract] + public partial class Model200Response : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// name. + /// _class. + public Model200Response(int name = default(int), string _class = default(string)) + { + this.Name = name; + this.Class = _class; + } + + /// + /// Gets or Sets Name + /// + [DataMember(Name="name", EmitDefaultValue=false)] + public int Name { get; set; } + + /// + /// Gets or Sets Class + /// + [DataMember(Name="class", EmitDefaultValue=false)] + public string Class { 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 Model200Response {\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" Class: ").Append(Class).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 OpenAPIClientUtils.compareLogic.Compare(this, input as Model200Response).AreEqual; + } + + /// + /// Returns true if Model200Response instances are equal + /// + /// Instance of Model200Response to be compared + /// Boolean + public bool Equals(Model200Response input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Name != null) + hashCode = hashCode * 59 + this.Name.GetHashCode(); + if (this.Class != null) + hashCode = hashCode * 59 + this.Class.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-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/ModelClient.cs new file mode 100644 index 00000000000..04562c4e269 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/ModelClient.cs @@ -0,0 +1,118 @@ +/* + * 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; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// ModelClient + /// + [DataContract] + public partial class ModelClient : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// _client. + public ModelClient(string _client = default(string)) + { + this.__Client = _client; + } + + /// + /// Gets or Sets __Client + /// + [DataMember(Name="client", EmitDefaultValue=false)] + public string __Client { 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 ModelClient {\n"); + sb.Append(" __Client: ").Append(__Client).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 OpenAPIClientUtils.compareLogic.Compare(this, input as ModelClient).AreEqual; + } + + /// + /// Returns true if ModelClient instances are equal + /// + /// Instance of ModelClient to be compared + /// Boolean + public bool Equals(ModelClient input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.__Client != null) + hashCode = hashCode * 59 + this.__Client.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-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/Name.cs new file mode 100644 index 00000000000..9549d8f9293 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/Name.cs @@ -0,0 +1,161 @@ +/* + * 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; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// Model for testing model name same as property name + /// + [DataContract] + public partial class Name : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected Name() { } + /// + /// Initializes a new instance of the class. + /// + /// name (required). + /// property. + public Name(int name = default(int), string property = default(string)) + { + // to ensure "name" is required (not null) + if (name == null) + { + throw new InvalidDataException("name is a required property for Name and cannot be null"); + } + else + { + this._Name = name; + } + + this.Property = property; + } + + /// + /// Gets or Sets _Name + /// + [DataMember(Name="name", EmitDefaultValue=false)] + public int _Name { get; set; } + + /// + /// Gets or Sets SnakeCase + /// + [DataMember(Name="snake_case", EmitDefaultValue=false)] + public int SnakeCase { get; private set; } + + /// + /// Gets or Sets Property + /// + [DataMember(Name="property", EmitDefaultValue=false)] + public string Property { get; set; } + + /// + /// Gets or Sets _123Number + /// + [DataMember(Name="123Number", EmitDefaultValue=false)] + public int _123Number { get; private set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class Name {\n"); + sb.Append(" _Name: ").Append(_Name).Append("\n"); + sb.Append(" SnakeCase: ").Append(SnakeCase).Append("\n"); + sb.Append(" Property: ").Append(Property).Append("\n"); + sb.Append(" _123Number: ").Append(_123Number).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 OpenAPIClientUtils.compareLogic.Compare(this, input as Name).AreEqual; + } + + /// + /// Returns true if Name instances are equal + /// + /// Instance of Name to be compared + /// Boolean + public bool Equals(Name input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this._Name != null) + hashCode = hashCode * 59 + this._Name.GetHashCode(); + if (this.SnakeCase != null) + hashCode = hashCode * 59 + this.SnakeCase.GetHashCode(); + if (this.Property != null) + hashCode = hashCode * 59 + this.Property.GetHashCode(); + if (this._123Number != null) + hashCode = hashCode * 59 + this._123Number.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-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/NumberOnly.cs new file mode 100644 index 00000000000..8e838a08ed1 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -0,0 +1,118 @@ +/* + * 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; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// NumberOnly + /// + [DataContract] + public partial class NumberOnly : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// justNumber. + public NumberOnly(decimal justNumber = default(decimal)) + { + this.JustNumber = justNumber; + } + + /// + /// Gets or Sets JustNumber + /// + [DataMember(Name="JustNumber", EmitDefaultValue=false)] + public decimal JustNumber { 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 NumberOnly {\n"); + sb.Append(" JustNumber: ").Append(JustNumber).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 OpenAPIClientUtils.compareLogic.Compare(this, input as NumberOnly).AreEqual; + } + + /// + /// Returns true if NumberOnly instances are equal + /// + /// Instance of NumberOnly to be compared + /// Boolean + public bool Equals(NumberOnly input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.JustNumber != null) + hashCode = hashCode * 59 + this.JustNumber.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-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/Order.cs new file mode 100644 index 00000000000..d13d7c87276 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/Order.cs @@ -0,0 +1,207 @@ +/* + * 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; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// Order + /// + [DataContract] + public partial class Order : IEquatable, IValidatableObject + { + /// + /// Order Status + /// + /// Order Status + [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 + + } + + /// + /// Order Status + /// + /// Order Status + [DataMember(Name="status", EmitDefaultValue=false)] + public StatusEnum? Status { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// id. + /// petId. + /// quantity. + /// shipDate. + /// Order Status. + /// complete (default to false). + public Order(long id = default(long), long petId = default(long), int quantity = default(int), DateTime shipDate = default(DateTime), StatusEnum? status = default(StatusEnum?), bool complete = false) + { + this.Id = id; + this.PetId = petId; + this.Quantity = quantity; + this.ShipDate = shipDate; + this.Status = status; + // use default value if no "complete" provided + if (complete == null) + { + this.Complete = false; + } + else + { + this.Complete = complete; + } + } + + /// + /// Gets or Sets Id + /// + [DataMember(Name="id", EmitDefaultValue=false)] + public long Id { get; set; } + + /// + /// Gets or Sets PetId + /// + [DataMember(Name="petId", EmitDefaultValue=false)] + public long PetId { get; set; } + + /// + /// Gets or Sets Quantity + /// + [DataMember(Name="quantity", EmitDefaultValue=false)] + public int Quantity { get; set; } + + /// + /// Gets or Sets ShipDate + /// + [DataMember(Name="shipDate", EmitDefaultValue=false)] + public DateTime ShipDate { get; set; } + + /// + /// Gets or Sets Complete + /// + [DataMember(Name="complete", EmitDefaultValue=false)] + public bool Complete { 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 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(); + } + + /// + /// 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 OpenAPIClientUtils.compareLogic.Compare(this, input as Order).AreEqual; + } + + /// + /// Returns true if Order instances are equal + /// + /// Instance of Order to be compared + /// Boolean + public bool Equals(Order input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Id != null) + hashCode = hashCode * 59 + this.Id.GetHashCode(); + if (this.PetId != null) + hashCode = hashCode * 59 + this.PetId.GetHashCode(); + if (this.Quantity != null) + hashCode = hashCode * 59 + this.Quantity.GetHashCode(); + if (this.ShipDate != null) + hashCode = hashCode * 59 + this.ShipDate.GetHashCode(); + hashCode = hashCode * 59 + this.Status.GetHashCode(); + if (this.Complete != null) + hashCode = hashCode * 59 + this.Complete.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-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/OuterComposite.cs new file mode 100644 index 00000000000..b3ea0bd5e04 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/OuterComposite.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; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// OuterComposite + /// + [DataContract] + public partial class OuterComposite : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// myNumber. + /// myString. + /// myBoolean. + public OuterComposite(decimal myNumber = default(decimal), string myString = default(string), bool myBoolean = default(bool)) + { + this.MyNumber = myNumber; + this.MyString = myString; + this.MyBoolean = myBoolean; + } + + /// + /// Gets or Sets MyNumber + /// + [DataMember(Name="my_number", EmitDefaultValue=false)] + public decimal MyNumber { get; set; } + + /// + /// Gets or Sets MyString + /// + [DataMember(Name="my_string", EmitDefaultValue=false)] + public string MyString { get; set; } + + /// + /// Gets or Sets MyBoolean + /// + [DataMember(Name="my_boolean", EmitDefaultValue=false)] + public bool MyBoolean { 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 OuterComposite {\n"); + sb.Append(" MyNumber: ").Append(MyNumber).Append("\n"); + sb.Append(" MyString: ").Append(MyString).Append("\n"); + sb.Append(" MyBoolean: ").Append(MyBoolean).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 OpenAPIClientUtils.compareLogic.Compare(this, input as OuterComposite).AreEqual; + } + + /// + /// Returns true if OuterComposite instances are equal + /// + /// Instance of OuterComposite to be compared + /// Boolean + public bool Equals(OuterComposite input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.MyNumber != null) + hashCode = hashCode * 59 + this.MyNumber.GetHashCode(); + if (this.MyString != null) + hashCode = hashCode * 59 + this.MyString.GetHashCode(); + if (this.MyBoolean != null) + hashCode = hashCode * 59 + this.MyBoolean.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-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/OuterEnum.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/OuterEnum.cs new file mode 100644 index 00000000000..0ad70406402 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/OuterEnum.cs @@ -0,0 +1,57 @@ +/* + * 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; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// Defines OuterEnum + /// + + [JsonConverter(typeof(StringEnumConverter))] + + 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-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/Pet.cs new file mode 100644 index 00000000000..9d217b2ad2b --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/Pet.cs @@ -0,0 +1,222 @@ +/* + * 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; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// Pet + /// + [DataContract] + public partial class Pet : IEquatable, IValidatableObject + { + /// + /// pet status in the store + /// + /// pet status in the store + [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 + + } + + /// + /// pet status in the store + /// + /// pet status in the store + [DataMember(Name="status", EmitDefaultValue=false)] + public StatusEnum? Status { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected Pet() { } + /// + /// Initializes a new instance of the class. + /// + /// id. + /// category. + /// name (required). + /// photoUrls (required). + /// tags. + /// pet status in the store. + public Pet(long id = default(long), Category category = default(Category), string name = default(string), List photoUrls = default(List), List tags = default(List), StatusEnum? status = default(StatusEnum?)) + { + // to ensure "name" is required (not null) + if (name == null) + { + throw new InvalidDataException("name is a required property for Pet and cannot be null"); + } + else + { + this.Name = name; + } + + // to ensure "photoUrls" is required (not null) + if (photoUrls == null) + { + throw new InvalidDataException("photoUrls is a required property for Pet and cannot be null"); + } + else + { + this.PhotoUrls = photoUrls; + } + + this.Id = id; + this.Category = category; + this.Tags = tags; + this.Status = status; + } + + /// + /// Gets or Sets Id + /// + [DataMember(Name="id", EmitDefaultValue=false)] + public long Id { get; set; } + + /// + /// Gets or Sets Category + /// + [DataMember(Name="category", EmitDefaultValue=false)] + public Category Category { get; set; } + + /// + /// Gets or Sets Name + /// + [DataMember(Name="name", EmitDefaultValue=false)] + public string Name { get; set; } + + /// + /// Gets or Sets PhotoUrls + /// + [DataMember(Name="photoUrls", EmitDefaultValue=false)] + public List PhotoUrls { get; set; } + + /// + /// Gets or Sets Tags + /// + [DataMember(Name="tags", EmitDefaultValue=false)] + public List Tags { 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 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(); + } + + /// + /// 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 OpenAPIClientUtils.compareLogic.Compare(this, input as Pet).AreEqual; + } + + /// + /// Returns true if Pet instances are equal + /// + /// Instance of Pet to be compared + /// Boolean + public bool Equals(Pet input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Id != null) + hashCode = hashCode * 59 + this.Id.GetHashCode(); + if (this.Category != null) + hashCode = hashCode * 59 + this.Category.GetHashCode(); + if (this.Name != null) + hashCode = hashCode * 59 + this.Name.GetHashCode(); + if (this.PhotoUrls != null) + hashCode = hashCode * 59 + this.PhotoUrls.GetHashCode(); + if (this.Tags != null) + hashCode = hashCode * 59 + this.Tags.GetHashCode(); + hashCode = hashCode * 59 + this.Status.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-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs new file mode 100644 index 00000000000..bc10ad93170 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs @@ -0,0 +1,127 @@ +/* + * 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; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// ReadOnlyFirst + /// + [DataContract] + public partial class ReadOnlyFirst : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// baz. + public ReadOnlyFirst(string baz = default(string)) + { + this.Baz = baz; + } + + /// + /// Gets or Sets Bar + /// + [DataMember(Name="bar", EmitDefaultValue=false)] + public string Bar { get; private set; } + + /// + /// Gets or Sets Baz + /// + [DataMember(Name="baz", EmitDefaultValue=false)] + public string Baz { 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 ReadOnlyFirst {\n"); + sb.Append(" Bar: ").Append(Bar).Append("\n"); + sb.Append(" Baz: ").Append(Baz).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 OpenAPIClientUtils.compareLogic.Compare(this, input as ReadOnlyFirst).AreEqual; + } + + /// + /// Returns true if ReadOnlyFirst instances are equal + /// + /// Instance of ReadOnlyFirst to be compared + /// Boolean + public bool Equals(ReadOnlyFirst input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Bar != null) + hashCode = hashCode * 59 + this.Bar.GetHashCode(); + if (this.Baz != null) + hashCode = hashCode * 59 + this.Baz.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-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/Return.cs new file mode 100644 index 00000000000..8ec49c13906 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/Return.cs @@ -0,0 +1,118 @@ +/* + * 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; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// Model for testing reserved words + /// + [DataContract] + public partial class Return : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// _return. + public Return(int _return = default(int)) + { + this._Return = _return; + } + + /// + /// Gets or Sets _Return + /// + [DataMember(Name="return", EmitDefaultValue=false)] + public int _Return { 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 Return {\n"); + sb.Append(" _Return: ").Append(_Return).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 OpenAPIClientUtils.compareLogic.Compare(this, input as Return).AreEqual; + } + + /// + /// Returns true if Return instances are equal + /// + /// Instance of Return to be compared + /// Boolean + public bool Equals(Return input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this._Return != null) + hashCode = hashCode * 59 + this._Return.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-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/SpecialModelName.cs new file mode 100644 index 00000000000..d7cff99d127 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -0,0 +1,118 @@ +/* + * 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; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// SpecialModelName + /// + [DataContract] + public partial class SpecialModelName : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// specialPropertyName. + public SpecialModelName(long specialPropertyName = default(long)) + { + this.SpecialPropertyName = specialPropertyName; + } + + /// + /// Gets or Sets SpecialPropertyName + /// + [DataMember(Name="$special[property.name]", EmitDefaultValue=false)] + public long SpecialPropertyName { 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 SpecialModelName {\n"); + sb.Append(" SpecialPropertyName: ").Append(SpecialPropertyName).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 OpenAPIClientUtils.compareLogic.Compare(this, input as SpecialModelName).AreEqual; + } + + /// + /// Returns true if SpecialModelName instances are equal + /// + /// Instance of SpecialModelName to be compared + /// Boolean + public bool Equals(SpecialModelName input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.SpecialPropertyName != null) + hashCode = hashCode * 59 + this.SpecialPropertyName.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-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/Tag.cs new file mode 100644 index 00000000000..f7517d82f1e --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/Tag.cs @@ -0,0 +1,129 @@ +/* + * 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; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// Tag + /// + [DataContract] + public partial class Tag : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// id. + /// name. + public Tag(long id = default(long), string name = default(string)) + { + this.Id = id; + this.Name = name; + } + + /// + /// Gets or Sets Id + /// + [DataMember(Name="id", EmitDefaultValue=false)] + public long Id { get; set; } + + /// + /// Gets or Sets Name + /// + [DataMember(Name="name", EmitDefaultValue=false)] + public string Name { 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 Tag {\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Name: ").Append(Name).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 OpenAPIClientUtils.compareLogic.Compare(this, input as Tag).AreEqual; + } + + /// + /// Returns true if Tag instances are equal + /// + /// Instance of Tag to be compared + /// Boolean + public bool Equals(Tag input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Id != null) + hashCode = hashCode * 59 + this.Id.GetHashCode(); + if (this.Name != null) + hashCode = hashCode * 59 + this.Name.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-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/TypeHolderDefault.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/TypeHolderDefault.cs new file mode 100644 index 00000000000..8be68877c78 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/TypeHolderDefault.cs @@ -0,0 +1,212 @@ +/* + * 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; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// TypeHolderDefault + /// + [DataContract] + public partial class TypeHolderDefault : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected TypeHolderDefault() { } + /// + /// Initializes a new instance of the class. + /// + /// stringItem (required) (default to "what"). + /// numberItem (required). + /// integerItem (required). + /// boolItem (required) (default to true). + /// arrayItem (required). + public TypeHolderDefault(string stringItem = "what", decimal numberItem = default(decimal), int integerItem = default(int), bool boolItem = true, List arrayItem = default(List)) + { + // to ensure "stringItem" is required (not null) + if (stringItem == null) + { + throw new InvalidDataException("stringItem is a required property for TypeHolderDefault and cannot be null"); + } + else + { + this.StringItem = stringItem; + } + + // to ensure "numberItem" is required (not null) + if (numberItem == null) + { + throw new InvalidDataException("numberItem is a required property for TypeHolderDefault and cannot be null"); + } + else + { + this.NumberItem = numberItem; + } + + // to ensure "integerItem" is required (not null) + if (integerItem == null) + { + throw new InvalidDataException("integerItem is a required property for TypeHolderDefault and cannot be null"); + } + else + { + this.IntegerItem = integerItem; + } + + // to ensure "boolItem" is required (not null) + if (boolItem == null) + { + throw new InvalidDataException("boolItem is a required property for TypeHolderDefault and cannot be null"); + } + else + { + this.BoolItem = boolItem; + } + + // to ensure "arrayItem" is required (not null) + if (arrayItem == null) + { + throw new InvalidDataException("arrayItem is a required property for TypeHolderDefault and cannot be null"); + } + else + { + this.ArrayItem = arrayItem; + } + + } + + /// + /// Gets or Sets StringItem + /// + [DataMember(Name="string_item", EmitDefaultValue=false)] + public string StringItem { get; set; } + + /// + /// Gets or Sets NumberItem + /// + [DataMember(Name="number_item", EmitDefaultValue=false)] + public decimal NumberItem { get; set; } + + /// + /// Gets or Sets IntegerItem + /// + [DataMember(Name="integer_item", EmitDefaultValue=false)] + public int IntegerItem { get; set; } + + /// + /// Gets or Sets BoolItem + /// + [DataMember(Name="bool_item", EmitDefaultValue=false)] + public bool BoolItem { get; set; } + + /// + /// Gets or Sets ArrayItem + /// + [DataMember(Name="array_item", EmitDefaultValue=false)] + public List ArrayItem { 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 TypeHolderDefault {\n"); + sb.Append(" StringItem: ").Append(StringItem).Append("\n"); + sb.Append(" NumberItem: ").Append(NumberItem).Append("\n"); + sb.Append(" IntegerItem: ").Append(IntegerItem).Append("\n"); + sb.Append(" BoolItem: ").Append(BoolItem).Append("\n"); + sb.Append(" ArrayItem: ").Append(ArrayItem).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 OpenAPIClientUtils.compareLogic.Compare(this, input as TypeHolderDefault).AreEqual; + } + + /// + /// Returns true if TypeHolderDefault instances are equal + /// + /// Instance of TypeHolderDefault to be compared + /// Boolean + public bool Equals(TypeHolderDefault input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.StringItem != null) + hashCode = hashCode * 59 + this.StringItem.GetHashCode(); + if (this.NumberItem != null) + hashCode = hashCode * 59 + this.NumberItem.GetHashCode(); + if (this.IntegerItem != null) + hashCode = hashCode * 59 + this.IntegerItem.GetHashCode(); + if (this.BoolItem != null) + hashCode = hashCode * 59 + this.BoolItem.GetHashCode(); + if (this.ArrayItem != null) + hashCode = hashCode * 59 + this.ArrayItem.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-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/TypeHolderExample.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/TypeHolderExample.cs new file mode 100644 index 00000000000..83183b1d4a5 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/TypeHolderExample.cs @@ -0,0 +1,212 @@ +/* + * 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; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// TypeHolderExample + /// + [DataContract] + public partial class TypeHolderExample : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected TypeHolderExample() { } + /// + /// Initializes a new instance of the class. + /// + /// stringItem (required). + /// numberItem (required). + /// integerItem (required). + /// boolItem (required). + /// arrayItem (required). + public TypeHolderExample(string stringItem = default(string), decimal numberItem = default(decimal), int integerItem = default(int), bool boolItem = default(bool), List arrayItem = default(List)) + { + // to ensure "stringItem" is required (not null) + if (stringItem == null) + { + throw new InvalidDataException("stringItem is a required property for TypeHolderExample and cannot be null"); + } + else + { + this.StringItem = stringItem; + } + + // to ensure "numberItem" is required (not null) + if (numberItem == null) + { + throw new InvalidDataException("numberItem is a required property for TypeHolderExample and cannot be null"); + } + else + { + this.NumberItem = numberItem; + } + + // to ensure "integerItem" is required (not null) + if (integerItem == null) + { + throw new InvalidDataException("integerItem is a required property for TypeHolderExample and cannot be null"); + } + else + { + this.IntegerItem = integerItem; + } + + // to ensure "boolItem" is required (not null) + if (boolItem == null) + { + throw new InvalidDataException("boolItem is a required property for TypeHolderExample and cannot be null"); + } + else + { + this.BoolItem = boolItem; + } + + // to ensure "arrayItem" is required (not null) + if (arrayItem == null) + { + throw new InvalidDataException("arrayItem is a required property for TypeHolderExample and cannot be null"); + } + else + { + this.ArrayItem = arrayItem; + } + + } + + /// + /// Gets or Sets StringItem + /// + [DataMember(Name="string_item", EmitDefaultValue=false)] + public string StringItem { get; set; } + + /// + /// Gets or Sets NumberItem + /// + [DataMember(Name="number_item", EmitDefaultValue=false)] + public decimal NumberItem { get; set; } + + /// + /// Gets or Sets IntegerItem + /// + [DataMember(Name="integer_item", EmitDefaultValue=false)] + public int IntegerItem { get; set; } + + /// + /// Gets or Sets BoolItem + /// + [DataMember(Name="bool_item", EmitDefaultValue=false)] + public bool BoolItem { get; set; } + + /// + /// Gets or Sets ArrayItem + /// + [DataMember(Name="array_item", EmitDefaultValue=false)] + public List ArrayItem { 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 TypeHolderExample {\n"); + sb.Append(" StringItem: ").Append(StringItem).Append("\n"); + sb.Append(" NumberItem: ").Append(NumberItem).Append("\n"); + sb.Append(" IntegerItem: ").Append(IntegerItem).Append("\n"); + sb.Append(" BoolItem: ").Append(BoolItem).Append("\n"); + sb.Append(" ArrayItem: ").Append(ArrayItem).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 OpenAPIClientUtils.compareLogic.Compare(this, input as TypeHolderExample).AreEqual; + } + + /// + /// Returns true if TypeHolderExample instances are equal + /// + /// Instance of TypeHolderExample to be compared + /// Boolean + public bool Equals(TypeHolderExample input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.StringItem != null) + hashCode = hashCode * 59 + this.StringItem.GetHashCode(); + if (this.NumberItem != null) + hashCode = hashCode * 59 + this.NumberItem.GetHashCode(); + if (this.IntegerItem != null) + hashCode = hashCode * 59 + this.IntegerItem.GetHashCode(); + if (this.BoolItem != null) + hashCode = hashCode * 59 + this.BoolItem.GetHashCode(); + if (this.ArrayItem != null) + hashCode = hashCode * 59 + this.ArrayItem.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-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/User.cs new file mode 100644 index 00000000000..6905abd8c7a --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/User.cs @@ -0,0 +1,196 @@ +/* + * 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; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// User + /// + [DataContract] + public partial class User : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// id. + /// username. + /// firstName. + /// lastName. + /// email. + /// password. + /// phone. + /// User Status. + public User(long id = default(long), string username = default(string), string firstName = default(string), string lastName = default(string), string email = default(string), string password = default(string), string phone = default(string), int userStatus = default(int)) + { + this.Id = id; + this.Username = username; + this.FirstName = firstName; + this.LastName = lastName; + this.Email = email; + this.Password = password; + this.Phone = phone; + this.UserStatus = userStatus; + } + + /// + /// Gets or Sets Id + /// + [DataMember(Name="id", EmitDefaultValue=false)] + public long Id { get; set; } + + /// + /// Gets or Sets Username + /// + [DataMember(Name="username", EmitDefaultValue=false)] + public string Username { get; set; } + + /// + /// Gets or Sets FirstName + /// + [DataMember(Name="firstName", EmitDefaultValue=false)] + public string FirstName { get; set; } + + /// + /// Gets or Sets LastName + /// + [DataMember(Name="lastName", EmitDefaultValue=false)] + public string LastName { get; set; } + + /// + /// Gets or Sets Email + /// + [DataMember(Name="email", EmitDefaultValue=false)] + public string Email { get; set; } + + /// + /// Gets or Sets Password + /// + [DataMember(Name="password", EmitDefaultValue=false)] + public string Password { get; set; } + + /// + /// Gets or Sets Phone + /// + [DataMember(Name="phone", EmitDefaultValue=false)] + public string Phone { get; set; } + + /// + /// User Status + /// + /// User Status + [DataMember(Name="userStatus", EmitDefaultValue=false)] + public int UserStatus { 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 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(); + } + + /// + /// 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 OpenAPIClientUtils.compareLogic.Compare(this, input as User).AreEqual; + } + + /// + /// Returns true if User instances are equal + /// + /// Instance of User to be compared + /// Boolean + public bool Equals(User input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Id != null) + hashCode = hashCode * 59 + this.Id.GetHashCode(); + if (this.Username != null) + hashCode = hashCode * 59 + this.Username.GetHashCode(); + if (this.FirstName != null) + hashCode = hashCode * 59 + this.FirstName.GetHashCode(); + if (this.LastName != null) + hashCode = hashCode * 59 + this.LastName.GetHashCode(); + if (this.Email != null) + hashCode = hashCode * 59 + this.Email.GetHashCode(); + if (this.Password != null) + hashCode = hashCode * 59 + this.Password.GetHashCode(); + if (this.Phone != null) + hashCode = hashCode * 59 + this.Phone.GetHashCode(); + if (this.UserStatus != null) + hashCode = hashCode * 59 + this.UserStatus.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-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/XmlItem.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/XmlItem.cs new file mode 100644 index 00000000000..e09b9dde360 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Model/XmlItem.cs @@ -0,0 +1,426 @@ +/* + * 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; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// XmlItem + /// + [DataContract] + public partial class XmlItem : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// attributeString. + /// attributeNumber. + /// attributeInteger. + /// attributeBoolean. + /// wrappedArray. + /// nameString. + /// nameNumber. + /// nameInteger. + /// nameBoolean. + /// nameArray. + /// nameWrappedArray. + /// prefixString. + /// prefixNumber. + /// prefixInteger. + /// prefixBoolean. + /// prefixArray. + /// prefixWrappedArray. + /// namespaceString. + /// namespaceNumber. + /// namespaceInteger. + /// namespaceBoolean. + /// namespaceArray. + /// namespaceWrappedArray. + /// prefixNsString. + /// prefixNsNumber. + /// prefixNsInteger. + /// prefixNsBoolean. + /// prefixNsArray. + /// prefixNsWrappedArray. + public XmlItem(string attributeString = default(string), decimal attributeNumber = default(decimal), int attributeInteger = default(int), bool attributeBoolean = default(bool), List wrappedArray = default(List), string nameString = default(string), decimal nameNumber = default(decimal), int nameInteger = default(int), bool nameBoolean = default(bool), List nameArray = default(List), List nameWrappedArray = default(List), string prefixString = default(string), decimal prefixNumber = default(decimal), int prefixInteger = default(int), bool prefixBoolean = default(bool), List prefixArray = default(List), List prefixWrappedArray = default(List), string namespaceString = default(string), decimal namespaceNumber = default(decimal), int namespaceInteger = default(int), bool namespaceBoolean = default(bool), List namespaceArray = default(List), List namespaceWrappedArray = default(List), string prefixNsString = default(string), decimal prefixNsNumber = default(decimal), int prefixNsInteger = default(int), bool prefixNsBoolean = default(bool), List prefixNsArray = default(List), List prefixNsWrappedArray = default(List)) + { + this.AttributeString = attributeString; + this.AttributeNumber = attributeNumber; + this.AttributeInteger = attributeInteger; + this.AttributeBoolean = attributeBoolean; + this.WrappedArray = wrappedArray; + this.NameString = nameString; + this.NameNumber = nameNumber; + this.NameInteger = nameInteger; + this.NameBoolean = nameBoolean; + this.NameArray = nameArray; + this.NameWrappedArray = nameWrappedArray; + this.PrefixString = prefixString; + this.PrefixNumber = prefixNumber; + this.PrefixInteger = prefixInteger; + this.PrefixBoolean = prefixBoolean; + this.PrefixArray = prefixArray; + this.PrefixWrappedArray = prefixWrappedArray; + this.NamespaceString = namespaceString; + this.NamespaceNumber = namespaceNumber; + this.NamespaceInteger = namespaceInteger; + this.NamespaceBoolean = namespaceBoolean; + this.NamespaceArray = namespaceArray; + this.NamespaceWrappedArray = namespaceWrappedArray; + this.PrefixNsString = prefixNsString; + this.PrefixNsNumber = prefixNsNumber; + this.PrefixNsInteger = prefixNsInteger; + this.PrefixNsBoolean = prefixNsBoolean; + this.PrefixNsArray = prefixNsArray; + this.PrefixNsWrappedArray = prefixNsWrappedArray; + } + + /// + /// Gets or Sets AttributeString + /// + [DataMember(Name="attribute_string", EmitDefaultValue=false)] + public string AttributeString { get; set; } + + /// + /// Gets or Sets AttributeNumber + /// + [DataMember(Name="attribute_number", EmitDefaultValue=false)] + public decimal AttributeNumber { get; set; } + + /// + /// Gets or Sets AttributeInteger + /// + [DataMember(Name="attribute_integer", EmitDefaultValue=false)] + public int AttributeInteger { get; set; } + + /// + /// Gets or Sets AttributeBoolean + /// + [DataMember(Name="attribute_boolean", EmitDefaultValue=false)] + public bool AttributeBoolean { get; set; } + + /// + /// Gets or Sets WrappedArray + /// + [DataMember(Name="wrapped_array", EmitDefaultValue=false)] + public List WrappedArray { get; set; } + + /// + /// Gets or Sets NameString + /// + [DataMember(Name="name_string", EmitDefaultValue=false)] + public string NameString { get; set; } + + /// + /// Gets or Sets NameNumber + /// + [DataMember(Name="name_number", EmitDefaultValue=false)] + public decimal NameNumber { get; set; } + + /// + /// Gets or Sets NameInteger + /// + [DataMember(Name="name_integer", EmitDefaultValue=false)] + public int NameInteger { get; set; } + + /// + /// Gets or Sets NameBoolean + /// + [DataMember(Name="name_boolean", EmitDefaultValue=false)] + public bool NameBoolean { get; set; } + + /// + /// Gets or Sets NameArray + /// + [DataMember(Name="name_array", EmitDefaultValue=false)] + public List NameArray { get; set; } + + /// + /// Gets or Sets NameWrappedArray + /// + [DataMember(Name="name_wrapped_array", EmitDefaultValue=false)] + public List NameWrappedArray { get; set; } + + /// + /// Gets or Sets PrefixString + /// + [DataMember(Name="prefix_string", EmitDefaultValue=false)] + public string PrefixString { get; set; } + + /// + /// Gets or Sets PrefixNumber + /// + [DataMember(Name="prefix_number", EmitDefaultValue=false)] + public decimal PrefixNumber { get; set; } + + /// + /// Gets or Sets PrefixInteger + /// + [DataMember(Name="prefix_integer", EmitDefaultValue=false)] + public int PrefixInteger { get; set; } + + /// + /// Gets or Sets PrefixBoolean + /// + [DataMember(Name="prefix_boolean", EmitDefaultValue=false)] + public bool PrefixBoolean { get; set; } + + /// + /// Gets or Sets PrefixArray + /// + [DataMember(Name="prefix_array", EmitDefaultValue=false)] + public List PrefixArray { get; set; } + + /// + /// Gets or Sets PrefixWrappedArray + /// + [DataMember(Name="prefix_wrapped_array", EmitDefaultValue=false)] + public List PrefixWrappedArray { get; set; } + + /// + /// Gets or Sets NamespaceString + /// + [DataMember(Name="namespace_string", EmitDefaultValue=false)] + public string NamespaceString { get; set; } + + /// + /// Gets or Sets NamespaceNumber + /// + [DataMember(Name="namespace_number", EmitDefaultValue=false)] + public decimal NamespaceNumber { get; set; } + + /// + /// Gets or Sets NamespaceInteger + /// + [DataMember(Name="namespace_integer", EmitDefaultValue=false)] + public int NamespaceInteger { get; set; } + + /// + /// Gets or Sets NamespaceBoolean + /// + [DataMember(Name="namespace_boolean", EmitDefaultValue=false)] + public bool NamespaceBoolean { get; set; } + + /// + /// Gets or Sets NamespaceArray + /// + [DataMember(Name="namespace_array", EmitDefaultValue=false)] + public List NamespaceArray { get; set; } + + /// + /// Gets or Sets NamespaceWrappedArray + /// + [DataMember(Name="namespace_wrapped_array", EmitDefaultValue=false)] + public List NamespaceWrappedArray { get; set; } + + /// + /// Gets or Sets PrefixNsString + /// + [DataMember(Name="prefix_ns_string", EmitDefaultValue=false)] + public string PrefixNsString { get; set; } + + /// + /// Gets or Sets PrefixNsNumber + /// + [DataMember(Name="prefix_ns_number", EmitDefaultValue=false)] + public decimal PrefixNsNumber { get; set; } + + /// + /// Gets or Sets PrefixNsInteger + /// + [DataMember(Name="prefix_ns_integer", EmitDefaultValue=false)] + public int PrefixNsInteger { get; set; } + + /// + /// Gets or Sets PrefixNsBoolean + /// + [DataMember(Name="prefix_ns_boolean", EmitDefaultValue=false)] + public bool PrefixNsBoolean { get; set; } + + /// + /// Gets or Sets PrefixNsArray + /// + [DataMember(Name="prefix_ns_array", EmitDefaultValue=false)] + public List PrefixNsArray { get; set; } + + /// + /// Gets or Sets PrefixNsWrappedArray + /// + [DataMember(Name="prefix_ns_wrapped_array", EmitDefaultValue=false)] + public List PrefixNsWrappedArray { 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 XmlItem {\n"); + sb.Append(" AttributeString: ").Append(AttributeString).Append("\n"); + sb.Append(" AttributeNumber: ").Append(AttributeNumber).Append("\n"); + sb.Append(" AttributeInteger: ").Append(AttributeInteger).Append("\n"); + sb.Append(" AttributeBoolean: ").Append(AttributeBoolean).Append("\n"); + sb.Append(" WrappedArray: ").Append(WrappedArray).Append("\n"); + sb.Append(" NameString: ").Append(NameString).Append("\n"); + sb.Append(" NameNumber: ").Append(NameNumber).Append("\n"); + sb.Append(" NameInteger: ").Append(NameInteger).Append("\n"); + sb.Append(" NameBoolean: ").Append(NameBoolean).Append("\n"); + sb.Append(" NameArray: ").Append(NameArray).Append("\n"); + sb.Append(" NameWrappedArray: ").Append(NameWrappedArray).Append("\n"); + sb.Append(" PrefixString: ").Append(PrefixString).Append("\n"); + sb.Append(" PrefixNumber: ").Append(PrefixNumber).Append("\n"); + sb.Append(" PrefixInteger: ").Append(PrefixInteger).Append("\n"); + sb.Append(" PrefixBoolean: ").Append(PrefixBoolean).Append("\n"); + sb.Append(" PrefixArray: ").Append(PrefixArray).Append("\n"); + sb.Append(" PrefixWrappedArray: ").Append(PrefixWrappedArray).Append("\n"); + sb.Append(" NamespaceString: ").Append(NamespaceString).Append("\n"); + sb.Append(" NamespaceNumber: ").Append(NamespaceNumber).Append("\n"); + sb.Append(" NamespaceInteger: ").Append(NamespaceInteger).Append("\n"); + sb.Append(" NamespaceBoolean: ").Append(NamespaceBoolean).Append("\n"); + sb.Append(" NamespaceArray: ").Append(NamespaceArray).Append("\n"); + sb.Append(" NamespaceWrappedArray: ").Append(NamespaceWrappedArray).Append("\n"); + sb.Append(" PrefixNsString: ").Append(PrefixNsString).Append("\n"); + sb.Append(" PrefixNsNumber: ").Append(PrefixNsNumber).Append("\n"); + sb.Append(" PrefixNsInteger: ").Append(PrefixNsInteger).Append("\n"); + sb.Append(" PrefixNsBoolean: ").Append(PrefixNsBoolean).Append("\n"); + sb.Append(" PrefixNsArray: ").Append(PrefixNsArray).Append("\n"); + sb.Append(" PrefixNsWrappedArray: ").Append(PrefixNsWrappedArray).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 OpenAPIClientUtils.compareLogic.Compare(this, input as XmlItem).AreEqual; + } + + /// + /// Returns true if XmlItem instances are equal + /// + /// Instance of XmlItem to be compared + /// Boolean + public bool Equals(XmlItem input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.AttributeString != null) + hashCode = hashCode * 59 + this.AttributeString.GetHashCode(); + if (this.AttributeNumber != null) + hashCode = hashCode * 59 + this.AttributeNumber.GetHashCode(); + if (this.AttributeInteger != null) + hashCode = hashCode * 59 + this.AttributeInteger.GetHashCode(); + if (this.AttributeBoolean != null) + hashCode = hashCode * 59 + this.AttributeBoolean.GetHashCode(); + if (this.WrappedArray != null) + hashCode = hashCode * 59 + this.WrappedArray.GetHashCode(); + if (this.NameString != null) + hashCode = hashCode * 59 + this.NameString.GetHashCode(); + if (this.NameNumber != null) + hashCode = hashCode * 59 + this.NameNumber.GetHashCode(); + if (this.NameInteger != null) + hashCode = hashCode * 59 + this.NameInteger.GetHashCode(); + if (this.NameBoolean != null) + hashCode = hashCode * 59 + this.NameBoolean.GetHashCode(); + if (this.NameArray != null) + hashCode = hashCode * 59 + this.NameArray.GetHashCode(); + if (this.NameWrappedArray != null) + hashCode = hashCode * 59 + this.NameWrappedArray.GetHashCode(); + if (this.PrefixString != null) + hashCode = hashCode * 59 + this.PrefixString.GetHashCode(); + if (this.PrefixNumber != null) + hashCode = hashCode * 59 + this.PrefixNumber.GetHashCode(); + if (this.PrefixInteger != null) + hashCode = hashCode * 59 + this.PrefixInteger.GetHashCode(); + if (this.PrefixBoolean != null) + hashCode = hashCode * 59 + this.PrefixBoolean.GetHashCode(); + if (this.PrefixArray != null) + hashCode = hashCode * 59 + this.PrefixArray.GetHashCode(); + if (this.PrefixWrappedArray != null) + hashCode = hashCode * 59 + this.PrefixWrappedArray.GetHashCode(); + if (this.NamespaceString != null) + hashCode = hashCode * 59 + this.NamespaceString.GetHashCode(); + if (this.NamespaceNumber != null) + hashCode = hashCode * 59 + this.NamespaceNumber.GetHashCode(); + if (this.NamespaceInteger != null) + hashCode = hashCode * 59 + this.NamespaceInteger.GetHashCode(); + if (this.NamespaceBoolean != null) + hashCode = hashCode * 59 + this.NamespaceBoolean.GetHashCode(); + if (this.NamespaceArray != null) + hashCode = hashCode * 59 + this.NamespaceArray.GetHashCode(); + if (this.NamespaceWrappedArray != null) + hashCode = hashCode * 59 + this.NamespaceWrappedArray.GetHashCode(); + if (this.PrefixNsString != null) + hashCode = hashCode * 59 + this.PrefixNsString.GetHashCode(); + if (this.PrefixNsNumber != null) + hashCode = hashCode * 59 + this.PrefixNsNumber.GetHashCode(); + if (this.PrefixNsInteger != null) + hashCode = hashCode * 59 + this.PrefixNsInteger.GetHashCode(); + if (this.PrefixNsBoolean != null) + hashCode = hashCode * 59 + this.PrefixNsBoolean.GetHashCode(); + if (this.PrefixNsArray != null) + hashCode = hashCode * 59 + this.PrefixNsArray.GetHashCode(); + if (this.PrefixNsWrappedArray != null) + hashCode = hashCode * 59 + this.PrefixNsWrappedArray.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-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Org.OpenAPITools.csproj new file mode 100644 index 00000000000..cf727d2fde2 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -0,0 +1,43 @@ + + + + false + netcoreapp2.0 + v2.0 + .NETCoreApp + Org.OpenAPITools + Org.OpenAPITools + Library + OpenAPI + OpenAPI + OpenAPI Library + A library generated from a OpenAPI doc + No Copyright + true + true + true + Org.OpenAPITools + 1.0.0 + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Org.OpenAPITools.nuspec b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Org.OpenAPITools.nuspec new file mode 100644 index 00000000000..3a930f57fb7 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Org.OpenAPITools.nuspec @@ -0,0 +1,44 @@ + + + + + $id$ + OpenAPI Library + + + $version$ + + + $author$ + + + $author$ + false + false + + + A library generated from a OpenAPI doc + http://www.apache.org/licenses/LICENSE-2.0.html + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Properties/AssemblyInfo.cs b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Properties/AssemblyInfo.cs new file mode 100644 index 00000000000..f3fef5199ab --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("OpenAPI Library")] +[assembly: AssemblyDescription("A library generated from a OpenAPI doc")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("OpenAPI")] +[assembly: AssemblyProduct("OpenAPILibrary")] +[assembly: AssemblyCopyright("No Copyright")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0")] +[assembly: AssemblyFileVersion("1.0.0")] diff --git a/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/project.json b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/project.json new file mode 100644 index 00000000000..252f5b93e63 --- /dev/null +++ b/samples/client/petstore/csharp-refactor/OpenAPIClientCore/src/Org.OpenAPITools/project.json @@ -0,0 +1,12 @@ +{ + "supports": {}, + "dependencies": { + "Newtonsoft.Json": "12.0.1", + "CompareNETObjects": "4.57.0", + "JsonSubTypes": "1.5.2", + "RestSharp": "106.6.7" + }, + "frameworks": { + "netcoreapp2.0": {} + } +}