diff --git a/ApiGeneratorOptions.json b/ApiGeneratorOptions.json index 6e5affbeb..cc26fb572 100644 --- a/ApiGeneratorOptions.json +++ b/ApiGeneratorOptions.json @@ -4,6 +4,13 @@ "swaggerThemeMode": "None", "useRestExtended": true, "includeDeprecated": false, + "projectSuffixName": "", + "contractsLocation": "Contracts.[[apiGroupName]]", + "endpointsLocation": "Endpoints.[[apiGroupName]]", + "handlersLocation": "Handlers.[[apiGroupName]]", + "usePartialClassForContracts": false, + "usePartialClassForEndpoints": false, + "removeNamespaceGroupSeparatorInGlobalUsings": false, "request": {}, "response": { "useProblemDetailsAsDefaultBody": false @@ -16,5 +23,5 @@ "modelNameCasingStyle": "PascalCase", "modelPropertyNameCasingStyle": "CamelCase" }, - "includeDeprecated": false + "includeDeprecatedOperations": false } \ No newline at end of file diff --git a/Atc.Rest.Api.Generator.sln.DotSettings b/Atc.Rest.Api.Generator.sln.DotSettings index 14dd62e35..d3fa14478 100644 --- a/Atc.Rest.Api.Generator.sln.DotSettings +++ b/Atc.Rest.Api.Generator.sln.DotSettings @@ -7,4 +7,5 @@ True True True + True True \ No newline at end of file diff --git a/README.md b/README.md index 31a6796fe..1ac4aa093 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,11 @@ - [Option **generate server all -h**](#option-generate-server-all--h) - [Command **options-file**](#command-options-file) - [Default options-file - ApiGeneratorOptions.json](#default-options-file---apigeneratoroptionsjson) + - [Custom options-file - ApiGeneratorOptions.json](#custom-options-file---apigeneratoroptionsjson) + - [Options for locations explained](#options-for-locations-explained) + - [Syntax](#syntax) + - [Examples](#examples) + - [Other options explained](#other-options-explained) - [PetStore Example](#petstore-example) - [Security - supporting role-based security and custom authentication-schemes](#security---supporting-role-based-security-and-custom-authentication-schemes) - [Roles and authentication-scheme validation](#roles-and-authentication-scheme-validation) @@ -79,12 +84,12 @@ flowchart TB; CLI --> ApiGenerator; CLI --> CodingRules; - + ApiGenerator --> ClientCSharp; ApiGenerator --> ServerMvc; ApiGenerator --> ServerMinimal; ApiGenerator .-> Contracts; - + ClientCSharp --> Framework; ClientCSharp .-> Contracts; ClientCSharp .-> CSharpGenerator; @@ -181,6 +186,9 @@ COMMANDS: ```powershell atc-rest-api-generator generate server all -h +DESCRIPTION: +Creates API, domain and host projects. + USAGE: atc-rest-api-generator.exe generate server all [OPTIONS] @@ -195,16 +203,24 @@ OPTIONS: -s, --specificationPath Path to Open API specification (directory, file or url) --optionsPath [OPTIONSPATH] Path to options json-file --validate-strictMode Use strictmode + --validate-operationIdValidation Use operationId validation --validate-operationIdCasingStyle [OPERATIONIDCASINGSTYLE] Set casingStyle for operationId. Valid values are: CamelCase (default), KebabCase, PascalCase, SnakeCase --validate-modelNameCasingStyle [MODELNAMECASINGSTYLE] Set casingStyle for model name. Valid values are: CamelCase, KebabCase, PascalCase (default), SnakeCase --validate-modelPropertyNameCasingStyle [MODELPROPERTYNAMECASINGSTYLE] Set casingStyle for model property name. Valid values are: CamelCase (default), KebabCase, PascalCase, SnakeCase - --useAuthorization Use authorization -p, --projectPrefixName Project prefix name (e.g. 'PetStore' becomes 'PetStore.Api.Generated') + --disableCodingRules Disable ATC-Coding-Rules + --useProblemDetailsAsDefaultResponseBody Use ProblemDetails as default responsen body + --endpointsLocation [ENDPOINTSLOCATION] If endpoints-localtion is provided, generated files will be placed here instead of the Endpoints folder + --contractsLocation [CONTRACTSLOCATION] If contracts-localtion is provided, generated files will be placed here instead of the Contracts folder + --handlersLocation [HANDLERSLOCATION] If handlers-localtion is provided, generated files will be placed here instead of the Handlers folder + --usePartialClassForContracts Use Partial-Class for contracts + --usePartialClassForEndpoints Use Partial-Class for endpoints + --removeNamespaceGroupSeparatorInGlobalUsings Remove space between namespace groups in GlobalUsing.cs + --aspnet-output-type [ASPNETOUTPUTTYPE] Set AspNet output type for the generated api. Valid values are: Mvc (default), MinimalApi + --swagger-theme [SWAGGERTHEME] Set Swagger theme for the hosting api. Valid values are: None, Default (default), Light, Dark --outputSlnPath Path to solution file (directory or file) --outputSrcPath Path to generated src projects (directory) --outputTestPath [OUTPUTTESTPATH] Path to generated test projects (directory) - --disableCodingRules Disable ATC-Coding-Rules - --removeNamespaceGroupSeparatorInGlobalUsings Remove space between namespace groups in GlobalUsing.cs ``` #### Command **options-file** @@ -225,13 +241,26 @@ COMMANDS: validate Validate the options file 'ApiGeneratorOptions.json' ``` +> **Note:** All values from the options-file will be overriden if pressent from the CLI options. +> +> **Example:** If the usePartialClassForContracts=false in the options-file and the CLI `--usePartialClassForContracts` options set, then the usePartialClassForContracts is true. + #### Default options-file - ApiGeneratorOptions.json ```json { "generator": { - "useAuthorization": false, + "aspNetOutputType": "Mvc", + "swaggerThemeMode": "None", "useRestExtended": true, + "projectName": "", + "projectSuffixName": "", + "contractsLocation": "Contracts.[[apiGroupName]]", + "endpointsLocation": "Endpoints.[[apiGroupName]]", + "handlersLocation": "Handlers.[[apiGroupName]]", + "usePartialClassForContracts": false, + "usePartialClassForEndpoints": false, + "removeNamespaceGroupSeparatorInGlobalUsings": false, "request": {}, "response": { "useProblemDetailsAsDefaultBody": false @@ -239,13 +268,119 @@ COMMANDS: }, "validation": { "strictMode": false, + "operationIdValidation": false, "operationIdCasingStyle": "CamelCase", "modelNameCasingStyle": "PascalCase", "modelPropertyNameCasingStyle": "CamelCase" - } + }, + "includeDeprecatedOperations": false } ``` +#### Custom options-file - ApiGeneratorOptions.json + +```json +{ + "generator": { + "aspNetOutputType": "MinimalApi", + "swaggerThemeMode": "Dark", + "useRestExtended": true, + "projectName": "", + "projectSuffixName": "", + "contractsLocation": "Contracts.[[apiGroupName]]", + "endpointsLocation": "Endpoints.[[apiGroupName]]", + "handlersLocation": "Handlers.[[apiGroupName]]", + "usePartialClassForContracts": false, + "usePartialClassForEndpoints": false, + "removeNamespaceGroupSeparatorInGlobalUsings": false, + "request": {}, + "response": { + "useProblemDetailsAsDefaultBody": false, + "customErrorResponseModel": { + "name": "ErrorResponse", + "description": "Represents an error response.", + "schema": { + "status": { + "dataType": "string?", + "description": "Gets or sets the status of the error." + }, + "message": { + "dataType": "string?", + "description": "Gets or sets the error message." + }, + "readableMessage": { + "dataType": "string?", + "description": "Gets or sets the readable message." + }, + "errorCode": { + "dataType": "string?", + "description": "Gets or sets the error code." + }, + "context": { + "dataType": "object?", + "description": "Gets or sets the context information." + } + } + } + }, + "client": { + "excludeEndpointGeneration": false, + "httpClientName": "My-ApiClient" + } + }, + "validation": { + "strictMode": false, + "operationIdValidation": false, + "operationIdCasingStyle": "CamelCase", + "modelNameCasingStyle": "PascalCase", + "modelPropertyNameCasingStyle": "CamelCase" + }, + "includeDeprecatedOperations": false +} +``` + +#### Options for locations explained + +The following options control the file locations for generated files such as contracts, endpoints, and handlers. +You can use specific syntax to define and customize the output file structure. + +##### Syntax + +For options like `contractsLocation`, `endpointsLocation`, and `handlersLocation`, +you can define paths using placeholders and custom directory names. + +The syntax is flexible and allows you to organize files based on grouping or specific requirements. + +##### Examples + +| Option-Name | Option-Value | Example-file | Generated-output | +|-------------|--------------|--------------|------------------| +| contractsLocation | Contracts | Account.cs | [Project-root]\Contracts\Accounts\Account.cs | +| contractsLocation | Contracts.[[apiGroupName]] | Account.cs | [Project-root]\Contracts\Accounts\Account.cs | +| contractsLocation | Contracts-[[apiGroupName]] | Account.cs | [Project-root]\Contracts\Accounts\Account.cs | +| contractsLocation | [[apiGroupName]].MyContracts | Account.cs | [Project-root]\Accounts\MyContracts\Account.cs | +| contractsLocation | [[apiGroupName]]-MyContracts | Account.cs | [Project-root]\Accounts\MyContracts\Account.cs | +| contractsLocation | [[apiGroupName]] | Account.cs | [Project-root]\Accounts\Account.cs | +| contractsLocation | . | Account.cs | [Project-root]\Account.cs | + +> Placeholder Explanation: +> +> - [[apiGroupName]]: A placeholder replaced by the API group name during code generation. This allows grouping files dynamically based on your API structure. +> - [Project-root]: The root directory of your project where the generated files will be placed. + +By using these options, you can effectively organize generated files into meaningful folder structures, ensuring clarity and scalability in your project layout. + +#### Other options explained + +The `projectSuffixName` extend `projectName` like the example: + +| projectName | projectSuffixName | Generated project name | Reson | +|-------------|-------------------|------------------------|-------| +| PetStore | | PetStore.Api.Generated | default is `Api.Generated` | +| PetStore | MyApi | PetStore.MyApi | | +| PetStore | Foo.Api | PetStore.Foo.Api | | +| PetStore | Bar-Api | PetStore.Bar.Api | | + ## PetStore Example The following command will generate an API that implements the offcial Pet Store example from Swagger. diff --git a/src/Atc.CodeGeneration.CSharp/Content/AccessModifiers.cs b/src/Atc.CodeGeneration.CSharp/Content/AccessModifiers.cs index 66075c684..270aa1b23 100644 --- a/src/Atc.CodeGeneration.CSharp/Content/AccessModifiers.cs +++ b/src/Atc.CodeGeneration.CSharp/Content/AccessModifiers.cs @@ -7,39 +7,18 @@ public enum AccessModifiers [Description("public")] Public, - [Description("public async")] - PublicAsync, - - [Description("public static")] - PublicStatic, - - [Description("public static implicit operator")] - PublicStaticImplicitOperator, - - [Description("public class")] - PublicClass, - - [Description("public static class")] - PublicStaticClass, - - [Description("public sealed class")] - PublicSealedClass, - - [Description("public record")] - PublicRecord, - - [Description("public record struct")] - PublicRecordStruct, - [Description("private")] Private, - [Description("private async")] - PrivateAsync, - [Description("protected")] Protected, [Description("internal")] Internal, + + [Description("protected internal")] + ProtectedInternal, + + [Description("private protected")] + PrivateProtected, } \ No newline at end of file diff --git a/src/Atc.CodeGeneration.CSharp/Content/DeclarationModifiers.cs b/src/Atc.CodeGeneration.CSharp/Content/DeclarationModifiers.cs new file mode 100644 index 000000000..bb34dfd2f --- /dev/null +++ b/src/Atc.CodeGeneration.CSharp/Content/DeclarationModifiers.cs @@ -0,0 +1,63 @@ +namespace Atc.CodeGeneration.CSharp.Content; + +public enum DeclarationModifiers +{ + None, + + [Description("public")] + Public, + + [Description("public async")] + PublicAsync, + + [Description("public static")] + PublicStatic, + + [Description("public static implicit operator")] + PublicStaticImplicitOperator, + + [Description("public class")] + PublicClass, + + [Description("public partial class")] + PublicPartialClass, + + [Description("public static class")] + PublicStaticClass, + + [Description("public sealed class")] + PublicSealedClass, + + [Description("public interface")] + PublicInterface, + + [Description("public partial interface")] + PublicPartialInterface, + + [Description("public static interface")] + PublicStaticInterface, + + [Description("public record")] + PublicRecord, + + [Description("public record struct")] + PublicRecordStruct, + + [Description("public partial record")] + PublicPartialRecord, + + [Description("public partial record struct")] + PublicPartialRecordStruct, + + [Description("private")] + Private, + + [Description("private async")] + PrivateAsync, + + [Description("protected")] + Protected, + + [Description("internal")] + Internal, +} \ No newline at end of file diff --git a/src/Atc.CodeGeneration.CSharp/Content/Factories/ClassParametersFactory.cs b/src/Atc.CodeGeneration.CSharp/Content/Factories/ClassParametersFactory.cs index ed4ec74b4..15142c32e 100644 --- a/src/Atc.CodeGeneration.CSharp/Content/Factories/ClassParametersFactory.cs +++ b/src/Atc.CodeGeneration.CSharp/Content/Factories/ClassParametersFactory.cs @@ -6,13 +6,14 @@ public static ClassParameters Create( string headerContent, string @namespace, AttributeParameters attribute, - string classTypeName) + string classTypeName, + bool usePartialClass = false) => new( HeaderContent: headerContent, Namespace: @namespace, DocumentationTags: null, Attributes: new List { attribute }, - AccessModifiers.PublicClass, + usePartialClass ? DeclarationModifiers.PublicPartialClass : DeclarationModifiers.PublicClass, ClassTypeName: classTypeName, GenericTypeName: null, InheritedClassTypeName: null, diff --git a/src/Atc.CodeGeneration.CSharp/Content/Factories/EnumParametersFactory.cs b/src/Atc.CodeGeneration.CSharp/Content/Factories/EnumParametersFactory.cs index 113698158..1b3e31ab6 100644 --- a/src/Atc.CodeGeneration.CSharp/Content/Factories/EnumParametersFactory.cs +++ b/src/Atc.CodeGeneration.CSharp/Content/Factories/EnumParametersFactory.cs @@ -14,7 +14,7 @@ public static EnumParameters Create( Namespace: @namespace, DocumentationTags: documentationTags, Attributes: attributes, - AccessModifier: AccessModifiers.Public, + DeclarationModifier: DeclarationModifiers.Public, EnumTypeName: enumTypeName, UseFlags: false, EnumValuesParametersFactory.Create(enumNames)); @@ -31,7 +31,7 @@ public static EnumParameters Create( Namespace: @namespace, DocumentationTags: documentationTags, Attributes: attributes, - AccessModifier: AccessModifiers.Public, + DeclarationModifier: DeclarationModifiers.Public, EnumTypeName: enumTypeName, UseFlags: DetermineIfFlagsAttributeShouldBeUsed(enumNameValues), EnumValuesParametersFactory.Create(enumNameValues)); diff --git a/src/Atc.CodeGeneration.CSharp/Content/Factories/InterfaceParametersFactory.cs b/src/Atc.CodeGeneration.CSharp/Content/Factories/InterfaceParametersFactory.cs index a088294b9..50fea3999 100644 --- a/src/Atc.CodeGeneration.CSharp/Content/Factories/InterfaceParametersFactory.cs +++ b/src/Atc.CodeGeneration.CSharp/Content/Factories/InterfaceParametersFactory.cs @@ -12,7 +12,7 @@ public static InterfaceParameters Create( Namespace: @namespace, DocumentationTags: null, Attributes: new List { attribute }, - AccessModifiers.Public, + DeclarationModifiers.Public, InterfaceTypeName: interfaceTypeName, InheritedInterfaceTypeName: null, Properties: null, @@ -28,7 +28,7 @@ public static InterfaceParameters Create( Namespace: @namespace, DocumentationTags: null, Attributes: attributes, - AccessModifiers.Public, + DeclarationModifiers.PublicInterface, InterfaceTypeName: interfaceTypeName, InheritedInterfaceTypeName: null, Properties: null, diff --git a/src/Atc.CodeGeneration.CSharp/Content/Generators/GenerateContentForClass.cs b/src/Atc.CodeGeneration.CSharp/Content/Generators/GenerateContentForClass.cs index 4474a12fe..014036392 100644 --- a/src/Atc.CodeGeneration.CSharp/Content/Generators/GenerateContentForClass.cs +++ b/src/Atc.CodeGeneration.CSharp/Content/Generators/GenerateContentForClass.cs @@ -27,7 +27,7 @@ public string Generate() parameters.DocumentationTags, parameters.Attributes)); - sb.Append($"{parameters.AccessModifier.GetDescription()} {parameters.ClassTypeName}"); + sb.Append($"{parameters.DeclarationModifier.GetDescription()} {parameters.ClassTypeName}"); if (!string.IsNullOrEmpty(parameters.GenericTypeName)) { sb.Append($"<{parameters.GenericTypeName}>"); diff --git a/src/Atc.CodeGeneration.CSharp/Content/Generators/GenerateContentForEnum.cs b/src/Atc.CodeGeneration.CSharp/Content/Generators/GenerateContentForEnum.cs index 447093510..b309c5768 100644 --- a/src/Atc.CodeGeneration.CSharp/Content/Generators/GenerateContentForEnum.cs +++ b/src/Atc.CodeGeneration.CSharp/Content/Generators/GenerateContentForEnum.cs @@ -34,7 +34,7 @@ public string Generate() sb.AppendLine("[JsonConverter(typeof(JsonStringEnumConverter))]"); } - sb.Append($"{parameters.AccessModifier.GetDescription()} enum "); + sb.Append($"{parameters.DeclarationModifier.GetDescription()} enum "); sb.AppendLine($"{parameters.EnumTypeName}"); sb.AppendLine("{"); diff --git a/src/Atc.CodeGeneration.CSharp/Content/Generators/GenerateContentForInterface.cs b/src/Atc.CodeGeneration.CSharp/Content/Generators/GenerateContentForInterface.cs index c1fffb53c..490e7720c 100644 --- a/src/Atc.CodeGeneration.CSharp/Content/Generators/GenerateContentForInterface.cs +++ b/src/Atc.CodeGeneration.CSharp/Content/Generators/GenerateContentForInterface.cs @@ -26,7 +26,7 @@ public string Generate() parameters.DocumentationTags, parameters.Attributes)); - sb.Append($"{parameters.AccessModifier.GetDescription()} interface "); + sb.Append($"{parameters.DeclarationModifier.GetDescription()} "); if (string.IsNullOrEmpty(parameters.InheritedInterfaceTypeName)) { sb.AppendLine($"{parameters.InterfaceTypeName}"); diff --git a/src/Atc.CodeGeneration.CSharp/Content/Generators/GenerateContentForRecords.cs b/src/Atc.CodeGeneration.CSharp/Content/Generators/GenerateContentForRecords.cs index 4e576f446..7875d3544 100644 --- a/src/Atc.CodeGeneration.CSharp/Content/Generators/GenerateContentForRecords.cs +++ b/src/Atc.CodeGeneration.CSharp/Content/Generators/GenerateContentForRecords.cs @@ -34,11 +34,11 @@ public string Generate() recordParameters.Parameters.Any(x => x.IsGenericListType && x.TypeName.Equals("T", StringComparison.Ordinal))) { - sb.Append($"{recordParameters.AccessModifier.GetDescription()} {recordParameters.Name}"); + sb.Append($"{recordParameters.DeclarationModifier.GetDescription()} {recordParameters.Name}"); } else { - sb.Append($"{recordParameters.AccessModifier.GetDescription()} {recordParameters.Name}"); + sb.Append($"{recordParameters.DeclarationModifier.GetDescription()} {recordParameters.Name}"); } if (recordParameters.Parameters is null || diff --git a/src/Atc.CodeGeneration.CSharp/Content/Generators/Internal/GenerateContentWriter.cs b/src/Atc.CodeGeneration.CSharp/Content/Generators/Internal/GenerateContentWriter.cs index c0656c74b..84bc4c33e 100644 --- a/src/Atc.CodeGeneration.CSharp/Content/Generators/Internal/GenerateContentWriter.cs +++ b/src/Atc.CodeGeneration.CSharp/Content/Generators/Internal/GenerateContentWriter.cs @@ -53,7 +53,7 @@ public string GenerateConstructor( var sb = new StringBuilder(); - sb.AppendAccessModifier(4, parameters.AccessModifier); + sb.AppendDeclarationModifier(4, parameters.DeclarationModifier); if (string.IsNullOrEmpty(parameters.GenericTypeName)) { @@ -181,9 +181,9 @@ public string GenerateProperty( } sb.Append(" "); - if (parameters.AccessModifier != AccessModifiers.None) + if (parameters.DeclarationModifier != DeclarationModifiers.None) { - sb.AppendAccessModifier(parameters.AccessModifier); + sb.AppendDeclarationModifier(parameters.DeclarationModifier); } sb.AppendTypeAndName(parameters.GenericTypeName, parameters.TypeName, parameters.IsNullableType, parameters.Name); @@ -261,9 +261,9 @@ public string GenerateMethod( } sb.Append(" "); - if (parameters.AccessModifier != AccessModifiers.None) + if (parameters.DeclarationModifier != DeclarationModifiers.None) { - sb.AppendAccessModifier(parameters.AccessModifier); + sb.AppendDeclarationModifier(parameters.DeclarationModifier); } if (string.IsNullOrEmpty(parameters.ReturnTypeName)) @@ -306,7 +306,7 @@ public string GenerateMethod( useCommaForEndChar); } - if (parameters.AccessModifier == AccessModifiers.None) + if (parameters.DeclarationModifier == DeclarationModifiers.None) { sb.Append(';'); } diff --git a/src/Atc.CodeGeneration.CSharp/Content/ParameterRecords.cs b/src/Atc.CodeGeneration.CSharp/Content/ParameterRecords.cs index f384eb90d..e340ff99e 100644 --- a/src/Atc.CodeGeneration.CSharp/Content/ParameterRecords.cs +++ b/src/Atc.CodeGeneration.CSharp/Content/ParameterRecords.cs @@ -36,7 +36,7 @@ public record BaseParameters( string? HeaderContent, string Namespace, CodeDocumentationTags? DocumentationTags, - AccessModifiers AccessModifier, + DeclarationModifiers DeclarationModifier, string TypeName); public record InterfaceParameters( @@ -44,7 +44,7 @@ public record InterfaceParameters( string Namespace, CodeDocumentationTags? DocumentationTags, IList? Attributes, - AccessModifiers AccessModifier, + DeclarationModifiers DeclarationModifier, string InterfaceTypeName, string? InheritedInterfaceTypeName, IList? Properties, @@ -53,7 +53,7 @@ public record InterfaceParameters( HeaderContent, Namespace, DocumentationTags, - AccessModifier, + DeclarationModifier, InterfaceTypeName); public record ClassParameters( @@ -61,7 +61,7 @@ public record ClassParameters( string Namespace, CodeDocumentationTags? DocumentationTags, IList? Attributes, - AccessModifiers AccessModifier, + DeclarationModifiers DeclarationModifier, string ClassTypeName, string? GenericTypeName, string? InheritedClassTypeName, @@ -75,7 +75,7 @@ public record ClassParameters( HeaderContent, Namespace, DocumentationTags, - AccessModifier, + DeclarationModifier, ClassTypeName); public record EnumParameters( @@ -83,7 +83,7 @@ public record EnumParameters( string Namespace, CodeDocumentationTags? DocumentationTags, IList? Attributes, - AccessModifiers AccessModifier, + DeclarationModifiers DeclarationModifier, string EnumTypeName, bool UseFlags, IList Values) @@ -91,7 +91,7 @@ public record EnumParameters( HeaderContent, Namespace, DocumentationTags, - AccessModifier, + DeclarationModifier, EnumTypeName); public record AttributeParameters( @@ -120,7 +120,7 @@ public record ConstructorParameterBaseParameters( public record ConstructorParameters( CodeDocumentationTags? DocumentationTags, - AccessModifiers AccessModifier, + DeclarationModifiers DeclarationModifier, string? GenericTypeName, string TypeName, string? InheritedClassTypeName, @@ -129,7 +129,7 @@ public record ConstructorParameters( public record PropertyParameters( CodeDocumentationTags? DocumentationTags, IList? Attributes, - AccessModifiers AccessModifier, + DeclarationModifiers DeclarationModifier, string? GenericTypeName, string TypeName, bool IsNullableType, @@ -156,7 +156,7 @@ public record PropertyParameters( public record MethodParameters( CodeDocumentationTags? DocumentationTags, IList? Attributes, - AccessModifiers AccessModifier, + DeclarationModifiers DeclarationModifier, string? ReturnGenericTypeName, string? ReturnTypeName, string Name, @@ -176,10 +176,11 @@ public record RecordsParameters( string Namespace, CodeDocumentationTags? DocumentationTags, IList? Attributes, + DeclarationModifiers DeclarationModifier, IList Parameters); public record RecordParameters( CodeDocumentationTags? DocumentationTags, - AccessModifiers AccessModifier, + DeclarationModifiers DeclarationModifier, string Name, IList? Parameters); \ No newline at end of file diff --git a/src/Atc.CodeGeneration.CSharp/Extensions/StringBuilderExtensions.cs b/src/Atc.CodeGeneration.CSharp/Extensions/StringBuilderExtensions.cs index 8c46f3baa..766457c30 100644 --- a/src/Atc.CodeGeneration.CSharp/Extensions/StringBuilderExtensions.cs +++ b/src/Atc.CodeGeneration.CSharp/Extensions/StringBuilderExtensions.cs @@ -3,20 +3,23 @@ namespace Atc.CodeGeneration.CSharp.Extensions; [SuppressMessage("Design", "CA1062:Validate arguments of public methods", Justification = "OK.")] public static class StringBuilderExtensions { - public static void AppendAccessModifier( + public static void AppendDeclarationModifier( this StringBuilder sb, - AccessModifiers accessModifier) - => sb.AppendAccessModifier(0, accessModifier); + DeclarationModifiers declarationModifier) + => sb.AppendDeclarationModifier(0, declarationModifier); - public static void AppendAccessModifier( + public static void AppendDeclarationModifier( this StringBuilder sb, int indentSpaces, - AccessModifiers accessModifier) + DeclarationModifiers declarationModifier) { - if (accessModifier != AccessModifiers.None) + if (declarationModifier == DeclarationModifiers.None) { - sb.Append(indentSpaces, $"{accessModifier.GetDescription()} "); + return; } + + sb.Append(indentSpaces, declarationModifier.GetDescription()); + sb.Append(' '); } public static void AppendTypeAndName( diff --git a/src/Atc.Rest.ApiGenerator.CLI/ApiOptionsHelper.cs b/src/Atc.Rest.ApiGenerator.CLI/ApiOptionsHelper.cs index a013ec217..ca3e5346d 100644 --- a/src/Atc.Rest.ApiGenerator.CLI/ApiOptionsHelper.cs +++ b/src/Atc.Rest.ApiGenerator.CLI/ApiOptionsHelper.cs @@ -132,20 +132,21 @@ private static void ApplyGeneratorOverrides( { if (settings is BaseServerCommandSettings serverCommandSettings) { - if (serverCommandSettings.AspNetOutputType.IsSet) + if (serverCommandSettings.AspNetOutputType.IsSet || + serverCommandSettings.AspNetOutputType.Value != apiOptions.Generator.AspNetOutputType) { apiOptions.Generator.AspNetOutputType = serverCommandSettings.AspNetOutputType.Value; } - if (serverCommandSettings.SwaggerThemeMode.IsSet) + if (serverCommandSettings.SwaggerThemeMode.IsSet || + serverCommandSettings.SwaggerThemeMode.Value != apiOptions.Generator.SwaggerThemeMode) { apiOptions.Generator.SwaggerThemeMode = serverCommandSettings.SwaggerThemeMode.Value; } if (serverCommandSettings.UseProblemDetailsAsDefaultResponseBody) { - apiOptions.Generator.Response.UseProblemDetailsAsDefaultBody = - serverCommandSettings.UseProblemDetailsAsDefaultResponseBody; + apiOptions.Generator.Response.UseProblemDetailsAsDefaultBody = serverCommandSettings.UseProblemDetailsAsDefaultResponseBody; } if (serverCommandSettings.ProjectPrefixName is not null) @@ -153,6 +154,34 @@ private static void ApplyGeneratorOverrides( apiOptions.Generator.ProjectName = serverCommandSettings.ProjectPrefixName; } + if (serverCommandSettings.ContractsLocation is not null && + serverCommandSettings.ContractsLocation.IsSet) + { + apiOptions.Generator.ContractsLocation = serverCommandSettings.ContractsLocation.Value; + } + + if (serverCommandSettings.EndpointsLocation is not null && + serverCommandSettings.EndpointsLocation.IsSet) + { + apiOptions.Generator.EndpointsLocation = serverCommandSettings.EndpointsLocation.Value; + } + + if (serverCommandSettings.HandlersLocation is not null && + serverCommandSettings.HandlersLocation.IsSet) + { + apiOptions.Generator.HandlersLocation = serverCommandSettings.HandlersLocation.Value; + } + + if (serverCommandSettings.UsePartialClassForContracts) + { + apiOptions.Generator.UsePartialClassForContracts = serverCommandSettings.UsePartialClassForContracts; + } + + if (serverCommandSettings.UsePartialClassForEndpoints) + { + apiOptions.Generator.UsePartialClassForEndpoints = serverCommandSettings.UsePartialClassForEndpoints; + } + if (serverCommandSettings.RemoveNamespaceGroupSeparatorInGlobalUsings) { apiOptions.Generator.RemoveNamespaceGroupSeparatorInGlobalUsings = serverCommandSettings.RemoveNamespaceGroupSeparatorInGlobalUsings; @@ -165,8 +194,7 @@ private static void ApplyGeneratorOverrides( { if (clientApiCommandSettings.UseProblemDetailsAsDefaultResponseBody) { - apiOptions.Generator.Response.UseProblemDetailsAsDefaultBody = - clientApiCommandSettings.UseProblemDetailsAsDefaultResponseBody; + apiOptions.Generator.Response.UseProblemDetailsAsDefaultBody = clientApiCommandSettings.UseProblemDetailsAsDefaultResponseBody; } if (clientApiCommandSettings.ProjectPrefixName is not null) @@ -181,41 +209,54 @@ private static void ApplyGeneratorOverrides( if (string.IsNullOrEmpty(apiOptions.Generator.ProjectSuffixName)) { - apiOptions.Generator.ProjectSuffixName = "ApiClient.Generated"; + apiOptions.Generator.ProjectSuffixName = $"{ContentGeneratorConstants.DefaultHttpClientName}.Generated"; } - apiOptions.Generator.Client ??= new ApiOptionsGeneratorClient(); + if (clientApiCommandSettings.ContractsLocation is not null && + clientApiCommandSettings.ContractsLocation.IsSet) + { + apiOptions.Generator.ContractsLocation = clientApiCommandSettings.ContractsLocation.Value; + } + + if (clientApiCommandSettings.EndpointsLocation is not null && + clientApiCommandSettings.EndpointsLocation.IsSet) + { + apiOptions.Generator.EndpointsLocation = clientApiCommandSettings.EndpointsLocation.Value; + } - if (clientApiCommandSettings.ClientFolderName is not null && - clientApiCommandSettings.ClientFolderName.IsSet) + if (clientApiCommandSettings.UsePartialClassForContracts) { - apiOptions.Generator.Client.FolderName = clientApiCommandSettings.ClientFolderName.Value; + apiOptions.Generator.UsePartialClassForContracts = clientApiCommandSettings.UsePartialClassForContracts; } + if (clientApiCommandSettings.UsePartialClassForEndpoints) + { + apiOptions.Generator.UsePartialClassForEndpoints = clientApiCommandSettings.UsePartialClassForEndpoints; + } + + apiOptions.Generator.Client ??= new ApiOptionsGeneratorClient(); + if (clientApiCommandSettings.HttpClientName is not null && clientApiCommandSettings.HttpClientName.IsSet) { apiOptions.Generator.Client.HttpClientName = clientApiCommandSettings.HttpClientName.Value; } - else if ("ApiClient".Equals(apiOptions.Generator.Client.HttpClientName, StringComparison.Ordinal)) + else if (ContentGeneratorConstants.DefaultHttpClientName.Equals(apiOptions.Generator.Client.HttpClientName, StringComparison.Ordinal)) { var baseGenerateCommandSettings = (BaseGenerateCommandSettings)settings; - apiOptions.Generator.Client.HttpClientName = $"{baseGenerateCommandSettings.ProjectPrefixName}-ApiClient"; + apiOptions.Generator.Client.HttpClientName = $"{baseGenerateCommandSettings.ProjectPrefixName}-{ContentGeneratorConstants.DefaultHttpClientName}"; } - apiOptions.Generator.Client.ExcludeEndpointGeneration = clientApiCommandSettings.ExcludeEndpointGeneration; + if (clientApiCommandSettings.ExcludeEndpointGeneration) + { + apiOptions.Generator.Client.ExcludeEndpointGeneration = clientApiCommandSettings.ExcludeEndpointGeneration; + } break; } } - if (apiOptions.Generator.ProjectSuffixName.Contains(' ', StringComparison.Ordinal) || - apiOptions.Generator.ProjectSuffixName.Contains('-', StringComparison.Ordinal)) - { - apiOptions.Generator.ProjectSuffixName = apiOptions.Generator.ProjectSuffixName - .Trim() - .Replace(' ', '.') - .Replace('-', '.'); - } + apiOptions.Generator.ProjectName = apiOptions.Generator.ProjectName.EnsureNamespaceFormat(); + apiOptions.Generator.ProjectSuffixName = apiOptions.Generator.ProjectSuffixName.EnsureNamespaceFormat(); } } \ No newline at end of file diff --git a/src/Atc.Rest.ApiGenerator.CLI/Commands/ArgumentCommandConstants.cs b/src/Atc.Rest.ApiGenerator.CLI/Commands/ArgumentCommandConstants.cs index e4fd46bd1..cb385698f 100644 --- a/src/Atc.Rest.ApiGenerator.CLI/Commands/ArgumentCommandConstants.cs +++ b/src/Atc.Rest.ApiGenerator.CLI/Commands/ArgumentCommandConstants.cs @@ -20,9 +20,14 @@ public static class ArgumentCommandConstants public const string LongConfigurationValidateModelNameCasingStyle = "--validate-modelNameCasingStyle"; public const string LongConfigurationValidateModelPropertyNameCasingStyle = "--validate-modelPropertyNameCasingStyle"; - public const string LongClientFolderName = "--clientFolderName"; + public const string LongEndpointsLocation = "--endpointsLocation"; + public const string LongContractsLocation = "--contractsLocation"; + public const string LongHandlersLocation = "--handlersLocation"; + public const string LongClientHttpClientName = "--httpClientName"; public const string LongExcludeEndpointGeneration = "--excludeEndpointGeneration"; + public const string LongUsePartialClassForContracts = "--usePartialClassForContracts"; + public const string LongUsePartialClassForEndpoints = "--usePartialClassForEndpoints"; public const string LongServerOutputSolutionPath = "--outputSlnPath"; public const string LongServerOutputSourcePath = "--outputSrcPath"; diff --git a/src/Atc.Rest.ApiGenerator.CLI/Commands/GenerateClientCSharpCommand.cs b/src/Atc.Rest.ApiGenerator.CLI/Commands/GenerateClientCSharpCommand.cs index 7842ef9ef..459081065 100644 --- a/src/Atc.Rest.ApiGenerator.CLI/Commands/GenerateClientCSharpCommand.cs +++ b/src/Atc.Rest.ApiGenerator.CLI/Commands/GenerateClientCSharpCommand.cs @@ -60,7 +60,7 @@ private async Task ExecuteInternalAsync( { if (!openApiDocumentValidator.IsValid( apiOptions.Validation, - apiOptions.IncludeDeprecated, + apiOptions.IncludeDeprecatedOperations, apiDocumentContainer)) { return ConsoleExitStatusCodes.Failure; diff --git a/src/Atc.Rest.ApiGenerator.CLI/Commands/GenerateServerAllCommand.cs b/src/Atc.Rest.ApiGenerator.CLI/Commands/GenerateServerAllCommand.cs index e52ff3455..6780d9d26 100644 --- a/src/Atc.Rest.ApiGenerator.CLI/Commands/GenerateServerAllCommand.cs +++ b/src/Atc.Rest.ApiGenerator.CLI/Commands/GenerateServerAllCommand.cs @@ -75,7 +75,7 @@ private async Task ExecuteInternalAsync( { if (!openApiDocumentValidator.IsValid( apiOptions.Validation, - apiOptions.IncludeDeprecated, + apiOptions.IncludeDeprecatedOperations, apiDocumentContainer)) { return ConsoleExitStatusCodes.Failure; diff --git a/src/Atc.Rest.ApiGenerator.CLI/Commands/GenerateServerApiCommand.cs b/src/Atc.Rest.ApiGenerator.CLI/Commands/GenerateServerApiCommand.cs index f0d942a9e..26e32de42 100644 --- a/src/Atc.Rest.ApiGenerator.CLI/Commands/GenerateServerApiCommand.cs +++ b/src/Atc.Rest.ApiGenerator.CLI/Commands/GenerateServerApiCommand.cs @@ -68,7 +68,7 @@ private async Task ExecuteInternalAsync( { if (!openApiDocumentValidator.IsValid( apiOptions.Validation, - apiOptions.IncludeDeprecated, + apiOptions.IncludeDeprecatedOperations, apiDocumentContainer)) { return ConsoleExitStatusCodes.Failure; diff --git a/src/Atc.Rest.ApiGenerator.CLI/Commands/GenerateServerDomainCommand.cs b/src/Atc.Rest.ApiGenerator.CLI/Commands/GenerateServerDomainCommand.cs index 2460956fc..4271042d5 100644 --- a/src/Atc.Rest.ApiGenerator.CLI/Commands/GenerateServerDomainCommand.cs +++ b/src/Atc.Rest.ApiGenerator.CLI/Commands/GenerateServerDomainCommand.cs @@ -68,7 +68,7 @@ private async Task ExecuteInternalAsync( { if (!openApiDocumentValidator.IsValid( apiOptions.Validation, - apiOptions.IncludeDeprecated, + apiOptions.IncludeDeprecatedOperations, apiDocumentContainer)) { return ConsoleExitStatusCodes.Failure; diff --git a/src/Atc.Rest.ApiGenerator.CLI/Commands/GenerateServerHostCommand.cs b/src/Atc.Rest.ApiGenerator.CLI/Commands/GenerateServerHostCommand.cs index d5512227c..2e93f554c 100644 --- a/src/Atc.Rest.ApiGenerator.CLI/Commands/GenerateServerHostCommand.cs +++ b/src/Atc.Rest.ApiGenerator.CLI/Commands/GenerateServerHostCommand.cs @@ -68,7 +68,7 @@ private async Task ExecuteInternalAsync( { if (!openApiDocumentValidator.IsValid( apiOptions.Validation, - apiOptions.IncludeDeprecated, + apiOptions.IncludeDeprecatedOperations, apiDocumentContainer)) { return ConsoleExitStatusCodes.Failure; diff --git a/src/Atc.Rest.ApiGenerator.CLI/Commands/Settings/BaseGenerateCommandSettings.cs b/src/Atc.Rest.ApiGenerator.CLI/Commands/Settings/BaseGenerateCommandSettings.cs index c8ec7782a..1234d1990 100644 --- a/src/Atc.Rest.ApiGenerator.CLI/Commands/Settings/BaseGenerateCommandSettings.cs +++ b/src/Atc.Rest.ApiGenerator.CLI/Commands/Settings/BaseGenerateCommandSettings.cs @@ -14,6 +14,26 @@ public class BaseGenerateCommandSettings : BaseConfigurationCommandSettings [Description("Use ProblemDetails as default responsen body")] public bool UseProblemDetailsAsDefaultResponseBody { get; init; } + [CommandOption($"{ArgumentCommandConstants.LongEndpointsLocation} [ENDPOINTSLOCATION]")] + [Description($"If endpoints-localtion is provided, generated files will be placed here instead of the {ContentGeneratorConstants.Endpoints} folder.")] + public FlagValue? EndpointsLocation { get; init; } + + [CommandOption($"{ArgumentCommandConstants.LongContractsLocation} [CONTRACTSLOCATION]")] + [Description($"If contracts-localtion is provided, generated files will be placed here instead of the {ContentGeneratorConstants.Contracts} folder.")] + public FlagValue? ContractsLocation { get; init; } + + [CommandOption($"{ArgumentCommandConstants.LongHandlersLocation} [HANDLERSLOCATION]")] + [Description($"If handlers-localtion is provided, generated files will be placed here instead of the {ContentGeneratorConstants.Handlers} folder.")] + public FlagValue? HandlersLocation { get; init; } + + [CommandOption(ArgumentCommandConstants.LongUsePartialClassForContracts)] + [Description("Use Partial-Class for contracts")] + public bool UsePartialClassForContracts { get; init; } + + [CommandOption(ArgumentCommandConstants.LongUsePartialClassForEndpoints)] + [Description("Use Partial-Class for endpoints")] + public bool UsePartialClassForEndpoints { get; init; } + [CommandOption($"{ArgumentCommandConstants.LongRemoveNamespaceGroupSeparatorInGlobalUsings}")] [Description("Remove space between namespace groups in GlobalUsing.cs")] public bool RemoveNamespaceGroupSeparatorInGlobalUsings { get; init; } diff --git a/src/Atc.Rest.ApiGenerator.CLI/Commands/Settings/ClientApiCommandSettings.cs b/src/Atc.Rest.ApiGenerator.CLI/Commands/Settings/ClientApiCommandSettings.cs index 83e0879d6..11c06bd2f 100644 --- a/src/Atc.Rest.ApiGenerator.CLI/Commands/Settings/ClientApiCommandSettings.cs +++ b/src/Atc.Rest.ApiGenerator.CLI/Commands/Settings/ClientApiCommandSettings.cs @@ -6,10 +6,6 @@ public class ClientApiCommandSettings : BaseGenerateCommandSettings [Description("Path to generated project (directory)")] public string OutputPath { get; init; } = string.Empty; - [CommandOption($"{ArgumentCommandConstants.LongClientFolderName} [CLIENTFOLDERNAME]")] - [Description("If client folder is provided, generated files will be placed here instead of the project root.")] - public FlagValue? ClientFolderName { get; init; } - [CommandOption(ArgumentCommandConstants.LongExcludeEndpointGeneration)] [Description("Exclude endpoint generation")] public bool ExcludeEndpointGeneration { get; init; } diff --git a/src/Atc.Rest.ApiGenerator.CLI/Commands/ValidateSchemaCommand.cs b/src/Atc.Rest.ApiGenerator.CLI/Commands/ValidateSchemaCommand.cs index f487d0418..e9bc87107 100644 --- a/src/Atc.Rest.ApiGenerator.CLI/Commands/ValidateSchemaCommand.cs +++ b/src/Atc.Rest.ApiGenerator.CLI/Commands/ValidateSchemaCommand.cs @@ -41,7 +41,7 @@ private async Task ExecuteInternalAsync( { if (!openApiDocumentValidator.IsValid( apiOptions.Validation, - apiOptions.IncludeDeprecated, + apiOptions.IncludeDeprecatedOperations, apiDocumentContainer)) { return ConsoleExitStatusCodes.Failure; diff --git a/src/Atc.Rest.ApiGenerator.CLI/GlobalUsings.cs b/src/Atc.Rest.ApiGenerator.CLI/GlobalUsings.cs index 49caf47dc..65b02b2aa 100644 --- a/src/Atc.Rest.ApiGenerator.CLI/GlobalUsings.cs +++ b/src/Atc.Rest.ApiGenerator.CLI/GlobalUsings.cs @@ -16,6 +16,7 @@ global using Atc.Rest.ApiGenerator.CLI.Extensions; global using Atc.Rest.ApiGenerator.CodingRules; global using Atc.Rest.ApiGenerator.Contracts; +global using Atc.Rest.ApiGenerator.Framework.Extensions; global using Atc.Rest.ApiGenerator.Framework.Providers; global using Atc.Rest.ApiGenerator.Framework.Readers; global using Atc.Rest.ApiGenerator.Helpers; diff --git a/src/Atc.Rest.ApiGenerator.Client.CSharp/ContentGenerators/ContentGeneratorClientEndpoint.cs b/src/Atc.Rest.ApiGenerator.Client.CSharp/ContentGenerators/ContentGeneratorClientEndpoint.cs index cf70e95f5..e21058dae 100644 --- a/src/Atc.Rest.ApiGenerator.Client.CSharp/ContentGenerators/ContentGeneratorClientEndpoint.cs +++ b/src/Atc.Rest.ApiGenerator.Client.CSharp/ContentGenerators/ContentGeneratorClientEndpoint.cs @@ -41,7 +41,7 @@ public string Generate() } sb.AppendLine(codeAttributeGenerator.Generate()); - sb.AppendLine($"public class {parameters.EndpointName} : {parameters.InterfaceName}"); + sb.AppendLine($"{parameters.DeclarationModifier.GetDescription()} {parameters.EndpointName} : {parameters.InterfaceName}"); sb.AppendLine("{"); sb.AppendLine(4, "private readonly IHttpClientFactory factory;"); sb.AppendLine(4, "private readonly IHttpMessageFactory httpMessageFactory;"); diff --git a/src/Atc.Rest.ApiGenerator.Client.CSharp/ContentGenerators/ContentGeneratorClientEndpointResult.cs b/src/Atc.Rest.ApiGenerator.Client.CSharp/ContentGenerators/ContentGeneratorClientEndpointResult.cs index cca7359d2..adde55417 100644 --- a/src/Atc.Rest.ApiGenerator.Client.CSharp/ContentGenerators/ContentGeneratorClientEndpointResult.cs +++ b/src/Atc.Rest.ApiGenerator.Client.CSharp/ContentGenerators/ContentGeneratorClientEndpointResult.cs @@ -36,7 +36,7 @@ public string Generate() } sb.AppendLine(codeAttributeGenerator.Generate()); - sb.AppendLine($"public class {parameters.EndpointResultName} : {parameters.InheritClassName}, {parameters.EndpointResultInterfaceName}"); + sb.AppendLine($"{parameters.DeclarationModifier.GetDescription()} {parameters.EndpointResultName} : {parameters.InheritClassName}, {parameters.EndpointResultInterfaceName}"); sb.AppendLine("{"); sb.AppendLine(4, $"public {parameters.EndpointResultName}(EndpointResponse response)"); sb.AppendLine(8, ": base(response)"); diff --git a/src/Atc.Rest.ApiGenerator.Client.CSharp/ContentGenerators/ContentGeneratorClientEndpointResultInterface.cs b/src/Atc.Rest.ApiGenerator.Client.CSharp/ContentGenerators/ContentGeneratorClientEndpointResultInterface.cs index dde620922..8fda829d5 100644 --- a/src/Atc.Rest.ApiGenerator.Client.CSharp/ContentGenerators/ContentGeneratorClientEndpointResultInterface.cs +++ b/src/Atc.Rest.ApiGenerator.Client.CSharp/ContentGenerators/ContentGeneratorClientEndpointResultInterface.cs @@ -37,7 +37,7 @@ public string Generate() } sb.AppendLine(codeAttributeGenerator.Generate()); - sb.AppendLine($"public interface {parameters.InterfaceName} : {parameters.InheritInterfaceName}"); + sb.AppendLine($"{parameters.DeclarationModifier.GetDescription()} {parameters.InterfaceName} : {parameters.InheritInterfaceName}"); sb.AppendLine("{"); AppendContent(sb); sb.Append('}'); diff --git a/src/Atc.Rest.ApiGenerator.Client.CSharp/ContentGenerators/ContentGeneratorClientParameter.cs b/src/Atc.Rest.ApiGenerator.Client.CSharp/ContentGenerators/ContentGeneratorClientParameter.cs index ffe8c1269..05cdc8a3f 100644 --- a/src/Atc.Rest.ApiGenerator.Client.CSharp/ContentGenerators/ContentGeneratorClientParameter.cs +++ b/src/Atc.Rest.ApiGenerator.Client.CSharp/ContentGenerators/ContentGeneratorClientParameter.cs @@ -35,7 +35,7 @@ public string Generate() } sb.AppendLine(codeAttributeGenerator.Generate()); - sb.AppendLine($"public class {parameters.ParameterName}"); + sb.AppendLine($"{parameters.DeclarationModifier.GetDescription()} {parameters.ParameterName}"); sb.AppendLine("{"); foreach (var parameter in parameters.PropertyParameters) diff --git a/src/Atc.Rest.ApiGenerator.Client.CSharp/GlobalUsings.cs b/src/Atc.Rest.ApiGenerator.Client.CSharp/GlobalUsings.cs index 3f90ae52b..c3d839ebf 100644 --- a/src/Atc.Rest.ApiGenerator.Client.CSharp/GlobalUsings.cs +++ b/src/Atc.Rest.ApiGenerator.Client.CSharp/GlobalUsings.cs @@ -14,10 +14,12 @@ global using Atc.Rest.ApiGenerator.Contracts.Extensions; global using Atc.Rest.ApiGenerator.Contracts.Models; global using Atc.Rest.ApiGenerator.Framework.ContentGenerators; +global using Atc.Rest.ApiGenerator.Framework.Factories; global using Atc.Rest.ApiGenerator.Framework.Factories.Parameters.Client; global using Atc.Rest.ApiGenerator.Framework.Factories.Parameters.ServerClient; global using Atc.Rest.ApiGenerator.Framework.Helpers; global using Atc.Rest.ApiGenerator.Framework.Providers; +global using Atc.Rest.ApiGenerator.Framework.Settings; global using Atc.Rest.ApiGenerator.Framework.Writers; global using Atc.Rest.ApiGenerator.OpenApi.Extensions; diff --git a/src/Atc.Rest.ApiGenerator.Client.CSharp/ProjectGenerator/ClientCSharpApiGenerator.cs b/src/Atc.Rest.ApiGenerator.Client.CSharp/ProjectGenerator/ClientCSharpApiGenerator.cs index 3b7a3ac26..91c45ca92 100644 --- a/src/Atc.Rest.ApiGenerator.Client.CSharp/ProjectGenerator/ClientCSharpApiGenerator.cs +++ b/src/Atc.Rest.ApiGenerator.Client.CSharp/ProjectGenerator/ClientCSharpApiGenerator.cs @@ -7,58 +7,42 @@ public class ClientCSharpApiGenerator : IClientCSharpApiGenerator { private readonly ILogger logger; private readonly INugetPackageReferenceProvider nugetPackageReferenceProvider; - private readonly Version apiGeneratorVersion; - private readonly string projectName; - private readonly DirectoryInfo projectPath; private readonly OpenApiDocument openApiDocument; private readonly IList operationSchemaMappings; private readonly string codeGeneratorContentHeader; private readonly AttributeParameters codeGeneratorAttribute; - private readonly bool useProblemDetailsAsDefaultResponseBody; - private readonly bool includeDeprecated; + private readonly GeneratorSettings settings; private readonly CustomErrorResponseModel? customErrorResponseModel; public ClientCSharpApiGenerator( ILoggerFactory loggerFactory, INugetPackageReferenceProvider nugetPackageReferenceProvider, - Version apiGeneratorVersion, - string projectName, - DirectoryInfo projectPath, OpenApiDocument openApiDocument, IList operationSchemaMappings, - bool useProblemDetailsAsDefaultResponseBody, - bool includeDeprecated, + GeneratorSettings generatorSettings, CustomErrorResponseModel? customErrorResponseModel) { ArgumentNullException.ThrowIfNull(loggerFactory); ArgumentNullException.ThrowIfNull(nugetPackageReferenceProvider); - ArgumentNullException.ThrowIfNull(apiGeneratorVersion); - ArgumentNullException.ThrowIfNull(projectName); - ArgumentNullException.ThrowIfNull(projectPath); ArgumentNullException.ThrowIfNull(openApiDocument); ArgumentNullException.ThrowIfNull(operationSchemaMappings); + ArgumentNullException.ThrowIfNull(generatorSettings); logger = loggerFactory.CreateLogger(); this.nugetPackageReferenceProvider = nugetPackageReferenceProvider; - this.apiGeneratorVersion = apiGeneratorVersion; - this.projectName = projectName; - this.projectPath = projectPath; this.customErrorResponseModel = customErrorResponseModel; this.openApiDocument = openApiDocument; this.operationSchemaMappings = operationSchemaMappings; - this.useProblemDetailsAsDefaultResponseBody = useProblemDetailsAsDefaultResponseBody; - this.includeDeprecated = includeDeprecated; + settings = generatorSettings; codeGeneratorContentHeader = GeneratedCodeHeaderGeneratorFactory - .Create(apiGeneratorVersion) + .Create(settings.Version) .Generate(); codeGeneratorAttribute = AttributeParametersFactory - .CreateGeneratedCode(apiGeneratorVersion); + .CreateGeneratedCode(settings.Version); } - public string? ClientFolderName { get; set; } - - public string HttpClientName { get; set; } = "DefaultHttpClient"; + public string HttpClientName { get; set; } = ContentGeneratorConstants.DefaultHttpClient; public async Task ScaffoldProjectFile() { @@ -86,7 +70,7 @@ public async Task ScaffoldProjectFile() new("GenerateDocumentationFile", Attributes: null, "true"), ], [ - new("DocumentationFile", Attributes: null, @$"bin\Debug\net8.0\{projectName}.xml"), + new("DocumentationFile", Attributes: null, @$"bin\Debug\net8.0\{settings.ProjectName}.xml"), new("NoWarn", Attributes: null, "$(NoWarn);1573;1591;1701;1702;1712;8618;"), ], ], @@ -101,8 +85,8 @@ public async Task ScaffoldProjectFile() var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo($"{projectName}.csproj"), + settings.ProjectPath, + FileInfoFactory.Create(settings.ProjectPath, $"{settings.ProjectName}.csproj"), ContentWriterArea.Src, content, overrideIfExist: false); @@ -144,13 +128,13 @@ public void GenerateParameters() { var apiGroupName = openApiPath.GetApiGroupName(); - var fullNamespace = string.IsNullOrEmpty(ClientFolderName) - ? $"{projectName}.{ContentGeneratorConstants.Contracts}.{apiGroupName}" - : $"{projectName}.{ClientFolderName}.{ContentGeneratorConstants.Contracts}.{apiGroupName}"; + var contractsLocation = LocationFactory.CreateWithApiGroupName(apiGroupName, settings.ContractsLocation); + + var fullNamespace = NamespaceFactory.Create(settings.ProjectName, contractsLocation); foreach (var openApiOperation in openApiPath.Value.Operations) { - if (openApiOperation.Value.Deprecated && !includeDeprecated) + if (openApiOperation.Value.Deprecated && !settings.IncludeDeprecatedOperations) { continue; } @@ -167,8 +151,8 @@ public void GenerateParameters() openApiPath.Value.Parameters); var contentGenerator = new ContentGeneratorClientParameter( - new GeneratedCodeHeaderGenerator(new GeneratedCodeGeneratorParameters(apiGeneratorVersion)), - new GeneratedCodeAttributeGenerator(new GeneratedCodeGeneratorParameters(apiGeneratorVersion)), + new GeneratedCodeHeaderGenerator(new GeneratedCodeGeneratorParameters(settings.Version)), + new GeneratedCodeAttributeGenerator(new GeneratedCodeGeneratorParameters(settings.Version)), new CodeDocumentationTagsGenerator(), parameterParameters); @@ -176,8 +160,8 @@ public void GenerateParameters() var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo(ContentGeneratorConstants.Contracts, apiGroupName, ContentGeneratorConstants.RequestParameters, $"{parameterParameters.ParameterName}.cs"), + settings.ProjectPath, + FileInfoFactory.Create(settings.ProjectPath, contractsLocation, ContentGeneratorConstants.RequestParameters, $"{parameterParameters.ParameterName}.cs"), ContentWriterArea.Src, content); } @@ -190,13 +174,13 @@ public void GenerateEndpointInterfaces() { var apiGroupName = openApiPath.GetApiGroupName(); - var fullNamespace = string.IsNullOrEmpty(ClientFolderName) - ? $"{projectName}.{ContentGeneratorConstants.Endpoints}.{apiGroupName}.{ContentGeneratorConstants.Interfaces}" - : $"{projectName}.{ClientFolderName}.{ContentGeneratorConstants.Endpoints}.{apiGroupName}.{ContentGeneratorConstants.Interfaces}"; + var endpointsLocation = LocationFactory.CreateWithApiGroupName(apiGroupName, settings.EndpointsLocation); + + var fullNamespace = NamespaceFactory.Create(settings.ProjectName, endpointsLocation) + $".{ContentGeneratorConstants.Interfaces}"; foreach (var openApiOperation in openApiPath.Value.Operations) { - if (openApiOperation.Value.Deprecated && !includeDeprecated) + if (openApiOperation.Value.Deprecated && !settings.IncludeDeprecatedOperations) { continue; } @@ -207,7 +191,8 @@ public void GenerateEndpointInterfaces() codeGeneratorAttribute, openApiPath.Value, openApiOperation.Value, - HttpClientName); + HttpClientName, + settings.UsePartialClassForEndpoints); var contentGenerator = new GenerateContentForInterface( new CodeDocumentationTagsGenerator(), @@ -217,8 +202,8 @@ public void GenerateEndpointInterfaces() var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo(ContentGeneratorConstants.Endpoints, apiGroupName, ContentGeneratorConstants.Interfaces, $"{interfaceParameters.TypeName}.cs"), + settings.ProjectPath, + FileInfoFactory.Create(settings.ProjectPath, endpointsLocation, ContentGeneratorConstants.Interfaces, $"{interfaceParameters.TypeName}.cs"), ContentWriterArea.Src, content); } @@ -231,41 +216,44 @@ public void GenerateEndpoints() { var apiGroupName = openApiPath.GetApiGroupName(); - var fullNamespace = string.IsNullOrEmpty(ClientFolderName) - ? $"{projectName}.{ContentGeneratorConstants.Endpoints}.{apiGroupName}" - : $"{projectName}.{ClientFolderName}.{ContentGeneratorConstants.Endpoints}.{apiGroupName}"; + var endpointsLocation = LocationFactory.CreateWithApiGroupName(apiGroupName, settings.EndpointsLocation); + var contractsLocation = LocationFactory.CreateWithApiGroupName(apiGroupName, settings.ContractsLocation); + + var fullNamespace = NamespaceFactory.Create(settings.ProjectName, endpointsLocation); foreach (var openApiOperation in openApiPath.Value.Operations) { - if (openApiOperation.Value.Deprecated && !includeDeprecated) + if (openApiOperation.Value.Deprecated && !settings.IncludeDeprecatedOperations) { continue; } var endpointParameters = ContentGeneratorClientEndpointParametersFactory.Create( - projectName, + settings.ProjectName, apiGroupName, fullNamespace, + contractsLocation, openApiPath.Value, openApiOperation.Key, openApiOperation.Value, HttpClientName, - $"{openApiDocument.GetServerUrlBasePath()}{openApiPath.Key}"); + $"{openApiDocument.GetServerUrlBasePath()}{openApiPath.Key}", + settings.UsePartialClassForEndpoints); var contentGenerator = new ContentGeneratorClientEndpoint( - new GeneratedCodeHeaderGenerator(new GeneratedCodeGeneratorParameters(apiGeneratorVersion)), - new GeneratedCodeAttributeGenerator(new GeneratedCodeGeneratorParameters(apiGeneratorVersion)), + new GeneratedCodeHeaderGenerator(new GeneratedCodeGeneratorParameters(settings.Version)), + new GeneratedCodeAttributeGenerator(new GeneratedCodeGeneratorParameters(settings.Version)), new CodeDocumentationTagsGenerator(), endpointParameters, - useProblemDetailsAsDefaultResponseBody, + settings.UseProblemDetailsAsDefaultResponseBody, customErrorResponseModel?.Name); var content = contentGenerator.Generate(); var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo(ContentGeneratorConstants.Endpoints, apiGroupName, $"{endpointParameters.EndpointName}.cs"), + settings.ProjectPath, + FileInfoFactory.Create(settings.ProjectPath, endpointsLocation, $"{endpointParameters.EndpointName}.cs"), ContentWriterArea.Src, content); } @@ -278,37 +266,40 @@ public void GenerateEndpointResultInterfaces() { var apiGroupName = openApiPath.GetApiGroupName(); - var fullNamespace = string.IsNullOrEmpty(ClientFolderName) - ? $"{projectName}.{ContentGeneratorConstants.Endpoints}.{apiGroupName}.{ContentGeneratorConstants.Interfaces}" - : $"{projectName}.{ClientFolderName}.{ContentGeneratorConstants.Endpoints}.{apiGroupName}.{ContentGeneratorConstants.Interfaces}"; + var endpointsLocation = LocationFactory.CreateWithApiGroupName(apiGroupName, settings.EndpointsLocation); + var contractsLocation = LocationFactory.CreateWithApiGroupName(apiGroupName, settings.ContractsLocation); + + var fullNamespace = NamespaceFactory.Create(settings.ProjectName, endpointsLocation) + $".{ContentGeneratorConstants.Interfaces}"; foreach (var openApiOperation in openApiPath.Value.Operations) { - if (openApiOperation.Value.Deprecated && !includeDeprecated) + if (openApiOperation.Value.Deprecated && !settings.IncludeDeprecatedOperations) { continue; } var endpointResultInterfaceParameters = ContentGeneratorClientEndpointResultInterfaceParametersFactory.Create( - projectName, + settings.ProjectName, apiGroupName, fullNamespace, + contractsLocation, openApiPath.Value, - openApiOperation.Value); + openApiOperation.Value, + settings.UsePartialClassForContracts); var contentGenerator = new ContentGeneratorClientEndpointResultInterface( - new GeneratedCodeHeaderGenerator(new GeneratedCodeGeneratorParameters(apiGeneratorVersion)), - new GeneratedCodeAttributeGenerator(new GeneratedCodeGeneratorParameters(apiGeneratorVersion)), + new GeneratedCodeHeaderGenerator(new GeneratedCodeGeneratorParameters(settings.Version)), + new GeneratedCodeAttributeGenerator(new GeneratedCodeGeneratorParameters(settings.Version)), new CodeDocumentationTagsGenerator(), endpointResultInterfaceParameters, - useProblemDetailsAsDefaultResponseBody); + settings.UseProblemDetailsAsDefaultResponseBody); var content = contentGenerator.Generate(); var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo(ContentGeneratorConstants.Endpoints, apiGroupName, ContentGeneratorConstants.Interfaces, $"{endpointResultInterfaceParameters.InterfaceName}.cs"), + settings.ProjectPath, + FileInfoFactory.Create(settings.ProjectPath, endpointsLocation, ContentGeneratorConstants.Interfaces, $"{endpointResultInterfaceParameters.InterfaceName}.cs"), ContentWriterArea.Src, content); } @@ -321,37 +312,40 @@ public void GenerateEndpointResults() { var apiGroupName = openApiPath.GetApiGroupName(); - var fullNamespace = string.IsNullOrEmpty(ClientFolderName) - ? $"{projectName}.{ContentGeneratorConstants.Endpoints}.{apiGroupName}" - : $"{projectName}.{ClientFolderName}.{ContentGeneratorConstants.Endpoints}.{apiGroupName}"; + var endpointsLocation = LocationFactory.CreateWithApiGroupName(apiGroupName, settings.EndpointsLocation); + var contractsLocation = LocationFactory.CreateWithApiGroupName(apiGroupName, settings.ContractsLocation); + + var fullNamespace = NamespaceFactory.Create(settings.ProjectName, endpointsLocation); foreach (var openApiOperation in openApiPath.Value.Operations) { - if (openApiOperation.Value.Deprecated && !includeDeprecated) + if (openApiOperation.Value.Deprecated && !settings.IncludeDeprecatedOperations) { continue; } var endpointResultParameters = ContentGeneratorClientEndpointResultParametersFactory.Create( - projectName, + settings.ProjectName, apiGroupName, fullNamespace, + contractsLocation, openApiPath.Value, - openApiOperation.Value); + openApiOperation.Value, + settings.UsePartialClassForContracts); var contentGenerator = new ContentGeneratorClientEndpointResult( - new GeneratedCodeHeaderGenerator(new GeneratedCodeGeneratorParameters(apiGeneratorVersion)), - new GeneratedCodeAttributeGenerator(new GeneratedCodeGeneratorParameters(apiGeneratorVersion)), + new GeneratedCodeHeaderGenerator(new GeneratedCodeGeneratorParameters(settings.Version)), + new GeneratedCodeAttributeGenerator(new GeneratedCodeGeneratorParameters(settings.Version)), new CodeDocumentationTagsGenerator(), endpointResultParameters, - useProblemDetailsAsDefaultResponseBody); + settings.UseProblemDetailsAsDefaultResponseBody); var content = contentGenerator.Generate(); var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo(ContentGeneratorConstants.Endpoints, apiGroupName, $"{endpointResultParameters.EndpointResultName}.cs"), + settings.ProjectPath, + FileInfoFactory.Create(settings.ProjectPath, endpointsLocation, $"{endpointResultParameters.EndpointResultName}.cs"), ContentWriterArea.Src, content); } @@ -375,17 +369,17 @@ public void MaintainGlobalUsings( "Microsoft.AspNetCore.Mvc", }; - if (openApiDocument.IsUsingRequiredForSystemLinq(includeDeprecated)) + if (openApiDocument.IsUsingRequiredForSystemLinq(settings.IncludeDeprecatedOperations)) { requiredUsings.Add("System.Linq"); } - if (openApiDocument.IsUsingRequiredForSystemCollectionGeneric(includeDeprecated)) + if (openApiDocument.IsUsingRequiredForSystemCollectionGeneric(settings.IncludeDeprecatedOperations)) { requiredUsings.Add("System.Collections.Generic"); } - if (openApiDocument.IsUsingRequiredForSystemTextJsonSerializationAndSystemRuntimeSerialization(includeDeprecated)) + if (openApiDocument.IsUsingRequiredForSystemTextJsonSerializationAndSystemRuntimeSerialization(settings.IncludeDeprecatedOperations)) { requiredUsings.Add("System.Runtime.Serialization"); requiredUsings.Add("System.Text.Json.Serialization"); @@ -403,16 +397,19 @@ public void MaintainGlobalUsings( if (operationSchemaMappings.Any(apiOperation => apiOperation.Model.IsShared)) { - requiredUsings.Add($"{projectName}.{ContentGeneratorConstants.Contracts}"); + requiredUsings.Add(NamespaceFactory.Create(settings.ProjectName, LocationFactory.CreateWithoutTemplateForApiGroupName(settings.ContractsLocation))); } var apiGroupNames = openApiDocument.GetApiGroupNames(); foreach (var openApiPath in openApiDocument.Paths) { var apiGroupName = openApiPath.GetApiGroupName(); + + var contractsLocation = LocationFactory.CreateWithApiGroupName(apiGroupName, settings.ContractsLocation); + foreach (var openApiOperation in openApiPath.Value.Operations) { - if (openApiOperation.Value.Deprecated && !includeDeprecated) + if (openApiOperation.Value.Deprecated && !settings.IncludeDeprecatedOperations) { continue; } @@ -423,7 +420,7 @@ public void MaintainGlobalUsings( continue; } - var requiredUsing = $"{projectName}.{ContentGeneratorConstants.Contracts}.{apiGroupName}"; + var requiredUsing = NamespaceFactory.Create(settings.ProjectName, contractsLocation); if (!requiredUsings.Contains(requiredUsing, StringComparer.CurrentCulture)) { requiredUsings.Add(requiredUsing); @@ -439,6 +436,8 @@ public void MaintainGlobalUsings( var apiOperationModels = GetDistinctApiOperationModels(apiOperations); + var contractsLocation = LocationFactory.CreateWithApiGroupName(apiGroupName, settings.ContractsLocation); + foreach (var apiOperationModel in apiOperationModels) { if (apiOperationModel.IsEnum || @@ -447,7 +446,12 @@ public void MaintainGlobalUsings( continue; } - var requiredUsing = $"{projectName}.{ContentGeneratorConstants.Contracts}.{apiGroupName}"; + if (apiGroupName.IsWellKnownSystemTypeName()) + { + continue; + } + + var requiredUsing = NamespaceFactory.Create(settings.ProjectName, contractsLocation); if (!requiredUsings.Contains(requiredUsing, StringComparer.CurrentCulture)) { requiredUsings.Add(requiredUsing); @@ -455,12 +459,12 @@ public void MaintainGlobalUsings( } } - requiredUsings.AddRange(apiGroupNames.Select(x => $"{projectName}.{ContentGeneratorConstants.Endpoints}.{x}.{ContentGeneratorConstants.Interfaces}")); + requiredUsings.AddRange(apiGroupNames.Select(x => NamespaceFactory.Create(settings.ProjectName, LocationFactory.CreateWithApiGroupName(x, settings.EndpointsLocation), ContentGeneratorConstants.Interfaces))); GlobalUsingsHelper.CreateOrUpdate( logger, ContentWriterArea.Src, - projectPath, + settings.ProjectPath, requiredUsings, removeNamespaceGroupSeparatorInGlobalUsings); } @@ -469,7 +473,9 @@ private void GenerateEnumerationType( string enumerationName, OpenApiSchema openApiSchemaEnumeration) { - var fullNamespace = $"{projectName}.{ContentGeneratorConstants.Contracts}"; + var contractsLocation = LocationFactory.CreateWithoutTemplateForApiGroupName(settings.ContractsLocation); + + var fullNamespace = NamespaceFactory.Create(settings.ProjectName, contractsLocation); var enumParameters = ContentGeneratorServerClientEnumParametersFactory.Create( codeGeneratorContentHeader, @@ -486,8 +492,8 @@ private void GenerateEnumerationType( var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo(ContentGeneratorConstants.Contracts, ContentGeneratorConstants.SpecialFolderEnumerationTypes, $"{enumerationName}.cs"), + settings.ProjectPath, + FileInfoFactory.Create(settings.ProjectPath, contractsLocation, ContentGeneratorConstants.SpecialFolderEnumerationTypes, $"{enumerationName}.cs"), ContentWriterArea.Src, content); } @@ -498,9 +504,11 @@ private void GenerateModel( string apiGroupName, bool isSharedContract) { - var fullNamespace = isSharedContract - ? $"{projectName}.{ContentGeneratorConstants.Contracts}" - : $"{projectName}.{ContentGeneratorConstants.Contracts}.{apiGroupName}"; + var contractsLocation = isSharedContract + ? LocationFactory.CreateWithoutTemplateForApiGroupName(settings.ContractsLocation) + : LocationFactory.CreateWithApiGroupName(apiGroupName, settings.ContractsLocation); + + var fullNamespace = NamespaceFactory.Create(settings.ProjectName, contractsLocation); var parameters = ContentGeneratorServerClientModelParametersFactory.CreateForClass( codeGeneratorContentHeader, @@ -508,7 +516,8 @@ private void GenerateModel( codeGeneratorAttribute, modelName, apiSchemaModel, - includeDeprecated); + settings.UsePartialClassForContracts, + settings.IncludeDeprecatedOperations); var contentGeneratorClass = new GenerateContentForClass( new CodeDocumentationTagsGenerator(), @@ -518,10 +527,10 @@ private void GenerateModel( var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, + settings.ProjectPath, isSharedContract - ? projectPath.CombineFileInfo(ContentGeneratorConstants.Contracts, ContentGeneratorConstants.SpecialFolderSharedModels, $"{modelName}.cs") - : projectPath.CombineFileInfo(ContentGeneratorConstants.Contracts, apiGroupName, $"{modelName}.cs"), + ? FileInfoFactory.Create(settings.ProjectPath, contractsLocation, ContentGeneratorConstants.SpecialFolderSharedModels, $"{modelName}.cs") + : FileInfoFactory.Create(settings.ProjectPath, contractsLocation, $"{modelName}.cs"), ContentWriterArea.Src, content); } @@ -534,13 +543,16 @@ private void GenerateCustomErrorResponseModel() return; } - var fullNamespace = $"{projectName}.{ContentGeneratorConstants.Contracts}"; + var contractsLocation = LocationFactory.CreateWithoutTemplateForApiGroupName(settings.ContractsLocation); + + var fullNamespace = NamespaceFactory.Create(settings.ProjectName, contractsLocation); var parameters = ContentGeneratorServerClientModelParametersFactory.CreateForCustomErrorResponseModel( codeGeneratorContentHeader, fullNamespace, codeGeneratorAttribute, - customErrorResponseModel); + customErrorResponseModel, + settings.UsePartialClassForContracts); var contentGeneratorClass = new GenerateContentForClass( new CodeDocumentationTagsGenerator(), @@ -550,8 +562,8 @@ private void GenerateCustomErrorResponseModel() var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo(ContentGeneratorConstants.Contracts, ContentGeneratorConstants.SpecialFolderSharedModels, $"{customErrorResponseModel.Name.EnsureFirstCharacterToUpper()}.cs"), + settings.ProjectPath, + FileInfoFactory.Create(settings.ProjectPath, contractsLocation, ContentGeneratorConstants.SpecialFolderSharedModels, $"{customErrorResponseModel.Name.EnsureFirstCharacterToUpper()}.cs"), ContentWriterArea.Src, content); } diff --git a/src/Atc.Rest.ApiGenerator.Client.CSharp/ProjectGenerator/IClientCSharpApiGenerator.cs b/src/Atc.Rest.ApiGenerator.Client.CSharp/ProjectGenerator/IClientCSharpApiGenerator.cs index c18a961c1..84ffac5a6 100644 --- a/src/Atc.Rest.ApiGenerator.Client.CSharp/ProjectGenerator/IClientCSharpApiGenerator.cs +++ b/src/Atc.Rest.ApiGenerator.Client.CSharp/ProjectGenerator/IClientCSharpApiGenerator.cs @@ -11,8 +11,6 @@ namespace Atc.Rest.ApiGenerator.Client.CSharp.ProjectGenerator; /// public interface IClientCSharpApiGenerator { - string? ClientFolderName { get; set; } - string HttpClientName { get; set; } Task ScaffoldProjectFile(); diff --git a/src/Atc.Rest.ApiGenerator.Contracts/Atc.Rest.ApiGenerator.Contracts.csproj b/src/Atc.Rest.ApiGenerator.Contracts/Atc.Rest.ApiGenerator.Contracts.csproj index 92a0a1a34..1d1e14174 100644 --- a/src/Atc.Rest.ApiGenerator.Contracts/Atc.Rest.ApiGenerator.Contracts.csproj +++ b/src/Atc.Rest.ApiGenerator.Contracts/Atc.Rest.ApiGenerator.Contracts.csproj @@ -10,4 +10,8 @@ + + + + diff --git a/src/Atc.Rest.ApiGenerator.Contracts/ContentGeneratorConstants.cs b/src/Atc.Rest.ApiGenerator.Contracts/ContentGeneratorConstants.cs index 4a1a4e04d..33e1006e8 100644 --- a/src/Atc.Rest.ApiGenerator.Contracts/ContentGeneratorConstants.cs +++ b/src/Atc.Rest.ApiGenerator.Contracts/ContentGeneratorConstants.cs @@ -25,4 +25,8 @@ public static class ContentGeneratorConstants public const string SpecialFolderSharedModels = "_Shared"; public const string Tests = "Tests"; public const string UndefinedDescription = "Undefined description."; + public const string DefaultHttpClientName = "ApiClient"; + public const string DefaultHttpClient = "DefaultHttpClient"; + public const string TemplateKeyForApiGroupName = "apiGroupName"; + public const string TemplateForApiGroupName = "[[apiGroupName]]"; } \ No newline at end of file diff --git a/src/Atc.Rest.ApiGenerator.Contracts/ContentGeneratorsParameters/Client/ContentGeneratorClientEndpointParameters.cs b/src/Atc.Rest.ApiGenerator.Contracts/ContentGeneratorsParameters/Client/ContentGeneratorClientEndpointParameters.cs index 9dce80986..90eaa45ab 100644 --- a/src/Atc.Rest.ApiGenerator.Contracts/ContentGeneratorsParameters/Client/ContentGeneratorClientEndpointParameters.cs +++ b/src/Atc.Rest.ApiGenerator.Contracts/ContentGeneratorsParameters/Client/ContentGeneratorClientEndpointParameters.cs @@ -7,6 +7,7 @@ public record ContentGeneratorClientEndpointParameters( CodeDocumentationTags DocumentationTags, string HttpClientName, string UrlPath, + DeclarationModifiers DeclarationModifier, string EndpointName, string InterfaceName, string ResultName, diff --git a/src/Atc.Rest.ApiGenerator.Contracts/ContentGeneratorsParameters/Client/ContentGeneratorClientEndpointResultInterfaceParameters.cs b/src/Atc.Rest.ApiGenerator.Contracts/ContentGeneratorsParameters/Client/ContentGeneratorClientEndpointResultInterfaceParameters.cs index 20417901e..44449ae9b 100644 --- a/src/Atc.Rest.ApiGenerator.Contracts/ContentGeneratorsParameters/Client/ContentGeneratorClientEndpointResultInterfaceParameters.cs +++ b/src/Atc.Rest.ApiGenerator.Contracts/ContentGeneratorsParameters/Client/ContentGeneratorClientEndpointResultInterfaceParameters.cs @@ -4,6 +4,7 @@ public record ContentGeneratorClientEndpointResultInterfaceParameters( string Namespace, string OperationName, CodeDocumentationTags DocumentationTags, + DeclarationModifiers DeclarationModifier, string InterfaceName, string InheritInterfaceName, bool HasParameterType, diff --git a/src/Atc.Rest.ApiGenerator.Contracts/ContentGeneratorsParameters/Client/ContentGeneratorClientEndpointResultParameters.cs b/src/Atc.Rest.ApiGenerator.Contracts/ContentGeneratorsParameters/Client/ContentGeneratorClientEndpointResultParameters.cs index 420804b99..204c5f664 100644 --- a/src/Atc.Rest.ApiGenerator.Contracts/ContentGeneratorsParameters/Client/ContentGeneratorClientEndpointResultParameters.cs +++ b/src/Atc.Rest.ApiGenerator.Contracts/ContentGeneratorsParameters/Client/ContentGeneratorClientEndpointResultParameters.cs @@ -4,6 +4,7 @@ public record ContentGeneratorClientEndpointResultParameters( string Namespace, string OperationName, CodeDocumentationTags DocumentationTags, + DeclarationModifiers DeclarationModifier, string EndpointResultName, string EndpointResultInterfaceName, string InheritClassName, diff --git a/src/Atc.Rest.ApiGenerator.Contracts/ContentGeneratorsParameters/Client/ContentGeneratorClientParameterParameters.cs b/src/Atc.Rest.ApiGenerator.Contracts/ContentGeneratorsParameters/Client/ContentGeneratorClientParameterParameters.cs index 103de5ad5..4be295271 100644 --- a/src/Atc.Rest.ApiGenerator.Contracts/ContentGeneratorsParameters/Client/ContentGeneratorClientParameterParameters.cs +++ b/src/Atc.Rest.ApiGenerator.Contracts/ContentGeneratorsParameters/Client/ContentGeneratorClientParameterParameters.cs @@ -4,6 +4,7 @@ public record ContentGeneratorClientParameterParameters( string Namespace, string OperationName, CodeDocumentationTags DocumentationTags, + DeclarationModifiers DeclarationModifier, string ParameterName, IList PropertyParameters); diff --git a/src/Atc.Rest.ApiGenerator.Contracts/ContentGeneratorsParameters/Server/ContentGeneratorServerParameterParameters.cs b/src/Atc.Rest.ApiGenerator.Contracts/ContentGeneratorsParameters/Server/ContentGeneratorServerParameterParameters.cs index d2d6f05b6..f89e2491f 100644 --- a/src/Atc.Rest.ApiGenerator.Contracts/ContentGeneratorsParameters/Server/ContentGeneratorServerParameterParameters.cs +++ b/src/Atc.Rest.ApiGenerator.Contracts/ContentGeneratorsParameters/Server/ContentGeneratorServerParameterParameters.cs @@ -4,6 +4,7 @@ public record ContentGeneratorServerParameterParameters( string Namespace, string OperationName, CodeDocumentationTags DocumentationTags, + DeclarationModifiers DeclarationModifier, string ParameterName, IList PropertyParameters); diff --git a/src/Atc.Rest.ApiGenerator.Contracts/ContentGeneratorsParameters/Server/ContentGeneratorServerResultParameters.cs b/src/Atc.Rest.ApiGenerator.Contracts/ContentGeneratorsParameters/Server/ContentGeneratorServerResultParameters.cs index c6dac7060..fa91840b6 100644 --- a/src/Atc.Rest.ApiGenerator.Contracts/ContentGeneratorsParameters/Server/ContentGeneratorServerResultParameters.cs +++ b/src/Atc.Rest.ApiGenerator.Contracts/ContentGeneratorsParameters/Server/ContentGeneratorServerResultParameters.cs @@ -4,6 +4,7 @@ public record ContentGeneratorServerResultParameters( string Namespace, string OperationName, CodeDocumentationTags DocumentationTags, + DeclarationModifiers DeclarationModifier, string ResultName, IList MethodParameters, ContentGeneratorServerResultImplicitOperatorParameters? ImplicitOperatorParameters); diff --git a/src/Atc.Rest.ApiGenerator.Contracts/Extensions/ApiOperationResponseModelExtensions.cs b/src/Atc.Rest.ApiGenerator.Contracts/Extensions/ApiOperationResponseModelExtensions.cs index 53eb66dc2..d63dab547 100644 --- a/src/Atc.Rest.ApiGenerator.Contracts/Extensions/ApiOperationResponseModelExtensions.cs +++ b/src/Atc.Rest.ApiGenerator.Contracts/Extensions/ApiOperationResponseModelExtensions.cs @@ -167,7 +167,7 @@ public static IEnumerable AdjustNamespacesIfNeeded( foreach (var model in responseModels) { if (model.DataType is not null && - IsWellKnownSystemTypeName(model.DataType)) + model.DataType.IsWellKnownSystemTypeName()) { var operationSchemaMapping = operationSchemaMappings.First(x => x.Model.Name == model.DataType); if (operationSchemaMapping.Model.IsShared) @@ -195,11 +195,4 @@ model with return models; } - - private static bool IsWellKnownSystemTypeName( - string value) - => value.EndsWith("Task", StringComparison.Ordinal) || - value.EndsWith("Tasks", StringComparison.Ordinal) || - value.EndsWith("Endpoint", StringComparison.Ordinal) || - value.EndsWith("EventArgs", StringComparison.Ordinal); } \ No newline at end of file diff --git a/src/Atc.Rest.ApiGenerator.Contracts/Extensions/StringExtensions.cs b/src/Atc.Rest.ApiGenerator.Contracts/Extensions/StringExtensions.cs new file mode 100644 index 000000000..762da1462 --- /dev/null +++ b/src/Atc.Rest.ApiGenerator.Contracts/Extensions/StringExtensions.cs @@ -0,0 +1,12 @@ +namespace Atc.Rest.ApiGenerator.Contracts.Extensions; + +public static class StringExtensions +{ + public static bool IsWellKnownSystemTypeName( + this string value) + => value is not null && + (value.EndsWith("Task", StringComparison.Ordinal) || + value.EndsWith("Tasks", StringComparison.Ordinal) || + value.EndsWith("Endpoint", StringComparison.Ordinal) || + value.EndsWith("EventArgs", StringComparison.Ordinal)); +} \ No newline at end of file diff --git a/src/Atc.Rest.ApiGenerator.Contracts/GlobalUsings.cs b/src/Atc.Rest.ApiGenerator.Contracts/GlobalUsings.cs index d23fac09f..422c9a275 100644 --- a/src/Atc.Rest.ApiGenerator.Contracts/GlobalUsings.cs +++ b/src/Atc.Rest.ApiGenerator.Contracts/GlobalUsings.cs @@ -3,4 +3,5 @@ global using System.Net; global using Atc.CodeDocumentation.CodeComment; +global using Atc.CodeGeneration.CSharp.Content; global using Atc.Rest.ApiGenerator.Contracts.Models; \ No newline at end of file diff --git a/src/Atc.Rest.ApiGenerator.Framework.Minimal/ContentGenerators/ContentGeneratorServerEndpoints.cs b/src/Atc.Rest.ApiGenerator.Framework.Minimal/ContentGenerators/ContentGeneratorServerEndpoints.cs index efb74b77d..015615f9d 100644 --- a/src/Atc.Rest.ApiGenerator.Framework.Minimal/ContentGenerators/ContentGeneratorServerEndpoints.cs +++ b/src/Atc.Rest.ApiGenerator.Framework.Minimal/ContentGenerators/ContentGeneratorServerEndpoints.cs @@ -37,7 +37,7 @@ public string Generate() sb.AppendLine(codeAttributeGenerator.Generate()); - sb.AppendLine($"public sealed class {parameters.ApiGroupName}EndpointDefinition : IEndpointDefinition"); + sb.AppendLine($"{parameters.DeclarationModifier.GetDescription()} {parameters.ApiGroupName}EndpointDefinition : IEndpointDefinition"); sb.AppendLine("{"); AppendContent(sb); sb.Append('}'); diff --git a/src/Atc.Rest.ApiGenerator.Framework.Minimal/ContentGenerators/ContentGeneratorServerResult.cs b/src/Atc.Rest.ApiGenerator.Framework.Minimal/ContentGenerators/ContentGeneratorServerResult.cs index ee471dd42..99421df34 100644 --- a/src/Atc.Rest.ApiGenerator.Framework.Minimal/ContentGenerators/ContentGeneratorServerResult.cs +++ b/src/Atc.Rest.ApiGenerator.Framework.Minimal/ContentGenerators/ContentGeneratorServerResult.cs @@ -35,7 +35,7 @@ public string Generate() } sb.AppendLine(codeAttributeGenerator.Generate()); - sb.AppendLine($"public class {parameters.ResultName}"); + sb.AppendLine($"{parameters.DeclarationModifier.GetDescription()} {parameters.ResultName}"); sb.AppendLine("{"); sb.AppendLine(4, $"private {parameters.ResultName}(IResult result)"); sb.AppendLine(4, "{"); diff --git a/src/Atc.Rest.ApiGenerator.Framework.Minimal/Factories/ContentGeneratorServerHandlerInterfaceParametersFactory.cs b/src/Atc.Rest.ApiGenerator.Framework.Minimal/Factories/ContentGeneratorServerHandlerInterfaceParametersFactory.cs index 93316a3d6..96dcf3ae3 100644 --- a/src/Atc.Rest.ApiGenerator.Framework.Minimal/Factories/ContentGeneratorServerHandlerInterfaceParametersFactory.cs +++ b/src/Atc.Rest.ApiGenerator.Framework.Minimal/Factories/ContentGeneratorServerHandlerInterfaceParametersFactory.cs @@ -57,7 +57,7 @@ public static InterfaceParameters Create( exceptions: null, @return: null), Attributes: null, - AccessModifier: AccessModifiers.None, + DeclarationModifier: DeclarationModifiers.None, ReturnTypeName: returnTypeName, ReturnGenericTypeName: "Task", Name: "ExecuteAsync", @@ -72,7 +72,7 @@ public static InterfaceParameters Create( @namespace, DocumentationTags: openApiOperation.ExtractDocumentationTagsForHandlerInterface(), new List { codeGeneratorAttribute }, - AccessModifiers.Public, + DeclarationModifiers.PublicInterface, InterfaceTypeName: $"I{operationName}{ContentGeneratorConstants.Handler}", InheritedInterfaceTypeName: null, Properties: null, diff --git a/src/Atc.Rest.ApiGenerator.Framework.Minimal/Factories/ContentGeneratorServerHandlerParametersFactory.cs b/src/Atc.Rest.ApiGenerator.Framework.Minimal/Factories/ContentGeneratorServerHandlerParametersFactory.cs index 598db795f..85faf73a2 100644 --- a/src/Atc.Rest.ApiGenerator.Framework.Minimal/Factories/ContentGeneratorServerHandlerParametersFactory.cs +++ b/src/Atc.Rest.ApiGenerator.Framework.Minimal/Factories/ContentGeneratorServerHandlerParametersFactory.cs @@ -46,7 +46,7 @@ public static ClassParameters Create( new( DocumentationTags: null, Attributes: null, - AccessModifier: AccessModifiers.Public, + DeclarationModifier: DeclarationModifiers.Public, ReturnTypeName: $"{operationName}{ContentGeneratorConstants.Result}", ReturnGenericTypeName: "Task", Name: "ExecuteAsync", @@ -61,7 +61,7 @@ public static ClassParameters Create( @namespace, openApiOperation.ExtractDocumentationTagsForHandler(), Attributes: null, - AccessModifiers.PublicSealedClass, + DeclarationModifiers.PublicSealedClass, ClassTypeName: $"{operationName}{ContentGeneratorConstants.Handler}", GenericTypeName: null, InheritedClassTypeName: $"I{operationName}{ContentGeneratorConstants.Handler}", @@ -84,7 +84,7 @@ public static ClassParameters CreateForCustomTest( new( DocumentationTags: null, Attributes: AttributesParametersFactory.Create("Fact", "Skip = \"Change this to a real test\""), - AccessModifier: AccessModifiers.Public, + DeclarationModifier: DeclarationModifiers.Public, ReturnTypeName: "void", ReturnGenericTypeName: null, Name: "Sample", @@ -99,7 +99,7 @@ public static ClassParameters CreateForCustomTest( @namespace, DocumentationTags: null, Attributes: null, - AccessModifiers.PublicClass, + DeclarationModifiers.PublicClass, ClassTypeName: $"{operationName}{ContentGeneratorConstants.HandlerTests}", GenericTypeName: null, InheritedClassTypeName: null, diff --git a/src/Atc.Rest.ApiGenerator.Framework.Minimal/Factories/ContentGeneratorServerResultParametersFactory.cs b/src/Atc.Rest.ApiGenerator.Framework.Minimal/Factories/ContentGeneratorServerResultParametersFactory.cs index 1c079f52c..f295b2cb2 100644 --- a/src/Atc.Rest.ApiGenerator.Framework.Minimal/Factories/ContentGeneratorServerResultParametersFactory.cs +++ b/src/Atc.Rest.ApiGenerator.Framework.Minimal/Factories/ContentGeneratorServerResultParametersFactory.cs @@ -53,6 +53,7 @@ public static ContentGeneratorServerResultParameters Create( @namespace, operationName, openApiOperation.ExtractDocumentationTagsForResult(), + DeclarationModifiers.PublicClass, $"{operationName}{ContentGeneratorConstants.Result}", methodParameters, implicitOperatorParameters); diff --git a/src/Atc.Rest.ApiGenerator.Framework.Minimal/GlobalUsings.cs b/src/Atc.Rest.ApiGenerator.Framework.Minimal/GlobalUsings.cs index e3bb7c36b..3fa87e833 100644 --- a/src/Atc.Rest.ApiGenerator.Framework.Minimal/GlobalUsings.cs +++ b/src/Atc.Rest.ApiGenerator.Framework.Minimal/GlobalUsings.cs @@ -14,6 +14,7 @@ global using Atc.Rest.ApiGenerator.Framework.ContentGenerators; global using Atc.Rest.ApiGenerator.Framework.ContentGenerators.Server; global using Atc.Rest.ApiGenerator.Framework.ContentGeneratorsParameters.Server; +global using Atc.Rest.ApiGenerator.Framework.Factories; global using Atc.Rest.ApiGenerator.Framework.Factories.Parameters.Server; global using Atc.Rest.ApiGenerator.Framework.Factories.Parameters.ServerClient; global using Atc.Rest.ApiGenerator.Framework.Factories.Server; @@ -21,6 +22,7 @@ global using Atc.Rest.ApiGenerator.Framework.Minimal.Factories; global using Atc.Rest.ApiGenerator.Framework.ProjectGenerator; global using Atc.Rest.ApiGenerator.Framework.Providers; +global using Atc.Rest.ApiGenerator.Framework.Settings; global using Atc.Rest.ApiGenerator.Framework.Writers; global using Atc.Rest.ApiGenerator.OpenApi.Extensions; diff --git a/src/Atc.Rest.ApiGenerator.Framework.Minimal/ProjectGenerator/ServerApiGenerator.cs b/src/Atc.Rest.ApiGenerator.Framework.Minimal/ProjectGenerator/ServerApiGenerator.cs index 67533c4d3..a5a3f94bf 100644 --- a/src/Atc.Rest.ApiGenerator.Framework.Minimal/ProjectGenerator/ServerApiGenerator.cs +++ b/src/Atc.Rest.ApiGenerator.Framework.Minimal/ProjectGenerator/ServerApiGenerator.cs @@ -5,54 +5,40 @@ public class ServerApiGenerator : IServerApiGenerator { private readonly ILogger logger; private readonly INugetPackageReferenceProvider nugetPackageReferenceProvider; - private readonly Version apiGeneratorVersion; - private readonly string projectName; - private readonly DirectoryInfo projectPath; private readonly OpenApiDocument openApiDocument; private readonly IList operationSchemaMappings; private readonly string routeBase; private readonly string codeGeneratorContentHeader; private readonly AttributeParameters codeGeneratorAttribute; - private readonly bool useProblemDetailsAsDefaultResponseBody; - private readonly bool includeDeprecated; + private readonly GeneratorSettings settings; public ServerApiGenerator( ILoggerFactory loggerFactory, INugetPackageReferenceProvider nugetPackageReferenceProvider, - Version apiGeneratorVersion, - string projectName, - DirectoryInfo projectPath, OpenApiDocument openApiDocument, IList operationSchemaMappings, string routeBase, - bool useProblemDetailsAsDefaultResponseBody, - bool includeDeprecated) + GeneratorSettings generatorSettings) { ArgumentNullException.ThrowIfNull(loggerFactory); ArgumentNullException.ThrowIfNull(nugetPackageReferenceProvider); - ArgumentNullException.ThrowIfNull(apiGeneratorVersion); - ArgumentNullException.ThrowIfNull(projectName); - ArgumentNullException.ThrowIfNull(projectPath); ArgumentNullException.ThrowIfNull(openApiDocument); ArgumentNullException.ThrowIfNull(routeBase); + ArgumentNullException.ThrowIfNull(generatorSettings); logger = loggerFactory.CreateLogger(); this.nugetPackageReferenceProvider = nugetPackageReferenceProvider; - this.apiGeneratorVersion = apiGeneratorVersion; - this.projectName = projectName; - this.projectPath = projectPath; this.openApiDocument = openApiDocument; this.operationSchemaMappings = operationSchemaMappings; this.routeBase = routeBase; - this.useProblemDetailsAsDefaultResponseBody = useProblemDetailsAsDefaultResponseBody; - this.includeDeprecated = includeDeprecated; + settings = generatorSettings; codeGeneratorContentHeader = GeneratedCodeHeaderGeneratorFactory - .Create(apiGeneratorVersion) + .Create(settings.Version) .Generate(); codeGeneratorAttribute = new AttributeParameters( "GeneratedCode", - $"\"{ContentWriterConstants.ApiGeneratorName}\", \"{apiGeneratorVersion}\""); + $"\"{ContentWriterConstants.ApiGeneratorName}\", \"{settings.Version}\""); } public async Task ScaffoldProjectFile() @@ -80,7 +66,7 @@ public async Task ScaffoldProjectFile() new("GenerateDocumentationFile", Attributes: null, "true"), ], [ - new("DocumentationFile", Attributes: null, @$"bin\Debug\net8.0\{projectName}.xml"), + new("DocumentationFile", Attributes: null, @$"bin\Debug\net8.0\{settings.ProjectName}.xml"), new("NoWarn", Attributes: null, "$(NoWarn);1573;1591;1701;1702;1712;8618;"), ], ], @@ -95,8 +81,8 @@ public async Task ScaffoldProjectFile() var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo($"{projectName}.csproj"), + settings.ProjectPath, + FileInfoFactory.Create(settings.ProjectPath, $"{settings.ProjectName}.csproj"), ContentWriterArea.Src, content, overrideIfExist: false); @@ -104,7 +90,7 @@ public async Task ScaffoldProjectFile() public void GenerateAssemblyMarker() { - ArgumentNullException.ThrowIfNull(apiGeneratorVersion); + ArgumentNullException.ThrowIfNull(settings.Version); var suppressMessageAvoidEmptyInterfaceAttribute = new AttributeParameters( "SuppressMessage", @@ -112,7 +98,7 @@ public void GenerateAssemblyMarker() var interfaceParameters = InterfaceParametersFactory.Create( codeGeneratorContentHeader, - projectName, + settings.ProjectName, [suppressMessageAvoidEmptyInterfaceAttribute, codeGeneratorAttribute], "IApiContractAssemblyMarker"); @@ -124,8 +110,8 @@ public void GenerateAssemblyMarker() var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo("IApiContractAssemblyMarker.cs"), + settings.ProjectPath, + FileInfoFactory.Create(settings.ProjectPath, "IApiContractAssemblyMarker.cs"), ContentWriterArea.Src, content); } @@ -164,11 +150,13 @@ public void GenerateParameters() { var apiGroupName = openApiPath.GetApiGroupName(); - var fullNamespace = $"{projectName}.{ContentGeneratorConstants.Contracts}.{apiGroupName}"; + var contractsLocation = LocationFactory.CreateWithApiGroupName(apiGroupName, settings.ContractsLocation); + + var fullNamespace = NamespaceFactory.Create(settings.ProjectName, contractsLocation); foreach (var openApiOperation in openApiPath.Value.Operations) { - if (openApiOperation.Value.Deprecated && !includeDeprecated) + if (openApiOperation.Value.Deprecated && !settings.IncludeDeprecatedOperations) { continue; } @@ -185,8 +173,8 @@ public void GenerateParameters() openApiPath.Value.Parameters); var contentGenerator = new ContentGenerators.ContentGeneratorServerParameter( - new GeneratedCodeHeaderGenerator(new GeneratedCodeGeneratorParameters(apiGeneratorVersion)), - new GeneratedCodeAttributeGenerator(new GeneratedCodeGeneratorParameters(apiGeneratorVersion)), + new GeneratedCodeHeaderGenerator(new GeneratedCodeGeneratorParameters(settings.Version)), + new GeneratedCodeAttributeGenerator(new GeneratedCodeGeneratorParameters(settings.Version)), new CodeDocumentationTagsGenerator(), parameterParameters); @@ -194,8 +182,8 @@ public void GenerateParameters() var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo(ContentGeneratorConstants.Contracts, apiGroupName, ContentGeneratorConstants.Parameters, $"{parameterParameters.ParameterName}.cs"), + settings.ProjectPath, + FileInfoFactory.Create(settings.ProjectPath, contractsLocation, ContentGeneratorConstants.Parameters, $"{parameterParameters.ParameterName}.cs"), ContentWriterArea.Src, content); } @@ -208,11 +196,13 @@ public void GenerateResults() { var apiGroupName = openApiPath.GetApiGroupName(); - var fullNamespace = $"{projectName}.{ContentGeneratorConstants.Contracts}.{apiGroupName}"; + var contractsLocation = LocationFactory.CreateWithApiGroupName(apiGroupName, settings.ContractsLocation); + + var fullNamespace = NamespaceFactory.Create(settings.ProjectName, contractsLocation); foreach (var openApiOperation in openApiPath.Value.Operations) { - if (openApiOperation.Value.Deprecated && !includeDeprecated) + if (openApiOperation.Value.Deprecated && !settings.IncludeDeprecatedOperations) { continue; } @@ -222,18 +212,18 @@ public void GenerateResults() openApiOperation.Value); var contentGenerator = new ContentGenerators.ContentGeneratorServerResult( - new GeneratedCodeHeaderGenerator(new GeneratedCodeGeneratorParameters(apiGeneratorVersion)), - new GeneratedCodeAttributeGenerator(new GeneratedCodeGeneratorParameters(apiGeneratorVersion)), + new GeneratedCodeHeaderGenerator(new GeneratedCodeGeneratorParameters(settings.Version)), + new GeneratedCodeAttributeGenerator(new GeneratedCodeGeneratorParameters(settings.Version)), new CodeDocumentationTagsGenerator(), resultParameters, - useProblemDetailsAsDefaultResponseBody); + settings.UseProblemDetailsAsDefaultResponseBody); var content = contentGenerator.Generate(); var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo(ContentGeneratorConstants.Contracts, apiGroupName, ContentGeneratorConstants.Results, $"{resultParameters.ResultName}.cs"), + settings.ProjectPath, + FileInfoFactory.Create(settings.ProjectPath, contractsLocation, ContentGeneratorConstants.Results, $"{resultParameters.ResultName}.cs"), ContentWriterArea.Src, content); } @@ -246,11 +236,13 @@ public void GenerateInterfaces() { var apiGroupName = openApiPath.GetApiGroupName(); - var fullNamespace = $"{projectName}.{ContentGeneratorConstants.Contracts}.{apiGroupName}"; + var contractsLocation = LocationFactory.CreateWithApiGroupName(apiGroupName, settings.ContractsLocation); + + var fullNamespace = NamespaceFactory.Create(settings.ProjectName, contractsLocation); foreach (var openApiOperation in openApiPath.Value.Operations) { - if (openApiOperation.Value.Deprecated && !includeDeprecated) + if (openApiOperation.Value.Deprecated && !settings.IncludeDeprecatedOperations) { continue; } @@ -270,8 +262,8 @@ public void GenerateInterfaces() var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo(ContentGeneratorConstants.Contracts, apiGroupName, ContentGeneratorConstants.Interfaces, $"{interfaceParameters.InterfaceTypeName}.cs"), + settings.ProjectPath, + FileInfoFactory.Create(settings.ProjectPath, contractsLocation, ContentGeneratorConstants.Interfaces, $"{interfaceParameters.InterfaceTypeName}.cs"), ContentWriterArea.Src, content); } @@ -282,28 +274,33 @@ public void GenerateEndpoints() { foreach (var apiGroupName in openApiDocument.GetApiGroupNames()) { + var endpointsLocation = LocationFactory.CreateWithoutTemplateForApiGroupName(settings.EndpointsLocation); + + var fullNamespace = NamespaceFactory.Create(settings.ProjectName, endpointsLocation); + var endpointParameters = ContentGeneratorServerEndpointParametersFactory.Create( operationSchemaMappings, - projectName, - $"{projectName}.{ContentGeneratorConstants.Endpoints}", + settings.ProjectName, + fullNamespace, apiGroupName, GetRouteByApiGroupName(apiGroupName), ContentGeneratorConstants.EndpointDefinition, - openApiDocument); + openApiDocument, + settings.UsePartialClassForEndpoints); var contentGenerator = new ContentGenerators.ContentGeneratorServerEndpoints( - new GeneratedCodeHeaderGenerator(new GeneratedCodeGeneratorParameters(apiGeneratorVersion)), - new GeneratedCodeAttributeGenerator(new GeneratedCodeGeneratorParameters(apiGeneratorVersion)), + new GeneratedCodeHeaderGenerator(new GeneratedCodeGeneratorParameters(settings.Version)), + new GeneratedCodeAttributeGenerator(new GeneratedCodeGeneratorParameters(settings.Version)), new CodeDocumentationTagsGenerator(), endpointParameters, - useProblemDetailsAsDefaultResponseBody); + settings.UseProblemDetailsAsDefaultResponseBody); var content = contentGenerator.Generate(); var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo(ContentGeneratorConstants.Endpoints, $"{endpointParameters.EndpointName}.cs"), + settings.ProjectPath, + FileInfoFactory.Create(settings.ProjectPath, endpointsLocation, $"{endpointParameters.EndpointName}.cs"), ContentWriterArea.Src, content); } @@ -314,7 +311,7 @@ public void MaintainApiSpecification( => ResourcesHelper.CopyApiSpecification( apiSpecificationFile, openApiDocument, - projectPath); + settings.ProjectPath); public void MaintainGlobalUsings( bool removeNamespaceGroupSeparatorInGlobalUsings) @@ -330,7 +327,7 @@ public void MaintainGlobalUsings( "Microsoft.AspNetCore.Mvc", }; - if (openApiDocument.IsUsingRequiredForSystemTextJsonSerializationAndSystemRuntimeSerialization(includeDeprecated)) + if (openApiDocument.IsUsingRequiredForSystemTextJsonSerializationAndSystemRuntimeSerialization(settings.IncludeDeprecatedOperations)) { requiredUsings.Add("System.Runtime.Serialization"); requiredUsings.Add("System.Text.Json.Serialization"); @@ -341,7 +338,7 @@ public void MaintainGlobalUsings( requiredUsings.Add("Atc.Rest.Results"); } - if (openApiDocument.IsUsingRequiredForMicrosoftAspNetCoreAuthorization(includeDeprecated)) + if (openApiDocument.IsUsingRequiredForMicrosoftAspNetCoreAuthorization(settings.IncludeDeprecatedOperations)) { requiredUsings.Add("Microsoft.AspNetCore.Authorization"); } @@ -353,16 +350,24 @@ public void MaintainGlobalUsings( if (operationSchemaMappings.Any(apiOperation => apiOperation.Model.IsShared)) { - requiredUsings.Add($"{projectName}.{ContentGeneratorConstants.Contracts}"); + var requiredUsing = NamespaceFactory.Create( + settings.ProjectName, + LocationFactory.CreateWithoutTemplateForApiGroupName(settings.ContractsLocation)); + + if (!requiredUsings.Contains(requiredUsing, StringComparer.CurrentCulture)) + { + requiredUsings.Add(requiredUsing); + } } var apiGroupNames = openApiDocument.GetApiGroupNames(); - requiredUsings.AddRange(apiGroupNames.Select(x => $"{projectName}.{ContentGeneratorConstants.Contracts}.{x}")); + + requiredUsings.AddRange(apiGroupNames.Select(x => NamespaceFactory.Create(settings.ProjectName, LocationFactory.CreateWithApiGroupName(x, settings.ContractsLocation)))); GlobalUsingsHelper.CreateOrUpdate( logger, ContentWriterArea.Src, - projectPath, + settings.ProjectPath, requiredUsings, removeNamespaceGroupSeparatorInGlobalUsings); } @@ -387,7 +392,9 @@ private void GenerateEnumerationType( string enumerationName, OpenApiSchema openApiSchemaEnumeration) { - var fullNamespace = $"{projectName}.{ContentGeneratorConstants.Contracts}"; + var contractsLocation = LocationFactory.CreateWithoutTemplateForApiGroupName(settings.ContractsLocation); + + var fullNamespace = NamespaceFactory.Create(settings.ProjectName, contractsLocation); var enumParameters = ContentGeneratorServerClientEnumParametersFactory.Create( codeGeneratorContentHeader, @@ -404,8 +411,8 @@ private void GenerateEnumerationType( var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo(ContentGeneratorConstants.Contracts, ContentGeneratorConstants.SpecialFolderEnumerationTypes, $"{enumerationName}.cs"), + settings.ProjectPath, + FileInfoFactory.Create(settings.ProjectPath, contractsLocation, ContentGeneratorConstants.SpecialFolderEnumerationTypes, $"{enumerationName}.cs"), ContentWriterArea.Src, content); } @@ -416,9 +423,11 @@ private void GenerateModel( string apiGroupName, bool isSharedContract) { - var fullNamespace = isSharedContract - ? $"{projectName}.{ContentGeneratorConstants.Contracts}" - : $"{projectName}.{ContentGeneratorConstants.Contracts}.{apiGroupName}"; + var contractsLocation = isSharedContract + ? LocationFactory.CreateWithoutTemplateForApiGroupName(settings.ContractsLocation) + : LocationFactory.CreateWithApiGroupName(apiGroupName, settings.ContractsLocation); + + var fullNamespace = NamespaceFactory.Create(settings.ProjectName, contractsLocation); var parameters = ContentGeneratorServerClientModelParametersFactory.CreateForRecord( codeGeneratorContentHeader, @@ -426,7 +435,8 @@ private void GenerateModel( codeGeneratorAttribute, modelName, apiSchemaModel, - includeDeprecated); + settings.UsePartialClassForContracts, + settings.IncludeDeprecatedOperations); var contentGeneratorRecord = new GenerateContentForRecords( new CodeDocumentationTagsGenerator(), @@ -436,10 +446,10 @@ private void GenerateModel( var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, + settings.ProjectPath, isSharedContract - ? projectPath.CombineFileInfo(ContentGeneratorConstants.Contracts, ContentGeneratorConstants.SpecialFolderSharedModels, $"{modelName}.cs") - : projectPath.CombineFileInfo(ContentGeneratorConstants.Contracts, apiGroupName, ContentGeneratorConstants.Models, $"{modelName}.cs"), + ? FileInfoFactory.Create(settings.ProjectPath, contractsLocation, ContentGeneratorConstants.SpecialFolderSharedModels, $"{modelName}.cs") + : FileInfoFactory.Create(settings.ProjectPath, contractsLocation, ContentGeneratorConstants.Models, $"{modelName}.cs"), ContentWriterArea.Src, content); } diff --git a/src/Atc.Rest.ApiGenerator.Framework.Minimal/ProjectGenerator/ServerDomainGenerator.cs b/src/Atc.Rest.ApiGenerator.Framework.Minimal/ProjectGenerator/ServerDomainGenerator.cs index 9b80ba590..12030a56d 100644 --- a/src/Atc.Rest.ApiGenerator.Framework.Minimal/ProjectGenerator/ServerDomainGenerator.cs +++ b/src/Atc.Rest.ApiGenerator.Framework.Minimal/ProjectGenerator/ServerDomainGenerator.cs @@ -6,42 +6,36 @@ public class ServerDomainGenerator : IServerDomainGenerator { private readonly ILogger logger; private readonly INugetPackageReferenceProvider nugetPackageReferenceProvider; - private readonly string projectName; private readonly string apiProjectName; - private readonly DirectoryInfo projectPath; private readonly OpenApiDocument openApiDocument; private readonly string codeGeneratorContentHeader; private readonly AttributeParameters codeGeneratorAttribute; + private readonly GeneratorSettings settings; public ServerDomainGenerator( ILoggerFactory loggerFactory, INugetPackageReferenceProvider nugetPackageReferenceProvider, - Version apiGeneratorVersion, - string projectName, string apiProjectName, - DirectoryInfo projectPath, - OpenApiDocument openApiDocument) + OpenApiDocument openApiDocument, + GeneratorSettings generatorSettings) { ArgumentNullException.ThrowIfNull(loggerFactory); ArgumentNullException.ThrowIfNull(nugetPackageReferenceProvider); - ArgumentNullException.ThrowIfNull(apiGeneratorVersion); - ArgumentNullException.ThrowIfNull(projectName); ArgumentNullException.ThrowIfNull(apiProjectName); - ArgumentNullException.ThrowIfNull(projectPath); ArgumentNullException.ThrowIfNull(openApiDocument); + ArgumentNullException.ThrowIfNull(generatorSettings); logger = loggerFactory.CreateLogger(); this.nugetPackageReferenceProvider = nugetPackageReferenceProvider; - this.projectName = projectName; this.apiProjectName = apiProjectName; - this.projectPath = projectPath; this.openApiDocument = openApiDocument; + settings = generatorSettings; codeGeneratorContentHeader = GeneratedCodeHeaderGeneratorFactory - .Create(apiGeneratorVersion) + .Create(settings.Version) .Generate(); codeGeneratorAttribute = AttributeParametersFactory - .CreateGeneratedCode(apiGeneratorVersion); + .CreateGeneratedCode(settings.Version); } public async Task ScaffoldProjectFile() @@ -69,7 +63,7 @@ public async Task ScaffoldProjectFile() new("GenerateDocumentationFile", Attributes: null, "true"), ], [ - new("DocumentationFile", Attributes: null, @$"bin\Debug\net8.0\{projectName}.xml"), + new("DocumentationFile", Attributes: null, @$"bin\Debug\net8.0\{settings.ProjectName}.xml"), new("NoWarn", Attributes: null, "$(NoWarn);1573;1591;1701;1702;1712;8618;"), ], ], @@ -100,8 +94,8 @@ public async Task ScaffoldProjectFile() var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo($"{projectName}.csproj"), + settings.ProjectPath, + settings.ProjectPath.CombineFileInfo($"{settings.ProjectName}.csproj"), ContentWriterArea.Src, content, overrideIfExist: false); @@ -113,13 +107,16 @@ public void ScaffoldHandlers() { var apiGroupName = urlPath.GetApiGroupName(); + var handlersLocation = LocationFactory.CreateWithApiGroupName(apiGroupName, settings.HandlersLocation); + var contractsLocation = LocationFactory.CreateWithApiGroupName(apiGroupName, settings.ContractsLocation); + + var fullNamespace = NamespaceFactory.Create(settings.ProjectName, handlersLocation); + foreach (var openApiOperation in urlPath.Value.Operations) { - var fullNamespace = $"{projectName}.{ContentGeneratorConstants.Handlers}.{apiGroupName}"; - var classParameters = ContentGeneratorServerHandlerParametersFactory.Create( fullNamespace, - $"Api.Generated.{ContentGeneratorConstants.Contracts}.{apiGroupName}", + $"Api.Generated.{contractsLocation}", // TODO: Fix this urlPath.Value, openApiOperation.Value); @@ -131,11 +128,8 @@ public void ScaffoldHandlers() var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo( - ContentGeneratorConstants.Handlers, - apiGroupName, - $"{classParameters.TypeName}.cs"), + settings.ProjectPath, + FileInfoFactory.Create(settings.ProjectPath, handlersLocation, $"{classParameters.TypeName}.cs"), ContentWriterArea.Src, content, overrideIfExist: false); @@ -151,7 +145,7 @@ public void GenerateAssemblyMarker() var interfaceParameters = InterfaceParametersFactory.Create( codeGeneratorContentHeader, - projectName, + settings.ProjectName, [suppressMessageAvoidEmptyInterfaceAttribute, codeGeneratorAttribute], "IDomainAssemblyMarker"); @@ -163,8 +157,8 @@ public void GenerateAssemblyMarker() var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo("IDomainAssemblyMarker.cs"), + settings.ProjectPath, + settings.ProjectPath.CombineFileInfo("IDomainAssemblyMarker.cs"), ContentWriterArea.Src, content); } @@ -188,7 +182,7 @@ public void GenerateServiceCollectionEndpointHandlerExtensions() var methodConfigureDomainServices = new MethodParameters( DocumentationTags: null, Attributes: null, - AccessModifiers.PublicStatic, + DeclarationModifiers.PublicStatic, ReturnGenericTypeName: null, ReturnTypeName: "IServiceCollection", Name: "ConfigureDomainHandlers", @@ -219,10 +213,10 @@ public void GenerateServiceCollectionEndpointHandlerExtensions() var classParameters = new ClassParameters( codeGeneratorContentHeader, - Namespace: $"{projectName}.Extensions", + Namespace: $"{settings.ProjectName}.Extensions", DocumentationTags: null, Attributes: [codeGeneratorAttribute], - AccessModifiers.PublicStaticClass, + DeclarationModifiers.PublicStaticClass, ClassTypeName: "ServiceCollectionEndpointHandlerExtensions", GenericTypeName: null, InheritedClassTypeName: null, @@ -244,8 +238,8 @@ public void GenerateServiceCollectionEndpointHandlerExtensions() var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo("Extensions", "ServiceCollectionEndpointHandlerExtensions.cs"), + settings.ProjectPath, + settings.ProjectPath.CombineFileInfo("Extensions", "ServiceCollectionEndpointHandlerExtensions.cs"), ContentWriterArea.Src, content); } @@ -263,13 +257,12 @@ public void MaintainGlobalUsings( var apiGroupNames = openApiDocument.GetApiGroupNames(); - requiredUsings.AddRange(apiGroupNames.Select(x => $"{apiProjectName}.{ContentGeneratorConstants.Contracts}.{x}")); - requiredUsings.AddRange(apiGroupNames.Select(x => $"{projectName}.{ContentGeneratorConstants.Handlers}.{x}")); + requiredUsings.AddRange(apiGroupNames.Select(x => NamespaceFactory.Create(apiProjectName, LocationFactory.CreateWithApiGroupName(x, settings.ContractsLocation)))); GlobalUsingsHelper.CreateOrUpdate( logger, ContentWriterArea.Src, - projectPath, + settings.ProjectPath, requiredUsings, removeNamespaceGroupSeparatorInGlobalUsings); } diff --git a/src/Atc.Rest.ApiGenerator.Framework.Minimal/ProjectGenerator/ServerHostGenerator.cs b/src/Atc.Rest.ApiGenerator.Framework.Minimal/ProjectGenerator/ServerHostGenerator.cs index 40881b7e9..638e1e208 100644 --- a/src/Atc.Rest.ApiGenerator.Framework.Minimal/ProjectGenerator/ServerHostGenerator.cs +++ b/src/Atc.Rest.ApiGenerator.Framework.Minimal/ProjectGenerator/ServerHostGenerator.cs @@ -5,40 +5,32 @@ public class ServerHostGenerator : IServerHostGenerator { private readonly ILogger logger; private readonly INugetPackageReferenceProvider nugetPackageReferenceProvider; - private readonly Version apiGeneratorVersion; - private readonly string projectName; private readonly string apiProjectName; private readonly string domainProjectName; - private readonly DirectoryInfo projectPath; private readonly OpenApiDocument openApiDocument; + private readonly GeneratorSettings settings; public ServerHostGenerator( ILoggerFactory loggerFactory, INugetPackageReferenceProvider nugetPackageReferenceProvider, - Version apiGeneratorVersion, - string projectName, string apiProjectName, string domainProjectName, - DirectoryInfo projectPath, - OpenApiDocument openApiDocument) + OpenApiDocument openApiDocument, + GeneratorSettings generatorSettings) { ArgumentNullException.ThrowIfNull(loggerFactory); ArgumentNullException.ThrowIfNull(nugetPackageReferenceProvider); - ArgumentNullException.ThrowIfNull(apiGeneratorVersion); - ArgumentNullException.ThrowIfNull(projectName); ArgumentNullException.ThrowIfNull(apiProjectName); ArgumentNullException.ThrowIfNull(domainProjectName); - ArgumentNullException.ThrowIfNull(projectPath); + ArgumentNullException.ThrowIfNull(openApiDocument); ArgumentNullException.ThrowIfNull(openApiDocument); logger = loggerFactory.CreateLogger(); this.nugetPackageReferenceProvider = nugetPackageReferenceProvider; - this.apiGeneratorVersion = apiGeneratorVersion; - this.projectName = projectName; this.apiProjectName = apiProjectName; this.domainProjectName = domainProjectName; - this.projectPath = projectPath; this.openApiDocument = openApiDocument; + settings = generatorSettings; } /// @@ -71,7 +63,7 @@ public async Task ScaffoldProjectFile() new("GenerateDocumentationFile", Attributes: null, "true"), ], [ - new("DocumentationFile", Attributes: null, @$"bin\Debug\net8.0\{projectName}.xml"), + new("DocumentationFile", Attributes: null, @$"bin\Debug\net8.0\{settings.ProjectName}.xml"), new("NoWarn", Attributes: null, "$(NoWarn);1573;1591;1701;1702;1712;8618;"), ], ], @@ -100,8 +92,8 @@ public async Task ScaffoldProjectFile() var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo($"{projectName}.csproj"), + settings.ProjectPath, + settings.ProjectPath.CombineFileInfo($"{settings.ProjectName}.csproj"), ContentWriterArea.Src, content, overrideIfExist: false); @@ -109,21 +101,21 @@ public async Task ScaffoldProjectFile() public void ScaffoldPropertiesLaunchSettingsFile() => ResourcesHelper.ScaffoldPropertiesLaunchSettingsFile( - projectName, - projectPath, + settings.ProjectName, + settings.ProjectPath, useExtended: true); public void ScaffoldJsonSerializerOptionsExtensions() { var contentGenerator = new ContentGenerators.ContentGeneratorServerJsonSerializerOptionsExtensions( - new ContentGeneratorBaseParameters(Namespace: projectName)); + new ContentGeneratorBaseParameters(Namespace: settings.ProjectName)); var content = contentGenerator.Generate(); var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo("Extensions", "JsonSerializerOptionsExtensions.cs"), + settings.ProjectPath, + settings.ProjectPath.CombineFileInfo("Extensions", "JsonSerializerOptionsExtensions.cs"), ContentWriterArea.Src, content, overrideIfExist: false); @@ -132,14 +124,14 @@ public void ScaffoldJsonSerializerOptionsExtensions() public void ScaffoldServiceCollectionExtensions() { var contentGenerator = new ContentGenerators.ContentGeneratorServerServiceCollectionExtensions( - new ContentGeneratorBaseParameters(Namespace: projectName)); + new ContentGeneratorBaseParameters(Namespace: settings.ProjectName)); var content = contentGenerator.Generate(); var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo("Extensions", "ServiceCollectionExtensions.cs"), + settings.ProjectPath, + settings.ProjectPath.CombineFileInfo("Extensions", "ServiceCollectionExtensions.cs"), ContentWriterArea.Src, content, overrideIfExist: false); @@ -148,14 +140,14 @@ public void ScaffoldServiceCollectionExtensions() public void ScaffoldWebApplicationBuilderExtensions() { var contentGenerator = new ContentGenerators.ContentGeneratorServerWebApplicationBuilderExtensions( - new ContentGeneratorBaseParameters(Namespace: projectName)); + new ContentGeneratorBaseParameters(Namespace: settings.ProjectName)); var content = contentGenerator.Generate(); var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo("Extensions", "WebApplicationBuilderExtensions.cs"), + settings.ProjectPath, + settings.ProjectPath.CombineFileInfo("Extensions", "WebApplicationBuilderExtensions.cs"), ContentWriterArea.Src, content, overrideIfExist: false); @@ -165,7 +157,7 @@ public void ScaffoldWebApplicationExtensions( SwaggerThemeMode swaggerThemeMode) { var contentGenerator = new ContentGenerators.ContentGeneratorServerWebApplicationExtensions( - new ContentGeneratorBaseParameters(Namespace: projectName)) + new ContentGeneratorBaseParameters(Namespace: settings.ProjectName)) { SwaggerThemeMode = swaggerThemeMode, }; @@ -174,8 +166,8 @@ public void ScaffoldWebApplicationExtensions( var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo("Extensions", "WebApplicationExtensions.cs"), + settings.ProjectPath, + settings.ProjectPath.CombineFileInfo("Extensions", "WebApplicationExtensions.cs"), ContentWriterArea.Src, content, overrideIfExist: false); @@ -185,7 +177,7 @@ public void ScaffoldProgramFile( SwaggerThemeMode swaggerThemeMode) { var contentGenerator = new ContentGenerators.ContentGeneratorServerProgram( - new ContentGeneratorBaseParameters(Namespace: projectName)) + new ContentGeneratorBaseParameters(Namespace: settings.ProjectName)) { SwaggerThemeMode = swaggerThemeMode, }; @@ -194,8 +186,8 @@ public void ScaffoldProgramFile( var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo("Program.cs"), + settings.ProjectPath, + settings.ProjectPath.CombineFileInfo("Program.cs"), ContentWriterArea.Src, content, overrideIfExist: false); @@ -212,8 +204,8 @@ public void ScaffoldWebConfig() var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo("web.config"), + settings.ProjectPath, + settings.ProjectPath.CombineFileInfo("web.config"), ContentWriterArea.Src, content, overrideIfExist: false); @@ -221,7 +213,7 @@ public void ScaffoldWebConfig() public void GenerateConfigureSwaggerDocOptions() { - var fullNamespace = $"{projectName}"; + var fullNamespace = $"{settings.ProjectName}"; var contentGeneratorServerSwaggerDocOptionsParameters = ContentGeneratorServerSwaggerDocOptionsParameterFactory .Create( @@ -229,16 +221,16 @@ public void GenerateConfigureSwaggerDocOptions() openApiDocument.ToSwaggerDocOptionsParameters()); var contentGenerator = new ContentGeneratorServerConfigureSwaggerDocOptions( - new GeneratedCodeHeaderGenerator(new GeneratedCodeGeneratorParameters(apiGeneratorVersion)), - new GeneratedCodeAttributeGenerator(new GeneratedCodeGeneratorParameters(apiGeneratorVersion)), + new GeneratedCodeHeaderGenerator(new GeneratedCodeGeneratorParameters(settings.Version)), + new GeneratedCodeAttributeGenerator(new GeneratedCodeGeneratorParameters(settings.Version)), contentGeneratorServerSwaggerDocOptionsParameters); var content = contentGenerator.Generate(); var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo("Options", "ConfigureSwaggerDocOptions.cs"), + settings.ProjectPath, + settings.ProjectPath.CombineFileInfo("Options", "ConfigureSwaggerDocOptions.cs"), ContentWriterArea.Src, content); } @@ -264,9 +256,9 @@ public void MaintainGlobalUsings( "Microsoft.Extensions.Options", "Microsoft.OpenApi.Models", "Swashbuckle.AspNetCore.SwaggerGen", - $"{projectName}.Extensions", - $"{projectName}.Generated", - $"{projectName}.Options", + $"{settings.ProjectName}.Extensions", + $"{settings.ProjectName}.Generated", + $"{settings.ProjectName}.Options", domainProjectName, $"{domainProjectName}.Extensions", }; @@ -274,11 +266,11 @@ public void MaintainGlobalUsings( GlobalUsingsHelper.CreateOrUpdate( logger, ContentWriterArea.Src, - projectPath, + settings.ProjectPath, requiredUsings, removeNamespaceGroupSeparatorInGlobalUsings); } public void MaintainWwwResources() - => ResourcesHelper.MaintainWwwResources(projectPath); + => ResourcesHelper.MaintainWwwResources(settings.ProjectPath); } \ No newline at end of file diff --git a/src/Atc.Rest.ApiGenerator.Framework.Minimal/ProjectGenerator/ServerHostTestGenerator.cs b/src/Atc.Rest.ApiGenerator.Framework.Minimal/ProjectGenerator/ServerHostTestGenerator.cs index c0b8c662e..8a3f277db 100644 --- a/src/Atc.Rest.ApiGenerator.Framework.Minimal/ProjectGenerator/ServerHostTestGenerator.cs +++ b/src/Atc.Rest.ApiGenerator.Framework.Minimal/ProjectGenerator/ServerHostTestGenerator.cs @@ -4,54 +4,48 @@ public class ServerHostTestGenerator : IServerHostTestGenerator { private readonly ILogger logger; private readonly INugetPackageReferenceProvider nugetPackageReferenceProvider; - private readonly string projectName; private readonly string hostProjectName; private readonly string apiProjectName; private readonly string domainProjectName; - private readonly DirectoryInfo projectPath; private readonly OpenApiDocument openApiDocument; private readonly IList operationSchemaMappings; private readonly string codeGeneratorContentHeader; private readonly AttributeParameters codeGeneratorAttribute; + private readonly GeneratorSettings settings; public ServerHostTestGenerator( ILoggerFactory loggerFactory, INugetPackageReferenceProvider nugetPackageReferenceProvider, - Version apiGeneratorVersion, - string projectName, string hostProjectName, string apiProjectName, string domainProjectName, - DirectoryInfo projectPath, OpenApiDocument openApiDocument, - IList operationSchemaMappings) + IList operationSchemaMappings, + GeneratorSettings generatorSettings) { ArgumentNullException.ThrowIfNull(loggerFactory); ArgumentNullException.ThrowIfNull(nugetPackageReferenceProvider); - ArgumentNullException.ThrowIfNull(apiGeneratorVersion); - ArgumentNullException.ThrowIfNull(projectName); ArgumentNullException.ThrowIfNull(hostProjectName); ArgumentNullException.ThrowIfNull(apiProjectName); ArgumentNullException.ThrowIfNull(domainProjectName); - ArgumentNullException.ThrowIfNull(projectPath); ArgumentNullException.ThrowIfNull(openApiDocument); ArgumentNullException.ThrowIfNull(operationSchemaMappings); + ArgumentNullException.ThrowIfNull(generatorSettings); logger = loggerFactory.CreateLogger(); this.nugetPackageReferenceProvider = nugetPackageReferenceProvider; - this.projectName = projectName; this.hostProjectName = hostProjectName; this.apiProjectName = apiProjectName; this.domainProjectName = domainProjectName; - this.projectPath = projectPath; this.openApiDocument = openApiDocument; this.operationSchemaMappings = operationSchemaMappings; + settings = generatorSettings; codeGeneratorContentHeader = GeneratedCodeHeaderGeneratorFactory - .Create(apiGeneratorVersion) + .Create(settings.Version) .Generate(); codeGeneratorAttribute = AttributeParametersFactory - .CreateGeneratedCode(apiGeneratorVersion); + .CreateGeneratedCode(settings.Version); } public async Task ScaffoldProjectFile() @@ -75,7 +69,7 @@ public async Task ScaffoldProjectFile() new("TargetFramework", Attributes: null, "net8.0"), ], [ - new("DocumentationFile", Attributes: null, @$"bin\Debug\net8.0\{projectName}.xml"), + new("DocumentationFile", Attributes: null, @$"bin\Debug\net8.0\{settings.ProjectName}.xml"), new("NoWarn", Attributes: null, "$(NoWarn);1573;1591;1701;1702;1712;8618;"), ], ], @@ -111,8 +105,8 @@ public async Task ScaffoldProjectFile() var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo($"{projectName}.csproj"), + settings.ProjectPath, + settings.ProjectPath.CombineFileInfo($"{settings.ProjectName}.csproj"), ContentWriterArea.Src, content, overrideIfExist: false); @@ -182,6 +176,10 @@ public void GenerateEndpointHandlerStubs() { var apiGroupName = openApiPath.GetApiGroupName(); + var endpointsLocation = LocationFactory.CreateWithApiGroupName(apiGroupName, settings.EndpointsLocation); + + var fullNamespace = NamespaceFactory.Create(settings.ProjectName, endpointsLocation); + foreach (var openApiOperation in openApiPath.Value.Operations) { if (openApiOperation.Value.Deprecated) @@ -189,8 +187,6 @@ public void GenerateEndpointHandlerStubs() continue; } - var fullNamespace = $"{projectName}.{ContentGeneratorConstants.Endpoints}.{apiGroupName}"; - var classParameters = ContentGeneratorServerTestEndpointHandlerStubParametersFactory.Create( codeGeneratorContentHeader, fullNamespace, @@ -206,8 +202,8 @@ public void GenerateEndpointHandlerStubs() var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo(ContentGeneratorConstants.Endpoints, apiGroupName, $"{classParameters.TypeName}.cs"), + settings.ProjectPath, + FileInfoFactory.Create(settings.ProjectPath, endpointsLocation, $"{classParameters.TypeName}.cs"), ContentWriterArea.Test, content); } @@ -279,7 +275,7 @@ public void MaintainGlobalUsings( if (operationSchemaMappings.Any(apiOperation => apiOperation.Model.IsShared)) { - requiredUsings.Add($"{apiProjectName}.Contracts"); + requiredUsings.Add(NamespaceFactory.Create(apiProjectName, LocationFactory.CreateWithoutTemplateForApiGroupName(settings.ContractsLocation))); } var apiGroupNames = openApiDocument.GetApiGroupNames(); @@ -291,13 +287,13 @@ public void MaintainGlobalUsings( continue; } - requiredUsings.Add($"{apiProjectName}.Contracts.{apiGroupName}"); + requiredUsings.Add(NamespaceFactory.Create(apiProjectName, LocationFactory.CreateWithApiGroupName(apiGroupName, settings.ContractsLocation))); } GlobalUsingsHelper.CreateOrUpdate( logger, ContentWriterArea.Test, - projectPath, + settings.ProjectPath, requiredUsings, removeNamespaceGroupSeparatorInGlobalUsings); } diff --git a/src/Atc.Rest.ApiGenerator.Framework.Mvc/ContentGenerators/ContentGeneratorServerController.cs b/src/Atc.Rest.ApiGenerator.Framework.Mvc/ContentGenerators/ContentGeneratorServerController.cs index 4ad0ebe80..5fa3fa544 100644 --- a/src/Atc.Rest.ApiGenerator.Framework.Mvc/ContentGenerators/ContentGeneratorServerController.cs +++ b/src/Atc.Rest.ApiGenerator.Framework.Mvc/ContentGenerators/ContentGeneratorServerController.cs @@ -46,7 +46,7 @@ public string Generate() sb.AppendLine($"[Route(\"{parameters.RouteBase}\")]"); sb.AppendLine(codeAttributeGenerator.Generate()); - sb.AppendLine($"public sealed class {parameters.ApiGroupName}Controller : ControllerBase"); + sb.AppendLine($"{parameters.DeclarationModifier.GetDescription()} {parameters.ApiGroupName}Controller : ControllerBase"); sb.AppendLine("{"); AppendContent(sb); sb.Append('}'); diff --git a/src/Atc.Rest.ApiGenerator.Framework.Mvc/ContentGenerators/ContentGeneratorServerParameter.cs b/src/Atc.Rest.ApiGenerator.Framework.Mvc/ContentGenerators/ContentGeneratorServerParameter.cs index 0a46387b2..c46c2a2d1 100644 --- a/src/Atc.Rest.ApiGenerator.Framework.Mvc/ContentGenerators/ContentGeneratorServerParameter.cs +++ b/src/Atc.Rest.ApiGenerator.Framework.Mvc/ContentGenerators/ContentGeneratorServerParameter.cs @@ -36,7 +36,7 @@ public string Generate() } sb.AppendLine(codeAttributeGenerator.Generate()); - sb.AppendLine($"public class {parameters.ParameterName}"); + sb.AppendLine($"{parameters.DeclarationModifier.GetDescription()} {parameters.ParameterName}"); sb.AppendLine("{"); foreach (var parameter in parameters.PropertyParameters) diff --git a/src/Atc.Rest.ApiGenerator.Framework.Mvc/ContentGenerators/ContentGeneratorServerResult.cs b/src/Atc.Rest.ApiGenerator.Framework.Mvc/ContentGenerators/ContentGeneratorServerResult.cs index 0659c8625..3b386adae 100644 --- a/src/Atc.Rest.ApiGenerator.Framework.Mvc/ContentGenerators/ContentGeneratorServerResult.cs +++ b/src/Atc.Rest.ApiGenerator.Framework.Mvc/ContentGenerators/ContentGeneratorServerResult.cs @@ -38,7 +38,7 @@ public string Generate() } sb.AppendLine(codeAttributeGenerator.Generate()); - sb.AppendLine($"public class {parameters.ResultName} : {nameof(Results.ResultBase)}"); + sb.AppendLine($"{parameters.DeclarationModifier.GetDescription()} {parameters.ResultName} : {nameof(Results.ResultBase)}"); sb.AppendLine("{"); sb.AppendLine(4, $"private {parameters.ResultName}(ActionResult result) : base(result) {{ }}"); sb.AppendLine(); diff --git a/src/Atc.Rest.ApiGenerator.Framework.Mvc/Factories/ContentGeneratorServerHandlerInterfaceParametersFactory.cs b/src/Atc.Rest.ApiGenerator.Framework.Mvc/Factories/ContentGeneratorServerHandlerInterfaceParametersFactory.cs index 5db774af6..cef845b38 100644 --- a/src/Atc.Rest.ApiGenerator.Framework.Mvc/Factories/ContentGeneratorServerHandlerInterfaceParametersFactory.cs +++ b/src/Atc.Rest.ApiGenerator.Framework.Mvc/Factories/ContentGeneratorServerHandlerInterfaceParametersFactory.cs @@ -53,7 +53,7 @@ public static InterfaceParameters Create( exceptions: null, @return: null), Attributes: null, - AccessModifier: AccessModifiers.None, + DeclarationModifier: DeclarationModifiers.None, ReturnTypeName: $"{operationName}{ContentGeneratorConstants.Result}", ReturnGenericTypeName: "Task", Name: "ExecuteAsync", @@ -68,7 +68,7 @@ public static InterfaceParameters Create( @namespace, DocumentationTags: openApiOperation.ExtractDocumentationTagsForHandlerInterface(), new List { codeGeneratorAttribute }, - AccessModifiers.Public, + DeclarationModifiers.PublicInterface, InterfaceTypeName: $"I{operationName}{ContentGeneratorConstants.Handler}", InheritedInterfaceTypeName: null, Properties: null, diff --git a/src/Atc.Rest.ApiGenerator.Framework.Mvc/Factories/ContentGeneratorServerHandlerParametersFactory.cs b/src/Atc.Rest.ApiGenerator.Framework.Mvc/Factories/ContentGeneratorServerHandlerParametersFactory.cs index ce0191b29..2500e4420 100644 --- a/src/Atc.Rest.ApiGenerator.Framework.Mvc/Factories/ContentGeneratorServerHandlerParametersFactory.cs +++ b/src/Atc.Rest.ApiGenerator.Framework.Mvc/Factories/ContentGeneratorServerHandlerParametersFactory.cs @@ -43,7 +43,7 @@ public static ClassParameters Create( new( DocumentationTags: null, Attributes: null, - AccessModifier: AccessModifiers.Public, + DeclarationModifier: DeclarationModifiers.Public, ReturnTypeName: $"{operationName}{ContentGeneratorConstants.Result}", ReturnGenericTypeName: "Task", Name: "ExecuteAsync", @@ -58,7 +58,7 @@ public static ClassParameters Create( @namespace, openApiOperation.ExtractDocumentationTagsForHandler(), Attributes: null, - AccessModifiers.PublicSealedClass, + DeclarationModifiers.PublicSealedClass, ClassTypeName: $"{operationName}{ContentGeneratorConstants.Handler}", GenericTypeName: null, InheritedClassTypeName: $"I{operationName}{ContentGeneratorConstants.Handler}", diff --git a/src/Atc.Rest.ApiGenerator.Framework.Mvc/Factories/ContentGeneratorServerResultParametersFactory.cs b/src/Atc.Rest.ApiGenerator.Framework.Mvc/Factories/ContentGeneratorServerResultParametersFactory.cs index 9b7d71373..a88923598 100644 --- a/src/Atc.Rest.ApiGenerator.Framework.Mvc/Factories/ContentGeneratorServerResultParametersFactory.cs +++ b/src/Atc.Rest.ApiGenerator.Framework.Mvc/Factories/ContentGeneratorServerResultParametersFactory.cs @@ -54,6 +54,7 @@ public static ContentGeneratorServerResultParameters Create( @namespace, operationName, openApiOperation.ExtractDocumentationTagsForResult(), + DeclarationModifiers.PublicClass, $"{operationName}{ContentGeneratorConstants.Result}", methodParameters, implicitOperatorParameters); diff --git a/src/Atc.Rest.ApiGenerator.Framework.Mvc/GlobalUsings.cs b/src/Atc.Rest.ApiGenerator.Framework.Mvc/GlobalUsings.cs index a5f4885b1..d94a29403 100644 --- a/src/Atc.Rest.ApiGenerator.Framework.Mvc/GlobalUsings.cs +++ b/src/Atc.Rest.ApiGenerator.Framework.Mvc/GlobalUsings.cs @@ -16,6 +16,7 @@ global using Atc.Rest.ApiGenerator.Framework.ContentGenerators; global using Atc.Rest.ApiGenerator.Framework.ContentGenerators.Server; global using Atc.Rest.ApiGenerator.Framework.ContentGeneratorsParameters.Server; +global using Atc.Rest.ApiGenerator.Framework.Factories; global using Atc.Rest.ApiGenerator.Framework.Factories.Parameters.Server; global using Atc.Rest.ApiGenerator.Framework.Factories.Parameters.ServerClient; global using Atc.Rest.ApiGenerator.Framework.Factories.Server; @@ -23,6 +24,7 @@ global using Atc.Rest.ApiGenerator.Framework.Mvc.Factories; global using Atc.Rest.ApiGenerator.Framework.ProjectGenerator; global using Atc.Rest.ApiGenerator.Framework.Providers; +global using Atc.Rest.ApiGenerator.Framework.Settings; global using Atc.Rest.ApiGenerator.Framework.Writers; global using Atc.Rest.ApiGenerator.OpenApi.Extensions; diff --git a/src/Atc.Rest.ApiGenerator.Framework.Mvc/ProjectGenerator/ServerApiGenerator.cs b/src/Atc.Rest.ApiGenerator.Framework.Mvc/ProjectGenerator/ServerApiGenerator.cs index 121cd8f65..e0d6f125f 100644 --- a/src/Atc.Rest.ApiGenerator.Framework.Mvc/ProjectGenerator/ServerApiGenerator.cs +++ b/src/Atc.Rest.ApiGenerator.Framework.Mvc/ProjectGenerator/ServerApiGenerator.cs @@ -5,54 +5,40 @@ public class ServerApiGenerator : IServerApiGenerator { private readonly ILogger logger; private readonly INugetPackageReferenceProvider nugetPackageReferenceProvider; - private readonly Version apiGeneratorVersion; - private readonly string projectName; - private readonly DirectoryInfo projectPath; private readonly OpenApiDocument openApiDocument; private readonly IList operationSchemaMappings; private readonly string routeBase; private readonly string codeGeneratorContentHeader; private readonly AttributeParameters codeGeneratorAttribute; - private readonly bool useProblemDetailsAsDefaultResponseBody; - private readonly bool includeDeprecated; + private readonly GeneratorSettings settings; public ServerApiGenerator( ILoggerFactory loggerFactory, INugetPackageReferenceProvider nugetPackageReferenceProvider, - Version apiGeneratorVersion, - string projectName, - DirectoryInfo projectPath, OpenApiDocument openApiDocument, IList operationSchemaMappings, string routeBase, - bool useProblemDetailsAsDefaultResponseBody, - bool includeDeprecated) + GeneratorSettings generatorSettings) { ArgumentNullException.ThrowIfNull(loggerFactory); ArgumentNullException.ThrowIfNull(nugetPackageReferenceProvider); - ArgumentNullException.ThrowIfNull(apiGeneratorVersion); - ArgumentNullException.ThrowIfNull(projectName); - ArgumentNullException.ThrowIfNull(projectPath); ArgumentNullException.ThrowIfNull(openApiDocument); ArgumentNullException.ThrowIfNull(operationSchemaMappings); ArgumentNullException.ThrowIfNull(routeBase); + ArgumentNullException.ThrowIfNull(generatorSettings); logger = loggerFactory.CreateLogger(); this.nugetPackageReferenceProvider = nugetPackageReferenceProvider; - this.apiGeneratorVersion = apiGeneratorVersion; - this.projectName = projectName; - this.projectPath = projectPath; this.openApiDocument = openApiDocument; this.operationSchemaMappings = operationSchemaMappings; this.routeBase = routeBase; - this.useProblemDetailsAsDefaultResponseBody = useProblemDetailsAsDefaultResponseBody; - this.includeDeprecated = includeDeprecated; + settings = generatorSettings; codeGeneratorContentHeader = GeneratedCodeHeaderGeneratorFactory - .Create(apiGeneratorVersion) + .Create(settings.Version) .Generate(); codeGeneratorAttribute = AttributeParametersFactory - .CreateGeneratedCode(apiGeneratorVersion); + .CreateGeneratedCode(settings.Version); } public async Task ScaffoldProjectFile() @@ -80,7 +66,7 @@ public async Task ScaffoldProjectFile() new("GenerateDocumentationFile", Attributes: null, "true"), ], [ - new("DocumentationFile", Attributes: null, @$"bin\Debug\net8.0\{projectName}.xml"), + new("DocumentationFile", Attributes: null, @$"bin\Debug\net8.0\{settings.ProjectName}.xml"), new("NoWarn", Attributes: null, "$(NoWarn);1573;1591;1701;1702;1712;8618;"), ], ], @@ -117,8 +103,8 @@ public async Task ScaffoldProjectFile() var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo($"{projectName}.csproj"), + settings.ProjectPath, + FileInfoFactory.Create(settings.ProjectPath, $"{settings.ProjectName}.csproj"), ContentWriterArea.Src, content, overrideIfExist: false); @@ -128,7 +114,7 @@ public void GenerateAssemblyMarker() { var classParameters = ClassParametersFactory.Create( codeGeneratorContentHeader, - projectName, + settings.ProjectName, codeGeneratorAttribute, "ApiRegistration"); @@ -140,8 +126,8 @@ public void GenerateAssemblyMarker() var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo("ApiRegistration.cs"), + settings.ProjectPath, + FileInfoFactory.Create(settings.ProjectPath, "ApiRegistration.cs"), ContentWriterArea.Src, content); } @@ -180,11 +166,13 @@ public void GenerateParameters() { var apiGroupName = openApiPath.GetApiGroupName(); - var fullNamespace = $"{projectName}.{ContentGeneratorConstants.Contracts}.{apiGroupName}"; + var contractsLocation = LocationFactory.CreateWithApiGroupName(apiGroupName, settings.ContractsLocation); + + var fullNamespace = NamespaceFactory.Create(settings.ProjectName, contractsLocation); foreach (var openApiOperation in openApiPath.Value.Operations) { - if (openApiOperation.Value.Deprecated && !includeDeprecated) + if (openApiOperation.Value.Deprecated && !settings.IncludeDeprecatedOperations) { continue; } @@ -201,8 +189,8 @@ public void GenerateParameters() openApiPath.Value.Parameters); var contentGenerator = new ContentGenerators.ContentGeneratorServerParameter( - new GeneratedCodeHeaderGenerator(new GeneratedCodeGeneratorParameters(apiGeneratorVersion)), - new GeneratedCodeAttributeGenerator(new GeneratedCodeGeneratorParameters(apiGeneratorVersion)), + new GeneratedCodeHeaderGenerator(new GeneratedCodeGeneratorParameters(settings.Version)), + new GeneratedCodeAttributeGenerator(new GeneratedCodeGeneratorParameters(settings.Version)), new CodeDocumentationTagsGenerator(), parameterParameters); @@ -210,8 +198,8 @@ public void GenerateParameters() var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo(ContentGeneratorConstants.Contracts, apiGroupName, ContentGeneratorConstants.Parameters, $"{parameterParameters.ParameterName}.cs"), + settings.ProjectPath, + FileInfoFactory.Create(settings.ProjectPath, contractsLocation, ContentGeneratorConstants.Parameters, $"{parameterParameters.ParameterName}.cs"), ContentWriterArea.Src, content); } @@ -224,11 +212,13 @@ public void GenerateResults() { var apiGroupName = openApiPath.GetApiGroupName(); - var fullNamespace = $"{projectName}.{ContentGeneratorConstants.Contracts}.{apiGroupName}"; + var contractsLocation = LocationFactory.CreateWithApiGroupName(apiGroupName, settings.ContractsLocation); + + var fullNamespace = NamespaceFactory.Create(settings.ProjectName, contractsLocation); foreach (var openApiOperation in openApiPath.Value.Operations) { - if (openApiOperation.Value.Deprecated && !includeDeprecated) + if (openApiOperation.Value.Deprecated && !settings.IncludeDeprecatedOperations) { continue; } @@ -238,18 +228,18 @@ public void GenerateResults() openApiOperation.Value); var contentGenerator = new ContentGenerators.ContentGeneratorServerResult( - new GeneratedCodeHeaderGenerator(new GeneratedCodeGeneratorParameters(apiGeneratorVersion)), - new GeneratedCodeAttributeGenerator(new GeneratedCodeGeneratorParameters(apiGeneratorVersion)), + new GeneratedCodeHeaderGenerator(new GeneratedCodeGeneratorParameters(settings.Version)), + new GeneratedCodeAttributeGenerator(new GeneratedCodeGeneratorParameters(settings.Version)), new CodeDocumentationTagsGenerator(), resultParameters, - useProblemDetailsAsDefaultResponseBody); + settings.UseProblemDetailsAsDefaultResponseBody); var content = contentGenerator.Generate(); var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo(ContentGeneratorConstants.Contracts, apiGroupName, ContentGeneratorConstants.Results, $"{resultParameters.ResultName}.cs"), + settings.ProjectPath, + FileInfoFactory.Create(settings.ProjectPath, contractsLocation, ContentGeneratorConstants.Results, $"{resultParameters.ResultName}.cs"), ContentWriterArea.Src, content); } @@ -262,11 +252,13 @@ public void GenerateInterfaces() { var apiGroupName = openApiPath.GetApiGroupName(); - var fullNamespace = $"{projectName}.{ContentGeneratorConstants.Contracts}.{apiGroupName}"; + var contractsLocation = LocationFactory.CreateWithApiGroupName(apiGroupName, settings.ContractsLocation); + + var fullNamespace = NamespaceFactory.Create(settings.ProjectName, contractsLocation); foreach (var openApiOperation in openApiPath.Value.Operations) { - if (openApiOperation.Value.Deprecated && !includeDeprecated) + if (openApiOperation.Value.Deprecated && !settings.IncludeDeprecatedOperations) { continue; } @@ -286,8 +278,8 @@ public void GenerateInterfaces() var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo(ContentGeneratorConstants.Contracts, apiGroupName, ContentGeneratorConstants.Interfaces, $"{interfaceParameters.InterfaceTypeName}.cs"), + settings.ProjectPath, + FileInfoFactory.Create(settings.ProjectPath, contractsLocation, ContentGeneratorConstants.Interfaces, $"{interfaceParameters.InterfaceTypeName}.cs"), ContentWriterArea.Src, content); } @@ -298,28 +290,33 @@ public void GenerateEndpoints() { foreach (var apiGroupName in openApiDocument.GetApiGroupNames()) { + var endpointsLocation = LocationFactory.CreateWithoutTemplateForApiGroupName(settings.EndpointsLocation); + + var fullNamespace = NamespaceFactory.Create(settings.ProjectName, endpointsLocation); + var controllerParameters = ContentGeneratorServerEndpointParametersFactory.Create( operationSchemaMappings, - projectName, - $"{projectName}.{ContentGeneratorConstants.Endpoints}", + settings.ProjectName, + fullNamespace, apiGroupName, GetRouteByApiGroupName(apiGroupName), ContentGeneratorConstants.Controller, - openApiDocument); + openApiDocument, + settings.UsePartialClassForEndpoints); var contentGenerator = new ContentGenerators.ContentGeneratorServerController( - new GeneratedCodeHeaderGenerator(new GeneratedCodeGeneratorParameters(apiGeneratorVersion)), - new GeneratedCodeAttributeGenerator(new GeneratedCodeGeneratorParameters(apiGeneratorVersion)), + new GeneratedCodeHeaderGenerator(new GeneratedCodeGeneratorParameters(settings.Version)), + new GeneratedCodeAttributeGenerator(new GeneratedCodeGeneratorParameters(settings.Version)), new CodeDocumentationTagsGenerator(), controllerParameters, - useProblemDetailsAsDefaultResponseBody); + settings.UseProblemDetailsAsDefaultResponseBody); var content = contentGenerator.Generate(); var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo(ContentGeneratorConstants.Endpoints, $"{controllerParameters.EndpointName}.cs"), + settings.ProjectPath, + FileInfoFactory.Create(settings.ProjectPath, endpointsLocation, $"{controllerParameters.EndpointName}.cs"), ContentWriterArea.Src, content); } @@ -330,7 +327,7 @@ public void MaintainApiSpecification( => ResourcesHelper.CopyApiSpecification( apiSpecificationFile, openApiDocument, - projectPath); + settings.ProjectPath); public void MaintainGlobalUsings( bool removeNamespaceGroupSeparatorInGlobalUsings) @@ -347,35 +344,42 @@ public void MaintainGlobalUsings( // TODO: Check for any use ?? requiredUsings.Add("System.Net"); - if (openApiDocument.IsUsingRequiredForSystemTextJsonSerializationAndSystemRuntimeSerialization(includeDeprecated)) + if (openApiDocument.IsUsingRequiredForSystemTextJsonSerializationAndSystemRuntimeSerialization(settings.IncludeDeprecatedOperations)) { requiredUsings.Add("System.Runtime.Serialization"); requiredUsings.Add("System.Text.Json.Serialization"); } - if (openApiDocument.IsUsingRequiredForAsyncEnumerable(includeDeprecated)) + if (openApiDocument.IsUsingRequiredForAsyncEnumerable(settings.IncludeDeprecatedOperations)) { requiredUsings.Add("Atc.Factories"); } - if (openApiDocument.IsUsingRequiredForMicrosoftAspNetCoreAuthorization(includeDeprecated)) + if (openApiDocument.IsUsingRequiredForMicrosoftAspNetCoreAuthorization(settings.IncludeDeprecatedOperations)) { requiredUsings.Add("Microsoft.AspNetCore.Authorization"); } if (operationSchemaMappings.Any(apiOperation => apiOperation.Model.IsShared)) { - requiredUsings.Add($"{projectName}.Contracts"); + var requiredUsing = NamespaceFactory.Create( + settings.ProjectName, + LocationFactory.CreateWithoutTemplateForApiGroupName(settings.ContractsLocation)); + + if (!requiredUsings.Contains(requiredUsing, StringComparer.CurrentCulture)) + { + requiredUsings.Add(requiredUsing); + } } var apiGroupNames = openApiDocument.GetApiGroupNames(); - requiredUsings.AddRange(apiGroupNames.Select(x => $"{projectName}.Contracts.{x}")); + requiredUsings.AddRange(apiGroupNames.Select(x => NamespaceFactory.Create(settings.ProjectName, LocationFactory.CreateWithApiGroupName(x, settings.ContractsLocation)))); GlobalUsingsHelper.CreateOrUpdate( logger, ContentWriterArea.Src, - projectPath, + settings.ProjectPath, requiredUsings, removeNamespaceGroupSeparatorInGlobalUsings); } @@ -400,7 +404,9 @@ private void GenerateEnumerationType( string enumerationName, OpenApiSchema openApiSchemaEnumeration) { - var fullNamespace = $"{projectName}.{ContentGeneratorConstants.Contracts}"; + var contractsLocation = LocationFactory.CreateWithoutTemplateForApiGroupName(settings.ContractsLocation); + + var fullNamespace = NamespaceFactory.Create(settings.ProjectName, contractsLocation); var enumParameters = ContentGeneratorServerClientEnumParametersFactory.Create( codeGeneratorContentHeader, @@ -417,8 +423,8 @@ private void GenerateEnumerationType( var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo(ContentGeneratorConstants.Contracts, ContentGeneratorConstants.SpecialFolderEnumerationTypes, $"{enumerationName}.cs"), + settings.ProjectPath, + FileInfoFactory.Create(settings.ProjectPath, contractsLocation, ContentGeneratorConstants.SpecialFolderEnumerationTypes, $"{enumerationName}.cs"), ContentWriterArea.Src, content); } @@ -429,9 +435,11 @@ private void GenerateModel( string apiGroupName, bool isSharedContract) { - var fullNamespace = isSharedContract - ? $"{projectName}.{ContentGeneratorConstants.Contracts}" - : $"{projectName}.{ContentGeneratorConstants.Contracts}.{apiGroupName}"; + var contractsLocation = isSharedContract + ? LocationFactory.CreateWithoutTemplateForApiGroupName(settings.ContractsLocation) + : LocationFactory.CreateWithApiGroupName(apiGroupName, settings.ContractsLocation); + + var fullNamespace = NamespaceFactory.Create(settings.ProjectName, contractsLocation); var parameters = ContentGeneratorServerClientModelParametersFactory.CreateForClass( codeGeneratorContentHeader, @@ -439,7 +447,8 @@ private void GenerateModel( codeGeneratorAttribute, modelName, apiSchemaModel, - includeDeprecated); + settings.UsePartialClassForContracts, + settings.IncludeDeprecatedOperations); var contentGeneratorClass = new GenerateContentForClass( new CodeDocumentationTagsGenerator(), @@ -449,10 +458,10 @@ private void GenerateModel( var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, + settings.ProjectPath, isSharedContract - ? projectPath.CombineFileInfo(ContentGeneratorConstants.Contracts, ContentGeneratorConstants.SpecialFolderSharedModels, $"{modelName}.cs") - : projectPath.CombineFileInfo(ContentGeneratorConstants.Contracts, apiGroupName, ContentGeneratorConstants.Models, $"{modelName}.cs"), + ? FileInfoFactory.Create(settings.ProjectPath, contractsLocation, ContentGeneratorConstants.SpecialFolderSharedModels, $"{modelName}.cs") + : FileInfoFactory.Create(settings.ProjectPath, contractsLocation, ContentGeneratorConstants.Models, $"{modelName}.cs"), ContentWriterArea.Src, content); } diff --git a/src/Atc.Rest.ApiGenerator.Framework.Mvc/ProjectGenerator/ServerDomainGenerator.cs b/src/Atc.Rest.ApiGenerator.Framework.Mvc/ProjectGenerator/ServerDomainGenerator.cs index af8bc15c9..284189913 100644 --- a/src/Atc.Rest.ApiGenerator.Framework.Mvc/ProjectGenerator/ServerDomainGenerator.cs +++ b/src/Atc.Rest.ApiGenerator.Framework.Mvc/ProjectGenerator/ServerDomainGenerator.cs @@ -4,39 +4,33 @@ namespace Atc.Rest.ApiGenerator.Framework.Mvc.ProjectGenerator; public class ServerDomainGenerator : IServerDomainGenerator { private readonly ILogger logger; - private readonly string projectName; private readonly string apiProjectName; - private readonly DirectoryInfo projectPath; private readonly OpenApiDocument openApiDocument; private readonly string codeGeneratorContentHeader; private readonly AttributeParameters codeGeneratorAttribute; + private readonly GeneratorSettings settings; public ServerDomainGenerator( ILoggerFactory loggerFactory, - Version apiGeneratorVersion, - string projectName, string apiProjectName, - DirectoryInfo projectPath, - OpenApiDocument openApiDocument) + OpenApiDocument openApiDocument, + GeneratorSettings generatorSettings) { ArgumentNullException.ThrowIfNull(loggerFactory); - ArgumentNullException.ThrowIfNull(apiGeneratorVersion); - ArgumentNullException.ThrowIfNull(projectName); ArgumentNullException.ThrowIfNull(apiProjectName); - ArgumentNullException.ThrowIfNull(projectPath); ArgumentNullException.ThrowIfNull(openApiDocument); + ArgumentNullException.ThrowIfNull(generatorSettings); logger = loggerFactory.CreateLogger(); - this.projectName = projectName; this.apiProjectName = apiProjectName; - this.projectPath = projectPath; this.openApiDocument = openApiDocument; + settings = generatorSettings; codeGeneratorContentHeader = GeneratedCodeHeaderGeneratorFactory - .Create(apiGeneratorVersion) + .Create(settings.Version) .Generate(); codeGeneratorAttribute = AttributeParametersFactory - .CreateGeneratedCode(apiGeneratorVersion); + .CreateGeneratedCode(settings.Version); } public async Task ScaffoldProjectFile() @@ -54,7 +48,7 @@ public async Task ScaffoldProjectFile() new("GenerateDocumentationFile", Attributes: null, "true"), ], [ - new("DocumentationFile", Attributes: null, @$"bin\Debug\net8.0\{projectName}.xml"), + new("DocumentationFile", Attributes: null, @$"bin\Debug\net8.0\{settings.ProjectName}.xml"), new("NoWarn", Attributes: null, "$(NoWarn);1573;1591;1701;1702;1712;8618;"), ], ], @@ -84,8 +78,8 @@ public async Task ScaffoldProjectFile() var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo($"{projectName}.csproj"), + settings.ProjectPath, + settings.ProjectPath.CombineFileInfo($"{settings.ProjectName}.csproj"), ContentWriterArea.Src, content, overrideIfExist: false); @@ -97,10 +91,12 @@ public void ScaffoldHandlers() { var apiGroupName = urlPath.GetApiGroupName(); + var handlersLocation = LocationFactory.CreateWithApiGroupName(apiGroupName, settings.HandlersLocation); + + var fullNamespace = NamespaceFactory.Create(settings.ProjectName, handlersLocation); + foreach (var openApiOperation in urlPath.Value.Operations) { - var fullNamespace = $"{projectName}.{ContentGeneratorConstants.Handlers}.{apiGroupName}"; - var classParameters = ContentGeneratorServerHandlerParametersFactory.Create( fullNamespace, urlPath.Value, @@ -114,11 +110,8 @@ public void ScaffoldHandlers() var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo( - ContentGeneratorConstants.Handlers, - apiGroupName, - $"{classParameters.TypeName}.cs"), + settings.ProjectPath, + FileInfoFactory.Create(settings.ProjectPath, handlersLocation, $"{classParameters.TypeName}.cs"), ContentWriterArea.Src, content, overrideIfExist: false); @@ -130,7 +123,7 @@ public void GenerateAssemblyMarker() { var classParameters = ClassParametersFactory.Create( codeGeneratorContentHeader, - projectName, + settings.ProjectName, codeGeneratorAttribute, "DomainRegistration"); @@ -142,8 +135,8 @@ public void GenerateAssemblyMarker() var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo("DomainRegistration.cs"), + settings.ProjectPath, + settings.ProjectPath.CombineFileInfo("DomainRegistration.cs"), ContentWriterArea.Src, content); } @@ -161,12 +154,12 @@ public void MaintainGlobalUsings( var apiGroupNames = openApiDocument.GetApiGroupNames(); - requiredUsings.AddRange(apiGroupNames.Select(x => $"{apiProjectName}.{ContentGeneratorConstants.Contracts}.{x}")); + requiredUsings.AddRange(apiGroupNames.Select(x => NamespaceFactory.Create(apiProjectName, LocationFactory.CreateWithApiGroupName(x, settings.ContractsLocation)))); GlobalUsingsHelper.CreateOrUpdate( logger, ContentWriterArea.Src, - projectPath, + settings.ProjectPath, requiredUsings, removeNamespaceGroupSeparatorInGlobalUsings); } diff --git a/src/Atc.Rest.ApiGenerator.Framework.Mvc/ProjectGenerator/ServerHostGenerator.cs b/src/Atc.Rest.ApiGenerator.Framework.Mvc/ProjectGenerator/ServerHostGenerator.cs index 85c0b6fc4..d7a0312ee 100644 --- a/src/Atc.Rest.ApiGenerator.Framework.Mvc/ProjectGenerator/ServerHostGenerator.cs +++ b/src/Atc.Rest.ApiGenerator.Framework.Mvc/ProjectGenerator/ServerHostGenerator.cs @@ -5,40 +5,32 @@ public class ServerHostGenerator : IServerHostGenerator { private readonly ILogger logger; private readonly INugetPackageReferenceProvider nugetPackageReferenceProvider; - private readonly Version apiGeneratorVersion; - private readonly string projectName; private readonly string apiProjectName; private readonly string domainProjectName; - private readonly DirectoryInfo projectPath; private readonly OpenApiDocument openApiDocument; + private readonly GeneratorSettings settings; public ServerHostGenerator( ILoggerFactory loggerFactory, INugetPackageReferenceProvider nugetPackageReferenceProvider, - Version apiGeneratorVersion, - string projectName, string apiProjectName, string domainProjectName, - DirectoryInfo projectPath, - OpenApiDocument openApiDocument) + OpenApiDocument openApiDocument, + GeneratorSettings generatorSettings) { ArgumentNullException.ThrowIfNull(loggerFactory); ArgumentNullException.ThrowIfNull(nugetPackageReferenceProvider); - ArgumentNullException.ThrowIfNull(apiGeneratorVersion); - ArgumentNullException.ThrowIfNull(projectName); ArgumentNullException.ThrowIfNull(apiProjectName); ArgumentNullException.ThrowIfNull(domainProjectName); - ArgumentNullException.ThrowIfNull(projectPath); ArgumentNullException.ThrowIfNull(openApiDocument); + ArgumentNullException.ThrowIfNull(generatorSettings); logger = loggerFactory.CreateLogger(); this.nugetPackageReferenceProvider = nugetPackageReferenceProvider; - this.apiGeneratorVersion = apiGeneratorVersion; - this.projectName = projectName; this.apiProjectName = apiProjectName; this.domainProjectName = domainProjectName; - this.projectPath = projectPath; this.openApiDocument = openApiDocument; + settings = generatorSettings; } public bool UseRestExtended { get; set; } @@ -68,7 +60,7 @@ public async Task ScaffoldProjectFile() new("GenerateDocumentationFile", Attributes: null, "true"), ], [ - new("DocumentationFile", Attributes: null, @$"bin\Debug\net8.0\{projectName}.xml"), + new("DocumentationFile", Attributes: null, @$"bin\Debug\net8.0\{settings.ProjectName}.xml"), new("NoWarn", Attributes: null, "$(NoWarn);1573;1591;1701;1702;1712;8618;"), ], ], @@ -98,8 +90,8 @@ public async Task ScaffoldProjectFile() var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo($"{projectName}.csproj"), + settings.ProjectPath, + settings.ProjectPath.CombineFileInfo($"{settings.ProjectName}.csproj"), ContentWriterArea.Src, content, overrideIfExist: false); @@ -107,8 +99,8 @@ public async Task ScaffoldProjectFile() public void ScaffoldPropertiesLaunchSettingsFile() => ResourcesHelper.ScaffoldPropertiesLaunchSettingsFile( - projectName, - projectPath, + settings.ProjectName, + settings.ProjectPath, useExtended: true); public void ScaffoldJsonSerializerOptionsExtensions() @@ -128,14 +120,14 @@ public void ScaffoldProgramFile( SwaggerThemeMode swaggerThemeMode) { var contentGenerator = new ContentGenerators.ContentGeneratorServerProgram( - new ContentGeneratorBaseParameters(Namespace: projectName)); + new ContentGeneratorBaseParameters(Namespace: settings.ProjectName)); var content = contentGenerator.Generate(); var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo("Program.cs"), + settings.ProjectPath, + settings.ProjectPath.CombineFileInfo("Program.cs"), ContentWriterArea.Src, content, overrideIfExist: false); @@ -144,14 +136,14 @@ public void ScaffoldProgramFile( public void ScaffoldStartupFile() { var contentGenerator = new ContentGenerators.ContentGeneratorServerStartup( - new ContentGeneratorBaseParameters(Namespace: projectName)); + new ContentGeneratorBaseParameters(Namespace: settings.ProjectName)); var content = contentGenerator.Generate(); var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo("Startup.cs"), + settings.ProjectPath, + settings.ProjectPath.CombineFileInfo("Startup.cs"), ContentWriterArea.Src, content, overrideIfExist: false); @@ -165,8 +157,8 @@ public void ScaffoldWebConfig() var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo("web.config"), + settings.ProjectPath, + settings.ProjectPath.CombineFileInfo("web.config"), ContentWriterArea.Src, content, overrideIfExist: false); @@ -174,7 +166,7 @@ public void ScaffoldWebConfig() public void GenerateConfigureSwaggerDocOptions() { - var fullNamespace = $"{projectName}"; + var fullNamespace = $"{settings.ProjectName}"; var contentGeneratorServerSwaggerDocOptionsParameters = ContentGeneratorServerSwaggerDocOptionsParameterFactory .Create( @@ -182,16 +174,16 @@ public void GenerateConfigureSwaggerDocOptions() openApiDocument.ToSwaggerDocOptionsParameters()); var contentGenerator = new ContentGeneratorServerConfigureSwaggerDocOptions( - new GeneratedCodeHeaderGenerator(new GeneratedCodeGeneratorParameters(apiGeneratorVersion)), - new GeneratedCodeAttributeGenerator(new GeneratedCodeGeneratorParameters(apiGeneratorVersion)), + new GeneratedCodeHeaderGenerator(new GeneratedCodeGeneratorParameters(settings.Version)), + new GeneratedCodeAttributeGenerator(new GeneratedCodeGeneratorParameters(settings.Version)), contentGeneratorServerSwaggerDocOptionsParameters); var content = contentGenerator.Generate(); var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo("Options", "ConfigureSwaggerDocOptions.cs"), + settings.ProjectPath, + settings.ProjectPath.CombineFileInfo("Options", "ConfigureSwaggerDocOptions.cs"), ContentWriterArea.Src, content); } @@ -205,8 +197,8 @@ public void MaintainGlobalUsings( "System.Reflection", "System.Text", domainProjectName, - $"{projectName}.Generated", - $"{projectName}.Options", + $"{settings.ProjectName}.Generated", + $"{settings.ProjectName}.Options", }; if (UseRestExtended) @@ -221,11 +213,11 @@ public void MaintainGlobalUsings( GlobalUsingsHelper.CreateOrUpdate( logger, ContentWriterArea.Src, - projectPath, + settings.ProjectPath, requiredUsings, removeNamespaceGroupSeparatorInGlobalUsings); } public void MaintainWwwResources() - => ResourcesHelper.MaintainWwwResources(projectPath); + => ResourcesHelper.MaintainWwwResources(settings.ProjectPath); } \ No newline at end of file diff --git a/src/Atc.Rest.ApiGenerator.Framework.Mvc/ProjectGenerator/ServerHostTestGenerator.cs b/src/Atc.Rest.ApiGenerator.Framework.Mvc/ProjectGenerator/ServerHostTestGenerator.cs index 0afe11257..5fda32d74 100644 --- a/src/Atc.Rest.ApiGenerator.Framework.Mvc/ProjectGenerator/ServerHostTestGenerator.cs +++ b/src/Atc.Rest.ApiGenerator.Framework.Mvc/ProjectGenerator/ServerHostTestGenerator.cs @@ -6,59 +6,48 @@ public class ServerHostTestGenerator : IServerHostTestGenerator { private readonly ILogger logger; private readonly INugetPackageReferenceProvider nugetPackageReferenceProvider; - private readonly Version apiGeneratorVersion; - private readonly string projectName; private readonly string hostProjectName; private readonly string apiProjectName; private readonly string domainProjectName; - private readonly DirectoryInfo projectPath; private readonly OpenApiDocument openApiDocument; private readonly IList operationSchemaMappings; private readonly string codeGeneratorContentHeader; private readonly AttributeParameters codeGeneratorAttribute; - private readonly bool includeDeprecated; + private readonly GeneratorSettings settings; public ServerHostTestGenerator( ILoggerFactory loggerFactory, INugetPackageReferenceProvider nugetPackageReferenceProvider, - Version apiGeneratorVersion, - string projectName, string hostProjectName, string apiProjectName, string domainProjectName, - DirectoryInfo projectPath, OpenApiDocument openApiDocument, IList operationSchemaMappings, - bool includeDeprecated) + GeneratorSettings generatorSettings) { ArgumentNullException.ThrowIfNull(loggerFactory); ArgumentNullException.ThrowIfNull(nugetPackageReferenceProvider); - ArgumentNullException.ThrowIfNull(apiGeneratorVersion); - ArgumentNullException.ThrowIfNull(projectName); ArgumentNullException.ThrowIfNull(hostProjectName); ArgumentNullException.ThrowIfNull(apiProjectName); ArgumentNullException.ThrowIfNull(domainProjectName); - ArgumentNullException.ThrowIfNull(projectPath); ArgumentNullException.ThrowIfNull(openApiDocument); ArgumentNullException.ThrowIfNull(operationSchemaMappings); + ArgumentNullException.ThrowIfNull(generatorSettings); logger = loggerFactory.CreateLogger(); this.nugetPackageReferenceProvider = nugetPackageReferenceProvider; - this.apiGeneratorVersion = apiGeneratorVersion; - this.projectName = projectName; this.hostProjectName = hostProjectName; this.apiProjectName = apiProjectName; this.domainProjectName = domainProjectName; - this.projectPath = projectPath; this.openApiDocument = openApiDocument; this.operationSchemaMappings = operationSchemaMappings; - this.includeDeprecated = includeDeprecated; + settings = generatorSettings; codeGeneratorContentHeader = GeneratedCodeHeaderGeneratorFactory - .Create(apiGeneratorVersion) + .Create(settings.Version) .Generate(); codeGeneratorAttribute = AttributeParametersFactory - .CreateGeneratedCode(apiGeneratorVersion); + .CreateGeneratedCode(settings.Version); } public async Task ScaffoldProjectFile() @@ -82,7 +71,7 @@ public async Task ScaffoldProjectFile() new("TargetFramework", Attributes: null, "net8.0"), ], [ - new("DocumentationFile", Attributes: null, @$"bin\Debug\net8.0\{projectName}.xml"), + new("DocumentationFile", Attributes: null, @$"bin\Debug\net8.0\{settings.ProjectName}.xml"), new("NoWarn", Attributes: null, "$(NoWarn);1573;1591;1701;1702;1712;8618;"), ], ], @@ -118,8 +107,8 @@ public async Task ScaffoldProjectFile() var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo($"{projectName}.csproj"), + settings.ProjectPath, + settings.ProjectPath.CombineFileInfo($"{settings.ProjectName}.csproj"), ContentWriterArea.Src, content, overrideIfExist: false); @@ -133,8 +122,8 @@ public void ScaffoldAppSettingsIntegrationTestFile() var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo("appsettings.integrationtest.json"), + settings.ProjectPath, + settings.ProjectPath.CombineFileInfo("appsettings.integrationtest.json"), ContentWriterArea.Test, content, overrideIfExist: false); @@ -143,11 +132,11 @@ public void ScaffoldAppSettingsIntegrationTestFile() public void GenerateWebApiStartupFactoryFile() { var contentGeneratorServerWebApiStartupFactoryParameters = ContentGeneratorServerWebApiStartupFactoryParametersFactory.Create( - projectName); + settings.ProjectName); var contentGenerator = new ContentGenerators.ContentGeneratorServerWebApiStartupFactory( - new GeneratedCodeHeaderGenerator(new GeneratedCodeGeneratorParameters(apiGeneratorVersion)), - new GeneratedCodeAttributeGenerator(new GeneratedCodeGeneratorParameters(apiGeneratorVersion)), + new GeneratedCodeHeaderGenerator(new GeneratedCodeGeneratorParameters(settings.Version)), + new GeneratedCodeAttributeGenerator(new GeneratedCodeGeneratorParameters(settings.Version)), new CodeDocumentationTagsGenerator(), contentGeneratorServerWebApiStartupFactoryParameters); @@ -155,8 +144,8 @@ public void GenerateWebApiStartupFactoryFile() var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo("WebApiStartupFactory.cs"), + settings.ProjectPath, + settings.ProjectPath.CombineFileInfo("WebApiStartupFactory.cs"), ContentWriterArea.Test, content, overrideIfExist: false); @@ -165,16 +154,16 @@ public void GenerateWebApiStartupFactoryFile() public void GenerateWebApiControllerBaseTestFile() { var contentGenerator = new ContentGenerators.ContentGeneratorServerWebApiControllerBaseTest( - new GeneratedCodeHeaderGenerator(new GeneratedCodeGeneratorParameters(apiGeneratorVersion)), - new GeneratedCodeAttributeGenerator(new GeneratedCodeGeneratorParameters(apiGeneratorVersion)), - new ContentGeneratorBaseParameters(projectName)); + new GeneratedCodeHeaderGenerator(new GeneratedCodeGeneratorParameters(settings.Version)), + new GeneratedCodeAttributeGenerator(new GeneratedCodeGeneratorParameters(settings.Version)), + new ContentGeneratorBaseParameters(settings.ProjectName)); var content = contentGenerator.Generate(); var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo("WebApiControllerBaseTest.cs"), + settings.ProjectPath, + settings.ProjectPath.CombineFileInfo("WebApiControllerBaseTest.cs"), ContentWriterArea.Test, content, overrideIfExist: false); @@ -186,15 +175,17 @@ public void GenerateEndpointHandlerStubs() { var apiGroupName = openApiPath.GetApiGroupName(); + var endpointsLocation = LocationFactory.CreateWithApiGroupName(apiGroupName, settings.EndpointsLocation); + + var fullNamespace = NamespaceFactory.Create(settings.ProjectName, endpointsLocation); + foreach (var openApiOperation in openApiPath.Value.Operations) { - if (openApiOperation.Value.Deprecated && !includeDeprecated) + if (openApiOperation.Value.Deprecated && !settings.IncludeDeprecatedOperations) { continue; } - var fullNamespace = $"{projectName}.{ContentGeneratorConstants.Endpoints}.{apiGroupName}"; - var classParameters = ContentGeneratorServerTestEndpointHandlerStubParametersFactory.Create( codeGeneratorContentHeader, fullNamespace, @@ -210,8 +201,8 @@ public void GenerateEndpointHandlerStubs() var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo(ContentGeneratorConstants.Endpoints, apiGroupName, $"{classParameters.TypeName}.cs"), + settings.ProjectPath, + FileInfoFactory.Create(settings.ProjectPath, endpointsLocation, $"{classParameters.TypeName}.cs"), ContentWriterArea.Test, content); } @@ -224,15 +215,17 @@ public void GenerateEndpointTests() { var apiGroupName = openApiPath.GetApiGroupName(); + var endpointsLocation = LocationFactory.CreateWithApiGroupName(apiGroupName, settings.EndpointsLocation); + + var fullNamespace = NamespaceFactory.Create(settings.ProjectName, endpointsLocation); + foreach (var openApiOperation in openApiPath.Value.Operations) { - if (openApiOperation.Value.Deprecated && !includeDeprecated) + if (openApiOperation.Value.Deprecated && !settings.IncludeDeprecatedOperations) { continue; } - var fullNamespace = $"{projectName}.{ContentGeneratorConstants.Endpoints}.{apiGroupName}"; - var classParameters = ContentGeneratorServerTestEndpointTestsParametersFactory.Create( fullNamespace, openApiOperation.Value); @@ -245,8 +238,8 @@ public void GenerateEndpointTests() var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo(ContentGeneratorConstants.Endpoints, apiGroupName, $"{classParameters.TypeName}.cs"), + settings.ProjectPath, + settings.ProjectPath.CombineFileInfo(ContentGeneratorConstants.Endpoints, apiGroupName, $"{classParameters.TypeName}.cs"), ContentWriterArea.Test, content); } @@ -284,7 +277,7 @@ public void MaintainGlobalUsings( if (operationSchemaMappings.Any(apiOperation => apiOperation.Model.IsShared)) { - requiredUsings.Add($"{apiProjectName}.Contracts"); + requiredUsings.Add(NamespaceFactory.Create(apiProjectName, LocationFactory.CreateWithoutTemplateForApiGroupName(settings.ContractsLocation))); } requiredUsings.Add("AutoFixture"); @@ -299,13 +292,13 @@ public void MaintainGlobalUsings( continue; } - requiredUsings.Add($"{apiProjectName}.Contracts.{apiGroupName}"); + requiredUsings.Add(NamespaceFactory.Create(apiProjectName, LocationFactory.CreateWithApiGroupName(apiGroupName, settings.ContractsLocation))); } GlobalUsingsHelper.CreateOrUpdate( logger, ContentWriterArea.Test, - projectPath, + settings.ProjectPath, requiredUsings, removeNamespaceGroupSeparatorInGlobalUsings); } diff --git a/src/Atc.Rest.ApiGenerator.Framework/ContentGeneratorsParameters/Server/ContentGeneratorServerEndpointParameters.cs b/src/Atc.Rest.ApiGenerator.Framework/ContentGeneratorsParameters/Server/ContentGeneratorServerEndpointParameters.cs index 100455680..cde493cf2 100644 --- a/src/Atc.Rest.ApiGenerator.Framework/ContentGeneratorsParameters/Server/ContentGeneratorServerEndpointParameters.cs +++ b/src/Atc.Rest.ApiGenerator.Framework/ContentGeneratorsParameters/Server/ContentGeneratorServerEndpointParameters.cs @@ -5,6 +5,7 @@ public record ContentGeneratorServerEndpointParameters( string ApiGroupName, string RouteBase, CodeDocumentationTags DocumentationTags, + DeclarationModifiers DeclarationModifier, string EndpointName, ApiAuthorizeModel? Authorization, IList MethodParameters); \ No newline at end of file diff --git a/src/Atc.Rest.ApiGenerator.Framework/Extensions/StringExtensions.cs b/src/Atc.Rest.ApiGenerator.Framework/Extensions/StringExtensions.cs new file mode 100644 index 000000000..fa3a163b5 --- /dev/null +++ b/src/Atc.Rest.ApiGenerator.Framework/Extensions/StringExtensions.cs @@ -0,0 +1,16 @@ +namespace Atc.Rest.ApiGenerator.Framework.Extensions; + +public static class StringExtensions +{ + public static string EnsureNamespaceFormat( + this string value) + => string.IsNullOrEmpty(value) + ? value + : value + .Trim() + .Replace('\\', ' ') + .Replace('-', ' ') + .Replace('.', ' ') + .PascalCase() + .Replace(' ', '.'); +} \ No newline at end of file diff --git a/src/Atc.Rest.ApiGenerator.Framework/Factories/FileInfoFactory.cs b/src/Atc.Rest.ApiGenerator.Framework/Factories/FileInfoFactory.cs new file mode 100644 index 000000000..8878796ed --- /dev/null +++ b/src/Atc.Rest.ApiGenerator.Framework/Factories/FileInfoFactory.cs @@ -0,0 +1,34 @@ +namespace Atc.Rest.ApiGenerator.Framework.Factories; + +public static class FileInfoFactory +{ + public static FileInfo Create( + DirectoryInfo projectPath, + params string[] subParts) + { + if (subParts is null || subParts.Length == 0) + { + throw new ArgumentException("At least one path part must be provided.", nameof(subParts)); + } + + var fileName = subParts[^1]; + + if (!fileName.Contains('.', StringComparison.Ordinal)) + { + throw new ArgumentException("The file name must include a valid extension (e.g., .cs).", nameof(subParts)); + } + + var pathParts = subParts[..^1]; + + var subPath = string + .Join('.', pathParts) + .Trim() + .Replace('\\', ' ') + .Replace('-', ' ') + .Replace('.', ' ') + .PascalCase(separators: [' ', '-']) + .Replace("_shared", "_Shared", StringComparison.Ordinal) + .Replace("_enumerationTypes", "_EnumerationTypes", StringComparison.Ordinal); + return projectPath.CombineFileInfo(subPath.Split(' ').Concat([fileName]).ToArray()); + } +} \ No newline at end of file diff --git a/src/Atc.Rest.ApiGenerator.Framework/Factories/KeyValueItemFactory.cs b/src/Atc.Rest.ApiGenerator.Framework/Factories/KeyValueItemFactory.cs new file mode 100644 index 000000000..0be062495 --- /dev/null +++ b/src/Atc.Rest.ApiGenerator.Framework/Factories/KeyValueItemFactory.cs @@ -0,0 +1,8 @@ +namespace Atc.Rest.ApiGenerator.Framework.Factories; + +public static class KeyValueItemFactory +{ + public static ICollection CreateTemplateCollectionWithApiGroupName( + string value) + => new List { new(ContentGeneratorConstants.TemplateKeyForApiGroupName, value) }; +} \ No newline at end of file diff --git a/src/Atc.Rest.ApiGenerator.Framework/Factories/LocationFactory.cs b/src/Atc.Rest.ApiGenerator.Framework/Factories/LocationFactory.cs new file mode 100644 index 000000000..7b7e339f1 --- /dev/null +++ b/src/Atc.Rest.ApiGenerator.Framework/Factories/LocationFactory.cs @@ -0,0 +1,90 @@ +namespace Atc.Rest.ApiGenerator.Framework.Factories; + +public static class LocationFactory +{ + public static string CreateWithApiGroupName( + string apiGroupName, + string value) + { + var templateNames = KeyValueItemFactory.CreateTemplateCollectionWithApiGroupName(apiGroupName); + + return Create( + templateNames, + value); + } + + public static string CreateWithoutTemplateForApiGroupName( + string value) + { + if (value is null) + { + return string.Empty; + } + + if (value.Contains(ContentGeneratorConstants.TemplateForApiGroupName, StringComparison.Ordinal)) + { + value = value + .Replace(ContentGeneratorConstants.TemplateForApiGroupName, string.Empty, StringComparison.Ordinal) + .TrimStart('.') + .TrimEnd('.'); + } + + return value; + } + + public static string Create( + ICollection templateItems, + params string[] values) + { + if (values is null) + { + return string.Empty; + } + + if (templateItems is not null && templateItems.Count > 0) + { + values = AppendMissingTemplateKeysToNamespaceParts(templateItems, values); + } + + var fullNamespace = string + .Join(' ', values) + .Replace(" . ", " ", StringComparison.Ordinal); + + if (templateItems is not null && templateItems.Count > 0) + { + fullNamespace = ApplyTemplates(templateItems, fullNamespace); + } + + return fullNamespace.EnsureNamespaceFormat(); + } + + private static string[] AppendMissingTemplateKeysToNamespaceParts( + ICollection templateItems, + string[] namespaceParts) + { + var templateKeys = new List(); + foreach (var namespacePart in namespaceParts) + { + templateKeys.AddRange(namespacePart.GetTemplateKeys()); + } + + return templateItems + .Where(x => !templateKeys.Contains(x.Key, StringComparer.Ordinal)) + .Aggregate( + namespaceParts, + (current, templateItem) => current + .Append(templateItem.Value) + .ToArray()); + } + + private static string ApplyTemplates( + ICollection templateItems, + string fullNamespace) + { + return templateItems.Aggregate( + fullNamespace, + (current, templateItem) => current.ReplaceTemplateKeyWithValue( + templateItem.Key, + templateItem.Value)); + } +} \ No newline at end of file diff --git a/src/Atc.Rest.ApiGenerator.Framework/Factories/NamespaceFactory.cs b/src/Atc.Rest.ApiGenerator.Framework/Factories/NamespaceFactory.cs new file mode 100644 index 000000000..79d84f979 --- /dev/null +++ b/src/Atc.Rest.ApiGenerator.Framework/Factories/NamespaceFactory.cs @@ -0,0 +1,19 @@ +namespace Atc.Rest.ApiGenerator.Framework.Factories; + +public static class NamespaceFactory +{ + public static string Create( + params string[] values) + { + if (values is null) + { + return string.Empty; + } + + var fullNamespace = string + .Join(' ', values) + .Replace(" . ", " ", StringComparison.Ordinal); + + return fullNamespace.EnsureNamespaceFormat(); + } +} \ No newline at end of file diff --git a/src/Atc.Rest.ApiGenerator.Framework/Factories/Parameters/Client/ContentGeneratorClientEndpointInterfaceParametersFactory.cs b/src/Atc.Rest.ApiGenerator.Framework/Factories/Parameters/Client/ContentGeneratorClientEndpointInterfaceParametersFactory.cs index a960d2c5f..a88bfb261 100644 --- a/src/Atc.Rest.ApiGenerator.Framework/Factories/Parameters/Client/ContentGeneratorClientEndpointInterfaceParametersFactory.cs +++ b/src/Atc.Rest.ApiGenerator.Framework/Factories/Parameters/Client/ContentGeneratorClientEndpointInterfaceParametersFactory.cs @@ -8,7 +8,8 @@ public static InterfaceParameters Create( AttributeParameters codeGeneratorAttribute, OpenApiPathItem openApiPath, OpenApiOperation openApiOperation, - string httpClientName) + string httpClientName, + bool usePartialInterface) { var operationName = openApiOperation.GetOperationName(); @@ -67,7 +68,7 @@ public static InterfaceParameters Create( exceptions: null, @return: null), Attributes: null, - AccessModifier: AccessModifiers.None, + DeclarationModifier: DeclarationModifiers.None, ReturnTypeName: $"{operationName}{ContentGeneratorConstants.EndpointResult}", ReturnGenericTypeName: "Task", Name: "ExecuteAsync", @@ -82,7 +83,7 @@ public static InterfaceParameters Create( @namespace, DocumentationTags: openApiOperation.ExtractDocumentationTagsForEndpointInterface(), new List { codeGeneratorAttribute }, - AccessModifiers.Public, + usePartialInterface ? DeclarationModifiers.PublicPartialInterface : DeclarationModifiers.PublicInterface, InterfaceTypeName: $"I{operationName}{ContentGeneratorConstants.Endpoint}", InheritedInterfaceTypeName: null, Properties: null, diff --git a/src/Atc.Rest.ApiGenerator.Framework/Factories/Parameters/Client/ContentGeneratorClientEndpointParametersFactory.cs b/src/Atc.Rest.ApiGenerator.Framework/Factories/Parameters/Client/ContentGeneratorClientEndpointParametersFactory.cs index 0dd1d1452..9573dbf70 100644 --- a/src/Atc.Rest.ApiGenerator.Framework/Factories/Parameters/Client/ContentGeneratorClientEndpointParametersFactory.cs +++ b/src/Atc.Rest.ApiGenerator.Framework/Factories/Parameters/Client/ContentGeneratorClientEndpointParametersFactory.cs @@ -6,11 +6,13 @@ public static ContentGeneratorClientEndpointParameters Create( string projectName, string apiGroupName, string @namespace, + string contractsLocation, OpenApiPathItem openApiPath, OperationType httpMethod, OpenApiOperation openApiOperation, string httpClientName, - string urlPath) + string urlPath, + bool usePartialClass) { ArgumentNullException.ThrowIfNull(openApiPath); ArgumentNullException.ThrowIfNull(openApiOperation); @@ -21,7 +23,7 @@ public static ContentGeneratorClientEndpointParameters Create( AppendParameters(parameters, openApiOperation.Parameters); AppendParametersFromBody(parameters, openApiOperation.RequestBody); - var modelNamespace = $"{projectName}.{ContentGeneratorConstants.Contracts}.{apiGroupName}"; + var modelNamespace = NamespaceFactory.Create(projectName, contractsLocation); var operationName = openApiOperation.GetOperationName(); var controllerAuthorization = openApiPath.ExtractApiPathAuthorization(); var endpointAuthorization = openApiOperation.ExtractApiOperationAuthorization(openApiPath); @@ -37,6 +39,7 @@ public static ContentGeneratorClientEndpointParameters Create( DocumentationTags: openApiOperation.ExtractDocumentationTagsForEndpoint(), HttpClientName: httpClientName, UrlPath: urlPath, + usePartialClass ? DeclarationModifiers.PublicPartialClass : DeclarationModifiers.PublicClass, EndpointName: $"{operationName}{ContentGeneratorConstants.Endpoint}", InterfaceName: $"I{operationName}{ContentGeneratorConstants.Endpoint}", ResultName: $"{operationName}{ContentGeneratorConstants.EndpointResult}", @@ -54,6 +57,7 @@ public static ContentGeneratorClientEndpointParameters Create( DocumentationTags: openApiOperation.ExtractDocumentationTagsForEndpoint(), HttpClientName: httpClientName, UrlPath: urlPath, + usePartialClass ? DeclarationModifiers.PublicPartialClass : DeclarationModifiers.PublicClass, EndpointName: $"{operationName}{ContentGeneratorConstants.Endpoint}", InterfaceName: $"I{operationName}{ContentGeneratorConstants.Endpoint}", ResultName: $"{operationName}{ContentGeneratorConstants.EndpointResult}", diff --git a/src/Atc.Rest.ApiGenerator.Framework/Factories/Parameters/Client/ContentGeneratorClientEndpointResultInterfaceParametersFactory.cs b/src/Atc.Rest.ApiGenerator.Framework/Factories/Parameters/Client/ContentGeneratorClientEndpointResultInterfaceParametersFactory.cs index 8acba3a79..5d55ad825 100644 --- a/src/Atc.Rest.ApiGenerator.Framework/Factories/Parameters/Client/ContentGeneratorClientEndpointResultInterfaceParametersFactory.cs +++ b/src/Atc.Rest.ApiGenerator.Framework/Factories/Parameters/Client/ContentGeneratorClientEndpointResultInterfaceParametersFactory.cs @@ -6,8 +6,10 @@ public static ContentGeneratorClientEndpointResultInterfaceParameters Create( string projectName, string apiGroupName, string @namespace, + string contractsLocation, OpenApiPathItem openApiPath, - OpenApiOperation openApiOperation) + OpenApiOperation openApiOperation, + bool usePartialClass) { ArgumentNullException.ThrowIfNull(openApiPath); ArgumentNullException.ThrowIfNull(openApiOperation); @@ -18,7 +20,7 @@ public static ContentGeneratorClientEndpointResultInterfaceParameters Create( AppendParameters(parameters, openApiOperation.Parameters); AppendParametersFromBody(parameters, openApiOperation.RequestBody); - var modelNamespace = $"{projectName}.{ContentGeneratorConstants.Contracts}.{apiGroupName}"; + var modelNamespace = NamespaceFactory.Create(projectName, contractsLocation); var operationName = openApiOperation.GetOperationName(); var controllerAuthorization = openApiPath.ExtractApiPathAuthorization(); var endpointAuthorization = openApiOperation.ExtractApiOperationAuthorization(openApiPath); @@ -29,6 +31,7 @@ public static ContentGeneratorClientEndpointResultInterfaceParameters Create( Namespace: @namespace, OperationName: operationName, DocumentationTags: openApiOperation.ExtractDocumentationTagsForEndpointResultInterface(), + usePartialClass ? DeclarationModifiers.PublicPartialInterface : DeclarationModifiers.PublicInterface, InterfaceName: $"I{operationName}{ContentGeneratorConstants.EndpointResult}", InheritInterfaceName: "IEndpointResponse", HasParameterType: hasParameterType, diff --git a/src/Atc.Rest.ApiGenerator.Framework/Factories/Parameters/Client/ContentGeneratorClientEndpointResultParametersFactory.cs b/src/Atc.Rest.ApiGenerator.Framework/Factories/Parameters/Client/ContentGeneratorClientEndpointResultParametersFactory.cs index e25c85e63..3d58d197a 100644 --- a/src/Atc.Rest.ApiGenerator.Framework/Factories/Parameters/Client/ContentGeneratorClientEndpointResultParametersFactory.cs +++ b/src/Atc.Rest.ApiGenerator.Framework/Factories/Parameters/Client/ContentGeneratorClientEndpointResultParametersFactory.cs @@ -6,8 +6,10 @@ public static ContentGeneratorClientEndpointResultParameters Create( string projectName, string apiGroupName, string @namespace, + string contractsLocation, OpenApiPathItem openApiPath, - OpenApiOperation openApiOperation) + OpenApiOperation openApiOperation, + bool usePartialClass) { ArgumentNullException.ThrowIfNull(openApiPath); ArgumentNullException.ThrowIfNull(openApiOperation); @@ -18,7 +20,7 @@ public static ContentGeneratorClientEndpointResultParameters Create( AppendParameters(parameters, openApiOperation.Parameters); AppendParametersFromBody(parameters, openApiOperation.RequestBody); - var modelNamespace = $"{projectName}.{ContentGeneratorConstants.Contracts}.{apiGroupName}"; + var modelNamespace = NamespaceFactory.Create(projectName, contractsLocation); var operationName = openApiOperation.GetOperationName(); var controllerAuthorization = openApiPath.ExtractApiPathAuthorization(); var endpointAuthorization = openApiOperation.ExtractApiOperationAuthorization(openApiPath); @@ -31,6 +33,7 @@ public static ContentGeneratorClientEndpointResultParameters Create( Namespace: @namespace, OperationName: operationName, DocumentationTags: openApiOperation.ExtractDocumentationTagsForEndpointResult(), + usePartialClass ? DeclarationModifiers.PublicPartialClass : DeclarationModifiers.PublicClass, EndpointResultName: $"{operationName}{ContentGeneratorConstants.EndpointResult}", EndpointResultInterfaceName: $"I{operationName}{ContentGeneratorConstants.EndpointResult}", InheritClassName: ContentGeneratorConstants.EndpointResponse, @@ -45,6 +48,7 @@ public static ContentGeneratorClientEndpointResultParameters Create( Namespace: @namespace, OperationName: operationName, DocumentationTags: openApiOperation.ExtractDocumentationTagsForEndpointResult(), + usePartialClass ? DeclarationModifiers.PublicPartialClass : DeclarationModifiers.PublicClass, EndpointResultName: $"{operationName}{ContentGeneratorConstants.EndpointResult}", EndpointResultInterfaceName: $"I{operationName}{ContentGeneratorConstants.EndpointResult}", InheritClassName: ContentGeneratorConstants.EndpointResponse, diff --git a/src/Atc.Rest.ApiGenerator.Framework/Factories/Parameters/Client/ContentGeneratorClientParameterParametersFactory.cs b/src/Atc.Rest.ApiGenerator.Framework/Factories/Parameters/Client/ContentGeneratorClientParameterParametersFactory.cs index e13227c0e..2732baf9d 100644 --- a/src/Atc.Rest.ApiGenerator.Framework/Factories/Parameters/Client/ContentGeneratorClientParameterParametersFactory.cs +++ b/src/Atc.Rest.ApiGenerator.Framework/Factories/Parameters/Client/ContentGeneratorClientParameterParametersFactory.cs @@ -25,6 +25,7 @@ public static ContentGeneratorClientParameterParameters Create( @namespace, operationName, openApiOperation.ExtractDocumentationTagsForParameters(), + DeclarationModifiers.PublicClass, ParameterName: $"{operationName}{ContentGeneratorConstants.Parameters}", parameters); } diff --git a/src/Atc.Rest.ApiGenerator.Framework/Factories/Parameters/Server/ContentGeneratorServerParameterParametersFactory.cs b/src/Atc.Rest.ApiGenerator.Framework/Factories/Parameters/Server/ContentGeneratorServerParameterParametersFactory.cs index fcee2e1f6..01de34df2 100644 --- a/src/Atc.Rest.ApiGenerator.Framework/Factories/Parameters/Server/ContentGeneratorServerParameterParametersFactory.cs +++ b/src/Atc.Rest.ApiGenerator.Framework/Factories/Parameters/Server/ContentGeneratorServerParameterParametersFactory.cs @@ -25,6 +25,7 @@ public static ContentGeneratorServerParameterParameters CreateForClass( @namespace, operationName, openApiOperation.ExtractDocumentationTagsForParameters(), + DeclarationModifiers.PublicClass, ParameterName: $"{operationName}{ContentGeneratorConstants.Parameters}", parameters); } @@ -49,6 +50,7 @@ public static ContentGeneratorServerParameterParameters CreateForRecord( @namespace, operationName, openApiOperation.ExtractDocumentationTagsForParameters(), + DeclarationModifiers.PublicClass, ParameterName: $"{operationName}{ContentGeneratorConstants.Parameters}", SortOptionalParametersMustAppearAfterAllRequiredParameters(parameters)); } diff --git a/src/Atc.Rest.ApiGenerator.Framework/Factories/Parameters/Server/ContentGeneratorServerTestEndpointHandlerStubParametersFactory.cs b/src/Atc.Rest.ApiGenerator.Framework/Factories/Parameters/Server/ContentGeneratorServerTestEndpointHandlerStubParametersFactory.cs index e45d0f1c1..320f4032d 100644 --- a/src/Atc.Rest.ApiGenerator.Framework/Factories/Parameters/Server/ContentGeneratorServerTestEndpointHandlerStubParametersFactory.cs +++ b/src/Atc.Rest.ApiGenerator.Framework/Factories/Parameters/Server/ContentGeneratorServerTestEndpointHandlerStubParametersFactory.cs @@ -51,7 +51,7 @@ public static ClassParameters Create( new( DocumentationTags: null, Attributes: null, - AccessModifier: AccessModifiers.Public, + DeclarationModifier: DeclarationModifiers.Public, ReturnTypeName: returnTypeName, ReturnGenericTypeName: "Task", Name: "ExecuteAsync", @@ -70,7 +70,7 @@ public static ClassParameters Create( @namespace, DocumentationTags: null, new List { codeGeneratorAttribute }, - AccessModifiers.PublicClass, + DeclarationModifiers.PublicClass, ClassTypeName: $"{operationName}{ContentGeneratorConstants.HandlerStub}", GenericTypeName: null, InheritedClassTypeName: inheritedClassTypeName, diff --git a/src/Atc.Rest.ApiGenerator.Framework/Factories/Parameters/Server/ContentGeneratorServerTestEndpointTestsParametersFactory.cs b/src/Atc.Rest.ApiGenerator.Framework/Factories/Parameters/Server/ContentGeneratorServerTestEndpointTestsParametersFactory.cs index 7bd0e2207..537106896 100644 --- a/src/Atc.Rest.ApiGenerator.Framework/Factories/Parameters/Server/ContentGeneratorServerTestEndpointTestsParametersFactory.cs +++ b/src/Atc.Rest.ApiGenerator.Framework/Factories/Parameters/Server/ContentGeneratorServerTestEndpointTestsParametersFactory.cs @@ -13,7 +13,7 @@ public static ClassParameters Create( { new( DocumentationTags: null, - AccessModifiers.Public, + DeclarationModifiers.Public, GenericTypeName: null, TypeName: $"{operationName}{ContentGeneratorConstants.Tests}", InheritedClassTypeName: "base", @@ -36,7 +36,7 @@ public static ClassParameters Create( new( DocumentationTags: null, Attributes: AttributesParametersFactory.Create("Fact", "Skip = \"Change this to a real integration-test\""), - AccessModifier: AccessModifiers.Public, + DeclarationModifier: DeclarationModifiers.Public, ReturnTypeName: "void", ReturnGenericTypeName: null, Name: "Sample", @@ -55,7 +55,7 @@ public static ClassParameters Create( AttributeParametersFactory.Create("Collection", "\"Sequential-Endpoints\""), AttributeParametersFactory.Create("Trait", "Traits.Category, Traits.Categories.Integration"), }, - AccessModifiers.PublicClass, + DeclarationModifiers.PublicClass, ClassTypeName: $"{operationName}{ContentGeneratorConstants.Tests}", GenericTypeName: null, InheritedClassTypeName: "WebApiControllerBaseTest", diff --git a/src/Atc.Rest.ApiGenerator.Framework/Factories/Parameters/ServerClient/ContentGeneratorServerClientModelParametersFactory.cs b/src/Atc.Rest.ApiGenerator.Framework/Factories/Parameters/ServerClient/ContentGeneratorServerClientModelParametersFactory.cs index 016f5e321..c97c77cfe 100644 --- a/src/Atc.Rest.ApiGenerator.Framework/Factories/Parameters/ServerClient/ContentGeneratorServerClientModelParametersFactory.cs +++ b/src/Atc.Rest.ApiGenerator.Framework/Factories/Parameters/ServerClient/ContentGeneratorServerClientModelParametersFactory.cs @@ -11,7 +11,8 @@ public static ClassParameters CreateForClass( AttributeParameters codeGeneratorAttribute, string modelName, OpenApiSchema apiSchemaModel, - bool includeDeprecated) + bool usePartialClass = false, + bool includeDeprecated = false) { ArgumentNullException.ThrowIfNull(apiSchemaModel); ArgumentNullException.ThrowIfNull(modelName); @@ -31,7 +32,7 @@ public static ClassParameters CreateForClass( @namespace, documentationTags, new List { codeGeneratorAttribute }, - AccessModifiers.PublicClass, + usePartialClass ? DeclarationModifiers.PublicPartialClass : DeclarationModifiers.PublicClass, ClassTypeName: modelName, GenericTypeName: genericTypeName, InheritedClassTypeName: null, @@ -49,7 +50,8 @@ public static RecordsParameters CreateForRecord( AttributeParameters codeGeneratorAttribute, string modelName, OpenApiSchema apiSchemaModel, - bool includeDeprecated) + bool usePartialRecord = false, + bool includeDeprecated = false) { ArgumentNullException.ThrowIfNull(apiSchemaModel); @@ -62,6 +64,7 @@ public static RecordsParameters CreateForRecord( @namespace, documentationTags, new List { codeGeneratorAttribute }, + usePartialRecord ? DeclarationModifiers.PublicPartialRecord : DeclarationModifiers.PublicRecord, Parameters: recordParameters); } @@ -69,7 +72,8 @@ public static ClassParameters CreateForCustomErrorResponseModel( string codeGeneratorContentHeader, string fullNamespace, AttributeParameters codeGeneratorAttribute, - CustomErrorResponseModel customErrorResponseModel) + CustomErrorResponseModel customErrorResponseModel, + bool usePartialClass) { ArgumentNullException.ThrowIfNull(customErrorResponseModel); @@ -92,7 +96,7 @@ public static ClassParameters CreateForCustomErrorResponseModel( { CodeDocumentationTags? documentationTag = null; - var dataType = string.Empty; + string dataType; var isNullableType = false; string? defaultValue = null; @@ -114,7 +118,7 @@ public static ClassParameters CreateForCustomErrorResponseModel( new PropertyParameters( documentationTag, Attributes: null, - AccessModifiers.Public, + DeclarationModifiers.Public, GenericTypeName: null, TypeName: dataType, IsNullableType: isNullableType, @@ -135,7 +139,7 @@ public static ClassParameters CreateForCustomErrorResponseModel( fullNamespace, documentationTags, new List { codeGeneratorAttribute }, - AccessModifiers.PublicClass, + usePartialClass ? DeclarationModifiers.PublicPartialClass : DeclarationModifiers.PublicClass, ClassTypeName: customErrorResponseModel.Name.EnsureFirstCharacterToUpper(), GenericTypeName: null, InheritedClassTypeName: null, @@ -207,7 +211,7 @@ private static List ExtractPropertiesParameters( new PropertyParameters( documentationTags, Attributes: null, - AccessModifier: AccessModifiers.Public, + DeclarationModifier: DeclarationModifiers.Public, GenericTypeName: NameConstants.List, IsGenericListType: true, TypeName: childModelName, @@ -331,7 +335,7 @@ openApiParameter.Default is null && apiSchema.Key, hasAnyPropertiesAsArrayWithFormatTypeBinary, openApiParameter), - AccessModifier: AccessModifiers.Public, + DeclarationModifier: DeclarationModifiers.Public, GenericTypeName: dataTypeForList, IsGenericListType: !string.IsNullOrEmpty(dataTypeForList), TypeName: dataType, @@ -382,7 +386,7 @@ private static List ExtractRecordParameters( [ new( documentationTags, - AccessModifiers.PublicRecord, + DeclarationModifiers.PublicRecord, Name: modelName, Parameters: ExtractRecordParameterBaseParameters(apiSchemaModel, includeDeprecated)) @@ -405,7 +409,7 @@ private static List ExtractRecordParameterBaseParameter new PropertyParameters( DocumentationTags: null, Attributes: null, - AccessModifier: AccessModifiers.Public, + DeclarationModifier: DeclarationModifiers.Public, GenericTypeName: NameConstants.List, IsGenericListType: true, TypeName: childModelName, diff --git a/src/Atc.Rest.ApiGenerator.Framework/Factories/Server/ContentGeneratorServerEndpointParametersFactory.cs b/src/Atc.Rest.ApiGenerator.Framework/Factories/Server/ContentGeneratorServerEndpointParametersFactory.cs index 3c1a63dd2..27a2a8541 100644 --- a/src/Atc.Rest.ApiGenerator.Framework/Factories/Server/ContentGeneratorServerEndpointParametersFactory.cs +++ b/src/Atc.Rest.ApiGenerator.Framework/Factories/Server/ContentGeneratorServerEndpointParametersFactory.cs @@ -9,7 +9,8 @@ public static ContentGeneratorServerEndpointParameters Create( string apiGroupName, string route, string endpointSuffixName, - OpenApiDocument openApiDocument) + OpenApiDocument openApiDocument, + bool usePartialClassForEndpoints) { var modelNamespace = $"{projectName}.{ContentGeneratorConstants.Contracts}.{apiGroupName}"; var methodParameters = new List(); @@ -50,6 +51,7 @@ public static ContentGeneratorServerEndpointParameters Create( ApiGroupName: apiGroupName, route, documentationTags, + usePartialClassForEndpoints ? DeclarationModifiers.PublicPartialClass : DeclarationModifiers.PublicSealedClass, EndpointName: $"{apiGroupName}{endpointSuffixName}", controllerAuthorization, methodParameters); diff --git a/src/Atc.Rest.ApiGenerator.Framework/Factories/Server/ContentGeneratorServerHandlerParametersTestFactory.cs b/src/Atc.Rest.ApiGenerator.Framework/Factories/Server/ContentGeneratorServerHandlerParametersTestFactory.cs index 8a1932ab3..8c7109a07 100644 --- a/src/Atc.Rest.ApiGenerator.Framework/Factories/Server/ContentGeneratorServerHandlerParametersTestFactory.cs +++ b/src/Atc.Rest.ApiGenerator.Framework/Factories/Server/ContentGeneratorServerHandlerParametersTestFactory.cs @@ -13,7 +13,7 @@ public static ClassParameters CreateForCustomTest( new( DocumentationTags: null, Attributes: AttributesParametersFactory.Create("Fact", "Skip = \"Change this to a real test\""), - AccessModifier: AccessModifiers.Public, + DeclarationModifier: DeclarationModifiers.Public, ReturnTypeName: "void", ReturnGenericTypeName: null, Name: "Sample", @@ -28,7 +28,7 @@ public static ClassParameters CreateForCustomTest( @namespace, DocumentationTags: null, Attributes: null, - AccessModifiers.PublicClass, + DeclarationModifiers.PublicClass, ClassTypeName: $"{operationName}{ContentGeneratorConstants.HandlerTests}", GenericTypeName: null, InheritedClassTypeName: null, diff --git a/src/Atc.Rest.ApiGenerator.Framework/GlobalUsings.cs b/src/Atc.Rest.ApiGenerator.Framework/GlobalUsings.cs index c51dedc6c..0bd9325fd 100644 --- a/src/Atc.Rest.ApiGenerator.Framework/GlobalUsings.cs +++ b/src/Atc.Rest.ApiGenerator.Framework/GlobalUsings.cs @@ -14,6 +14,7 @@ global using Atc.CodeGeneration.CSharp.Content.Factories; global using Atc.CodeGeneration.CSharp.Content.Generators; global using Atc.CodeGeneration.CSharp.Extensions; +global using Atc.Data.Models; global using Atc.DotNet; global using Atc.Helpers; global using Atc.Rest.ApiGenerator.Contracts; @@ -24,11 +25,14 @@ global using Atc.Rest.ApiGenerator.Contracts.Models; global using Atc.Rest.ApiGenerator.Framework.ContentGenerators; global using Atc.Rest.ApiGenerator.Framework.ContentGeneratorsParameters.Server; +global using Atc.Rest.ApiGenerator.Framework.Extensions; +global using Atc.Rest.ApiGenerator.Framework.Factories; global using Atc.Rest.ApiGenerator.Framework.Factories.Parameters.ServerClient; global using Atc.Rest.ApiGenerator.Framework.Factories.Server; global using Atc.Rest.ApiGenerator.Framework.Helpers; global using Atc.Rest.ApiGenerator.Framework.Providers; global using Atc.Rest.ApiGenerator.Framework.Readers; +global using Atc.Rest.ApiGenerator.Framework.Settings; global using Atc.Rest.ApiGenerator.Framework.ToRefactor; global using Atc.Rest.ApiGenerator.Framework.Writers; global using Atc.Rest.ApiGenerator.Nuget.Clients; diff --git a/src/Atc.Rest.ApiGenerator.Framework/ProjectGenerator/ServerDomainTestGenerator.cs b/src/Atc.Rest.ApiGenerator.Framework/ProjectGenerator/ServerDomainTestGenerator.cs index 232a46e74..ab09b3c21 100644 --- a/src/Atc.Rest.ApiGenerator.Framework/ProjectGenerator/ServerDomainTestGenerator.cs +++ b/src/Atc.Rest.ApiGenerator.Framework/ProjectGenerator/ServerDomainTestGenerator.cs @@ -5,38 +5,32 @@ public class ServerDomainTestGenerator : IServerDomainTestGenerator { private readonly ILogger logger; private readonly INugetPackageReferenceProvider nugetPackageReferenceProvider; - private readonly string projectName; private readonly string apiProjectName; private readonly string domainProjectName; - private readonly DirectoryInfo projectPath; private readonly OpenApiDocument openApiDocument; + private readonly GeneratorSettings settings; public ServerDomainTestGenerator( ILoggerFactory loggerFactory, INugetPackageReferenceProvider nugetPackageReferenceProvider, - Version apiGeneratorVersion, - string projectName, string apiProjectName, string domainProjectName, - DirectoryInfo projectPath, - OpenApiDocument openApiDocument) + OpenApiDocument openApiDocument, + GeneratorSettings generatorSettings) { ArgumentNullException.ThrowIfNull(loggerFactory); ArgumentNullException.ThrowIfNull(nugetPackageReferenceProvider); - ArgumentNullException.ThrowIfNull(apiGeneratorVersion); - ArgumentNullException.ThrowIfNull(projectName); ArgumentNullException.ThrowIfNull(apiProjectName); ArgumentNullException.ThrowIfNull(domainProjectName); - ArgumentNullException.ThrowIfNull(projectPath); ArgumentNullException.ThrowIfNull(openApiDocument); + ArgumentNullException.ThrowIfNull(generatorSettings); logger = loggerFactory.CreateLogger(); this.nugetPackageReferenceProvider = nugetPackageReferenceProvider; - this.projectName = projectName; this.apiProjectName = apiProjectName; this.domainProjectName = domainProjectName; - this.projectPath = projectPath; this.openApiDocument = openApiDocument; + settings = generatorSettings; } public async Task ScaffoldProjectFile() @@ -85,8 +79,8 @@ public async Task ScaffoldProjectFile() var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo($"{projectName}.csproj"), + settings.ProjectPath, + settings.ProjectPath.CombineFileInfo($"{settings.ProjectName}.csproj"), ContentWriterArea.Src, content, overrideIfExist: false); @@ -98,10 +92,12 @@ public void ScaffoldHandlers() { var apiGroupName = urlPath.GetApiGroupName(); + var handlersLocation = LocationFactory.CreateWithApiGroupName(apiGroupName, settings.HandlersLocation); + + var fullNamespace = NamespaceFactory.Create(settings.ProjectName, handlersLocation); + foreach (var openApiOperation in urlPath.Value.Operations) { - var fullNamespace = $"{projectName}.{ContentGeneratorConstants.Handlers}.{apiGroupName}"; - var classParameters = ContentGeneratorServerHandlerParametersTestFactory.CreateForCustomTest( fullNamespace, openApiOperation.Value); @@ -114,11 +110,8 @@ public void ScaffoldHandlers() var contentWriter = new ContentWriter(logger); contentWriter.Write( - projectPath, - projectPath.CombineFileInfo( - ContentGeneratorConstants.Handlers, - apiGroupName, - $"{classParameters.TypeName}.cs"), + settings.ProjectPath, + FileInfoFactory.Create(settings.ProjectPath, handlersLocation, $"{classParameters.TypeName}.cs"), ContentWriterArea.Test, content, overrideIfExist: false); @@ -138,7 +131,7 @@ public void MaintainGlobalUsings( GlobalUsingsHelper.CreateOrUpdate( logger, ContentWriterArea.Test, - projectPath, + settings.ProjectPath, requiredUsings, removeNamespaceGroupSeparatorInGlobalUsings); } diff --git a/src/Atc.Rest.ApiGenerator.Framework/Providers/NugetPackageReferenceProvider.cs b/src/Atc.Rest.ApiGenerator.Framework/Providers/NugetPackageReferenceProvider.cs index 64e0837ee..511c7dbf1 100644 --- a/src/Atc.Rest.ApiGenerator.Framework/Providers/NugetPackageReferenceProvider.cs +++ b/src/Atc.Rest.ApiGenerator.Framework/Providers/NugetPackageReferenceProvider.cs @@ -29,7 +29,7 @@ public class NugetPackageReferenceProvider( { "Microsoft.NET.Test.Sdk", "17.10.0" }, { "NSubstitute", "5.1.0" }, { "Swashbuckle.AspNetCore", "7.0.0" }, - { "xunit", "2.8.1" }, + { "xunit", "2.9.2" }, { "xunit.runner.visualstudio", "2.8.1" }, }; diff --git a/src/Atc.Rest.ApiGenerator.Framework/Resources/wwwroot/swagger-ui/SwaggerDark.css b/src/Atc.Rest.ApiGenerator.Framework/Resources/wwwroot/swagger-ui/SwaggerDark.css index ca7314507..d2bbde8f2 100644 --- a/src/Atc.Rest.ApiGenerator.Framework/Resources/wwwroot/swagger-ui/SwaggerDark.css +++ b/src/Atc.Rest.ApiGenerator.Framework/Resources/wwwroot/swagger-ui/SwaggerDark.css @@ -66,7 +66,7 @@ button, input, select, textarea { } .swagger-ui pre { - font-family: monospace,monospace; + font-family: monospace; font-size: 1em } @@ -77,8 +77,6 @@ button, input, select, textarea { .swagger-ui abbr[title] { border-bottom: none; - text-decoration: underline; - -webkit-text-decoration: underline dotted; text-decoration: underline dotted } @@ -88,7 +86,7 @@ button, input, select, textarea { } .swagger-ui code, .swagger-ui kbd, .swagger-ui samp { - font-family: monospace,monospace; + font-family: monospace; font-size: 1em } @@ -1065,7 +1063,7 @@ button, input, select, textarea { } .swagger-ui .b--washed-yellow { - border-color: #1c1c21ceb + border-color: #1c1c21ce } .swagger-ui .b--washed-red { @@ -1603,7 +1601,6 @@ button, input, select, textarea { .swagger-ui .pre { overflow-x: auto; overflow-y: hidden; - overflow: scroll } .swagger-ui .top-0 { @@ -4940,7 +4937,7 @@ button, input, select, textarea { } .swagger-ui .washed-yellow { - color: #1c1c21ceb + color: #1c1c21ce } .swagger-ui .washed-red { @@ -5168,7 +5165,7 @@ button, input, select, textarea { } .swagger-ui .bg-washed-yellow { - background-color: #1c1c21ceb + background-color: #1c1c21ce } .swagger-ui .bg-washed-red { @@ -5512,7 +5509,7 @@ button, input, select, textarea { } .swagger-ui .hover-washed-yellow:focus, .swagger-ui .hover-washed-yellow:hover { - color: #1c1c21ceb + color: #1c1c21ce } .swagger-ui .hover-washed-red:focus, .swagger-ui .hover-washed-red:hover { @@ -5612,7 +5609,7 @@ button, input, select, textarea { } .swagger-ui .hover-bg-washed-yellow:focus, .swagger-ui .hover-bg-washed-yellow:hover { - background-color: #1c1c21ceb + background-color: #1c1c21ce } .swagger-ui .hover-bg-washed-red:focus, .swagger-ui .hover-bg-washed-red:hover { diff --git a/src/Atc.Rest.ApiGenerator.Framework/Resources/wwwroot/swagger-ui/SwaggerLight.css b/src/Atc.Rest.ApiGenerator.Framework/Resources/wwwroot/swagger-ui/SwaggerLight.css index 6779f1b06..a6d881a25 100644 --- a/src/Atc.Rest.ApiGenerator.Framework/Resources/wwwroot/swagger-ui/SwaggerLight.css +++ b/src/Atc.Rest.ApiGenerator.Framework/Resources/wwwroot/swagger-ui/SwaggerLight.css @@ -53,7 +53,7 @@ } .swagger-ui pre { - font-family: monospace,monospace; + font-family: monospace; font-size: 1em } @@ -64,8 +64,6 @@ .swagger-ui abbr[title] { border-bottom: none; - text-decoration: underline; - -webkit-text-decoration: underline dotted; text-decoration: underline dotted } @@ -75,7 +73,7 @@ } .swagger-ui code, .swagger-ui kbd, .swagger-ui samp { - font-family: monospace,monospace; + font-family: monospace; font-size: 1em } @@ -1590,7 +1588,6 @@ .swagger-ui .pre { overflow-x: auto; overflow-y: hidden; - overflow: scroll } .swagger-ui .top-0 { diff --git a/src/Atc.Rest.ApiGenerator.Framework/Resources/wwwroot/swagger-ui/SwaggerLight.css.bak b/src/Atc.Rest.ApiGenerator.Framework/Resources/wwwroot/swagger-ui/SwaggerLight.css.bak deleted file mode 100644 index f1674c184..000000000 --- a/src/Atc.Rest.ApiGenerator.Framework/Resources/wwwroot/swagger-ui/SwaggerLight.css.bak +++ /dev/null @@ -1,1346 +0,0 @@ -/* Inject clean Swagger Image */ -.topbar-wrapper .link { - background: url(swagger.png); - background-size: contain; - height: 22px; - width: 220px; - background-repeat: no-repeat; - flex: none !important; -} - -/* Remove Existing Swagger/SmartBear image */ -.topbar-wrapper .link img, .topbar-wrapper .link span { - display: none; -} - - -/* Light Mode */ -a { - color: #8c8cfa; -} - -::-webkit-scrollbar-track-piece { - background-color: rgba(247, 247, 247, .2) !important; -} - -::-webkit-scrollbar-track { - background-color: rgba(247, 247, 247, .3) !important; -} - -::-webkit-scrollbar-thumb { - background-color: rgba(247, 247, 247, .5) !important; -} - -embed[type="application/pdf"] { - filter: invert(90%); -} - -html { - background: #f7f7f7 !important; - box-sizing: border-box; - filter: contrast(100%) brightness(100%) saturate(100%); - overflow-y: scroll; -} - -body { - background: #f7f7f7; - background-color: #f7f7f7; - background-image: none !important; -} - -button, input, select, textarea { - background-color: #f7f7f7; - color: #bfbfbf; -} - -font, html { - color: #bfbfbf; -} - -.swagger-ui, .swagger-ui section h3 { - color: #b5bac9; -} - - .swagger-ui a { - background-color: transparent; - } - - .swagger-ui mark { - background-color: #664b00; - color: #bfbfbf; - } - - .swagger-ui legend { - color: inherit; - } - - .swagger-ui .debug * { - outline: #e6da99 solid 1px; - } - - .swagger-ui .debug-white * { - outline: #fff solid 1px; - } - - .swagger-ui .debug-black * { - outline: #bfbfbf solid 1px; - } - - .swagger-ui .debug-grid { - background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyhpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTExIDc5LjE1ODMyNSwgMjAxNS8wOS8xMC0wMToxMDoyMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MTRDOTY4N0U2N0VFMTFFNjg2MzZDQjkwNkQ4MjgwMEIiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MTRDOTY4N0Q2N0VFMTFFNjg2MzZDQjkwNkQ4MjgwMEIiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTUgKE1hY2ludG9zaCkiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo3NjcyQkQ3NjY3QzUxMUU2QjJCQ0UyNDA4MTAwMjE3MSIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDo3NjcyQkQ3NzY3QzUxMUU2QjJCQ0UyNDA4MTAwMjE3MSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PsBS+GMAAAAjSURBVHjaYvz//z8DLsD4gcGXiYEAGBIKGBne//fFpwAgwAB98AaF2pjlUQAAAABJRU5ErkJggg==) 0 0; - } - - .swagger-ui .debug-grid-16 { - background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyhpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTExIDc5LjE1ODMyNSwgMjAxNS8wOS8xMC0wMToxMDoyMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6ODYyRjhERDU2N0YyMTFFNjg2MzZDQjkwNkQ4MjgwMEIiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6ODYyRjhERDQ2N0YyMTFFNjg2MzZDQjkwNkQ4MjgwMEIiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTUgKE1hY2ludG9zaCkiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo3NjcyQkQ3QTY3QzUxMUU2QjJCQ0UyNDA4MTAwMjE3MSIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDo3NjcyQkQ3QjY3QzUxMUU2QjJCQ0UyNDA4MTAwMjE3MSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PvCS01IAAABMSURBVHjaYmR4/5+BFPBfAMFm/MBgx8RAGWCn1AAmSg34Q6kBDKMGMDCwICeMIemF/5QawEipAWwUhwEjMDvbAWlWkvVBwu8vQIABAEwBCph8U6c0AAAAAElFTkSuQmCC) 0 0; - } - - .swagger-ui .debug-grid-8-solid { - background: url(data:image/jpeg;base64,/9j/4QAYRXhpZgAASUkqAAgAAAAAAAAAAAAAAP/sABFEdWNreQABAAQAAAAAAAD/4QMxaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLwA8P3hwYWNrZXQgYmVnaW49Iu+7vyIgaWQ9Ilc1TTBNcENlaGlIenJlU3pOVGN6a2M5ZCI/PiA8eDp4bXBtZXRhIHhtbG5zOng9ImFkb2JlOm5zOm1ldGEvIiB4OnhtcHRrPSJBZG9iZSBYTVAgQ29yZSA1LjYtYzExMSA3OS4xNTgzMjUsIDIwMTUvMDkvMTAtMDE6MTA6MjAgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCBDQyAyMDE1IChNYWNpbnRvc2gpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOkIxMjI0OTczNjdCMzExRTZCMkJDRTI0MDgxMDAyMTcxIiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOkIxMjI0OTc0NjdCMzExRTZCMkJDRTI0MDgxMDAyMTcxIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6QjEyMjQ5NzE2N0IzMTFFNkIyQkNFMjQwODEwMDIxNzEiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6QjEyMjQ5NzI2N0IzMTFFNkIyQkNFMjQwODEwMDIxNzEiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz7/7gAOQWRvYmUAZMAAAAAB/9sAhAAbGhopHSlBJiZBQi8vL0JHPz4+P0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHAR0pKTQmND8oKD9HPzU/R0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0f/wAARCAAIAAgDASIAAhEBAxEB/8QAWQABAQAAAAAAAAAAAAAAAAAAAAYBAQEAAAAAAAAAAAAAAAAAAAIEEAEBAAMBAAAAAAAAAAAAAAABADECA0ERAAEDBQAAAAAAAAAAAAAAAAARITFBUWESIv/aAAwDAQACEQMRAD8AoOnTV1QTD7JJshP3vSM3P//Z) 0 0 #1c1c21; - } - - .swagger-ui .debug-grid-16-solid { - background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyhpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTExIDc5LjE1ODMyNSwgMjAxNS8wOS8xMC0wMToxMDoyMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTUgKE1hY2ludG9zaCkiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6NzY3MkJEN0U2N0M1MTFFNkIyQkNFMjQwODEwMDIxNzEiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6NzY3MkJEN0Y2N0M1MTFFNkIyQkNFMjQwODEwMDIxNzEiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo3NjcyQkQ3QzY3QzUxMUU2QjJCQ0UyNDA4MTAwMjE3MSIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDo3NjcyQkQ3RDY3QzUxMUU2QjJCQ0UyNDA4MTAwMjE3MSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pve6J3kAAAAzSURBVHjaYvz//z8D0UDsMwMjSRoYP5Gq4SPNbRjVMEQ1fCRDg+in/6+J1AJUxsgAEGAA31BAJMS0GYEAAAAASUVORK5CYII=) 0 0 #1c1c21; - } - - .swagger-ui .b--black { - border-color: #000; - } - - .swagger-ui .b--near-black { - border-color: #121212; - } - - .swagger-ui .b--dark-gray { - border-color: #333; - } - - .swagger-ui .b--mid-gray { - border-color: #545454; - } - - .swagger-ui .b--gray { - border-color: #787878; - } - - .swagger-ui .b--silver { - border-color: #999; - } - - .swagger-ui .b--light-silver { - border-color: #6e6e6e; - } - - .swagger-ui .b--moon-gray { - border-color: #4d4d4d; - } - - .swagger-ui .b--light-gray { - border-color: #2b2b2b; - } - - .swagger-ui .b--near-white { - border-color: #242424; - } - - .swagger-ui .b--white { - border-color: #1c1c21; - } - - .swagger-ui .b--white-90 { - border-color: rgba(28, 28, 33, .9); - } - - .swagger-ui .b--white-80 { - border-color: rgba(28, 28, 33, .8); - } - - .swagger-ui .b--white-70 { - border-color: rgba(28, 28, 33, .7); - } - - .swagger-ui .b--white-60 { - border-color: rgba(28, 28, 33, .6); - } - - .swagger-ui .b--white-50 { - border-color: rgba(28, 28, 33, .5); - } - - .swagger-ui .b--white-40 { - border-color: rgba(28, 28, 33, .4); - } - - .swagger-ui .b--white-30 { - border-color: rgba(28, 28, 33, .3); - } - - .swagger-ui .b--white-20 { - border-color: rgba(28, 28, 33, .2); - } - - .swagger-ui .b--white-10 { - border-color: rgba(28, 28, 33, .1); - } - - .swagger-ui .b--white-05 { - border-color: rgba(28, 28, 33, .05); - } - - .swagger-ui .b--white-025 { - border-color: rgba(28, 28, 33, .024); - } - - .swagger-ui .b--white-0125 { - border-color: rgba(28, 28, 33, .01); - } - - .swagger-ui .b--black-90 { - border-color: rgba(0, 0, 0, .9); - } - - .swagger-ui .b--black-80 { - border-color: rgba(0, 0, 0, .8); - } - - .swagger-ui .b--black-70 { - border-color: rgba(0, 0, 0, .7); - } - - .swagger-ui .b--black-60 { - border-color: rgba(0, 0, 0, .6); - } - - .swagger-ui .b--black-50 { - border-color: rgba(0, 0, 0, .5); - } - - .swagger-ui .b--black-40 { - border-color: rgba(0, 0, 0, .4); - } - - .swagger-ui .b--black-30 { - border-color: rgba(0, 0, 0, .3); - } - - .swagger-ui .b--black-20 { - border-color: rgba(0, 0, 0, .2); - } - - .swagger-ui .b--black-10 { - border-color: rgba(0, 0, 0, .1); - } - - .swagger-ui .b--black-05 { - border-color: rgba(0, 0, 0, .05); - } - - .swagger-ui .b--black-025 { - border-color: rgba(0, 0, 0, .024); - } - - .swagger-ui .b--black-0125 { - border-color: rgba(0, 0, 0, .01); - } - - .swagger-ui .b--dark-red { - border-color: #bc2f36; - } - - .swagger-ui .b--red { - border-color: #c83932; - } - - .swagger-ui .b--light-red { - border-color: #ab3c2b; - } - - .swagger-ui .b--orange { - border-color: #cc6e33; - } - - .swagger-ui .b--purple { - border-color: #5e2ca5; - } - - .swagger-ui .b--light-purple { - border-color: #672caf; - } - - .swagger-ui .b--dark-pink { - border-color: #ab2b81; - } - - .swagger-ui .b--hot-pink { - border-color: #c03086; - } - - .swagger-ui .b--pink { - border-color: #8f2464; - } - - .swagger-ui .b--light-pink { - border-color: #721d4d; - } - - .swagger-ui .b--dark-green { - border-color: #1c6e50; - } - - .swagger-ui .b--green { - border-color: #279b70; - } - - .swagger-ui .b--light-green { - border-color: #228762; - } - - .swagger-ui .b--navy { - border-color: #0d1d35; - } - - .swagger-ui .b--dark-blue { - border-color: #20497e; - } - - .swagger-ui .b--blue { - border-color: #4380d0; - } - - .swagger-ui .b--light-blue { - border-color: #20517e; - } - - .swagger-ui .b--lightest-blue { - border-color: #143a52; - } - - .swagger-ui .b--washed-blue { - border-color: #0c312d; - } - - .swagger-ui .b--washed-green { - border-color: #0f3d2c; - } - - .swagger-ui .b--washed-red { - border-color: #411010; - } - - .swagger-ui .b--transparent { - border-color: transparent; - } - - .swagger-ui .b--gold, .swagger-ui .b--light-yellow, .swagger-ui .b--washed-yellow, .swagger-ui .b--yellow { - border-color: #664b00; - } - - .swagger-ui .shadow-1 { - box-shadow: rgba(0, 0, 0, .2) 0 0 4px 2px; - } - - .swagger-ui .shadow-2 { - box-shadow: rgba(0, 0, 0, .2) 0 0 8px 2px; - } - - .swagger-ui .shadow-3 { - box-shadow: rgba(0, 0, 0, .2) 2px 2px 4px 2px; - } - - .swagger-ui .shadow-4 { - box-shadow: rgba(0, 0, 0, .2) 2px 2px 8px 0; - } - - .swagger-ui .shadow-5 { - box-shadow: rgba(0, 0, 0, .2) 4px 4px 8px 0; - } - -@media screen and (min-width: 30em) { - .swagger-ui .shadow-1-ns { - box-shadow: rgba(0, 0, 0, .2) 0 0 4px 2px; - } - - .swagger-ui .shadow-2-ns { - box-shadow: rgba(0, 0, 0, .2) 0 0 8px 2px; - } - - .swagger-ui .shadow-3-ns { - box-shadow: rgba(0, 0, 0, .2) 2px 2px 4px 2px; - } - - .swagger-ui .shadow-4-ns { - box-shadow: rgba(0, 0, 0, .2) 2px 2px 8px 0; - } - - .swagger-ui .shadow-5-ns { - box-shadow: rgba(0, 0, 0, .2) 4px 4px 8px 0; - } -} - -@media screen and (max-width: 60em) and (min-width: 30em) { - .swagger-ui .shadow-1-m { - box-shadow: rgba(0, 0, 0, .2) 0 0 4px 2px; - } - - .swagger-ui .shadow-2-m { - box-shadow: rgba(0, 0, 0, .2) 0 0 8px 2px; - } - - .swagger-ui .shadow-3-m { - box-shadow: rgba(0, 0, 0, .2) 2px 2px 4px 2px; - } - - .swagger-ui .shadow-4-m { - box-shadow: rgba(0, 0, 0, .2) 2px 2px 8px 0; - } - - .swagger-ui .shadow-5-m { - box-shadow: rgba(0, 0, 0, .2) 4px 4px 8px 0; - } -} - -@media screen and (min-width: 60em) { - .swagger-ui .shadow-1-l { - box-shadow: rgba(0, 0, 0, .2) 0 0 4px 2px; - } - - .swagger-ui .shadow-2-l { - box-shadow: rgba(0, 0, 0, .2) 0 0 8px 2px; - } - - .swagger-ui .shadow-3-l { - box-shadow: rgba(0, 0, 0, .2) 2px 2px 4px 2px; - } - - .swagger-ui .shadow-4-l { - box-shadow: rgba(0, 0, 0, .2) 2px 2px 8px 0; - } - - .swagger-ui .shadow-5-l { - box-shadow: rgba(0, 0, 0, .2) 4px 4px 8px 0; - } -} - -.swagger-ui .black-05 { - color: rgba(191, 191, 191, .05); -} - -.swagger-ui .bg-black-05 { - background-color: rgba(0, 0, 0, .05); -} - -.swagger-ui .black-90, .swagger-ui .hover-black-90:focus, .swagger-ui .hover-black-90:hover { - color: rgba(191, 191, 191, .9); -} - -.swagger-ui .black-80, .swagger-ui .hover-black-80:focus, .swagger-ui .hover-black-80:hover { - color: rgba(191, 191, 191, .8); -} - -.swagger-ui .black-70, .swagger-ui .hover-black-70:focus, .swagger-ui .hover-black-70:hover { - color: rgba(191, 191, 191, .7); -} - -.swagger-ui .black-60, .swagger-ui .hover-black-60:focus, .swagger-ui .hover-black-60:hover { - color: rgba(191, 191, 191, .6); -} - -.swagger-ui .black-50, .swagger-ui .hover-black-50:focus, .swagger-ui .hover-black-50:hover { - color: rgba(191, 191, 191, .5); -} - -.swagger-ui .black-40, .swagger-ui .hover-black-40:focus, .swagger-ui .hover-black-40:hover { - color: rgba(191, 191, 191, .4); -} - -.swagger-ui .black-30, .swagger-ui .hover-black-30:focus, .swagger-ui .hover-black-30:hover { - color: rgba(191, 191, 191, .3); -} - -.swagger-ui .black-20, .swagger-ui .hover-black-20:focus, .swagger-ui .hover-black-20:hover { - color: rgba(191, 191, 191, .2); -} - -.swagger-ui .black-10, .swagger-ui .hover-black-10:focus, .swagger-ui .hover-black-10:hover { - color: rgba(191, 191, 191, .1); -} - -.swagger-ui .hover-white-90:focus, .swagger-ui .hover-white-90:hover, .swagger-ui .white-90 { - color: rgba(247, 247, 247, .9); -} - -.swagger-ui .hover-white-80:focus, .swagger-ui .hover-white-80:hover, .swagger-ui .white-80 { - color: rgba(247, 247, 247, .8); -} - -.swagger-ui .hover-white-70:focus, .swagger-ui .hover-white-70:hover, .swagger-ui .white-70 { - color: rgba(247, 247, 247, .7); -} - -.swagger-ui .hover-white-60:focus, .swagger-ui .hover-white-60:hover, .swagger-ui .white-60 { - color: rgba(247, 247, 247, .6); -} - -.swagger-ui .hover-white-50:focus, .swagger-ui .hover-white-50:hover, .swagger-ui .white-50 { - color: rgba(247, 247, 247, .5); -} - -.swagger-ui .hover-white-40:focus, .swagger-ui .hover-white-40:hover, .swagger-ui .white-40 { - color: rgba(247, 247, 247, .4); -} - -.swagger-ui .hover-white-30:focus, .swagger-ui .hover-white-30:hover, .swagger-ui .white-30 { - color: rgba(247, 247, 247, .3); -} - -.swagger-ui .hover-white-20:focus, .swagger-ui .hover-white-20:hover, .swagger-ui .white-20 { - color: rgba(247, 247, 247, .2); -} - -.swagger-ui .hover-white-10:focus, .swagger-ui .hover-white-10:hover, .swagger-ui .white-10 { - color: rgba(247, 247, 247, .1); -} - -.swagger-ui .hover-moon-gray:focus, .swagger-ui .hover-moon-gray:hover, .swagger-ui .moon-gray { - color: #ccc; -} - -.swagger-ui .hover-light-gray:focus, .swagger-ui .hover-light-gray:hover, .swagger-ui .light-gray { - color: #ededed; -} - -.swagger-ui .hover-near-white:focus, .swagger-ui .hover-near-white:hover, .swagger-ui .near-white { - color: #f5f5f5; -} - -.swagger-ui .dark-red, .swagger-ui .hover-dark-red:focus, .swagger-ui .hover-dark-red:hover { - color: #e6999d; -} - -.swagger-ui .hover-red:focus, .swagger-ui .hover-red:hover, .swagger-ui .red { - color: #e69d99; -} - -.swagger-ui .hover-light-red:focus, .swagger-ui .hover-light-red:hover, .swagger-ui .light-red { - color: #e6a399; -} - -.swagger-ui .hover-orange:focus, .swagger-ui .hover-orange:hover, .swagger-ui .orange { - color: #e6b699; -} - -.swagger-ui .gold, .swagger-ui .hover-gold:focus, .swagger-ui .hover-gold:hover { - color: #e6d099; -} - -.swagger-ui .hover-yellow:focus, .swagger-ui .hover-yellow:hover, .swagger-ui .yellow { - color: #e6da99; -} - -.swagger-ui .hover-light-yellow:focus, .swagger-ui .hover-light-yellow:hover, .swagger-ui .light-yellow { - color: #ede6b6; -} - -.swagger-ui .hover-purple:focus, .swagger-ui .hover-purple:hover, .swagger-ui .purple { - color: #b99ae4; -} - -.swagger-ui .hover-light-purple:focus, .swagger-ui .hover-light-purple:hover, .swagger-ui .light-purple { - color: #bb99e6; -} - -.swagger-ui .dark-pink, .swagger-ui .hover-dark-pink:focus, .swagger-ui .hover-dark-pink:hover { - color: #e699cc; -} - -.swagger-ui .hot-pink, .swagger-ui .hover-hot-pink:focus, .swagger-ui .hover-hot-pink:hover, .swagger-ui .hover-pink:focus, .swagger-ui .hover-pink:hover, .swagger-ui .pink { - color: #e699c7; -} - -.swagger-ui .hover-light-pink:focus, .swagger-ui .hover-light-pink:hover, .swagger-ui .light-pink { - color: #edb6d5; -} - -.swagger-ui .dark-green, .swagger-ui .green, .swagger-ui .hover-dark-green:focus, .swagger-ui .hover-dark-green:hover, .swagger-ui .hover-green:focus, .swagger-ui .hover-green:hover { - color: #99e6c9; -} - -.swagger-ui .hover-light-green:focus, .swagger-ui .hover-light-green:hover, .swagger-ui .light-green { - color: #a1e8ce; -} - -.swagger-ui .hover-navy:focus, .swagger-ui .hover-navy:hover, .swagger-ui .navy { - color: #99b8e6; -} - -.swagger-ui .blue, .swagger-ui .dark-blue, .swagger-ui .hover-blue:focus, .swagger-ui .hover-blue:hover, .swagger-ui .hover-dark-blue:focus, .swagger-ui .hover-dark-blue:hover { - color: #99bae6; -} - -.swagger-ui .hover-light-blue:focus, .swagger-ui .hover-light-blue:hover, .swagger-ui .light-blue { - color: #a9cbea; -} - -.swagger-ui .hover-lightest-blue:focus, .swagger-ui .hover-lightest-blue:hover, .swagger-ui .lightest-blue { - color: #d6e9f5; -} - -.swagger-ui .hover-washed-blue:focus, .swagger-ui .hover-washed-blue:hover, .swagger-ui .washed-blue { - color: #f7fdfc; -} - -.swagger-ui .hover-washed-green:focus, .swagger-ui .hover-washed-green:hover, .swagger-ui .washed-green { - color: #ebfaf4; -} - -.swagger-ui .hover-washed-yellow:focus, .swagger-ui .hover-washed-yellow:hover, .swagger-ui .washed-yellow { - color: #fbf9ef; -} - -.swagger-ui .hover-washed-red:focus, .swagger-ui .hover-washed-red:hover, .swagger-ui .washed-red { - color: #f9e7e7; -} - -.swagger-ui .color-inherit, .swagger-ui .hover-inherit:focus, .swagger-ui .hover-inherit:hover { - color: inherit; -} - -.swagger-ui .bg-black-90, .swagger-ui .hover-bg-black-90:focus, .swagger-ui .hover-bg-black-90:hover { - background-color: rgba(0, 0, 0, .9); -} - -.swagger-ui .bg-black-80, .swagger-ui .hover-bg-black-80:focus, .swagger-ui .hover-bg-black-80:hover { - background-color: rgba(0, 0, 0, .8); -} - -.swagger-ui .bg-black-70, .swagger-ui .hover-bg-black-70:focus, .swagger-ui .hover-bg-black-70:hover { - background-color: rgba(0, 0, 0, .7); -} - -.swagger-ui .bg-black-60, .swagger-ui .hover-bg-black-60:focus, .swagger-ui .hover-bg-black-60:hover { - background-color: rgba(0, 0, 0, .6); -} - -.swagger-ui .bg-black-50, .swagger-ui .hover-bg-black-50:focus, .swagger-ui .hover-bg-black-50:hover { - background-color: rgba(0, 0, 0, .5); -} - -.swagger-ui .bg-black-40, .swagger-ui .hover-bg-black-40:focus, .swagger-ui .hover-bg-black-40:hover { - background-color: rgba(0, 0, 0, .4); -} - -.swagger-ui .bg-black-30, .swagger-ui .hover-bg-black-30:focus, .swagger-ui .hover-bg-black-30:hover { - background-color: rgba(0, 0, 0, .3); -} - -.swagger-ui .bg-black-20, .swagger-ui .hover-bg-black-20:focus, .swagger-ui .hover-bg-black-20:hover { - background-color: rgba(0, 0, 0, .2); -} - -.swagger-ui .bg-white-90, .swagger-ui .hover-bg-white-90:focus, .swagger-ui .hover-bg-white-90:hover { - background-color: rgba(28, 28, 33, .9); -} - -.swagger-ui .bg-white-80, .swagger-ui .hover-bg-white-80:focus, .swagger-ui .hover-bg-white-80:hover { - background-color: rgba(28, 28, 33, .8); -} - -.swagger-ui .bg-white-70, .swagger-ui .hover-bg-white-70:focus, .swagger-ui .hover-bg-white-70:hover { - background-color: rgba(28, 28, 33, .7); -} - -.swagger-ui .bg-white-60, .swagger-ui .hover-bg-white-60:focus, .swagger-ui .hover-bg-white-60:hover { - background-color: rgba(28, 28, 33, .6); -} - -.swagger-ui .bg-white-50, .swagger-ui .hover-bg-white-50:focus, .swagger-ui .hover-bg-white-50:hover { - background-color: rgba(28, 28, 33, .5); -} - -.swagger-ui .bg-white-40, .swagger-ui .hover-bg-white-40:focus, .swagger-ui .hover-bg-white-40:hover { - background-color: rgba(28, 28, 33, .4); -} - -.swagger-ui .bg-white-30, .swagger-ui .hover-bg-white-30:focus, .swagger-ui .hover-bg-white-30:hover { - background-color: rgba(28, 28, 33, .3); -} - -.swagger-ui .bg-white-20, .swagger-ui .hover-bg-white-20:focus, .swagger-ui .hover-bg-white-20:hover { - background-color: rgba(28, 28, 33, .2); -} - -.swagger-ui .bg-black, .swagger-ui .hover-bg-black:focus, .swagger-ui .hover-bg-black:hover { - background-color: #000; -} - -.swagger-ui .bg-near-black, .swagger-ui .hover-bg-near-black:focus, .swagger-ui .hover-bg-near-black:hover { - background-color: #121212; -} - -.swagger-ui .bg-dark-gray, .swagger-ui .hover-bg-dark-gray:focus, .swagger-ui .hover-bg-dark-gray:hover { - background-color: #333; -} - -.swagger-ui .bg-mid-gray, .swagger-ui .hover-bg-mid-gray:focus, .swagger-ui .hover-bg-mid-gray:hover { - background-color: #545454; -} - -.swagger-ui .bg-gray, .swagger-ui .hover-bg-gray:focus, .swagger-ui .hover-bg-gray:hover { - background-color: #787878; -} - -.swagger-ui .bg-silver, .swagger-ui .hover-bg-silver:focus, .swagger-ui .hover-bg-silver:hover { - background-color: #999; -} - -.swagger-ui .bg-white, .swagger-ui .hover-bg-white:focus, .swagger-ui .hover-bg-white:hover { - background-color: #1c1c21; -} - -.swagger-ui .bg-transparent, .swagger-ui .hover-bg-transparent:focus, .swagger-ui .hover-bg-transparent:hover { - background-color: transparent; -} - -.swagger-ui .bg-dark-red, .swagger-ui .hover-bg-dark-red:focus, .swagger-ui .hover-bg-dark-red:hover { - background-color: #bc2f36; -} - -.swagger-ui .bg-red, .swagger-ui .hover-bg-red:focus, .swagger-ui .hover-bg-red:hover { - background-color: #c83932; -} - -.swagger-ui .bg-light-red, .swagger-ui .hover-bg-light-red:focus, .swagger-ui .hover-bg-light-red:hover { - background-color: #ab3c2b; -} - -.swagger-ui .bg-orange, .swagger-ui .hover-bg-orange:focus, .swagger-ui .hover-bg-orange:hover { - background-color: #cc6e33; -} - -.swagger-ui .bg-gold, .swagger-ui .bg-light-yellow, .swagger-ui .bg-washed-yellow, .swagger-ui .bg-yellow, .swagger-ui .hover-bg-gold:focus, .swagger-ui .hover-bg-gold:hover, .swagger-ui .hover-bg-light-yellow:focus, .swagger-ui .hover-bg-light-yellow:hover, .swagger-ui .hover-bg-washed-yellow:focus, .swagger-ui .hover-bg-washed-yellow:hover, .swagger-ui .hover-bg-yellow:focus, .swagger-ui .hover-bg-yellow:hover { - background-color: #664b00; -} - -.swagger-ui .bg-purple, .swagger-ui .hover-bg-purple:focus, .swagger-ui .hover-bg-purple:hover { - background-color: #5e2ca5; -} - -.swagger-ui .bg-light-purple, .swagger-ui .hover-bg-light-purple:focus, .swagger-ui .hover-bg-light-purple:hover { - background-color: #672caf; -} - -.swagger-ui .bg-dark-pink, .swagger-ui .hover-bg-dark-pink:focus, .swagger-ui .hover-bg-dark-pink:hover { - background-color: #ab2b81; -} - -.swagger-ui .bg-hot-pink, .swagger-ui .hover-bg-hot-pink:focus, .swagger-ui .hover-bg-hot-pink:hover { - background-color: #c03086; -} - -.swagger-ui .bg-pink, .swagger-ui .hover-bg-pink:focus, .swagger-ui .hover-bg-pink:hover { - background-color: #8f2464; -} - -.swagger-ui .bg-light-pink, .swagger-ui .hover-bg-light-pink:focus, .swagger-ui .hover-bg-light-pink:hover { - background-color: #721d4d; -} - -.swagger-ui .bg-dark-green, .swagger-ui .hover-bg-dark-green:focus, .swagger-ui .hover-bg-dark-green:hover { - background-color: #1c6e50; -} - -.swagger-ui .bg-green, .swagger-ui .hover-bg-green:focus, .swagger-ui .hover-bg-green:hover { - background-color: #279b70; -} - -.swagger-ui .bg-light-green, .swagger-ui .hover-bg-light-green:focus, .swagger-ui .hover-bg-light-green:hover { - background-color: #228762; -} - -.swagger-ui .bg-navy, .swagger-ui .hover-bg-navy:focus, .swagger-ui .hover-bg-navy:hover { - background-color: #0d1d35; -} - -.swagger-ui .bg-dark-blue, .swagger-ui .hover-bg-dark-blue:focus, .swagger-ui .hover-bg-dark-blue:hover { - background-color: #20497e; -} - -.swagger-ui .bg-blue, .swagger-ui .hover-bg-blue:focus, .swagger-ui .hover-bg-blue:hover { - background-color: #4380d0; -} - -.swagger-ui .bg-light-blue, .swagger-ui .hover-bg-light-blue:focus, .swagger-ui .hover-bg-light-blue:hover { - background-color: #20517e; -} - -.swagger-ui .bg-lightest-blue, .swagger-ui .hover-bg-lightest-blue:focus, .swagger-ui .hover-bg-lightest-blue:hover { - background-color: #143a52; -} - -.swagger-ui .bg-washed-blue, .swagger-ui .hover-bg-washed-blue:focus, .swagger-ui .hover-bg-washed-blue:hover { - background-color: #0c312d; -} - -.swagger-ui .bg-washed-green, .swagger-ui .hover-bg-washed-green:focus, .swagger-ui .hover-bg-washed-green:hover { - background-color: #0f3d2c; -} - -.swagger-ui .bg-washed-red, .swagger-ui .hover-bg-washed-red:focus, .swagger-ui .hover-bg-washed-red:hover { - background-color: #411010; -} - -.swagger-ui .bg-inherit, .swagger-ui .hover-bg-inherit:focus, .swagger-ui .hover-bg-inherit:hover { - background-color: inherit; -} - -.swagger-ui .shadow-hover { - transition: all .5s cubic-bezier(.165, .84, .44, 1) 0s; -} - - .swagger-ui .shadow-hover::after { - border-radius: inherit; - box-shadow: rgba(0, 0, 0, .2) 0 0 16px 2px; - content: ""; - height: 100%; - left: 0; - opacity: 0; - position: absolute; - top: 0; - transition: opacity .5s cubic-bezier(.165, .84, .44, 1) 0s; - width: 100%; - z-index: -1; - } - -.swagger-ui .bg-animate, .swagger-ui .bg-animate:focus, .swagger-ui .bg-animate:hover { - transition: background-color .15s ease-in-out 0s; -} - -.swagger-ui .nested-links a { - color: #99bae6; - transition: color .15s ease-in 0s; -} - - .swagger-ui .nested-links a:focus, .swagger-ui .nested-links a:hover { - color: #a9cbea; - transition: color .15s ease-in 0s; - } - -.swagger-ui .opblock-tag { - border-bottom: 1px solid rgba(58, 64, 80, .3); - color: #b5bac9; - transition: all .2s ease 0s; -} - - .swagger-ui .opblock-tag svg, .swagger-ui section.models h4 svg { - transition: all .4s ease 0s; - } - -.swagger-ui .opblock { - border: 1px solid #000; - border-radius: 4px; - box-shadow: rgba(0, 0, 0, .19) 0 0 3px; - margin: 0 0 15px; -} - - .swagger-ui .opblock .tab-header .tab-item.active h4 span::after { - background: gray; - } - - .swagger-ui .opblock.is-open .opblock-summary { - border-bottom: 1px solid #000; - } - - .swagger-ui .opblock .opblock-section-header { - background: rgba(28, 28, 33, .8); - box-shadow: rgba(0, 0, 0, .1) 0 1px 2px; - } - - .swagger-ui .opblock .opblock-section-header > label > span { - padding: 0 10px 0 0; - } - - .swagger-ui .opblock .opblock-summary-method { - background: #000; - color: #fff; - text-shadow: rgba(0, 0, 0, .1) 0 1px 0; - } - - .swagger-ui .opblock.opblock-post { - background: rgba(72, 203, 144, .1); - border-color: #48cb90; - } - - .swagger-ui .opblock.opblock-post .opblock-summary-method, .swagger-ui .opblock.opblock-post .tab-header .tab-item.active h4 span::after { - background: #48cb90; - } - - .swagger-ui .opblock.opblock-post .opblock-summary { - border-color: #48cb90; - } - - .swagger-ui .opblock.opblock-put { - background: rgba(213, 157, 88, .1); - border-color: #d59d58; - } - - .swagger-ui .opblock.opblock-put .opblock-summary-method, .swagger-ui .opblock.opblock-put .tab-header .tab-item.active h4 span::after { - background: #d59d58; - } - - .swagger-ui .opblock.opblock-put .opblock-summary { - border-color: #d59d58; - } - - .swagger-ui .opblock.opblock-delete { - background: rgba(200, 50, 50, .1); - border-color: #c83232; - } - - .swagger-ui .opblock.opblock-delete .opblock-summary-method, .swagger-ui .opblock.opblock-delete .tab-header .tab-item.active h4 span::after { - background: #c83232; - } - - .swagger-ui .opblock.opblock-delete .opblock-summary { - border-color: #c83232; - } - - .swagger-ui .opblock.opblock-get { - background: rgba(42, 105, 167, .1); - border-color: #2a69a7; - } - - .swagger-ui .opblock.opblock-get .opblock-summary-method, .swagger-ui .opblock.opblock-get .tab-header .tab-item.active h4 span::after { - background: #2a69a7; - } - - .swagger-ui .opblock.opblock-get .opblock-summary { - border-color: #2a69a7; - } - - .swagger-ui .opblock.opblock-patch { - background: rgba(92, 214, 188, .1); - border-color: #5cd6bc; - } - - .swagger-ui .opblock.opblock-patch .opblock-summary-method, .swagger-ui .opblock.opblock-patch .tab-header .tab-item.active h4 span::after { - background: #5cd6bc; - } - - .swagger-ui .opblock.opblock-patch .opblock-summary { - border-color: #5cd6bc; - } - - .swagger-ui .opblock.opblock-head { - background: rgba(140, 63, 207, .1); - border-color: #8c3fcf; - } - - .swagger-ui .opblock.opblock-head .opblock-summary-method, .swagger-ui .opblock.opblock-head .tab-header .tab-item.active h4 span::after { - background: #8c3fcf; - } - - .swagger-ui .opblock.opblock-head .opblock-summary { - border-color: #8c3fcf; - } - - .swagger-ui .opblock.opblock-options { - background: rgba(36, 89, 143, .1); - border-color: #24598f; - } - - .swagger-ui .opblock.opblock-options .opblock-summary-method, .swagger-ui .opblock.opblock-options .tab-header .tab-item.active h4 span::after { - background: #24598f; - } - - .swagger-ui .opblock.opblock-options .opblock-summary { - border-color: #24598f; - } - - .swagger-ui .opblock.opblock-deprecated { - background: rgba(46, 46, 46, .1); - border-color: #2e2e2e; - opacity: .6; - } - - .swagger-ui .opblock.opblock-deprecated .opblock-summary-method, .swagger-ui .opblock.opblock-deprecated .tab-header .tab-item.active h4 span::after { - background: #2e2e2e; - } - - .swagger-ui .opblock.opblock-deprecated .opblock-summary { - border-color: #2e2e2e; - } - -.swagger-ui .filter .operation-filter-input { - border: 2px solid #2b3446; -} - -.swagger-ui .tab li:first-of-type::after { - background: rgba(0, 0, 0, .2); -} - -.swagger-ui .download-contents { - background: #7c8192; - color: #fff; -} - -.swagger-ui .scheme-container { - background: #1c1c21; - box-shadow: rgba(0, 0, 0, .15) 0 1px 2px 0; -} - -.swagger-ui .loading-container .loading::before { - animation: 1s linear 0s infinite normal none running rotation, .5s ease 0s 1 normal none running opacity; - border-color: rgba(0, 0, 0, .6) rgba(84, 84, 84, .1) rgba(84, 84, 84, .1); -} - -.swagger-ui .response-control-media-type--accept-controller select { - border-color: #196619; -} - -.swagger-ui .response-control-media-type__accept-message { - color: #99e699; -} - -.swagger-ui .version-pragma__message code { - background-color: #3b3b3b; -} - -.swagger-ui .btn { - background: 0 0; - border: 2px solid gray; - box-shadow: rgba(0, 0, 0, .1) 0 1px 2px; - color: #b5bac9; -} - - .swagger-ui .btn:hover { - box-shadow: rgba(0, 0, 0, .3) 0 0 5px; - } - - .swagger-ui .btn.authorize, .swagger-ui .btn.cancel { - background-color: transparent; - border-color: #a72a2a; - color: #e69999; - } - - .swagger-ui .btn.authorize { - border-color: #48cb90; - color: #9ce3c3; - } - - .swagger-ui .btn.authorize svg { - fill: #9ce3c3; - } - - .swagger-ui .btn.execute { - background-color: #5892d5; - border-color: #5892d5; - color: #fff; - } - -.swagger-ui .copy-to-clipboard { - background: #7c8192; -} - - .swagger-ui .copy-to-clipboard button { - background: url("data:image/svg+xml;charset=utf-8,") 50% center no-repeat; - } - -.swagger-ui select { - background: url("data:image/svg+xml;charset=utf-8,") right 10px center/20px no-repeat #212121; - background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIgogICB4bWxuczpjYz0iaHR0cDovL2NyZWF0aXZlY29tbW9ucy5vcmcvbnMjIgogICB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiCiAgIHhtbG5zOnN2Zz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciCiAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICAgeG1sbnM6c29kaXBvZGk9Imh0dHA6Ly9zb2RpcG9kaS5zb3VyY2Vmb3JnZS5uZXQvRFREL3NvZGlwb2RpLTAuZHRkIgogICB4bWxuczppbmtzY2FwZT0iaHR0cDovL3d3dy5pbmtzY2FwZS5vcmcvbmFtZXNwYWNlcy9pbmtzY2FwZSIKICAgaW5rc2NhcGU6dmVyc2lvbj0iMS4wICg0MDM1YTRmYjQ5LCAyMDIwLTA1LTAxKSIKICAgc29kaXBvZGk6ZG9jbmFtZT0iZG93bmxvYWQuc3ZnIgogICBpZD0ic3ZnNCIKICAgdmVyc2lvbj0iMS4xIgogICB2aWV3Qm94PSIwIDAgMjAgMjAiPgogIDxtZXRhZGF0YQogICAgIGlkPSJtZXRhZGF0YTEwIj4KICAgIDxyZGY6UkRGPgogICAgICA8Y2M6V29yawogICAgICAgICByZGY6YWJvdXQ9IiI+CiAgICAgICAgPGRjOmZvcm1hdD5pbWFnZS9zdmcreG1sPC9kYzpmb3JtYXQ+CiAgICAgICAgPGRjOnR5cGUKICAgICAgICAgICByZGY6cmVzb3VyY2U9Imh0dHA6Ly9wdXJsLm9yZy9kYy9kY21pdHlwZS9TdGlsbEltYWdlIiAvPgogICAgICA8L2NjOldvcms+CiAgICA8L3JkZjpSREY+CiAgPC9tZXRhZGF0YT4KICA8ZGVmcwogICAgIGlkPSJkZWZzOCIgLz4KICA8c29kaXBvZGk6bmFtZWR2aWV3CiAgICAgaW5rc2NhcGU6Y3VycmVudC1sYXllcj0ic3ZnNCIKICAgICBpbmtzY2FwZTp3aW5kb3ctbWF4aW1pemVkPSIxIgogICAgIGlua3NjYXBlOndpbmRvdy15PSItOSIKICAgICBpbmtzY2FwZTp3aW5kb3cteD0iLTkiCiAgICAgaW5rc2NhcGU6Y3k9IjEwIgogICAgIGlua3NjYXBlOmN4PSIxMCIKICAgICBpbmtzY2FwZTp6b29tPSI0MS41IgogICAgIHNob3dncmlkPSJmYWxzZSIKICAgICBpZD0ibmFtZWR2aWV3NiIKICAgICBpbmtzY2FwZTp3aW5kb3ctaGVpZ2h0PSIxMDAxIgogICAgIGlua3NjYXBlOndpbmRvdy13aWR0aD0iMTkyMCIKICAgICBpbmtzY2FwZTpwYWdlc2hhZG93PSIyIgogICAgIGlua3NjYXBlOnBhZ2VvcGFjaXR5PSIwIgogICAgIGd1aWRldG9sZXJhbmNlPSIxMCIKICAgICBncmlkdG9sZXJhbmNlPSIxMCIKICAgICBvYmplY3R0b2xlcmFuY2U9IjEwIgogICAgIGJvcmRlcm9wYWNpdHk9IjEiCiAgICAgYm9yZGVyY29sb3I9IiM2NjY2NjYiCiAgICAgcGFnZWNvbG9yPSIjZmZmZmZmIiAvPgogIDxwYXRoCiAgICAgc3R5bGU9ImZpbGw6I2ZmZmZmZiIKICAgICBpZD0icGF0aDIiCiAgICAgZD0iTTEzLjQxOCA3Ljg1OWEuNjk1LjY5NSAwIDAxLjk3OCAwIC42OC42OCAwIDAxMCAuOTY5bC0zLjkwOCAzLjgzYS42OTcuNjk3IDAgMDEtLjk3OSAwbC0zLjkwOC0zLjgzYS42OC42OCAwIDAxMC0uOTY5LjY5NS42OTUgMCAwMS45NzggMEwxMCAxMWwzLjQxOC0zLjE0MXoiIC8+Cjwvc3ZnPgo=) right 10px center/20px no-repeat #1c1c21; - border: 2px solid #41444e; -} - - .swagger-ui select[multiple] { - background: #212121; - } - - .swagger-ui button.invalid, .swagger-ui input[type=email].invalid, .swagger-ui input[type=file].invalid, .swagger-ui input[type=password].invalid, .swagger-ui input[type=search].invalid, .swagger-ui input[type=text].invalid, .swagger-ui select.invalid, .swagger-ui textarea.invalid { - background: #390e0e; - border-color: #c83232; - } - -.swagger-ui input[type=email], .swagger-ui input[type=file], .swagger-ui input[type=password], .swagger-ui input[type=search], .swagger-ui input[type=text], .swagger-ui textarea { - background: #1c1c21; - border: 1px solid #404040; -} - -.swagger-ui textarea { - background: rgba(28, 28, 33, .8); - color: #b5bac9; -} - -.swagger-ui input[disabled], .swagger-ui select[disabled] { - background-color: #f7f7f7; - color: #bfbfbf; -} - -.swagger-ui textarea[disabled] { - background-color: #41444e; - color: #fff; -} - -.swagger-ui select[disabled] { - border-color: #878787; -} - -.swagger-ui textarea:focus { - border: 2px solid #2a69a7; -} - -.swagger-ui .checkbox input[type=checkbox] + label > .item { - background: #303030; - box-shadow: #303030 0 0 0 2px; -} - -.swagger-ui .checkbox input[type=checkbox]:checked + label > .item { - background: url("data:image/svg+xml;charset=utf-8,") 50% center no-repeat #303030; -} - -.swagger-ui .dialog-ux .backdrop-ux { - background: rgba(0, 0, 0, .8); -} - -.swagger-ui .dialog-ux .modal-ux { - background: #1c1c21; - border: 1px solid #2e2e2e; - box-shadow: rgba(0, 0, 0, .2) 0 10px 30px 0; -} - -.swagger-ui .dialog-ux .modal-ux-header .close-modal { - background: 0 0; -} - -.swagger-ui .model .deprecated span, .swagger-ui .model .deprecated td { - color: #bfbfbf !important; -} - -.swagger-ui .model-toggle::after { - background: url("data:image/svg+xml;charset=utf-8,") 50% center/100% no-repeat; -} - -.swagger-ui .model-hint { - background: rgba(0, 0, 0, .7); - color: #ebebeb; -} - -.swagger-ui section.models { - border: 1px solid rgba(58, 64, 80, .3); -} - - .swagger-ui section.models.is-open h4 { - border-bottom: 1px solid rgba(58, 64, 80, .3); - } - - .swagger-ui section.models .model-container { - background: rgba(0, 0, 0, .05); - } - - .swagger-ui section.models .model-container:hover { - background: rgba(0, 0, 0, .07); - } - -.swagger-ui .model-box { - background: rgba(0, 0, 0, .1); -} - -.swagger-ui .prop-type { - color: #aaaad4; -} - -.swagger-ui table thead tr td, .swagger-ui table thead tr th { - border-bottom: 1px solid rgba(58, 64, 80, .2); - color: #b5bac9; -} - -.swagger-ui .parameter__name.required::after { - color: rgba(230, 153, 153, .6); -} - -.swagger-ui .topbar .download-url-wrapper .select-label { - color: #f0f0f0; -} - -.swagger-ui .topbar .download-url-wrapper .download-url-button { - background: #63a040; - color: #fff; -} - -.swagger-ui .info .title small { - background: #7c8492; -} - - .swagger-ui .info .title small.version-stamp { - background-color: #7a9b27; - } - -.swagger-ui .auth-container .errors { - background-color: #350d0d; - color: #b5bac9; -} - -.swagger-ui .errors-wrapper { - background: rgba(200, 50, 50, .1); - border: 2px solid #c83232; -} - -.swagger-ui .markdown code, .swagger-ui .renderedmarkdown code { - background: rgba(0, 0, 0, .05); - color: #c299e6; -} - -.swagger-ui .model-toggle:after { - background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIgogICB4bWxuczpjYz0iaHR0cDovL2NyZWF0aXZlY29tbW9ucy5vcmcvbnMjIgogICB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiCiAgIHhtbG5zOnN2Zz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciCiAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICAgeG1sbnM6c29kaXBvZGk9Imh0dHA6Ly9zb2RpcG9kaS5zb3VyY2Vmb3JnZS5uZXQvRFREL3NvZGlwb2RpLTAuZHRkIgogICB4bWxuczppbmtzY2FwZT0iaHR0cDovL3d3dy5pbmtzY2FwZS5vcmcvbmFtZXNwYWNlcy9pbmtzY2FwZSIKICAgaW5rc2NhcGU6dmVyc2lvbj0iMS4wICg0MDM1YTRmYjQ5LCAyMDIwLTA1LTAxKSIKICAgc29kaXBvZGk6ZG9jbmFtZT0iZG93bmxvYWQyLnN2ZyIKICAgaWQ9InN2ZzQiCiAgIHZlcnNpb249IjEuMSIKICAgaGVpZ2h0PSIyNCIKICAgd2lkdGg9IjI0Ij4KICA8bWV0YWRhdGEKICAgICBpZD0ibWV0YWRhdGExMCI+CiAgICA8cmRmOlJERj4KICAgICAgPGNjOldvcmsKICAgICAgICAgcmRmOmFib3V0PSIiPgogICAgICAgIDxkYzpmb3JtYXQ+aW1hZ2Uvc3ZnK3htbDwvZGM6Zm9ybWF0PgogICAgICAgIDxkYzp0eXBlCiAgICAgICAgICAgcmRmOnJlc291cmNlPSJodHRwOi8vcHVybC5vcmcvZGMvZGNtaXR5cGUvU3RpbGxJbWFnZSIgLz4KICAgICAgPC9jYzpXb3JrPgogICAgPC9yZGY6UkRGPgogIDwvbWV0YWRhdGE+CiAgPGRlZnMKICAgICBpZD0iZGVmczgiIC8+CiAgPHNvZGlwb2RpOm5hbWVkdmlldwogICAgIGlua3NjYXBlOmN1cnJlbnQtbGF5ZXI9InN2ZzQiCiAgICAgaW5rc2NhcGU6d2luZG93LW1heGltaXplZD0iMSIKICAgICBpbmtzY2FwZTp3aW5kb3cteT0iLTkiCiAgICAgaW5rc2NhcGU6d2luZG93LXg9Ii05IgogICAgIGlua3NjYXBlOmN5PSIxMiIKICAgICBpbmtzY2FwZTpjeD0iMTIiCiAgICAgaW5rc2NhcGU6em9vbT0iMzQuNTgzMzMzIgogICAgIHNob3dncmlkPSJmYWxzZSIKICAgICBpZD0ibmFtZWR2aWV3NiIKICAgICBpbmtzY2FwZTp3aW5kb3ctaGVpZ2h0PSIxMDAxIgogICAgIGlua3NjYXBlOndpbmRvdy13aWR0aD0iMTkyMCIKICAgICBpbmtzY2FwZTpwYWdlc2hhZG93PSIyIgogICAgIGlua3NjYXBlOnBhZ2VvcGFjaXR5PSIwIgogICAgIGd1aWRldG9sZXJhbmNlPSIxMCIKICAgICBncmlkdG9sZXJhbmNlPSIxMCIKICAgICBvYmplY3R0b2xlcmFuY2U9IjEwIgogICAgIGJvcmRlcm9wYWNpdHk9IjEiCiAgICAgYm9yZGVyY29sb3I9IiM2NjY2NjYiCiAgICAgcGFnZWNvbG9yPSIjZmZmZmZmIiAvPgogIDxwYXRoCiAgICAgc3R5bGU9ImZpbGw6I2ZmZmZmZiIKICAgICBpZD0icGF0aDIiCiAgICAgZD0iTTEwIDZMOC41OSA3LjQxIDEzLjE3IDEybC00LjU4IDQuNTlMMTAgMThsNi02eiIgLz4KPC9zdmc+Cg==) 50% no-repeat; -} - -.swagger-ui .expand-operation svg, .swagger-ui section.models h4 svg { - fill: #fff; -} - -::-webkit-scrollbar-track { - background-color: #646464 !important; -} - -::-webkit-scrollbar-thumb { - background-color: #242424 !important; - border: 2px solid #3e4346 !important; -} - -::-webkit-scrollbar-button:vertical:start:decrement { - background: linear-gradient(130deg, #696969 40%, rgba(255, 0, 0, 0) 41%), linear-gradient(230deg, #696969 40%, transparent 41%), linear-gradient(0deg, #696969 40%, transparent 31%); - background-color: #b6b6b6; -} - -::-webkit-scrollbar-button:vertical:end:increment { - background: linear-gradient(310deg, #696969 40%, transparent 41%), linear-gradient(50deg, #696969 40%, transparent 41%), linear-gradient(180deg, #696969 40%, transparent 31%); - background-color: #b6b6b6; -} - -::-webkit-scrollbar-button:horizontal:end:increment { - background: linear-gradient(210deg, #696969 40%, transparent 41%), linear-gradient(330deg, #696969 40%, transparent 41%), linear-gradient(90deg, #696969 30%, transparent 31%); - background-color: #b6b6b6; -} - -::-webkit-scrollbar-button:horizontal:start:decrement { - background: linear-gradient(30deg, #696969 40%, transparent 41%), linear-gradient(150deg, #696969 40%, transparent 41%), linear-gradient(270deg, #696969 30%, transparent 31%); - background-color: #b6b6b6; -} - -::-webkit-scrollbar-button, ::-webkit-scrollbar-track-piece { - background-color: #3e4346 !important; -} - -.swagger-ui .black, .swagger-ui .checkbox, .swagger-ui .dark-gray, .swagger-ui .download-url-wrapper .loading, .swagger-ui .errors-wrapper .errors small, .swagger-ui .fallback, .swagger-ui .filter .loading, .swagger-ui .gray, .swagger-ui .hover-black:focus, .swagger-ui .hover-black:hover, .swagger-ui .hover-dark-gray:focus, .swagger-ui .hover-dark-gray:hover, .swagger-ui .hover-gray:focus, .swagger-ui .hover-gray:hover, .swagger-ui .hover-light-silver:focus, .swagger-ui .hover-light-silver:hover, .swagger-ui .hover-mid-gray:focus, .swagger-ui .hover-mid-gray:hover, .swagger-ui .hover-near-black:focus, .swagger-ui .hover-near-black:hover, .swagger-ui .hover-silver:focus, .swagger-ui .hover-silver:hover, .swagger-ui .light-silver, .swagger-ui .markdown pre, .swagger-ui .mid-gray, .swagger-ui .model .property, .swagger-ui .model .property.primitive, .swagger-ui .model-title, .swagger-ui .near-black, .swagger-ui .parameter__extension, .swagger-ui .parameter__in, .swagger-ui .prop-format, .swagger-ui .renderedmarkdown pre, .swagger-ui .response-col_links .response-undocumented, .swagger-ui .response-col_status .response-undocumented, .swagger-ui .silver, .swagger-ui section.models h4, .swagger-ui section.models h5, .swagger-ui span.token-not-formatted, .swagger-ui span.token-string, .swagger-ui table.headers .header-example, .swagger-ui table.model tr.description, .swagger-ui table.model tr.extension { - color: #bfbfbf; -} - -.swagger-ui .hover-white:focus, .swagger-ui .hover-white:hover, .swagger-ui .info .title small pre, .swagger-ui .topbar a, .swagger-ui .white { - color: #fff; -} - -.swagger-ui .bg-black-10, .swagger-ui .hover-bg-black-10:focus, .swagger-ui .hover-bg-black-10:hover, .swagger-ui .stripe-dark:nth-child(2n + 1) { - background-color: rgba(0, 0, 0, .1); -} - -.swagger-ui .bg-white-10, .swagger-ui .hover-bg-white-10:focus, .swagger-ui .hover-bg-white-10:hover, .swagger-ui .stripe-light:nth-child(2n + 1) { - background-color: rgba(28, 28, 33, .1); -} - -.swagger-ui .bg-light-silver, .swagger-ui .hover-bg-light-silver:focus, .swagger-ui .hover-bg-light-silver:hover, .swagger-ui .striped--light-silver:nth-child(2n + 1) { - background-color: #6e6e6e; -} - -.swagger-ui .bg-moon-gray, .swagger-ui .hover-bg-moon-gray:focus, .swagger-ui .hover-bg-moon-gray:hover, .swagger-ui .striped--moon-gray:nth-child(2n + 1) { - background-color: #4d4d4d; -} - -.swagger-ui .bg-light-gray, .swagger-ui .hover-bg-light-gray:focus, .swagger-ui .hover-bg-light-gray:hover, .swagger-ui .striped--light-gray:nth-child(2n + 1) { - background-color: #2b2b2b; -} - -.swagger-ui .bg-near-white, .swagger-ui .hover-bg-near-white:focus, .swagger-ui .hover-bg-near-white:hover, .swagger-ui .striped--near-white:nth-child(2n + 1) { - background-color: #242424; -} - -.swagger-ui .opblock-tag:hover, .swagger-ui section.models h4:hover { - background: rgba(0, 0, 0, .02); -} - -.swagger-ui .checkbox p, .swagger-ui .dialog-ux .modal-ux-content h4, .swagger-ui .dialog-ux .modal-ux-content p, .swagger-ui .dialog-ux .modal-ux-header h3, .swagger-ui .errors-wrapper .errors h4, .swagger-ui .errors-wrapper hgroup h4, .swagger-ui .info .base-url, .swagger-ui .info .title, .swagger-ui .info h1, .swagger-ui .info h2, .swagger-ui .info h3, .swagger-ui .info h4, .swagger-ui .info h5, .swagger-ui .info li, .swagger-ui .info p, .swagger-ui .info table, .swagger-ui .loading-container .loading::after, .swagger-ui .model, .swagger-ui .opblock .opblock-section-header h4, .swagger-ui .opblock .opblock-section-header > label, .swagger-ui .opblock .opblock-summary-description, .swagger-ui .opblock .opblock-summary-operation-id, .swagger-ui .opblock .opblock-summary-path, .swagger-ui .opblock .opblock-summary-path__deprecated, .swagger-ui .opblock-description-wrapper, .swagger-ui .opblock-description-wrapper h4, .swagger-ui .opblock-description-wrapper p, .swagger-ui .opblock-external-docs-wrapper, .swagger-ui .opblock-external-docs-wrapper h4, .swagger-ui .opblock-external-docs-wrapper p, .swagger-ui .opblock-tag small, .swagger-ui .opblock-title_normal, .swagger-ui .opblock-title_normal h4, .swagger-ui .opblock-title_normal p, .swagger-ui .parameter__name, .swagger-ui .parameter__type, .swagger-ui .response-col_links, .swagger-ui .response-col_status, .swagger-ui .responses-inner h4, .swagger-ui .responses-inner h5, .swagger-ui .scheme-container .schemes > label, .swagger-ui .scopes h2, .swagger-ui .servers > label, .swagger-ui .tab li, .swagger-ui label, .swagger-ui select, .swagger-ui table.headers td { - color: #b5bac9; -} - - .swagger-ui .download-url-wrapper .failed, .swagger-ui .filter .failed, .swagger-ui .model-deprecated-warning, .swagger-ui .parameter__deprecated, .swagger-ui .parameter__name.required span, .swagger-ui table.model tr.property-row .star { - color: #e69999; - } - -.swagger-ui .opblock-body pre.microlight, .swagger-ui textarea.curl { - background: #41444e; - border-radius: 4px; - color: #fff; -} - -.swagger-ui .expand-methods svg, .swagger-ui .expand-methods:hover svg { - fill: #bfbfbf; -} - -.swagger-ui .auth-container, .swagger-ui .dialog-ux .modal-ux-header { - border-bottom: 1px solid #2e2e2e; -} - -.swagger-ui .topbar .download-url-wrapper .select-label select, .swagger-ui .topbar .download-url-wrapper input[type=text] { - border: 2px solid #63a040; -} - -.swagger-ui .info a, .swagger-ui .info a:hover, .swagger-ui .scopes h2 a { - color: #99bde6; -} - -/* Dark Scrollbar */ -::-webkit-scrollbar { - width: 14px; - height: 14px; -} - -::-webkit-scrollbar-button { - background-color: #3e4346 !important; -} - -::-webkit-scrollbar-track { - background-color: #646464 !important; -} - -::-webkit-scrollbar-track-piece { - background-color: #3e4346 !important; -} - -::-webkit-scrollbar-thumb { - height: 50px; - background-color: #242424 !important; - border: 2px solid #3e4346 !important; -} - -::-webkit-scrollbar-corner { -} - -::-webkit-resizer { -} - -::-webkit-scrollbar-button:vertical:start:decrement { - background: linear-gradient(130deg, #696969 40%, rgba(255, 0, 0, 0) 41%), linear-gradient(230deg, #696969 40%, rgba(0, 0, 0, 0) 41%), linear-gradient(0deg, #696969 40%, rgba(0, 0, 0, 0) 31%); - background-color: #b6b6b6; -} - -::-webkit-scrollbar-button:vertical:end:increment { - background: linear-gradient(310deg, #696969 40%, rgba(0, 0, 0, 0) 41%), linear-gradient(50deg, #696969 40%, rgba(0, 0, 0, 0) 41%), linear-gradient(180deg, #696969 40%, rgba(0, 0, 0, 0) 31%); - background-color: #b6b6b6; -} - -::-webkit-scrollbar-button:horizontal:end:increment { - background: linear-gradient(210deg, #696969 40%, rgba(0, 0, 0, 0) 41%), linear-gradient(330deg, #696969 40%, rgba(0, 0, 0, 0) 41%), linear-gradient(90deg, #696969 30%, rgba(0, 0, 0, 0) 31%); - background-color: #b6b6b6; -} - -::-webkit-scrollbar-button:horizontal:start:decrement { - background: linear-gradient(30deg, #696969 40%, rgba(0, 0, 0, 0) 41%), linear-gradient(150deg, #696969 40%, rgba(0, 0, 0, 0) 41%), linear-gradient(270deg, #696969 30%, rgba(0, 0, 0, 0) 31%); - background-color: #b6b6b6; -} diff --git a/src/Atc.Rest.ApiGenerator.Framework/Resources/wwwroot/swagger-ui/main.js b/src/Atc.Rest.ApiGenerator.Framework/Resources/wwwroot/swagger-ui/main.js index a07b5763b..1af0dc39b 100644 --- a/src/Atc.Rest.ApiGenerator.Framework/Resources/wwwroot/swagger-ui/main.js +++ b/src/Atc.Rest.ApiGenerator.Framework/Resources/wwwroot/swagger-ui/main.js @@ -1,4 +1,4 @@ -var link = document.querySelector("link[rel*='icon']") || document.createElement("link"); +let link = document.querySelector("link[rel*='icon']") || document.createElement("link"); link.type = "image/x-icon"; link.rel = "shortcut icon"; link.href = "/favicon.ico"; diff --git a/src/Atc.Rest.ApiGenerator.Framework/Settings/GeneratorSettings.cs b/src/Atc.Rest.ApiGenerator.Framework/Settings/GeneratorSettings.cs new file mode 100644 index 000000000..b71b4f525 --- /dev/null +++ b/src/Atc.Rest.ApiGenerator.Framework/Settings/GeneratorSettings.cs @@ -0,0 +1,27 @@ +namespace Atc.Rest.ApiGenerator.Framework.Settings; + +public class GeneratorSettings( + Version version, + string projectName, + DirectoryInfo projectPath) +{ + public Version Version { get; private set; } = version; + + public string ProjectName { get; private set; } = projectName; + + public DirectoryInfo ProjectPath { get; private set; } = projectPath; + + public string EndpointsLocation { get; set; } = ContentGeneratorConstants.Endpoints; + + public string ContractsLocation { get; set; } = ContentGeneratorConstants.Contracts; + + public string HandlersLocation { get; set; } = ContentGeneratorConstants.Handlers; + + public bool UsePartialClassForContracts { get; set; } + + public bool UsePartialClassForEndpoints { get; set; } + + public bool UseProblemDetailsAsDefaultResponseBody { get; set; } + + public bool IncludeDeprecatedOperations { get; set; } +} \ No newline at end of file diff --git a/src/Atc.Rest.ApiGenerator/Factories/GeneratorSettingsFactory.cs b/src/Atc.Rest.ApiGenerator/Factories/GeneratorSettingsFactory.cs new file mode 100644 index 000000000..eb2fee70b --- /dev/null +++ b/src/Atc.Rest.ApiGenerator/Factories/GeneratorSettingsFactory.cs @@ -0,0 +1,42 @@ +namespace Atc.Rest.ApiGenerator.Factories; + +public static class GeneratorSettingsFactory +{ + public static GeneratorSettings Create( + Version version, + string projectName, + DirectoryInfo projectPath, + ApiOptionsGenerator apiOptionsGenerator, + bool includeDeprecatedOperations) + { + ArgumentNullException.ThrowIfNull(apiOptionsGenerator); + + var generatorSettings = new GeneratorSettings( + version, + projectName, + projectPath) + { + UseProblemDetailsAsDefaultResponseBody = apiOptionsGenerator.Response.UseProblemDetailsAsDefaultBody, + UsePartialClassForContracts = apiOptionsGenerator.UsePartialClassForContracts, + UsePartialClassForEndpoints = apiOptionsGenerator.UsePartialClassForEndpoints, + IncludeDeprecatedOperations = includeDeprecatedOperations, + }; + + if (!string.IsNullOrEmpty(apiOptionsGenerator.EndpointsLocation)) + { + generatorSettings.EndpointsLocation = apiOptionsGenerator.EndpointsLocation; + } + + if (!string.IsNullOrEmpty(apiOptionsGenerator.ContractsLocation)) + { + generatorSettings.ContractsLocation = apiOptionsGenerator.ContractsLocation; + } + + if (!string.IsNullOrEmpty(apiOptionsGenerator.HandlersLocation)) + { + generatorSettings.HandlersLocation = apiOptionsGenerator.HandlersLocation; + } + + return generatorSettings; + } +} \ No newline at end of file diff --git a/src/Atc.Rest.ApiGenerator/Generators/ClientCSharpApiGenerator.cs b/src/Atc.Rest.ApiGenerator/Generators/ClientCSharpApiGenerator.cs index 65915a1e1..80865331a 100644 --- a/src/Atc.Rest.ApiGenerator/Generators/ClientCSharpApiGenerator.cs +++ b/src/Atc.Rest.ApiGenerator/Generators/ClientCSharpApiGenerator.cs @@ -23,26 +23,24 @@ public ClientCSharpApiGenerator( var operationSchemaMappings = apiOperationExtractor.Extract(projectOptions.Document); - clientCSharpApiGenerator = new Client.CSharp.ProjectGenerator.ClientCSharpApiGenerator( - loggerFactory, - nugetPackageReferenceProvider, + var generatorSettings = GeneratorSettingsFactory.Create( projectOptions.ApiGeneratorVersion, projectOptions.ProjectName, projectOptions.PathForSrcGenerate, + projectOptions.ApiOptions.Generator, + projectOptions.ApiOptions.IncludeDeprecatedOperations); + + clientCSharpApiGenerator = new Client.CSharp.ProjectGenerator.ClientCSharpApiGenerator( + loggerFactory, + nugetPackageReferenceProvider, projectOptions.Document, operationSchemaMappings, - projectOptions.ApiOptions.Generator.Response.UseProblemDetailsAsDefaultBody, - projectOptions.ApiOptions.Generator.IncludeDeprecated, + generatorSettings, projectOptions.ApiOptions.Generator.Response.CustomErrorResponseModel); if (projectOptions.ApiOptions.Generator.Client is not null) { clientCSharpApiGenerator.HttpClientName = projectOptions.ApiOptions.Generator.Client.HttpClientName; - - if (!string.IsNullOrEmpty(projectOptions.ApiOptions.Generator.Client.FolderName)) - { - clientCSharpApiGenerator.ClientFolderName = projectOptions.ApiOptions.Generator.Client.FolderName; - } } } diff --git a/src/Atc.Rest.ApiGenerator/Generators/ServerApiGenerator.cs b/src/Atc.Rest.ApiGenerator/Generators/ServerApiGenerator.cs index 4ed705081..cdae8e65e 100644 --- a/src/Atc.Rest.ApiGenerator/Generators/ServerApiGenerator.cs +++ b/src/Atc.Rest.ApiGenerator/Generators/ServerApiGenerator.cs @@ -29,29 +29,28 @@ public ServerApiGenerator( var operationSchemaMappings = apiOperationExtractor.Extract(projectOptions.Document); - serverApiGeneratorMvc = new Framework.Mvc.ProjectGenerator.ServerApiGenerator( - loggerFactory, - nugetPackageReferenceProvider, + var generatorSettings = GeneratorSettingsFactory.Create( projectOptions.ApiGeneratorVersion, projectOptions.ProjectName, projectOptions.PathForSrcGenerate, + projectOptions.ApiOptions.Generator, + projectOptions.ApiOptions.IncludeDeprecatedOperations); + + serverApiGeneratorMvc = new Framework.Mvc.ProjectGenerator.ServerApiGenerator( + loggerFactory, + nugetPackageReferenceProvider, projectOptions.Document, operationSchemaMappings, projectOptions.RouteBase, - projectOptions.ApiOptions.Generator.Response.UseProblemDetailsAsDefaultBody, - projectOptions.ApiOptions.Generator.IncludeDeprecated); + generatorSettings); serverApiGeneratorMinimalApi = new Framework.Minimal.ProjectGenerator.ServerApiGenerator( loggerFactory, nugetPackageReferenceProvider, - projectOptions.ApiGeneratorVersion, - projectOptions.ProjectName, - projectOptions.PathForSrcGenerate, projectOptions.Document, operationSchemaMappings, projectOptions.RouteBase, - projectOptions.ApiOptions.Generator.Response.UseProblemDetailsAsDefaultBody, - projectOptions.ApiOptions.Generator.IncludeDeprecated); + generatorSettings); } public async Task Generate() diff --git a/src/Atc.Rest.ApiGenerator/Generators/ServerDomainGenerator.cs b/src/Atc.Rest.ApiGenerator/Generators/ServerDomainGenerator.cs index 77fbcb293..118b286f3 100644 --- a/src/Atc.Rest.ApiGenerator/Generators/ServerDomainGenerator.cs +++ b/src/Atc.Rest.ApiGenerator/Generators/ServerDomainGenerator.cs @@ -29,34 +29,42 @@ public ServerDomainGenerator( var apiProjectName = projectOptions.ProjectName.Replace(".Domain", ".Api.Generated", StringComparison.Ordinal); - serverDomainGeneratorMvc = new Framework.Mvc.ProjectGenerator.ServerDomainGenerator( - loggerFactory, + var generatorSettings = GeneratorSettingsFactory.Create( projectOptions.ApiGeneratorVersion, projectOptions.ProjectName, - apiProjectName, projectOptions.PathForSrcGenerate, - projectOptions.Document); + projectOptions.ApiOptions.Generator, + projectOptions.ApiOptions.IncludeDeprecatedOperations); + + serverDomainGeneratorMvc = new Framework.Mvc.ProjectGenerator.ServerDomainGenerator( + loggerFactory, + apiProjectName, + projectOptions.Document, + generatorSettings); serverDomainGeneratorMinimalApi = new Framework.Minimal.ProjectGenerator.ServerDomainGenerator( loggerFactory, nugetPackageReferenceProvider, - projectOptions.ApiGeneratorVersion, - projectOptions.ProjectName, apiProjectName, - projectOptions.PathForSrcGenerate, - projectOptions.Document); + projectOptions.Document, + generatorSettings); if (projectOptions.PathForTestGenerate is not null) { - serverDomainTestGenerator = new Framework.ProjectGenerator.ServerDomainTestGenerator( - loggerFactory, - nugetPackageReferenceProvider, + var generatorTestSettings = GeneratorSettingsFactory.Create( projectOptions.ApiGeneratorVersion, $"{projectOptions.ProjectName}.{ContentGeneratorConstants.Tests}", + projectOptions.PathForTestGenerate, + projectOptions.ApiOptions.Generator, + projectOptions.ApiOptions.IncludeDeprecatedOperations); + + serverDomainTestGenerator = new ServerDomainTestGenerator( + loggerFactory, + nugetPackageReferenceProvider, apiProjectName, projectOptions.ProjectName, - projectOptions.PathForTestGenerate, - projectOptions.Document); + projectOptions.Document, + generatorTestSettings); } } diff --git a/src/Atc.Rest.ApiGenerator/Generators/ServerHostGenerator.cs b/src/Atc.Rest.ApiGenerator/Generators/ServerHostGenerator.cs index deecb6384..a91b66671 100644 --- a/src/Atc.Rest.ApiGenerator/Generators/ServerHostGenerator.cs +++ b/src/Atc.Rest.ApiGenerator/Generators/ServerHostGenerator.cs @@ -31,15 +31,20 @@ public ServerHostGenerator( var domainProjectName = projectOptions.ProjectName.Replace(".Api", ".Domain", StringComparison.Ordinal); var operationSchemaMappings = apiOperationExtractor.Extract(projectOptions.Document); + var generatorSettings = GeneratorSettingsFactory.Create( + projectOptions.ApiGeneratorVersion, + projectOptions.ProjectName, + projectOptions.PathForSrcGenerate, + projectOptions.ApiOptions.Generator, + projectOptions.ApiOptions.IncludeDeprecatedOperations); + serverHostGeneratorMvc = new Framework.Mvc.ProjectGenerator.ServerHostGenerator( loggerFactory, nugetPackageReferenceProvider, - projectOptions.ApiGeneratorVersion, - projectOptions.ProjectName, apiProjectName, domainProjectName, - projectOptions.PathForSrcGenerate, - projectOptions.Document) + projectOptions.Document, + generatorSettings) { UseRestExtended = projectOptions.UseRestExtended, }; @@ -47,39 +52,39 @@ public ServerHostGenerator( serverHostGeneratorMinimalApi = new Framework.Minimal.ProjectGenerator.ServerHostGenerator( loggerFactory, nugetPackageReferenceProvider, - projectOptions.ApiGeneratorVersion, - projectOptions.ProjectName, apiProjectName, domainProjectName, - projectOptions.PathForSrcGenerate, - projectOptions.Document); + projectOptions.Document, + generatorSettings); if (projectOptions.PathForTestGenerate is not null) { + var generatorTestSettings = GeneratorSettingsFactory.Create( + projectOptions.ApiGeneratorVersion, + $"{projectOptions.ProjectName}.{ContentGeneratorConstants.Tests}", + projectOptions.PathForTestGenerate, + projectOptions.ApiOptions.Generator, + projectOptions.ApiOptions.IncludeDeprecatedOperations); + serverHostTestGeneratorMvc = new Framework.Mvc.ProjectGenerator.ServerHostTestGenerator( loggerFactory, nugetPackageReferenceProvider, - projectOptions.ApiGeneratorVersion, - $"{projectOptions.ProjectName}.{ContentGeneratorConstants.Tests}", projectOptions.ProjectName, apiProjectName, domainProjectName, - projectOptions.PathForTestGenerate, projectOptions.Document, operationSchemaMappings, - projectOptions.ApiOptions.IncludeDeprecated); + generatorTestSettings); serverHostTestGeneratorMinimalApi = new Framework.Minimal.ProjectGenerator.ServerHostTestGenerator( loggerFactory, nugetPackageReferenceProvider, - projectOptions.ApiGeneratorVersion, - $"{projectOptions.ProjectName}.{ContentGeneratorConstants.Tests}", projectOptions.ProjectName, apiProjectName, domainProjectName, - projectOptions.PathForTestGenerate, projectOptions.Document, - operationSchemaMappings); + operationSchemaMappings, + generatorTestSettings); } } diff --git a/src/Atc.Rest.ApiGenerator/GlobalUsings.cs b/src/Atc.Rest.ApiGenerator/GlobalUsings.cs index 6ddf3edbf..4ec580e48 100644 --- a/src/Atc.Rest.ApiGenerator/GlobalUsings.cs +++ b/src/Atc.Rest.ApiGenerator/GlobalUsings.cs @@ -6,8 +6,10 @@ global using Atc.Rest.ApiGenerator.Contracts; global using Atc.Rest.ApiGenerator.Contracts.Models; global using Atc.Rest.ApiGenerator.Contracts.Options; +global using Atc.Rest.ApiGenerator.Factories; global using Atc.Rest.ApiGenerator.Framework.ProjectGenerator; global using Atc.Rest.ApiGenerator.Framework.Providers; +global using Atc.Rest.ApiGenerator.Framework.Settings; global using Atc.Rest.ApiGenerator.Framework.Writers; global using Atc.Rest.ApiGenerator.Generators; global using Atc.Rest.ApiGenerator.Models; diff --git a/src/Atc.Rest.ApiGenerator/Models/ApiProjectOptions.cs b/src/Atc.Rest.ApiGenerator/Models/ApiProjectOptions.cs index c0f00d465..1de1e2c51 100644 --- a/src/Atc.Rest.ApiGenerator/Models/ApiProjectOptions.cs +++ b/src/Atc.Rest.ApiGenerator/Models/ApiProjectOptions.cs @@ -11,8 +11,7 @@ public ApiProjectOptions( string? projectSuffixName, ApiOptions apiOptions, bool usingCodingRules, - bool forClient = false, - string? clientFolderName = null) + bool forClient = false) : base( projectSrcGeneratePath, projectTestGeneratePath, @@ -22,26 +21,7 @@ public ApiProjectOptions( projectSuffixName, apiOptions, usingCodingRules, - forClient, - clientFolderName) + forClient) { - if (string.IsNullOrEmpty(clientFolderName)) - { - PathForEndpoints = new DirectoryInfo(Path.Combine(PathForSrcGenerate.FullName, ContentGeneratorConstants.Endpoints)); - PathForContracts = new DirectoryInfo(Path.Combine(PathForSrcGenerate.FullName, ContentGeneratorConstants.Contracts)); - PathForContractsShared = new DirectoryInfo(Path.Combine(PathForContracts.FullName, ContentGeneratorConstants.SpecialFolderSharedModels)); - } - else - { - PathForEndpoints = new DirectoryInfo(Path.Combine(Path.Combine(PathForSrcGenerate.FullName, clientFolderName), ContentGeneratorConstants.Endpoints)); - PathForContracts = new DirectoryInfo(Path.Combine(Path.Combine(PathForSrcGenerate.FullName, clientFolderName), ContentGeneratorConstants.Contracts)); - PathForContractsShared = new DirectoryInfo(Path.Combine(Path.Combine(PathForContracts.FullName), ContentGeneratorConstants.SpecialFolderSharedModels)); - } } - - public DirectoryInfo PathForEndpoints { get; } - - public DirectoryInfo PathForContracts { get; } - - public DirectoryInfo PathForContractsShared { get; } } \ No newline at end of file diff --git a/src/Atc.Rest.ApiGenerator/Models/BaseProjectOptions.cs b/src/Atc.Rest.ApiGenerator/Models/BaseProjectOptions.cs index 4de23d279..c853f3be3 100644 --- a/src/Atc.Rest.ApiGenerator/Models/BaseProjectOptions.cs +++ b/src/Atc.Rest.ApiGenerator/Models/BaseProjectOptions.cs @@ -11,8 +11,7 @@ protected BaseProjectOptions( string? projectSuffixName, ApiOptions apiOptions, bool usingCodingRules, - bool forClient = false, - string? clientFolderName = null) + bool forClient = false) { ArgumentNullException.ThrowIfNull(projectSrcGeneratePath); @@ -70,7 +69,6 @@ protected BaseProjectOptions( UsingCodingRules = usingCodingRules; IsForClient = forClient; - ClientFolderName = clientFolderName; ApiGroupNames = openApiDocument.GetApiGroupNames(); } @@ -117,7 +115,5 @@ public string ProjectTestCsProjDisplayLocation public bool IsForClient { get; } - public string? ClientFolderName { get; } - public IList ApiGroupNames { get; } } \ No newline at end of file diff --git a/src/Atc.Rest.ApiGenerator/Options/ApiOptions.cs b/src/Atc.Rest.ApiGenerator/Options/ApiOptions.cs index 99bbbe086..ef165e631 100644 --- a/src/Atc.Rest.ApiGenerator/Options/ApiOptions.cs +++ b/src/Atc.Rest.ApiGenerator/Options/ApiOptions.cs @@ -6,8 +6,8 @@ public class ApiOptions public ApiOptionsValidation Validation { get; set; } = new(); - public bool IncludeDeprecated { get; set; } + public bool IncludeDeprecatedOperations { get; set; } public override string ToString() - => $"{nameof(Generator)}: {Generator}, {nameof(Validation)}: ({Validation}), {nameof(IncludeDeprecated)}: ({IncludeDeprecated})"; + => $"{nameof(Generator)}: {Generator}, {nameof(Validation)}: ({Validation}), {nameof(IncludeDeprecatedOperations)}: ({IncludeDeprecatedOperations})"; } \ No newline at end of file diff --git a/src/Atc.Rest.ApiGenerator/Options/ApiOptionsGenerator.cs b/src/Atc.Rest.ApiGenerator/Options/ApiOptionsGenerator.cs index 8a5e328e0..94db2e280 100644 --- a/src/Atc.Rest.ApiGenerator/Options/ApiOptionsGenerator.cs +++ b/src/Atc.Rest.ApiGenerator/Options/ApiOptionsGenerator.cs @@ -8,12 +8,20 @@ public class ApiOptionsGenerator public bool UseRestExtended { get; set; } = true; - public bool IncludeDeprecated { get; set; } - public string ProjectName { get; set; } = string.Empty; public string ProjectSuffixName { get; set; } = string.Empty; + public string ContractsLocation { get; set; } = ContentGeneratorConstants.Contracts + ".[[apiGroupName]]"; + + public string EndpointsLocation { get; set; } = ContentGeneratorConstants.Endpoints + ".[[apiGroupName]]"; + + public string HandlersLocation { get; set; } = ContentGeneratorConstants.Handlers + ".[[apiGroupName]]"; + + public bool UsePartialClassForContracts { get; set; } + + public bool UsePartialClassForEndpoints { get; set; } + public bool RemoveNamespaceGroupSeparatorInGlobalUsings { get; set; } public ApiOptionsGeneratorRequest Request { get; set; } = new(); @@ -23,5 +31,5 @@ public class ApiOptionsGenerator public ApiOptionsGeneratorClient? Client { get; set; } public override string ToString() - => $"{nameof(AspNetOutputType)}: {AspNetOutputType}, {nameof(SwaggerThemeMode)}: {SwaggerThemeMode}, {nameof(UseRestExtended)}: {UseRestExtended}, {nameof(IncludeDeprecated)}: {IncludeDeprecated}, {nameof(ProjectName)}: {ProjectName}, {nameof(ProjectSuffixName)}: {ProjectSuffixName}, {nameof(RemoveNamespaceGroupSeparatorInGlobalUsings)}: {RemoveNamespaceGroupSeparatorInGlobalUsings}, {nameof(Request)}: ({Request}), {nameof(Response)}: ({Response}), {nameof(Client)}: ({Client})"; + => $"{nameof(AspNetOutputType)}: {AspNetOutputType}, {nameof(SwaggerThemeMode)}: {SwaggerThemeMode}, {nameof(UseRestExtended)}: {UseRestExtended}, {nameof(ProjectName)}: {ProjectName}, {nameof(ProjectSuffixName)}: {ProjectSuffixName}, {nameof(RemoveNamespaceGroupSeparatorInGlobalUsings)}: {RemoveNamespaceGroupSeparatorInGlobalUsings}, {nameof(Request)}: ({Request}), {nameof(Response)}: ({Response}), {nameof(Client)}: ({Client})"; } \ No newline at end of file diff --git a/src/Atc.Rest.ApiGenerator/Options/ApiOptionsGeneratorClient.cs b/src/Atc.Rest.ApiGenerator/Options/ApiOptionsGeneratorClient.cs index f88e7923f..7115aec1b 100644 --- a/src/Atc.Rest.ApiGenerator/Options/ApiOptionsGeneratorClient.cs +++ b/src/Atc.Rest.ApiGenerator/Options/ApiOptionsGeneratorClient.cs @@ -2,12 +2,10 @@ namespace Atc.Rest.ApiGenerator.Options; public class ApiOptionsGeneratorClient { - public string FolderName { get; set; } = string.Empty; + public string HttpClientName { get; set; } = ContentGeneratorConstants.DefaultHttpClientName; public bool ExcludeEndpointGeneration { get; set; } - public string HttpClientName { get; set; } = "ApiClient"; - public override string ToString() - => $"{nameof(FolderName)}: {FolderName}, {nameof(ExcludeEndpointGeneration)}: {ExcludeEndpointGeneration}, {nameof(HttpClientName)}: {HttpClientName}"; + => $"{nameof(HttpClientName)}: {HttpClientName}, {nameof(ExcludeEndpointGeneration)}: {ExcludeEndpointGeneration}"; } \ No newline at end of file diff --git a/test/Atc.CodeGeneration.CSharp.Tests/Content/Generators/GenerateContentForClassTests.cs b/test/Atc.CodeGeneration.CSharp.Tests/Content/Generators/GenerateContentForClassTests.cs index 650eb7048..d1636eb66 100644 --- a/test/Atc.CodeGeneration.CSharp.Tests/Content/Generators/GenerateContentForClassTests.cs +++ b/test/Atc.CodeGeneration.CSharp.Tests/Content/Generators/GenerateContentForClassTests.cs @@ -36,7 +36,7 @@ public override string ToString() new( DocumentationTags: null, Attributes: null, - AccessModifier: AccessModifiers.Public, + DeclarationModifier: DeclarationModifiers.Public, GenericTypeName: null, IsGenericListType: false, TypeName: "string", @@ -57,7 +57,7 @@ public override string ToString() Namespace: "Demo.Api.Generated.Contracts.Accounts", DocumentationTags: documentationTags, Attributes: AttributesWithGeneratedCode, - AccessModifier: AccessModifiers.PublicClass, + DeclarationModifier: DeclarationModifiers.PublicClass, ClassTypeName: "UpdateAccountRequest", GenericTypeName: null, InheritedClassTypeName: null, @@ -128,7 +128,7 @@ public override string ToString() new("FromRoute", "Name = \"accountId\""), new("Required", null), }, - AccessModifier: AccessModifiers.Public, + DeclarationModifier: DeclarationModifiers.Public, GenericTypeName: null, IsGenericListType: false, TypeName: "Guid", @@ -148,7 +148,7 @@ public override string ToString() { new("FromHeader", "Name = \"name\""), }, - AccessModifier: AccessModifiers.Public, + DeclarationModifier: DeclarationModifiers.Public, GenericTypeName: null, IsGenericListType: false, TypeName: "string", @@ -169,7 +169,7 @@ public override string ToString() Namespace: "Demo.Api.Generated.Contracts.Accounts", DocumentationTags: documentationTags, Attributes: AttributesWithGeneratedCode, - AccessModifier: AccessModifiers.PublicClass, + DeclarationModifier: DeclarationModifiers.PublicClass, ClassTypeName: "UpdateAccountNameParameters", GenericTypeName: null, InheritedClassTypeName: null, @@ -265,7 +265,7 @@ public async Task SetAccountName( new("ProducesResponseType", "typeof(ProblemDetails), StatusCodes.Status401Unauthorized"), new("ProducesResponseType", "typeof(ProblemDetails), StatusCodes.Status403Forbidden"), }, - AccessModifier: AccessModifiers.PublicAsync, + DeclarationModifier: DeclarationModifiers.PublicAsync, ReturnGenericTypeName: "Task", ReturnTypeName: "ActionResult", Name: "UpdateAccountName", @@ -288,7 +288,7 @@ public async Task SetAccountName( new("ProducesResponseType", "typeof(ProblemDetails), StatusCodes.Status401Unauthorized"), new("ProducesResponseType", "typeof(ProblemDetails), StatusCodes.Status403Forbidden"), }, - AccessModifier: AccessModifiers.PublicAsync, + DeclarationModifier: DeclarationModifiers.PublicAsync, ReturnGenericTypeName: "Task", ReturnTypeName: "ActionResult", Name: "SetAccountName", @@ -308,7 +308,7 @@ public async Task SetAccountName( Namespace: "Demo.Api.Generated.Endpoints", DocumentationTags: documentationTags, Attributes: attributes, - AccessModifier: AccessModifiers.PublicClass, + DeclarationModifier: DeclarationModifiers.PublicClass, ClassTypeName: "AccountsController", GenericTypeName: null, InheritedClassTypeName: "ControllerBase", @@ -371,7 +371,7 @@ public static implicit operator UpdateAccountNameResult(string response) { new( DocumentationTags: null, - AccessModifier: AccessModifiers.Private, + DeclarationModifier: DeclarationModifiers.Private, GenericTypeName: null, TypeName: "UpdateAccountNameResult", InheritedClassTypeName: "base", @@ -394,7 +394,7 @@ public static implicit operator UpdateAccountNameResult(string response) new( DocumentationTags: new CodeDocumentationTags("200 - Ok response."), Attributes: null, - AccessModifier: AccessModifiers.PublicStatic, + DeclarationModifier: DeclarationModifiers.PublicStatic, ReturnGenericTypeName: null, ReturnTypeName: "UpdateAccountNameResult", Name: "Ok", @@ -405,7 +405,7 @@ public static implicit operator UpdateAccountNameResult(string response) new( DocumentationTags: new CodeDocumentationTags("Performs an implicit conversion from UpdateAccountNameResult to ActionResult."), Attributes: null, - AccessModifier: AccessModifiers.PublicStaticImplicitOperator, + DeclarationModifier: DeclarationModifiers.PublicStaticImplicitOperator, ReturnGenericTypeName: null, ReturnTypeName: null, Name: "UpdateAccountNameResult", @@ -420,7 +420,7 @@ public static implicit operator UpdateAccountNameResult(string response) Namespace: "Demo.Api.Generated.Contracts.Accounts", DocumentationTags: documentationTags, Attributes: AttributesWithGeneratedCode, - AccessModifier: AccessModifiers.PublicClass, + DeclarationModifier: DeclarationModifiers.PublicClass, ClassTypeName: "UpdateAccountNameResult", GenericTypeName: null, InheritedClassTypeName: "ResultBase", @@ -520,7 +520,7 @@ public async Task ExecuteAsync( { new( DocumentationTags: null, - AccessModifier: AccessModifiers.Public, + DeclarationModifier: DeclarationModifiers.Public, GenericTypeName: null, TypeName: "CreateLocationEndpoint", InheritedClassTypeName: null, @@ -552,7 +552,7 @@ public async Task ExecuteAsync( new( DocumentationTags: null, Attributes: null, - AccessModifier: AccessModifiers.PublicAsync, + DeclarationModifier: DeclarationModifiers.PublicAsync, ReturnGenericTypeName: "Task", ReturnTypeName: "ICreateLocationEndpointResult", Name: "ExecuteAsync", @@ -587,7 +587,7 @@ public async Task ExecuteAsync( Namespace: "XXX.ApiClient.Generated.Endpoints", DocumentationTags: documentationTags, Attributes: AttributesWithGeneratedCode, - AccessModifier: AccessModifiers.PublicClass, + DeclarationModifier: DeclarationModifiers.PublicClass, ClassTypeName: "CreateLocationEndpoint", GenericTypeName: null, InheritedClassTypeName: "ICreateLocationEndpoint", @@ -681,7 +681,7 @@ public ProblemDetails InternalServerErrorContent { new( DocumentationTags: null, - AccessModifier: AccessModifiers.Public, + DeclarationModifier: DeclarationModifiers.Public, GenericTypeName: null, TypeName: "CreateLocationEndpointResult", InheritedClassTypeName: "base", @@ -704,7 +704,7 @@ public ProblemDetails InternalServerErrorContent new( DocumentationTags: null, Attributes: null, - AccessModifier: AccessModifiers.Public, + DeclarationModifier: DeclarationModifiers.Public, GenericTypeName: null, IsGenericListType: false, TypeName: "bool", @@ -721,7 +721,7 @@ public ProblemDetails InternalServerErrorContent new( DocumentationTags: null, Attributes: null, - AccessModifier: AccessModifiers.Public, + DeclarationModifier: DeclarationModifiers.Public, GenericTypeName: null, IsGenericListType: false, TypeName: "bool", @@ -738,7 +738,7 @@ public ProblemDetails InternalServerErrorContent new( DocumentationTags: null, Attributes: null, - AccessModifier: AccessModifiers.Public, + DeclarationModifier: DeclarationModifiers.Public, GenericTypeName: null, IsGenericListType: false, TypeName: "bool", @@ -755,7 +755,7 @@ public ProblemDetails InternalServerErrorContent new( DocumentationTags: null, Attributes: null, - AccessModifier: AccessModifiers.Public, + DeclarationModifier: DeclarationModifiers.Public, GenericTypeName: null, IsGenericListType: false, TypeName: "bool", @@ -772,7 +772,7 @@ public ProblemDetails InternalServerErrorContent new( DocumentationTags: null, Attributes: null, - AccessModifier: AccessModifiers.Public, + DeclarationModifier: DeclarationModifiers.Public, GenericTypeName: null, IsGenericListType: false, TypeName: "bool", @@ -789,7 +789,7 @@ public ProblemDetails InternalServerErrorContent new( DocumentationTags: null, Attributes: null, - AccessModifier: AccessModifiers.Public, + DeclarationModifier: DeclarationModifiers.Public, GenericTypeName: null, IsGenericListType: false, TypeName: "Location", @@ -806,7 +806,7 @@ public ProblemDetails InternalServerErrorContent new( DocumentationTags: null, Attributes: null, - AccessModifier: AccessModifiers.Public, + DeclarationModifier: DeclarationModifiers.Public, GenericTypeName: null, IsGenericListType: false, TypeName: "ValidationProblemDetails", @@ -823,7 +823,7 @@ public ProblemDetails InternalServerErrorContent new( DocumentationTags: null, Attributes: null, - AccessModifier: AccessModifiers.Public, + DeclarationModifier: DeclarationModifiers.Public, GenericTypeName: null, IsGenericListType: false, TypeName: "ProblemDetails", @@ -840,7 +840,7 @@ public ProblemDetails InternalServerErrorContent new( DocumentationTags: null, Attributes: null, - AccessModifier: AccessModifiers.Public, + DeclarationModifier: DeclarationModifiers.Public, GenericTypeName: null, IsGenericListType: false, TypeName: "ProblemDetails", @@ -857,7 +857,7 @@ public ProblemDetails InternalServerErrorContent new( DocumentationTags: null, Attributes: null, - AccessModifier: AccessModifiers.Public, + DeclarationModifier: DeclarationModifiers.Public, GenericTypeName: null, IsGenericListType: false, TypeName: "ProblemDetails", @@ -878,7 +878,7 @@ public ProblemDetails InternalServerErrorContent Namespace: "XXX.ApiClient.Generated.Endpoints", DocumentationTags: documentationTags, Attributes: AttributesWithGeneratedCode, - AccessModifier: AccessModifiers.PublicClass, + DeclarationModifier: DeclarationModifiers.PublicClass, ClassTypeName: "CreateLocationEndpointResult", GenericTypeName: null, InheritedClassTypeName: "EndpointResponse", diff --git a/test/Atc.CodeGeneration.CSharp.Tests/Content/Generators/GenerateContentForInterfaceTests.cs b/test/Atc.CodeGeneration.CSharp.Tests/Content/Generators/GenerateContentForInterfaceTests.cs index 42c260dd7..865f0dbf3 100644 --- a/test/Atc.CodeGeneration.CSharp.Tests/Content/Generators/GenerateContentForInterfaceTests.cs +++ b/test/Atc.CodeGeneration.CSharp.Tests/Content/Generators/GenerateContentForInterfaceTests.cs @@ -17,7 +17,7 @@ public interface MyInterface Namespace: "App.MyNamespace", DocumentationTags: null, Attributes: null, - AccessModifier: AccessModifiers.Public, + DeclarationModifier: DeclarationModifiers.PublicInterface, InterfaceTypeName: "MyInterface", InheritedInterfaceTypeName: null, Properties: null, @@ -48,7 +48,7 @@ public interface MyInterface : MyInterfaceBase Namespace: "App.MyNamespace", DocumentationTags: null, Attributes: null, - AccessModifier: AccessModifiers.Public, + DeclarationModifier: DeclarationModifiers.PublicInterface, InterfaceTypeName: "MyInterface", InheritedInterfaceTypeName: "MyInterfaceBase", Properties: null, @@ -113,7 +113,7 @@ Task ExecuteAsync( exceptions: null, @return: null), Attributes: null, - AccessModifier: AccessModifiers.None, + DeclarationModifier: DeclarationModifiers.None, ReturnTypeName: "SetAccountNameResult", ReturnGenericTypeName: "Task", Name: "ExecuteAsync", @@ -148,7 +148,7 @@ Task ExecuteAsync( Namespace: "Demo.Api.Generated.Contracts.Accounts", DocumentationTags: documentationTags, Attributes: AttributesWithGeneratedCode, - AccessModifier: AccessModifiers.Public, + DeclarationModifier: DeclarationModifiers.PublicInterface, InterfaceTypeName: "ISetAccountNameHandler", InheritedInterfaceTypeName: null, Properties: null, @@ -213,7 +213,7 @@ Task ExecuteAsync( exceptions: null, @return: null), Attributes: null, - AccessModifier: AccessModifiers.None, + DeclarationModifier: DeclarationModifiers.None, ReturnTypeName: "UpdateAccountNameResult", ReturnGenericTypeName: "Task", Name: "ExecuteAsync", @@ -248,7 +248,7 @@ Task ExecuteAsync( Namespace: "Demo.Api.Generated.Contracts.Accounts", DocumentationTags: documentationTags, Attributes: AttributesWithGeneratedCode, - AccessModifier: AccessModifiers.Public, + DeclarationModifier: DeclarationModifiers.PublicInterface, InterfaceTypeName: "IUpdateAccountNameHandler", InheritedInterfaceTypeName: null, Properties: null, @@ -313,7 +313,7 @@ Task ExecuteAsync( exceptions: null, @return: null), Attributes: null, - AccessModifier: AccessModifiers.None, + DeclarationModifier: DeclarationModifiers.None, ReturnTypeName: "ICreateLocationEndpointResult", ReturnGenericTypeName: "Task", Name: "ExecuteAsync", @@ -348,7 +348,7 @@ Task ExecuteAsync( Namespace: "XXX.ApiClient.Generated.Endpoints", DocumentationTags: documentationTags, Attributes: AttributesWithGeneratedCode, - AccessModifier: AccessModifiers.Public, + DeclarationModifier: DeclarationModifiers.PublicInterface, InterfaceTypeName: "ICreateLocationEndpoint", InheritedInterfaceTypeName: null, Properties: null, @@ -413,7 +413,7 @@ public interface ICreateLocationEndpointResult : IEndpointResponse new( DocumentationTags: null, Attributes: null, - AccessModifier: AccessModifiers.None, + DeclarationModifier: DeclarationModifiers.None, GenericTypeName: null, IsGenericListType: false, TypeName: "bool", @@ -430,7 +430,7 @@ public interface ICreateLocationEndpointResult : IEndpointResponse new( DocumentationTags: null, Attributes: null, - AccessModifier: AccessModifiers.None, + DeclarationModifier: DeclarationModifiers.None, GenericTypeName: null, IsGenericListType: false, TypeName: "bool", @@ -447,7 +447,7 @@ public interface ICreateLocationEndpointResult : IEndpointResponse new( DocumentationTags: null, Attributes: null, - AccessModifier: AccessModifiers.None, + DeclarationModifier: DeclarationModifiers.None, GenericTypeName: null, IsGenericListType: false, TypeName: "bool", @@ -464,7 +464,7 @@ public interface ICreateLocationEndpointResult : IEndpointResponse new( DocumentationTags: null, Attributes: null, - AccessModifier: AccessModifiers.None, + DeclarationModifier: DeclarationModifiers.None, GenericTypeName: null, IsGenericListType: false, TypeName: "bool", @@ -481,7 +481,7 @@ public interface ICreateLocationEndpointResult : IEndpointResponse new( DocumentationTags: null, Attributes: null, - AccessModifier: AccessModifiers.None, + DeclarationModifier: DeclarationModifiers.None, GenericTypeName: null, IsGenericListType: false, TypeName: "bool", @@ -498,7 +498,7 @@ public interface ICreateLocationEndpointResult : IEndpointResponse new( DocumentationTags: null, Attributes: null, - AccessModifier: AccessModifiers.None, + DeclarationModifier: DeclarationModifiers.None, GenericTypeName: null, IsGenericListType: false, TypeName: "Location", @@ -515,7 +515,7 @@ public interface ICreateLocationEndpointResult : IEndpointResponse new( DocumentationTags: null, Attributes: null, - AccessModifier: AccessModifiers.None, + DeclarationModifier: DeclarationModifiers.None, GenericTypeName: null, IsGenericListType: false, TypeName: "ValidationProblemDetails", @@ -532,7 +532,7 @@ public interface ICreateLocationEndpointResult : IEndpointResponse new( DocumentationTags: null, Attributes: null, - AccessModifier: AccessModifiers.None, + DeclarationModifier: DeclarationModifiers.None, GenericTypeName: null, IsGenericListType: false, TypeName: "ProblemDetails", @@ -549,7 +549,7 @@ public interface ICreateLocationEndpointResult : IEndpointResponse new( DocumentationTags: null, Attributes: null, - AccessModifier: AccessModifiers.None, + DeclarationModifier: DeclarationModifiers.None, GenericTypeName: null, IsGenericListType: false, TypeName: "ProblemDetails", @@ -566,7 +566,7 @@ public interface ICreateLocationEndpointResult : IEndpointResponse new( DocumentationTags: null, Attributes: null, - AccessModifier: AccessModifiers.None, + DeclarationModifier: DeclarationModifiers.None, GenericTypeName: null, IsGenericListType: false, TypeName: "ProblemDetails", @@ -587,7 +587,7 @@ public interface ICreateLocationEndpointResult : IEndpointResponse Namespace: "XXX.ApiClient.Generated.Endpoints", DocumentationTags: documentationTags, Attributes: AttributesWithGeneratedCode, - AccessModifier: AccessModifiers.Public, + DeclarationModifier: DeclarationModifiers.PublicInterface, InterfaceTypeName: "ICreateLocationEndpointResult", InheritedInterfaceTypeName: "IEndpointResponse", Properties: propertyParameters, diff --git a/test/Atc.CodeGeneration.CSharp.Tests/Content/Generators/GenerateContentForRecordsTests.cs b/test/Atc.CodeGeneration.CSharp.Tests/Content/Generators/GenerateContentForRecordsTests.cs index 44a1a55e8..cbba3c68d 100644 --- a/test/Atc.CodeGeneration.CSharp.Tests/Content/Generators/GenerateContentForRecordsTests.cs +++ b/test/Atc.CodeGeneration.CSharp.Tests/Content/Generators/GenerateContentForRecordsTests.cs @@ -22,11 +22,12 @@ public record GetLocationsByCountryCodeA3Parameters( "Energy.Consumption.Api.Contracts.Contracts.Petrol.Parameters", DocumentationTags: null, Attributes: null, + DeclarationModifiers.PublicRecord, new List { new( DocumentationTags: null, - AccessModifiers.PublicRecord, + DeclarationModifiers.PublicRecord, Name: "CreateLocationParameters", new List { @@ -42,7 +43,7 @@ public record GetLocationsByCountryCodeA3Parameters( }), new( DocumentationTags: null, - AccessModifiers.PublicRecord, + DeclarationModifiers.PublicRecord, Name: "GetLocationByIdParameters", new List { @@ -58,7 +59,7 @@ public record GetLocationsByCountryCodeA3Parameters( }), new( DocumentationTags: null, - AccessModifiers.PublicRecord, + DeclarationModifiers.PublicRecord, Name: "GetLocationsByCountryCodeA3Parameters", new List { diff --git a/test/Atc.CodeGeneration.CSharp.Tests/Extensions/StringBuilderExtensionsTests.cs b/test/Atc.CodeGeneration.CSharp.Tests/Extensions/StringBuilderExtensionsTests.cs index e6b76f66a..ddb1f2b4f 100644 --- a/test/Atc.CodeGeneration.CSharp.Tests/Extensions/StringBuilderExtensionsTests.cs +++ b/test/Atc.CodeGeneration.CSharp.Tests/Extensions/StringBuilderExtensionsTests.cs @@ -4,25 +4,25 @@ namespace Atc.CodeGeneration.CSharp.Tests.Extensions; public class StringBuilderExtensionsTests { [Theory] - [InlineData("", AccessModifiers.None)] - [InlineData("public ", AccessModifiers.Public)] - [InlineData("public async ", AccessModifiers.PublicAsync)] - [InlineData("public static ", AccessModifiers.PublicStatic)] - [InlineData("public static implicit operator ", AccessModifiers.PublicStaticImplicitOperator)] - [InlineData("public record ", AccessModifiers.PublicRecord)] - [InlineData("public record struct ", AccessModifiers.PublicRecordStruct)] - [InlineData("private ", AccessModifiers.Private)] - [InlineData("protected ", AccessModifiers.Protected)] - [InlineData("internal ", AccessModifiers.Internal)] - public void AppendAccessModifier( + [InlineData("", DeclarationModifiers.None)] + [InlineData("public ", DeclarationModifiers.Public)] + [InlineData("public async ", DeclarationModifiers.PublicAsync)] + [InlineData("public static ", DeclarationModifiers.PublicStatic)] + [InlineData("public static implicit operator ", DeclarationModifiers.PublicStaticImplicitOperator)] + [InlineData("public record ", DeclarationModifiers.PublicRecord)] + [InlineData("public record struct ", DeclarationModifiers.PublicRecordStruct)] + [InlineData("private ", DeclarationModifiers.Private)] + [InlineData("protected ", DeclarationModifiers.Protected)] + [InlineData("internal ", DeclarationModifiers.Internal)] + public void AppendDeclarationModifier( string expected, - AccessModifiers accessModifier) + DeclarationModifiers declarationModifier) { // Arrange var sb = new StringBuilder(); // Act - sb.AppendAccessModifier(accessModifier); + sb.AppendDeclarationModifier(declarationModifier); var actual = sb.ToString(); // Assert @@ -30,26 +30,26 @@ public void AppendAccessModifier( } [Theory] - [InlineData("", 3, AccessModifiers.None)] - [InlineData(" public ", 3, AccessModifiers.Public)] - [InlineData(" public async ", 3, AccessModifiers.PublicAsync)] - [InlineData(" public static ", 3, AccessModifiers.PublicStatic)] - [InlineData(" public static implicit operator ", 3, AccessModifiers.PublicStaticImplicitOperator)] - [InlineData(" public record ", 3, AccessModifiers.PublicRecord)] - [InlineData(" public record struct ", 3, AccessModifiers.PublicRecordStruct)] - [InlineData(" private ", 3, AccessModifiers.Private)] - [InlineData(" protected ", 3, AccessModifiers.Protected)] - [InlineData(" internal ", 3, AccessModifiers.Internal)] - public void AppendAccessModifier_WithIndentSpaces( + [InlineData("", 3, DeclarationModifiers.None)] + [InlineData(" public ", 3, DeclarationModifiers.Public)] + [InlineData(" public async ", 3, DeclarationModifiers.PublicAsync)] + [InlineData(" public static ", 3, DeclarationModifiers.PublicStatic)] + [InlineData(" public static implicit operator ", 3, DeclarationModifiers.PublicStaticImplicitOperator)] + [InlineData(" public record ", 3, DeclarationModifiers.PublicRecord)] + [InlineData(" public record struct ", 3, DeclarationModifiers.PublicRecordStruct)] + [InlineData(" private ", 3, DeclarationModifiers.Private)] + [InlineData(" protected ", 3, DeclarationModifiers.Protected)] + [InlineData(" internal ", 3, DeclarationModifiers.Internal)] + public void AppendDeclarationModifier_WithIndentSpaces( string expected, int indentSpaces, - AccessModifiers accessModifier) + DeclarationModifiers declarationModifier) { // Arrange var sb = new StringBuilder(); // Act - sb.AppendAccessModifier(indentSpaces, accessModifier); + sb.AppendDeclarationModifier(indentSpaces, declarationModifier); var actual = sb.ToString(); // Assert diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Atc.Rest.ApiGenerator.CLI.Tests.csproj b/test/Atc.Rest.ApiGenerator.CLI.Tests/Atc.Rest.ApiGenerator.CLI.Tests.csproj index 379240bb3..64458158f 100644 --- a/test/Atc.Rest.ApiGenerator.CLI.Tests/Atc.Rest.ApiGenerator.CLI.Tests.csproj +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Atc.Rest.ApiGenerator.CLI.Tests.csproj @@ -24,6 +24,8 @@ + + @@ -39,6 +41,8 @@ + + @@ -54,6 +58,8 @@ + + diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/DemoSample/VerifyClient/WOPD/src/DemoSample.ApiClient.Generated/GlobalUsings.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/DemoSample/VerifyClient/WOPD/src/DemoSample.ApiClient.Generated/GlobalUsings.verified.cs index b364f1614..3759d4054 100644 --- a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/DemoSample/VerifyClient/WOPD/src/DemoSample.ApiClient.Generated/GlobalUsings.verified.cs +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/DemoSample/VerifyClient/WOPD/src/DemoSample.ApiClient.Generated/GlobalUsings.verified.cs @@ -1,4 +1,4 @@ -global using System; +global using System; global using System.CodeDom.Compiler; global using System.Collections.Generic; global using System.ComponentModel.DataAnnotations; @@ -19,7 +19,6 @@ global using DemoSample.ApiClient.Generated.Contracts.Files; global using DemoSample.ApiClient.Generated.Contracts.Items; global using DemoSample.ApiClient.Generated.Contracts.Orders; -global using DemoSample.ApiClient.Generated.Contracts.Tasks; global using DemoSample.ApiClient.Generated.Contracts.Users; global using DemoSample.ApiClient.Generated.Endpoints.Accounts.Interfaces; global using DemoSample.ApiClient.Generated.Endpoints.Addresses.Interfaces; diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/DemoSample/VerifyClient/WPD/src/DemoSample.ApiClient.Generated/GlobalUsings.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/DemoSample/VerifyClient/WPD/src/DemoSample.ApiClient.Generated/GlobalUsings.verified.cs index b364f1614..3759d4054 100644 --- a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/DemoSample/VerifyClient/WPD/src/DemoSample.ApiClient.Generated/GlobalUsings.verified.cs +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/DemoSample/VerifyClient/WPD/src/DemoSample.ApiClient.Generated/GlobalUsings.verified.cs @@ -1,4 +1,4 @@ -global using System; +global using System; global using System.CodeDom.Compiler; global using System.Collections.Generic; global using System.ComponentModel.DataAnnotations; @@ -19,7 +19,6 @@ global using DemoSample.ApiClient.Generated.Contracts.Files; global using DemoSample.ApiClient.Generated.Contracts.Items; global using DemoSample.ApiClient.Generated.Contracts.Orders; -global using DemoSample.ApiClient.Generated.Contracts.Tasks; global using DemoSample.ApiClient.Generated.Contracts.Users; global using DemoSample.ApiClient.Generated.Endpoints.Accounts.Interfaces; global using DemoSample.ApiClient.Generated.Endpoints.Addresses.Interfaces; diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/ExAsyncEnumerable/VerifyServerAll/MinimalApi_WOPD/src/ExAsyncEnumerable.Domain/GlobalUsings.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/ExAsyncEnumerable/VerifyServerAll/MinimalApi_WOPD/src/ExAsyncEnumerable.Domain/GlobalUsings.verified.cs index 68af4d8d7..96b6a39d7 100644 --- a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/ExAsyncEnumerable/VerifyServerAll/MinimalApi_WOPD/src/ExAsyncEnumerable.Domain/GlobalUsings.verified.cs +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/ExAsyncEnumerable/VerifyServerAll/MinimalApi_WOPD/src/ExAsyncEnumerable.Domain/GlobalUsings.verified.cs @@ -3,8 +3,6 @@ global using ExAsyncEnumerable.Api.Generated.Contracts.Customers; global using ExAsyncEnumerable.Api.Generated.Contracts.Users; -global using ExAsyncEnumerable.Domain.Handlers.Customers; -global using ExAsyncEnumerable.Domain.Handlers.Users; global using Microsoft.Extensions.Configuration; global using Microsoft.Extensions.DependencyInjection; \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/ExAsyncEnumerable/VerifyServerAll/MinimalApi_WPD/src/ExAsyncEnumerable.Domain/GlobalUsings.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/ExAsyncEnumerable/VerifyServerAll/MinimalApi_WPD/src/ExAsyncEnumerable.Domain/GlobalUsings.verified.cs index 68af4d8d7..96b6a39d7 100644 --- a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/ExAsyncEnumerable/VerifyServerAll/MinimalApi_WPD/src/ExAsyncEnumerable.Domain/GlobalUsings.verified.cs +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/ExAsyncEnumerable/VerifyServerAll/MinimalApi_WPD/src/ExAsyncEnumerable.Domain/GlobalUsings.verified.cs @@ -3,8 +3,6 @@ global using ExAsyncEnumerable.Api.Generated.Contracts.Customers; global using ExAsyncEnumerable.Api.Generated.Contracts.Users; -global using ExAsyncEnumerable.Domain.Handlers.Customers; -global using ExAsyncEnumerable.Domain.Handlers.Users; global using Microsoft.Extensions.Configuration; global using Microsoft.Extensions.DependencyInjection; \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/ExNsWithTask/VerifyClient/WOPD/src/ExNsWithTask.ApiClient.Generated/GlobalUsings.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/ExNsWithTask/VerifyClient/WOPD/src/ExNsWithTask.ApiClient.Generated/GlobalUsings.verified.cs index 7b76232d7..70b8fc3d1 100644 --- a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/ExNsWithTask/VerifyClient/WOPD/src/ExNsWithTask.ApiClient.Generated/GlobalUsings.verified.cs +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/ExNsWithTask/VerifyClient/WOPD/src/ExNsWithTask.ApiClient.Generated/GlobalUsings.verified.cs @@ -13,7 +13,6 @@ global using ExNsWithTask.ApiClient.Generated.Contracts; global using ExNsWithTask.ApiClient.Generated.Contracts.EventArgs; global using ExNsWithTask.ApiClient.Generated.Contracts.Orders; -global using ExNsWithTask.ApiClient.Generated.Contracts.Tasks; global using ExNsWithTask.ApiClient.Generated.Contracts.TestUnits; global using ExNsWithTask.ApiClient.Generated.Endpoints.EventArgs.Interfaces; global using ExNsWithTask.ApiClient.Generated.Endpoints.Orders.Interfaces; diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/ExNsWithTask/VerifyClient/WPD/src/ExNsWithTask.ApiClient.Generated/GlobalUsings.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/ExNsWithTask/VerifyClient/WPD/src/ExNsWithTask.ApiClient.Generated/GlobalUsings.verified.cs index 7b76232d7..70b8fc3d1 100644 --- a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/ExNsWithTask/VerifyClient/WPD/src/ExNsWithTask.ApiClient.Generated/GlobalUsings.verified.cs +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/ExNsWithTask/VerifyClient/WPD/src/ExNsWithTask.ApiClient.Generated/GlobalUsings.verified.cs @@ -13,7 +13,6 @@ global using ExNsWithTask.ApiClient.Generated.Contracts; global using ExNsWithTask.ApiClient.Generated.Contracts.EventArgs; global using ExNsWithTask.ApiClient.Generated.Contracts.Orders; -global using ExNsWithTask.ApiClient.Generated.Contracts.Tasks; global using ExNsWithTask.ApiClient.Generated.Contracts.TestUnits; global using ExNsWithTask.ApiClient.Generated.Endpoints.EventArgs.Interfaces; global using ExNsWithTask.ApiClient.Generated.Endpoints.Orders.Interfaces; diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Monta/ApiGeneratorOptions.json b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Monta/ApiGeneratorOptions.json index fe79e7e2f..04c42efa6 100644 --- a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Monta/ApiGeneratorOptions.json +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Monta/ApiGeneratorOptions.json @@ -5,6 +5,11 @@ "useRestExtended": true, "includeDeprecated": false, "projectSuffixName": "", + "contractsLocation": "Contracts.[[apiGroupName]]", + "endpointsLocation": "Endpoints.[[apiGroupName]]", + "handlersLocation": "Handlers.[[apiGroupName]]", + "usePartialClassForContracts": false, + "usePartialClassForEndpoints": false, "removeNamespaceGroupSeparatorInGlobalUsings": false, "request": {}, "response": { @@ -37,7 +42,6 @@ } }, "client": { - "folderName": "", "excludeEndpointGeneration": false, "httpClientName": "Monta-ApiClient" } @@ -49,5 +53,5 @@ "modelNameCasingStyle": "PascalCase", "modelPropertyNameCasingStyle": "CamelCase" }, - "includeDeprecated": false + "includeDeprecatedOperations": false } \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/Structure1.yaml b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/Structure1.yaml new file mode 100644 index 000000000..cf543aff2 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/Structure1.yaml @@ -0,0 +1,969 @@ +openapi: 3.0.1 +info: + title: Demo Sample Api + description: Demo Sample Api - SingleFileVersion + version: '1.0' + contact: + name: atc-net A/S +servers: + - url: /api/v1 + description: Api version 1.0 +x-authorize-roles: + - admin + - operator +paths: + /orders: + x-authentication-required: true + get: + tags: + - Orders + summary: Get orders + description: Get orders + operationId: getOrders + parameters: + - $ref: '#/components/parameters/pagingPageSize' + - $ref: '#/components/parameters/pagingPageIndex' + - $ref: '#/components/parameters/queryString' + - $ref: '#/components/parameters/queryStringArray' + - $ref: '#/components/parameters/continuationToken' + responses: + '200': + description: Expected response to a valid request + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Pagination' + - $ref: '#/components/schemas/Orders' + '404': + description: Not Found + '/orders/{id}': + x-authentication-required: true + x-authorize-roles: + - operator + get: + tags: + - Orders + summary: Get order by id + description: Get order by id + operationId: getOrderById + x-authentication-required: false + parameters: + - name: myEmail + in: query + description: The email for filter orders to retrieve + schema: + type: string + format: email + nullable: true + responses: + '200': + description: Expected response to a valid request + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + '404': + description: Not Found + patch: + summary: Update part of order by id + description: Update part of order by id + operationId: patchOrdersId + x-authorize-roles: + - admin + - operator + parameters: + - name: myTestHeader + in: header + required: true + description: The myTestHeader special key + schema: + type: string + - name: myTestHeaderBool + in: header + required: true + description: The myTestHeaderBool special key + schema: + type: boolean + - name: myTestHeaderInt + in: header + required: true + description: The myTestHeaderInt special key + schema: + type: integer + - name: x-correlation-id + in: header + required: true + description: The correlationId + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateOrderRequest' + responses: + '200': + description: OK + '404': + description: Not Found + '409': + description: Conflict + '502': + description: Bad Gateway + content: + application/json: + schema: + $ref: '#/components/schemas/ProblemDetails' + parameters: + - name: id + in: path + description: The id of the order + required: true + schema: + type: string + format: uuid + /users/email: + get: + tags: + - Users + summary: Get user by email + description: Get user by email + operationId: getUserByEmail + parameters: + - name: email + in: query + description: The email of the user to retrieve + required: true + schema: + type: string + format: email + responses: + '200': + description: Expected response to a valid request + content: + application/json: + schema: + $ref: '#/components/schemas/User' + '400': + description: Bad Request + '404': + description: Not Found + '409': + description: Conflict + '/users/{id}': + get: + summary: Get user by id + description: Get user by id + operationId: getUserById + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/User' + '404': + description: Not Found + '409': + description: Conflict + put: + summary: Update user by id + description: Update user by id + operationId: updateUserById + responses: + '200': + description: OK + '400': + description: Bad Request + '404': + description: Not Found + '409': + description: Conflict + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateUserRequest' + delete: + summary: Delete user by id + description: Delete user by id + operationId: deleteUserById + responses: + '200': + description: OK + '404': + description: Not Found + '409': + description: Conflict + parameters: + - name: id + in: path + description: Id of the user + required: true + schema: + type: string + format: uuid + /users: + get: + summary: Get all users + description: Get all users + operationId: getUsers + tags: [] + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Users' + '409': + description: Conflict + post: + summary: Create a new user + description: Create a new user + operationId: postUser + responses: + '201': + description: Created + '400': + description: Bad Request + '409': + description: Conflict + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateUserRequest' + '/users/{id}/gender': + put: + summary: Update gender on a user + description: Update gender on a user + operationId: updateMyTestGender + parameters: + - name: genderParam + in: query + description: The gender to set on the user + schema: + $ref: '#/components/schemas/GenderType' + responses: + '200': + description: OK + '400': + description: Bad Request + '404': + description: Not Found + '409': + description: Conflict + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateTestGenderRequest' + parameters: + - name: id + description: Id of the user + in: path + required: true + schema: + type: string + format: uuid + '/accounts/{accountId}/name': + put: + summary: Update name of account + description: Update name of account + operationId: updateAccountName + responses: + '200': + description: OK + parameters: + - name: name + in: header + description: The account name + schema: + type: string + post: + summary: Set name of account + description: Set name of account + operationId: setAccountName + responses: + '200': + description: OK + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateAccountRequest' + parameters: + - name: accountId + in: path + required: true + description: The accountId + schema: + type: string + format: uuid + '/addresses/{postalCode}': + get: + summary: Get addresses by postal code + description: Get addresses by postal code + operationId: getAddressesByPostalCodes + tags: [] + responses: + '200': + description: OK + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Address' + '404': + description: Not Found + parameters: + - name: postalCode + in: path + required: true + description: The postalCode to limit addresses on + schema: + type: string + /route-with-dash: + get: + summary: Your GET endpoint + description: Your GET endpoint + tags: [] + responses: + '200': + description: OK + operationId: getRouteWithDash + /items: + post: + summary: Create a new item + description: Create a new item + operationId: createItem + responses: + '200': + description: OK + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateItemRequest' + '/items/{id}': + put: + summary: Updates an item + description: Updates an item + operationId: updateItem + responses: + '200': + description: OK + content: + application/json: + schema: + type: string + format: uuid + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateItemRequest' + parameters: + - name: id + in: path + description: The id of the order + required: true + schema: + type: string + format: uuid + /tasks: + get: + operationId: getTasks + summary: Returns tasks + description: Returns tasks + tags: [] + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Tasks' + '/eventArgs/{id}': + parameters: + - name: id + in: path + description: The id of the eventArgs + required: true + schema: + type: string + get: + summary: Get EventArgs By Id + description: Get EventArgs By Id + tags: [] + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/EventArgs' + '404': + description: Not Found + operationId: getEventArgById + /eventArgs: + get: + operationId: getEventArgs + summary: Get EventArgs List + description: Get EventArgs List + tags: [] + responses: + '200': + description: OK + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/EventArgs' + '/files/{id}': + parameters: + - name: id + in: path + description: The file id + required: true + schema: + type: string + get: + operationId: getFileById + summary: Get File By Id + description: Get File By Id + tags: [] + responses: + '200': + description: OK + content: + application/octet-stream: + schema: + type: string + format: binary + headers: {} + '404': + description: Not Found + /files/form-data/singleObject: + post: + operationId: uploadSingleObjectWithFileAsFormData + summary: Upload a file as FormData + description: Upload a file as FormData + responses: + '200': + description: OK + '400': + description: Bad Request + requestBody: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/FileAsFormDataRequest' + parameters: [] + /files/form-data/singleObjectMultiFile: + post: + operationId: uploadSingleObjectWithFilesAsFormData + summary: Upload files as FormData + description: Upload files as FormData + responses: + '200': + description: OK + '400': + description: Bad Request + requestBody: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/FilesAsFormDataRequest' + parameters: [] + /files/form-data/singleFile: + post: + operationId: uploadSingleFileAsFormData + summary: Upload a file as OctetStream + description: Upload a file as OctetStream + responses: + '200': + description: OK + requestBody: + content: + application/octet-stream: + schema: + type: string + format: binary + parameters: [] + /files/form-data/multiFile: + post: + summary: Upload multi files as form data + description: Upload multi files as form data + operationId: uploadMultiFilesAsFormData + responses: + '200': + description: OK + requestBody: + content: + multipart/form-data: + schema: + type: array + items: + type: string + format: binary +components: + parameters: + pagingPageSize: + name: pageSize + in: query + required: true + schema: + type: integer + minimum: 1 + maximum: 100 + default: 10 + description: The numbers of items to return. + pagingPageIndex: + name: pageIndex + in: query + required: false + schema: + type: integer + minimum: 0 + default: 0 + description: The number of items to skip before starting to collect the result set. + queryString: + name: queryString + in: query + required: false + schema: + type: string + nullable: true + description: The query string. + queryStringArray: + name: queryStringArray + in: query + required: false + schema: + type: array + items: + type: string + nullable: true + description: The query array of string. + continuationToken: + name: continuationToken + in: query + required: false + schema: + type: string + nullable: true + description: The continuation token. + schemas: + Pagination: + type: object + title: Pagination + description: A item result subset of a data query. + properties: + pageSize: + type: number + description: The number of items to request. + pageIndex: + type: number + nullable: true + description: The given page index starting with 0. + queryString: + type: string + nullable: true + description: The query to filter items by. + continuationToken: + type: string + nullable: true + description: Token to indicate next result set. + count: + type: number + description: Items count in result set. + totalCount: + type: number + nullable: true + description: Total items count. + totalPages: + type: number + nullable: true + description: Total pages. + required: + - pageSize + - count + ProblemDetails: + type: object + title: ProblemDetails + description: 'A machine-readable format for specifying errors in HTTP API responses based on https://tools.ietf.org/html/rfc7807.' + properties: + type: + type: string + description: 'A URI reference [RFC3986] that identifies the problem type. This specification encourages that, when dereferenced, it provide human-readable documentation for the problem type (e.g., using HTML [W3C.REC-html5-20141028]).' + title: + type: string + description: 'A short, human-readable summary of the problem type.It SHOULD NOT change from occurrence to occurrence of the problem, except for purposes of localization(e.g., using proactive content negotiation; see[RFC7231], Section 3.4).' + status: + type: integer + format: int32 + description: 'The HTTP status code([RFC7231], Section 6) generated by the origin server for this occurrence of the problem.' + detail: + type: string + description: A human-readable explanation specific to this occurrence of the problem. + instance: + type: string + description: A URI reference that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced. + Order: + title: Order + description: |- + A single order. + Hallo description with multiline and no ending dot + type: object + x-examples: + MyExample: + id: 123 + name: Hallo world + MyExample2: {} + properties: + id: + type: string + format: uuid + description: + type: string + myTime: + type: string + format: time + myEmail: + type: string + format: email + default: a@a.com + myNullableDateTime: + type: string + format: date-time + nullable: true + myDateTime: + type: string + format: date-time + myNumber: + type: number + minimum: 1.1 + maximum: 20.2 + myInteger: + type: integer + maximum: 50 + default: 15 + myBool: + type: boolean + description: MyBool is great + myUri: + type: string + format: uri + description: 'This is the good uri :-)' + myByte: + type: string + format: byte + myStringList: + type: array + description: 'Hallo myStringList desc :-)' + items: + type: string + myLong: + type: integer + format: int64 + minimum: 10 + exclusiveMinimum: false + deliveryAddress: + $ref: '#/components/schemas/Address' + Orders: + description: A list of orders. + type: array + x-tags: + - Orders + title: Orders + items: + $ref: '#/components/schemas/Order' + GenderType: + title: GenderType + description: '' + type: object + properties: + gender: + type: string + description: The users gender type + enum: + - None + - NonBinary + - Male + - Female + required: + - gender + ColorType: + title: ColorType + description: '' + type: object + properties: + color: + type: string + description: The users color type + enum: + - None = 0 + - Black = 1 + - White = 2 + - Yellow = 4 + - Red = 8 + required: + - color + User: + title: User + description: A single user. + type: object + properties: + id: + type: string + format: uuid + example: 00000000-0000-0000-0000-000000000000 + gender: + $ref: '#/components/schemas/GenderType' + firstName: + type: string + lastName: + type: string + email: + type: string + format: email + example: email@email.dk + homepage: + type: string + format: uri + color: + $ref: '#/components/schemas/ColorType' + homeAddress: + $ref: '#/components/schemas/Address' + companyAddress: + $ref: '#/components/schemas/Address' + Users: + description: A list of users. + type: array + items: + $ref: '#/components/schemas/User' + x-tags: + - Users + title: Users + CreateUserRequest: + title: CreateUserRequest + description: Request to create a user + type: object + properties: + firstName: + type: string + lastName: + type: string + myNullableDateTime: + type: string + format: date-time + nullable: true + myDateTime: + type: string + format: date-time + email: + type: string + format: email + example: email@email.dk + homepage: + type: string + format: uri + gender: + $ref: '#/components/schemas/GenderType' + myNullableAddress: + nullable: true + oneOf: + - $ref: '#/components/schemas/Address' + tags: + type: object + additionalProperties: + type: string + desiredProperties1: + type: object + additionalProperties: + type: string + desiredProperties2: + type: object + nullable: true + additionalProperties: + type: string + desiredProperties3: + type: object + nullable: true + additionalProperties: + type: integer + required: + - firstName + - lastName + - myDateTime + - email + - gender + - tags + CreateUsersRequest: + description: A list of users. + type: array + x-tags: + - CreateUsersRequest + title: CreateUsersRequest + items: + $ref: '#/components/schemas/CreateUserRequest' + UpdateUserRequest: + title: UpdateUserRequest + description: Request to update a user + type: object + properties: + firstName: + type: string + lastName: + type: string + email: + type: string + format: email + example: email@email.dk + gender: + $ref: '#/components/schemas/GenderType' + UpdateTestGenderRequest: + title: Update test-gender Request + description: '' + type: object + properties: + gender: + $ref: '#/components/schemas/GenderType' + Address: + title: Address + type: object + properties: + streetName: + type: string + maxLength: 255 + streetNumber: + type: string + postalCode: + type: string + cityName: + type: string + myCountry: + $ref: '#/components/schemas/Country' + Country: + title: Country + type: object + properties: + name: + type: string + alpha2Code: + type: string + minLength: 2 + maxLength: 2 + pattern: '^[A-Za-z]{2}$' + alpha3Code: + type: string + minLength: 3 + maxLength: 3 + pattern: '^[A-Za-z]{3}$' + required: + - name + - alpha2Code + - alpha3Code + UpdateOrderRequest: + title: UpdateOrderRequest + description: Request to update an order + type: object + properties: + myEmail: + type: string + format: email + required: + - myEmail + Item: + title: Item + type: object + properties: + name: + type: string + required: + - name + CreateItemRequest: + title: CreateItemRequest + type: object + properties: + item: + $ref: '#/components/schemas/Item' + myItems: + type: array + items: + $ref: '#/components/schemas/Item' + required: + - item + - myItems + UpdateItemRequest: + title: UpdateItemRequest + type: object + properties: + item: + $ref: '#/components/schemas/Item' + required: + - item + Task: + title: Task + type: object + properties: + id: + type: string + format: uuid + name: + type: string + description: Describes a single task. + Tasks: + title: Tasks + type: array + items: + $ref: '#/components/schemas/Task' + description: Contains a list of Tasks + EventArgs: + title: EventArgs + type: object + properties: + id: + type: string + format: uuid + eventName: + type: string + FileAsFormDataRequest: + title: FileAsFormDataRequest + type: object + properties: + itemName: + type: string + file: + type: string + format: binary + nullable: true + items: + type: array + items: + type: string + required: + - itemName + - items + FilesAsFormDataRequest: + title: FilesAsFormDataRequest + type: object + properties: + files: + type: array + items: + type: string + format: binary + required: + - files + UpdateAccountRequest: + title: UpdateAccountRequest + type: object + properties: + name: + type: string \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Accounts/MyContracts/RequestParameters/SetAccountNameParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Accounts/MyContracts/RequestParameters/SetAccountNameParameters.verified.cs new file mode 100644 index 000000000..ebd55f30f --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Accounts/MyContracts/RequestParameters/SetAccountNameParameters.verified.cs @@ -0,0 +1,32 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Accounts.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Set name of account. +/// Operation: SetAccountName. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class SetAccountNameParameters +{ + /// + /// The accountId. + /// + [Required] + public Guid AccountId { get; set; } + + /// + /// UpdateAccountRequest. + /// + [Required] + public UpdateAccountRequest Request { get; set; } + + /// + public override string ToString() + => $"{nameof(AccountId)}: {AccountId}, {nameof(Request)}: ({Request})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Accounts/MyContracts/RequestParameters/UpdateAccountNameParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Accounts/MyContracts/RequestParameters/UpdateAccountNameParameters.verified.cs new file mode 100644 index 000000000..8a179d181 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Accounts/MyContracts/RequestParameters/UpdateAccountNameParameters.verified.cs @@ -0,0 +1,31 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Accounts.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Update name of account. +/// Operation: UpdateAccountName. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateAccountNameParameters +{ + /// + /// The accountId. + /// + [Required] + public Guid AccountId { get; set; } + + /// + /// The account name. + /// + public string Name { get; set; } + + /// + public override string ToString() + => $"{nameof(AccountId)}: {AccountId}, {nameof(Name)}: {Name}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Accounts/MyContracts/UpdateAccountRequest.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Accounts/MyContracts/UpdateAccountRequest.verified.cs new file mode 100644 index 000000000..892a401ed --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Accounts/MyContracts/UpdateAccountRequest.verified.cs @@ -0,0 +1,20 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Accounts.MyContracts; + +/// +/// UpdateAccountRequest. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateAccountRequest +{ + public string Name { get; set; } + + /// + public override string ToString() + => $"{nameof(Name)}: {Name}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Accounts/MyEndpoints/Interfaces/ISetAccountNameEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Accounts/MyEndpoints/Interfaces/ISetAccountNameEndpoint.verified.cs new file mode 100644 index 000000000..7dd9edc6d --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Accounts/MyEndpoints/Interfaces/ISetAccountNameEndpoint.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Accounts.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint. +/// Description: Set name of account. +/// Operation: SetAccountName. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface ISetAccountNameEndpoint +{ + /// + /// Execute method. + /// + /// The parameters. + /// The http client name. + /// The cancellation token. + Task ExecuteAsync( + SetAccountNameParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Accounts/MyEndpoints/Interfaces/ISetAccountNameEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Accounts/MyEndpoints/Interfaces/ISetAccountNameEndpointResult.verified.cs new file mode 100644 index 000000000..193943fc9 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Accounts/MyEndpoints/Interfaces/ISetAccountNameEndpointResult.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Accounts.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint Result. +/// Description: Set name of account. +/// Operation: SetAccountName. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface ISetAccountNameEndpointResult : IEndpointResponse +{ + + bool IsOk { get; } + + bool IsBadRequest { get; } + + string? OkContent { get; } + + string? BadRequestContent { get; } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Accounts/MyEndpoints/Interfaces/IUpdateAccountNameEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Accounts/MyEndpoints/Interfaces/IUpdateAccountNameEndpoint.verified.cs new file mode 100644 index 000000000..ae216ccb0 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Accounts/MyEndpoints/Interfaces/IUpdateAccountNameEndpoint.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Accounts.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint. +/// Description: Update name of account. +/// Operation: UpdateAccountName. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IUpdateAccountNameEndpoint +{ + /// + /// Execute method. + /// + /// The parameters. + /// The http client name. + /// The cancellation token. + Task ExecuteAsync( + UpdateAccountNameParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Accounts/MyEndpoints/Interfaces/IUpdateAccountNameEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Accounts/MyEndpoints/Interfaces/IUpdateAccountNameEndpointResult.verified.cs new file mode 100644 index 000000000..7e9545d99 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Accounts/MyEndpoints/Interfaces/IUpdateAccountNameEndpointResult.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Accounts.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint Result. +/// Description: Update name of account. +/// Operation: UpdateAccountName. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IUpdateAccountNameEndpointResult : IEndpointResponse +{ + + bool IsOk { get; } + + bool IsBadRequest { get; } + + string? OkContent { get; } + + string? BadRequestContent { get; } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Accounts/MyEndpoints/SetAccountNameEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Accounts/MyEndpoints/SetAccountNameEndpoint.verified.cs new file mode 100644 index 000000000..1f717bf17 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Accounts/MyEndpoints/SetAccountNameEndpoint.verified.cs @@ -0,0 +1,47 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Accounts.MyEndpoints; + +/// +/// Client Endpoint. +/// Description: Set name of account. +/// Operation: SetAccountName. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class SetAccountNameEndpoint : ISetAccountNameEndpoint +{ + private readonly IHttpClientFactory factory; + private readonly IHttpMessageFactory httpMessageFactory; + + public SetAccountNameEndpoint( + IHttpClientFactory factory, + IHttpMessageFactory httpMessageFactory) + { + this.factory = factory; + this.httpMessageFactory = httpMessageFactory; + } + + public async Task ExecuteAsync( + SetAccountNameParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default) + { + var client = factory.CreateClient(httpClientName); + + var requestBuilder = httpMessageFactory.FromTemplate("/api/v1/accounts/{accountId}/name"); + requestBuilder.WithPathParameter("accountId", parameters.AccountId); + requestBuilder.WithBody(parameters.Request); + + using var requestMessage = requestBuilder.Build(HttpMethod.Post); + using var response = await client.SendAsync(requestMessage, cancellationToken); + + var responseBuilder = httpMessageFactory.FromResponse(response); + responseBuilder.AddSuccessResponse(HttpStatusCode.OK); + responseBuilder.AddErrorResponse(HttpStatusCode.BadRequest); + return await responseBuilder.BuildResponseAsync(x => new SetAccountNameEndpointResult(x), cancellationToken); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Accounts/MyEndpoints/SetAccountNameEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Accounts/MyEndpoints/SetAccountNameEndpointResult.verified.cs new file mode 100644 index 000000000..59cbff3da --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Accounts/MyEndpoints/SetAccountNameEndpointResult.verified.cs @@ -0,0 +1,37 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Accounts.MyEndpoints; + +/// +/// Client Endpoint result. +/// Description: Set name of account. +/// Operation: SetAccountName. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class SetAccountNameEndpointResult : EndpointResponse, ISetAccountNameEndpointResult +{ + public SetAccountNameEndpointResult(EndpointResponse response) + : base(response) + { + } + + public bool IsOk + => StatusCode == HttpStatusCode.OK; + + public bool IsBadRequest + => StatusCode == HttpStatusCode.BadRequest; + + public string? OkContent + => IsOk && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsOk property first."); + + public string? BadRequestContent + => IsBadRequest && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsBadRequest property first."); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Accounts/MyEndpoints/UpdateAccountNameEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Accounts/MyEndpoints/UpdateAccountNameEndpoint.verified.cs new file mode 100644 index 000000000..9128f0b5e --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Accounts/MyEndpoints/UpdateAccountNameEndpoint.verified.cs @@ -0,0 +1,47 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Accounts.MyEndpoints; + +/// +/// Client Endpoint. +/// Description: Update name of account. +/// Operation: UpdateAccountName. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateAccountNameEndpoint : IUpdateAccountNameEndpoint +{ + private readonly IHttpClientFactory factory; + private readonly IHttpMessageFactory httpMessageFactory; + + public UpdateAccountNameEndpoint( + IHttpClientFactory factory, + IHttpMessageFactory httpMessageFactory) + { + this.factory = factory; + this.httpMessageFactory = httpMessageFactory; + } + + public async Task ExecuteAsync( + UpdateAccountNameParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default) + { + var client = factory.CreateClient(httpClientName); + + var requestBuilder = httpMessageFactory.FromTemplate("/api/v1/accounts/{accountId}/name"); + requestBuilder.WithPathParameter("accountId", parameters.AccountId); + requestBuilder.WithHeaderParameter("name", parameters.Name); + + using var requestMessage = requestBuilder.Build(HttpMethod.Put); + using var response = await client.SendAsync(requestMessage, cancellationToken); + + var responseBuilder = httpMessageFactory.FromResponse(response); + responseBuilder.AddSuccessResponse(HttpStatusCode.OK); + responseBuilder.AddErrorResponse(HttpStatusCode.BadRequest); + return await responseBuilder.BuildResponseAsync(x => new UpdateAccountNameEndpointResult(x), cancellationToken); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Accounts/MyEndpoints/UpdateAccountNameEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Accounts/MyEndpoints/UpdateAccountNameEndpointResult.verified.cs new file mode 100644 index 000000000..855d4cacc --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Accounts/MyEndpoints/UpdateAccountNameEndpointResult.verified.cs @@ -0,0 +1,37 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Accounts.MyEndpoints; + +/// +/// Client Endpoint result. +/// Description: Update name of account. +/// Operation: UpdateAccountName. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateAccountNameEndpointResult : EndpointResponse, IUpdateAccountNameEndpointResult +{ + public UpdateAccountNameEndpointResult(EndpointResponse response) + : base(response) + { + } + + public bool IsOk + => StatusCode == HttpStatusCode.OK; + + public bool IsBadRequest + => StatusCode == HttpStatusCode.BadRequest; + + public string? OkContent + => IsOk && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsOk property first."); + + public string? BadRequestContent + => IsBadRequest && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsBadRequest property first."); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Addresses/MyContracts/RequestParameters/GetAddressesByPostalCodesParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Addresses/MyContracts/RequestParameters/GetAddressesByPostalCodesParameters.verified.cs new file mode 100644 index 000000000..4a4dccec8 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Addresses/MyContracts/RequestParameters/GetAddressesByPostalCodesParameters.verified.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Addresses.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Get addresses by postal code. +/// Operation: GetAddressesByPostalCodes. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetAddressesByPostalCodesParameters +{ + /// + /// The postalCode to limit addresses on. + /// + [Required] + public string PostalCode { get; set; } + + /// + public override string ToString() + => $"{nameof(PostalCode)}: {PostalCode}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Addresses/MyEndpoints/GetAddressesByPostalCodesEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Addresses/MyEndpoints/GetAddressesByPostalCodesEndpoint.verified.cs new file mode 100644 index 000000000..a29fbb34e --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Addresses/MyEndpoints/GetAddressesByPostalCodesEndpoint.verified.cs @@ -0,0 +1,47 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Addresses.MyEndpoints; + +/// +/// Client Endpoint. +/// Description: Get addresses by postal code. +/// Operation: GetAddressesByPostalCodes. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetAddressesByPostalCodesEndpoint : IGetAddressesByPostalCodesEndpoint +{ + private readonly IHttpClientFactory factory; + private readonly IHttpMessageFactory httpMessageFactory; + + public GetAddressesByPostalCodesEndpoint( + IHttpClientFactory factory, + IHttpMessageFactory httpMessageFactory) + { + this.factory = factory; + this.httpMessageFactory = httpMessageFactory; + } + + public async Task ExecuteAsync( + GetAddressesByPostalCodesParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default) + { + var client = factory.CreateClient(httpClientName); + + var requestBuilder = httpMessageFactory.FromTemplate("/api/v1/addresses/{postalCode}"); + requestBuilder.WithPathParameter("postalCode", parameters.PostalCode); + + using var requestMessage = requestBuilder.Build(HttpMethod.Get); + using var response = await client.SendAsync(requestMessage, cancellationToken); + + var responseBuilder = httpMessageFactory.FromResponse(response); + responseBuilder.AddSuccessResponse>(HttpStatusCode.OK); + responseBuilder.AddErrorResponse(HttpStatusCode.BadRequest); + responseBuilder.AddErrorResponse(HttpStatusCode.NotFound); + return await responseBuilder.BuildResponseAsync(x => new GetAddressesByPostalCodesEndpointResult(x), cancellationToken); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Addresses/MyEndpoints/GetAddressesByPostalCodesEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Addresses/MyEndpoints/GetAddressesByPostalCodesEndpointResult.verified.cs new file mode 100644 index 000000000..bcc846862 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Addresses/MyEndpoints/GetAddressesByPostalCodesEndpointResult.verified.cs @@ -0,0 +1,45 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Addresses.MyEndpoints; + +/// +/// Client Endpoint result. +/// Description: Get addresses by postal code. +/// Operation: GetAddressesByPostalCodes. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetAddressesByPostalCodesEndpointResult : EndpointResponse, IGetAddressesByPostalCodesEndpointResult +{ + public GetAddressesByPostalCodesEndpointResult(EndpointResponse response) + : base(response) + { + } + + public bool IsOk + => StatusCode == HttpStatusCode.OK; + + public bool IsBadRequest + => StatusCode == HttpStatusCode.BadRequest; + + public bool IsNotFound + => StatusCode == HttpStatusCode.NotFound; + + public IEnumerable
OkContent + => IsOk && ContentObject is IEnumerable
result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsOk property first."); + + public string? BadRequestContent + => IsBadRequest && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsBadRequest property first."); + + public string? NotFoundContent + => IsNotFound && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsNotFound property first."); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Addresses/MyEndpoints/Interfaces/IGetAddressesByPostalCodesEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Addresses/MyEndpoints/Interfaces/IGetAddressesByPostalCodesEndpoint.verified.cs new file mode 100644 index 000000000..caec7e29d --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Addresses/MyEndpoints/Interfaces/IGetAddressesByPostalCodesEndpoint.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Addresses.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint. +/// Description: Get addresses by postal code. +/// Operation: GetAddressesByPostalCodes. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetAddressesByPostalCodesEndpoint +{ + /// + /// Execute method. + /// + /// The parameters. + /// The http client name. + /// The cancellation token. + Task ExecuteAsync( + GetAddressesByPostalCodesParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Addresses/MyEndpoints/Interfaces/IGetAddressesByPostalCodesEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Addresses/MyEndpoints/Interfaces/IGetAddressesByPostalCodesEndpointResult.verified.cs new file mode 100644 index 000000000..f0f654b9b --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Addresses/MyEndpoints/Interfaces/IGetAddressesByPostalCodesEndpointResult.verified.cs @@ -0,0 +1,29 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Addresses.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint Result. +/// Description: Get addresses by postal code. +/// Operation: GetAddressesByPostalCodes. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetAddressesByPostalCodesEndpointResult : IEndpointResponse +{ + + bool IsOk { get; } + + bool IsBadRequest { get; } + + bool IsNotFound { get; } + + IEnumerable
OkContent { get; } + + string? BadRequestContent { get; } + + string? NotFoundContent { get; } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/EventArgs/MyContracts/EventArgs.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/EventArgs/MyContracts/EventArgs.verified.cs new file mode 100644 index 000000000..ca95a836d --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/EventArgs/MyContracts/EventArgs.verified.cs @@ -0,0 +1,22 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.EventArgs.MyContracts; + +/// +/// EventArgs. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class EventArgs +{ + public Guid Id { get; set; } + + public string EventName { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}, {nameof(EventName)}: {EventName}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/EventArgs/MyContracts/RequestParameters/GetEventArgByIdParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/EventArgs/MyContracts/RequestParameters/GetEventArgByIdParameters.verified.cs new file mode 100644 index 000000000..4509c563c --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/EventArgs/MyContracts/RequestParameters/GetEventArgByIdParameters.verified.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.EventArgs.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Get EventArgs By Id. +/// Operation: GetEventArgById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetEventArgByIdParameters +{ + /// + /// The id of the eventArgs. + /// + [Required] + public string Id { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/EventArgs/MyEndpoints/GetEventArgByIdEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/EventArgs/MyEndpoints/GetEventArgByIdEndpoint.verified.cs new file mode 100644 index 000000000..d19708e64 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/EventArgs/MyEndpoints/GetEventArgByIdEndpoint.verified.cs @@ -0,0 +1,47 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.EventArgs.MyEndpoints; + +/// +/// Client Endpoint. +/// Description: Get EventArgs By Id. +/// Operation: GetEventArgById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetEventArgByIdEndpoint : IGetEventArgByIdEndpoint +{ + private readonly IHttpClientFactory factory; + private readonly IHttpMessageFactory httpMessageFactory; + + public GetEventArgByIdEndpoint( + IHttpClientFactory factory, + IHttpMessageFactory httpMessageFactory) + { + this.factory = factory; + this.httpMessageFactory = httpMessageFactory; + } + + public async Task ExecuteAsync( + GetEventArgByIdParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default) + { + var client = factory.CreateClient(httpClientName); + + var requestBuilder = httpMessageFactory.FromTemplate("/api/v1/eventArgs/{id}"); + requestBuilder.WithPathParameter("id", parameters.Id); + + using var requestMessage = requestBuilder.Build(HttpMethod.Get); + using var response = await client.SendAsync(requestMessage, cancellationToken); + + var responseBuilder = httpMessageFactory.FromResponse(response); + responseBuilder.AddSuccessResponse(HttpStatusCode.OK); + responseBuilder.AddErrorResponse(HttpStatusCode.BadRequest); + responseBuilder.AddErrorResponse(HttpStatusCode.NotFound); + return await responseBuilder.BuildResponseAsync(x => new GetEventArgByIdEndpointResult(x), cancellationToken); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/EventArgs/MyEndpoints/GetEventArgByIdEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/EventArgs/MyEndpoints/GetEventArgByIdEndpointResult.verified.cs new file mode 100644 index 000000000..14decc6ca --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/EventArgs/MyEndpoints/GetEventArgByIdEndpointResult.verified.cs @@ -0,0 +1,45 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.EventArgs.MyEndpoints; + +/// +/// Client Endpoint result. +/// Description: Get EventArgs By Id. +/// Operation: GetEventArgById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetEventArgByIdEndpointResult : EndpointResponse, IGetEventArgByIdEndpointResult +{ + public GetEventArgByIdEndpointResult(EndpointResponse response) + : base(response) + { + } + + public bool IsOk + => StatusCode == HttpStatusCode.OK; + + public bool IsBadRequest + => StatusCode == HttpStatusCode.BadRequest; + + public bool IsNotFound + => StatusCode == HttpStatusCode.NotFound; + + public Structure1.ApiClient.Generated.EventArgs.MyContracts.EventArgs OkContent + => IsOk && ContentObject is Structure1.ApiClient.Generated.EventArgs.MyContracts.EventArgs result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsOk property first."); + + public string? BadRequestContent + => IsBadRequest && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsBadRequest property first."); + + public string? NotFoundContent + => IsNotFound && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsNotFound property first."); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/EventArgs/MyEndpoints/GetEventArgsEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/EventArgs/MyEndpoints/GetEventArgsEndpoint.verified.cs new file mode 100644 index 000000000..afdd09edf --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/EventArgs/MyEndpoints/GetEventArgsEndpoint.verified.cs @@ -0,0 +1,43 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.EventArgs.MyEndpoints; + +/// +/// Client Endpoint. +/// Description: Get EventArgs List. +/// Operation: GetEventArgs. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetEventArgsEndpoint : IGetEventArgsEndpoint +{ + private readonly IHttpClientFactory factory; + private readonly IHttpMessageFactory httpMessageFactory; + + public GetEventArgsEndpoint( + IHttpClientFactory factory, + IHttpMessageFactory httpMessageFactory) + { + this.factory = factory; + this.httpMessageFactory = httpMessageFactory; + } + + public async Task ExecuteAsync( + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default) + { + var client = factory.CreateClient(httpClientName); + + var requestBuilder = httpMessageFactory.FromTemplate("/api/v1/eventArgs"); + + using var requestMessage = requestBuilder.Build(HttpMethod.Get); + using var response = await client.SendAsync(requestMessage, cancellationToken); + + var responseBuilder = httpMessageFactory.FromResponse(response); + responseBuilder.AddSuccessResponse>(HttpStatusCode.OK); + return await responseBuilder.BuildResponseAsync(x => new GetEventArgsEndpointResult(x), cancellationToken); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/EventArgs/MyEndpoints/GetEventArgsEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/EventArgs/MyEndpoints/GetEventArgsEndpointResult.verified.cs new file mode 100644 index 000000000..5b80591b1 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/EventArgs/MyEndpoints/GetEventArgsEndpointResult.verified.cs @@ -0,0 +1,29 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.EventArgs.MyEndpoints; + +/// +/// Client Endpoint result. +/// Description: Get EventArgs List. +/// Operation: GetEventArgs. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetEventArgsEndpointResult : EndpointResponse, IGetEventArgsEndpointResult +{ + public GetEventArgsEndpointResult(EndpointResponse response) + : base(response) + { + } + + public bool IsOk + => StatusCode == HttpStatusCode.OK; + + public IEnumerable OkContent + => IsOk && ContentObject is IEnumerable result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsOk property first."); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/EventArgs/MyEndpoints/Interfaces/IGetEventArgByIdEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/EventArgs/MyEndpoints/Interfaces/IGetEventArgByIdEndpoint.verified.cs new file mode 100644 index 000000000..b92c64595 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/EventArgs/MyEndpoints/Interfaces/IGetEventArgByIdEndpoint.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.EventArgs.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint. +/// Description: Get EventArgs By Id. +/// Operation: GetEventArgById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetEventArgByIdEndpoint +{ + /// + /// Execute method. + /// + /// The parameters. + /// The http client name. + /// The cancellation token. + Task ExecuteAsync( + GetEventArgByIdParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/EventArgs/MyEndpoints/Interfaces/IGetEventArgByIdEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/EventArgs/MyEndpoints/Interfaces/IGetEventArgByIdEndpointResult.verified.cs new file mode 100644 index 000000000..7efd544e1 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/EventArgs/MyEndpoints/Interfaces/IGetEventArgByIdEndpointResult.verified.cs @@ -0,0 +1,29 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.EventArgs.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint Result. +/// Description: Get EventArgs By Id. +/// Operation: GetEventArgById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetEventArgByIdEndpointResult : IEndpointResponse +{ + + bool IsOk { get; } + + bool IsBadRequest { get; } + + bool IsNotFound { get; } + + Structure1.ApiClient.Generated.EventArgs.MyContracts.EventArgs OkContent { get; } + + string? BadRequestContent { get; } + + string? NotFoundContent { get; } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/EventArgs/MyEndpoints/Interfaces/IGetEventArgsEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/EventArgs/MyEndpoints/Interfaces/IGetEventArgsEndpoint.verified.cs new file mode 100644 index 000000000..e09fea10a --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/EventArgs/MyEndpoints/Interfaces/IGetEventArgsEndpoint.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.EventArgs.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint. +/// Description: Get EventArgs List. +/// Operation: GetEventArgs. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetEventArgsEndpoint +{ + /// + /// Execute method. + /// + /// The http client name. + /// The cancellation token. + Task ExecuteAsync( + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/EventArgs/MyEndpoints/Interfaces/IGetEventArgsEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/EventArgs/MyEndpoints/Interfaces/IGetEventArgsEndpointResult.verified.cs new file mode 100644 index 000000000..4b09921d4 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/EventArgs/MyEndpoints/Interfaces/IGetEventArgsEndpointResult.verified.cs @@ -0,0 +1,21 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.EventArgs.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint Result. +/// Description: Get EventArgs List. +/// Operation: GetEventArgs. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetEventArgsEndpointResult : IEndpointResponse +{ + + bool IsOk { get; } + + IEnumerable OkContent { get; } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyContracts/FileAsFormDataRequest.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyContracts/FileAsFormDataRequest.verified.cs new file mode 100644 index 000000000..130183d18 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyContracts/FileAsFormDataRequest.verified.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyContracts; + +/// +/// FileAsFormDataRequest. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class FileAsFormDataRequest +{ + [Required] + public string ItemName { get; set; } + + public IFormFile? File { get; set; } + + [Required] + public List Items { get; set; } + + /// + public override string ToString() + => $"{nameof(ItemName)}: {ItemName}, {nameof(File)}: {File}, {nameof(Items)}.Count: {Items?.Count ?? 0}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyContracts/FilesAsFormDataRequest.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyContracts/FilesAsFormDataRequest.verified.cs new file mode 100644 index 000000000..72a31c919 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyContracts/FilesAsFormDataRequest.verified.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyContracts; + +/// +/// FilesAsFormDataRequest. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class FilesAsFormDataRequest +{ + /// + /// A list of File(s). + /// + public List Files { get; set; } = new List(); + + /// + public override string ToString() + => $"{nameof(Files)}.Count: {Files?.Count ?? 0}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyContracts/RequestParameters/GetFileByIdParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyContracts/RequestParameters/GetFileByIdParameters.verified.cs new file mode 100644 index 000000000..b7569e00f --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyContracts/RequestParameters/GetFileByIdParameters.verified.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Get File By Id. +/// Operation: GetFileById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetFileByIdParameters +{ + /// + /// The file id. + /// + [Required] + public string Id { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyContracts/RequestParameters/UploadMultiFilesAsFormDataParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyContracts/RequestParameters/UploadMultiFilesAsFormDataParameters.verified.cs new file mode 100644 index 000000000..71ac6707b --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyContracts/RequestParameters/UploadMultiFilesAsFormDataParameters.verified.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Upload multi files as form data. +/// Operation: UploadMultiFilesAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UploadMultiFilesAsFormDataParameters +{ + [Required] + public List Request { get; set; } = new List(); + + /// + public override string ToString() + => $"{nameof(Request)}.Count: {Request?.Count ?? 0}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyContracts/RequestParameters/UploadSingleFileAsFormDataParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyContracts/RequestParameters/UploadSingleFileAsFormDataParameters.verified.cs new file mode 100644 index 000000000..ba28c10f2 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyContracts/RequestParameters/UploadSingleFileAsFormDataParameters.verified.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Upload a file as OctetStream. +/// Operation: UploadSingleFileAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UploadSingleFileAsFormDataParameters +{ + [Required] + public IFormFile Request { get; set; } + + /// + public override string ToString() + => $"{nameof(Request)}: ({Request})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyContracts/RequestParameters/UploadSingleObjectWithFileAsFormDataParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyContracts/RequestParameters/UploadSingleObjectWithFileAsFormDataParameters.verified.cs new file mode 100644 index 000000000..ab3f552f2 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyContracts/RequestParameters/UploadSingleObjectWithFileAsFormDataParameters.verified.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Upload a file as FormData. +/// Operation: UploadSingleObjectWithFileAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UploadSingleObjectWithFileAsFormDataParameters +{ + /// + /// FileAsFormDataRequest. + /// + [Required] + public FileAsFormDataRequest Request { get; set; } + + /// + public override string ToString() + => $"{nameof(Request)}: ({Request})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyContracts/RequestParameters/UploadSingleObjectWithFilesAsFormDataParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyContracts/RequestParameters/UploadSingleObjectWithFilesAsFormDataParameters.verified.cs new file mode 100644 index 000000000..5e2d14dca --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyContracts/RequestParameters/UploadSingleObjectWithFilesAsFormDataParameters.verified.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Upload files as FormData. +/// Operation: UploadSingleObjectWithFilesAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UploadSingleObjectWithFilesAsFormDataParameters +{ + /// + /// FilesAsFormDataRequest. + /// + [Required] + public FilesAsFormDataRequest Request { get; set; } + + /// + public override string ToString() + => $"{nameof(Request)}: ({Request})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/GetFileByIdEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/GetFileByIdEndpoint.verified.cs new file mode 100644 index 000000000..17242b471 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/GetFileByIdEndpoint.verified.cs @@ -0,0 +1,47 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyEndpoints; + +/// +/// Client Endpoint. +/// Description: Get File By Id. +/// Operation: GetFileById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetFileByIdEndpoint : IGetFileByIdEndpoint +{ + private readonly IHttpClientFactory factory; + private readonly IHttpMessageFactory httpMessageFactory; + + public GetFileByIdEndpoint( + IHttpClientFactory factory, + IHttpMessageFactory httpMessageFactory) + { + this.factory = factory; + this.httpMessageFactory = httpMessageFactory; + } + + public async Task ExecuteAsync( + GetFileByIdParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default) + { + var client = factory.CreateClient(httpClientName); + + var requestBuilder = httpMessageFactory.FromTemplate("/api/v1/files/{id}"); + requestBuilder.WithPathParameter("id", parameters.Id); + + using var requestMessage = requestBuilder.Build(HttpMethod.Get); + using var response = await client.SendAsync(requestMessage, cancellationToken); + + var responseBuilder = httpMessageFactory.FromResponse(response); + responseBuilder.AddSuccessResponse(HttpStatusCode.OK); + responseBuilder.AddErrorResponse(HttpStatusCode.BadRequest); + responseBuilder.AddErrorResponse(HttpStatusCode.NotFound); + return await responseBuilder.BuildResponseAsync(x => new GetFileByIdEndpointResult(x), cancellationToken); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/GetFileByIdEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/GetFileByIdEndpointResult.verified.cs new file mode 100644 index 000000000..b9a6c73b3 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/GetFileByIdEndpointResult.verified.cs @@ -0,0 +1,45 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyEndpoints; + +/// +/// Client Endpoint result. +/// Description: Get File By Id. +/// Operation: GetFileById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetFileByIdEndpointResult : EndpointResponse, IGetFileByIdEndpointResult +{ + public GetFileByIdEndpointResult(EndpointResponse response) + : base(response) + { + } + + public bool IsOk + => StatusCode == HttpStatusCode.OK; + + public bool IsBadRequest + => StatusCode == HttpStatusCode.BadRequest; + + public bool IsNotFound + => StatusCode == HttpStatusCode.NotFound; + + public byte[] OkContent + => IsOk && ContentObject is byte[] result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsOk property first."); + + public string? BadRequestContent + => IsBadRequest && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsBadRequest property first."); + + public string? NotFoundContent + => IsNotFound && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsNotFound property first."); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IGetFileByIdEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IGetFileByIdEndpoint.verified.cs new file mode 100644 index 000000000..3ecf63afd --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IGetFileByIdEndpoint.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint. +/// Description: Get File By Id. +/// Operation: GetFileById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetFileByIdEndpoint +{ + /// + /// Execute method. + /// + /// The parameters. + /// The http client name. + /// The cancellation token. + Task ExecuteAsync( + GetFileByIdParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IGetFileByIdEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IGetFileByIdEndpointResult.verified.cs new file mode 100644 index 000000000..a8aaf73c5 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IGetFileByIdEndpointResult.verified.cs @@ -0,0 +1,29 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint Result. +/// Description: Get File By Id. +/// Operation: GetFileById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetFileByIdEndpointResult : IEndpointResponse +{ + + bool IsOk { get; } + + bool IsBadRequest { get; } + + bool IsNotFound { get; } + + byte[] OkContent { get; } + + string? BadRequestContent { get; } + + string? NotFoundContent { get; } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IUploadMultiFilesAsFormDataEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IUploadMultiFilesAsFormDataEndpoint.verified.cs new file mode 100644 index 000000000..d4cacc231 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IUploadMultiFilesAsFormDataEndpoint.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint. +/// Description: Upload multi files as form data. +/// Operation: UploadMultiFilesAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IUploadMultiFilesAsFormDataEndpoint +{ + /// + /// Execute method. + /// + /// The parameters. + /// The http client name. + /// The cancellation token. + Task ExecuteAsync( + UploadMultiFilesAsFormDataParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IUploadMultiFilesAsFormDataEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IUploadMultiFilesAsFormDataEndpointResult.verified.cs new file mode 100644 index 000000000..9fdb7f754 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IUploadMultiFilesAsFormDataEndpointResult.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint Result. +/// Description: Upload multi files as form data. +/// Operation: UploadMultiFilesAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IUploadMultiFilesAsFormDataEndpointResult : IEndpointResponse +{ + + bool IsOk { get; } + + bool IsBadRequest { get; } + + string? OkContent { get; } + + string? BadRequestContent { get; } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IUploadSingleFileAsFormDataEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IUploadSingleFileAsFormDataEndpoint.verified.cs new file mode 100644 index 000000000..fde836c91 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IUploadSingleFileAsFormDataEndpoint.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint. +/// Description: Upload a file as OctetStream. +/// Operation: UploadSingleFileAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IUploadSingleFileAsFormDataEndpoint +{ + /// + /// Execute method. + /// + /// The parameters. + /// The http client name. + /// The cancellation token. + Task ExecuteAsync( + UploadSingleFileAsFormDataParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IUploadSingleFileAsFormDataEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IUploadSingleFileAsFormDataEndpointResult.verified.cs new file mode 100644 index 000000000..b4f4862f2 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IUploadSingleFileAsFormDataEndpointResult.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint Result. +/// Description: Upload a file as OctetStream. +/// Operation: UploadSingleFileAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IUploadSingleFileAsFormDataEndpointResult : IEndpointResponse +{ + + bool IsOk { get; } + + bool IsBadRequest { get; } + + string? OkContent { get; } + + string? BadRequestContent { get; } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IUploadSingleObjectWithFileAsFormDataEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IUploadSingleObjectWithFileAsFormDataEndpoint.verified.cs new file mode 100644 index 000000000..860964fd7 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IUploadSingleObjectWithFileAsFormDataEndpoint.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint. +/// Description: Upload a file as FormData. +/// Operation: UploadSingleObjectWithFileAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IUploadSingleObjectWithFileAsFormDataEndpoint +{ + /// + /// Execute method. + /// + /// The parameters. + /// The http client name. + /// The cancellation token. + Task ExecuteAsync( + UploadSingleObjectWithFileAsFormDataParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IUploadSingleObjectWithFileAsFormDataEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IUploadSingleObjectWithFileAsFormDataEndpointResult.verified.cs new file mode 100644 index 000000000..490971ab0 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IUploadSingleObjectWithFileAsFormDataEndpointResult.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint Result. +/// Description: Upload a file as FormData. +/// Operation: UploadSingleObjectWithFileAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IUploadSingleObjectWithFileAsFormDataEndpointResult : IEndpointResponse +{ + + bool IsOk { get; } + + bool IsBadRequest { get; } + + string? OkContent { get; } + + string? BadRequestContent { get; } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IUploadSingleObjectWithFilesAsFormDataEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IUploadSingleObjectWithFilesAsFormDataEndpoint.verified.cs new file mode 100644 index 000000000..dbae2f9b1 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IUploadSingleObjectWithFilesAsFormDataEndpoint.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint. +/// Description: Upload files as FormData. +/// Operation: UploadSingleObjectWithFilesAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IUploadSingleObjectWithFilesAsFormDataEndpoint +{ + /// + /// Execute method. + /// + /// The parameters. + /// The http client name. + /// The cancellation token. + Task ExecuteAsync( + UploadSingleObjectWithFilesAsFormDataParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IUploadSingleObjectWithFilesAsFormDataEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IUploadSingleObjectWithFilesAsFormDataEndpointResult.verified.cs new file mode 100644 index 000000000..4c24174ef --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IUploadSingleObjectWithFilesAsFormDataEndpointResult.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint Result. +/// Description: Upload files as FormData. +/// Operation: UploadSingleObjectWithFilesAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IUploadSingleObjectWithFilesAsFormDataEndpointResult : IEndpointResponse +{ + + bool IsOk { get; } + + bool IsBadRequest { get; } + + string? OkContent { get; } + + string? BadRequestContent { get; } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/UploadMultiFilesAsFormDataEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/UploadMultiFilesAsFormDataEndpoint.verified.cs new file mode 100644 index 000000000..675bccc3c --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/UploadMultiFilesAsFormDataEndpoint.verified.cs @@ -0,0 +1,46 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyEndpoints; + +/// +/// Client Endpoint. +/// Description: Upload multi files as form data. +/// Operation: UploadMultiFilesAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UploadMultiFilesAsFormDataEndpoint : IUploadMultiFilesAsFormDataEndpoint +{ + private readonly IHttpClientFactory factory; + private readonly IHttpMessageFactory httpMessageFactory; + + public UploadMultiFilesAsFormDataEndpoint( + IHttpClientFactory factory, + IHttpMessageFactory httpMessageFactory) + { + this.factory = factory; + this.httpMessageFactory = httpMessageFactory; + } + + public async Task ExecuteAsync( + UploadMultiFilesAsFormDataParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default) + { + var client = factory.CreateClient(httpClientName); + + var requestBuilder = httpMessageFactory.FromTemplate("/api/v1/files/form-data/multiFile"); + // TODO: Imp. With-Form + + using var requestMessage = requestBuilder.Build(HttpMethod.Post); + using var response = await client.SendAsync(requestMessage, cancellationToken); + + var responseBuilder = httpMessageFactory.FromResponse(response); + responseBuilder.AddSuccessResponse(HttpStatusCode.OK); + responseBuilder.AddErrorResponse(HttpStatusCode.BadRequest); + return await responseBuilder.BuildResponseAsync(x => new UploadMultiFilesAsFormDataEndpointResult(x), cancellationToken); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/UploadMultiFilesAsFormDataEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/UploadMultiFilesAsFormDataEndpointResult.verified.cs new file mode 100644 index 000000000..4acf140ac --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/UploadMultiFilesAsFormDataEndpointResult.verified.cs @@ -0,0 +1,37 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyEndpoints; + +/// +/// Client Endpoint result. +/// Description: Upload multi files as form data. +/// Operation: UploadMultiFilesAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UploadMultiFilesAsFormDataEndpointResult : EndpointResponse, IUploadMultiFilesAsFormDataEndpointResult +{ + public UploadMultiFilesAsFormDataEndpointResult(EndpointResponse response) + : base(response) + { + } + + public bool IsOk + => StatusCode == HttpStatusCode.OK; + + public bool IsBadRequest + => StatusCode == HttpStatusCode.BadRequest; + + public string? OkContent + => IsOk && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsOk property first."); + + public string? BadRequestContent + => IsBadRequest && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsBadRequest property first."); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/UploadSingleFileAsFormDataEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/UploadSingleFileAsFormDataEndpoint.verified.cs new file mode 100644 index 000000000..d7b5294c9 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/UploadSingleFileAsFormDataEndpoint.verified.cs @@ -0,0 +1,46 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyEndpoints; + +/// +/// Client Endpoint. +/// Description: Upload a file as OctetStream. +/// Operation: UploadSingleFileAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UploadSingleFileAsFormDataEndpoint : IUploadSingleFileAsFormDataEndpoint +{ + private readonly IHttpClientFactory factory; + private readonly IHttpMessageFactory httpMessageFactory; + + public UploadSingleFileAsFormDataEndpoint( + IHttpClientFactory factory, + IHttpMessageFactory httpMessageFactory) + { + this.factory = factory; + this.httpMessageFactory = httpMessageFactory; + } + + public async Task ExecuteAsync( + UploadSingleFileAsFormDataParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default) + { + var client = factory.CreateClient(httpClientName); + + var requestBuilder = httpMessageFactory.FromTemplate("/api/v1/files/form-data/singleFile"); + requestBuilder.WithBody(parameters.Request); + + using var requestMessage = requestBuilder.Build(HttpMethod.Post); + using var response = await client.SendAsync(requestMessage, cancellationToken); + + var responseBuilder = httpMessageFactory.FromResponse(response); + responseBuilder.AddSuccessResponse(HttpStatusCode.OK); + responseBuilder.AddErrorResponse(HttpStatusCode.BadRequest); + return await responseBuilder.BuildResponseAsync(x => new UploadSingleFileAsFormDataEndpointResult(x), cancellationToken); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/UploadSingleFileAsFormDataEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/UploadSingleFileAsFormDataEndpointResult.verified.cs new file mode 100644 index 000000000..7e7a17226 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/UploadSingleFileAsFormDataEndpointResult.verified.cs @@ -0,0 +1,37 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyEndpoints; + +/// +/// Client Endpoint result. +/// Description: Upload a file as OctetStream. +/// Operation: UploadSingleFileAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UploadSingleFileAsFormDataEndpointResult : EndpointResponse, IUploadSingleFileAsFormDataEndpointResult +{ + public UploadSingleFileAsFormDataEndpointResult(EndpointResponse response) + : base(response) + { + } + + public bool IsOk + => StatusCode == HttpStatusCode.OK; + + public bool IsBadRequest + => StatusCode == HttpStatusCode.BadRequest; + + public string? OkContent + => IsOk && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsOk property first."); + + public string? BadRequestContent + => IsBadRequest && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsBadRequest property first."); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/UploadSingleObjectWithFileAsFormDataEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/UploadSingleObjectWithFileAsFormDataEndpoint.verified.cs new file mode 100644 index 000000000..aabd83e6b --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/UploadSingleObjectWithFileAsFormDataEndpoint.verified.cs @@ -0,0 +1,46 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyEndpoints; + +/// +/// Client Endpoint. +/// Description: Upload a file as FormData. +/// Operation: UploadSingleObjectWithFileAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UploadSingleObjectWithFileAsFormDataEndpoint : IUploadSingleObjectWithFileAsFormDataEndpoint +{ + private readonly IHttpClientFactory factory; + private readonly IHttpMessageFactory httpMessageFactory; + + public UploadSingleObjectWithFileAsFormDataEndpoint( + IHttpClientFactory factory, + IHttpMessageFactory httpMessageFactory) + { + this.factory = factory; + this.httpMessageFactory = httpMessageFactory; + } + + public async Task ExecuteAsync( + UploadSingleObjectWithFileAsFormDataParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default) + { + var client = factory.CreateClient(httpClientName); + + var requestBuilder = httpMessageFactory.FromTemplate("/api/v1/files/form-data/singleObject"); + // TODO: Imp. With-Form + + using var requestMessage = requestBuilder.Build(HttpMethod.Post); + using var response = await client.SendAsync(requestMessage, cancellationToken); + + var responseBuilder = httpMessageFactory.FromResponse(response); + responseBuilder.AddSuccessResponse(HttpStatusCode.OK); + responseBuilder.AddErrorResponse(HttpStatusCode.BadRequest); + return await responseBuilder.BuildResponseAsync(x => new UploadSingleObjectWithFileAsFormDataEndpointResult(x), cancellationToken); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/UploadSingleObjectWithFileAsFormDataEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/UploadSingleObjectWithFileAsFormDataEndpointResult.verified.cs new file mode 100644 index 000000000..d08a76c01 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/UploadSingleObjectWithFileAsFormDataEndpointResult.verified.cs @@ -0,0 +1,37 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyEndpoints; + +/// +/// Client Endpoint result. +/// Description: Upload a file as FormData. +/// Operation: UploadSingleObjectWithFileAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UploadSingleObjectWithFileAsFormDataEndpointResult : EndpointResponse, IUploadSingleObjectWithFileAsFormDataEndpointResult +{ + public UploadSingleObjectWithFileAsFormDataEndpointResult(EndpointResponse response) + : base(response) + { + } + + public bool IsOk + => StatusCode == HttpStatusCode.OK; + + public bool IsBadRequest + => StatusCode == HttpStatusCode.BadRequest; + + public string? OkContent + => IsOk && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsOk property first."); + + public string? BadRequestContent + => IsBadRequest && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsBadRequest property first."); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/UploadSingleObjectWithFilesAsFormDataEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/UploadSingleObjectWithFilesAsFormDataEndpoint.verified.cs new file mode 100644 index 000000000..e1e1cb07a --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/UploadSingleObjectWithFilesAsFormDataEndpoint.verified.cs @@ -0,0 +1,46 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyEndpoints; + +/// +/// Client Endpoint. +/// Description: Upload files as FormData. +/// Operation: UploadSingleObjectWithFilesAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UploadSingleObjectWithFilesAsFormDataEndpoint : IUploadSingleObjectWithFilesAsFormDataEndpoint +{ + private readonly IHttpClientFactory factory; + private readonly IHttpMessageFactory httpMessageFactory; + + public UploadSingleObjectWithFilesAsFormDataEndpoint( + IHttpClientFactory factory, + IHttpMessageFactory httpMessageFactory) + { + this.factory = factory; + this.httpMessageFactory = httpMessageFactory; + } + + public async Task ExecuteAsync( + UploadSingleObjectWithFilesAsFormDataParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default) + { + var client = factory.CreateClient(httpClientName); + + var requestBuilder = httpMessageFactory.FromTemplate("/api/v1/files/form-data/singleObjectMultiFile"); + // TODO: Imp. With-Form + + using var requestMessage = requestBuilder.Build(HttpMethod.Post); + using var response = await client.SendAsync(requestMessage, cancellationToken); + + var responseBuilder = httpMessageFactory.FromResponse(response); + responseBuilder.AddSuccessResponse(HttpStatusCode.OK); + responseBuilder.AddErrorResponse(HttpStatusCode.BadRequest); + return await responseBuilder.BuildResponseAsync(x => new UploadSingleObjectWithFilesAsFormDataEndpointResult(x), cancellationToken); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/UploadSingleObjectWithFilesAsFormDataEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/UploadSingleObjectWithFilesAsFormDataEndpointResult.verified.cs new file mode 100644 index 000000000..896b4b324 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/UploadSingleObjectWithFilesAsFormDataEndpointResult.verified.cs @@ -0,0 +1,37 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyEndpoints; + +/// +/// Client Endpoint result. +/// Description: Upload files as FormData. +/// Operation: UploadSingleObjectWithFilesAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UploadSingleObjectWithFilesAsFormDataEndpointResult : EndpointResponse, IUploadSingleObjectWithFilesAsFormDataEndpointResult +{ + public UploadSingleObjectWithFilesAsFormDataEndpointResult(EndpointResponse response) + : base(response) + { + } + + public bool IsOk + => StatusCode == HttpStatusCode.OK; + + public bool IsBadRequest + => StatusCode == HttpStatusCode.BadRequest; + + public string? OkContent + => IsOk && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsOk property first."); + + public string? BadRequestContent + => IsBadRequest && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsBadRequest property first."); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/GlobalUsings.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/GlobalUsings.verified.cs new file mode 100644 index 000000000..a49ad84a8 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/GlobalUsings.verified.cs @@ -0,0 +1,34 @@ +global using System; +global using System.CodeDom.Compiler; +global using System.Collections.Generic; +global using System.ComponentModel.DataAnnotations; +global using System.Linq; +global using System.Net; +global using System.Net.Http; +global using System.Threading; +global using System.Threading.Tasks; + +global using Atc.Rest.Client; +global using Atc.Rest.Client.Builder; +global using Atc.Rest.Results; + +global using Microsoft.AspNetCore.Http; +global using Microsoft.AspNetCore.Mvc; + +global using Structure1.ApiClient.Generated.Accounts.MyContracts; +global using Structure1.ApiClient.Generated.Accounts.MyEndpoints.Interfaces; +global using Structure1.ApiClient.Generated.Addresses.MyContracts; +global using Structure1.ApiClient.Generated.Addresses.MyEndpoints.Interfaces; +global using Structure1.ApiClient.Generated.EventArgs.MyContracts; +global using Structure1.ApiClient.Generated.EventArgs.MyEndpoints.Interfaces; +global using Structure1.ApiClient.Generated.Files.MyContracts; +global using Structure1.ApiClient.Generated.Files.MyEndpoints.Interfaces; +global using Structure1.ApiClient.Generated.Items.MyContracts; +global using Structure1.ApiClient.Generated.Items.MyEndpoints.Interfaces; +global using Structure1.ApiClient.Generated.MyContracts; +global using Structure1.ApiClient.Generated.Orders.MyContracts; +global using Structure1.ApiClient.Generated.Orders.MyEndpoints.Interfaces; +global using Structure1.ApiClient.Generated.RouteWithDash.MyEndpoints.Interfaces; +global using Structure1.ApiClient.Generated.Tasks.MyEndpoints.Interfaces; +global using Structure1.ApiClient.Generated.Users.MyContracts; +global using Structure1.ApiClient.Generated.Users.MyEndpoints.Interfaces; \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Items/MyContracts/CreateItemRequest.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Items/MyContracts/CreateItemRequest.verified.cs new file mode 100644 index 000000000..72946b7e8 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Items/MyContracts/CreateItemRequest.verified.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Items.MyContracts; + +/// +/// CreateItemRequest. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class CreateItemRequest +{ + /// + /// Item. + /// + [Required] + public Item Item { get; set; } + + /// + /// A list of Item. + /// + [Required] + public List MyItems { get; set; } + + /// + public override string ToString() + => $"{nameof(Item)}: ({Item}), {nameof(MyItems)}.Count: {MyItems?.Count ?? 0}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Items/MyContracts/Item.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Items/MyContracts/Item.verified.cs new file mode 100644 index 000000000..338def7fd --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Items/MyContracts/Item.verified.cs @@ -0,0 +1,21 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Items.MyContracts; + +/// +/// Item. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class Item +{ + [Required] + public string Name { get; set; } + + /// + public override string ToString() + => $"{nameof(Name)}: {Name}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Items/MyContracts/RequestParameters/CreateItemParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Items/MyContracts/RequestParameters/CreateItemParameters.verified.cs new file mode 100644 index 000000000..6d1f62ea4 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Items/MyContracts/RequestParameters/CreateItemParameters.verified.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Items.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Create a new item. +/// Operation: CreateItem. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class CreateItemParameters +{ + /// + /// CreateItemRequest. + /// + [Required] + public CreateItemRequest Request { get; set; } + + /// + public override string ToString() + => $"{nameof(Request)}: ({Request})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Items/MyContracts/RequestParameters/UpdateItemParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Items/MyContracts/RequestParameters/UpdateItemParameters.verified.cs new file mode 100644 index 000000000..857f8164e --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Items/MyContracts/RequestParameters/UpdateItemParameters.verified.cs @@ -0,0 +1,32 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Items.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Updates an item. +/// Operation: UpdateItem. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateItemParameters +{ + /// + /// The id of the order. + /// + [Required] + public Guid Id { get; set; } + + /// + /// UpdateItemRequest. + /// + [Required] + public UpdateItemRequest Request { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}, {nameof(Request)}: ({Request})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Items/MyContracts/UpdateItemRequest.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Items/MyContracts/UpdateItemRequest.verified.cs new file mode 100644 index 000000000..25bc5c565 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Items/MyContracts/UpdateItemRequest.verified.cs @@ -0,0 +1,24 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Items.MyContracts; + +/// +/// UpdateItemRequest. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateItemRequest +{ + /// + /// Item. + /// + [Required] + public Item Item { get; set; } + + /// + public override string ToString() + => $"{nameof(Item)}: ({Item})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Items/MyEndpoints/CreateItemEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Items/MyEndpoints/CreateItemEndpoint.verified.cs new file mode 100644 index 000000000..c151d8eb3 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Items/MyEndpoints/CreateItemEndpoint.verified.cs @@ -0,0 +1,46 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Items.MyEndpoints; + +/// +/// Client Endpoint. +/// Description: Create a new item. +/// Operation: CreateItem. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class CreateItemEndpoint : ICreateItemEndpoint +{ + private readonly IHttpClientFactory factory; + private readonly IHttpMessageFactory httpMessageFactory; + + public CreateItemEndpoint( + IHttpClientFactory factory, + IHttpMessageFactory httpMessageFactory) + { + this.factory = factory; + this.httpMessageFactory = httpMessageFactory; + } + + public async Task ExecuteAsync( + CreateItemParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default) + { + var client = factory.CreateClient(httpClientName); + + var requestBuilder = httpMessageFactory.FromTemplate("/api/v1/items"); + requestBuilder.WithBody(parameters.Request); + + using var requestMessage = requestBuilder.Build(HttpMethod.Post); + using var response = await client.SendAsync(requestMessage, cancellationToken); + + var responseBuilder = httpMessageFactory.FromResponse(response); + responseBuilder.AddSuccessResponse(HttpStatusCode.OK); + responseBuilder.AddErrorResponse(HttpStatusCode.BadRequest); + return await responseBuilder.BuildResponseAsync(x => new CreateItemEndpointResult(x), cancellationToken); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Items/MyEndpoints/CreateItemEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Items/MyEndpoints/CreateItemEndpointResult.verified.cs new file mode 100644 index 000000000..1a3816e90 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Items/MyEndpoints/CreateItemEndpointResult.verified.cs @@ -0,0 +1,37 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Items.MyEndpoints; + +/// +/// Client Endpoint result. +/// Description: Create a new item. +/// Operation: CreateItem. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class CreateItemEndpointResult : EndpointResponse, ICreateItemEndpointResult +{ + public CreateItemEndpointResult(EndpointResponse response) + : base(response) + { + } + + public bool IsOk + => StatusCode == HttpStatusCode.OK; + + public bool IsBadRequest + => StatusCode == HttpStatusCode.BadRequest; + + public string? OkContent + => IsOk && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsOk property first."); + + public string? BadRequestContent + => IsBadRequest && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsBadRequest property first."); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Items/MyEndpoints/Interfaces/ICreateItemEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Items/MyEndpoints/Interfaces/ICreateItemEndpoint.verified.cs new file mode 100644 index 000000000..a030a7ffe --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Items/MyEndpoints/Interfaces/ICreateItemEndpoint.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Items.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint. +/// Description: Create a new item. +/// Operation: CreateItem. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface ICreateItemEndpoint +{ + /// + /// Execute method. + /// + /// The parameters. + /// The http client name. + /// The cancellation token. + Task ExecuteAsync( + CreateItemParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Items/MyEndpoints/Interfaces/ICreateItemEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Items/MyEndpoints/Interfaces/ICreateItemEndpointResult.verified.cs new file mode 100644 index 000000000..5fba321c3 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Items/MyEndpoints/Interfaces/ICreateItemEndpointResult.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Items.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint Result. +/// Description: Create a new item. +/// Operation: CreateItem. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface ICreateItemEndpointResult : IEndpointResponse +{ + + bool IsOk { get; } + + bool IsBadRequest { get; } + + string? OkContent { get; } + + string? BadRequestContent { get; } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Items/MyEndpoints/Interfaces/IUpdateItemEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Items/MyEndpoints/Interfaces/IUpdateItemEndpoint.verified.cs new file mode 100644 index 000000000..109aedace --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Items/MyEndpoints/Interfaces/IUpdateItemEndpoint.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Items.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint. +/// Description: Updates an item. +/// Operation: UpdateItem. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IUpdateItemEndpoint +{ + /// + /// Execute method. + /// + /// The parameters. + /// The http client name. + /// The cancellation token. + Task ExecuteAsync( + UpdateItemParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Items/MyEndpoints/Interfaces/IUpdateItemEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Items/MyEndpoints/Interfaces/IUpdateItemEndpointResult.verified.cs new file mode 100644 index 000000000..6ee009d6a --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Items/MyEndpoints/Interfaces/IUpdateItemEndpointResult.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Items.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint Result. +/// Description: Updates an item. +/// Operation: UpdateItem. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IUpdateItemEndpointResult : IEndpointResponse +{ + + bool IsOk { get; } + + bool IsBadRequest { get; } + + Guid OkContent { get; } + + string? BadRequestContent { get; } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Items/MyEndpoints/UpdateItemEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Items/MyEndpoints/UpdateItemEndpoint.verified.cs new file mode 100644 index 000000000..3cc6a083d --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Items/MyEndpoints/UpdateItemEndpoint.verified.cs @@ -0,0 +1,47 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Items.MyEndpoints; + +/// +/// Client Endpoint. +/// Description: Updates an item. +/// Operation: UpdateItem. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateItemEndpoint : IUpdateItemEndpoint +{ + private readonly IHttpClientFactory factory; + private readonly IHttpMessageFactory httpMessageFactory; + + public UpdateItemEndpoint( + IHttpClientFactory factory, + IHttpMessageFactory httpMessageFactory) + { + this.factory = factory; + this.httpMessageFactory = httpMessageFactory; + } + + public async Task ExecuteAsync( + UpdateItemParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default) + { + var client = factory.CreateClient(httpClientName); + + var requestBuilder = httpMessageFactory.FromTemplate("/api/v1/items/{id}"); + requestBuilder.WithPathParameter("id", parameters.Id); + requestBuilder.WithBody(parameters.Request); + + using var requestMessage = requestBuilder.Build(HttpMethod.Put); + using var response = await client.SendAsync(requestMessage, cancellationToken); + + var responseBuilder = httpMessageFactory.FromResponse(response); + responseBuilder.AddSuccessResponse(HttpStatusCode.OK); + responseBuilder.AddErrorResponse(HttpStatusCode.BadRequest); + return await responseBuilder.BuildResponseAsync(x => new UpdateItemEndpointResult(x), cancellationToken); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Items/MyEndpoints/UpdateItemEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Items/MyEndpoints/UpdateItemEndpointResult.verified.cs new file mode 100644 index 000000000..63f9cacbf --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Items/MyEndpoints/UpdateItemEndpointResult.verified.cs @@ -0,0 +1,37 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Items.MyEndpoints; + +/// +/// Client Endpoint result. +/// Description: Updates an item. +/// Operation: UpdateItem. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateItemEndpointResult : EndpointResponse, IUpdateItemEndpointResult +{ + public UpdateItemEndpointResult(EndpointResponse response) + : base(response) + { + } + + public bool IsOk + => StatusCode == HttpStatusCode.OK; + + public bool IsBadRequest + => StatusCode == HttpStatusCode.BadRequest; + + public Guid OkContent + => IsOk && ContentObject is Guid result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsOk property first."); + + public string? BadRequestContent + => IsBadRequest && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsBadRequest property first."); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/MyContracts/_EnumerationTypes/ColorType.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/MyContracts/_EnumerationTypes/ColorType.verified.cs new file mode 100644 index 000000000..2482e9d82 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/MyContracts/_EnumerationTypes/ColorType.verified.cs @@ -0,0 +1,21 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.MyContracts; + +/// +/// Enumeration: ColorType. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +[Flags] +public enum ColorType +{ + None = 0, + Black = 1, + White = 2, + Yellow = 4, + Red = 8, +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/MyContracts/_EnumerationTypes/GenderType.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/MyContracts/_EnumerationTypes/GenderType.verified.cs new file mode 100644 index 000000000..226ad596f --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/MyContracts/_EnumerationTypes/GenderType.verified.cs @@ -0,0 +1,19 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.MyContracts; + +/// +/// Enumeration: GenderType. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public enum GenderType +{ + None, + NonBinary, + Male, + Female, +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/MyContracts/_Shared/Address.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/MyContracts/_Shared/Address.verified.cs new file mode 100644 index 000000000..a2d705631 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/MyContracts/_Shared/Address.verified.cs @@ -0,0 +1,32 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.MyContracts; + +/// +/// Address. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class Address +{ + [StringLength(255)] + public string StreetName { get; set; } + + public string StreetNumber { get; set; } + + public string PostalCode { get; set; } + + public string CityName { get; set; } + + /// + /// Country. + /// + public Country MyCountry { get; set; } + + /// + public override string ToString() + => $"{nameof(StreetName)}: {StreetName}, {nameof(StreetNumber)}: {StreetNumber}, {nameof(PostalCode)}: {PostalCode}, {nameof(CityName)}: {CityName}, {nameof(MyCountry)}: ({MyCountry})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/MyContracts/_Shared/Country.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/MyContracts/_Shared/Country.verified.cs new file mode 100644 index 000000000..b26edf4df --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/MyContracts/_Shared/Country.verified.cs @@ -0,0 +1,33 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.MyContracts; + +/// +/// Country. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class Country +{ + [Required] + public string Name { get; set; } + + [Required] + [MinLength(2)] + [MaxLength(2)] + [RegularExpression("^[A-Za-z]{2}$")] + public string Alpha2Code { get; set; } + + [Required] + [MinLength(3)] + [MaxLength(3)] + [RegularExpression("^[A-Za-z]{3}$")] + public string Alpha3Code { get; set; } + + /// + public override string ToString() + => $"{nameof(Name)}: {Name}, {nameof(Alpha2Code)}: {Alpha2Code}, {nameof(Alpha3Code)}: {Alpha3Code}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Orders/MyContracts/Order.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Orders/MyContracts/Order.verified.cs new file mode 100644 index 000000000..77a20ee94 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Orders/MyContracts/Order.verified.cs @@ -0,0 +1,79 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Orders.MyContracts; + +/// +/// A single order. +/// Hallo description with multiline and no ending dot. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class Order +{ + public Guid Id { get; set; } + + public string Description { get; set; } + + public DateTimeOffset MyTime { get; set; } + + /// + /// Undefined description. + /// + /// + /// Email validation being enforced. + /// + [EmailAddress] + public string MyEmail { get; set; } = "a@a.com"; + + public DateTimeOffset? MyNullableDateTime { get; set; } + + public DateTimeOffset MyDateTime { get; set; } + + [Range(1.1, 20.2)] + public double MyNumber { get; set; } + + [Range(int.MinValue, 50)] + public int MyInteger { get; set; } = 15; + + /// + /// MyBool is great. + /// + public bool MyBool { get; set; } + + /// + /// This is the good uri :-). + /// + /// + /// Url validation being enforced. + /// + [Uri] + public Uri MyUri { get; set; } + + /// + /// Undefined description. + /// + /// + /// This string should be base64-encoded. + /// + public string MyByte { get; set; } + + /// + /// Hallo myStringList desc :-). + /// + public List MyStringList { get; set; } = new List(); + + [Range(10, int.MaxValue)] + public long MyLong { get; set; } + + /// + /// Address. + /// + public Address DeliveryAddress { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}, {nameof(Description)}: {Description}, {nameof(MyTime)}: ({MyTime}), {nameof(MyEmail)}: {MyEmail}, {nameof(MyNullableDateTime)}: ({MyNullableDateTime}), {nameof(MyDateTime)}: ({MyDateTime}), {nameof(MyNumber)}: {MyNumber}, {nameof(MyInteger)}: {MyInteger}, {nameof(MyBool)}: {MyBool}, {nameof(MyUri)}: ({MyUri}), {nameof(MyByte)}: {MyByte}, {nameof(MyStringList)}.Count: {MyStringList?.Count ?? 0}, {nameof(MyLong)}: {MyLong}, {nameof(DeliveryAddress)}: ({DeliveryAddress})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Orders/MyContracts/RequestParameters/GetOrderByIdParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Orders/MyContracts/RequestParameters/GetOrderByIdParameters.verified.cs new file mode 100644 index 000000000..9a9629ec5 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Orders/MyContracts/RequestParameters/GetOrderByIdParameters.verified.cs @@ -0,0 +1,35 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Orders.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Get order by id. +/// Operation: GetOrderById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetOrderByIdParameters +{ + /// + /// The id of the order. + /// + [Required] + public Guid Id { get; set; } + + /// + /// The email for filter orders to retrieve. + /// + /// + /// Email validation being enforced. + /// + [EmailAddress] + public string? MyEmail { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}, {nameof(MyEmail)}: {MyEmail}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Orders/MyContracts/RequestParameters/GetOrdersParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Orders/MyContracts/RequestParameters/GetOrdersParameters.verified.cs new file mode 100644 index 000000000..213643daa --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Orders/MyContracts/RequestParameters/GetOrdersParameters.verified.cs @@ -0,0 +1,48 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Orders.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Get orders. +/// Operation: GetOrders. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetOrdersParameters +{ + /// + /// The numbers of items to return. + /// + [Required] + [Range(1, 100)] + public int PageSize { get; set; } = 10; + + /// + /// The number of items to skip before starting to collect the result set. + /// + [Range(0, 2147483647)] + public int PageIndex { get; set; } = 0; + + /// + /// The query string. + /// + public string? QueryString { get; set; } + + /// + /// The query array of string. + /// + public List QueryStringArray { get; set; } = new List(); + + /// + /// The continuation token. + /// + public string? ContinuationToken { get; set; } + + /// + public override string ToString() + => $"{nameof(PageSize)}: {PageSize}, {nameof(PageIndex)}: {PageIndex}, {nameof(QueryString)}: {QueryString}, {nameof(QueryStringArray)}.Count: {QueryStringArray?.Count ?? 0}, {nameof(ContinuationToken)}: {ContinuationToken}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Orders/MyContracts/RequestParameters/PatchOrdersIdParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Orders/MyContracts/RequestParameters/PatchOrdersIdParameters.verified.cs new file mode 100644 index 000000000..c6d4a513c --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Orders/MyContracts/RequestParameters/PatchOrdersIdParameters.verified.cs @@ -0,0 +1,56 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Orders.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Update part of order by id. +/// Operation: PatchOrdersId. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class PatchOrdersIdParameters +{ + /// + /// The id of the order. + /// + [Required] + public Guid Id { get; set; } + + /// + /// The myTestHeader special key. + /// + [Required] + public string MyTestHeader { get; set; } + + /// + /// The myTestHeaderBool special key. + /// + [Required] + public bool MyTestHeaderBool { get; set; } + + /// + /// The myTestHeaderInt special key. + /// + [Required] + public int MyTestHeaderInt { get; set; } + + /// + /// The correlationId. + /// + [Required] + public string CorrelationId { get; set; } + + /// + /// Request to update an order. + /// + [Required] + public UpdateOrderRequest Request { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}, {nameof(MyTestHeader)}: {MyTestHeader}, {nameof(MyTestHeaderBool)}: {MyTestHeaderBool}, {nameof(MyTestHeaderInt)}: {MyTestHeaderInt}, {nameof(CorrelationId)}: {CorrelationId}, {nameof(Request)}: ({Request})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Orders/MyContracts/UpdateOrderRequest.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Orders/MyContracts/UpdateOrderRequest.verified.cs new file mode 100644 index 000000000..37332d188 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Orders/MyContracts/UpdateOrderRequest.verified.cs @@ -0,0 +1,28 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Orders.MyContracts; + +/// +/// Request to update an order. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateOrderRequest +{ + /// + /// Undefined description. + /// + /// + /// Email validation being enforced. + /// + [Required] + [EmailAddress] + public string MyEmail { get; set; } + + /// + public override string ToString() + => $"{nameof(MyEmail)}: {MyEmail}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/GetOrderByIdEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/GetOrderByIdEndpoint.verified.cs new file mode 100644 index 000000000..f71f8cf8d --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/GetOrderByIdEndpoint.verified.cs @@ -0,0 +1,48 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Orders.MyEndpoints; + +/// +/// Client Endpoint. +/// Description: Get order by id. +/// Operation: GetOrderById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetOrderByIdEndpoint : IGetOrderByIdEndpoint +{ + private readonly IHttpClientFactory factory; + private readonly IHttpMessageFactory httpMessageFactory; + + public GetOrderByIdEndpoint( + IHttpClientFactory factory, + IHttpMessageFactory httpMessageFactory) + { + this.factory = factory; + this.httpMessageFactory = httpMessageFactory; + } + + public async Task ExecuteAsync( + GetOrderByIdParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default) + { + var client = factory.CreateClient(httpClientName); + + var requestBuilder = httpMessageFactory.FromTemplate("/api/v1/orders/{id}"); + requestBuilder.WithPathParameter("id", parameters.Id); + requestBuilder.WithQueryParameter("myEmail", parameters.MyEmail); + + using var requestMessage = requestBuilder.Build(HttpMethod.Get); + using var response = await client.SendAsync(requestMessage, cancellationToken); + + var responseBuilder = httpMessageFactory.FromResponse(response); + responseBuilder.AddSuccessResponse(HttpStatusCode.OK); + responseBuilder.AddErrorResponse(HttpStatusCode.BadRequest); + responseBuilder.AddErrorResponse(HttpStatusCode.NotFound); + return await responseBuilder.BuildResponseAsync(x => new GetOrderByIdEndpointResult(x), cancellationToken); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/GetOrderByIdEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/GetOrderByIdEndpointResult.verified.cs new file mode 100644 index 000000000..ad4c4c5e6 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/GetOrderByIdEndpointResult.verified.cs @@ -0,0 +1,45 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Orders.MyEndpoints; + +/// +/// Client Endpoint result. +/// Description: Get order by id. +/// Operation: GetOrderById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetOrderByIdEndpointResult : EndpointResponse, IGetOrderByIdEndpointResult +{ + public GetOrderByIdEndpointResult(EndpointResponse response) + : base(response) + { + } + + public bool IsOk + => StatusCode == HttpStatusCode.OK; + + public bool IsBadRequest + => StatusCode == HttpStatusCode.BadRequest; + + public bool IsNotFound + => StatusCode == HttpStatusCode.NotFound; + + public Order OkContent + => IsOk && ContentObject is Order result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsOk property first."); + + public string? BadRequestContent + => IsBadRequest && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsBadRequest property first."); + + public string? NotFoundContent + => IsNotFound && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsNotFound property first."); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/GetOrdersEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/GetOrdersEndpoint.verified.cs new file mode 100644 index 000000000..5d5f5f4a9 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/GetOrdersEndpoint.verified.cs @@ -0,0 +1,56 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Orders.MyEndpoints; + +/// +/// Client Endpoint. +/// Description: Get orders. +/// Operation: GetOrders. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetOrdersEndpoint : IGetOrdersEndpoint +{ + private readonly IHttpClientFactory factory; + private readonly IHttpMessageFactory httpMessageFactory; + + public GetOrdersEndpoint( + IHttpClientFactory factory, + IHttpMessageFactory httpMessageFactory) + { + this.factory = factory; + this.httpMessageFactory = httpMessageFactory; + } + + public async Task ExecuteAsync( + GetOrdersParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default) + { + var client = factory.CreateClient(httpClientName); + + var requestBuilder = httpMessageFactory.FromTemplate("/api/v1/orders"); + requestBuilder.WithQueryParameter("pageSize", parameters.PageSize); + requestBuilder.WithQueryParameter("pageIndex", parameters.PageIndex); + requestBuilder.WithQueryParameter("queryString", parameters.QueryString); + if (parameters.QueryStringArray.Any()) + { + requestBuilder.WithQueryParameter("queryStringArray", parameters.QueryStringArray); + } + + requestBuilder.WithQueryParameter("continuationToken", parameters.ContinuationToken); + + using var requestMessage = requestBuilder.Build(HttpMethod.Get); + using var response = await client.SendAsync(requestMessage, cancellationToken); + + var responseBuilder = httpMessageFactory.FromResponse(response); + responseBuilder.AddSuccessResponse>(HttpStatusCode.OK); + responseBuilder.AddErrorResponse(HttpStatusCode.BadRequest); + responseBuilder.AddErrorResponse(HttpStatusCode.Unauthorized); + responseBuilder.AddErrorResponse(HttpStatusCode.NotFound); + return await responseBuilder.BuildResponseAsync(x => new GetOrdersEndpointResult(x), cancellationToken); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/GetOrdersEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/GetOrdersEndpointResult.verified.cs new file mode 100644 index 000000000..782abbcd0 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/GetOrdersEndpointResult.verified.cs @@ -0,0 +1,53 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Orders.MyEndpoints; + +/// +/// Client Endpoint result. +/// Description: Get orders. +/// Operation: GetOrders. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetOrdersEndpointResult : EndpointResponse, IGetOrdersEndpointResult +{ + public GetOrdersEndpointResult(EndpointResponse response) + : base(response) + { + } + + public bool IsOk + => StatusCode == HttpStatusCode.OK; + + public bool IsBadRequest + => StatusCode == HttpStatusCode.BadRequest; + + public bool IsUnauthorized + => StatusCode == HttpStatusCode.Unauthorized; + + public bool IsNotFound + => StatusCode == HttpStatusCode.NotFound; + + public Pagination OkContent + => IsOk && ContentObject is Pagination result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsOk property first."); + + public string? BadRequestContent + => IsBadRequest && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsBadRequest property first."); + + public string? UnauthorizedContent + => IsUnauthorized && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsUnauthorized property first."); + + public string? NotFoundContent + => IsNotFound && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsNotFound property first."); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/Interfaces/IGetOrderByIdEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/Interfaces/IGetOrderByIdEndpoint.verified.cs new file mode 100644 index 000000000..c763a470b --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/Interfaces/IGetOrderByIdEndpoint.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Orders.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint. +/// Description: Get order by id. +/// Operation: GetOrderById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetOrderByIdEndpoint +{ + /// + /// Execute method. + /// + /// The parameters. + /// The http client name. + /// The cancellation token. + Task ExecuteAsync( + GetOrderByIdParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/Interfaces/IGetOrderByIdEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/Interfaces/IGetOrderByIdEndpointResult.verified.cs new file mode 100644 index 000000000..a9dce734e --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/Interfaces/IGetOrderByIdEndpointResult.verified.cs @@ -0,0 +1,29 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Orders.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint Result. +/// Description: Get order by id. +/// Operation: GetOrderById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetOrderByIdEndpointResult : IEndpointResponse +{ + + bool IsOk { get; } + + bool IsBadRequest { get; } + + bool IsNotFound { get; } + + Order OkContent { get; } + + string? BadRequestContent { get; } + + string? NotFoundContent { get; } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/Interfaces/IGetOrdersEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/Interfaces/IGetOrdersEndpoint.verified.cs new file mode 100644 index 000000000..74aa603c1 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/Interfaces/IGetOrdersEndpoint.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Orders.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint. +/// Description: Get orders. +/// Operation: GetOrders. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetOrdersEndpoint +{ + /// + /// Execute method. + /// + /// The parameters. + /// The http client name. + /// The cancellation token. + Task ExecuteAsync( + GetOrdersParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/Interfaces/IGetOrdersEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/Interfaces/IGetOrdersEndpointResult.verified.cs new file mode 100644 index 000000000..e101e8f68 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/Interfaces/IGetOrdersEndpointResult.verified.cs @@ -0,0 +1,33 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Orders.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint Result. +/// Description: Get orders. +/// Operation: GetOrders. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetOrdersEndpointResult : IEndpointResponse +{ + + bool IsOk { get; } + + bool IsBadRequest { get; } + + bool IsUnauthorized { get; } + + bool IsNotFound { get; } + + Pagination OkContent { get; } + + string? BadRequestContent { get; } + + string? UnauthorizedContent { get; } + + string? NotFoundContent { get; } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/Interfaces/IPatchOrdersIdEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/Interfaces/IPatchOrdersIdEndpoint.verified.cs new file mode 100644 index 000000000..a359c4aa4 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/Interfaces/IPatchOrdersIdEndpoint.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Orders.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint. +/// Description: Update part of order by id. +/// Operation: PatchOrdersId. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IPatchOrdersIdEndpoint +{ + /// + /// Execute method. + /// + /// The parameters. + /// The http client name. + /// The cancellation token. + Task ExecuteAsync( + PatchOrdersIdParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/Interfaces/IPatchOrdersIdEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/Interfaces/IPatchOrdersIdEndpointResult.verified.cs new file mode 100644 index 000000000..6ad8b26d2 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/Interfaces/IPatchOrdersIdEndpointResult.verified.cs @@ -0,0 +1,45 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Orders.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint Result. +/// Description: Update part of order by id. +/// Operation: PatchOrdersId. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IPatchOrdersIdEndpointResult : IEndpointResponse +{ + + bool IsOk { get; } + + bool IsBadRequest { get; } + + bool IsUnauthorized { get; } + + bool IsForbidden { get; } + + bool IsNotFound { get; } + + bool IsConflict { get; } + + bool IsBadGateway { get; } + + string? OkContent { get; } + + string? BadRequestContent { get; } + + string? UnauthorizedContent { get; } + + string? ForbiddenContent { get; } + + string? NotFoundContent { get; } + + string? ConflictContent { get; } + + string? BadGatewayContent { get; } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/PatchOrdersIdEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/PatchOrdersIdEndpoint.verified.cs new file mode 100644 index 000000000..8f35ebbff --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/PatchOrdersIdEndpoint.verified.cs @@ -0,0 +1,56 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Orders.MyEndpoints; + +/// +/// Client Endpoint. +/// Description: Update part of order by id. +/// Operation: PatchOrdersId. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class PatchOrdersIdEndpoint : IPatchOrdersIdEndpoint +{ + private readonly IHttpClientFactory factory; + private readonly IHttpMessageFactory httpMessageFactory; + + public PatchOrdersIdEndpoint( + IHttpClientFactory factory, + IHttpMessageFactory httpMessageFactory) + { + this.factory = factory; + this.httpMessageFactory = httpMessageFactory; + } + + public async Task ExecuteAsync( + PatchOrdersIdParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default) + { + var client = factory.CreateClient(httpClientName); + + var requestBuilder = httpMessageFactory.FromTemplate("/api/v1/orders/{id}"); + requestBuilder.WithPathParameter("id", parameters.Id); + requestBuilder.WithHeaderParameter("myTestHeader", parameters.MyTestHeader); + requestBuilder.WithHeaderParameter("myTestHeaderBool", parameters.MyTestHeaderBool); + requestBuilder.WithHeaderParameter("myTestHeaderInt", parameters.MyTestHeaderInt); + requestBuilder.WithHeaderParameter("x-correlation-id", parameters.CorrelationId); + requestBuilder.WithBody(parameters.Request); + + using var requestMessage = requestBuilder.Build(HttpMethod.Patch); + using var response = await client.SendAsync(requestMessage, cancellationToken); + + var responseBuilder = httpMessageFactory.FromResponse(response); + responseBuilder.AddSuccessResponse(HttpStatusCode.OK); + responseBuilder.AddErrorResponse(HttpStatusCode.BadRequest); + responseBuilder.AddErrorResponse(HttpStatusCode.Unauthorized); + responseBuilder.AddErrorResponse(HttpStatusCode.Forbidden); + responseBuilder.AddErrorResponse(HttpStatusCode.NotFound); + responseBuilder.AddErrorResponse(HttpStatusCode.Conflict); + responseBuilder.AddErrorResponse(HttpStatusCode.BadGateway); + return await responseBuilder.BuildResponseAsync(x => new PatchOrdersIdEndpointResult(x), cancellationToken); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/PatchOrdersIdEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/PatchOrdersIdEndpointResult.verified.cs new file mode 100644 index 000000000..efb7361b3 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/PatchOrdersIdEndpointResult.verified.cs @@ -0,0 +1,77 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Orders.MyEndpoints; + +/// +/// Client Endpoint result. +/// Description: Update part of order by id. +/// Operation: PatchOrdersId. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class PatchOrdersIdEndpointResult : EndpointResponse, IPatchOrdersIdEndpointResult +{ + public PatchOrdersIdEndpointResult(EndpointResponse response) + : base(response) + { + } + + public bool IsOk + => StatusCode == HttpStatusCode.OK; + + public bool IsBadRequest + => StatusCode == HttpStatusCode.BadRequest; + + public bool IsUnauthorized + => StatusCode == HttpStatusCode.Unauthorized; + + public bool IsForbidden + => StatusCode == HttpStatusCode.Forbidden; + + public bool IsNotFound + => StatusCode == HttpStatusCode.NotFound; + + public bool IsConflict + => StatusCode == HttpStatusCode.Conflict; + + public bool IsBadGateway + => StatusCode == HttpStatusCode.BadGateway; + + public string? OkContent + => IsOk && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsOk property first."); + + public string? BadRequestContent + => IsBadRequest && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsBadRequest property first."); + + public string? UnauthorizedContent + => IsUnauthorized && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsUnauthorized property first."); + + public string? ForbiddenContent + => IsForbidden && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsForbidden property first."); + + public string? NotFoundContent + => IsNotFound && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsNotFound property first."); + + public string? ConflictContent + => IsConflict && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsConflict property first."); + + public string? BadGatewayContent + => IsBadGateway && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsBadGateway property first."); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/RouteWithDash/MyEndpoints/GetRouteWithDashEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/RouteWithDash/MyEndpoints/GetRouteWithDashEndpoint.verified.cs new file mode 100644 index 000000000..0925058e2 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/RouteWithDash/MyEndpoints/GetRouteWithDashEndpoint.verified.cs @@ -0,0 +1,43 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.RouteWithDash.MyEndpoints; + +/// +/// Client Endpoint. +/// Description: Your GET endpoint. +/// Operation: GetRouteWithDash. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetRouteWithDashEndpoint : IGetRouteWithDashEndpoint +{ + private readonly IHttpClientFactory factory; + private readonly IHttpMessageFactory httpMessageFactory; + + public GetRouteWithDashEndpoint( + IHttpClientFactory factory, + IHttpMessageFactory httpMessageFactory) + { + this.factory = factory; + this.httpMessageFactory = httpMessageFactory; + } + + public async Task ExecuteAsync( + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default) + { + var client = factory.CreateClient(httpClientName); + + var requestBuilder = httpMessageFactory.FromTemplate("/api/v1/route-with-dash"); + + using var requestMessage = requestBuilder.Build(HttpMethod.Get); + using var response = await client.SendAsync(requestMessage, cancellationToken); + + var responseBuilder = httpMessageFactory.FromResponse(response); + responseBuilder.AddSuccessResponse(HttpStatusCode.OK); + return await responseBuilder.BuildResponseAsync(x => new GetRouteWithDashEndpointResult(x), cancellationToken); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/RouteWithDash/MyEndpoints/GetRouteWithDashEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/RouteWithDash/MyEndpoints/GetRouteWithDashEndpointResult.verified.cs new file mode 100644 index 000000000..067a9a553 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/RouteWithDash/MyEndpoints/GetRouteWithDashEndpointResult.verified.cs @@ -0,0 +1,29 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.RouteWithDash.MyEndpoints; + +/// +/// Client Endpoint result. +/// Description: Your GET endpoint. +/// Operation: GetRouteWithDash. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetRouteWithDashEndpointResult : EndpointResponse, IGetRouteWithDashEndpointResult +{ + public GetRouteWithDashEndpointResult(EndpointResponse response) + : base(response) + { + } + + public bool IsOk + => StatusCode == HttpStatusCode.OK; + + public string? OkContent + => IsOk && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsOk property first."); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/RouteWithDash/MyEndpoints/Interfaces/IGetRouteWithDashEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/RouteWithDash/MyEndpoints/Interfaces/IGetRouteWithDashEndpoint.verified.cs new file mode 100644 index 000000000..31584e79f --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/RouteWithDash/MyEndpoints/Interfaces/IGetRouteWithDashEndpoint.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.RouteWithDash.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint. +/// Description: Your GET endpoint. +/// Operation: GetRouteWithDash. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetRouteWithDashEndpoint +{ + /// + /// Execute method. + /// + /// The http client name. + /// The cancellation token. + Task ExecuteAsync( + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/RouteWithDash/MyEndpoints/Interfaces/IGetRouteWithDashEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/RouteWithDash/MyEndpoints/Interfaces/IGetRouteWithDashEndpointResult.verified.cs new file mode 100644 index 000000000..e3aed0783 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/RouteWithDash/MyEndpoints/Interfaces/IGetRouteWithDashEndpointResult.verified.cs @@ -0,0 +1,21 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.RouteWithDash.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint Result. +/// Description: Your GET endpoint. +/// Operation: GetRouteWithDash. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetRouteWithDashEndpointResult : IEndpointResponse +{ + + bool IsOk { get; } + + string? OkContent { get; } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Tasks/MyContracts/Task.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Tasks/MyContracts/Task.verified.cs new file mode 100644 index 000000000..521cd0c7f --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Tasks/MyContracts/Task.verified.cs @@ -0,0 +1,22 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Tasks.MyContracts; + +/// +/// Describes a single task. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class Task +{ + public Guid Id { get; set; } + + public string Name { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}, {nameof(Name)}: {Name}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Tasks/MyContracts/Tasks.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Tasks/MyContracts/Tasks.verified.cs new file mode 100644 index 000000000..7419a0e92 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Tasks/MyContracts/Tasks.verified.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Tasks.MyContracts; + +/// +/// Contains a list of Tasks. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class Tasks +{ + /// + /// A list of Task. + /// + public List TaskList { get; set; } = new List(); + + /// + public override string ToString() + => $"{nameof(TaskList)}.Count: {TaskList?.Count ?? 0}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Tasks/MyEndpoints/GetTasksEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Tasks/MyEndpoints/GetTasksEndpoint.verified.cs new file mode 100644 index 000000000..8bd76c064 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Tasks/MyEndpoints/GetTasksEndpoint.verified.cs @@ -0,0 +1,43 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Tasks.MyEndpoints; + +/// +/// Client Endpoint. +/// Description: Returns tasks. +/// Operation: GetTasks. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetTasksEndpoint : IGetTasksEndpoint +{ + private readonly IHttpClientFactory factory; + private readonly IHttpMessageFactory httpMessageFactory; + + public GetTasksEndpoint( + IHttpClientFactory factory, + IHttpMessageFactory httpMessageFactory) + { + this.factory = factory; + this.httpMessageFactory = httpMessageFactory; + } + + public async Task ExecuteAsync( + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default) + { + var client = factory.CreateClient(httpClientName); + + var requestBuilder = httpMessageFactory.FromTemplate("/api/v1/tasks"); + + using var requestMessage = requestBuilder.Build(HttpMethod.Get); + using var response = await client.SendAsync(requestMessage, cancellationToken); + + var responseBuilder = httpMessageFactory.FromResponse(response); + responseBuilder.AddSuccessResponse>(HttpStatusCode.OK); + return await responseBuilder.BuildResponseAsync(x => new GetTasksEndpointResult(x), cancellationToken); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Tasks/MyEndpoints/GetTasksEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Tasks/MyEndpoints/GetTasksEndpointResult.verified.cs new file mode 100644 index 000000000..cf0ce55c9 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Tasks/MyEndpoints/GetTasksEndpointResult.verified.cs @@ -0,0 +1,29 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Tasks.MyEndpoints; + +/// +/// Client Endpoint result. +/// Description: Returns tasks. +/// Operation: GetTasks. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetTasksEndpointResult : EndpointResponse, IGetTasksEndpointResult +{ + public GetTasksEndpointResult(EndpointResponse response) + : base(response) + { + } + + public bool IsOk + => StatusCode == HttpStatusCode.OK; + + public IEnumerable OkContent + => IsOk && ContentObject is IEnumerable result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsOk property first."); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Tasks/MyEndpoints/Interfaces/IGetTasksEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Tasks/MyEndpoints/Interfaces/IGetTasksEndpoint.verified.cs new file mode 100644 index 000000000..35f486eed --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Tasks/MyEndpoints/Interfaces/IGetTasksEndpoint.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Tasks.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint. +/// Description: Returns tasks. +/// Operation: GetTasks. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetTasksEndpoint +{ + /// + /// Execute method. + /// + /// The http client name. + /// The cancellation token. + Task ExecuteAsync( + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Tasks/MyEndpoints/Interfaces/IGetTasksEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Tasks/MyEndpoints/Interfaces/IGetTasksEndpointResult.verified.cs new file mode 100644 index 000000000..c04e1849a --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Tasks/MyEndpoints/Interfaces/IGetTasksEndpointResult.verified.cs @@ -0,0 +1,21 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Tasks.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint Result. +/// Description: Returns tasks. +/// Operation: GetTasks. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetTasksEndpointResult : IEndpointResponse +{ + + bool IsOk { get; } + + IEnumerable OkContent { get; } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyContracts/CreateUserRequest.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyContracts/CreateUserRequest.verified.cs new file mode 100644 index 000000000..0fb28fc4a --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyContracts/CreateUserRequest.verified.cs @@ -0,0 +1,65 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyContracts; + +/// +/// Request to create a user. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class CreateUserRequest +{ + [Required] + public string FirstName { get; set; } + + [Required] + public string LastName { get; set; } + + public DateTimeOffset? MyNullableDateTime { get; set; } + + [Required] + public DateTimeOffset MyDateTime { get; set; } + + /// + /// Undefined description. + /// + /// + /// Email validation being enforced. + /// + [Required] + [EmailAddress] + public string Email { get; set; } + + /// + /// Undefined description. + /// + /// + /// Url validation being enforced. + /// + [Uri] + public Uri Homepage { get; set; } + + /// + /// GenderType. + /// + [Required] + public GenderType Gender { get; set; } + + public Address? MyNullableAddress { get; set; } + + [Required] + public Dictionary Tags { get; set; } + + public Dictionary DesiredProperties1 { get; set; } + + public Dictionary? DesiredProperties2 { get; set; } + + public Dictionary? DesiredProperties3 { get; set; } + + /// + public override string ToString() + => $"{nameof(FirstName)}: {FirstName}, {nameof(LastName)}: {LastName}, {nameof(MyNullableDateTime)}: ({MyNullableDateTime}), {nameof(MyDateTime)}: ({MyDateTime}), {nameof(Email)}: {Email}, {nameof(Homepage)}: ({Homepage}), {nameof(Gender)}: {Gender}, {nameof(MyNullableAddress)}: ({MyNullableAddress}), {nameof(Tags)}: ({Tags}), {nameof(DesiredProperties1)}: ({DesiredProperties1}), {nameof(DesiredProperties2)}: ({DesiredProperties2}), {nameof(DesiredProperties3)}: ({DesiredProperties3})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyContracts/RequestParameters/DeleteUserByIdParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyContracts/RequestParameters/DeleteUserByIdParameters.verified.cs new file mode 100644 index 000000000..896c27c0b --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyContracts/RequestParameters/DeleteUserByIdParameters.verified.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Delete user by id. +/// Operation: DeleteUserById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class DeleteUserByIdParameters +{ + /// + /// Id of the user. + /// + [Required] + public Guid Id { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyContracts/RequestParameters/GetUserByEmailParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyContracts/RequestParameters/GetUserByEmailParameters.verified.cs new file mode 100644 index 000000000..2ad1823cb --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyContracts/RequestParameters/GetUserByEmailParameters.verified.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Get user by email. +/// Operation: GetUserByEmail. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetUserByEmailParameters +{ + /// + /// The email of the user to retrieve. + /// + /// + /// Email validation being enforced. + /// + [Required] + [EmailAddress] + public string Email { get; set; } + + /// + public override string ToString() + => $"{nameof(Email)}: {Email}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyContracts/RequestParameters/GetUserByIdParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyContracts/RequestParameters/GetUserByIdParameters.verified.cs new file mode 100644 index 000000000..8717fdb20 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyContracts/RequestParameters/GetUserByIdParameters.verified.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Get user by id. +/// Operation: GetUserById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetUserByIdParameters +{ + /// + /// Id of the user. + /// + [Required] + public Guid Id { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyContracts/RequestParameters/PostUserParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyContracts/RequestParameters/PostUserParameters.verified.cs new file mode 100644 index 000000000..0a6b35b46 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyContracts/RequestParameters/PostUserParameters.verified.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Create a new user. +/// Operation: PostUser. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class PostUserParameters +{ + /// + /// Request to create a user. + /// + [Required] + public CreateUserRequest Request { get; set; } + + /// + public override string ToString() + => $"{nameof(Request)}: ({Request})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyContracts/RequestParameters/UpdateMyTestGenderParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyContracts/RequestParameters/UpdateMyTestGenderParameters.verified.cs new file mode 100644 index 000000000..78e0deb99 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyContracts/RequestParameters/UpdateMyTestGenderParameters.verified.cs @@ -0,0 +1,37 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Update gender on a user. +/// Operation: UpdateMyTestGender. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateMyTestGenderParameters +{ + /// + /// Id of the user. + /// + [Required] + public Guid Id { get; set; } + + /// + /// The gender to set on the user. + /// + public GenderType? GenderParam { get; set; } + + /// + /// Update test-gender Request. + /// + [Required] + public UpdateTestGenderRequest Request { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}, {nameof(GenderParam)}: {GenderParam}, {nameof(Request)}: ({Request})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyContracts/RequestParameters/UpdateUserByIdParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyContracts/RequestParameters/UpdateUserByIdParameters.verified.cs new file mode 100644 index 000000000..4a0e55b3f --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyContracts/RequestParameters/UpdateUserByIdParameters.verified.cs @@ -0,0 +1,32 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Update user by id. +/// Operation: UpdateUserById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateUserByIdParameters +{ + /// + /// Id of the user. + /// + [Required] + public Guid Id { get; set; } + + /// + /// Request to update a user. + /// + [Required] + public UpdateUserRequest Request { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}, {nameof(Request)}: ({Request})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyContracts/UpdateTestGenderRequest.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyContracts/UpdateTestGenderRequest.verified.cs new file mode 100644 index 000000000..b063a57e9 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyContracts/UpdateTestGenderRequest.verified.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyContracts; + +/// +/// Update test-gender Request. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateTestGenderRequest +{ + /// + /// GenderType. + /// + public GenderType Gender { get; set; } + + /// + public override string ToString() + => $"{nameof(Gender)}: {Gender}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyContracts/UpdateUserRequest.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyContracts/UpdateUserRequest.verified.cs new file mode 100644 index 000000000..318242b8c --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyContracts/UpdateUserRequest.verified.cs @@ -0,0 +1,36 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyContracts; + +/// +/// Request to update a user. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateUserRequest +{ + public string FirstName { get; set; } + + public string LastName { get; set; } + + /// + /// Undefined description. + /// + /// + /// Email validation being enforced. + /// + [EmailAddress] + public string Email { get; set; } + + /// + /// GenderType. + /// + public GenderType Gender { get; set; } + + /// + public override string ToString() + => $"{nameof(FirstName)}: {FirstName}, {nameof(LastName)}: {LastName}, {nameof(Email)}: {Email}, {nameof(Gender)}: {Gender}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyContracts/User.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyContracts/User.verified.cs new file mode 100644 index 000000000..54e44db1f --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyContracts/User.verified.cs @@ -0,0 +1,62 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyContracts; + +/// +/// A single user. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class User +{ + public Guid Id { get; set; } + + /// + /// GenderType. + /// + public GenderType Gender { get; set; } + + public string FirstName { get; set; } + + public string LastName { get; set; } + + /// + /// Undefined description. + /// + /// + /// Email validation being enforced. + /// + [EmailAddress] + public string Email { get; set; } + + /// + /// Undefined description. + /// + /// + /// Url validation being enforced. + /// + [Uri] + public Uri Homepage { get; set; } + + /// + /// ColorType. + /// + public ColorType Color { get; set; } + + /// + /// Address. + /// + public Address HomeAddress { get; set; } + + /// + /// Address. + /// + public Address CompanyAddress { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}, {nameof(Gender)}: {Gender}, {nameof(FirstName)}: {FirstName}, {nameof(LastName)}: {LastName}, {nameof(Email)}: {Email}, {nameof(Homepage)}: ({Homepage}), {nameof(Color)}: {Color}, {nameof(HomeAddress)}: ({HomeAddress}), {nameof(CompanyAddress)}: ({CompanyAddress})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyContracts/Users.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyContracts/Users.verified.cs new file mode 100644 index 000000000..1373864d4 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyContracts/Users.verified.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyContracts; + +/// +/// A list of users. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class Users +{ + /// + /// A list of User. + /// + public List UserList { get; set; } = new List(); + + /// + public override string ToString() + => $"{nameof(UserList)}.Count: {UserList?.Count ?? 0}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/DeleteUserByIdEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/DeleteUserByIdEndpoint.verified.cs new file mode 100644 index 000000000..c6da344e4 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/DeleteUserByIdEndpoint.verified.cs @@ -0,0 +1,48 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints; + +/// +/// Client Endpoint. +/// Description: Delete user by id. +/// Operation: DeleteUserById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class DeleteUserByIdEndpoint : IDeleteUserByIdEndpoint +{ + private readonly IHttpClientFactory factory; + private readonly IHttpMessageFactory httpMessageFactory; + + public DeleteUserByIdEndpoint( + IHttpClientFactory factory, + IHttpMessageFactory httpMessageFactory) + { + this.factory = factory; + this.httpMessageFactory = httpMessageFactory; + } + + public async Task ExecuteAsync( + DeleteUserByIdParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default) + { + var client = factory.CreateClient(httpClientName); + + var requestBuilder = httpMessageFactory.FromTemplate("/api/v1/users/{id}"); + requestBuilder.WithPathParameter("id", parameters.Id); + + using var requestMessage = requestBuilder.Build(HttpMethod.Delete); + using var response = await client.SendAsync(requestMessage, cancellationToken); + + var responseBuilder = httpMessageFactory.FromResponse(response); + responseBuilder.AddSuccessResponse(HttpStatusCode.OK); + responseBuilder.AddErrorResponse(HttpStatusCode.BadRequest); + responseBuilder.AddErrorResponse(HttpStatusCode.NotFound); + responseBuilder.AddErrorResponse(HttpStatusCode.Conflict); + return await responseBuilder.BuildResponseAsync(x => new DeleteUserByIdEndpointResult(x), cancellationToken); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/DeleteUserByIdEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/DeleteUserByIdEndpointResult.verified.cs new file mode 100644 index 000000000..09baa86e8 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/DeleteUserByIdEndpointResult.verified.cs @@ -0,0 +1,53 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints; + +/// +/// Client Endpoint result. +/// Description: Delete user by id. +/// Operation: DeleteUserById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class DeleteUserByIdEndpointResult : EndpointResponse, IDeleteUserByIdEndpointResult +{ + public DeleteUserByIdEndpointResult(EndpointResponse response) + : base(response) + { + } + + public bool IsOk + => StatusCode == HttpStatusCode.OK; + + public bool IsBadRequest + => StatusCode == HttpStatusCode.BadRequest; + + public bool IsNotFound + => StatusCode == HttpStatusCode.NotFound; + + public bool IsConflict + => StatusCode == HttpStatusCode.Conflict; + + public string? OkContent + => IsOk && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsOk property first."); + + public string? BadRequestContent + => IsBadRequest && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsBadRequest property first."); + + public string? NotFoundContent + => IsNotFound && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsNotFound property first."); + + public string? ConflictContent + => IsConflict && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsConflict property first."); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/GetUserByEmailEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/GetUserByEmailEndpoint.verified.cs new file mode 100644 index 000000000..a4221179a --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/GetUserByEmailEndpoint.verified.cs @@ -0,0 +1,48 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints; + +/// +/// Client Endpoint. +/// Description: Get user by email. +/// Operation: GetUserByEmail. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetUserByEmailEndpoint : IGetUserByEmailEndpoint +{ + private readonly IHttpClientFactory factory; + private readonly IHttpMessageFactory httpMessageFactory; + + public GetUserByEmailEndpoint( + IHttpClientFactory factory, + IHttpMessageFactory httpMessageFactory) + { + this.factory = factory; + this.httpMessageFactory = httpMessageFactory; + } + + public async Task ExecuteAsync( + GetUserByEmailParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default) + { + var client = factory.CreateClient(httpClientName); + + var requestBuilder = httpMessageFactory.FromTemplate("/api/v1/users/email"); + requestBuilder.WithQueryParameter("email", parameters.Email); + + using var requestMessage = requestBuilder.Build(HttpMethod.Get); + using var response = await client.SendAsync(requestMessage, cancellationToken); + + var responseBuilder = httpMessageFactory.FromResponse(response); + responseBuilder.AddSuccessResponse(HttpStatusCode.OK); + responseBuilder.AddErrorResponse(HttpStatusCode.BadRequest); + responseBuilder.AddErrorResponse(HttpStatusCode.NotFound); + responseBuilder.AddErrorResponse(HttpStatusCode.Conflict); + return await responseBuilder.BuildResponseAsync(x => new GetUserByEmailEndpointResult(x), cancellationToken); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/GetUserByEmailEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/GetUserByEmailEndpointResult.verified.cs new file mode 100644 index 000000000..1351860fb --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/GetUserByEmailEndpointResult.verified.cs @@ -0,0 +1,53 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints; + +/// +/// Client Endpoint result. +/// Description: Get user by email. +/// Operation: GetUserByEmail. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetUserByEmailEndpointResult : EndpointResponse, IGetUserByEmailEndpointResult +{ + public GetUserByEmailEndpointResult(EndpointResponse response) + : base(response) + { + } + + public bool IsOk + => StatusCode == HttpStatusCode.OK; + + public bool IsBadRequest + => StatusCode == HttpStatusCode.BadRequest; + + public bool IsNotFound + => StatusCode == HttpStatusCode.NotFound; + + public bool IsConflict + => StatusCode == HttpStatusCode.Conflict; + + public User OkContent + => IsOk && ContentObject is User result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsOk property first."); + + public string? BadRequestContent + => IsBadRequest && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsBadRequest property first."); + + public string? NotFoundContent + => IsNotFound && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsNotFound property first."); + + public string? ConflictContent + => IsConflict && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsConflict property first."); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/GetUserByIdEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/GetUserByIdEndpoint.verified.cs new file mode 100644 index 000000000..2521584c4 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/GetUserByIdEndpoint.verified.cs @@ -0,0 +1,48 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints; + +/// +/// Client Endpoint. +/// Description: Get user by id. +/// Operation: GetUserById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetUserByIdEndpoint : IGetUserByIdEndpoint +{ + private readonly IHttpClientFactory factory; + private readonly IHttpMessageFactory httpMessageFactory; + + public GetUserByIdEndpoint( + IHttpClientFactory factory, + IHttpMessageFactory httpMessageFactory) + { + this.factory = factory; + this.httpMessageFactory = httpMessageFactory; + } + + public async Task ExecuteAsync( + GetUserByIdParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default) + { + var client = factory.CreateClient(httpClientName); + + var requestBuilder = httpMessageFactory.FromTemplate("/api/v1/users/{id}"); + requestBuilder.WithPathParameter("id", parameters.Id); + + using var requestMessage = requestBuilder.Build(HttpMethod.Get); + using var response = await client.SendAsync(requestMessage, cancellationToken); + + var responseBuilder = httpMessageFactory.FromResponse(response); + responseBuilder.AddSuccessResponse(HttpStatusCode.OK); + responseBuilder.AddErrorResponse(HttpStatusCode.BadRequest); + responseBuilder.AddErrorResponse(HttpStatusCode.NotFound); + responseBuilder.AddErrorResponse(HttpStatusCode.Conflict); + return await responseBuilder.BuildResponseAsync(x => new GetUserByIdEndpointResult(x), cancellationToken); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/GetUserByIdEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/GetUserByIdEndpointResult.verified.cs new file mode 100644 index 000000000..485c83ba8 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/GetUserByIdEndpointResult.verified.cs @@ -0,0 +1,53 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints; + +/// +/// Client Endpoint result. +/// Description: Get user by id. +/// Operation: GetUserById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetUserByIdEndpointResult : EndpointResponse, IGetUserByIdEndpointResult +{ + public GetUserByIdEndpointResult(EndpointResponse response) + : base(response) + { + } + + public bool IsOk + => StatusCode == HttpStatusCode.OK; + + public bool IsBadRequest + => StatusCode == HttpStatusCode.BadRequest; + + public bool IsNotFound + => StatusCode == HttpStatusCode.NotFound; + + public bool IsConflict + => StatusCode == HttpStatusCode.Conflict; + + public User OkContent + => IsOk && ContentObject is User result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsOk property first."); + + public string? BadRequestContent + => IsBadRequest && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsBadRequest property first."); + + public string? NotFoundContent + => IsNotFound && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsNotFound property first."); + + public string? ConflictContent + => IsConflict && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsConflict property first."); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/GetUsersEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/GetUsersEndpoint.verified.cs new file mode 100644 index 000000000..0390b15a2 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/GetUsersEndpoint.verified.cs @@ -0,0 +1,44 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints; + +/// +/// Client Endpoint. +/// Description: Get all users. +/// Operation: GetUsers. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetUsersEndpoint : IGetUsersEndpoint +{ + private readonly IHttpClientFactory factory; + private readonly IHttpMessageFactory httpMessageFactory; + + public GetUsersEndpoint( + IHttpClientFactory factory, + IHttpMessageFactory httpMessageFactory) + { + this.factory = factory; + this.httpMessageFactory = httpMessageFactory; + } + + public async Task ExecuteAsync( + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default) + { + var client = factory.CreateClient(httpClientName); + + var requestBuilder = httpMessageFactory.FromTemplate("/api/v1/users"); + + using var requestMessage = requestBuilder.Build(HttpMethod.Get); + using var response = await client.SendAsync(requestMessage, cancellationToken); + + var responseBuilder = httpMessageFactory.FromResponse(response); + responseBuilder.AddSuccessResponse>(HttpStatusCode.OK); + responseBuilder.AddErrorResponse(HttpStatusCode.Conflict); + return await responseBuilder.BuildResponseAsync(x => new GetUsersEndpointResult(x), cancellationToken); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/GetUsersEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/GetUsersEndpointResult.verified.cs new file mode 100644 index 000000000..b5a40f6d8 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/GetUsersEndpointResult.verified.cs @@ -0,0 +1,37 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints; + +/// +/// Client Endpoint result. +/// Description: Get all users. +/// Operation: GetUsers. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetUsersEndpointResult : EndpointResponse, IGetUsersEndpointResult +{ + public GetUsersEndpointResult(EndpointResponse response) + : base(response) + { + } + + public bool IsOk + => StatusCode == HttpStatusCode.OK; + + public bool IsConflict + => StatusCode == HttpStatusCode.Conflict; + + public IEnumerable OkContent + => IsOk && ContentObject is IEnumerable result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsOk property first."); + + public string? ConflictContent + => IsConflict && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsConflict property first."); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IDeleteUserByIdEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IDeleteUserByIdEndpoint.verified.cs new file mode 100644 index 000000000..5a4c71446 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IDeleteUserByIdEndpoint.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint. +/// Description: Delete user by id. +/// Operation: DeleteUserById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IDeleteUserByIdEndpoint +{ + /// + /// Execute method. + /// + /// The parameters. + /// The http client name. + /// The cancellation token. + Task ExecuteAsync( + DeleteUserByIdParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IDeleteUserByIdEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IDeleteUserByIdEndpointResult.verified.cs new file mode 100644 index 000000000..fe771350d --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IDeleteUserByIdEndpointResult.verified.cs @@ -0,0 +1,33 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint Result. +/// Description: Delete user by id. +/// Operation: DeleteUserById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IDeleteUserByIdEndpointResult : IEndpointResponse +{ + + bool IsOk { get; } + + bool IsBadRequest { get; } + + bool IsNotFound { get; } + + bool IsConflict { get; } + + string? OkContent { get; } + + string? BadRequestContent { get; } + + string? NotFoundContent { get; } + + string? ConflictContent { get; } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IGetUserByEmailEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IGetUserByEmailEndpoint.verified.cs new file mode 100644 index 000000000..6ccc64469 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IGetUserByEmailEndpoint.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint. +/// Description: Get user by email. +/// Operation: GetUserByEmail. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetUserByEmailEndpoint +{ + /// + /// Execute method. + /// + /// The parameters. + /// The http client name. + /// The cancellation token. + Task ExecuteAsync( + GetUserByEmailParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IGetUserByEmailEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IGetUserByEmailEndpointResult.verified.cs new file mode 100644 index 000000000..4082b0a3d --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IGetUserByEmailEndpointResult.verified.cs @@ -0,0 +1,33 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint Result. +/// Description: Get user by email. +/// Operation: GetUserByEmail. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetUserByEmailEndpointResult : IEndpointResponse +{ + + bool IsOk { get; } + + bool IsBadRequest { get; } + + bool IsNotFound { get; } + + bool IsConflict { get; } + + User OkContent { get; } + + string? BadRequestContent { get; } + + string? NotFoundContent { get; } + + string? ConflictContent { get; } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IGetUserByIdEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IGetUserByIdEndpoint.verified.cs new file mode 100644 index 000000000..f587bebbe --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IGetUserByIdEndpoint.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint. +/// Description: Get user by id. +/// Operation: GetUserById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetUserByIdEndpoint +{ + /// + /// Execute method. + /// + /// The parameters. + /// The http client name. + /// The cancellation token. + Task ExecuteAsync( + GetUserByIdParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IGetUserByIdEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IGetUserByIdEndpointResult.verified.cs new file mode 100644 index 000000000..7e47ed12f --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IGetUserByIdEndpointResult.verified.cs @@ -0,0 +1,33 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint Result. +/// Description: Get user by id. +/// Operation: GetUserById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetUserByIdEndpointResult : IEndpointResponse +{ + + bool IsOk { get; } + + bool IsBadRequest { get; } + + bool IsNotFound { get; } + + bool IsConflict { get; } + + User OkContent { get; } + + string? BadRequestContent { get; } + + string? NotFoundContent { get; } + + string? ConflictContent { get; } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IGetUsersEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IGetUsersEndpoint.verified.cs new file mode 100644 index 000000000..e5713f683 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IGetUsersEndpoint.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint. +/// Description: Get all users. +/// Operation: GetUsers. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetUsersEndpoint +{ + /// + /// Execute method. + /// + /// The http client name. + /// The cancellation token. + Task ExecuteAsync( + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IGetUsersEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IGetUsersEndpointResult.verified.cs new file mode 100644 index 000000000..300a2c657 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IGetUsersEndpointResult.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint Result. +/// Description: Get all users. +/// Operation: GetUsers. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetUsersEndpointResult : IEndpointResponse +{ + + bool IsOk { get; } + + bool IsConflict { get; } + + IEnumerable OkContent { get; } + + string? ConflictContent { get; } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IPostUserEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IPostUserEndpoint.verified.cs new file mode 100644 index 000000000..0fe3778fe --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IPostUserEndpoint.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint. +/// Description: Create a new user. +/// Operation: PostUser. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IPostUserEndpoint +{ + /// + /// Execute method. + /// + /// The parameters. + /// The http client name. + /// The cancellation token. + Task ExecuteAsync( + PostUserParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IPostUserEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IPostUserEndpointResult.verified.cs new file mode 100644 index 000000000..5b8a616e3 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IPostUserEndpointResult.verified.cs @@ -0,0 +1,29 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint Result. +/// Description: Create a new user. +/// Operation: PostUser. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IPostUserEndpointResult : IEndpointResponse +{ + + bool IsCreated { get; } + + bool IsBadRequest { get; } + + bool IsConflict { get; } + + string? CreatedContent { get; } + + string? BadRequestContent { get; } + + string? ConflictContent { get; } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IUpdateMyTestGenderEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IUpdateMyTestGenderEndpoint.verified.cs new file mode 100644 index 000000000..1d3bf7535 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IUpdateMyTestGenderEndpoint.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint. +/// Description: Update gender on a user. +/// Operation: UpdateMyTestGender. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IUpdateMyTestGenderEndpoint +{ + /// + /// Execute method. + /// + /// The parameters. + /// The http client name. + /// The cancellation token. + Task ExecuteAsync( + UpdateMyTestGenderParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IUpdateMyTestGenderEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IUpdateMyTestGenderEndpointResult.verified.cs new file mode 100644 index 000000000..deff37592 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IUpdateMyTestGenderEndpointResult.verified.cs @@ -0,0 +1,33 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint Result. +/// Description: Update gender on a user. +/// Operation: UpdateMyTestGender. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IUpdateMyTestGenderEndpointResult : IEndpointResponse +{ + + bool IsOk { get; } + + bool IsBadRequest { get; } + + bool IsNotFound { get; } + + bool IsConflict { get; } + + string? OkContent { get; } + + string? BadRequestContent { get; } + + string? NotFoundContent { get; } + + string? ConflictContent { get; } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IUpdateUserByIdEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IUpdateUserByIdEndpoint.verified.cs new file mode 100644 index 000000000..ae7d21b63 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IUpdateUserByIdEndpoint.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint. +/// Description: Update user by id. +/// Operation: UpdateUserById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IUpdateUserByIdEndpoint +{ + /// + /// Execute method. + /// + /// The parameters. + /// The http client name. + /// The cancellation token. + Task ExecuteAsync( + UpdateUserByIdParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IUpdateUserByIdEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IUpdateUserByIdEndpointResult.verified.cs new file mode 100644 index 000000000..0c6536cdd --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IUpdateUserByIdEndpointResult.verified.cs @@ -0,0 +1,33 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint Result. +/// Description: Update user by id. +/// Operation: UpdateUserById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IUpdateUserByIdEndpointResult : IEndpointResponse +{ + + bool IsOk { get; } + + bool IsBadRequest { get; } + + bool IsNotFound { get; } + + bool IsConflict { get; } + + string? OkContent { get; } + + string? BadRequestContent { get; } + + string? NotFoundContent { get; } + + string? ConflictContent { get; } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/PostUserEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/PostUserEndpoint.verified.cs new file mode 100644 index 000000000..77ee39cd8 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/PostUserEndpoint.verified.cs @@ -0,0 +1,47 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints; + +/// +/// Client Endpoint. +/// Description: Create a new user. +/// Operation: PostUser. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class PostUserEndpoint : IPostUserEndpoint +{ + private readonly IHttpClientFactory factory; + private readonly IHttpMessageFactory httpMessageFactory; + + public PostUserEndpoint( + IHttpClientFactory factory, + IHttpMessageFactory httpMessageFactory) + { + this.factory = factory; + this.httpMessageFactory = httpMessageFactory; + } + + public async Task ExecuteAsync( + PostUserParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default) + { + var client = factory.CreateClient(httpClientName); + + var requestBuilder = httpMessageFactory.FromTemplate("/api/v1/users"); + requestBuilder.WithBody(parameters.Request); + + using var requestMessage = requestBuilder.Build(HttpMethod.Post); + using var response = await client.SendAsync(requestMessage, cancellationToken); + + var responseBuilder = httpMessageFactory.FromResponse(response); + responseBuilder.AddErrorResponse(HttpStatusCode.Created); + responseBuilder.AddErrorResponse(HttpStatusCode.BadRequest); + responseBuilder.AddErrorResponse(HttpStatusCode.Conflict); + return await responseBuilder.BuildResponseAsync(x => new PostUserEndpointResult(x), cancellationToken); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/PostUserEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/PostUserEndpointResult.verified.cs new file mode 100644 index 000000000..48f28ce64 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/PostUserEndpointResult.verified.cs @@ -0,0 +1,45 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints; + +/// +/// Client Endpoint result. +/// Description: Create a new user. +/// Operation: PostUser. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class PostUserEndpointResult : EndpointResponse, IPostUserEndpointResult +{ + public PostUserEndpointResult(EndpointResponse response) + : base(response) + { + } + + public bool IsCreated + => StatusCode == HttpStatusCode.Created; + + public bool IsBadRequest + => StatusCode == HttpStatusCode.BadRequest; + + public bool IsConflict + => StatusCode == HttpStatusCode.Conflict; + + public string? CreatedContent + => IsCreated && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsCreated property first."); + + public string? BadRequestContent + => IsBadRequest && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsBadRequest property first."); + + public string? ConflictContent + => IsConflict && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsConflict property first."); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/UpdateMyTestGenderEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/UpdateMyTestGenderEndpoint.verified.cs new file mode 100644 index 000000000..8bed2c7da --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/UpdateMyTestGenderEndpoint.verified.cs @@ -0,0 +1,50 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints; + +/// +/// Client Endpoint. +/// Description: Update gender on a user. +/// Operation: UpdateMyTestGender. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateMyTestGenderEndpoint : IUpdateMyTestGenderEndpoint +{ + private readonly IHttpClientFactory factory; + private readonly IHttpMessageFactory httpMessageFactory; + + public UpdateMyTestGenderEndpoint( + IHttpClientFactory factory, + IHttpMessageFactory httpMessageFactory) + { + this.factory = factory; + this.httpMessageFactory = httpMessageFactory; + } + + public async Task ExecuteAsync( + UpdateMyTestGenderParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default) + { + var client = factory.CreateClient(httpClientName); + + var requestBuilder = httpMessageFactory.FromTemplate("/api/v1/users/{id}/gender"); + requestBuilder.WithPathParameter("id", parameters.Id); + requestBuilder.WithQueryParameter("genderParam", parameters.GenderParam); + requestBuilder.WithBody(parameters.Request); + + using var requestMessage = requestBuilder.Build(HttpMethod.Put); + using var response = await client.SendAsync(requestMessage, cancellationToken); + + var responseBuilder = httpMessageFactory.FromResponse(response); + responseBuilder.AddSuccessResponse(HttpStatusCode.OK); + responseBuilder.AddErrorResponse(HttpStatusCode.BadRequest); + responseBuilder.AddErrorResponse(HttpStatusCode.NotFound); + responseBuilder.AddErrorResponse(HttpStatusCode.Conflict); + return await responseBuilder.BuildResponseAsync(x => new UpdateMyTestGenderEndpointResult(x), cancellationToken); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/UpdateMyTestGenderEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/UpdateMyTestGenderEndpointResult.verified.cs new file mode 100644 index 000000000..81ffe6b88 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/UpdateMyTestGenderEndpointResult.verified.cs @@ -0,0 +1,53 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints; + +/// +/// Client Endpoint result. +/// Description: Update gender on a user. +/// Operation: UpdateMyTestGender. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateMyTestGenderEndpointResult : EndpointResponse, IUpdateMyTestGenderEndpointResult +{ + public UpdateMyTestGenderEndpointResult(EndpointResponse response) + : base(response) + { + } + + public bool IsOk + => StatusCode == HttpStatusCode.OK; + + public bool IsBadRequest + => StatusCode == HttpStatusCode.BadRequest; + + public bool IsNotFound + => StatusCode == HttpStatusCode.NotFound; + + public bool IsConflict + => StatusCode == HttpStatusCode.Conflict; + + public string? OkContent + => IsOk && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsOk property first."); + + public string? BadRequestContent + => IsBadRequest && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsBadRequest property first."); + + public string? NotFoundContent + => IsNotFound && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsNotFound property first."); + + public string? ConflictContent + => IsConflict && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsConflict property first."); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/UpdateUserByIdEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/UpdateUserByIdEndpoint.verified.cs new file mode 100644 index 000000000..60f99df46 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/UpdateUserByIdEndpoint.verified.cs @@ -0,0 +1,49 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints; + +/// +/// Client Endpoint. +/// Description: Update user by id. +/// Operation: UpdateUserById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateUserByIdEndpoint : IUpdateUserByIdEndpoint +{ + private readonly IHttpClientFactory factory; + private readonly IHttpMessageFactory httpMessageFactory; + + public UpdateUserByIdEndpoint( + IHttpClientFactory factory, + IHttpMessageFactory httpMessageFactory) + { + this.factory = factory; + this.httpMessageFactory = httpMessageFactory; + } + + public async Task ExecuteAsync( + UpdateUserByIdParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default) + { + var client = factory.CreateClient(httpClientName); + + var requestBuilder = httpMessageFactory.FromTemplate("/api/v1/users/{id}"); + requestBuilder.WithPathParameter("id", parameters.Id); + requestBuilder.WithBody(parameters.Request); + + using var requestMessage = requestBuilder.Build(HttpMethod.Put); + using var response = await client.SendAsync(requestMessage, cancellationToken); + + var responseBuilder = httpMessageFactory.FromResponse(response); + responseBuilder.AddSuccessResponse(HttpStatusCode.OK); + responseBuilder.AddErrorResponse(HttpStatusCode.BadRequest); + responseBuilder.AddErrorResponse(HttpStatusCode.NotFound); + responseBuilder.AddErrorResponse(HttpStatusCode.Conflict); + return await responseBuilder.BuildResponseAsync(x => new UpdateUserByIdEndpointResult(x), cancellationToken); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/UpdateUserByIdEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/UpdateUserByIdEndpointResult.verified.cs new file mode 100644 index 000000000..35da9f366 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WOPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/UpdateUserByIdEndpointResult.verified.cs @@ -0,0 +1,53 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints; + +/// +/// Client Endpoint result. +/// Description: Update user by id. +/// Operation: UpdateUserById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateUserByIdEndpointResult : EndpointResponse, IUpdateUserByIdEndpointResult +{ + public UpdateUserByIdEndpointResult(EndpointResponse response) + : base(response) + { + } + + public bool IsOk + => StatusCode == HttpStatusCode.OK; + + public bool IsBadRequest + => StatusCode == HttpStatusCode.BadRequest; + + public bool IsNotFound + => StatusCode == HttpStatusCode.NotFound; + + public bool IsConflict + => StatusCode == HttpStatusCode.Conflict; + + public string? OkContent + => IsOk && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsOk property first."); + + public string? BadRequestContent + => IsBadRequest && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsBadRequest property first."); + + public string? NotFoundContent + => IsNotFound && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsNotFound property first."); + + public string? ConflictContent + => IsConflict && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsConflict property first."); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Accounts/MyContracts/RequestParameters/SetAccountNameParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Accounts/MyContracts/RequestParameters/SetAccountNameParameters.verified.cs new file mode 100644 index 000000000..ebd55f30f --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Accounts/MyContracts/RequestParameters/SetAccountNameParameters.verified.cs @@ -0,0 +1,32 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Accounts.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Set name of account. +/// Operation: SetAccountName. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class SetAccountNameParameters +{ + /// + /// The accountId. + /// + [Required] + public Guid AccountId { get; set; } + + /// + /// UpdateAccountRequest. + /// + [Required] + public UpdateAccountRequest Request { get; set; } + + /// + public override string ToString() + => $"{nameof(AccountId)}: {AccountId}, {nameof(Request)}: ({Request})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Accounts/MyContracts/RequestParameters/UpdateAccountNameParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Accounts/MyContracts/RequestParameters/UpdateAccountNameParameters.verified.cs new file mode 100644 index 000000000..8a179d181 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Accounts/MyContracts/RequestParameters/UpdateAccountNameParameters.verified.cs @@ -0,0 +1,31 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Accounts.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Update name of account. +/// Operation: UpdateAccountName. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateAccountNameParameters +{ + /// + /// The accountId. + /// + [Required] + public Guid AccountId { get; set; } + + /// + /// The account name. + /// + public string Name { get; set; } + + /// + public override string ToString() + => $"{nameof(AccountId)}: {AccountId}, {nameof(Name)}: {Name}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Accounts/MyContracts/UpdateAccountRequest.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Accounts/MyContracts/UpdateAccountRequest.verified.cs new file mode 100644 index 000000000..892a401ed --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Accounts/MyContracts/UpdateAccountRequest.verified.cs @@ -0,0 +1,20 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Accounts.MyContracts; + +/// +/// UpdateAccountRequest. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateAccountRequest +{ + public string Name { get; set; } + + /// + public override string ToString() + => $"{nameof(Name)}: {Name}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Accounts/MyEndpoints/Interfaces/ISetAccountNameEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Accounts/MyEndpoints/Interfaces/ISetAccountNameEndpoint.verified.cs new file mode 100644 index 000000000..7dd9edc6d --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Accounts/MyEndpoints/Interfaces/ISetAccountNameEndpoint.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Accounts.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint. +/// Description: Set name of account. +/// Operation: SetAccountName. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface ISetAccountNameEndpoint +{ + /// + /// Execute method. + /// + /// The parameters. + /// The http client name. + /// The cancellation token. + Task ExecuteAsync( + SetAccountNameParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Accounts/MyEndpoints/Interfaces/ISetAccountNameEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Accounts/MyEndpoints/Interfaces/ISetAccountNameEndpointResult.verified.cs new file mode 100644 index 000000000..f91dc6547 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Accounts/MyEndpoints/Interfaces/ISetAccountNameEndpointResult.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Accounts.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint Result. +/// Description: Set name of account. +/// Operation: SetAccountName. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface ISetAccountNameEndpointResult : IEndpointResponse +{ + + bool IsOk { get; } + + bool IsBadRequest { get; } + + string? OkContent { get; } + + ValidationProblemDetails BadRequestContent { get; } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Accounts/MyEndpoints/Interfaces/IUpdateAccountNameEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Accounts/MyEndpoints/Interfaces/IUpdateAccountNameEndpoint.verified.cs new file mode 100644 index 000000000..ae216ccb0 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Accounts/MyEndpoints/Interfaces/IUpdateAccountNameEndpoint.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Accounts.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint. +/// Description: Update name of account. +/// Operation: UpdateAccountName. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IUpdateAccountNameEndpoint +{ + /// + /// Execute method. + /// + /// The parameters. + /// The http client name. + /// The cancellation token. + Task ExecuteAsync( + UpdateAccountNameParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Accounts/MyEndpoints/Interfaces/IUpdateAccountNameEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Accounts/MyEndpoints/Interfaces/IUpdateAccountNameEndpointResult.verified.cs new file mode 100644 index 000000000..f615dd891 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Accounts/MyEndpoints/Interfaces/IUpdateAccountNameEndpointResult.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Accounts.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint Result. +/// Description: Update name of account. +/// Operation: UpdateAccountName. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IUpdateAccountNameEndpointResult : IEndpointResponse +{ + + bool IsOk { get; } + + bool IsBadRequest { get; } + + string? OkContent { get; } + + ValidationProblemDetails BadRequestContent { get; } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Accounts/MyEndpoints/SetAccountNameEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Accounts/MyEndpoints/SetAccountNameEndpoint.verified.cs new file mode 100644 index 000000000..1f717bf17 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Accounts/MyEndpoints/SetAccountNameEndpoint.verified.cs @@ -0,0 +1,47 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Accounts.MyEndpoints; + +/// +/// Client Endpoint. +/// Description: Set name of account. +/// Operation: SetAccountName. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class SetAccountNameEndpoint : ISetAccountNameEndpoint +{ + private readonly IHttpClientFactory factory; + private readonly IHttpMessageFactory httpMessageFactory; + + public SetAccountNameEndpoint( + IHttpClientFactory factory, + IHttpMessageFactory httpMessageFactory) + { + this.factory = factory; + this.httpMessageFactory = httpMessageFactory; + } + + public async Task ExecuteAsync( + SetAccountNameParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default) + { + var client = factory.CreateClient(httpClientName); + + var requestBuilder = httpMessageFactory.FromTemplate("/api/v1/accounts/{accountId}/name"); + requestBuilder.WithPathParameter("accountId", parameters.AccountId); + requestBuilder.WithBody(parameters.Request); + + using var requestMessage = requestBuilder.Build(HttpMethod.Post); + using var response = await client.SendAsync(requestMessage, cancellationToken); + + var responseBuilder = httpMessageFactory.FromResponse(response); + responseBuilder.AddSuccessResponse(HttpStatusCode.OK); + responseBuilder.AddErrorResponse(HttpStatusCode.BadRequest); + return await responseBuilder.BuildResponseAsync(x => new SetAccountNameEndpointResult(x), cancellationToken); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Accounts/MyEndpoints/SetAccountNameEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Accounts/MyEndpoints/SetAccountNameEndpointResult.verified.cs new file mode 100644 index 000000000..b11f8a918 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Accounts/MyEndpoints/SetAccountNameEndpointResult.verified.cs @@ -0,0 +1,37 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Accounts.MyEndpoints; + +/// +/// Client Endpoint result. +/// Description: Set name of account. +/// Operation: SetAccountName. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class SetAccountNameEndpointResult : EndpointResponse, ISetAccountNameEndpointResult +{ + public SetAccountNameEndpointResult(EndpointResponse response) + : base(response) + { + } + + public bool IsOk + => StatusCode == HttpStatusCode.OK; + + public bool IsBadRequest + => StatusCode == HttpStatusCode.BadRequest; + + public string? OkContent + => IsOk && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsOk property first."); + + public ValidationProblemDetails BadRequestContent + => IsBadRequest && ContentObject is ValidationProblemDetails result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsBadRequest property first."); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Accounts/MyEndpoints/UpdateAccountNameEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Accounts/MyEndpoints/UpdateAccountNameEndpoint.verified.cs new file mode 100644 index 000000000..9128f0b5e --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Accounts/MyEndpoints/UpdateAccountNameEndpoint.verified.cs @@ -0,0 +1,47 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Accounts.MyEndpoints; + +/// +/// Client Endpoint. +/// Description: Update name of account. +/// Operation: UpdateAccountName. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateAccountNameEndpoint : IUpdateAccountNameEndpoint +{ + private readonly IHttpClientFactory factory; + private readonly IHttpMessageFactory httpMessageFactory; + + public UpdateAccountNameEndpoint( + IHttpClientFactory factory, + IHttpMessageFactory httpMessageFactory) + { + this.factory = factory; + this.httpMessageFactory = httpMessageFactory; + } + + public async Task ExecuteAsync( + UpdateAccountNameParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default) + { + var client = factory.CreateClient(httpClientName); + + var requestBuilder = httpMessageFactory.FromTemplate("/api/v1/accounts/{accountId}/name"); + requestBuilder.WithPathParameter("accountId", parameters.AccountId); + requestBuilder.WithHeaderParameter("name", parameters.Name); + + using var requestMessage = requestBuilder.Build(HttpMethod.Put); + using var response = await client.SendAsync(requestMessage, cancellationToken); + + var responseBuilder = httpMessageFactory.FromResponse(response); + responseBuilder.AddSuccessResponse(HttpStatusCode.OK); + responseBuilder.AddErrorResponse(HttpStatusCode.BadRequest); + return await responseBuilder.BuildResponseAsync(x => new UpdateAccountNameEndpointResult(x), cancellationToken); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Accounts/MyEndpoints/UpdateAccountNameEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Accounts/MyEndpoints/UpdateAccountNameEndpointResult.verified.cs new file mode 100644 index 000000000..6f85d5bc9 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Accounts/MyEndpoints/UpdateAccountNameEndpointResult.verified.cs @@ -0,0 +1,37 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Accounts.MyEndpoints; + +/// +/// Client Endpoint result. +/// Description: Update name of account. +/// Operation: UpdateAccountName. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateAccountNameEndpointResult : EndpointResponse, IUpdateAccountNameEndpointResult +{ + public UpdateAccountNameEndpointResult(EndpointResponse response) + : base(response) + { + } + + public bool IsOk + => StatusCode == HttpStatusCode.OK; + + public bool IsBadRequest + => StatusCode == HttpStatusCode.BadRequest; + + public string? OkContent + => IsOk && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsOk property first."); + + public ValidationProblemDetails BadRequestContent + => IsBadRequest && ContentObject is ValidationProblemDetails result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsBadRequest property first."); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Addresses/MyContracts/RequestParameters/GetAddressesByPostalCodesParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Addresses/MyContracts/RequestParameters/GetAddressesByPostalCodesParameters.verified.cs new file mode 100644 index 000000000..4a4dccec8 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Addresses/MyContracts/RequestParameters/GetAddressesByPostalCodesParameters.verified.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Addresses.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Get addresses by postal code. +/// Operation: GetAddressesByPostalCodes. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetAddressesByPostalCodesParameters +{ + /// + /// The postalCode to limit addresses on. + /// + [Required] + public string PostalCode { get; set; } + + /// + public override string ToString() + => $"{nameof(PostalCode)}: {PostalCode}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Addresses/MyEndpoints/GetAddressesByPostalCodesEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Addresses/MyEndpoints/GetAddressesByPostalCodesEndpoint.verified.cs new file mode 100644 index 000000000..a29fbb34e --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Addresses/MyEndpoints/GetAddressesByPostalCodesEndpoint.verified.cs @@ -0,0 +1,47 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Addresses.MyEndpoints; + +/// +/// Client Endpoint. +/// Description: Get addresses by postal code. +/// Operation: GetAddressesByPostalCodes. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetAddressesByPostalCodesEndpoint : IGetAddressesByPostalCodesEndpoint +{ + private readonly IHttpClientFactory factory; + private readonly IHttpMessageFactory httpMessageFactory; + + public GetAddressesByPostalCodesEndpoint( + IHttpClientFactory factory, + IHttpMessageFactory httpMessageFactory) + { + this.factory = factory; + this.httpMessageFactory = httpMessageFactory; + } + + public async Task ExecuteAsync( + GetAddressesByPostalCodesParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default) + { + var client = factory.CreateClient(httpClientName); + + var requestBuilder = httpMessageFactory.FromTemplate("/api/v1/addresses/{postalCode}"); + requestBuilder.WithPathParameter("postalCode", parameters.PostalCode); + + using var requestMessage = requestBuilder.Build(HttpMethod.Get); + using var response = await client.SendAsync(requestMessage, cancellationToken); + + var responseBuilder = httpMessageFactory.FromResponse(response); + responseBuilder.AddSuccessResponse>(HttpStatusCode.OK); + responseBuilder.AddErrorResponse(HttpStatusCode.BadRequest); + responseBuilder.AddErrorResponse(HttpStatusCode.NotFound); + return await responseBuilder.BuildResponseAsync(x => new GetAddressesByPostalCodesEndpointResult(x), cancellationToken); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Addresses/MyEndpoints/GetAddressesByPostalCodesEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Addresses/MyEndpoints/GetAddressesByPostalCodesEndpointResult.verified.cs new file mode 100644 index 000000000..3caa1c7f7 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Addresses/MyEndpoints/GetAddressesByPostalCodesEndpointResult.verified.cs @@ -0,0 +1,45 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Addresses.MyEndpoints; + +/// +/// Client Endpoint result. +/// Description: Get addresses by postal code. +/// Operation: GetAddressesByPostalCodes. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetAddressesByPostalCodesEndpointResult : EndpointResponse, IGetAddressesByPostalCodesEndpointResult +{ + public GetAddressesByPostalCodesEndpointResult(EndpointResponse response) + : base(response) + { + } + + public bool IsOk + => StatusCode == HttpStatusCode.OK; + + public bool IsBadRequest + => StatusCode == HttpStatusCode.BadRequest; + + public bool IsNotFound + => StatusCode == HttpStatusCode.NotFound; + + public IEnumerable
OkContent + => IsOk && ContentObject is IEnumerable
result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsOk property first."); + + public ValidationProblemDetails BadRequestContent + => IsBadRequest && ContentObject is ValidationProblemDetails result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsBadRequest property first."); + + public string? NotFoundContent + => IsNotFound && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsNotFound property first."); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Addresses/MyEndpoints/Interfaces/IGetAddressesByPostalCodesEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Addresses/MyEndpoints/Interfaces/IGetAddressesByPostalCodesEndpoint.verified.cs new file mode 100644 index 000000000..caec7e29d --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Addresses/MyEndpoints/Interfaces/IGetAddressesByPostalCodesEndpoint.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Addresses.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint. +/// Description: Get addresses by postal code. +/// Operation: GetAddressesByPostalCodes. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetAddressesByPostalCodesEndpoint +{ + /// + /// Execute method. + /// + /// The parameters. + /// The http client name. + /// The cancellation token. + Task ExecuteAsync( + GetAddressesByPostalCodesParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Addresses/MyEndpoints/Interfaces/IGetAddressesByPostalCodesEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Addresses/MyEndpoints/Interfaces/IGetAddressesByPostalCodesEndpointResult.verified.cs new file mode 100644 index 000000000..6820b7fa6 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Addresses/MyEndpoints/Interfaces/IGetAddressesByPostalCodesEndpointResult.verified.cs @@ -0,0 +1,29 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Addresses.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint Result. +/// Description: Get addresses by postal code. +/// Operation: GetAddressesByPostalCodes. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetAddressesByPostalCodesEndpointResult : IEndpointResponse +{ + + bool IsOk { get; } + + bool IsBadRequest { get; } + + bool IsNotFound { get; } + + IEnumerable
OkContent { get; } + + ValidationProblemDetails BadRequestContent { get; } + + string? NotFoundContent { get; } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/EventArgs/MyContracts/EventArgs.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/EventArgs/MyContracts/EventArgs.verified.cs new file mode 100644 index 000000000..ca95a836d --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/EventArgs/MyContracts/EventArgs.verified.cs @@ -0,0 +1,22 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.EventArgs.MyContracts; + +/// +/// EventArgs. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class EventArgs +{ + public Guid Id { get; set; } + + public string EventName { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}, {nameof(EventName)}: {EventName}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/EventArgs/MyContracts/RequestParameters/GetEventArgByIdParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/EventArgs/MyContracts/RequestParameters/GetEventArgByIdParameters.verified.cs new file mode 100644 index 000000000..4509c563c --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/EventArgs/MyContracts/RequestParameters/GetEventArgByIdParameters.verified.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.EventArgs.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Get EventArgs By Id. +/// Operation: GetEventArgById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetEventArgByIdParameters +{ + /// + /// The id of the eventArgs. + /// + [Required] + public string Id { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/EventArgs/MyEndpoints/GetEventArgByIdEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/EventArgs/MyEndpoints/GetEventArgByIdEndpoint.verified.cs new file mode 100644 index 000000000..d19708e64 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/EventArgs/MyEndpoints/GetEventArgByIdEndpoint.verified.cs @@ -0,0 +1,47 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.EventArgs.MyEndpoints; + +/// +/// Client Endpoint. +/// Description: Get EventArgs By Id. +/// Operation: GetEventArgById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetEventArgByIdEndpoint : IGetEventArgByIdEndpoint +{ + private readonly IHttpClientFactory factory; + private readonly IHttpMessageFactory httpMessageFactory; + + public GetEventArgByIdEndpoint( + IHttpClientFactory factory, + IHttpMessageFactory httpMessageFactory) + { + this.factory = factory; + this.httpMessageFactory = httpMessageFactory; + } + + public async Task ExecuteAsync( + GetEventArgByIdParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default) + { + var client = factory.CreateClient(httpClientName); + + var requestBuilder = httpMessageFactory.FromTemplate("/api/v1/eventArgs/{id}"); + requestBuilder.WithPathParameter("id", parameters.Id); + + using var requestMessage = requestBuilder.Build(HttpMethod.Get); + using var response = await client.SendAsync(requestMessage, cancellationToken); + + var responseBuilder = httpMessageFactory.FromResponse(response); + responseBuilder.AddSuccessResponse(HttpStatusCode.OK); + responseBuilder.AddErrorResponse(HttpStatusCode.BadRequest); + responseBuilder.AddErrorResponse(HttpStatusCode.NotFound); + return await responseBuilder.BuildResponseAsync(x => new GetEventArgByIdEndpointResult(x), cancellationToken); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/EventArgs/MyEndpoints/GetEventArgByIdEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/EventArgs/MyEndpoints/GetEventArgByIdEndpointResult.verified.cs new file mode 100644 index 000000000..fce49a508 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/EventArgs/MyEndpoints/GetEventArgByIdEndpointResult.verified.cs @@ -0,0 +1,45 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.EventArgs.MyEndpoints; + +/// +/// Client Endpoint result. +/// Description: Get EventArgs By Id. +/// Operation: GetEventArgById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetEventArgByIdEndpointResult : EndpointResponse, IGetEventArgByIdEndpointResult +{ + public GetEventArgByIdEndpointResult(EndpointResponse response) + : base(response) + { + } + + public bool IsOk + => StatusCode == HttpStatusCode.OK; + + public bool IsBadRequest + => StatusCode == HttpStatusCode.BadRequest; + + public bool IsNotFound + => StatusCode == HttpStatusCode.NotFound; + + public Structure1.ApiClient.Generated.EventArgs.MyContracts.EventArgs OkContent + => IsOk && ContentObject is Structure1.ApiClient.Generated.EventArgs.MyContracts.EventArgs result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsOk property first."); + + public ValidationProblemDetails BadRequestContent + => IsBadRequest && ContentObject is ValidationProblemDetails result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsBadRequest property first."); + + public string? NotFoundContent + => IsNotFound && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsNotFound property first."); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/EventArgs/MyEndpoints/GetEventArgsEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/EventArgs/MyEndpoints/GetEventArgsEndpoint.verified.cs new file mode 100644 index 000000000..afdd09edf --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/EventArgs/MyEndpoints/GetEventArgsEndpoint.verified.cs @@ -0,0 +1,43 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.EventArgs.MyEndpoints; + +/// +/// Client Endpoint. +/// Description: Get EventArgs List. +/// Operation: GetEventArgs. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetEventArgsEndpoint : IGetEventArgsEndpoint +{ + private readonly IHttpClientFactory factory; + private readonly IHttpMessageFactory httpMessageFactory; + + public GetEventArgsEndpoint( + IHttpClientFactory factory, + IHttpMessageFactory httpMessageFactory) + { + this.factory = factory; + this.httpMessageFactory = httpMessageFactory; + } + + public async Task ExecuteAsync( + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default) + { + var client = factory.CreateClient(httpClientName); + + var requestBuilder = httpMessageFactory.FromTemplate("/api/v1/eventArgs"); + + using var requestMessage = requestBuilder.Build(HttpMethod.Get); + using var response = await client.SendAsync(requestMessage, cancellationToken); + + var responseBuilder = httpMessageFactory.FromResponse(response); + responseBuilder.AddSuccessResponse>(HttpStatusCode.OK); + return await responseBuilder.BuildResponseAsync(x => new GetEventArgsEndpointResult(x), cancellationToken); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/EventArgs/MyEndpoints/GetEventArgsEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/EventArgs/MyEndpoints/GetEventArgsEndpointResult.verified.cs new file mode 100644 index 000000000..5b80591b1 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/EventArgs/MyEndpoints/GetEventArgsEndpointResult.verified.cs @@ -0,0 +1,29 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.EventArgs.MyEndpoints; + +/// +/// Client Endpoint result. +/// Description: Get EventArgs List. +/// Operation: GetEventArgs. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetEventArgsEndpointResult : EndpointResponse, IGetEventArgsEndpointResult +{ + public GetEventArgsEndpointResult(EndpointResponse response) + : base(response) + { + } + + public bool IsOk + => StatusCode == HttpStatusCode.OK; + + public IEnumerable OkContent + => IsOk && ContentObject is IEnumerable result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsOk property first."); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/EventArgs/MyEndpoints/Interfaces/IGetEventArgByIdEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/EventArgs/MyEndpoints/Interfaces/IGetEventArgByIdEndpoint.verified.cs new file mode 100644 index 000000000..b92c64595 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/EventArgs/MyEndpoints/Interfaces/IGetEventArgByIdEndpoint.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.EventArgs.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint. +/// Description: Get EventArgs By Id. +/// Operation: GetEventArgById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetEventArgByIdEndpoint +{ + /// + /// Execute method. + /// + /// The parameters. + /// The http client name. + /// The cancellation token. + Task ExecuteAsync( + GetEventArgByIdParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/EventArgs/MyEndpoints/Interfaces/IGetEventArgByIdEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/EventArgs/MyEndpoints/Interfaces/IGetEventArgByIdEndpointResult.verified.cs new file mode 100644 index 000000000..5bb3846df --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/EventArgs/MyEndpoints/Interfaces/IGetEventArgByIdEndpointResult.verified.cs @@ -0,0 +1,29 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.EventArgs.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint Result. +/// Description: Get EventArgs By Id. +/// Operation: GetEventArgById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetEventArgByIdEndpointResult : IEndpointResponse +{ + + bool IsOk { get; } + + bool IsBadRequest { get; } + + bool IsNotFound { get; } + + Structure1.ApiClient.Generated.EventArgs.MyContracts.EventArgs OkContent { get; } + + ValidationProblemDetails BadRequestContent { get; } + + string? NotFoundContent { get; } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/EventArgs/MyEndpoints/Interfaces/IGetEventArgsEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/EventArgs/MyEndpoints/Interfaces/IGetEventArgsEndpoint.verified.cs new file mode 100644 index 000000000..e09fea10a --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/EventArgs/MyEndpoints/Interfaces/IGetEventArgsEndpoint.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.EventArgs.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint. +/// Description: Get EventArgs List. +/// Operation: GetEventArgs. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetEventArgsEndpoint +{ + /// + /// Execute method. + /// + /// The http client name. + /// The cancellation token. + Task ExecuteAsync( + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/EventArgs/MyEndpoints/Interfaces/IGetEventArgsEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/EventArgs/MyEndpoints/Interfaces/IGetEventArgsEndpointResult.verified.cs new file mode 100644 index 000000000..4b09921d4 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/EventArgs/MyEndpoints/Interfaces/IGetEventArgsEndpointResult.verified.cs @@ -0,0 +1,21 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.EventArgs.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint Result. +/// Description: Get EventArgs List. +/// Operation: GetEventArgs. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetEventArgsEndpointResult : IEndpointResponse +{ + + bool IsOk { get; } + + IEnumerable OkContent { get; } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyContracts/FileAsFormDataRequest.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyContracts/FileAsFormDataRequest.verified.cs new file mode 100644 index 000000000..130183d18 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyContracts/FileAsFormDataRequest.verified.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyContracts; + +/// +/// FileAsFormDataRequest. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class FileAsFormDataRequest +{ + [Required] + public string ItemName { get; set; } + + public IFormFile? File { get; set; } + + [Required] + public List Items { get; set; } + + /// + public override string ToString() + => $"{nameof(ItemName)}: {ItemName}, {nameof(File)}: {File}, {nameof(Items)}.Count: {Items?.Count ?? 0}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyContracts/FilesAsFormDataRequest.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyContracts/FilesAsFormDataRequest.verified.cs new file mode 100644 index 000000000..72a31c919 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyContracts/FilesAsFormDataRequest.verified.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyContracts; + +/// +/// FilesAsFormDataRequest. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class FilesAsFormDataRequest +{ + /// + /// A list of File(s). + /// + public List Files { get; set; } = new List(); + + /// + public override string ToString() + => $"{nameof(Files)}.Count: {Files?.Count ?? 0}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyContracts/RequestParameters/GetFileByIdParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyContracts/RequestParameters/GetFileByIdParameters.verified.cs new file mode 100644 index 000000000..b7569e00f --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyContracts/RequestParameters/GetFileByIdParameters.verified.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Get File By Id. +/// Operation: GetFileById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetFileByIdParameters +{ + /// + /// The file id. + /// + [Required] + public string Id { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyContracts/RequestParameters/UploadMultiFilesAsFormDataParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyContracts/RequestParameters/UploadMultiFilesAsFormDataParameters.verified.cs new file mode 100644 index 000000000..71ac6707b --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyContracts/RequestParameters/UploadMultiFilesAsFormDataParameters.verified.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Upload multi files as form data. +/// Operation: UploadMultiFilesAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UploadMultiFilesAsFormDataParameters +{ + [Required] + public List Request { get; set; } = new List(); + + /// + public override string ToString() + => $"{nameof(Request)}.Count: {Request?.Count ?? 0}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyContracts/RequestParameters/UploadSingleFileAsFormDataParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyContracts/RequestParameters/UploadSingleFileAsFormDataParameters.verified.cs new file mode 100644 index 000000000..ba28c10f2 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyContracts/RequestParameters/UploadSingleFileAsFormDataParameters.verified.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Upload a file as OctetStream. +/// Operation: UploadSingleFileAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UploadSingleFileAsFormDataParameters +{ + [Required] + public IFormFile Request { get; set; } + + /// + public override string ToString() + => $"{nameof(Request)}: ({Request})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyContracts/RequestParameters/UploadSingleObjectWithFileAsFormDataParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyContracts/RequestParameters/UploadSingleObjectWithFileAsFormDataParameters.verified.cs new file mode 100644 index 000000000..ab3f552f2 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyContracts/RequestParameters/UploadSingleObjectWithFileAsFormDataParameters.verified.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Upload a file as FormData. +/// Operation: UploadSingleObjectWithFileAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UploadSingleObjectWithFileAsFormDataParameters +{ + /// + /// FileAsFormDataRequest. + /// + [Required] + public FileAsFormDataRequest Request { get; set; } + + /// + public override string ToString() + => $"{nameof(Request)}: ({Request})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyContracts/RequestParameters/UploadSingleObjectWithFilesAsFormDataParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyContracts/RequestParameters/UploadSingleObjectWithFilesAsFormDataParameters.verified.cs new file mode 100644 index 000000000..5e2d14dca --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyContracts/RequestParameters/UploadSingleObjectWithFilesAsFormDataParameters.verified.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Upload files as FormData. +/// Operation: UploadSingleObjectWithFilesAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UploadSingleObjectWithFilesAsFormDataParameters +{ + /// + /// FilesAsFormDataRequest. + /// + [Required] + public FilesAsFormDataRequest Request { get; set; } + + /// + public override string ToString() + => $"{nameof(Request)}: ({Request})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/GetFileByIdEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/GetFileByIdEndpoint.verified.cs new file mode 100644 index 000000000..17242b471 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/GetFileByIdEndpoint.verified.cs @@ -0,0 +1,47 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyEndpoints; + +/// +/// Client Endpoint. +/// Description: Get File By Id. +/// Operation: GetFileById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetFileByIdEndpoint : IGetFileByIdEndpoint +{ + private readonly IHttpClientFactory factory; + private readonly IHttpMessageFactory httpMessageFactory; + + public GetFileByIdEndpoint( + IHttpClientFactory factory, + IHttpMessageFactory httpMessageFactory) + { + this.factory = factory; + this.httpMessageFactory = httpMessageFactory; + } + + public async Task ExecuteAsync( + GetFileByIdParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default) + { + var client = factory.CreateClient(httpClientName); + + var requestBuilder = httpMessageFactory.FromTemplate("/api/v1/files/{id}"); + requestBuilder.WithPathParameter("id", parameters.Id); + + using var requestMessage = requestBuilder.Build(HttpMethod.Get); + using var response = await client.SendAsync(requestMessage, cancellationToken); + + var responseBuilder = httpMessageFactory.FromResponse(response); + responseBuilder.AddSuccessResponse(HttpStatusCode.OK); + responseBuilder.AddErrorResponse(HttpStatusCode.BadRequest); + responseBuilder.AddErrorResponse(HttpStatusCode.NotFound); + return await responseBuilder.BuildResponseAsync(x => new GetFileByIdEndpointResult(x), cancellationToken); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/GetFileByIdEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/GetFileByIdEndpointResult.verified.cs new file mode 100644 index 000000000..e59e4a929 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/GetFileByIdEndpointResult.verified.cs @@ -0,0 +1,45 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyEndpoints; + +/// +/// Client Endpoint result. +/// Description: Get File By Id. +/// Operation: GetFileById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetFileByIdEndpointResult : EndpointResponse, IGetFileByIdEndpointResult +{ + public GetFileByIdEndpointResult(EndpointResponse response) + : base(response) + { + } + + public bool IsOk + => StatusCode == HttpStatusCode.OK; + + public bool IsBadRequest + => StatusCode == HttpStatusCode.BadRequest; + + public bool IsNotFound + => StatusCode == HttpStatusCode.NotFound; + + public byte[] OkContent + => IsOk && ContentObject is byte[] result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsOk property first."); + + public ValidationProblemDetails BadRequestContent + => IsBadRequest && ContentObject is ValidationProblemDetails result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsBadRequest property first."); + + public string? NotFoundContent + => IsNotFound && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsNotFound property first."); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IGetFileByIdEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IGetFileByIdEndpoint.verified.cs new file mode 100644 index 000000000..3ecf63afd --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IGetFileByIdEndpoint.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint. +/// Description: Get File By Id. +/// Operation: GetFileById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetFileByIdEndpoint +{ + /// + /// Execute method. + /// + /// The parameters. + /// The http client name. + /// The cancellation token. + Task ExecuteAsync( + GetFileByIdParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IGetFileByIdEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IGetFileByIdEndpointResult.verified.cs new file mode 100644 index 000000000..abdf33b67 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IGetFileByIdEndpointResult.verified.cs @@ -0,0 +1,29 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint Result. +/// Description: Get File By Id. +/// Operation: GetFileById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetFileByIdEndpointResult : IEndpointResponse +{ + + bool IsOk { get; } + + bool IsBadRequest { get; } + + bool IsNotFound { get; } + + byte[] OkContent { get; } + + ValidationProblemDetails BadRequestContent { get; } + + string? NotFoundContent { get; } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IUploadMultiFilesAsFormDataEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IUploadMultiFilesAsFormDataEndpoint.verified.cs new file mode 100644 index 000000000..d4cacc231 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IUploadMultiFilesAsFormDataEndpoint.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint. +/// Description: Upload multi files as form data. +/// Operation: UploadMultiFilesAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IUploadMultiFilesAsFormDataEndpoint +{ + /// + /// Execute method. + /// + /// The parameters. + /// The http client name. + /// The cancellation token. + Task ExecuteAsync( + UploadMultiFilesAsFormDataParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IUploadMultiFilesAsFormDataEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IUploadMultiFilesAsFormDataEndpointResult.verified.cs new file mode 100644 index 000000000..b0fe4dbf6 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IUploadMultiFilesAsFormDataEndpointResult.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint Result. +/// Description: Upload multi files as form data. +/// Operation: UploadMultiFilesAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IUploadMultiFilesAsFormDataEndpointResult : IEndpointResponse +{ + + bool IsOk { get; } + + bool IsBadRequest { get; } + + string? OkContent { get; } + + ValidationProblemDetails BadRequestContent { get; } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IUploadSingleFileAsFormDataEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IUploadSingleFileAsFormDataEndpoint.verified.cs new file mode 100644 index 000000000..fde836c91 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IUploadSingleFileAsFormDataEndpoint.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint. +/// Description: Upload a file as OctetStream. +/// Operation: UploadSingleFileAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IUploadSingleFileAsFormDataEndpoint +{ + /// + /// Execute method. + /// + /// The parameters. + /// The http client name. + /// The cancellation token. + Task ExecuteAsync( + UploadSingleFileAsFormDataParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IUploadSingleFileAsFormDataEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IUploadSingleFileAsFormDataEndpointResult.verified.cs new file mode 100644 index 000000000..5f9813e5c --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IUploadSingleFileAsFormDataEndpointResult.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint Result. +/// Description: Upload a file as OctetStream. +/// Operation: UploadSingleFileAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IUploadSingleFileAsFormDataEndpointResult : IEndpointResponse +{ + + bool IsOk { get; } + + bool IsBadRequest { get; } + + string? OkContent { get; } + + ValidationProblemDetails BadRequestContent { get; } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IUploadSingleObjectWithFileAsFormDataEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IUploadSingleObjectWithFileAsFormDataEndpoint.verified.cs new file mode 100644 index 000000000..860964fd7 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IUploadSingleObjectWithFileAsFormDataEndpoint.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint. +/// Description: Upload a file as FormData. +/// Operation: UploadSingleObjectWithFileAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IUploadSingleObjectWithFileAsFormDataEndpoint +{ + /// + /// Execute method. + /// + /// The parameters. + /// The http client name. + /// The cancellation token. + Task ExecuteAsync( + UploadSingleObjectWithFileAsFormDataParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IUploadSingleObjectWithFileAsFormDataEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IUploadSingleObjectWithFileAsFormDataEndpointResult.verified.cs new file mode 100644 index 000000000..6919f5330 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IUploadSingleObjectWithFileAsFormDataEndpointResult.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint Result. +/// Description: Upload a file as FormData. +/// Operation: UploadSingleObjectWithFileAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IUploadSingleObjectWithFileAsFormDataEndpointResult : IEndpointResponse +{ + + bool IsOk { get; } + + bool IsBadRequest { get; } + + string? OkContent { get; } + + ValidationProblemDetails BadRequestContent { get; } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IUploadSingleObjectWithFilesAsFormDataEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IUploadSingleObjectWithFilesAsFormDataEndpoint.verified.cs new file mode 100644 index 000000000..dbae2f9b1 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IUploadSingleObjectWithFilesAsFormDataEndpoint.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint. +/// Description: Upload files as FormData. +/// Operation: UploadSingleObjectWithFilesAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IUploadSingleObjectWithFilesAsFormDataEndpoint +{ + /// + /// Execute method. + /// + /// The parameters. + /// The http client name. + /// The cancellation token. + Task ExecuteAsync( + UploadSingleObjectWithFilesAsFormDataParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IUploadSingleObjectWithFilesAsFormDataEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IUploadSingleObjectWithFilesAsFormDataEndpointResult.verified.cs new file mode 100644 index 000000000..b1f523bbf --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/Interfaces/IUploadSingleObjectWithFilesAsFormDataEndpointResult.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint Result. +/// Description: Upload files as FormData. +/// Operation: UploadSingleObjectWithFilesAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IUploadSingleObjectWithFilesAsFormDataEndpointResult : IEndpointResponse +{ + + bool IsOk { get; } + + bool IsBadRequest { get; } + + string? OkContent { get; } + + ValidationProblemDetails BadRequestContent { get; } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/UploadMultiFilesAsFormDataEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/UploadMultiFilesAsFormDataEndpoint.verified.cs new file mode 100644 index 000000000..675bccc3c --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/UploadMultiFilesAsFormDataEndpoint.verified.cs @@ -0,0 +1,46 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyEndpoints; + +/// +/// Client Endpoint. +/// Description: Upload multi files as form data. +/// Operation: UploadMultiFilesAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UploadMultiFilesAsFormDataEndpoint : IUploadMultiFilesAsFormDataEndpoint +{ + private readonly IHttpClientFactory factory; + private readonly IHttpMessageFactory httpMessageFactory; + + public UploadMultiFilesAsFormDataEndpoint( + IHttpClientFactory factory, + IHttpMessageFactory httpMessageFactory) + { + this.factory = factory; + this.httpMessageFactory = httpMessageFactory; + } + + public async Task ExecuteAsync( + UploadMultiFilesAsFormDataParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default) + { + var client = factory.CreateClient(httpClientName); + + var requestBuilder = httpMessageFactory.FromTemplate("/api/v1/files/form-data/multiFile"); + // TODO: Imp. With-Form + + using var requestMessage = requestBuilder.Build(HttpMethod.Post); + using var response = await client.SendAsync(requestMessage, cancellationToken); + + var responseBuilder = httpMessageFactory.FromResponse(response); + responseBuilder.AddSuccessResponse(HttpStatusCode.OK); + responseBuilder.AddErrorResponse(HttpStatusCode.BadRequest); + return await responseBuilder.BuildResponseAsync(x => new UploadMultiFilesAsFormDataEndpointResult(x), cancellationToken); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/UploadMultiFilesAsFormDataEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/UploadMultiFilesAsFormDataEndpointResult.verified.cs new file mode 100644 index 000000000..68a8fd9ac --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/UploadMultiFilesAsFormDataEndpointResult.verified.cs @@ -0,0 +1,37 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyEndpoints; + +/// +/// Client Endpoint result. +/// Description: Upload multi files as form data. +/// Operation: UploadMultiFilesAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UploadMultiFilesAsFormDataEndpointResult : EndpointResponse, IUploadMultiFilesAsFormDataEndpointResult +{ + public UploadMultiFilesAsFormDataEndpointResult(EndpointResponse response) + : base(response) + { + } + + public bool IsOk + => StatusCode == HttpStatusCode.OK; + + public bool IsBadRequest + => StatusCode == HttpStatusCode.BadRequest; + + public string? OkContent + => IsOk && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsOk property first."); + + public ValidationProblemDetails BadRequestContent + => IsBadRequest && ContentObject is ValidationProblemDetails result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsBadRequest property first."); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/UploadSingleFileAsFormDataEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/UploadSingleFileAsFormDataEndpoint.verified.cs new file mode 100644 index 000000000..d7b5294c9 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/UploadSingleFileAsFormDataEndpoint.verified.cs @@ -0,0 +1,46 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyEndpoints; + +/// +/// Client Endpoint. +/// Description: Upload a file as OctetStream. +/// Operation: UploadSingleFileAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UploadSingleFileAsFormDataEndpoint : IUploadSingleFileAsFormDataEndpoint +{ + private readonly IHttpClientFactory factory; + private readonly IHttpMessageFactory httpMessageFactory; + + public UploadSingleFileAsFormDataEndpoint( + IHttpClientFactory factory, + IHttpMessageFactory httpMessageFactory) + { + this.factory = factory; + this.httpMessageFactory = httpMessageFactory; + } + + public async Task ExecuteAsync( + UploadSingleFileAsFormDataParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default) + { + var client = factory.CreateClient(httpClientName); + + var requestBuilder = httpMessageFactory.FromTemplate("/api/v1/files/form-data/singleFile"); + requestBuilder.WithBody(parameters.Request); + + using var requestMessage = requestBuilder.Build(HttpMethod.Post); + using var response = await client.SendAsync(requestMessage, cancellationToken); + + var responseBuilder = httpMessageFactory.FromResponse(response); + responseBuilder.AddSuccessResponse(HttpStatusCode.OK); + responseBuilder.AddErrorResponse(HttpStatusCode.BadRequest); + return await responseBuilder.BuildResponseAsync(x => new UploadSingleFileAsFormDataEndpointResult(x), cancellationToken); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/UploadSingleFileAsFormDataEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/UploadSingleFileAsFormDataEndpointResult.verified.cs new file mode 100644 index 000000000..2674baf74 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/UploadSingleFileAsFormDataEndpointResult.verified.cs @@ -0,0 +1,37 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyEndpoints; + +/// +/// Client Endpoint result. +/// Description: Upload a file as OctetStream. +/// Operation: UploadSingleFileAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UploadSingleFileAsFormDataEndpointResult : EndpointResponse, IUploadSingleFileAsFormDataEndpointResult +{ + public UploadSingleFileAsFormDataEndpointResult(EndpointResponse response) + : base(response) + { + } + + public bool IsOk + => StatusCode == HttpStatusCode.OK; + + public bool IsBadRequest + => StatusCode == HttpStatusCode.BadRequest; + + public string? OkContent + => IsOk && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsOk property first."); + + public ValidationProblemDetails BadRequestContent + => IsBadRequest && ContentObject is ValidationProblemDetails result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsBadRequest property first."); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/UploadSingleObjectWithFileAsFormDataEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/UploadSingleObjectWithFileAsFormDataEndpoint.verified.cs new file mode 100644 index 000000000..aabd83e6b --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/UploadSingleObjectWithFileAsFormDataEndpoint.verified.cs @@ -0,0 +1,46 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyEndpoints; + +/// +/// Client Endpoint. +/// Description: Upload a file as FormData. +/// Operation: UploadSingleObjectWithFileAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UploadSingleObjectWithFileAsFormDataEndpoint : IUploadSingleObjectWithFileAsFormDataEndpoint +{ + private readonly IHttpClientFactory factory; + private readonly IHttpMessageFactory httpMessageFactory; + + public UploadSingleObjectWithFileAsFormDataEndpoint( + IHttpClientFactory factory, + IHttpMessageFactory httpMessageFactory) + { + this.factory = factory; + this.httpMessageFactory = httpMessageFactory; + } + + public async Task ExecuteAsync( + UploadSingleObjectWithFileAsFormDataParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default) + { + var client = factory.CreateClient(httpClientName); + + var requestBuilder = httpMessageFactory.FromTemplate("/api/v1/files/form-data/singleObject"); + // TODO: Imp. With-Form + + using var requestMessage = requestBuilder.Build(HttpMethod.Post); + using var response = await client.SendAsync(requestMessage, cancellationToken); + + var responseBuilder = httpMessageFactory.FromResponse(response); + responseBuilder.AddSuccessResponse(HttpStatusCode.OK); + responseBuilder.AddErrorResponse(HttpStatusCode.BadRequest); + return await responseBuilder.BuildResponseAsync(x => new UploadSingleObjectWithFileAsFormDataEndpointResult(x), cancellationToken); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/UploadSingleObjectWithFileAsFormDataEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/UploadSingleObjectWithFileAsFormDataEndpointResult.verified.cs new file mode 100644 index 000000000..2588666e8 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/UploadSingleObjectWithFileAsFormDataEndpointResult.verified.cs @@ -0,0 +1,37 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyEndpoints; + +/// +/// Client Endpoint result. +/// Description: Upload a file as FormData. +/// Operation: UploadSingleObjectWithFileAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UploadSingleObjectWithFileAsFormDataEndpointResult : EndpointResponse, IUploadSingleObjectWithFileAsFormDataEndpointResult +{ + public UploadSingleObjectWithFileAsFormDataEndpointResult(EndpointResponse response) + : base(response) + { + } + + public bool IsOk + => StatusCode == HttpStatusCode.OK; + + public bool IsBadRequest + => StatusCode == HttpStatusCode.BadRequest; + + public string? OkContent + => IsOk && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsOk property first."); + + public ValidationProblemDetails BadRequestContent + => IsBadRequest && ContentObject is ValidationProblemDetails result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsBadRequest property first."); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/UploadSingleObjectWithFilesAsFormDataEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/UploadSingleObjectWithFilesAsFormDataEndpoint.verified.cs new file mode 100644 index 000000000..e1e1cb07a --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/UploadSingleObjectWithFilesAsFormDataEndpoint.verified.cs @@ -0,0 +1,46 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyEndpoints; + +/// +/// Client Endpoint. +/// Description: Upload files as FormData. +/// Operation: UploadSingleObjectWithFilesAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UploadSingleObjectWithFilesAsFormDataEndpoint : IUploadSingleObjectWithFilesAsFormDataEndpoint +{ + private readonly IHttpClientFactory factory; + private readonly IHttpMessageFactory httpMessageFactory; + + public UploadSingleObjectWithFilesAsFormDataEndpoint( + IHttpClientFactory factory, + IHttpMessageFactory httpMessageFactory) + { + this.factory = factory; + this.httpMessageFactory = httpMessageFactory; + } + + public async Task ExecuteAsync( + UploadSingleObjectWithFilesAsFormDataParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default) + { + var client = factory.CreateClient(httpClientName); + + var requestBuilder = httpMessageFactory.FromTemplate("/api/v1/files/form-data/singleObjectMultiFile"); + // TODO: Imp. With-Form + + using var requestMessage = requestBuilder.Build(HttpMethod.Post); + using var response = await client.SendAsync(requestMessage, cancellationToken); + + var responseBuilder = httpMessageFactory.FromResponse(response); + responseBuilder.AddSuccessResponse(HttpStatusCode.OK); + responseBuilder.AddErrorResponse(HttpStatusCode.BadRequest); + return await responseBuilder.BuildResponseAsync(x => new UploadSingleObjectWithFilesAsFormDataEndpointResult(x), cancellationToken); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/UploadSingleObjectWithFilesAsFormDataEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/UploadSingleObjectWithFilesAsFormDataEndpointResult.verified.cs new file mode 100644 index 000000000..7ed752fd8 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Files/MyEndpoints/UploadSingleObjectWithFilesAsFormDataEndpointResult.verified.cs @@ -0,0 +1,37 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Files.MyEndpoints; + +/// +/// Client Endpoint result. +/// Description: Upload files as FormData. +/// Operation: UploadSingleObjectWithFilesAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UploadSingleObjectWithFilesAsFormDataEndpointResult : EndpointResponse, IUploadSingleObjectWithFilesAsFormDataEndpointResult +{ + public UploadSingleObjectWithFilesAsFormDataEndpointResult(EndpointResponse response) + : base(response) + { + } + + public bool IsOk + => StatusCode == HttpStatusCode.OK; + + public bool IsBadRequest + => StatusCode == HttpStatusCode.BadRequest; + + public string? OkContent + => IsOk && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsOk property first."); + + public ValidationProblemDetails BadRequestContent + => IsBadRequest && ContentObject is ValidationProblemDetails result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsBadRequest property first."); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/GlobalUsings.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/GlobalUsings.verified.cs new file mode 100644 index 000000000..a49ad84a8 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/GlobalUsings.verified.cs @@ -0,0 +1,34 @@ +global using System; +global using System.CodeDom.Compiler; +global using System.Collections.Generic; +global using System.ComponentModel.DataAnnotations; +global using System.Linq; +global using System.Net; +global using System.Net.Http; +global using System.Threading; +global using System.Threading.Tasks; + +global using Atc.Rest.Client; +global using Atc.Rest.Client.Builder; +global using Atc.Rest.Results; + +global using Microsoft.AspNetCore.Http; +global using Microsoft.AspNetCore.Mvc; + +global using Structure1.ApiClient.Generated.Accounts.MyContracts; +global using Structure1.ApiClient.Generated.Accounts.MyEndpoints.Interfaces; +global using Structure1.ApiClient.Generated.Addresses.MyContracts; +global using Structure1.ApiClient.Generated.Addresses.MyEndpoints.Interfaces; +global using Structure1.ApiClient.Generated.EventArgs.MyContracts; +global using Structure1.ApiClient.Generated.EventArgs.MyEndpoints.Interfaces; +global using Structure1.ApiClient.Generated.Files.MyContracts; +global using Structure1.ApiClient.Generated.Files.MyEndpoints.Interfaces; +global using Structure1.ApiClient.Generated.Items.MyContracts; +global using Structure1.ApiClient.Generated.Items.MyEndpoints.Interfaces; +global using Structure1.ApiClient.Generated.MyContracts; +global using Structure1.ApiClient.Generated.Orders.MyContracts; +global using Structure1.ApiClient.Generated.Orders.MyEndpoints.Interfaces; +global using Structure1.ApiClient.Generated.RouteWithDash.MyEndpoints.Interfaces; +global using Structure1.ApiClient.Generated.Tasks.MyEndpoints.Interfaces; +global using Structure1.ApiClient.Generated.Users.MyContracts; +global using Structure1.ApiClient.Generated.Users.MyEndpoints.Interfaces; \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Items/MyContracts/CreateItemRequest.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Items/MyContracts/CreateItemRequest.verified.cs new file mode 100644 index 000000000..72946b7e8 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Items/MyContracts/CreateItemRequest.verified.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Items.MyContracts; + +/// +/// CreateItemRequest. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class CreateItemRequest +{ + /// + /// Item. + /// + [Required] + public Item Item { get; set; } + + /// + /// A list of Item. + /// + [Required] + public List MyItems { get; set; } + + /// + public override string ToString() + => $"{nameof(Item)}: ({Item}), {nameof(MyItems)}.Count: {MyItems?.Count ?? 0}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Items/MyContracts/Item.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Items/MyContracts/Item.verified.cs new file mode 100644 index 000000000..338def7fd --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Items/MyContracts/Item.verified.cs @@ -0,0 +1,21 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Items.MyContracts; + +/// +/// Item. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class Item +{ + [Required] + public string Name { get; set; } + + /// + public override string ToString() + => $"{nameof(Name)}: {Name}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Items/MyContracts/RequestParameters/CreateItemParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Items/MyContracts/RequestParameters/CreateItemParameters.verified.cs new file mode 100644 index 000000000..6d1f62ea4 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Items/MyContracts/RequestParameters/CreateItemParameters.verified.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Items.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Create a new item. +/// Operation: CreateItem. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class CreateItemParameters +{ + /// + /// CreateItemRequest. + /// + [Required] + public CreateItemRequest Request { get; set; } + + /// + public override string ToString() + => $"{nameof(Request)}: ({Request})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Items/MyContracts/RequestParameters/UpdateItemParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Items/MyContracts/RequestParameters/UpdateItemParameters.verified.cs new file mode 100644 index 000000000..857f8164e --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Items/MyContracts/RequestParameters/UpdateItemParameters.verified.cs @@ -0,0 +1,32 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Items.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Updates an item. +/// Operation: UpdateItem. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateItemParameters +{ + /// + /// The id of the order. + /// + [Required] + public Guid Id { get; set; } + + /// + /// UpdateItemRequest. + /// + [Required] + public UpdateItemRequest Request { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}, {nameof(Request)}: ({Request})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Items/MyContracts/UpdateItemRequest.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Items/MyContracts/UpdateItemRequest.verified.cs new file mode 100644 index 000000000..25bc5c565 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Items/MyContracts/UpdateItemRequest.verified.cs @@ -0,0 +1,24 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Items.MyContracts; + +/// +/// UpdateItemRequest. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateItemRequest +{ + /// + /// Item. + /// + [Required] + public Item Item { get; set; } + + /// + public override string ToString() + => $"{nameof(Item)}: ({Item})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Items/MyEndpoints/CreateItemEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Items/MyEndpoints/CreateItemEndpoint.verified.cs new file mode 100644 index 000000000..c151d8eb3 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Items/MyEndpoints/CreateItemEndpoint.verified.cs @@ -0,0 +1,46 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Items.MyEndpoints; + +/// +/// Client Endpoint. +/// Description: Create a new item. +/// Operation: CreateItem. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class CreateItemEndpoint : ICreateItemEndpoint +{ + private readonly IHttpClientFactory factory; + private readonly IHttpMessageFactory httpMessageFactory; + + public CreateItemEndpoint( + IHttpClientFactory factory, + IHttpMessageFactory httpMessageFactory) + { + this.factory = factory; + this.httpMessageFactory = httpMessageFactory; + } + + public async Task ExecuteAsync( + CreateItemParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default) + { + var client = factory.CreateClient(httpClientName); + + var requestBuilder = httpMessageFactory.FromTemplate("/api/v1/items"); + requestBuilder.WithBody(parameters.Request); + + using var requestMessage = requestBuilder.Build(HttpMethod.Post); + using var response = await client.SendAsync(requestMessage, cancellationToken); + + var responseBuilder = httpMessageFactory.FromResponse(response); + responseBuilder.AddSuccessResponse(HttpStatusCode.OK); + responseBuilder.AddErrorResponse(HttpStatusCode.BadRequest); + return await responseBuilder.BuildResponseAsync(x => new CreateItemEndpointResult(x), cancellationToken); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Items/MyEndpoints/CreateItemEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Items/MyEndpoints/CreateItemEndpointResult.verified.cs new file mode 100644 index 000000000..cf07c6c13 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Items/MyEndpoints/CreateItemEndpointResult.verified.cs @@ -0,0 +1,37 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Items.MyEndpoints; + +/// +/// Client Endpoint result. +/// Description: Create a new item. +/// Operation: CreateItem. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class CreateItemEndpointResult : EndpointResponse, ICreateItemEndpointResult +{ + public CreateItemEndpointResult(EndpointResponse response) + : base(response) + { + } + + public bool IsOk + => StatusCode == HttpStatusCode.OK; + + public bool IsBadRequest + => StatusCode == HttpStatusCode.BadRequest; + + public string? OkContent + => IsOk && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsOk property first."); + + public ValidationProblemDetails BadRequestContent + => IsBadRequest && ContentObject is ValidationProblemDetails result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsBadRequest property first."); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Items/MyEndpoints/Interfaces/ICreateItemEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Items/MyEndpoints/Interfaces/ICreateItemEndpoint.verified.cs new file mode 100644 index 000000000..a030a7ffe --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Items/MyEndpoints/Interfaces/ICreateItemEndpoint.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Items.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint. +/// Description: Create a new item. +/// Operation: CreateItem. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface ICreateItemEndpoint +{ + /// + /// Execute method. + /// + /// The parameters. + /// The http client name. + /// The cancellation token. + Task ExecuteAsync( + CreateItemParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Items/MyEndpoints/Interfaces/ICreateItemEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Items/MyEndpoints/Interfaces/ICreateItemEndpointResult.verified.cs new file mode 100644 index 000000000..59b4dee40 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Items/MyEndpoints/Interfaces/ICreateItemEndpointResult.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Items.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint Result. +/// Description: Create a new item. +/// Operation: CreateItem. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface ICreateItemEndpointResult : IEndpointResponse +{ + + bool IsOk { get; } + + bool IsBadRequest { get; } + + string? OkContent { get; } + + ValidationProblemDetails BadRequestContent { get; } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Items/MyEndpoints/Interfaces/IUpdateItemEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Items/MyEndpoints/Interfaces/IUpdateItemEndpoint.verified.cs new file mode 100644 index 000000000..109aedace --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Items/MyEndpoints/Interfaces/IUpdateItemEndpoint.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Items.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint. +/// Description: Updates an item. +/// Operation: UpdateItem. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IUpdateItemEndpoint +{ + /// + /// Execute method. + /// + /// The parameters. + /// The http client name. + /// The cancellation token. + Task ExecuteAsync( + UpdateItemParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Items/MyEndpoints/Interfaces/IUpdateItemEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Items/MyEndpoints/Interfaces/IUpdateItemEndpointResult.verified.cs new file mode 100644 index 000000000..c266fdafb --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Items/MyEndpoints/Interfaces/IUpdateItemEndpointResult.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Items.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint Result. +/// Description: Updates an item. +/// Operation: UpdateItem. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IUpdateItemEndpointResult : IEndpointResponse +{ + + bool IsOk { get; } + + bool IsBadRequest { get; } + + Guid OkContent { get; } + + ValidationProblemDetails BadRequestContent { get; } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Items/MyEndpoints/UpdateItemEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Items/MyEndpoints/UpdateItemEndpoint.verified.cs new file mode 100644 index 000000000..3cc6a083d --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Items/MyEndpoints/UpdateItemEndpoint.verified.cs @@ -0,0 +1,47 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Items.MyEndpoints; + +/// +/// Client Endpoint. +/// Description: Updates an item. +/// Operation: UpdateItem. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateItemEndpoint : IUpdateItemEndpoint +{ + private readonly IHttpClientFactory factory; + private readonly IHttpMessageFactory httpMessageFactory; + + public UpdateItemEndpoint( + IHttpClientFactory factory, + IHttpMessageFactory httpMessageFactory) + { + this.factory = factory; + this.httpMessageFactory = httpMessageFactory; + } + + public async Task ExecuteAsync( + UpdateItemParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default) + { + var client = factory.CreateClient(httpClientName); + + var requestBuilder = httpMessageFactory.FromTemplate("/api/v1/items/{id}"); + requestBuilder.WithPathParameter("id", parameters.Id); + requestBuilder.WithBody(parameters.Request); + + using var requestMessage = requestBuilder.Build(HttpMethod.Put); + using var response = await client.SendAsync(requestMessage, cancellationToken); + + var responseBuilder = httpMessageFactory.FromResponse(response); + responseBuilder.AddSuccessResponse(HttpStatusCode.OK); + responseBuilder.AddErrorResponse(HttpStatusCode.BadRequest); + return await responseBuilder.BuildResponseAsync(x => new UpdateItemEndpointResult(x), cancellationToken); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Items/MyEndpoints/UpdateItemEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Items/MyEndpoints/UpdateItemEndpointResult.verified.cs new file mode 100644 index 000000000..a6d242ff5 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Items/MyEndpoints/UpdateItemEndpointResult.verified.cs @@ -0,0 +1,37 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Items.MyEndpoints; + +/// +/// Client Endpoint result. +/// Description: Updates an item. +/// Operation: UpdateItem. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateItemEndpointResult : EndpointResponse, IUpdateItemEndpointResult +{ + public UpdateItemEndpointResult(EndpointResponse response) + : base(response) + { + } + + public bool IsOk + => StatusCode == HttpStatusCode.OK; + + public bool IsBadRequest + => StatusCode == HttpStatusCode.BadRequest; + + public Guid OkContent + => IsOk && ContentObject is Guid result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsOk property first."); + + public ValidationProblemDetails BadRequestContent + => IsBadRequest && ContentObject is ValidationProblemDetails result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsBadRequest property first."); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/MyContracts/_EnumerationTypes/ColorType.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/MyContracts/_EnumerationTypes/ColorType.verified.cs new file mode 100644 index 000000000..2482e9d82 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/MyContracts/_EnumerationTypes/ColorType.verified.cs @@ -0,0 +1,21 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.MyContracts; + +/// +/// Enumeration: ColorType. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +[Flags] +public enum ColorType +{ + None = 0, + Black = 1, + White = 2, + Yellow = 4, + Red = 8, +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/MyContracts/_EnumerationTypes/GenderType.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/MyContracts/_EnumerationTypes/GenderType.verified.cs new file mode 100644 index 000000000..226ad596f --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/MyContracts/_EnumerationTypes/GenderType.verified.cs @@ -0,0 +1,19 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.MyContracts; + +/// +/// Enumeration: GenderType. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public enum GenderType +{ + None, + NonBinary, + Male, + Female, +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/MyContracts/_Shared/Address.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/MyContracts/_Shared/Address.verified.cs new file mode 100644 index 000000000..a2d705631 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/MyContracts/_Shared/Address.verified.cs @@ -0,0 +1,32 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.MyContracts; + +/// +/// Address. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class Address +{ + [StringLength(255)] + public string StreetName { get; set; } + + public string StreetNumber { get; set; } + + public string PostalCode { get; set; } + + public string CityName { get; set; } + + /// + /// Country. + /// + public Country MyCountry { get; set; } + + /// + public override string ToString() + => $"{nameof(StreetName)}: {StreetName}, {nameof(StreetNumber)}: {StreetNumber}, {nameof(PostalCode)}: {PostalCode}, {nameof(CityName)}: {CityName}, {nameof(MyCountry)}: ({MyCountry})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/MyContracts/_Shared/Country.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/MyContracts/_Shared/Country.verified.cs new file mode 100644 index 000000000..b26edf4df --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/MyContracts/_Shared/Country.verified.cs @@ -0,0 +1,33 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.MyContracts; + +/// +/// Country. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class Country +{ + [Required] + public string Name { get; set; } + + [Required] + [MinLength(2)] + [MaxLength(2)] + [RegularExpression("^[A-Za-z]{2}$")] + public string Alpha2Code { get; set; } + + [Required] + [MinLength(3)] + [MaxLength(3)] + [RegularExpression("^[A-Za-z]{3}$")] + public string Alpha3Code { get; set; } + + /// + public override string ToString() + => $"{nameof(Name)}: {Name}, {nameof(Alpha2Code)}: {Alpha2Code}, {nameof(Alpha3Code)}: {Alpha3Code}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Orders/MyContracts/Order.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Orders/MyContracts/Order.verified.cs new file mode 100644 index 000000000..77a20ee94 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Orders/MyContracts/Order.verified.cs @@ -0,0 +1,79 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Orders.MyContracts; + +/// +/// A single order. +/// Hallo description with multiline and no ending dot. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class Order +{ + public Guid Id { get; set; } + + public string Description { get; set; } + + public DateTimeOffset MyTime { get; set; } + + /// + /// Undefined description. + /// + /// + /// Email validation being enforced. + /// + [EmailAddress] + public string MyEmail { get; set; } = "a@a.com"; + + public DateTimeOffset? MyNullableDateTime { get; set; } + + public DateTimeOffset MyDateTime { get; set; } + + [Range(1.1, 20.2)] + public double MyNumber { get; set; } + + [Range(int.MinValue, 50)] + public int MyInteger { get; set; } = 15; + + /// + /// MyBool is great. + /// + public bool MyBool { get; set; } + + /// + /// This is the good uri :-). + /// + /// + /// Url validation being enforced. + /// + [Uri] + public Uri MyUri { get; set; } + + /// + /// Undefined description. + /// + /// + /// This string should be base64-encoded. + /// + public string MyByte { get; set; } + + /// + /// Hallo myStringList desc :-). + /// + public List MyStringList { get; set; } = new List(); + + [Range(10, int.MaxValue)] + public long MyLong { get; set; } + + /// + /// Address. + /// + public Address DeliveryAddress { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}, {nameof(Description)}: {Description}, {nameof(MyTime)}: ({MyTime}), {nameof(MyEmail)}: {MyEmail}, {nameof(MyNullableDateTime)}: ({MyNullableDateTime}), {nameof(MyDateTime)}: ({MyDateTime}), {nameof(MyNumber)}: {MyNumber}, {nameof(MyInteger)}: {MyInteger}, {nameof(MyBool)}: {MyBool}, {nameof(MyUri)}: ({MyUri}), {nameof(MyByte)}: {MyByte}, {nameof(MyStringList)}.Count: {MyStringList?.Count ?? 0}, {nameof(MyLong)}: {MyLong}, {nameof(DeliveryAddress)}: ({DeliveryAddress})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Orders/MyContracts/RequestParameters/GetOrderByIdParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Orders/MyContracts/RequestParameters/GetOrderByIdParameters.verified.cs new file mode 100644 index 000000000..9a9629ec5 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Orders/MyContracts/RequestParameters/GetOrderByIdParameters.verified.cs @@ -0,0 +1,35 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Orders.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Get order by id. +/// Operation: GetOrderById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetOrderByIdParameters +{ + /// + /// The id of the order. + /// + [Required] + public Guid Id { get; set; } + + /// + /// The email for filter orders to retrieve. + /// + /// + /// Email validation being enforced. + /// + [EmailAddress] + public string? MyEmail { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}, {nameof(MyEmail)}: {MyEmail}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Orders/MyContracts/RequestParameters/GetOrdersParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Orders/MyContracts/RequestParameters/GetOrdersParameters.verified.cs new file mode 100644 index 000000000..213643daa --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Orders/MyContracts/RequestParameters/GetOrdersParameters.verified.cs @@ -0,0 +1,48 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Orders.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Get orders. +/// Operation: GetOrders. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetOrdersParameters +{ + /// + /// The numbers of items to return. + /// + [Required] + [Range(1, 100)] + public int PageSize { get; set; } = 10; + + /// + /// The number of items to skip before starting to collect the result set. + /// + [Range(0, 2147483647)] + public int PageIndex { get; set; } = 0; + + /// + /// The query string. + /// + public string? QueryString { get; set; } + + /// + /// The query array of string. + /// + public List QueryStringArray { get; set; } = new List(); + + /// + /// The continuation token. + /// + public string? ContinuationToken { get; set; } + + /// + public override string ToString() + => $"{nameof(PageSize)}: {PageSize}, {nameof(PageIndex)}: {PageIndex}, {nameof(QueryString)}: {QueryString}, {nameof(QueryStringArray)}.Count: {QueryStringArray?.Count ?? 0}, {nameof(ContinuationToken)}: {ContinuationToken}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Orders/MyContracts/RequestParameters/PatchOrdersIdParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Orders/MyContracts/RequestParameters/PatchOrdersIdParameters.verified.cs new file mode 100644 index 000000000..c6d4a513c --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Orders/MyContracts/RequestParameters/PatchOrdersIdParameters.verified.cs @@ -0,0 +1,56 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Orders.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Update part of order by id. +/// Operation: PatchOrdersId. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class PatchOrdersIdParameters +{ + /// + /// The id of the order. + /// + [Required] + public Guid Id { get; set; } + + /// + /// The myTestHeader special key. + /// + [Required] + public string MyTestHeader { get; set; } + + /// + /// The myTestHeaderBool special key. + /// + [Required] + public bool MyTestHeaderBool { get; set; } + + /// + /// The myTestHeaderInt special key. + /// + [Required] + public int MyTestHeaderInt { get; set; } + + /// + /// The correlationId. + /// + [Required] + public string CorrelationId { get; set; } + + /// + /// Request to update an order. + /// + [Required] + public UpdateOrderRequest Request { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}, {nameof(MyTestHeader)}: {MyTestHeader}, {nameof(MyTestHeaderBool)}: {MyTestHeaderBool}, {nameof(MyTestHeaderInt)}: {MyTestHeaderInt}, {nameof(CorrelationId)}: {CorrelationId}, {nameof(Request)}: ({Request})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Orders/MyContracts/UpdateOrderRequest.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Orders/MyContracts/UpdateOrderRequest.verified.cs new file mode 100644 index 000000000..37332d188 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Orders/MyContracts/UpdateOrderRequest.verified.cs @@ -0,0 +1,28 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Orders.MyContracts; + +/// +/// Request to update an order. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateOrderRequest +{ + /// + /// Undefined description. + /// + /// + /// Email validation being enforced. + /// + [Required] + [EmailAddress] + public string MyEmail { get; set; } + + /// + public override string ToString() + => $"{nameof(MyEmail)}: {MyEmail}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/GetOrderByIdEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/GetOrderByIdEndpoint.verified.cs new file mode 100644 index 000000000..f71f8cf8d --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/GetOrderByIdEndpoint.verified.cs @@ -0,0 +1,48 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Orders.MyEndpoints; + +/// +/// Client Endpoint. +/// Description: Get order by id. +/// Operation: GetOrderById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetOrderByIdEndpoint : IGetOrderByIdEndpoint +{ + private readonly IHttpClientFactory factory; + private readonly IHttpMessageFactory httpMessageFactory; + + public GetOrderByIdEndpoint( + IHttpClientFactory factory, + IHttpMessageFactory httpMessageFactory) + { + this.factory = factory; + this.httpMessageFactory = httpMessageFactory; + } + + public async Task ExecuteAsync( + GetOrderByIdParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default) + { + var client = factory.CreateClient(httpClientName); + + var requestBuilder = httpMessageFactory.FromTemplate("/api/v1/orders/{id}"); + requestBuilder.WithPathParameter("id", parameters.Id); + requestBuilder.WithQueryParameter("myEmail", parameters.MyEmail); + + using var requestMessage = requestBuilder.Build(HttpMethod.Get); + using var response = await client.SendAsync(requestMessage, cancellationToken); + + var responseBuilder = httpMessageFactory.FromResponse(response); + responseBuilder.AddSuccessResponse(HttpStatusCode.OK); + responseBuilder.AddErrorResponse(HttpStatusCode.BadRequest); + responseBuilder.AddErrorResponse(HttpStatusCode.NotFound); + return await responseBuilder.BuildResponseAsync(x => new GetOrderByIdEndpointResult(x), cancellationToken); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/GetOrderByIdEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/GetOrderByIdEndpointResult.verified.cs new file mode 100644 index 000000000..1138e8a0d --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/GetOrderByIdEndpointResult.verified.cs @@ -0,0 +1,45 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Orders.MyEndpoints; + +/// +/// Client Endpoint result. +/// Description: Get order by id. +/// Operation: GetOrderById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetOrderByIdEndpointResult : EndpointResponse, IGetOrderByIdEndpointResult +{ + public GetOrderByIdEndpointResult(EndpointResponse response) + : base(response) + { + } + + public bool IsOk + => StatusCode == HttpStatusCode.OK; + + public bool IsBadRequest + => StatusCode == HttpStatusCode.BadRequest; + + public bool IsNotFound + => StatusCode == HttpStatusCode.NotFound; + + public Order OkContent + => IsOk && ContentObject is Order result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsOk property first."); + + public ValidationProblemDetails BadRequestContent + => IsBadRequest && ContentObject is ValidationProblemDetails result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsBadRequest property first."); + + public string? NotFoundContent + => IsNotFound && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsNotFound property first."); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/GetOrdersEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/GetOrdersEndpoint.verified.cs new file mode 100644 index 000000000..c0cc2a6ed --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/GetOrdersEndpoint.verified.cs @@ -0,0 +1,56 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Orders.MyEndpoints; + +/// +/// Client Endpoint. +/// Description: Get orders. +/// Operation: GetOrders. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetOrdersEndpoint : IGetOrdersEndpoint +{ + private readonly IHttpClientFactory factory; + private readonly IHttpMessageFactory httpMessageFactory; + + public GetOrdersEndpoint( + IHttpClientFactory factory, + IHttpMessageFactory httpMessageFactory) + { + this.factory = factory; + this.httpMessageFactory = httpMessageFactory; + } + + public async Task ExecuteAsync( + GetOrdersParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default) + { + var client = factory.CreateClient(httpClientName); + + var requestBuilder = httpMessageFactory.FromTemplate("/api/v1/orders"); + requestBuilder.WithQueryParameter("pageSize", parameters.PageSize); + requestBuilder.WithQueryParameter("pageIndex", parameters.PageIndex); + requestBuilder.WithQueryParameter("queryString", parameters.QueryString); + if (parameters.QueryStringArray.Any()) + { + requestBuilder.WithQueryParameter("queryStringArray", parameters.QueryStringArray); + } + + requestBuilder.WithQueryParameter("continuationToken", parameters.ContinuationToken); + + using var requestMessage = requestBuilder.Build(HttpMethod.Get); + using var response = await client.SendAsync(requestMessage, cancellationToken); + + var responseBuilder = httpMessageFactory.FromResponse(response); + responseBuilder.AddSuccessResponse>(HttpStatusCode.OK); + responseBuilder.AddErrorResponse(HttpStatusCode.BadRequest); + responseBuilder.AddErrorResponse(HttpStatusCode.Unauthorized); + responseBuilder.AddErrorResponse(HttpStatusCode.NotFound); + return await responseBuilder.BuildResponseAsync(x => new GetOrdersEndpointResult(x), cancellationToken); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/GetOrdersEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/GetOrdersEndpointResult.verified.cs new file mode 100644 index 000000000..13842a923 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/GetOrdersEndpointResult.verified.cs @@ -0,0 +1,53 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Orders.MyEndpoints; + +/// +/// Client Endpoint result. +/// Description: Get orders. +/// Operation: GetOrders. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetOrdersEndpointResult : EndpointResponse, IGetOrdersEndpointResult +{ + public GetOrdersEndpointResult(EndpointResponse response) + : base(response) + { + } + + public bool IsOk + => StatusCode == HttpStatusCode.OK; + + public bool IsBadRequest + => StatusCode == HttpStatusCode.BadRequest; + + public bool IsUnauthorized + => StatusCode == HttpStatusCode.Unauthorized; + + public bool IsNotFound + => StatusCode == HttpStatusCode.NotFound; + + public Pagination OkContent + => IsOk && ContentObject is Pagination result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsOk property first."); + + public ValidationProblemDetails BadRequestContent + => IsBadRequest && ContentObject is ValidationProblemDetails result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsBadRequest property first."); + + public ProblemDetails UnauthorizedContent + => IsUnauthorized && ContentObject is ProblemDetails result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsUnauthorized property first."); + + public string? NotFoundContent + => IsNotFound && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsNotFound property first."); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/Interfaces/IGetOrderByIdEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/Interfaces/IGetOrderByIdEndpoint.verified.cs new file mode 100644 index 000000000..c763a470b --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/Interfaces/IGetOrderByIdEndpoint.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Orders.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint. +/// Description: Get order by id. +/// Operation: GetOrderById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetOrderByIdEndpoint +{ + /// + /// Execute method. + /// + /// The parameters. + /// The http client name. + /// The cancellation token. + Task ExecuteAsync( + GetOrderByIdParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/Interfaces/IGetOrderByIdEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/Interfaces/IGetOrderByIdEndpointResult.verified.cs new file mode 100644 index 000000000..e448998bc --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/Interfaces/IGetOrderByIdEndpointResult.verified.cs @@ -0,0 +1,29 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Orders.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint Result. +/// Description: Get order by id. +/// Operation: GetOrderById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetOrderByIdEndpointResult : IEndpointResponse +{ + + bool IsOk { get; } + + bool IsBadRequest { get; } + + bool IsNotFound { get; } + + Order OkContent { get; } + + ValidationProblemDetails BadRequestContent { get; } + + string? NotFoundContent { get; } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/Interfaces/IGetOrdersEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/Interfaces/IGetOrdersEndpoint.verified.cs new file mode 100644 index 000000000..74aa603c1 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/Interfaces/IGetOrdersEndpoint.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Orders.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint. +/// Description: Get orders. +/// Operation: GetOrders. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetOrdersEndpoint +{ + /// + /// Execute method. + /// + /// The parameters. + /// The http client name. + /// The cancellation token. + Task ExecuteAsync( + GetOrdersParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/Interfaces/IGetOrdersEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/Interfaces/IGetOrdersEndpointResult.verified.cs new file mode 100644 index 000000000..954233948 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/Interfaces/IGetOrdersEndpointResult.verified.cs @@ -0,0 +1,33 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Orders.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint Result. +/// Description: Get orders. +/// Operation: GetOrders. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetOrdersEndpointResult : IEndpointResponse +{ + + bool IsOk { get; } + + bool IsBadRequest { get; } + + bool IsUnauthorized { get; } + + bool IsNotFound { get; } + + Pagination OkContent { get; } + + ValidationProblemDetails BadRequestContent { get; } + + ProblemDetails UnauthorizedContent { get; } + + string? NotFoundContent { get; } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/Interfaces/IPatchOrdersIdEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/Interfaces/IPatchOrdersIdEndpoint.verified.cs new file mode 100644 index 000000000..a359c4aa4 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/Interfaces/IPatchOrdersIdEndpoint.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Orders.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint. +/// Description: Update part of order by id. +/// Operation: PatchOrdersId. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IPatchOrdersIdEndpoint +{ + /// + /// Execute method. + /// + /// The parameters. + /// The http client name. + /// The cancellation token. + Task ExecuteAsync( + PatchOrdersIdParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/Interfaces/IPatchOrdersIdEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/Interfaces/IPatchOrdersIdEndpointResult.verified.cs new file mode 100644 index 000000000..144a5da49 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/Interfaces/IPatchOrdersIdEndpointResult.verified.cs @@ -0,0 +1,45 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Orders.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint Result. +/// Description: Update part of order by id. +/// Operation: PatchOrdersId. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IPatchOrdersIdEndpointResult : IEndpointResponse +{ + + bool IsOk { get; } + + bool IsBadRequest { get; } + + bool IsUnauthorized { get; } + + bool IsForbidden { get; } + + bool IsNotFound { get; } + + bool IsConflict { get; } + + bool IsBadGateway { get; } + + string? OkContent { get; } + + ValidationProblemDetails BadRequestContent { get; } + + ProblemDetails UnauthorizedContent { get; } + + ProblemDetails ForbiddenContent { get; } + + string? NotFoundContent { get; } + + ProblemDetails ConflictContent { get; } + + ProblemDetails BadGatewayContent { get; } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/PatchOrdersIdEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/PatchOrdersIdEndpoint.verified.cs new file mode 100644 index 000000000..ca6680cb5 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/PatchOrdersIdEndpoint.verified.cs @@ -0,0 +1,56 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Orders.MyEndpoints; + +/// +/// Client Endpoint. +/// Description: Update part of order by id. +/// Operation: PatchOrdersId. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class PatchOrdersIdEndpoint : IPatchOrdersIdEndpoint +{ + private readonly IHttpClientFactory factory; + private readonly IHttpMessageFactory httpMessageFactory; + + public PatchOrdersIdEndpoint( + IHttpClientFactory factory, + IHttpMessageFactory httpMessageFactory) + { + this.factory = factory; + this.httpMessageFactory = httpMessageFactory; + } + + public async Task ExecuteAsync( + PatchOrdersIdParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default) + { + var client = factory.CreateClient(httpClientName); + + var requestBuilder = httpMessageFactory.FromTemplate("/api/v1/orders/{id}"); + requestBuilder.WithPathParameter("id", parameters.Id); + requestBuilder.WithHeaderParameter("myTestHeader", parameters.MyTestHeader); + requestBuilder.WithHeaderParameter("myTestHeaderBool", parameters.MyTestHeaderBool); + requestBuilder.WithHeaderParameter("myTestHeaderInt", parameters.MyTestHeaderInt); + requestBuilder.WithHeaderParameter("x-correlation-id", parameters.CorrelationId); + requestBuilder.WithBody(parameters.Request); + + using var requestMessage = requestBuilder.Build(HttpMethod.Patch); + using var response = await client.SendAsync(requestMessage, cancellationToken); + + var responseBuilder = httpMessageFactory.FromResponse(response); + responseBuilder.AddSuccessResponse(HttpStatusCode.OK); + responseBuilder.AddErrorResponse(HttpStatusCode.BadRequest); + responseBuilder.AddErrorResponse(HttpStatusCode.Unauthorized); + responseBuilder.AddErrorResponse(HttpStatusCode.Forbidden); + responseBuilder.AddErrorResponse(HttpStatusCode.NotFound); + responseBuilder.AddErrorResponse(HttpStatusCode.Conflict); + responseBuilder.AddErrorResponse(HttpStatusCode.BadGateway); + return await responseBuilder.BuildResponseAsync(x => new PatchOrdersIdEndpointResult(x), cancellationToken); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/PatchOrdersIdEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/PatchOrdersIdEndpointResult.verified.cs new file mode 100644 index 000000000..33da7da30 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Orders/MyEndpoints/PatchOrdersIdEndpointResult.verified.cs @@ -0,0 +1,77 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Orders.MyEndpoints; + +/// +/// Client Endpoint result. +/// Description: Update part of order by id. +/// Operation: PatchOrdersId. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class PatchOrdersIdEndpointResult : EndpointResponse, IPatchOrdersIdEndpointResult +{ + public PatchOrdersIdEndpointResult(EndpointResponse response) + : base(response) + { + } + + public bool IsOk + => StatusCode == HttpStatusCode.OK; + + public bool IsBadRequest + => StatusCode == HttpStatusCode.BadRequest; + + public bool IsUnauthorized + => StatusCode == HttpStatusCode.Unauthorized; + + public bool IsForbidden + => StatusCode == HttpStatusCode.Forbidden; + + public bool IsNotFound + => StatusCode == HttpStatusCode.NotFound; + + public bool IsConflict + => StatusCode == HttpStatusCode.Conflict; + + public bool IsBadGateway + => StatusCode == HttpStatusCode.BadGateway; + + public string? OkContent + => IsOk && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsOk property first."); + + public ValidationProblemDetails BadRequestContent + => IsBadRequest && ContentObject is ValidationProblemDetails result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsBadRequest property first."); + + public ProblemDetails UnauthorizedContent + => IsUnauthorized && ContentObject is ProblemDetails result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsUnauthorized property first."); + + public ProblemDetails ForbiddenContent + => IsForbidden && ContentObject is ProblemDetails result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsForbidden property first."); + + public string? NotFoundContent + => IsNotFound && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsNotFound property first."); + + public ProblemDetails ConflictContent + => IsConflict && ContentObject is ProblemDetails result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsConflict property first."); + + public ProblemDetails BadGatewayContent + => IsBadGateway && ContentObject is ProblemDetails result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsBadGateway property first."); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/RouteWithDash/MyEndpoints/GetRouteWithDashEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/RouteWithDash/MyEndpoints/GetRouteWithDashEndpoint.verified.cs new file mode 100644 index 000000000..0925058e2 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/RouteWithDash/MyEndpoints/GetRouteWithDashEndpoint.verified.cs @@ -0,0 +1,43 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.RouteWithDash.MyEndpoints; + +/// +/// Client Endpoint. +/// Description: Your GET endpoint. +/// Operation: GetRouteWithDash. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetRouteWithDashEndpoint : IGetRouteWithDashEndpoint +{ + private readonly IHttpClientFactory factory; + private readonly IHttpMessageFactory httpMessageFactory; + + public GetRouteWithDashEndpoint( + IHttpClientFactory factory, + IHttpMessageFactory httpMessageFactory) + { + this.factory = factory; + this.httpMessageFactory = httpMessageFactory; + } + + public async Task ExecuteAsync( + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default) + { + var client = factory.CreateClient(httpClientName); + + var requestBuilder = httpMessageFactory.FromTemplate("/api/v1/route-with-dash"); + + using var requestMessage = requestBuilder.Build(HttpMethod.Get); + using var response = await client.SendAsync(requestMessage, cancellationToken); + + var responseBuilder = httpMessageFactory.FromResponse(response); + responseBuilder.AddSuccessResponse(HttpStatusCode.OK); + return await responseBuilder.BuildResponseAsync(x => new GetRouteWithDashEndpointResult(x), cancellationToken); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/RouteWithDash/MyEndpoints/GetRouteWithDashEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/RouteWithDash/MyEndpoints/GetRouteWithDashEndpointResult.verified.cs new file mode 100644 index 000000000..067a9a553 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/RouteWithDash/MyEndpoints/GetRouteWithDashEndpointResult.verified.cs @@ -0,0 +1,29 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.RouteWithDash.MyEndpoints; + +/// +/// Client Endpoint result. +/// Description: Your GET endpoint. +/// Operation: GetRouteWithDash. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetRouteWithDashEndpointResult : EndpointResponse, IGetRouteWithDashEndpointResult +{ + public GetRouteWithDashEndpointResult(EndpointResponse response) + : base(response) + { + } + + public bool IsOk + => StatusCode == HttpStatusCode.OK; + + public string? OkContent + => IsOk && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsOk property first."); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/RouteWithDash/MyEndpoints/Interfaces/IGetRouteWithDashEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/RouteWithDash/MyEndpoints/Interfaces/IGetRouteWithDashEndpoint.verified.cs new file mode 100644 index 000000000..31584e79f --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/RouteWithDash/MyEndpoints/Interfaces/IGetRouteWithDashEndpoint.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.RouteWithDash.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint. +/// Description: Your GET endpoint. +/// Operation: GetRouteWithDash. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetRouteWithDashEndpoint +{ + /// + /// Execute method. + /// + /// The http client name. + /// The cancellation token. + Task ExecuteAsync( + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/RouteWithDash/MyEndpoints/Interfaces/IGetRouteWithDashEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/RouteWithDash/MyEndpoints/Interfaces/IGetRouteWithDashEndpointResult.verified.cs new file mode 100644 index 000000000..e3aed0783 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/RouteWithDash/MyEndpoints/Interfaces/IGetRouteWithDashEndpointResult.verified.cs @@ -0,0 +1,21 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.RouteWithDash.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint Result. +/// Description: Your GET endpoint. +/// Operation: GetRouteWithDash. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetRouteWithDashEndpointResult : IEndpointResponse +{ + + bool IsOk { get; } + + string? OkContent { get; } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Tasks/MyContracts/Task.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Tasks/MyContracts/Task.verified.cs new file mode 100644 index 000000000..521cd0c7f --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Tasks/MyContracts/Task.verified.cs @@ -0,0 +1,22 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Tasks.MyContracts; + +/// +/// Describes a single task. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class Task +{ + public Guid Id { get; set; } + + public string Name { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}, {nameof(Name)}: {Name}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Tasks/MyContracts/Tasks.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Tasks/MyContracts/Tasks.verified.cs new file mode 100644 index 000000000..7419a0e92 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Tasks/MyContracts/Tasks.verified.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Tasks.MyContracts; + +/// +/// Contains a list of Tasks. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class Tasks +{ + /// + /// A list of Task. + /// + public List TaskList { get; set; } = new List(); + + /// + public override string ToString() + => $"{nameof(TaskList)}.Count: {TaskList?.Count ?? 0}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Tasks/MyEndpoints/GetTasksEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Tasks/MyEndpoints/GetTasksEndpoint.verified.cs new file mode 100644 index 000000000..8bd76c064 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Tasks/MyEndpoints/GetTasksEndpoint.verified.cs @@ -0,0 +1,43 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Tasks.MyEndpoints; + +/// +/// Client Endpoint. +/// Description: Returns tasks. +/// Operation: GetTasks. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetTasksEndpoint : IGetTasksEndpoint +{ + private readonly IHttpClientFactory factory; + private readonly IHttpMessageFactory httpMessageFactory; + + public GetTasksEndpoint( + IHttpClientFactory factory, + IHttpMessageFactory httpMessageFactory) + { + this.factory = factory; + this.httpMessageFactory = httpMessageFactory; + } + + public async Task ExecuteAsync( + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default) + { + var client = factory.CreateClient(httpClientName); + + var requestBuilder = httpMessageFactory.FromTemplate("/api/v1/tasks"); + + using var requestMessage = requestBuilder.Build(HttpMethod.Get); + using var response = await client.SendAsync(requestMessage, cancellationToken); + + var responseBuilder = httpMessageFactory.FromResponse(response); + responseBuilder.AddSuccessResponse>(HttpStatusCode.OK); + return await responseBuilder.BuildResponseAsync(x => new GetTasksEndpointResult(x), cancellationToken); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Tasks/MyEndpoints/GetTasksEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Tasks/MyEndpoints/GetTasksEndpointResult.verified.cs new file mode 100644 index 000000000..cf0ce55c9 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Tasks/MyEndpoints/GetTasksEndpointResult.verified.cs @@ -0,0 +1,29 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Tasks.MyEndpoints; + +/// +/// Client Endpoint result. +/// Description: Returns tasks. +/// Operation: GetTasks. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetTasksEndpointResult : EndpointResponse, IGetTasksEndpointResult +{ + public GetTasksEndpointResult(EndpointResponse response) + : base(response) + { + } + + public bool IsOk + => StatusCode == HttpStatusCode.OK; + + public IEnumerable OkContent + => IsOk && ContentObject is IEnumerable result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsOk property first."); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Tasks/MyEndpoints/Interfaces/IGetTasksEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Tasks/MyEndpoints/Interfaces/IGetTasksEndpoint.verified.cs new file mode 100644 index 000000000..35f486eed --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Tasks/MyEndpoints/Interfaces/IGetTasksEndpoint.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Tasks.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint. +/// Description: Returns tasks. +/// Operation: GetTasks. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetTasksEndpoint +{ + /// + /// Execute method. + /// + /// The http client name. + /// The cancellation token. + Task ExecuteAsync( + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Tasks/MyEndpoints/Interfaces/IGetTasksEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Tasks/MyEndpoints/Interfaces/IGetTasksEndpointResult.verified.cs new file mode 100644 index 000000000..c04e1849a --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Tasks/MyEndpoints/Interfaces/IGetTasksEndpointResult.verified.cs @@ -0,0 +1,21 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Tasks.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint Result. +/// Description: Returns tasks. +/// Operation: GetTasks. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetTasksEndpointResult : IEndpointResponse +{ + + bool IsOk { get; } + + IEnumerable OkContent { get; } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyContracts/CreateUserRequest.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyContracts/CreateUserRequest.verified.cs new file mode 100644 index 000000000..0fb28fc4a --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyContracts/CreateUserRequest.verified.cs @@ -0,0 +1,65 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyContracts; + +/// +/// Request to create a user. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class CreateUserRequest +{ + [Required] + public string FirstName { get; set; } + + [Required] + public string LastName { get; set; } + + public DateTimeOffset? MyNullableDateTime { get; set; } + + [Required] + public DateTimeOffset MyDateTime { get; set; } + + /// + /// Undefined description. + /// + /// + /// Email validation being enforced. + /// + [Required] + [EmailAddress] + public string Email { get; set; } + + /// + /// Undefined description. + /// + /// + /// Url validation being enforced. + /// + [Uri] + public Uri Homepage { get; set; } + + /// + /// GenderType. + /// + [Required] + public GenderType Gender { get; set; } + + public Address? MyNullableAddress { get; set; } + + [Required] + public Dictionary Tags { get; set; } + + public Dictionary DesiredProperties1 { get; set; } + + public Dictionary? DesiredProperties2 { get; set; } + + public Dictionary? DesiredProperties3 { get; set; } + + /// + public override string ToString() + => $"{nameof(FirstName)}: {FirstName}, {nameof(LastName)}: {LastName}, {nameof(MyNullableDateTime)}: ({MyNullableDateTime}), {nameof(MyDateTime)}: ({MyDateTime}), {nameof(Email)}: {Email}, {nameof(Homepage)}: ({Homepage}), {nameof(Gender)}: {Gender}, {nameof(MyNullableAddress)}: ({MyNullableAddress}), {nameof(Tags)}: ({Tags}), {nameof(DesiredProperties1)}: ({DesiredProperties1}), {nameof(DesiredProperties2)}: ({DesiredProperties2}), {nameof(DesiredProperties3)}: ({DesiredProperties3})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyContracts/RequestParameters/DeleteUserByIdParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyContracts/RequestParameters/DeleteUserByIdParameters.verified.cs new file mode 100644 index 000000000..896c27c0b --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyContracts/RequestParameters/DeleteUserByIdParameters.verified.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Delete user by id. +/// Operation: DeleteUserById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class DeleteUserByIdParameters +{ + /// + /// Id of the user. + /// + [Required] + public Guid Id { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyContracts/RequestParameters/GetUserByEmailParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyContracts/RequestParameters/GetUserByEmailParameters.verified.cs new file mode 100644 index 000000000..2ad1823cb --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyContracts/RequestParameters/GetUserByEmailParameters.verified.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Get user by email. +/// Operation: GetUserByEmail. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetUserByEmailParameters +{ + /// + /// The email of the user to retrieve. + /// + /// + /// Email validation being enforced. + /// + [Required] + [EmailAddress] + public string Email { get; set; } + + /// + public override string ToString() + => $"{nameof(Email)}: {Email}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyContracts/RequestParameters/GetUserByIdParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyContracts/RequestParameters/GetUserByIdParameters.verified.cs new file mode 100644 index 000000000..8717fdb20 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyContracts/RequestParameters/GetUserByIdParameters.verified.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Get user by id. +/// Operation: GetUserById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetUserByIdParameters +{ + /// + /// Id of the user. + /// + [Required] + public Guid Id { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyContracts/RequestParameters/PostUserParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyContracts/RequestParameters/PostUserParameters.verified.cs new file mode 100644 index 000000000..0a6b35b46 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyContracts/RequestParameters/PostUserParameters.verified.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Create a new user. +/// Operation: PostUser. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class PostUserParameters +{ + /// + /// Request to create a user. + /// + [Required] + public CreateUserRequest Request { get; set; } + + /// + public override string ToString() + => $"{nameof(Request)}: ({Request})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyContracts/RequestParameters/UpdateMyTestGenderParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyContracts/RequestParameters/UpdateMyTestGenderParameters.verified.cs new file mode 100644 index 000000000..78e0deb99 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyContracts/RequestParameters/UpdateMyTestGenderParameters.verified.cs @@ -0,0 +1,37 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Update gender on a user. +/// Operation: UpdateMyTestGender. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateMyTestGenderParameters +{ + /// + /// Id of the user. + /// + [Required] + public Guid Id { get; set; } + + /// + /// The gender to set on the user. + /// + public GenderType? GenderParam { get; set; } + + /// + /// Update test-gender Request. + /// + [Required] + public UpdateTestGenderRequest Request { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}, {nameof(GenderParam)}: {GenderParam}, {nameof(Request)}: ({Request})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyContracts/RequestParameters/UpdateUserByIdParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyContracts/RequestParameters/UpdateUserByIdParameters.verified.cs new file mode 100644 index 000000000..4a0e55b3f --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyContracts/RequestParameters/UpdateUserByIdParameters.verified.cs @@ -0,0 +1,32 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Update user by id. +/// Operation: UpdateUserById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateUserByIdParameters +{ + /// + /// Id of the user. + /// + [Required] + public Guid Id { get; set; } + + /// + /// Request to update a user. + /// + [Required] + public UpdateUserRequest Request { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}, {nameof(Request)}: ({Request})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyContracts/UpdateTestGenderRequest.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyContracts/UpdateTestGenderRequest.verified.cs new file mode 100644 index 000000000..b063a57e9 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyContracts/UpdateTestGenderRequest.verified.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyContracts; + +/// +/// Update test-gender Request. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateTestGenderRequest +{ + /// + /// GenderType. + /// + public GenderType Gender { get; set; } + + /// + public override string ToString() + => $"{nameof(Gender)}: {Gender}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyContracts/UpdateUserRequest.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyContracts/UpdateUserRequest.verified.cs new file mode 100644 index 000000000..318242b8c --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyContracts/UpdateUserRequest.verified.cs @@ -0,0 +1,36 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyContracts; + +/// +/// Request to update a user. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateUserRequest +{ + public string FirstName { get; set; } + + public string LastName { get; set; } + + /// + /// Undefined description. + /// + /// + /// Email validation being enforced. + /// + [EmailAddress] + public string Email { get; set; } + + /// + /// GenderType. + /// + public GenderType Gender { get; set; } + + /// + public override string ToString() + => $"{nameof(FirstName)}: {FirstName}, {nameof(LastName)}: {LastName}, {nameof(Email)}: {Email}, {nameof(Gender)}: {Gender}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyContracts/User.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyContracts/User.verified.cs new file mode 100644 index 000000000..54e44db1f --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyContracts/User.verified.cs @@ -0,0 +1,62 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyContracts; + +/// +/// A single user. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class User +{ + public Guid Id { get; set; } + + /// + /// GenderType. + /// + public GenderType Gender { get; set; } + + public string FirstName { get; set; } + + public string LastName { get; set; } + + /// + /// Undefined description. + /// + /// + /// Email validation being enforced. + /// + [EmailAddress] + public string Email { get; set; } + + /// + /// Undefined description. + /// + /// + /// Url validation being enforced. + /// + [Uri] + public Uri Homepage { get; set; } + + /// + /// ColorType. + /// + public ColorType Color { get; set; } + + /// + /// Address. + /// + public Address HomeAddress { get; set; } + + /// + /// Address. + /// + public Address CompanyAddress { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}, {nameof(Gender)}: {Gender}, {nameof(FirstName)}: {FirstName}, {nameof(LastName)}: {LastName}, {nameof(Email)}: {Email}, {nameof(Homepage)}: ({Homepage}), {nameof(Color)}: {Color}, {nameof(HomeAddress)}: ({HomeAddress}), {nameof(CompanyAddress)}: ({CompanyAddress})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyContracts/Users.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyContracts/Users.verified.cs new file mode 100644 index 000000000..1373864d4 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyContracts/Users.verified.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyContracts; + +/// +/// A list of users. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class Users +{ + /// + /// A list of User. + /// + public List UserList { get; set; } = new List(); + + /// + public override string ToString() + => $"{nameof(UserList)}.Count: {UserList?.Count ?? 0}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/DeleteUserByIdEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/DeleteUserByIdEndpoint.verified.cs new file mode 100644 index 000000000..533adb340 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/DeleteUserByIdEndpoint.verified.cs @@ -0,0 +1,48 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints; + +/// +/// Client Endpoint. +/// Description: Delete user by id. +/// Operation: DeleteUserById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class DeleteUserByIdEndpoint : IDeleteUserByIdEndpoint +{ + private readonly IHttpClientFactory factory; + private readonly IHttpMessageFactory httpMessageFactory; + + public DeleteUserByIdEndpoint( + IHttpClientFactory factory, + IHttpMessageFactory httpMessageFactory) + { + this.factory = factory; + this.httpMessageFactory = httpMessageFactory; + } + + public async Task ExecuteAsync( + DeleteUserByIdParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default) + { + var client = factory.CreateClient(httpClientName); + + var requestBuilder = httpMessageFactory.FromTemplate("/api/v1/users/{id}"); + requestBuilder.WithPathParameter("id", parameters.Id); + + using var requestMessage = requestBuilder.Build(HttpMethod.Delete); + using var response = await client.SendAsync(requestMessage, cancellationToken); + + var responseBuilder = httpMessageFactory.FromResponse(response); + responseBuilder.AddSuccessResponse(HttpStatusCode.OK); + responseBuilder.AddErrorResponse(HttpStatusCode.BadRequest); + responseBuilder.AddErrorResponse(HttpStatusCode.NotFound); + responseBuilder.AddErrorResponse(HttpStatusCode.Conflict); + return await responseBuilder.BuildResponseAsync(x => new DeleteUserByIdEndpointResult(x), cancellationToken); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/DeleteUserByIdEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/DeleteUserByIdEndpointResult.verified.cs new file mode 100644 index 000000000..df86a8432 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/DeleteUserByIdEndpointResult.verified.cs @@ -0,0 +1,53 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints; + +/// +/// Client Endpoint result. +/// Description: Delete user by id. +/// Operation: DeleteUserById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class DeleteUserByIdEndpointResult : EndpointResponse, IDeleteUserByIdEndpointResult +{ + public DeleteUserByIdEndpointResult(EndpointResponse response) + : base(response) + { + } + + public bool IsOk + => StatusCode == HttpStatusCode.OK; + + public bool IsBadRequest + => StatusCode == HttpStatusCode.BadRequest; + + public bool IsNotFound + => StatusCode == HttpStatusCode.NotFound; + + public bool IsConflict + => StatusCode == HttpStatusCode.Conflict; + + public string? OkContent + => IsOk && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsOk property first."); + + public ValidationProblemDetails BadRequestContent + => IsBadRequest && ContentObject is ValidationProblemDetails result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsBadRequest property first."); + + public string? NotFoundContent + => IsNotFound && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsNotFound property first."); + + public ProblemDetails ConflictContent + => IsConflict && ContentObject is ProblemDetails result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsConflict property first."); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/GetUserByEmailEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/GetUserByEmailEndpoint.verified.cs new file mode 100644 index 000000000..252e1d6a1 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/GetUserByEmailEndpoint.verified.cs @@ -0,0 +1,48 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints; + +/// +/// Client Endpoint. +/// Description: Get user by email. +/// Operation: GetUserByEmail. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetUserByEmailEndpoint : IGetUserByEmailEndpoint +{ + private readonly IHttpClientFactory factory; + private readonly IHttpMessageFactory httpMessageFactory; + + public GetUserByEmailEndpoint( + IHttpClientFactory factory, + IHttpMessageFactory httpMessageFactory) + { + this.factory = factory; + this.httpMessageFactory = httpMessageFactory; + } + + public async Task ExecuteAsync( + GetUserByEmailParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default) + { + var client = factory.CreateClient(httpClientName); + + var requestBuilder = httpMessageFactory.FromTemplate("/api/v1/users/email"); + requestBuilder.WithQueryParameter("email", parameters.Email); + + using var requestMessage = requestBuilder.Build(HttpMethod.Get); + using var response = await client.SendAsync(requestMessage, cancellationToken); + + var responseBuilder = httpMessageFactory.FromResponse(response); + responseBuilder.AddSuccessResponse(HttpStatusCode.OK); + responseBuilder.AddErrorResponse(HttpStatusCode.BadRequest); + responseBuilder.AddErrorResponse(HttpStatusCode.NotFound); + responseBuilder.AddErrorResponse(HttpStatusCode.Conflict); + return await responseBuilder.BuildResponseAsync(x => new GetUserByEmailEndpointResult(x), cancellationToken); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/GetUserByEmailEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/GetUserByEmailEndpointResult.verified.cs new file mode 100644 index 000000000..623627c10 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/GetUserByEmailEndpointResult.verified.cs @@ -0,0 +1,53 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints; + +/// +/// Client Endpoint result. +/// Description: Get user by email. +/// Operation: GetUserByEmail. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetUserByEmailEndpointResult : EndpointResponse, IGetUserByEmailEndpointResult +{ + public GetUserByEmailEndpointResult(EndpointResponse response) + : base(response) + { + } + + public bool IsOk + => StatusCode == HttpStatusCode.OK; + + public bool IsBadRequest + => StatusCode == HttpStatusCode.BadRequest; + + public bool IsNotFound + => StatusCode == HttpStatusCode.NotFound; + + public bool IsConflict + => StatusCode == HttpStatusCode.Conflict; + + public User OkContent + => IsOk && ContentObject is User result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsOk property first."); + + public ValidationProblemDetails BadRequestContent + => IsBadRequest && ContentObject is ValidationProblemDetails result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsBadRequest property first."); + + public string? NotFoundContent + => IsNotFound && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsNotFound property first."); + + public ProblemDetails ConflictContent + => IsConflict && ContentObject is ProblemDetails result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsConflict property first."); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/GetUserByIdEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/GetUserByIdEndpoint.verified.cs new file mode 100644 index 000000000..7cd429973 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/GetUserByIdEndpoint.verified.cs @@ -0,0 +1,48 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints; + +/// +/// Client Endpoint. +/// Description: Get user by id. +/// Operation: GetUserById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetUserByIdEndpoint : IGetUserByIdEndpoint +{ + private readonly IHttpClientFactory factory; + private readonly IHttpMessageFactory httpMessageFactory; + + public GetUserByIdEndpoint( + IHttpClientFactory factory, + IHttpMessageFactory httpMessageFactory) + { + this.factory = factory; + this.httpMessageFactory = httpMessageFactory; + } + + public async Task ExecuteAsync( + GetUserByIdParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default) + { + var client = factory.CreateClient(httpClientName); + + var requestBuilder = httpMessageFactory.FromTemplate("/api/v1/users/{id}"); + requestBuilder.WithPathParameter("id", parameters.Id); + + using var requestMessage = requestBuilder.Build(HttpMethod.Get); + using var response = await client.SendAsync(requestMessage, cancellationToken); + + var responseBuilder = httpMessageFactory.FromResponse(response); + responseBuilder.AddSuccessResponse(HttpStatusCode.OK); + responseBuilder.AddErrorResponse(HttpStatusCode.BadRequest); + responseBuilder.AddErrorResponse(HttpStatusCode.NotFound); + responseBuilder.AddErrorResponse(HttpStatusCode.Conflict); + return await responseBuilder.BuildResponseAsync(x => new GetUserByIdEndpointResult(x), cancellationToken); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/GetUserByIdEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/GetUserByIdEndpointResult.verified.cs new file mode 100644 index 000000000..01715a9ed --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/GetUserByIdEndpointResult.verified.cs @@ -0,0 +1,53 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints; + +/// +/// Client Endpoint result. +/// Description: Get user by id. +/// Operation: GetUserById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetUserByIdEndpointResult : EndpointResponse, IGetUserByIdEndpointResult +{ + public GetUserByIdEndpointResult(EndpointResponse response) + : base(response) + { + } + + public bool IsOk + => StatusCode == HttpStatusCode.OK; + + public bool IsBadRequest + => StatusCode == HttpStatusCode.BadRequest; + + public bool IsNotFound + => StatusCode == HttpStatusCode.NotFound; + + public bool IsConflict + => StatusCode == HttpStatusCode.Conflict; + + public User OkContent + => IsOk && ContentObject is User result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsOk property first."); + + public ValidationProblemDetails BadRequestContent + => IsBadRequest && ContentObject is ValidationProblemDetails result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsBadRequest property first."); + + public string? NotFoundContent + => IsNotFound && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsNotFound property first."); + + public ProblemDetails ConflictContent + => IsConflict && ContentObject is ProblemDetails result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsConflict property first."); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/GetUsersEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/GetUsersEndpoint.verified.cs new file mode 100644 index 000000000..5c5635744 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/GetUsersEndpoint.verified.cs @@ -0,0 +1,44 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints; + +/// +/// Client Endpoint. +/// Description: Get all users. +/// Operation: GetUsers. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetUsersEndpoint : IGetUsersEndpoint +{ + private readonly IHttpClientFactory factory; + private readonly IHttpMessageFactory httpMessageFactory; + + public GetUsersEndpoint( + IHttpClientFactory factory, + IHttpMessageFactory httpMessageFactory) + { + this.factory = factory; + this.httpMessageFactory = httpMessageFactory; + } + + public async Task ExecuteAsync( + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default) + { + var client = factory.CreateClient(httpClientName); + + var requestBuilder = httpMessageFactory.FromTemplate("/api/v1/users"); + + using var requestMessage = requestBuilder.Build(HttpMethod.Get); + using var response = await client.SendAsync(requestMessage, cancellationToken); + + var responseBuilder = httpMessageFactory.FromResponse(response); + responseBuilder.AddSuccessResponse>(HttpStatusCode.OK); + responseBuilder.AddErrorResponse(HttpStatusCode.Conflict); + return await responseBuilder.BuildResponseAsync(x => new GetUsersEndpointResult(x), cancellationToken); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/GetUsersEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/GetUsersEndpointResult.verified.cs new file mode 100644 index 000000000..3a5cac727 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/GetUsersEndpointResult.verified.cs @@ -0,0 +1,37 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints; + +/// +/// Client Endpoint result. +/// Description: Get all users. +/// Operation: GetUsers. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetUsersEndpointResult : EndpointResponse, IGetUsersEndpointResult +{ + public GetUsersEndpointResult(EndpointResponse response) + : base(response) + { + } + + public bool IsOk + => StatusCode == HttpStatusCode.OK; + + public bool IsConflict + => StatusCode == HttpStatusCode.Conflict; + + public IEnumerable OkContent + => IsOk && ContentObject is IEnumerable result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsOk property first."); + + public ProblemDetails ConflictContent + => IsConflict && ContentObject is ProblemDetails result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsConflict property first."); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IDeleteUserByIdEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IDeleteUserByIdEndpoint.verified.cs new file mode 100644 index 000000000..5a4c71446 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IDeleteUserByIdEndpoint.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint. +/// Description: Delete user by id. +/// Operation: DeleteUserById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IDeleteUserByIdEndpoint +{ + /// + /// Execute method. + /// + /// The parameters. + /// The http client name. + /// The cancellation token. + Task ExecuteAsync( + DeleteUserByIdParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IDeleteUserByIdEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IDeleteUserByIdEndpointResult.verified.cs new file mode 100644 index 000000000..5654f3d4b --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IDeleteUserByIdEndpointResult.verified.cs @@ -0,0 +1,33 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint Result. +/// Description: Delete user by id. +/// Operation: DeleteUserById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IDeleteUserByIdEndpointResult : IEndpointResponse +{ + + bool IsOk { get; } + + bool IsBadRequest { get; } + + bool IsNotFound { get; } + + bool IsConflict { get; } + + string? OkContent { get; } + + ValidationProblemDetails BadRequestContent { get; } + + string? NotFoundContent { get; } + + ProblemDetails ConflictContent { get; } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IGetUserByEmailEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IGetUserByEmailEndpoint.verified.cs new file mode 100644 index 000000000..6ccc64469 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IGetUserByEmailEndpoint.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint. +/// Description: Get user by email. +/// Operation: GetUserByEmail. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetUserByEmailEndpoint +{ + /// + /// Execute method. + /// + /// The parameters. + /// The http client name. + /// The cancellation token. + Task ExecuteAsync( + GetUserByEmailParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IGetUserByEmailEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IGetUserByEmailEndpointResult.verified.cs new file mode 100644 index 000000000..bc46d8ba7 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IGetUserByEmailEndpointResult.verified.cs @@ -0,0 +1,33 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint Result. +/// Description: Get user by email. +/// Operation: GetUserByEmail. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetUserByEmailEndpointResult : IEndpointResponse +{ + + bool IsOk { get; } + + bool IsBadRequest { get; } + + bool IsNotFound { get; } + + bool IsConflict { get; } + + User OkContent { get; } + + ValidationProblemDetails BadRequestContent { get; } + + string? NotFoundContent { get; } + + ProblemDetails ConflictContent { get; } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IGetUserByIdEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IGetUserByIdEndpoint.verified.cs new file mode 100644 index 000000000..f587bebbe --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IGetUserByIdEndpoint.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint. +/// Description: Get user by id. +/// Operation: GetUserById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetUserByIdEndpoint +{ + /// + /// Execute method. + /// + /// The parameters. + /// The http client name. + /// The cancellation token. + Task ExecuteAsync( + GetUserByIdParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IGetUserByIdEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IGetUserByIdEndpointResult.verified.cs new file mode 100644 index 000000000..b43899e4a --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IGetUserByIdEndpointResult.verified.cs @@ -0,0 +1,33 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint Result. +/// Description: Get user by id. +/// Operation: GetUserById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetUserByIdEndpointResult : IEndpointResponse +{ + + bool IsOk { get; } + + bool IsBadRequest { get; } + + bool IsNotFound { get; } + + bool IsConflict { get; } + + User OkContent { get; } + + ValidationProblemDetails BadRequestContent { get; } + + string? NotFoundContent { get; } + + ProblemDetails ConflictContent { get; } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IGetUsersEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IGetUsersEndpoint.verified.cs new file mode 100644 index 000000000..e5713f683 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IGetUsersEndpoint.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint. +/// Description: Get all users. +/// Operation: GetUsers. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetUsersEndpoint +{ + /// + /// Execute method. + /// + /// The http client name. + /// The cancellation token. + Task ExecuteAsync( + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IGetUsersEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IGetUsersEndpointResult.verified.cs new file mode 100644 index 000000000..61f80d6c0 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IGetUsersEndpointResult.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint Result. +/// Description: Get all users. +/// Operation: GetUsers. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetUsersEndpointResult : IEndpointResponse +{ + + bool IsOk { get; } + + bool IsConflict { get; } + + IEnumerable OkContent { get; } + + ProblemDetails ConflictContent { get; } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IPostUserEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IPostUserEndpoint.verified.cs new file mode 100644 index 000000000..0fe3778fe --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IPostUserEndpoint.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint. +/// Description: Create a new user. +/// Operation: PostUser. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IPostUserEndpoint +{ + /// + /// Execute method. + /// + /// The parameters. + /// The http client name. + /// The cancellation token. + Task ExecuteAsync( + PostUserParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IPostUserEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IPostUserEndpointResult.verified.cs new file mode 100644 index 000000000..22ac4e8eb --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IPostUserEndpointResult.verified.cs @@ -0,0 +1,29 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint Result. +/// Description: Create a new user. +/// Operation: PostUser. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IPostUserEndpointResult : IEndpointResponse +{ + + bool IsCreated { get; } + + bool IsBadRequest { get; } + + bool IsConflict { get; } + + ProblemDetails CreatedContent { get; } + + ValidationProblemDetails BadRequestContent { get; } + + ProblemDetails ConflictContent { get; } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IUpdateMyTestGenderEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IUpdateMyTestGenderEndpoint.verified.cs new file mode 100644 index 000000000..1d3bf7535 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IUpdateMyTestGenderEndpoint.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint. +/// Description: Update gender on a user. +/// Operation: UpdateMyTestGender. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IUpdateMyTestGenderEndpoint +{ + /// + /// Execute method. + /// + /// The parameters. + /// The http client name. + /// The cancellation token. + Task ExecuteAsync( + UpdateMyTestGenderParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IUpdateMyTestGenderEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IUpdateMyTestGenderEndpointResult.verified.cs new file mode 100644 index 000000000..e7f77531d --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IUpdateMyTestGenderEndpointResult.verified.cs @@ -0,0 +1,33 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint Result. +/// Description: Update gender on a user. +/// Operation: UpdateMyTestGender. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IUpdateMyTestGenderEndpointResult : IEndpointResponse +{ + + bool IsOk { get; } + + bool IsBadRequest { get; } + + bool IsNotFound { get; } + + bool IsConflict { get; } + + string? OkContent { get; } + + ValidationProblemDetails BadRequestContent { get; } + + string? NotFoundContent { get; } + + ProblemDetails ConflictContent { get; } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IUpdateUserByIdEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IUpdateUserByIdEndpoint.verified.cs new file mode 100644 index 000000000..ae7d21b63 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IUpdateUserByIdEndpoint.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint. +/// Description: Update user by id. +/// Operation: UpdateUserById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IUpdateUserByIdEndpoint +{ + /// + /// Execute method. + /// + /// The parameters. + /// The http client name. + /// The cancellation token. + Task ExecuteAsync( + UpdateUserByIdParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IUpdateUserByIdEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IUpdateUserByIdEndpointResult.verified.cs new file mode 100644 index 000000000..5af581363 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/Interfaces/IUpdateUserByIdEndpointResult.verified.cs @@ -0,0 +1,33 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints.Interfaces; + +/// +/// Interface for Client Endpoint Result. +/// Description: Update user by id. +/// Operation: UpdateUserById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IUpdateUserByIdEndpointResult : IEndpointResponse +{ + + bool IsOk { get; } + + bool IsBadRequest { get; } + + bool IsNotFound { get; } + + bool IsConflict { get; } + + string? OkContent { get; } + + ValidationProblemDetails BadRequestContent { get; } + + string? NotFoundContent { get; } + + ProblemDetails ConflictContent { get; } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/PostUserEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/PostUserEndpoint.verified.cs new file mode 100644 index 000000000..b30d25ddc --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/PostUserEndpoint.verified.cs @@ -0,0 +1,47 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints; + +/// +/// Client Endpoint. +/// Description: Create a new user. +/// Operation: PostUser. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class PostUserEndpoint : IPostUserEndpoint +{ + private readonly IHttpClientFactory factory; + private readonly IHttpMessageFactory httpMessageFactory; + + public PostUserEndpoint( + IHttpClientFactory factory, + IHttpMessageFactory httpMessageFactory) + { + this.factory = factory; + this.httpMessageFactory = httpMessageFactory; + } + + public async Task ExecuteAsync( + PostUserParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default) + { + var client = factory.CreateClient(httpClientName); + + var requestBuilder = httpMessageFactory.FromTemplate("/api/v1/users"); + requestBuilder.WithBody(parameters.Request); + + using var requestMessage = requestBuilder.Build(HttpMethod.Post); + using var response = await client.SendAsync(requestMessage, cancellationToken); + + var responseBuilder = httpMessageFactory.FromResponse(response); + responseBuilder.AddErrorResponse(HttpStatusCode.Created); + responseBuilder.AddErrorResponse(HttpStatusCode.BadRequest); + responseBuilder.AddErrorResponse(HttpStatusCode.Conflict); + return await responseBuilder.BuildResponseAsync(x => new PostUserEndpointResult(x), cancellationToken); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/PostUserEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/PostUserEndpointResult.verified.cs new file mode 100644 index 000000000..2c3781da1 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/PostUserEndpointResult.verified.cs @@ -0,0 +1,45 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints; + +/// +/// Client Endpoint result. +/// Description: Create a new user. +/// Operation: PostUser. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class PostUserEndpointResult : EndpointResponse, IPostUserEndpointResult +{ + public PostUserEndpointResult(EndpointResponse response) + : base(response) + { + } + + public bool IsCreated + => StatusCode == HttpStatusCode.Created; + + public bool IsBadRequest + => StatusCode == HttpStatusCode.BadRequest; + + public bool IsConflict + => StatusCode == HttpStatusCode.Conflict; + + public ProblemDetails CreatedContent + => IsCreated && ContentObject is ProblemDetails result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsCreated property first."); + + public ValidationProblemDetails BadRequestContent + => IsBadRequest && ContentObject is ValidationProblemDetails result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsBadRequest property first."); + + public ProblemDetails ConflictContent + => IsConflict && ContentObject is ProblemDetails result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsConflict property first."); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/UpdateMyTestGenderEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/UpdateMyTestGenderEndpoint.verified.cs new file mode 100644 index 000000000..c834e31e1 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/UpdateMyTestGenderEndpoint.verified.cs @@ -0,0 +1,50 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints; + +/// +/// Client Endpoint. +/// Description: Update gender on a user. +/// Operation: UpdateMyTestGender. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateMyTestGenderEndpoint : IUpdateMyTestGenderEndpoint +{ + private readonly IHttpClientFactory factory; + private readonly IHttpMessageFactory httpMessageFactory; + + public UpdateMyTestGenderEndpoint( + IHttpClientFactory factory, + IHttpMessageFactory httpMessageFactory) + { + this.factory = factory; + this.httpMessageFactory = httpMessageFactory; + } + + public async Task ExecuteAsync( + UpdateMyTestGenderParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default) + { + var client = factory.CreateClient(httpClientName); + + var requestBuilder = httpMessageFactory.FromTemplate("/api/v1/users/{id}/gender"); + requestBuilder.WithPathParameter("id", parameters.Id); + requestBuilder.WithQueryParameter("genderParam", parameters.GenderParam); + requestBuilder.WithBody(parameters.Request); + + using var requestMessage = requestBuilder.Build(HttpMethod.Put); + using var response = await client.SendAsync(requestMessage, cancellationToken); + + var responseBuilder = httpMessageFactory.FromResponse(response); + responseBuilder.AddSuccessResponse(HttpStatusCode.OK); + responseBuilder.AddErrorResponse(HttpStatusCode.BadRequest); + responseBuilder.AddErrorResponse(HttpStatusCode.NotFound); + responseBuilder.AddErrorResponse(HttpStatusCode.Conflict); + return await responseBuilder.BuildResponseAsync(x => new UpdateMyTestGenderEndpointResult(x), cancellationToken); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/UpdateMyTestGenderEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/UpdateMyTestGenderEndpointResult.verified.cs new file mode 100644 index 000000000..15052224d --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/UpdateMyTestGenderEndpointResult.verified.cs @@ -0,0 +1,53 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints; + +/// +/// Client Endpoint result. +/// Description: Update gender on a user. +/// Operation: UpdateMyTestGender. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateMyTestGenderEndpointResult : EndpointResponse, IUpdateMyTestGenderEndpointResult +{ + public UpdateMyTestGenderEndpointResult(EndpointResponse response) + : base(response) + { + } + + public bool IsOk + => StatusCode == HttpStatusCode.OK; + + public bool IsBadRequest + => StatusCode == HttpStatusCode.BadRequest; + + public bool IsNotFound + => StatusCode == HttpStatusCode.NotFound; + + public bool IsConflict + => StatusCode == HttpStatusCode.Conflict; + + public string? OkContent + => IsOk && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsOk property first."); + + public ValidationProblemDetails BadRequestContent + => IsBadRequest && ContentObject is ValidationProblemDetails result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsBadRequest property first."); + + public string? NotFoundContent + => IsNotFound && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsNotFound property first."); + + public ProblemDetails ConflictContent + => IsConflict && ContentObject is ProblemDetails result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsConflict property first."); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/UpdateUserByIdEndpoint.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/UpdateUserByIdEndpoint.verified.cs new file mode 100644 index 000000000..c93385481 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/UpdateUserByIdEndpoint.verified.cs @@ -0,0 +1,49 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints; + +/// +/// Client Endpoint. +/// Description: Update user by id. +/// Operation: UpdateUserById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateUserByIdEndpoint : IUpdateUserByIdEndpoint +{ + private readonly IHttpClientFactory factory; + private readonly IHttpMessageFactory httpMessageFactory; + + public UpdateUserByIdEndpoint( + IHttpClientFactory factory, + IHttpMessageFactory httpMessageFactory) + { + this.factory = factory; + this.httpMessageFactory = httpMessageFactory; + } + + public async Task ExecuteAsync( + UpdateUserByIdParameters parameters, + string httpClientName = "Structure1-ApiClient", + CancellationToken cancellationToken = default) + { + var client = factory.CreateClient(httpClientName); + + var requestBuilder = httpMessageFactory.FromTemplate("/api/v1/users/{id}"); + requestBuilder.WithPathParameter("id", parameters.Id); + requestBuilder.WithBody(parameters.Request); + + using var requestMessage = requestBuilder.Build(HttpMethod.Put); + using var response = await client.SendAsync(requestMessage, cancellationToken); + + var responseBuilder = httpMessageFactory.FromResponse(response); + responseBuilder.AddSuccessResponse(HttpStatusCode.OK); + responseBuilder.AddErrorResponse(HttpStatusCode.BadRequest); + responseBuilder.AddErrorResponse(HttpStatusCode.NotFound); + responseBuilder.AddErrorResponse(HttpStatusCode.Conflict); + return await responseBuilder.BuildResponseAsync(x => new UpdateUserByIdEndpointResult(x), cancellationToken); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/UpdateUserByIdEndpointResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/UpdateUserByIdEndpointResult.verified.cs new file mode 100644 index 000000000..04e69c30f --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyClient/WPD/src/Structure1.ApiClient.Generated/Users/MyEndpoints/UpdateUserByIdEndpointResult.verified.cs @@ -0,0 +1,53 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.ApiClient.Generated.Users.MyEndpoints; + +/// +/// Client Endpoint result. +/// Description: Update user by id. +/// Operation: UpdateUserById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateUserByIdEndpointResult : EndpointResponse, IUpdateUserByIdEndpointResult +{ + public UpdateUserByIdEndpointResult(EndpointResponse response) + : base(response) + { + } + + public bool IsOk + => StatusCode == HttpStatusCode.OK; + + public bool IsBadRequest + => StatusCode == HttpStatusCode.BadRequest; + + public bool IsNotFound + => StatusCode == HttpStatusCode.NotFound; + + public bool IsConflict + => StatusCode == HttpStatusCode.Conflict; + + public string? OkContent + => IsOk && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsOk property first."); + + public ValidationProblemDetails BadRequestContent + => IsBadRequest && ContentObject is ValidationProblemDetails result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsBadRequest property first."); + + public string? NotFoundContent + => IsNotFound && ContentObject is string result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsNotFound property first."); + + public ProblemDetails ConflictContent + => IsConflict && ContentObject is ProblemDetails result + ? result + : throw new InvalidOperationException("Content is not the expected type - please use the IsConflict property first."); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Accounts/MyContracts/Interfaces/ISetAccountNameHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Accounts/MyContracts/Interfaces/ISetAccountNameHandler.verified.cs new file mode 100644 index 000000000..80dbd1854 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Accounts/MyContracts/Interfaces/ISetAccountNameHandler.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Accounts.MyContracts; + +/// +/// Domain Interface for RequestHandler. +/// Description: Set name of account. +/// Operation: SetAccountName. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface ISetAccountNameHandler +{ + /// + /// Execute method. + /// + /// The parameters. + /// The cancellation token. + Task ExecuteAsync( + SetAccountNameParameters parameters, + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Accounts/MyContracts/Interfaces/IUpdateAccountNameHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Accounts/MyContracts/Interfaces/IUpdateAccountNameHandler.verified.cs new file mode 100644 index 000000000..12be463b5 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Accounts/MyContracts/Interfaces/IUpdateAccountNameHandler.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Accounts.MyContracts; + +/// +/// Domain Interface for RequestHandler. +/// Description: Update name of account. +/// Operation: UpdateAccountName. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IUpdateAccountNameHandler +{ + /// + /// Execute method. + /// + /// The parameters. + /// The cancellation token. + Task ExecuteAsync( + UpdateAccountNameParameters parameters, + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Accounts/MyContracts/Models/UpdateAccountRequest.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Accounts/MyContracts/Models/UpdateAccountRequest.verified.cs new file mode 100644 index 000000000..c56e8e07c --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Accounts/MyContracts/Models/UpdateAccountRequest.verified.cs @@ -0,0 +1,20 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Accounts.MyContracts; + +/// +/// UpdateAccountRequest. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateAccountRequest +{ + public string Name { get; set; } + + /// + public override string ToString() + => $"{nameof(Name)}: {Name}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Accounts/MyContracts/Parameters/SetAccountNameParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Accounts/MyContracts/Parameters/SetAccountNameParameters.verified.cs new file mode 100644 index 000000000..8da7147f5 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Accounts/MyContracts/Parameters/SetAccountNameParameters.verified.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Accounts.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Set name of account. +/// Operation: SetAccountName. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class SetAccountNameParameters +{ + /// + /// The accountId. + /// + [FromRoute(Name = "accountId")] + [Required] + public Guid AccountId { get; set; } + + /// + /// UpdateAccountRequest. + /// + [FromBody] + [Required] + public UpdateAccountRequest Request { get; set; } + + /// + public override string ToString() + => $"{nameof(AccountId)}: {AccountId}, {nameof(Request)}: ({Request})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Accounts/MyContracts/Parameters/UpdateAccountNameParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Accounts/MyContracts/Parameters/UpdateAccountNameParameters.verified.cs new file mode 100644 index 000000000..381922220 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Accounts/MyContracts/Parameters/UpdateAccountNameParameters.verified.cs @@ -0,0 +1,33 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Accounts.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Update name of account. +/// Operation: UpdateAccountName. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateAccountNameParameters +{ + /// + /// The accountId. + /// + [FromRoute(Name = "accountId")] + [Required] + public Guid AccountId { get; set; } + + /// + /// The account name. + /// + [FromHeader(Name = "name")] + public string? Name { get; set; } + + /// + public override string ToString() + => $"{nameof(AccountId)}: {AccountId}, {nameof(Name)}: {Name}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Accounts/MyContracts/Results/SetAccountNameResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Accounts/MyContracts/Results/SetAccountNameResult.verified.cs new file mode 100644 index 000000000..1ef3f6247 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Accounts/MyContracts/Results/SetAccountNameResult.verified.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Accounts.MyContracts; + +/// +/// Results for operation request. +/// Description: Set name of account. +/// Operation: SetAccountName. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class SetAccountNameResult : ResultBase +{ + private SetAccountNameResult(ActionResult result) : base(result) { } + + /// + /// 200 - Ok response. + /// + public static SetAccountNameResult Ok(string? message = null) + => new SetAccountNameResult(new OkObjectResult(message)); + + /// + /// Performs an implicit conversion from SetAccountNameResult to ActionResult. + /// + public static implicit operator SetAccountNameResult(string response) + => Ok(response); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Accounts/MyContracts/Results/UpdateAccountNameResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Accounts/MyContracts/Results/UpdateAccountNameResult.verified.cs new file mode 100644 index 000000000..493fb1a9e --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Accounts/MyContracts/Results/UpdateAccountNameResult.verified.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Accounts.MyContracts; + +/// +/// Results for operation request. +/// Description: Update name of account. +/// Operation: UpdateAccountName. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateAccountNameResult : ResultBase +{ + private UpdateAccountNameResult(ActionResult result) : base(result) { } + + /// + /// 200 - Ok response. + /// + public static UpdateAccountNameResult Ok(string? message = null) + => new UpdateAccountNameResult(new OkObjectResult(message)); + + /// + /// Performs an implicit conversion from UpdateAccountNameResult to ActionResult. + /// + public static implicit operator UpdateAccountNameResult(string response) + => Ok(response); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Addresses/MyContracts/Interfaces/IGetAddressesByPostalCodesHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Addresses/MyContracts/Interfaces/IGetAddressesByPostalCodesHandler.verified.cs new file mode 100644 index 000000000..5e1b3ecb2 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Addresses/MyContracts/Interfaces/IGetAddressesByPostalCodesHandler.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Addresses.MyContracts; + +/// +/// Domain Interface for RequestHandler. +/// Description: Get addresses by postal code. +/// Operation: GetAddressesByPostalCodes. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetAddressesByPostalCodesHandler +{ + /// + /// Execute method. + /// + /// The parameters. + /// The cancellation token. + Task ExecuteAsync( + GetAddressesByPostalCodesParameters parameters, + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Addresses/MyContracts/Parameters/GetAddressesByPostalCodesParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Addresses/MyContracts/Parameters/GetAddressesByPostalCodesParameters.verified.cs new file mode 100644 index 000000000..96bb43589 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Addresses/MyContracts/Parameters/GetAddressesByPostalCodesParameters.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Addresses.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Get addresses by postal code. +/// Operation: GetAddressesByPostalCodes. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetAddressesByPostalCodesParameters +{ + /// + /// The postalCode to limit addresses on. + /// + [FromRoute(Name = "postalCode")] + [Required] + public string PostalCode { get; set; } + + /// + public override string ToString() + => $"{nameof(PostalCode)}: {PostalCode}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Addresses/MyContracts/Results/GetAddressesByPostalCodesResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Addresses/MyContracts/Results/GetAddressesByPostalCodesResult.verified.cs new file mode 100644 index 000000000..1e63219ce --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Addresses/MyContracts/Results/GetAddressesByPostalCodesResult.verified.cs @@ -0,0 +1,36 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Addresses.MyContracts; + +/// +/// Results for operation request. +/// Description: Get addresses by postal code. +/// Operation: GetAddressesByPostalCodes. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetAddressesByPostalCodesResult : ResultBase +{ + private GetAddressesByPostalCodesResult(ActionResult result) : base(result) { } + + /// + /// 200 - Ok response. + /// + public static GetAddressesByPostalCodesResult Ok(IEnumerable
response) + => new GetAddressesByPostalCodesResult(new OkObjectResult(response ?? Enumerable.Empty
())); + + /// + /// 404 - NotFound response. + /// + public static GetAddressesByPostalCodesResult NotFound(string? message = null) + => new GetAddressesByPostalCodesResult(new NotFoundObjectResult(message)); + + /// + /// Performs an implicit conversion from GetAddressesByPostalCodesResult to ActionResult. + /// + public static implicit operator GetAddressesByPostalCodesResult(List
response) + => Ok(response); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/ApiRegistration.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/ApiRegistration.verified.cs new file mode 100644 index 000000000..24076909b --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/ApiRegistration.verified.cs @@ -0,0 +1,12 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class ApiRegistration +{ +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/EventArgs/MyContracts/Interfaces/IGetEventArgByIdHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/EventArgs/MyContracts/Interfaces/IGetEventArgByIdHandler.verified.cs new file mode 100644 index 000000000..3a4df487b --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/EventArgs/MyContracts/Interfaces/IGetEventArgByIdHandler.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.EventArgs.MyContracts; + +/// +/// Domain Interface for RequestHandler. +/// Description: Get EventArgs By Id. +/// Operation: GetEventArgById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetEventArgByIdHandler +{ + /// + /// Execute method. + /// + /// The parameters. + /// The cancellation token. + Task ExecuteAsync( + GetEventArgByIdParameters parameters, + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/EventArgs/MyContracts/Interfaces/IGetEventArgsHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/EventArgs/MyContracts/Interfaces/IGetEventArgsHandler.verified.cs new file mode 100644 index 000000000..95b0fb798 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/EventArgs/MyContracts/Interfaces/IGetEventArgsHandler.verified.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.EventArgs.MyContracts; + +/// +/// Domain Interface for RequestHandler. +/// Description: Get EventArgs List. +/// Operation: GetEventArgs. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetEventArgsHandler +{ + /// + /// Execute method. + /// + /// The cancellation token. + Task ExecuteAsync( + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/EventArgs/MyContracts/Models/EventArgs.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/EventArgs/MyContracts/Models/EventArgs.verified.cs new file mode 100644 index 000000000..7413b2af1 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/EventArgs/MyContracts/Models/EventArgs.verified.cs @@ -0,0 +1,22 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.EventArgs.MyContracts; + +/// +/// EventArgs. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class EventArgs +{ + public Guid Id { get; set; } + + public string EventName { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}, {nameof(EventName)}: {EventName}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/EventArgs/MyContracts/Parameters/GetEventArgByIdParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/EventArgs/MyContracts/Parameters/GetEventArgByIdParameters.verified.cs new file mode 100644 index 000000000..981212598 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/EventArgs/MyContracts/Parameters/GetEventArgByIdParameters.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.EventArgs.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Get EventArgs By Id. +/// Operation: GetEventArgById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetEventArgByIdParameters +{ + /// + /// The id of the eventArgs. + /// + [FromRoute(Name = "id")] + [Required] + public string Id { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/EventArgs/MyContracts/Results/GetEventArgByIdResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/EventArgs/MyContracts/Results/GetEventArgByIdResult.verified.cs new file mode 100644 index 000000000..950bfb1a5 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/EventArgs/MyContracts/Results/GetEventArgByIdResult.verified.cs @@ -0,0 +1,36 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.EventArgs.MyContracts; + +/// +/// Results for operation request. +/// Description: Get EventArgs By Id. +/// Operation: GetEventArgById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetEventArgByIdResult : ResultBase +{ + private GetEventArgByIdResult(ActionResult result) : base(result) { } + + /// + /// 200 - Ok response. + /// + public static GetEventArgByIdResult Ok(EventArgs response) + => new GetEventArgByIdResult(new OkObjectResult(response)); + + /// + /// 404 - NotFound response. + /// + public static GetEventArgByIdResult NotFound(string? message = null) + => new GetEventArgByIdResult(new NotFoundObjectResult(message)); + + /// + /// Performs an implicit conversion from GetEventArgByIdResult to ActionResult. + /// + public static implicit operator GetEventArgByIdResult(EventArgs response) + => Ok(response); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/EventArgs/MyContracts/Results/GetEventArgsResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/EventArgs/MyContracts/Results/GetEventArgsResult.verified.cs new file mode 100644 index 000000000..de0f1a0b5 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/EventArgs/MyContracts/Results/GetEventArgsResult.verified.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.EventArgs.MyContracts; + +/// +/// Results for operation request. +/// Description: Get EventArgs List. +/// Operation: GetEventArgs. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetEventArgsResult : ResultBase +{ + private GetEventArgsResult(ActionResult result) : base(result) { } + + /// + /// 200 - Ok response. + /// + public static GetEventArgsResult Ok(IEnumerable response) + => new GetEventArgsResult(new OkObjectResult(response ?? Enumerable.Empty())); + + /// + /// Performs an implicit conversion from GetEventArgsResult to ActionResult. + /// + public static implicit operator GetEventArgsResult(List response) + => Ok(response); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Files/MyContracts/Interfaces/IGetFileByIdHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Files/MyContracts/Interfaces/IGetFileByIdHandler.verified.cs new file mode 100644 index 000000000..a10a53e3e --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Files/MyContracts/Interfaces/IGetFileByIdHandler.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Files.MyContracts; + +/// +/// Domain Interface for RequestHandler. +/// Description: Get File By Id. +/// Operation: GetFileById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetFileByIdHandler +{ + /// + /// Execute method. + /// + /// The parameters. + /// The cancellation token. + Task ExecuteAsync( + GetFileByIdParameters parameters, + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Files/MyContracts/Interfaces/IUploadMultiFilesAsFormDataHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Files/MyContracts/Interfaces/IUploadMultiFilesAsFormDataHandler.verified.cs new file mode 100644 index 000000000..1ddda3760 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Files/MyContracts/Interfaces/IUploadMultiFilesAsFormDataHandler.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Files.MyContracts; + +/// +/// Domain Interface for RequestHandler. +/// Description: Upload multi files as form data. +/// Operation: UploadMultiFilesAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IUploadMultiFilesAsFormDataHandler +{ + /// + /// Execute method. + /// + /// The parameters. + /// The cancellation token. + Task ExecuteAsync( + UploadMultiFilesAsFormDataParameters parameters, + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Files/MyContracts/Interfaces/IUploadSingleFileAsFormDataHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Files/MyContracts/Interfaces/IUploadSingleFileAsFormDataHandler.verified.cs new file mode 100644 index 000000000..dcf66124e --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Files/MyContracts/Interfaces/IUploadSingleFileAsFormDataHandler.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Files.MyContracts; + +/// +/// Domain Interface for RequestHandler. +/// Description: Upload a file as OctetStream. +/// Operation: UploadSingleFileAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IUploadSingleFileAsFormDataHandler +{ + /// + /// Execute method. + /// + /// The parameters. + /// The cancellation token. + Task ExecuteAsync( + UploadSingleFileAsFormDataParameters parameters, + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Files/MyContracts/Interfaces/IUploadSingleObjectWithFileAsFormDataHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Files/MyContracts/Interfaces/IUploadSingleObjectWithFileAsFormDataHandler.verified.cs new file mode 100644 index 000000000..bdaeeac4c --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Files/MyContracts/Interfaces/IUploadSingleObjectWithFileAsFormDataHandler.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Files.MyContracts; + +/// +/// Domain Interface for RequestHandler. +/// Description: Upload a file as FormData. +/// Operation: UploadSingleObjectWithFileAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IUploadSingleObjectWithFileAsFormDataHandler +{ + /// + /// Execute method. + /// + /// The parameters. + /// The cancellation token. + Task ExecuteAsync( + UploadSingleObjectWithFileAsFormDataParameters parameters, + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Files/MyContracts/Interfaces/IUploadSingleObjectWithFilesAsFormDataHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Files/MyContracts/Interfaces/IUploadSingleObjectWithFilesAsFormDataHandler.verified.cs new file mode 100644 index 000000000..47e56e87e --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Files/MyContracts/Interfaces/IUploadSingleObjectWithFilesAsFormDataHandler.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Files.MyContracts; + +/// +/// Domain Interface for RequestHandler. +/// Description: Upload files as FormData. +/// Operation: UploadSingleObjectWithFilesAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IUploadSingleObjectWithFilesAsFormDataHandler +{ + /// + /// Execute method. + /// + /// The parameters. + /// The cancellation token. + Task ExecuteAsync( + UploadSingleObjectWithFilesAsFormDataParameters parameters, + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Files/MyContracts/Models/FileAsFormDataRequest.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Files/MyContracts/Models/FileAsFormDataRequest.verified.cs new file mode 100644 index 000000000..d187e1ed8 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Files/MyContracts/Models/FileAsFormDataRequest.verified.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Files.MyContracts; + +/// +/// FileAsFormDataRequest. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class FileAsFormDataRequest +{ + [Required] + public string ItemName { get; set; } + + public IFormFile? File { get; set; } + + [Required] + public List Items { get; set; } + + /// + public override string ToString() + => $"{nameof(ItemName)}: {ItemName}, {nameof(File)}: {File}, {nameof(Items)}.Count: {Items?.Count ?? 0}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Files/MyContracts/Models/FilesAsFormDataRequest.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Files/MyContracts/Models/FilesAsFormDataRequest.verified.cs new file mode 100644 index 000000000..1c0728c6b --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Files/MyContracts/Models/FilesAsFormDataRequest.verified.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Files.MyContracts; + +/// +/// FilesAsFormDataRequest. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class FilesAsFormDataRequest +{ + /// + /// A list of File(s). + /// + public List Files { get; set; } = new List(); + + /// + public override string ToString() + => $"{nameof(Files)}.Count: {Files?.Count ?? 0}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Files/MyContracts/Parameters/GetFileByIdParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Files/MyContracts/Parameters/GetFileByIdParameters.verified.cs new file mode 100644 index 000000000..5f0edff2b --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Files/MyContracts/Parameters/GetFileByIdParameters.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Files.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Get File By Id. +/// Operation: GetFileById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetFileByIdParameters +{ + /// + /// The file id. + /// + [FromRoute(Name = "id")] + [Required] + public string Id { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Files/MyContracts/Parameters/UploadMultiFilesAsFormDataParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Files/MyContracts/Parameters/UploadMultiFilesAsFormDataParameters.verified.cs new file mode 100644 index 000000000..ba7c1aa55 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Files/MyContracts/Parameters/UploadMultiFilesAsFormDataParameters.verified.cs @@ -0,0 +1,24 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Files.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Upload multi files as form data. +/// Operation: UploadMultiFilesAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UploadMultiFilesAsFormDataParameters +{ + [FromForm] + [Required] + public List Request { get; set; } = new List(); + + /// + public override string ToString() + => $"{nameof(Request)}.Count: {Request?.Count ?? 0}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Files/MyContracts/Parameters/UploadSingleFileAsFormDataParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Files/MyContracts/Parameters/UploadSingleFileAsFormDataParameters.verified.cs new file mode 100644 index 000000000..b761ea16d --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Files/MyContracts/Parameters/UploadSingleFileAsFormDataParameters.verified.cs @@ -0,0 +1,24 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Files.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Upload a file as OctetStream. +/// Operation: UploadSingleFileAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UploadSingleFileAsFormDataParameters +{ + [FromBody] + [Required] + public IFormFile Request { get; set; } + + /// + public override string ToString() + => $"{nameof(Request)}: ({Request})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Files/MyContracts/Parameters/UploadSingleObjectWithFileAsFormDataParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Files/MyContracts/Parameters/UploadSingleObjectWithFileAsFormDataParameters.verified.cs new file mode 100644 index 000000000..2afbb0b39 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Files/MyContracts/Parameters/UploadSingleObjectWithFileAsFormDataParameters.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Files.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Upload a file as FormData. +/// Operation: UploadSingleObjectWithFileAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UploadSingleObjectWithFileAsFormDataParameters +{ + /// + /// FileAsFormDataRequest. + /// + [FromForm] + [Required] + public FileAsFormDataRequest Request { get; set; } + + /// + public override string ToString() + => $"{nameof(Request)}: ({Request})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Files/MyContracts/Parameters/UploadSingleObjectWithFilesAsFormDataParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Files/MyContracts/Parameters/UploadSingleObjectWithFilesAsFormDataParameters.verified.cs new file mode 100644 index 000000000..a80165b8a --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Files/MyContracts/Parameters/UploadSingleObjectWithFilesAsFormDataParameters.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Files.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Upload files as FormData. +/// Operation: UploadSingleObjectWithFilesAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UploadSingleObjectWithFilesAsFormDataParameters +{ + /// + /// FilesAsFormDataRequest. + /// + [FromForm] + [Required] + public FilesAsFormDataRequest Request { get; set; } + + /// + public override string ToString() + => $"{nameof(Request)}: ({Request})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Files/MyContracts/Results/GetFileByIdResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Files/MyContracts/Results/GetFileByIdResult.verified.cs new file mode 100644 index 000000000..6d5e1b715 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Files/MyContracts/Results/GetFileByIdResult.verified.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Files.MyContracts; + +/// +/// Results for operation request. +/// Description: Get File By Id. +/// Operation: GetFileById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetFileByIdResult : ResultBase +{ + private GetFileByIdResult(ActionResult result) : base(result) { } + + /// + /// 200 - Ok response. + /// + public static GetFileByIdResult Ok(byte[] bytes, string fileName) + => new GetFileByIdResult(ResultFactory.CreateFileContentResult(bytes, fileName)); + + /// + /// 404 - NotFound response. + /// + public static GetFileByIdResult NotFound(string? message = null) + => new GetFileByIdResult(new NotFoundObjectResult(message)); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Files/MyContracts/Results/UploadMultiFilesAsFormDataResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Files/MyContracts/Results/UploadMultiFilesAsFormDataResult.verified.cs new file mode 100644 index 000000000..8b8f0b690 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Files/MyContracts/Results/UploadMultiFilesAsFormDataResult.verified.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Files.MyContracts; + +/// +/// Results for operation request. +/// Description: Upload multi files as form data. +/// Operation: UploadMultiFilesAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UploadMultiFilesAsFormDataResult : ResultBase +{ + private UploadMultiFilesAsFormDataResult(ActionResult result) : base(result) { } + + /// + /// 200 - Ok response. + /// + public static UploadMultiFilesAsFormDataResult Ok(string? message = null) + => new UploadMultiFilesAsFormDataResult(new OkObjectResult(message)); + + /// + /// Performs an implicit conversion from UploadMultiFilesAsFormDataResult to ActionResult. + /// + public static implicit operator UploadMultiFilesAsFormDataResult(string response) + => Ok(response); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Files/MyContracts/Results/UploadSingleFileAsFormDataResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Files/MyContracts/Results/UploadSingleFileAsFormDataResult.verified.cs new file mode 100644 index 000000000..1a3604161 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Files/MyContracts/Results/UploadSingleFileAsFormDataResult.verified.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Files.MyContracts; + +/// +/// Results for operation request. +/// Description: Upload a file as OctetStream. +/// Operation: UploadSingleFileAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UploadSingleFileAsFormDataResult : ResultBase +{ + private UploadSingleFileAsFormDataResult(ActionResult result) : base(result) { } + + /// + /// 200 - Ok response. + /// + public static UploadSingleFileAsFormDataResult Ok(string? message = null) + => new UploadSingleFileAsFormDataResult(new OkObjectResult(message)); + + /// + /// Performs an implicit conversion from UploadSingleFileAsFormDataResult to ActionResult. + /// + public static implicit operator UploadSingleFileAsFormDataResult(string response) + => Ok(response); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Files/MyContracts/Results/UploadSingleObjectWithFileAsFormDataResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Files/MyContracts/Results/UploadSingleObjectWithFileAsFormDataResult.verified.cs new file mode 100644 index 000000000..95b75f97c --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Files/MyContracts/Results/UploadSingleObjectWithFileAsFormDataResult.verified.cs @@ -0,0 +1,36 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Files.MyContracts; + +/// +/// Results for operation request. +/// Description: Upload a file as FormData. +/// Operation: UploadSingleObjectWithFileAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UploadSingleObjectWithFileAsFormDataResult : ResultBase +{ + private UploadSingleObjectWithFileAsFormDataResult(ActionResult result) : base(result) { } + + /// + /// 200 - Ok response. + /// + public static UploadSingleObjectWithFileAsFormDataResult Ok(string? message = null) + => new UploadSingleObjectWithFileAsFormDataResult(new OkObjectResult(message)); + + /// + /// 400 - BadRequest response. + /// + public static UploadSingleObjectWithFileAsFormDataResult BadRequest(string? message = null) + => new UploadSingleObjectWithFileAsFormDataResult(new BadRequestObjectResult(message)); + + /// + /// Performs an implicit conversion from UploadSingleObjectWithFileAsFormDataResult to ActionResult. + /// + public static implicit operator UploadSingleObjectWithFileAsFormDataResult(string response) + => Ok(response); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Files/MyContracts/Results/UploadSingleObjectWithFilesAsFormDataResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Files/MyContracts/Results/UploadSingleObjectWithFilesAsFormDataResult.verified.cs new file mode 100644 index 000000000..20702a43b --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Files/MyContracts/Results/UploadSingleObjectWithFilesAsFormDataResult.verified.cs @@ -0,0 +1,36 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Files.MyContracts; + +/// +/// Results for operation request. +/// Description: Upload files as FormData. +/// Operation: UploadSingleObjectWithFilesAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UploadSingleObjectWithFilesAsFormDataResult : ResultBase +{ + private UploadSingleObjectWithFilesAsFormDataResult(ActionResult result) : base(result) { } + + /// + /// 200 - Ok response. + /// + public static UploadSingleObjectWithFilesAsFormDataResult Ok(string? message = null) + => new UploadSingleObjectWithFilesAsFormDataResult(new OkObjectResult(message)); + + /// + /// 400 - BadRequest response. + /// + public static UploadSingleObjectWithFilesAsFormDataResult BadRequest(string? message = null) + => new UploadSingleObjectWithFilesAsFormDataResult(new BadRequestObjectResult(message)); + + /// + /// Performs an implicit conversion from UploadSingleObjectWithFilesAsFormDataResult to ActionResult. + /// + public static implicit operator UploadSingleObjectWithFilesAsFormDataResult(string response) + => Ok(response); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/GlobalUsings.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/GlobalUsings.verified.cs new file mode 100644 index 000000000..a2569039d --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/GlobalUsings.verified.cs @@ -0,0 +1,20 @@ +global using System.CodeDom.Compiler; +global using System.ComponentModel.DataAnnotations; +global using System.Net; + +global using Atc.Rest.Results; + +global using Microsoft.AspNetCore.Authorization; +global using Microsoft.AspNetCore.Http; +global using Microsoft.AspNetCore.Mvc; + +global using Structure1.Api.Generated.Accounts.MyContracts; +global using Structure1.Api.Generated.Addresses.MyContracts; +global using Structure1.Api.Generated.EventArgs.MyContracts; +global using Structure1.Api.Generated.Files.MyContracts; +global using Structure1.Api.Generated.Items.MyContracts; +global using Structure1.Api.Generated.MyContracts; +global using Structure1.Api.Generated.Orders.MyContracts; +global using Structure1.Api.Generated.RouteWithDash.MyContracts; +global using Structure1.Api.Generated.Tasks.MyContracts; +global using Structure1.Api.Generated.Users.MyContracts; \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Items/MyContracts/Interfaces/ICreateItemHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Items/MyContracts/Interfaces/ICreateItemHandler.verified.cs new file mode 100644 index 000000000..e6c623a37 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Items/MyContracts/Interfaces/ICreateItemHandler.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Items.MyContracts; + +/// +/// Domain Interface for RequestHandler. +/// Description: Create a new item. +/// Operation: CreateItem. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface ICreateItemHandler +{ + /// + /// Execute method. + /// + /// The parameters. + /// The cancellation token. + Task ExecuteAsync( + CreateItemParameters parameters, + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Items/MyContracts/Interfaces/IUpdateItemHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Items/MyContracts/Interfaces/IUpdateItemHandler.verified.cs new file mode 100644 index 000000000..cb7998fd5 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Items/MyContracts/Interfaces/IUpdateItemHandler.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Items.MyContracts; + +/// +/// Domain Interface for RequestHandler. +/// Description: Updates an item. +/// Operation: UpdateItem. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IUpdateItemHandler +{ + /// + /// Execute method. + /// + /// The parameters. + /// The cancellation token. + Task ExecuteAsync( + UpdateItemParameters parameters, + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Items/MyContracts/Models/CreateItemRequest.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Items/MyContracts/Models/CreateItemRequest.verified.cs new file mode 100644 index 000000000..c5ca1f3b6 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Items/MyContracts/Models/CreateItemRequest.verified.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Items.MyContracts; + +/// +/// CreateItemRequest. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class CreateItemRequest +{ + /// + /// Item. + /// + [Required] + public Item Item { get; set; } + + /// + /// A list of Item. + /// + [Required] + public List MyItems { get; set; } + + /// + public override string ToString() + => $"{nameof(Item)}: ({Item}), {nameof(MyItems)}.Count: {MyItems?.Count ?? 0}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Items/MyContracts/Models/Item.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Items/MyContracts/Models/Item.verified.cs new file mode 100644 index 000000000..f44dd5fe6 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Items/MyContracts/Models/Item.verified.cs @@ -0,0 +1,21 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Items.MyContracts; + +/// +/// Item. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class Item +{ + [Required] + public string Name { get; set; } + + /// + public override string ToString() + => $"{nameof(Name)}: {Name}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Items/MyContracts/Models/UpdateItemRequest.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Items/MyContracts/Models/UpdateItemRequest.verified.cs new file mode 100644 index 000000000..e6c3179a6 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Items/MyContracts/Models/UpdateItemRequest.verified.cs @@ -0,0 +1,24 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Items.MyContracts; + +/// +/// UpdateItemRequest. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateItemRequest +{ + /// + /// Item. + /// + [Required] + public Item Item { get; set; } + + /// + public override string ToString() + => $"{nameof(Item)}: ({Item})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Items/MyContracts/Parameters/CreateItemParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Items/MyContracts/Parameters/CreateItemParameters.verified.cs new file mode 100644 index 000000000..19e052aa9 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Items/MyContracts/Parameters/CreateItemParameters.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Items.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Create a new item. +/// Operation: CreateItem. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class CreateItemParameters +{ + /// + /// CreateItemRequest. + /// + [FromBody] + [Required] + public CreateItemRequest Request { get; set; } + + /// + public override string ToString() + => $"{nameof(Request)}: ({Request})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Items/MyContracts/Parameters/UpdateItemParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Items/MyContracts/Parameters/UpdateItemParameters.verified.cs new file mode 100644 index 000000000..b414f536e --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Items/MyContracts/Parameters/UpdateItemParameters.verified.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Items.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Updates an item. +/// Operation: UpdateItem. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateItemParameters +{ + /// + /// The id of the order. + /// + [FromRoute(Name = "id")] + [Required] + public Guid Id { get; set; } + + /// + /// UpdateItemRequest. + /// + [FromBody] + [Required] + public UpdateItemRequest Request { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}, {nameof(Request)}: ({Request})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Items/MyContracts/Results/CreateItemResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Items/MyContracts/Results/CreateItemResult.verified.cs new file mode 100644 index 000000000..a7b01b9d8 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Items/MyContracts/Results/CreateItemResult.verified.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Items.MyContracts; + +/// +/// Results for operation request. +/// Description: Create a new item. +/// Operation: CreateItem. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class CreateItemResult : ResultBase +{ + private CreateItemResult(ActionResult result) : base(result) { } + + /// + /// 200 - Ok response. + /// + public static CreateItemResult Ok(string? message = null) + => new CreateItemResult(new OkObjectResult(message)); + + /// + /// Performs an implicit conversion from CreateItemResult to ActionResult. + /// + public static implicit operator CreateItemResult(string response) + => Ok(response); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Items/MyContracts/Results/UpdateItemResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Items/MyContracts/Results/UpdateItemResult.verified.cs new file mode 100644 index 000000000..4cb56f23d --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Items/MyContracts/Results/UpdateItemResult.verified.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Items.MyContracts; + +/// +/// Results for operation request. +/// Description: Updates an item. +/// Operation: UpdateItem. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateItemResult : ResultBase +{ + private UpdateItemResult(ActionResult result) : base(result) { } + + /// + /// 200 - Ok response. + /// + public static UpdateItemResult Ok(Guid response) + => new UpdateItemResult(new OkObjectResult(response)); + + /// + /// Performs an implicit conversion from UpdateItemResult to ActionResult. + /// + public static implicit operator UpdateItemResult(Guid response) + => Ok(response); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/MyContracts/_EnumerationTypes/ColorType.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/MyContracts/_EnumerationTypes/ColorType.verified.cs new file mode 100644 index 000000000..3df9ddd51 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/MyContracts/_EnumerationTypes/ColorType.verified.cs @@ -0,0 +1,21 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.MyContracts; + +/// +/// Enumeration: ColorType. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +[Flags] +public enum ColorType +{ + None = 0, + Black = 1, + White = 2, + Yellow = 4, + Red = 8, +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/MyContracts/_EnumerationTypes/GenderType.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/MyContracts/_EnumerationTypes/GenderType.verified.cs new file mode 100644 index 000000000..fbdaffc77 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/MyContracts/_EnumerationTypes/GenderType.verified.cs @@ -0,0 +1,19 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.MyContracts; + +/// +/// Enumeration: GenderType. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public enum GenderType +{ + None, + NonBinary, + Male, + Female, +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/MyContracts/_Shared/Address.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/MyContracts/_Shared/Address.verified.cs new file mode 100644 index 000000000..6df154843 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/MyContracts/_Shared/Address.verified.cs @@ -0,0 +1,32 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.MyContracts; + +/// +/// Address. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class Address +{ + [StringLength(255)] + public string StreetName { get; set; } + + public string StreetNumber { get; set; } + + public string PostalCode { get; set; } + + public string CityName { get; set; } + + /// + /// Country. + /// + public Country MyCountry { get; set; } + + /// + public override string ToString() + => $"{nameof(StreetName)}: {StreetName}, {nameof(StreetNumber)}: {StreetNumber}, {nameof(PostalCode)}: {PostalCode}, {nameof(CityName)}: {CityName}, {nameof(MyCountry)}: ({MyCountry})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/MyContracts/_Shared/Country.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/MyContracts/_Shared/Country.verified.cs new file mode 100644 index 000000000..92f9e91cd --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/MyContracts/_Shared/Country.verified.cs @@ -0,0 +1,33 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.MyContracts; + +/// +/// Country. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class Country +{ + [Required] + public string Name { get; set; } + + [Required] + [MinLength(2)] + [MaxLength(2)] + [RegularExpression("^[A-Za-z]{2}$")] + public string Alpha2Code { get; set; } + + [Required] + [MinLength(3)] + [MaxLength(3)] + [RegularExpression("^[A-Za-z]{3}$")] + public string Alpha3Code { get; set; } + + /// + public override string ToString() + => $"{nameof(Name)}: {Name}, {nameof(Alpha2Code)}: {Alpha2Code}, {nameof(Alpha3Code)}: {Alpha3Code}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/MyEndpoints/AccountsController.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/MyEndpoints/AccountsController.verified.cs new file mode 100644 index 000000000..9123238c6 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/MyEndpoints/AccountsController.verified.cs @@ -0,0 +1,42 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.MyEndpoints; + +/// +/// Endpoint definitions. +/// +[ApiController] +[Route("/api/v1/accounts")] +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public sealed class AccountsController : ControllerBase +{ + /// + /// Description: Update name of account. + /// Operation: UpdateAccountName. + /// + [HttpPut("{accountId}/name")] + [ProducesResponseType(typeof(string), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] + public async Task UpdateAccountName( + UpdateAccountNameParameters parameters, + [FromServices] IUpdateAccountNameHandler handler, + CancellationToken cancellationToken) + => await handler.ExecuteAsync(parameters, cancellationToken); + + /// + /// Description: Set name of account. + /// Operation: SetAccountName. + /// + [HttpPost("{accountId}/name")] + [ProducesResponseType(typeof(string), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] + public async Task SetAccountName( + SetAccountNameParameters parameters, + [FromServices] ISetAccountNameHandler handler, + CancellationToken cancellationToken) + => await handler.ExecuteAsync(parameters, cancellationToken); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/MyEndpoints/AddressesController.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/MyEndpoints/AddressesController.verified.cs new file mode 100644 index 000000000..c5b7c3c75 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/MyEndpoints/AddressesController.verified.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.MyEndpoints; + +/// +/// Endpoint definitions. +/// +[ApiController] +[Route("/api/v1/addresses")] +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public sealed class AddressesController : ControllerBase +{ + /// + /// Description: Get addresses by postal code. + /// Operation: GetAddressesByPostalCodes. + /// + [HttpGet("{postalCode}")] + [ProducesResponseType(typeof(IEnumerable
), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] + [ProducesResponseType(typeof(string), StatusCodes.Status404NotFound)] + public async Task GetAddressesByPostalCodes( + GetAddressesByPostalCodesParameters parameters, + [FromServices] IGetAddressesByPostalCodesHandler handler, + CancellationToken cancellationToken) + => await handler.ExecuteAsync(parameters, cancellationToken); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/MyEndpoints/EventArgsController.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/MyEndpoints/EventArgsController.verified.cs new file mode 100644 index 000000000..1db8993d0 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/MyEndpoints/EventArgsController.verified.cs @@ -0,0 +1,41 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.MyEndpoints; + +/// +/// Endpoint definitions. +/// +[ApiController] +[Route("/api/v1/eventArgs")] +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public sealed class EventArgsController : ControllerBase +{ + /// + /// Description: Get EventArgs List. + /// Operation: GetEventArgs. + /// + [HttpGet] + [ProducesResponseType(typeof(IEnumerable), StatusCodes.Status200OK)] + public async Task GetEventArgs( + [FromServices] IGetEventArgsHandler handler, + CancellationToken cancellationToken) + => await handler.ExecuteAsync(cancellationToken); + + /// + /// Description: Get EventArgs By Id. + /// Operation: GetEventArgById. + /// + [HttpGet("{id}")] + [ProducesResponseType(typeof(Contracts.EventArgs.EventArgs), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] + [ProducesResponseType(typeof(string), StatusCodes.Status404NotFound)] + public async Task GetEventArgById( + GetEventArgByIdParameters parameters, + [FromServices] IGetEventArgByIdHandler handler, + CancellationToken cancellationToken) + => await handler.ExecuteAsync(parameters, cancellationToken); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/MyEndpoints/FilesController.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/MyEndpoints/FilesController.verified.cs new file mode 100644 index 000000000..c0ac6a3b7 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/MyEndpoints/FilesController.verified.cs @@ -0,0 +1,86 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.MyEndpoints; + +/// +/// Endpoint definitions. +/// +[ApiController] +[Route("/api/v1/files")] +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public sealed class FilesController : ControllerBase +{ + /// + /// Description: Upload multi files as form data. + /// Operation: UploadMultiFilesAsFormData. + /// + [HttpPost("form-data/multiFile")] + [RequestFormLimits(MultipartBodyLengthLimit = long.MaxValue)] + [ProducesResponseType(typeof(string), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] + public async Task UploadMultiFilesAsFormData( + UploadMultiFilesAsFormDataParameters parameters, + [FromServices] IUploadMultiFilesAsFormDataHandler handler, + CancellationToken cancellationToken) + => await handler.ExecuteAsync(parameters, cancellationToken); + + /// + /// Description: Upload a file as OctetStream. + /// Operation: UploadSingleFileAsFormData. + /// + [HttpPost("form-data/singleFile")] + [RequestFormLimits(MultipartBodyLengthLimit = long.MaxValue)] + [ProducesResponseType(typeof(string), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] + public async Task UploadSingleFileAsFormData( + UploadSingleFileAsFormDataParameters parameters, + [FromServices] IUploadSingleFileAsFormDataHandler handler, + CancellationToken cancellationToken) + => await handler.ExecuteAsync(parameters, cancellationToken); + + /// + /// Description: Upload a file as FormData. + /// Operation: UploadSingleObjectWithFileAsFormData. + /// + [HttpPost("form-data/singleObject")] + [RequestFormLimits(MultipartBodyLengthLimit = long.MaxValue)] + [ProducesResponseType(typeof(string), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] + public async Task UploadSingleObjectWithFileAsFormData( + UploadSingleObjectWithFileAsFormDataParameters parameters, + [FromServices] IUploadSingleObjectWithFileAsFormDataHandler handler, + CancellationToken cancellationToken) + => await handler.ExecuteAsync(parameters, cancellationToken); + + /// + /// Description: Upload files as FormData. + /// Operation: UploadSingleObjectWithFilesAsFormData. + /// + [HttpPost("form-data/singleObjectMultiFile")] + [RequestFormLimits(MultipartBodyLengthLimit = long.MaxValue)] + [ProducesResponseType(typeof(string), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] + public async Task UploadSingleObjectWithFilesAsFormData( + UploadSingleObjectWithFilesAsFormDataParameters parameters, + [FromServices] IUploadSingleObjectWithFilesAsFormDataHandler handler, + CancellationToken cancellationToken) + => await handler.ExecuteAsync(parameters, cancellationToken); + + /// + /// Description: Get File By Id. + /// Operation: GetFileById. + /// + [HttpGet("{id}")] + [ProducesResponseType(typeof(byte[]), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] + [ProducesResponseType(typeof(string), StatusCodes.Status404NotFound)] + public async Task GetFileById( + GetFileByIdParameters parameters, + [FromServices] IGetFileByIdHandler handler, + CancellationToken cancellationToken) + => await handler.ExecuteAsync(parameters, cancellationToken); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/MyEndpoints/ItemsController.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/MyEndpoints/ItemsController.verified.cs new file mode 100644 index 000000000..b09c525b4 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/MyEndpoints/ItemsController.verified.cs @@ -0,0 +1,42 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.MyEndpoints; + +/// +/// Endpoint definitions. +/// +[ApiController] +[Route("/api/v1/items")] +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public sealed class ItemsController : ControllerBase +{ + /// + /// Description: Create a new item. + /// Operation: CreateItem. + /// + [HttpPost] + [ProducesResponseType(typeof(string), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] + public async Task CreateItem( + CreateItemParameters parameters, + [FromServices] ICreateItemHandler handler, + CancellationToken cancellationToken) + => await handler.ExecuteAsync(parameters, cancellationToken); + + /// + /// Description: Updates an item. + /// Operation: UpdateItem. + /// + [HttpPut("{id}")] + [ProducesResponseType(typeof(Guid), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] + public async Task UpdateItem( + UpdateItemParameters parameters, + [FromServices] IUpdateItemHandler handler, + CancellationToken cancellationToken) + => await handler.ExecuteAsync(parameters, cancellationToken); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/MyEndpoints/OrdersController.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/MyEndpoints/OrdersController.verified.cs new file mode 100644 index 000000000..45fd076b2 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/MyEndpoints/OrdersController.verified.cs @@ -0,0 +1,66 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.MyEndpoints; + +/// +/// Endpoint definitions. +/// +[Authorize] +[ApiController] +[Route("/api/v1/orders")] +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public sealed class OrdersController : ControllerBase +{ + /// + /// Description: Get orders. + /// Operation: GetOrders. + /// + [HttpGet] + [ProducesResponseType(typeof(Pagination), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] + [ProducesResponseType(StatusCodes.Status401Unauthorized)] + [ProducesResponseType(typeof(string), StatusCodes.Status404NotFound)] + public async Task GetOrders( + GetOrdersParameters parameters, + [FromServices] IGetOrdersHandler handler, + CancellationToken cancellationToken) + => await handler.ExecuteAsync(parameters, cancellationToken); + + /// + /// Description: Get order by id. + /// Operation: GetOrderById. + /// + [AllowAnonymous] + [HttpGet("{id}")] + [ProducesResponseType(typeof(Order), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] + [ProducesResponseType(typeof(string), StatusCodes.Status404NotFound)] + public async Task GetOrderById( + GetOrderByIdParameters parameters, + [FromServices] IGetOrderByIdHandler handler, + CancellationToken cancellationToken) + => await handler.ExecuteAsync(parameters, cancellationToken); + + /// + /// Description: Update part of order by id. + /// Operation: PatchOrdersId. + /// + [Authorize(Roles = "admin,operator")] + [HttpPatch("{id}")] + [ProducesResponseType(typeof(string), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] + [ProducesResponseType(StatusCodes.Status401Unauthorized)] + [ProducesResponseType(StatusCodes.Status403Forbidden)] + [ProducesResponseType(typeof(string), StatusCodes.Status404NotFound)] + [ProducesResponseType(typeof(string), StatusCodes.Status409Conflict)] + [ProducesResponseType(StatusCodes.Status502BadGateway)] + public async Task PatchOrdersId( + PatchOrdersIdParameters parameters, + [FromServices] IPatchOrdersIdHandler handler, + CancellationToken cancellationToken) + => await handler.ExecuteAsync(parameters, cancellationToken); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/MyEndpoints/RouteWithDashController.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/MyEndpoints/RouteWithDashController.verified.cs new file mode 100644 index 000000000..e654e78c6 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/MyEndpoints/RouteWithDashController.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.MyEndpoints; + +/// +/// Endpoint definitions. +/// +[ApiController] +[Route("/api/v1/route-with-dash")] +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public sealed class RouteWithDashController : ControllerBase +{ + /// + /// Description: Your GET endpoint. + /// Operation: GetRouteWithDash. + /// + [HttpGet] + [ProducesResponseType(typeof(string), StatusCodes.Status200OK)] + public async Task GetRouteWithDash( + [FromServices] IGetRouteWithDashHandler handler, + CancellationToken cancellationToken) + => await handler.ExecuteAsync(cancellationToken); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/MyEndpoints/TasksController.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/MyEndpoints/TasksController.verified.cs new file mode 100644 index 000000000..0c6b92783 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/MyEndpoints/TasksController.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.MyEndpoints; + +/// +/// Endpoint definitions. +/// +[ApiController] +[Route("/api/v1/tasks")] +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public sealed class TasksController : ControllerBase +{ + /// + /// Description: Returns tasks. + /// Operation: GetTasks. + /// + [HttpGet] + [ProducesResponseType(typeof(IEnumerable), StatusCodes.Status200OK)] + public async Task GetTasks( + [FromServices] IGetTasksHandler handler, + CancellationToken cancellationToken) + => await handler.ExecuteAsync(cancellationToken); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/MyEndpoints/UsersController.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/MyEndpoints/UsersController.verified.cs new file mode 100644 index 000000000..82f67a610 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/MyEndpoints/UsersController.verified.cs @@ -0,0 +1,117 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.MyEndpoints; + +/// +/// Endpoint definitions. +/// +[ApiController] +[Route("/api/v1/users")] +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public sealed class UsersController : ControllerBase +{ + /// + /// Description: Get all users. + /// Operation: GetUsers. + /// + [HttpGet] + [ProducesResponseType(typeof(IEnumerable), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(string), StatusCodes.Status409Conflict)] + public async Task GetUsers( + [FromServices] IGetUsersHandler handler, + CancellationToken cancellationToken) + => await handler.ExecuteAsync(cancellationToken); + + /// + /// Description: Create a new user. + /// Operation: PostUser. + /// + [HttpPost] + [ProducesResponseType(typeof(string), StatusCodes.Status201Created)] + [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] + [ProducesResponseType(typeof(string), StatusCodes.Status409Conflict)] + public async Task PostUser( + PostUserParameters parameters, + [FromServices] IPostUserHandler handler, + CancellationToken cancellationToken) + => await handler.ExecuteAsync(parameters, cancellationToken); + + /// + /// Description: Get user by email. + /// Operation: GetUserByEmail. + /// + [HttpGet("email")] + [ProducesResponseType(typeof(User), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] + [ProducesResponseType(typeof(string), StatusCodes.Status404NotFound)] + [ProducesResponseType(typeof(string), StatusCodes.Status409Conflict)] + public async Task GetUserByEmail( + GetUserByEmailParameters parameters, + [FromServices] IGetUserByEmailHandler handler, + CancellationToken cancellationToken) + => await handler.ExecuteAsync(parameters, cancellationToken); + + /// + /// Description: Get user by id. + /// Operation: GetUserById. + /// + [HttpGet("{id}")] + [ProducesResponseType(typeof(User), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] + [ProducesResponseType(typeof(string), StatusCodes.Status404NotFound)] + [ProducesResponseType(typeof(string), StatusCodes.Status409Conflict)] + public async Task GetUserById( + GetUserByIdParameters parameters, + [FromServices] IGetUserByIdHandler handler, + CancellationToken cancellationToken) + => await handler.ExecuteAsync(parameters, cancellationToken); + + /// + /// Description: Update user by id. + /// Operation: UpdateUserById. + /// + [HttpPut("{id}")] + [ProducesResponseType(typeof(string), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] + [ProducesResponseType(typeof(string), StatusCodes.Status404NotFound)] + [ProducesResponseType(typeof(string), StatusCodes.Status409Conflict)] + public async Task UpdateUserById( + UpdateUserByIdParameters parameters, + [FromServices] IUpdateUserByIdHandler handler, + CancellationToken cancellationToken) + => await handler.ExecuteAsync(parameters, cancellationToken); + + /// + /// Description: Delete user by id. + /// Operation: DeleteUserById. + /// + [HttpDelete("{id}")] + [ProducesResponseType(typeof(string), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] + [ProducesResponseType(typeof(string), StatusCodes.Status404NotFound)] + [ProducesResponseType(typeof(string), StatusCodes.Status409Conflict)] + public async Task DeleteUserById( + DeleteUserByIdParameters parameters, + [FromServices] IDeleteUserByIdHandler handler, + CancellationToken cancellationToken) + => await handler.ExecuteAsync(parameters, cancellationToken); + + /// + /// Description: Update gender on a user. + /// Operation: UpdateMyTestGender. + /// + [HttpPut("{id}/gender")] + [ProducesResponseType(typeof(string), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] + [ProducesResponseType(typeof(string), StatusCodes.Status404NotFound)] + [ProducesResponseType(typeof(string), StatusCodes.Status409Conflict)] + public async Task UpdateMyTestGender( + UpdateMyTestGenderParameters parameters, + [FromServices] IUpdateMyTestGenderHandler handler, + CancellationToken cancellationToken) + => await handler.ExecuteAsync(parameters, cancellationToken); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Orders/MyContracts/Interfaces/IGetOrderByIdHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Orders/MyContracts/Interfaces/IGetOrderByIdHandler.verified.cs new file mode 100644 index 000000000..3757a6f71 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Orders/MyContracts/Interfaces/IGetOrderByIdHandler.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Orders.MyContracts; + +/// +/// Domain Interface for RequestHandler. +/// Description: Get order by id. +/// Operation: GetOrderById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetOrderByIdHandler +{ + /// + /// Execute method. + /// + /// The parameters. + /// The cancellation token. + Task ExecuteAsync( + GetOrderByIdParameters parameters, + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Orders/MyContracts/Interfaces/IGetOrdersHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Orders/MyContracts/Interfaces/IGetOrdersHandler.verified.cs new file mode 100644 index 000000000..2c1d391d2 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Orders/MyContracts/Interfaces/IGetOrdersHandler.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Orders.MyContracts; + +/// +/// Domain Interface for RequestHandler. +/// Description: Get orders. +/// Operation: GetOrders. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetOrdersHandler +{ + /// + /// Execute method. + /// + /// The parameters. + /// The cancellation token. + Task ExecuteAsync( + GetOrdersParameters parameters, + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Orders/MyContracts/Interfaces/IPatchOrdersIdHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Orders/MyContracts/Interfaces/IPatchOrdersIdHandler.verified.cs new file mode 100644 index 000000000..4e2849e04 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Orders/MyContracts/Interfaces/IPatchOrdersIdHandler.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Orders.MyContracts; + +/// +/// Domain Interface for RequestHandler. +/// Description: Update part of order by id. +/// Operation: PatchOrdersId. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IPatchOrdersIdHandler +{ + /// + /// Execute method. + /// + /// The parameters. + /// The cancellation token. + Task ExecuteAsync( + PatchOrdersIdParameters parameters, + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Orders/MyContracts/Models/Order.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Orders/MyContracts/Models/Order.verified.cs new file mode 100644 index 000000000..c744d852d --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Orders/MyContracts/Models/Order.verified.cs @@ -0,0 +1,79 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Orders.MyContracts; + +/// +/// A single order. +/// Hallo description with multiline and no ending dot. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class Order +{ + public Guid Id { get; set; } + + public string Description { get; set; } + + public DateTimeOffset MyTime { get; set; } + + /// + /// Undefined description. + /// + /// + /// Email validation being enforced. + /// + [EmailAddress] + public string MyEmail { get; set; } = "a@a.com"; + + public DateTimeOffset? MyNullableDateTime { get; set; } + + public DateTimeOffset MyDateTime { get; set; } + + [Range(1.1, 20.2)] + public double MyNumber { get; set; } + + [Range(int.MinValue, 50)] + public int MyInteger { get; set; } = 15; + + /// + /// MyBool is great. + /// + public bool MyBool { get; set; } + + /// + /// This is the good uri :-). + /// + /// + /// Url validation being enforced. + /// + [Uri] + public Uri MyUri { get; set; } + + /// + /// Undefined description. + /// + /// + /// This string should be base64-encoded. + /// + public string MyByte { get; set; } + + /// + /// Hallo myStringList desc :-). + /// + public List MyStringList { get; set; } = new List(); + + [Range(10, int.MaxValue)] + public long MyLong { get; set; } + + /// + /// Address. + /// + public Address DeliveryAddress { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}, {nameof(Description)}: {Description}, {nameof(MyTime)}: ({MyTime}), {nameof(MyEmail)}: {MyEmail}, {nameof(MyNullableDateTime)}: ({MyNullableDateTime}), {nameof(MyDateTime)}: ({MyDateTime}), {nameof(MyNumber)}: {MyNumber}, {nameof(MyInteger)}: {MyInteger}, {nameof(MyBool)}: {MyBool}, {nameof(MyUri)}: ({MyUri}), {nameof(MyByte)}: {MyByte}, {nameof(MyStringList)}.Count: {MyStringList?.Count ?? 0}, {nameof(MyLong)}: {MyLong}, {nameof(DeliveryAddress)}: ({DeliveryAddress})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Orders/MyContracts/Models/UpdateOrderRequest.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Orders/MyContracts/Models/UpdateOrderRequest.verified.cs new file mode 100644 index 000000000..c94553357 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Orders/MyContracts/Models/UpdateOrderRequest.verified.cs @@ -0,0 +1,28 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Orders.MyContracts; + +/// +/// Request to update an order. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateOrderRequest +{ + /// + /// Undefined description. + /// + /// + /// Email validation being enforced. + /// + [Required] + [EmailAddress] + public string MyEmail { get; set; } + + /// + public override string ToString() + => $"{nameof(MyEmail)}: {MyEmail}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Orders/MyContracts/Parameters/GetOrderByIdParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Orders/MyContracts/Parameters/GetOrderByIdParameters.verified.cs new file mode 100644 index 000000000..e195efbd7 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Orders/MyContracts/Parameters/GetOrderByIdParameters.verified.cs @@ -0,0 +1,37 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Orders.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Get order by id. +/// Operation: GetOrderById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetOrderByIdParameters +{ + /// + /// The id of the order. + /// + [FromRoute(Name = "id")] + [Required] + public Guid Id { get; set; } + + /// + /// The email for filter orders to retrieve. + /// + /// + /// Email validation being enforced. + /// + [FromQuery] + [EmailAddress] + public string? MyEmail { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}, {nameof(MyEmail)}: {MyEmail}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Orders/MyContracts/Parameters/GetOrdersParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Orders/MyContracts/Parameters/GetOrdersParameters.verified.cs new file mode 100644 index 000000000..9b0631300 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Orders/MyContracts/Parameters/GetOrdersParameters.verified.cs @@ -0,0 +1,53 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Orders.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Get orders. +/// Operation: GetOrders. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetOrdersParameters +{ + /// + /// The numbers of items to return. + /// + [FromQuery] + [Required] + [Range(1, 100)] + public int PageSize { get; set; } = 10; + + /// + /// The number of items to skip before starting to collect the result set. + /// + [FromQuery] + [Range(0, 2147483647)] + public int PageIndex { get; set; } = 0; + + /// + /// The query string. + /// + [FromQuery] + public string? QueryString { get; set; } + + /// + /// The query array of string. + /// + [FromQuery] + public List QueryStringArray { get; set; } = new List(); + + /// + /// The continuation token. + /// + [FromQuery] + public string? ContinuationToken { get; set; } + + /// + public override string ToString() + => $"{nameof(PageSize)}: {PageSize}, {nameof(PageIndex)}: {PageIndex}, {nameof(QueryString)}: {QueryString}, {nameof(QueryStringArray)}.Count: {QueryStringArray?.Count ?? 0}, {nameof(ContinuationToken)}: {ContinuationToken}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Orders/MyContracts/Parameters/PatchOrdersIdParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Orders/MyContracts/Parameters/PatchOrdersIdParameters.verified.cs new file mode 100644 index 000000000..c3edea113 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Orders/MyContracts/Parameters/PatchOrdersIdParameters.verified.cs @@ -0,0 +1,62 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Orders.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Update part of order by id. +/// Operation: PatchOrdersId. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class PatchOrdersIdParameters +{ + /// + /// The id of the order. + /// + [FromRoute(Name = "id")] + [Required] + public Guid Id { get; set; } + + /// + /// The myTestHeader special key. + /// + [FromHeader(Name = "myTestHeader")] + [Required] + public string MyTestHeader { get; set; } + + /// + /// The myTestHeaderBool special key. + /// + [FromHeader(Name = "myTestHeaderBool")] + [Required] + public bool MyTestHeaderBool { get; set; } + + /// + /// The myTestHeaderInt special key. + /// + [FromHeader(Name = "myTestHeaderInt")] + [Required] + public int MyTestHeaderInt { get; set; } + + /// + /// The correlationId. + /// + [FromHeader(Name = "x-correlation-id")] + [Required] + public string CorrelationId { get; set; } + + /// + /// Request to update an order. + /// + [FromBody] + [Required] + public UpdateOrderRequest Request { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}, {nameof(MyTestHeader)}: {MyTestHeader}, {nameof(MyTestHeaderBool)}: {MyTestHeaderBool}, {nameof(MyTestHeaderInt)}: {MyTestHeaderInt}, {nameof(CorrelationId)}: {CorrelationId}, {nameof(Request)}: ({Request})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Orders/MyContracts/Results/GetOrderByIdResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Orders/MyContracts/Results/GetOrderByIdResult.verified.cs new file mode 100644 index 000000000..290184c7a --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Orders/MyContracts/Results/GetOrderByIdResult.verified.cs @@ -0,0 +1,36 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Orders.MyContracts; + +/// +/// Results for operation request. +/// Description: Get order by id. +/// Operation: GetOrderById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetOrderByIdResult : ResultBase +{ + private GetOrderByIdResult(ActionResult result) : base(result) { } + + /// + /// 200 - Ok response. + /// + public static GetOrderByIdResult Ok(Order response) + => new GetOrderByIdResult(new OkObjectResult(response)); + + /// + /// 404 - NotFound response. + /// + public static GetOrderByIdResult NotFound(string? message = null) + => new GetOrderByIdResult(new NotFoundObjectResult(message)); + + /// + /// Performs an implicit conversion from GetOrderByIdResult to ActionResult. + /// + public static implicit operator GetOrderByIdResult(Order response) + => Ok(response); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Orders/MyContracts/Results/GetOrdersResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Orders/MyContracts/Results/GetOrdersResult.verified.cs new file mode 100644 index 000000000..711fbb473 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Orders/MyContracts/Results/GetOrdersResult.verified.cs @@ -0,0 +1,36 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Orders.MyContracts; + +/// +/// Results for operation request. +/// Description: Get orders. +/// Operation: GetOrders. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetOrdersResult : ResultBase +{ + private GetOrdersResult(ActionResult result) : base(result) { } + + /// + /// 200 - Ok response. + /// + public static GetOrdersResult Ok(Pagination response) + => new GetOrdersResult(new OkObjectResult(response)); + + /// + /// 404 - NotFound response. + /// + public static GetOrdersResult NotFound(string? message = null) + => new GetOrdersResult(new NotFoundObjectResult(message)); + + /// + /// Performs an implicit conversion from GetOrdersResult to ActionResult. + /// + public static implicit operator GetOrdersResult(Pagination response) + => Ok(response); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Orders/MyContracts/Results/PatchOrdersIdResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Orders/MyContracts/Results/PatchOrdersIdResult.verified.cs new file mode 100644 index 000000000..d57176004 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Orders/MyContracts/Results/PatchOrdersIdResult.verified.cs @@ -0,0 +1,48 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Orders.MyContracts; + +/// +/// Results for operation request. +/// Description: Update part of order by id. +/// Operation: PatchOrdersId. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class PatchOrdersIdResult : ResultBase +{ + private PatchOrdersIdResult(ActionResult result) : base(result) { } + + /// + /// 200 - Ok response. + /// + public static PatchOrdersIdResult Ok(string? message = null) + => new PatchOrdersIdResult(new OkObjectResult(message)); + + /// + /// 404 - NotFound response. + /// + public static PatchOrdersIdResult NotFound(string? message = null) + => new PatchOrdersIdResult(new NotFoundObjectResult(message)); + + /// + /// 409 - Conflict response. + /// + public static PatchOrdersIdResult Conflict(string? message = null) + => new PatchOrdersIdResult(new ConflictObjectResult(message)); + + /// + /// 502 - BadGateway response. + /// + public static PatchOrdersIdResult BadGateway(string? message = null) + => new PatchOrdersIdResult(ResultFactory.CreateContentResult(HttpStatusCode.BadGateway, message)); + + /// + /// Performs an implicit conversion from PatchOrdersIdResult to ActionResult. + /// + public static implicit operator PatchOrdersIdResult(string response) + => Ok(response); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Resources/ApiSpecification.yaml b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Resources/ApiSpecification.yaml new file mode 100644 index 000000000..cf543aff2 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Resources/ApiSpecification.yaml @@ -0,0 +1,969 @@ +openapi: 3.0.1 +info: + title: Demo Sample Api + description: Demo Sample Api - SingleFileVersion + version: '1.0' + contact: + name: atc-net A/S +servers: + - url: /api/v1 + description: Api version 1.0 +x-authorize-roles: + - admin + - operator +paths: + /orders: + x-authentication-required: true + get: + tags: + - Orders + summary: Get orders + description: Get orders + operationId: getOrders + parameters: + - $ref: '#/components/parameters/pagingPageSize' + - $ref: '#/components/parameters/pagingPageIndex' + - $ref: '#/components/parameters/queryString' + - $ref: '#/components/parameters/queryStringArray' + - $ref: '#/components/parameters/continuationToken' + responses: + '200': + description: Expected response to a valid request + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Pagination' + - $ref: '#/components/schemas/Orders' + '404': + description: Not Found + '/orders/{id}': + x-authentication-required: true + x-authorize-roles: + - operator + get: + tags: + - Orders + summary: Get order by id + description: Get order by id + operationId: getOrderById + x-authentication-required: false + parameters: + - name: myEmail + in: query + description: The email for filter orders to retrieve + schema: + type: string + format: email + nullable: true + responses: + '200': + description: Expected response to a valid request + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + '404': + description: Not Found + patch: + summary: Update part of order by id + description: Update part of order by id + operationId: patchOrdersId + x-authorize-roles: + - admin + - operator + parameters: + - name: myTestHeader + in: header + required: true + description: The myTestHeader special key + schema: + type: string + - name: myTestHeaderBool + in: header + required: true + description: The myTestHeaderBool special key + schema: + type: boolean + - name: myTestHeaderInt + in: header + required: true + description: The myTestHeaderInt special key + schema: + type: integer + - name: x-correlation-id + in: header + required: true + description: The correlationId + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateOrderRequest' + responses: + '200': + description: OK + '404': + description: Not Found + '409': + description: Conflict + '502': + description: Bad Gateway + content: + application/json: + schema: + $ref: '#/components/schemas/ProblemDetails' + parameters: + - name: id + in: path + description: The id of the order + required: true + schema: + type: string + format: uuid + /users/email: + get: + tags: + - Users + summary: Get user by email + description: Get user by email + operationId: getUserByEmail + parameters: + - name: email + in: query + description: The email of the user to retrieve + required: true + schema: + type: string + format: email + responses: + '200': + description: Expected response to a valid request + content: + application/json: + schema: + $ref: '#/components/schemas/User' + '400': + description: Bad Request + '404': + description: Not Found + '409': + description: Conflict + '/users/{id}': + get: + summary: Get user by id + description: Get user by id + operationId: getUserById + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/User' + '404': + description: Not Found + '409': + description: Conflict + put: + summary: Update user by id + description: Update user by id + operationId: updateUserById + responses: + '200': + description: OK + '400': + description: Bad Request + '404': + description: Not Found + '409': + description: Conflict + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateUserRequest' + delete: + summary: Delete user by id + description: Delete user by id + operationId: deleteUserById + responses: + '200': + description: OK + '404': + description: Not Found + '409': + description: Conflict + parameters: + - name: id + in: path + description: Id of the user + required: true + schema: + type: string + format: uuid + /users: + get: + summary: Get all users + description: Get all users + operationId: getUsers + tags: [] + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Users' + '409': + description: Conflict + post: + summary: Create a new user + description: Create a new user + operationId: postUser + responses: + '201': + description: Created + '400': + description: Bad Request + '409': + description: Conflict + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateUserRequest' + '/users/{id}/gender': + put: + summary: Update gender on a user + description: Update gender on a user + operationId: updateMyTestGender + parameters: + - name: genderParam + in: query + description: The gender to set on the user + schema: + $ref: '#/components/schemas/GenderType' + responses: + '200': + description: OK + '400': + description: Bad Request + '404': + description: Not Found + '409': + description: Conflict + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateTestGenderRequest' + parameters: + - name: id + description: Id of the user + in: path + required: true + schema: + type: string + format: uuid + '/accounts/{accountId}/name': + put: + summary: Update name of account + description: Update name of account + operationId: updateAccountName + responses: + '200': + description: OK + parameters: + - name: name + in: header + description: The account name + schema: + type: string + post: + summary: Set name of account + description: Set name of account + operationId: setAccountName + responses: + '200': + description: OK + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateAccountRequest' + parameters: + - name: accountId + in: path + required: true + description: The accountId + schema: + type: string + format: uuid + '/addresses/{postalCode}': + get: + summary: Get addresses by postal code + description: Get addresses by postal code + operationId: getAddressesByPostalCodes + tags: [] + responses: + '200': + description: OK + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Address' + '404': + description: Not Found + parameters: + - name: postalCode + in: path + required: true + description: The postalCode to limit addresses on + schema: + type: string + /route-with-dash: + get: + summary: Your GET endpoint + description: Your GET endpoint + tags: [] + responses: + '200': + description: OK + operationId: getRouteWithDash + /items: + post: + summary: Create a new item + description: Create a new item + operationId: createItem + responses: + '200': + description: OK + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateItemRequest' + '/items/{id}': + put: + summary: Updates an item + description: Updates an item + operationId: updateItem + responses: + '200': + description: OK + content: + application/json: + schema: + type: string + format: uuid + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateItemRequest' + parameters: + - name: id + in: path + description: The id of the order + required: true + schema: + type: string + format: uuid + /tasks: + get: + operationId: getTasks + summary: Returns tasks + description: Returns tasks + tags: [] + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Tasks' + '/eventArgs/{id}': + parameters: + - name: id + in: path + description: The id of the eventArgs + required: true + schema: + type: string + get: + summary: Get EventArgs By Id + description: Get EventArgs By Id + tags: [] + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/EventArgs' + '404': + description: Not Found + operationId: getEventArgById + /eventArgs: + get: + operationId: getEventArgs + summary: Get EventArgs List + description: Get EventArgs List + tags: [] + responses: + '200': + description: OK + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/EventArgs' + '/files/{id}': + parameters: + - name: id + in: path + description: The file id + required: true + schema: + type: string + get: + operationId: getFileById + summary: Get File By Id + description: Get File By Id + tags: [] + responses: + '200': + description: OK + content: + application/octet-stream: + schema: + type: string + format: binary + headers: {} + '404': + description: Not Found + /files/form-data/singleObject: + post: + operationId: uploadSingleObjectWithFileAsFormData + summary: Upload a file as FormData + description: Upload a file as FormData + responses: + '200': + description: OK + '400': + description: Bad Request + requestBody: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/FileAsFormDataRequest' + parameters: [] + /files/form-data/singleObjectMultiFile: + post: + operationId: uploadSingleObjectWithFilesAsFormData + summary: Upload files as FormData + description: Upload files as FormData + responses: + '200': + description: OK + '400': + description: Bad Request + requestBody: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/FilesAsFormDataRequest' + parameters: [] + /files/form-data/singleFile: + post: + operationId: uploadSingleFileAsFormData + summary: Upload a file as OctetStream + description: Upload a file as OctetStream + responses: + '200': + description: OK + requestBody: + content: + application/octet-stream: + schema: + type: string + format: binary + parameters: [] + /files/form-data/multiFile: + post: + summary: Upload multi files as form data + description: Upload multi files as form data + operationId: uploadMultiFilesAsFormData + responses: + '200': + description: OK + requestBody: + content: + multipart/form-data: + schema: + type: array + items: + type: string + format: binary +components: + parameters: + pagingPageSize: + name: pageSize + in: query + required: true + schema: + type: integer + minimum: 1 + maximum: 100 + default: 10 + description: The numbers of items to return. + pagingPageIndex: + name: pageIndex + in: query + required: false + schema: + type: integer + minimum: 0 + default: 0 + description: The number of items to skip before starting to collect the result set. + queryString: + name: queryString + in: query + required: false + schema: + type: string + nullable: true + description: The query string. + queryStringArray: + name: queryStringArray + in: query + required: false + schema: + type: array + items: + type: string + nullable: true + description: The query array of string. + continuationToken: + name: continuationToken + in: query + required: false + schema: + type: string + nullable: true + description: The continuation token. + schemas: + Pagination: + type: object + title: Pagination + description: A item result subset of a data query. + properties: + pageSize: + type: number + description: The number of items to request. + pageIndex: + type: number + nullable: true + description: The given page index starting with 0. + queryString: + type: string + nullable: true + description: The query to filter items by. + continuationToken: + type: string + nullable: true + description: Token to indicate next result set. + count: + type: number + description: Items count in result set. + totalCount: + type: number + nullable: true + description: Total items count. + totalPages: + type: number + nullable: true + description: Total pages. + required: + - pageSize + - count + ProblemDetails: + type: object + title: ProblemDetails + description: 'A machine-readable format for specifying errors in HTTP API responses based on https://tools.ietf.org/html/rfc7807.' + properties: + type: + type: string + description: 'A URI reference [RFC3986] that identifies the problem type. This specification encourages that, when dereferenced, it provide human-readable documentation for the problem type (e.g., using HTML [W3C.REC-html5-20141028]).' + title: + type: string + description: 'A short, human-readable summary of the problem type.It SHOULD NOT change from occurrence to occurrence of the problem, except for purposes of localization(e.g., using proactive content negotiation; see[RFC7231], Section 3.4).' + status: + type: integer + format: int32 + description: 'The HTTP status code([RFC7231], Section 6) generated by the origin server for this occurrence of the problem.' + detail: + type: string + description: A human-readable explanation specific to this occurrence of the problem. + instance: + type: string + description: A URI reference that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced. + Order: + title: Order + description: |- + A single order. + Hallo description with multiline and no ending dot + type: object + x-examples: + MyExample: + id: 123 + name: Hallo world + MyExample2: {} + properties: + id: + type: string + format: uuid + description: + type: string + myTime: + type: string + format: time + myEmail: + type: string + format: email + default: a@a.com + myNullableDateTime: + type: string + format: date-time + nullable: true + myDateTime: + type: string + format: date-time + myNumber: + type: number + minimum: 1.1 + maximum: 20.2 + myInteger: + type: integer + maximum: 50 + default: 15 + myBool: + type: boolean + description: MyBool is great + myUri: + type: string + format: uri + description: 'This is the good uri :-)' + myByte: + type: string + format: byte + myStringList: + type: array + description: 'Hallo myStringList desc :-)' + items: + type: string + myLong: + type: integer + format: int64 + minimum: 10 + exclusiveMinimum: false + deliveryAddress: + $ref: '#/components/schemas/Address' + Orders: + description: A list of orders. + type: array + x-tags: + - Orders + title: Orders + items: + $ref: '#/components/schemas/Order' + GenderType: + title: GenderType + description: '' + type: object + properties: + gender: + type: string + description: The users gender type + enum: + - None + - NonBinary + - Male + - Female + required: + - gender + ColorType: + title: ColorType + description: '' + type: object + properties: + color: + type: string + description: The users color type + enum: + - None = 0 + - Black = 1 + - White = 2 + - Yellow = 4 + - Red = 8 + required: + - color + User: + title: User + description: A single user. + type: object + properties: + id: + type: string + format: uuid + example: 00000000-0000-0000-0000-000000000000 + gender: + $ref: '#/components/schemas/GenderType' + firstName: + type: string + lastName: + type: string + email: + type: string + format: email + example: email@email.dk + homepage: + type: string + format: uri + color: + $ref: '#/components/schemas/ColorType' + homeAddress: + $ref: '#/components/schemas/Address' + companyAddress: + $ref: '#/components/schemas/Address' + Users: + description: A list of users. + type: array + items: + $ref: '#/components/schemas/User' + x-tags: + - Users + title: Users + CreateUserRequest: + title: CreateUserRequest + description: Request to create a user + type: object + properties: + firstName: + type: string + lastName: + type: string + myNullableDateTime: + type: string + format: date-time + nullable: true + myDateTime: + type: string + format: date-time + email: + type: string + format: email + example: email@email.dk + homepage: + type: string + format: uri + gender: + $ref: '#/components/schemas/GenderType' + myNullableAddress: + nullable: true + oneOf: + - $ref: '#/components/schemas/Address' + tags: + type: object + additionalProperties: + type: string + desiredProperties1: + type: object + additionalProperties: + type: string + desiredProperties2: + type: object + nullable: true + additionalProperties: + type: string + desiredProperties3: + type: object + nullable: true + additionalProperties: + type: integer + required: + - firstName + - lastName + - myDateTime + - email + - gender + - tags + CreateUsersRequest: + description: A list of users. + type: array + x-tags: + - CreateUsersRequest + title: CreateUsersRequest + items: + $ref: '#/components/schemas/CreateUserRequest' + UpdateUserRequest: + title: UpdateUserRequest + description: Request to update a user + type: object + properties: + firstName: + type: string + lastName: + type: string + email: + type: string + format: email + example: email@email.dk + gender: + $ref: '#/components/schemas/GenderType' + UpdateTestGenderRequest: + title: Update test-gender Request + description: '' + type: object + properties: + gender: + $ref: '#/components/schemas/GenderType' + Address: + title: Address + type: object + properties: + streetName: + type: string + maxLength: 255 + streetNumber: + type: string + postalCode: + type: string + cityName: + type: string + myCountry: + $ref: '#/components/schemas/Country' + Country: + title: Country + type: object + properties: + name: + type: string + alpha2Code: + type: string + minLength: 2 + maxLength: 2 + pattern: '^[A-Za-z]{2}$' + alpha3Code: + type: string + minLength: 3 + maxLength: 3 + pattern: '^[A-Za-z]{3}$' + required: + - name + - alpha2Code + - alpha3Code + UpdateOrderRequest: + title: UpdateOrderRequest + description: Request to update an order + type: object + properties: + myEmail: + type: string + format: email + required: + - myEmail + Item: + title: Item + type: object + properties: + name: + type: string + required: + - name + CreateItemRequest: + title: CreateItemRequest + type: object + properties: + item: + $ref: '#/components/schemas/Item' + myItems: + type: array + items: + $ref: '#/components/schemas/Item' + required: + - item + - myItems + UpdateItemRequest: + title: UpdateItemRequest + type: object + properties: + item: + $ref: '#/components/schemas/Item' + required: + - item + Task: + title: Task + type: object + properties: + id: + type: string + format: uuid + name: + type: string + description: Describes a single task. + Tasks: + title: Tasks + type: array + items: + $ref: '#/components/schemas/Task' + description: Contains a list of Tasks + EventArgs: + title: EventArgs + type: object + properties: + id: + type: string + format: uuid + eventName: + type: string + FileAsFormDataRequest: + title: FileAsFormDataRequest + type: object + properties: + itemName: + type: string + file: + type: string + format: binary + nullable: true + items: + type: array + items: + type: string + required: + - itemName + - items + FilesAsFormDataRequest: + title: FilesAsFormDataRequest + type: object + properties: + files: + type: array + items: + type: string + format: binary + required: + - files + UpdateAccountRequest: + title: UpdateAccountRequest + type: object + properties: + name: + type: string \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/RouteWithDash/MyContracts/Interfaces/IGetRouteWithDashHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/RouteWithDash/MyContracts/Interfaces/IGetRouteWithDashHandler.verified.cs new file mode 100644 index 000000000..eabe2ac64 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/RouteWithDash/MyContracts/Interfaces/IGetRouteWithDashHandler.verified.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.RouteWithDash.MyContracts; + +/// +/// Domain Interface for RequestHandler. +/// Description: Your GET endpoint. +/// Operation: GetRouteWithDash. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetRouteWithDashHandler +{ + /// + /// Execute method. + /// + /// The cancellation token. + Task ExecuteAsync( + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/RouteWithDash/MyContracts/Results/GetRouteWithDashResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/RouteWithDash/MyContracts/Results/GetRouteWithDashResult.verified.cs new file mode 100644 index 000000000..21e6f5355 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/RouteWithDash/MyContracts/Results/GetRouteWithDashResult.verified.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.RouteWithDash.MyContracts; + +/// +/// Results for operation request. +/// Description: Your GET endpoint. +/// Operation: GetRouteWithDash. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetRouteWithDashResult : ResultBase +{ + private GetRouteWithDashResult(ActionResult result) : base(result) { } + + /// + /// 200 - Ok response. + /// + public static GetRouteWithDashResult Ok(string? message = null) + => new GetRouteWithDashResult(new OkObjectResult(message)); + + /// + /// Performs an implicit conversion from GetRouteWithDashResult to ActionResult. + /// + public static implicit operator GetRouteWithDashResult(string response) + => Ok(response); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Tasks/MyContracts/Interfaces/IGetTasksHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Tasks/MyContracts/Interfaces/IGetTasksHandler.verified.cs new file mode 100644 index 000000000..49a98e04e --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Tasks/MyContracts/Interfaces/IGetTasksHandler.verified.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Tasks.MyContracts; + +/// +/// Domain Interface for RequestHandler. +/// Description: Returns tasks. +/// Operation: GetTasks. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetTasksHandler +{ + /// + /// Execute method. + /// + /// The cancellation token. + Task ExecuteAsync( + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Tasks/MyContracts/Models/Task.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Tasks/MyContracts/Models/Task.verified.cs new file mode 100644 index 000000000..09523b1d4 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Tasks/MyContracts/Models/Task.verified.cs @@ -0,0 +1,22 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Tasks.MyContracts; + +/// +/// Describes a single task. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class Task +{ + public Guid Id { get; set; } + + public string Name { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}, {nameof(Name)}: {Name}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Tasks/MyContracts/Models/Tasks.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Tasks/MyContracts/Models/Tasks.verified.cs new file mode 100644 index 000000000..5aa2e0080 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Tasks/MyContracts/Models/Tasks.verified.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Tasks.MyContracts; + +/// +/// Contains a list of Tasks. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class Tasks +{ + /// + /// A list of Task. + /// + public List TaskList { get; set; } = new List(); + + /// + public override string ToString() + => $"{nameof(TaskList)}.Count: {TaskList?.Count ?? 0}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Tasks/MyContracts/Results/GetTasksResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Tasks/MyContracts/Results/GetTasksResult.verified.cs new file mode 100644 index 000000000..163cec60b --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Tasks/MyContracts/Results/GetTasksResult.verified.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Tasks.MyContracts; + +/// +/// Results for operation request. +/// Description: Returns tasks. +/// Operation: GetTasks. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetTasksResult : ResultBase +{ + private GetTasksResult(ActionResult result) : base(result) { } + + /// + /// 200 - Ok response. + /// + public static GetTasksResult Ok(IEnumerable response) + => new GetTasksResult(new OkObjectResult(response ?? Enumerable.Empty())); + + /// + /// Performs an implicit conversion from GetTasksResult to ActionResult. + /// + public static implicit operator GetTasksResult(List response) + => Ok(response); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Interfaces/IDeleteUserByIdHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Interfaces/IDeleteUserByIdHandler.verified.cs new file mode 100644 index 000000000..0e75b7d69 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Interfaces/IDeleteUserByIdHandler.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Users.MyContracts; + +/// +/// Domain Interface for RequestHandler. +/// Description: Delete user by id. +/// Operation: DeleteUserById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IDeleteUserByIdHandler +{ + /// + /// Execute method. + /// + /// The parameters. + /// The cancellation token. + Task ExecuteAsync( + DeleteUserByIdParameters parameters, + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Interfaces/IGetUserByEmailHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Interfaces/IGetUserByEmailHandler.verified.cs new file mode 100644 index 000000000..2f5d266b2 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Interfaces/IGetUserByEmailHandler.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Users.MyContracts; + +/// +/// Domain Interface for RequestHandler. +/// Description: Get user by email. +/// Operation: GetUserByEmail. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetUserByEmailHandler +{ + /// + /// Execute method. + /// + /// The parameters. + /// The cancellation token. + Task ExecuteAsync( + GetUserByEmailParameters parameters, + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Interfaces/IGetUserByIdHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Interfaces/IGetUserByIdHandler.verified.cs new file mode 100644 index 000000000..1aac66f25 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Interfaces/IGetUserByIdHandler.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Users.MyContracts; + +/// +/// Domain Interface for RequestHandler. +/// Description: Get user by id. +/// Operation: GetUserById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetUserByIdHandler +{ + /// + /// Execute method. + /// + /// The parameters. + /// The cancellation token. + Task ExecuteAsync( + GetUserByIdParameters parameters, + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Interfaces/IGetUsersHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Interfaces/IGetUsersHandler.verified.cs new file mode 100644 index 000000000..96d2abb0f --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Interfaces/IGetUsersHandler.verified.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Users.MyContracts; + +/// +/// Domain Interface for RequestHandler. +/// Description: Get all users. +/// Operation: GetUsers. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetUsersHandler +{ + /// + /// Execute method. + /// + /// The cancellation token. + Task ExecuteAsync( + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Interfaces/IPostUserHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Interfaces/IPostUserHandler.verified.cs new file mode 100644 index 000000000..8ca92cf7b --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Interfaces/IPostUserHandler.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Users.MyContracts; + +/// +/// Domain Interface for RequestHandler. +/// Description: Create a new user. +/// Operation: PostUser. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IPostUserHandler +{ + /// + /// Execute method. + /// + /// The parameters. + /// The cancellation token. + Task ExecuteAsync( + PostUserParameters parameters, + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Interfaces/IUpdateMyTestGenderHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Interfaces/IUpdateMyTestGenderHandler.verified.cs new file mode 100644 index 000000000..7753fbd54 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Interfaces/IUpdateMyTestGenderHandler.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Users.MyContracts; + +/// +/// Domain Interface for RequestHandler. +/// Description: Update gender on a user. +/// Operation: UpdateMyTestGender. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IUpdateMyTestGenderHandler +{ + /// + /// Execute method. + /// + /// The parameters. + /// The cancellation token. + Task ExecuteAsync( + UpdateMyTestGenderParameters parameters, + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Interfaces/IUpdateUserByIdHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Interfaces/IUpdateUserByIdHandler.verified.cs new file mode 100644 index 000000000..1e1980b23 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Interfaces/IUpdateUserByIdHandler.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Users.MyContracts; + +/// +/// Domain Interface for RequestHandler. +/// Description: Update user by id. +/// Operation: UpdateUserById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IUpdateUserByIdHandler +{ + /// + /// Execute method. + /// + /// The parameters. + /// The cancellation token. + Task ExecuteAsync( + UpdateUserByIdParameters parameters, + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Models/CreateUserRequest.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Models/CreateUserRequest.verified.cs new file mode 100644 index 000000000..0b8cba906 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Models/CreateUserRequest.verified.cs @@ -0,0 +1,65 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Users.MyContracts; + +/// +/// Request to create a user. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class CreateUserRequest +{ + [Required] + public string FirstName { get; set; } + + [Required] + public string LastName { get; set; } + + public DateTimeOffset? MyNullableDateTime { get; set; } + + [Required] + public DateTimeOffset MyDateTime { get; set; } + + /// + /// Undefined description. + /// + /// + /// Email validation being enforced. + /// + [Required] + [EmailAddress] + public string Email { get; set; } + + /// + /// Undefined description. + /// + /// + /// Url validation being enforced. + /// + [Uri] + public Uri Homepage { get; set; } + + /// + /// GenderType. + /// + [Required] + public GenderType Gender { get; set; } + + public Address? MyNullableAddress { get; set; } + + [Required] + public Dictionary Tags { get; set; } + + public Dictionary DesiredProperties1 { get; set; } + + public Dictionary? DesiredProperties2 { get; set; } + + public Dictionary? DesiredProperties3 { get; set; } + + /// + public override string ToString() + => $"{nameof(FirstName)}: {FirstName}, {nameof(LastName)}: {LastName}, {nameof(MyNullableDateTime)}: ({MyNullableDateTime}), {nameof(MyDateTime)}: ({MyDateTime}), {nameof(Email)}: {Email}, {nameof(Homepage)}: ({Homepage}), {nameof(Gender)}: {Gender}, {nameof(MyNullableAddress)}: ({MyNullableAddress}), {nameof(Tags)}: ({Tags}), {nameof(DesiredProperties1)}: ({DesiredProperties1}), {nameof(DesiredProperties2)}: ({DesiredProperties2}), {nameof(DesiredProperties3)}: ({DesiredProperties3})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Models/UpdateTestGenderRequest.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Models/UpdateTestGenderRequest.verified.cs new file mode 100644 index 000000000..c703c9152 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Models/UpdateTestGenderRequest.verified.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Users.MyContracts; + +/// +/// Update test-gender Request. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateTestGenderRequest +{ + /// + /// GenderType. + /// + public GenderType Gender { get; set; } + + /// + public override string ToString() + => $"{nameof(Gender)}: {Gender}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Models/UpdateUserRequest.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Models/UpdateUserRequest.verified.cs new file mode 100644 index 000000000..5d47fa337 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Models/UpdateUserRequest.verified.cs @@ -0,0 +1,36 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Users.MyContracts; + +/// +/// Request to update a user. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateUserRequest +{ + public string FirstName { get; set; } + + public string LastName { get; set; } + + /// + /// Undefined description. + /// + /// + /// Email validation being enforced. + /// + [EmailAddress] + public string Email { get; set; } + + /// + /// GenderType. + /// + public GenderType Gender { get; set; } + + /// + public override string ToString() + => $"{nameof(FirstName)}: {FirstName}, {nameof(LastName)}: {LastName}, {nameof(Email)}: {Email}, {nameof(Gender)}: {Gender}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Models/User.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Models/User.verified.cs new file mode 100644 index 000000000..edcdbd59b --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Models/User.verified.cs @@ -0,0 +1,62 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Users.MyContracts; + +/// +/// A single user. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class User +{ + public Guid Id { get; set; } + + /// + /// GenderType. + /// + public GenderType Gender { get; set; } + + public string FirstName { get; set; } + + public string LastName { get; set; } + + /// + /// Undefined description. + /// + /// + /// Email validation being enforced. + /// + [EmailAddress] + public string Email { get; set; } + + /// + /// Undefined description. + /// + /// + /// Url validation being enforced. + /// + [Uri] + public Uri Homepage { get; set; } + + /// + /// ColorType. + /// + public ColorType Color { get; set; } + + /// + /// Address. + /// + public Address HomeAddress { get; set; } + + /// + /// Address. + /// + public Address CompanyAddress { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}, {nameof(Gender)}: {Gender}, {nameof(FirstName)}: {FirstName}, {nameof(LastName)}: {LastName}, {nameof(Email)}: {Email}, {nameof(Homepage)}: ({Homepage}), {nameof(Color)}: {Color}, {nameof(HomeAddress)}: ({HomeAddress}), {nameof(CompanyAddress)}: ({CompanyAddress})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Models/Users.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Models/Users.verified.cs new file mode 100644 index 000000000..85cefc96b --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Models/Users.verified.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Users.MyContracts; + +/// +/// A list of users. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class Users +{ + /// + /// A list of User. + /// + public List UserList { get; set; } = new List(); + + /// + public override string ToString() + => $"{nameof(UserList)}.Count: {UserList?.Count ?? 0}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Parameters/DeleteUserByIdParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Parameters/DeleteUserByIdParameters.verified.cs new file mode 100644 index 000000000..ad9bef77d --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Parameters/DeleteUserByIdParameters.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Users.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Delete user by id. +/// Operation: DeleteUserById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class DeleteUserByIdParameters +{ + /// + /// Id of the user. + /// + [FromRoute(Name = "id")] + [Required] + public Guid Id { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Parameters/GetUserByEmailParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Parameters/GetUserByEmailParameters.verified.cs new file mode 100644 index 000000000..08f120981 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Parameters/GetUserByEmailParameters.verified.cs @@ -0,0 +1,31 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Users.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Get user by email. +/// Operation: GetUserByEmail. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetUserByEmailParameters +{ + /// + /// The email of the user to retrieve. + /// + /// + /// Email validation being enforced. + /// + [FromQuery] + [Required] + [EmailAddress] + public string Email { get; set; } + + /// + public override string ToString() + => $"{nameof(Email)}: {Email}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Parameters/GetUserByIdParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Parameters/GetUserByIdParameters.verified.cs new file mode 100644 index 000000000..64e1029f2 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Parameters/GetUserByIdParameters.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Users.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Get user by id. +/// Operation: GetUserById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetUserByIdParameters +{ + /// + /// Id of the user. + /// + [FromRoute(Name = "id")] + [Required] + public Guid Id { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Parameters/PostUserParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Parameters/PostUserParameters.verified.cs new file mode 100644 index 000000000..457eca163 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Parameters/PostUserParameters.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Users.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Create a new user. +/// Operation: PostUser. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class PostUserParameters +{ + /// + /// Request to create a user. + /// + [FromBody] + [Required] + public CreateUserRequest Request { get; set; } + + /// + public override string ToString() + => $"{nameof(Request)}: ({Request})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Parameters/UpdateMyTestGenderParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Parameters/UpdateMyTestGenderParameters.verified.cs new file mode 100644 index 000000000..6441eb709 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Parameters/UpdateMyTestGenderParameters.verified.cs @@ -0,0 +1,40 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Users.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Update gender on a user. +/// Operation: UpdateMyTestGender. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateMyTestGenderParameters +{ + /// + /// Id of the user. + /// + [FromRoute(Name = "id")] + [Required] + public Guid Id { get; set; } + + /// + /// The gender to set on the user. + /// + [FromQuery] + public GenderType? GenderParam { get; set; } + + /// + /// Update test-gender Request. + /// + [FromBody] + [Required] + public UpdateTestGenderRequest Request { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}, {nameof(GenderParam)}: {GenderParam}, {nameof(Request)}: ({Request})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Parameters/UpdateUserByIdParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Parameters/UpdateUserByIdParameters.verified.cs new file mode 100644 index 000000000..7f6be0b19 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Parameters/UpdateUserByIdParameters.verified.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Users.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Update user by id. +/// Operation: UpdateUserById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateUserByIdParameters +{ + /// + /// Id of the user. + /// + [FromRoute(Name = "id")] + [Required] + public Guid Id { get; set; } + + /// + /// Request to update a user. + /// + [FromBody] + [Required] + public UpdateUserRequest Request { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}, {nameof(Request)}: ({Request})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Results/DeleteUserByIdResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Results/DeleteUserByIdResult.verified.cs new file mode 100644 index 000000000..bde26e789 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Results/DeleteUserByIdResult.verified.cs @@ -0,0 +1,42 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Users.MyContracts; + +/// +/// Results for operation request. +/// Description: Delete user by id. +/// Operation: DeleteUserById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class DeleteUserByIdResult : ResultBase +{ + private DeleteUserByIdResult(ActionResult result) : base(result) { } + + /// + /// 200 - Ok response. + /// + public static DeleteUserByIdResult Ok(string? message = null) + => new DeleteUserByIdResult(new OkObjectResult(message)); + + /// + /// 404 - NotFound response. + /// + public static DeleteUserByIdResult NotFound(string? message = null) + => new DeleteUserByIdResult(new NotFoundObjectResult(message)); + + /// + /// 409 - Conflict response. + /// + public static DeleteUserByIdResult Conflict(string? message = null) + => new DeleteUserByIdResult(new ConflictObjectResult(message)); + + /// + /// Performs an implicit conversion from DeleteUserByIdResult to ActionResult. + /// + public static implicit operator DeleteUserByIdResult(string response) + => Ok(response); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Results/GetUserByEmailResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Results/GetUserByEmailResult.verified.cs new file mode 100644 index 000000000..1598a32d1 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Results/GetUserByEmailResult.verified.cs @@ -0,0 +1,48 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Users.MyContracts; + +/// +/// Results for operation request. +/// Description: Get user by email. +/// Operation: GetUserByEmail. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetUserByEmailResult : ResultBase +{ + private GetUserByEmailResult(ActionResult result) : base(result) { } + + /// + /// 200 - Ok response. + /// + public static GetUserByEmailResult Ok(User response) + => new GetUserByEmailResult(new OkObjectResult(response)); + + /// + /// 400 - BadRequest response. + /// + public static GetUserByEmailResult BadRequest(string? message = null) + => new GetUserByEmailResult(new BadRequestObjectResult(message)); + + /// + /// 404 - NotFound response. + /// + public static GetUserByEmailResult NotFound(string? message = null) + => new GetUserByEmailResult(new NotFoundObjectResult(message)); + + /// + /// 409 - Conflict response. + /// + public static GetUserByEmailResult Conflict(string? message = null) + => new GetUserByEmailResult(new ConflictObjectResult(message)); + + /// + /// Performs an implicit conversion from GetUserByEmailResult to ActionResult. + /// + public static implicit operator GetUserByEmailResult(User response) + => Ok(response); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Results/GetUserByIdResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Results/GetUserByIdResult.verified.cs new file mode 100644 index 000000000..304c7b85b --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Results/GetUserByIdResult.verified.cs @@ -0,0 +1,42 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Users.MyContracts; + +/// +/// Results for operation request. +/// Description: Get user by id. +/// Operation: GetUserById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetUserByIdResult : ResultBase +{ + private GetUserByIdResult(ActionResult result) : base(result) { } + + /// + /// 200 - Ok response. + /// + public static GetUserByIdResult Ok(User response) + => new GetUserByIdResult(new OkObjectResult(response)); + + /// + /// 404 - NotFound response. + /// + public static GetUserByIdResult NotFound(string? message = null) + => new GetUserByIdResult(new NotFoundObjectResult(message)); + + /// + /// 409 - Conflict response. + /// + public static GetUserByIdResult Conflict(string? message = null) + => new GetUserByIdResult(new ConflictObjectResult(message)); + + /// + /// Performs an implicit conversion from GetUserByIdResult to ActionResult. + /// + public static implicit operator GetUserByIdResult(User response) + => Ok(response); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Results/GetUsersResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Results/GetUsersResult.verified.cs new file mode 100644 index 000000000..507e2f40a --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Results/GetUsersResult.verified.cs @@ -0,0 +1,36 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Users.MyContracts; + +/// +/// Results for operation request. +/// Description: Get all users. +/// Operation: GetUsers. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetUsersResult : ResultBase +{ + private GetUsersResult(ActionResult result) : base(result) { } + + /// + /// 200 - Ok response. + /// + public static GetUsersResult Ok(IEnumerable response) + => new GetUsersResult(new OkObjectResult(response ?? Enumerable.Empty())); + + /// + /// 409 - Conflict response. + /// + public static GetUsersResult Conflict(string? message = null) + => new GetUsersResult(new ConflictObjectResult(message)); + + /// + /// Performs an implicit conversion from GetUsersResult to ActionResult. + /// + public static implicit operator GetUsersResult(List response) + => Ok(response); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Results/PostUserResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Results/PostUserResult.verified.cs new file mode 100644 index 000000000..ef31ce060 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Results/PostUserResult.verified.cs @@ -0,0 +1,36 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Users.MyContracts; + +/// +/// Results for operation request. +/// Description: Create a new user. +/// Operation: PostUser. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class PostUserResult : ResultBase +{ + private PostUserResult(ActionResult result) : base(result) { } + + /// + /// 201 - Created response. + /// + public static PostUserResult Created(string? uri = null) + => new PostUserResult(ResultFactory.CreateContentResult(HttpStatusCode.Created, uri)); + + /// + /// 400 - BadRequest response. + /// + public static PostUserResult BadRequest(string? message = null) + => new PostUserResult(new BadRequestObjectResult(message)); + + /// + /// 409 - Conflict response. + /// + public static PostUserResult Conflict(string? message = null) + => new PostUserResult(new ConflictObjectResult(message)); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Results/UpdateMyTestGenderResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Results/UpdateMyTestGenderResult.verified.cs new file mode 100644 index 000000000..aa0582fac --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Results/UpdateMyTestGenderResult.verified.cs @@ -0,0 +1,48 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Users.MyContracts; + +/// +/// Results for operation request. +/// Description: Update gender on a user. +/// Operation: UpdateMyTestGender. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateMyTestGenderResult : ResultBase +{ + private UpdateMyTestGenderResult(ActionResult result) : base(result) { } + + /// + /// 200 - Ok response. + /// + public static UpdateMyTestGenderResult Ok(string? message = null) + => new UpdateMyTestGenderResult(new OkObjectResult(message)); + + /// + /// 400 - BadRequest response. + /// + public static UpdateMyTestGenderResult BadRequest(string? message = null) + => new UpdateMyTestGenderResult(new BadRequestObjectResult(message)); + + /// + /// 404 - NotFound response. + /// + public static UpdateMyTestGenderResult NotFound(string? message = null) + => new UpdateMyTestGenderResult(new NotFoundObjectResult(message)); + + /// + /// 409 - Conflict response. + /// + public static UpdateMyTestGenderResult Conflict(string? message = null) + => new UpdateMyTestGenderResult(new ConflictObjectResult(message)); + + /// + /// Performs an implicit conversion from UpdateMyTestGenderResult to ActionResult. + /// + public static implicit operator UpdateMyTestGenderResult(string response) + => Ok(response); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Results/UpdateUserByIdResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Results/UpdateUserByIdResult.verified.cs new file mode 100644 index 000000000..0697138b9 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api.Generated/Users/MyContracts/Results/UpdateUserByIdResult.verified.cs @@ -0,0 +1,48 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Users.MyContracts; + +/// +/// Results for operation request. +/// Description: Update user by id. +/// Operation: UpdateUserById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateUserByIdResult : ResultBase +{ + private UpdateUserByIdResult(ActionResult result) : base(result) { } + + /// + /// 200 - Ok response. + /// + public static UpdateUserByIdResult Ok(string? message = null) + => new UpdateUserByIdResult(new OkObjectResult(message)); + + /// + /// 400 - BadRequest response. + /// + public static UpdateUserByIdResult BadRequest(string? message = null) + => new UpdateUserByIdResult(new BadRequestObjectResult(message)); + + /// + /// 404 - NotFound response. + /// + public static UpdateUserByIdResult NotFound(string? message = null) + => new UpdateUserByIdResult(new NotFoundObjectResult(message)); + + /// + /// 409 - Conflict response. + /// + public static UpdateUserByIdResult Conflict(string? message = null) + => new UpdateUserByIdResult(new ConflictObjectResult(message)); + + /// + /// Performs an implicit conversion from UpdateUserByIdResult to ActionResult. + /// + public static implicit operator UpdateUserByIdResult(string response) + => Ok(response); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api/GlobalUsings.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api/GlobalUsings.verified.cs new file mode 100644 index 000000000..c9fdc9c44 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api/GlobalUsings.verified.cs @@ -0,0 +1,16 @@ +global using System.CodeDom.Compiler; +global using System.Reflection; +global using System.Text; + +global using Asp.Versioning.ApiExplorer; + +global using Atc.Rest.Extended.Options; + +global using Microsoft.Extensions.Options; +global using Microsoft.OpenApi.Models; + +global using Structure1.Api.Generated; +global using Structure1.Api.Options; +global using Structure1.Domain; + +global using Swashbuckle.AspNetCore.SwaggerGen; \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api/Options/ConfigureSwaggerDocOptions.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api/Options/ConfigureSwaggerDocOptions.verified.cs new file mode 100644 index 000000000..99ea13d7f --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api/Options/ConfigureSwaggerDocOptions.verified.cs @@ -0,0 +1,94 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Options; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class ConfigureSwaggerDocOptions : IConfigureOptions +{ + private readonly IApiVersionDescriptionProvider provider; + private readonly IWebHostEnvironment environment; + + /// + /// Initializes a new instance of the class. + /// + /// The provider used to generate Swagger documents. + /// The environment. + public ConfigureSwaggerDocOptions( + IApiVersionDescriptionProvider provider, + IWebHostEnvironment environment) + { + this.provider = provider; + this.environment = environment; + } + + public void Configure( + SwaggerGenOptions options) + { + foreach (var description in provider.ApiVersionDescriptions) + { + options.SwaggerDoc(description.GroupName, CreateInfoForApiVersion(description)); + } + + options.IncludeXmlComments(Path.ChangeExtension(GetType().Assembly.Location, "xml")); + } + + private OpenApiInfo CreateInfoForApiVersion( + ApiVersionDescription description) + { + var text = new StringBuilder("Demo Sample Api - SingleFileVersion"); + var info = new OpenApiInfo + { + Title = $"{environment.ApplicationName} {description.GroupName.ToUpperInvariant()}", + Version = description.ApiVersion.ToString(), + Contact = new OpenApiContact + { + Name = "atc-net A/S", + }, + }; + + if (description.IsDeprecated) + { + text.Append(" This API version has been deprecated."); + } + + if (description.SunsetPolicy is { } policy) + { + if (policy.Date is { } when) + { + text.Append(" The API will be sunset on ") + .Append(when.Date.ToShortDateString()) + .Append('.'); + } + + if (policy.HasLinks) + { + text.AppendLine(); + + foreach (var link in policy.Links) + { + if (link.Type != "text/html") + { + continue; + } + + text.AppendLine(); + + if (link.Title.HasValue) + { + text.Append(link.Title.Value).Append(": "); + } + + text.Append(link.LinkTarget.OriginalString); + } + } + } + + info.Description = text.ToString(); + + return info; + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api/Program.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api/Program.verified.cs new file mode 100644 index 000000000..0c49ad9ae --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api/Program.verified.cs @@ -0,0 +1,23 @@ +namespace Structure1.Api; + +public static class Program +{ + public static void Main(string[] args) + { + CreateHostBuilder(args) + .Build() + .Run(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) + { + var builder = Host + .CreateDefaultBuilder(args) + .ConfigureWebHostDefaults(webBuilder => + { + webBuilder.UseStartup(); + }); + + return builder; + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api/Startup.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api/Startup.verified.cs new file mode 100644 index 000000000..cd23f998f --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Api/Startup.verified.cs @@ -0,0 +1,38 @@ +namespace Structure1.Api; + +public class Startup +{ + private readonly RestApiExtendedOptions restApiOptions; + + public Startup( + IConfiguration configuration) + { + Configuration = configuration; + restApiOptions = new RestApiExtendedOptions + { + // TODO: Remove/out-comment/set to false this for production scenarios! + AllowAnonymousAccessForDevelopment = true, + }; + + restApiOptions.AddAssemblyPairs( + Assembly.GetAssembly(typeof(ApiRegistration)), + Assembly.GetAssembly(typeof(DomainRegistration))); + } + + public IConfiguration Configuration { get; } + + public void ConfigureServices( + IServiceCollection services) + { + services.ConfigureOptions(); + + services.AddRestApi(restApiOptions, Configuration); + } + + public void Configure( + IApplicationBuilder app, + IWebHostEnvironment env) + { + app.ConfigureRestApi(env, restApiOptions); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Accounts/MyHandlers/SetAccountNameHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Accounts/MyHandlers/SetAccountNameHandler.verified.cs new file mode 100644 index 000000000..976aa4191 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Accounts/MyHandlers/SetAccountNameHandler.verified.cs @@ -0,0 +1,18 @@ +namespace Structure1.Domain.Accounts.MyHandlers; + +/// +/// Handler for operation request. +/// Description: Set name of account. +/// Operation: SetAccountName. +/// +public sealed class SetAccountNameHandler : ISetAccountNameHandler +{ + public Task ExecuteAsync( + SetAccountNameParameters parameters, + CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(parameters); + + throw new NotImplementedException("Add logic here for SetAccountNameHandler"); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Accounts/MyHandlers/UpdateAccountNameHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Accounts/MyHandlers/UpdateAccountNameHandler.verified.cs new file mode 100644 index 000000000..aa1622271 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Accounts/MyHandlers/UpdateAccountNameHandler.verified.cs @@ -0,0 +1,18 @@ +namespace Structure1.Domain.Accounts.MyHandlers; + +/// +/// Handler for operation request. +/// Description: Update name of account. +/// Operation: UpdateAccountName. +/// +public sealed class UpdateAccountNameHandler : IUpdateAccountNameHandler +{ + public Task ExecuteAsync( + UpdateAccountNameParameters parameters, + CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(parameters); + + throw new NotImplementedException("Add logic here for UpdateAccountNameHandler"); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Addresses/MyHandlers/GetAddressesByPostalCodesHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Addresses/MyHandlers/GetAddressesByPostalCodesHandler.verified.cs new file mode 100644 index 000000000..0617b6ec0 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Addresses/MyHandlers/GetAddressesByPostalCodesHandler.verified.cs @@ -0,0 +1,18 @@ +namespace Structure1.Domain.Addresses.MyHandlers; + +/// +/// Handler for operation request. +/// Description: Get addresses by postal code. +/// Operation: GetAddressesByPostalCodes. +/// +public sealed class GetAddressesByPostalCodesHandler : IGetAddressesByPostalCodesHandler +{ + public Task ExecuteAsync( + GetAddressesByPostalCodesParameters parameters, + CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(parameters); + + throw new NotImplementedException("Add logic here for GetAddressesByPostalCodesHandler"); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/DomainRegistration.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/DomainRegistration.verified.cs new file mode 100644 index 000000000..f3e9d6787 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/DomainRegistration.verified.cs @@ -0,0 +1,12 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Domain; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class DomainRegistration +{ +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/EventArgs/MyHandlers/GetEventArgByIdHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/EventArgs/MyHandlers/GetEventArgByIdHandler.verified.cs new file mode 100644 index 000000000..277d579db --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/EventArgs/MyHandlers/GetEventArgByIdHandler.verified.cs @@ -0,0 +1,18 @@ +namespace Structure1.Domain.EventArgs.MyHandlers; + +/// +/// Handler for operation request. +/// Description: Get EventArgs By Id. +/// Operation: GetEventArgById. +/// +public sealed class GetEventArgByIdHandler : IGetEventArgByIdHandler +{ + public Task ExecuteAsync( + GetEventArgByIdParameters parameters, + CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(parameters); + + throw new NotImplementedException("Add logic here for GetEventArgByIdHandler"); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/EventArgs/MyHandlers/GetEventArgsHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/EventArgs/MyHandlers/GetEventArgsHandler.verified.cs new file mode 100644 index 000000000..d10976a32 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/EventArgs/MyHandlers/GetEventArgsHandler.verified.cs @@ -0,0 +1,15 @@ +namespace Structure1.Domain.EventArgs.MyHandlers; + +/// +/// Handler for operation request. +/// Description: Get EventArgs List. +/// Operation: GetEventArgs. +/// +public sealed class GetEventArgsHandler : IGetEventArgsHandler +{ + public Task ExecuteAsync( + CancellationToken cancellationToken = default) + { + throw new NotImplementedException("Add logic here for GetEventArgsHandler"); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Files/MyHandlers/GetFileByIdHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Files/MyHandlers/GetFileByIdHandler.verified.cs new file mode 100644 index 000000000..4ef41766b --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Files/MyHandlers/GetFileByIdHandler.verified.cs @@ -0,0 +1,18 @@ +namespace Structure1.Domain.Files.MyHandlers; + +/// +/// Handler for operation request. +/// Description: Get File By Id. +/// Operation: GetFileById. +/// +public sealed class GetFileByIdHandler : IGetFileByIdHandler +{ + public Task ExecuteAsync( + GetFileByIdParameters parameters, + CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(parameters); + + throw new NotImplementedException("Add logic here for GetFileByIdHandler"); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Files/MyHandlers/UploadMultiFilesAsFormDataHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Files/MyHandlers/UploadMultiFilesAsFormDataHandler.verified.cs new file mode 100644 index 000000000..f8212b2c4 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Files/MyHandlers/UploadMultiFilesAsFormDataHandler.verified.cs @@ -0,0 +1,18 @@ +namespace Structure1.Domain.Files.MyHandlers; + +/// +/// Handler for operation request. +/// Description: Upload multi files as form data. +/// Operation: UploadMultiFilesAsFormData. +/// +public sealed class UploadMultiFilesAsFormDataHandler : IUploadMultiFilesAsFormDataHandler +{ + public Task ExecuteAsync( + UploadMultiFilesAsFormDataParameters parameters, + CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(parameters); + + throw new NotImplementedException("Add logic here for UploadMultiFilesAsFormDataHandler"); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Files/MyHandlers/UploadSingleFileAsFormDataHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Files/MyHandlers/UploadSingleFileAsFormDataHandler.verified.cs new file mode 100644 index 000000000..ba1db77bd --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Files/MyHandlers/UploadSingleFileAsFormDataHandler.verified.cs @@ -0,0 +1,18 @@ +namespace Structure1.Domain.Files.MyHandlers; + +/// +/// Handler for operation request. +/// Description: Upload a file as OctetStream. +/// Operation: UploadSingleFileAsFormData. +/// +public sealed class UploadSingleFileAsFormDataHandler : IUploadSingleFileAsFormDataHandler +{ + public Task ExecuteAsync( + UploadSingleFileAsFormDataParameters parameters, + CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(parameters); + + throw new NotImplementedException("Add logic here for UploadSingleFileAsFormDataHandler"); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Files/MyHandlers/UploadSingleObjectWithFileAsFormDataHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Files/MyHandlers/UploadSingleObjectWithFileAsFormDataHandler.verified.cs new file mode 100644 index 000000000..9122dd024 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Files/MyHandlers/UploadSingleObjectWithFileAsFormDataHandler.verified.cs @@ -0,0 +1,18 @@ +namespace Structure1.Domain.Files.MyHandlers; + +/// +/// Handler for operation request. +/// Description: Upload a file as FormData. +/// Operation: UploadSingleObjectWithFileAsFormData. +/// +public sealed class UploadSingleObjectWithFileAsFormDataHandler : IUploadSingleObjectWithFileAsFormDataHandler +{ + public Task ExecuteAsync( + UploadSingleObjectWithFileAsFormDataParameters parameters, + CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(parameters); + + throw new NotImplementedException("Add logic here for UploadSingleObjectWithFileAsFormDataHandler"); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Files/MyHandlers/UploadSingleObjectWithFilesAsFormDataHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Files/MyHandlers/UploadSingleObjectWithFilesAsFormDataHandler.verified.cs new file mode 100644 index 000000000..835cfd2ec --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Files/MyHandlers/UploadSingleObjectWithFilesAsFormDataHandler.verified.cs @@ -0,0 +1,18 @@ +namespace Structure1.Domain.Files.MyHandlers; + +/// +/// Handler for operation request. +/// Description: Upload files as FormData. +/// Operation: UploadSingleObjectWithFilesAsFormData. +/// +public sealed class UploadSingleObjectWithFilesAsFormDataHandler : IUploadSingleObjectWithFilesAsFormDataHandler +{ + public Task ExecuteAsync( + UploadSingleObjectWithFilesAsFormDataParameters parameters, + CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(parameters); + + throw new NotImplementedException("Add logic here for UploadSingleObjectWithFilesAsFormDataHandler"); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/GlobalUsings.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/GlobalUsings.verified.cs new file mode 100644 index 000000000..3e480efb0 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/GlobalUsings.verified.cs @@ -0,0 +1,11 @@ +global using System.CodeDom.Compiler; + +global using Structure1.Api.Generated.Accounts.MyContracts; +global using Structure1.Api.Generated.Addresses.MyContracts; +global using Structure1.Api.Generated.EventArgs.MyContracts; +global using Structure1.Api.Generated.Files.MyContracts; +global using Structure1.Api.Generated.Items.MyContracts; +global using Structure1.Api.Generated.Orders.MyContracts; +global using Structure1.Api.Generated.RouteWithDash.MyContracts; +global using Structure1.Api.Generated.Tasks.MyContracts; +global using Structure1.Api.Generated.Users.MyContracts; \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Items/MyHandlers/CreateItemHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Items/MyHandlers/CreateItemHandler.verified.cs new file mode 100644 index 000000000..363741ecd --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Items/MyHandlers/CreateItemHandler.verified.cs @@ -0,0 +1,18 @@ +namespace Structure1.Domain.Items.MyHandlers; + +/// +/// Handler for operation request. +/// Description: Create a new item. +/// Operation: CreateItem. +/// +public sealed class CreateItemHandler : ICreateItemHandler +{ + public Task ExecuteAsync( + CreateItemParameters parameters, + CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(parameters); + + throw new NotImplementedException("Add logic here for CreateItemHandler"); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Items/MyHandlers/UpdateItemHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Items/MyHandlers/UpdateItemHandler.verified.cs new file mode 100644 index 000000000..008b542ee --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Items/MyHandlers/UpdateItemHandler.verified.cs @@ -0,0 +1,18 @@ +namespace Structure1.Domain.Items.MyHandlers; + +/// +/// Handler for operation request. +/// Description: Updates an item. +/// Operation: UpdateItem. +/// +public sealed class UpdateItemHandler : IUpdateItemHandler +{ + public Task ExecuteAsync( + UpdateItemParameters parameters, + CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(parameters); + + throw new NotImplementedException("Add logic here for UpdateItemHandler"); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Orders/MyHandlers/GetOrderByIdHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Orders/MyHandlers/GetOrderByIdHandler.verified.cs new file mode 100644 index 000000000..fb0232810 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Orders/MyHandlers/GetOrderByIdHandler.verified.cs @@ -0,0 +1,18 @@ +namespace Structure1.Domain.Orders.MyHandlers; + +/// +/// Handler for operation request. +/// Description: Get order by id. +/// Operation: GetOrderById. +/// +public sealed class GetOrderByIdHandler : IGetOrderByIdHandler +{ + public Task ExecuteAsync( + GetOrderByIdParameters parameters, + CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(parameters); + + throw new NotImplementedException("Add logic here for GetOrderByIdHandler"); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Orders/MyHandlers/GetOrdersHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Orders/MyHandlers/GetOrdersHandler.verified.cs new file mode 100644 index 000000000..a35d74bf1 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Orders/MyHandlers/GetOrdersHandler.verified.cs @@ -0,0 +1,18 @@ +namespace Structure1.Domain.Orders.MyHandlers; + +/// +/// Handler for operation request. +/// Description: Get orders. +/// Operation: GetOrders. +/// +public sealed class GetOrdersHandler : IGetOrdersHandler +{ + public Task ExecuteAsync( + GetOrdersParameters parameters, + CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(parameters); + + throw new NotImplementedException("Add logic here for GetOrdersHandler"); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Orders/MyHandlers/PatchOrdersIdHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Orders/MyHandlers/PatchOrdersIdHandler.verified.cs new file mode 100644 index 000000000..6ade26cd5 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Orders/MyHandlers/PatchOrdersIdHandler.verified.cs @@ -0,0 +1,18 @@ +namespace Structure1.Domain.Orders.MyHandlers; + +/// +/// Handler for operation request. +/// Description: Update part of order by id. +/// Operation: PatchOrdersId. +/// +public sealed class PatchOrdersIdHandler : IPatchOrdersIdHandler +{ + public Task ExecuteAsync( + PatchOrdersIdParameters parameters, + CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(parameters); + + throw new NotImplementedException("Add logic here for PatchOrdersIdHandler"); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/RouteWithDash/MyHandlers/GetRouteWithDashHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/RouteWithDash/MyHandlers/GetRouteWithDashHandler.verified.cs new file mode 100644 index 000000000..418d9c3f4 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/RouteWithDash/MyHandlers/GetRouteWithDashHandler.verified.cs @@ -0,0 +1,15 @@ +namespace Structure1.Domain.RouteWithDash.MyHandlers; + +/// +/// Handler for operation request. +/// Description: Your GET endpoint. +/// Operation: GetRouteWithDash. +/// +public sealed class GetRouteWithDashHandler : IGetRouteWithDashHandler +{ + public Task ExecuteAsync( + CancellationToken cancellationToken = default) + { + throw new NotImplementedException("Add logic here for GetRouteWithDashHandler"); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Tasks/MyHandlers/GetTasksHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Tasks/MyHandlers/GetTasksHandler.verified.cs new file mode 100644 index 000000000..850dc7812 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Tasks/MyHandlers/GetTasksHandler.verified.cs @@ -0,0 +1,15 @@ +namespace Structure1.Domain.Tasks.MyHandlers; + +/// +/// Handler for operation request. +/// Description: Returns tasks. +/// Operation: GetTasks. +/// +public sealed class GetTasksHandler : IGetTasksHandler +{ + public Task ExecuteAsync( + CancellationToken cancellationToken = default) + { + throw new NotImplementedException("Add logic here for GetTasksHandler"); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Users/MyHandlers/DeleteUserByIdHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Users/MyHandlers/DeleteUserByIdHandler.verified.cs new file mode 100644 index 000000000..267a22865 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Users/MyHandlers/DeleteUserByIdHandler.verified.cs @@ -0,0 +1,18 @@ +namespace Structure1.Domain.Users.MyHandlers; + +/// +/// Handler for operation request. +/// Description: Delete user by id. +/// Operation: DeleteUserById. +/// +public sealed class DeleteUserByIdHandler : IDeleteUserByIdHandler +{ + public Task ExecuteAsync( + DeleteUserByIdParameters parameters, + CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(parameters); + + throw new NotImplementedException("Add logic here for DeleteUserByIdHandler"); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Users/MyHandlers/GetUserByEmailHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Users/MyHandlers/GetUserByEmailHandler.verified.cs new file mode 100644 index 000000000..117cb294f --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Users/MyHandlers/GetUserByEmailHandler.verified.cs @@ -0,0 +1,18 @@ +namespace Structure1.Domain.Users.MyHandlers; + +/// +/// Handler for operation request. +/// Description: Get user by email. +/// Operation: GetUserByEmail. +/// +public sealed class GetUserByEmailHandler : IGetUserByEmailHandler +{ + public Task ExecuteAsync( + GetUserByEmailParameters parameters, + CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(parameters); + + throw new NotImplementedException("Add logic here for GetUserByEmailHandler"); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Users/MyHandlers/GetUserByIdHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Users/MyHandlers/GetUserByIdHandler.verified.cs new file mode 100644 index 000000000..63b690554 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Users/MyHandlers/GetUserByIdHandler.verified.cs @@ -0,0 +1,18 @@ +namespace Structure1.Domain.Users.MyHandlers; + +/// +/// Handler for operation request. +/// Description: Get user by id. +/// Operation: GetUserById. +/// +public sealed class GetUserByIdHandler : IGetUserByIdHandler +{ + public Task ExecuteAsync( + GetUserByIdParameters parameters, + CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(parameters); + + throw new NotImplementedException("Add logic here for GetUserByIdHandler"); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Users/MyHandlers/GetUsersHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Users/MyHandlers/GetUsersHandler.verified.cs new file mode 100644 index 000000000..d8d8e7fab --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Users/MyHandlers/GetUsersHandler.verified.cs @@ -0,0 +1,15 @@ +namespace Structure1.Domain.Users.MyHandlers; + +/// +/// Handler for operation request. +/// Description: Get all users. +/// Operation: GetUsers. +/// +public sealed class GetUsersHandler : IGetUsersHandler +{ + public Task ExecuteAsync( + CancellationToken cancellationToken = default) + { + throw new NotImplementedException("Add logic here for GetUsersHandler"); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Users/MyHandlers/PostUserHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Users/MyHandlers/PostUserHandler.verified.cs new file mode 100644 index 000000000..075338c5a --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Users/MyHandlers/PostUserHandler.verified.cs @@ -0,0 +1,18 @@ +namespace Structure1.Domain.Users.MyHandlers; + +/// +/// Handler for operation request. +/// Description: Create a new user. +/// Operation: PostUser. +/// +public sealed class PostUserHandler : IPostUserHandler +{ + public Task ExecuteAsync( + PostUserParameters parameters, + CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(parameters); + + throw new NotImplementedException("Add logic here for PostUserHandler"); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Users/MyHandlers/UpdateMyTestGenderHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Users/MyHandlers/UpdateMyTestGenderHandler.verified.cs new file mode 100644 index 000000000..300667242 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Users/MyHandlers/UpdateMyTestGenderHandler.verified.cs @@ -0,0 +1,18 @@ +namespace Structure1.Domain.Users.MyHandlers; + +/// +/// Handler for operation request. +/// Description: Update gender on a user. +/// Operation: UpdateMyTestGender. +/// +public sealed class UpdateMyTestGenderHandler : IUpdateMyTestGenderHandler +{ + public Task ExecuteAsync( + UpdateMyTestGenderParameters parameters, + CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(parameters); + + throw new NotImplementedException("Add logic here for UpdateMyTestGenderHandler"); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Users/MyHandlers/UpdateUserByIdHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Users/MyHandlers/UpdateUserByIdHandler.verified.cs new file mode 100644 index 000000000..4db3de34d --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/src/Structure1.Domain/Users/MyHandlers/UpdateUserByIdHandler.verified.cs @@ -0,0 +1,18 @@ +namespace Structure1.Domain.Users.MyHandlers; + +/// +/// Handler for operation request. +/// Description: Update user by id. +/// Operation: UpdateUserById. +/// +public sealed class UpdateUserByIdHandler : IUpdateUserByIdHandler +{ + public Task ExecuteAsync( + UpdateUserByIdParameters parameters, + CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(parameters); + + throw new NotImplementedException("Add logic here for UpdateUserByIdHandler"); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Accounts/MyEndpoints/SetAccountNameHandlerStub.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Accounts/MyEndpoints/SetAccountNameHandlerStub.verified.cs new file mode 100644 index 000000000..198a26833 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Accounts/MyEndpoints/SetAccountNameHandlerStub.verified.cs @@ -0,0 +1,18 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests.Accounts.MyEndpoints; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class SetAccountNameHandlerStub : ISetAccountNameHandler +{ + public Task ExecuteAsync( + SetAccountNameParameters parameters, + CancellationToken cancellationToken = default) + { + return Task.FromResult(SetAccountNameResult.Ok("Hallo world")); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Accounts/MyEndpoints/UpdateAccountNameHandlerStub.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Accounts/MyEndpoints/UpdateAccountNameHandlerStub.verified.cs new file mode 100644 index 000000000..4e0bf86ea --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Accounts/MyEndpoints/UpdateAccountNameHandlerStub.verified.cs @@ -0,0 +1,18 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests.Accounts.MyEndpoints; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateAccountNameHandlerStub : IUpdateAccountNameHandler +{ + public Task ExecuteAsync( + UpdateAccountNameParameters parameters, + CancellationToken cancellationToken = default) + { + return Task.FromResult(UpdateAccountNameResult.Ok("Hallo world")); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Addresses/MyEndpoints/GetAddressesByPostalCodesHandlerStub.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Addresses/MyEndpoints/GetAddressesByPostalCodesHandlerStub.verified.cs new file mode 100644 index 000000000..054394ecd --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Addresses/MyEndpoints/GetAddressesByPostalCodesHandlerStub.verified.cs @@ -0,0 +1,20 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests.Addresses.MyEndpoints; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetAddressesByPostalCodesHandlerStub : IGetAddressesByPostalCodesHandler +{ + public Task ExecuteAsync( + GetAddressesByPostalCodesParameters parameters, + CancellationToken cancellationToken = default) + { + var data = new Fixture().Create>(); + + return Task.FromResult(GetAddressesByPostalCodesResult.Ok(data)); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Accounts/SetAccountNameTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Accounts/SetAccountNameTests.verified.cs new file mode 100644 index 000000000..c1f50a460 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Accounts/SetAccountNameTests.verified.cs @@ -0,0 +1,21 @@ +namespace Structure1.Api.Tests.Accounts.MyEndpoints; + +[Collection("Sequential-Endpoints")] +[Trait(Traits.Category, Traits.Categories.Integration)] +public class SetAccountNameTests : WebApiControllerBaseTest +{ + public SetAccountNameTests(WebApiStartupFactory fixture) + : base(fixture) + { + } + + [Fact(Skip = "Change this to a real integration-test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Accounts/UpdateAccountNameTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Accounts/UpdateAccountNameTests.verified.cs new file mode 100644 index 000000000..a145fc48d --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Accounts/UpdateAccountNameTests.verified.cs @@ -0,0 +1,21 @@ +namespace Structure1.Api.Tests.Accounts.MyEndpoints; + +[Collection("Sequential-Endpoints")] +[Trait(Traits.Category, Traits.Categories.Integration)] +public class UpdateAccountNameTests : WebApiControllerBaseTest +{ + public UpdateAccountNameTests(WebApiStartupFactory fixture) + : base(fixture) + { + } + + [Fact(Skip = "Change this to a real integration-test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Addresses/GetAddressesByPostalCodesTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Addresses/GetAddressesByPostalCodesTests.verified.cs new file mode 100644 index 000000000..602c00981 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Addresses/GetAddressesByPostalCodesTests.verified.cs @@ -0,0 +1,21 @@ +namespace Structure1.Api.Tests.Addresses.MyEndpoints; + +[Collection("Sequential-Endpoints")] +[Trait(Traits.Category, Traits.Categories.Integration)] +public class GetAddressesByPostalCodesTests : WebApiControllerBaseTest +{ + public GetAddressesByPostalCodesTests(WebApiStartupFactory fixture) + : base(fixture) + { + } + + [Fact(Skip = "Change this to a real integration-test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/EventArgs/GetEventArgByIdTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/EventArgs/GetEventArgByIdTests.verified.cs new file mode 100644 index 000000000..9b5b1fe1b --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/EventArgs/GetEventArgByIdTests.verified.cs @@ -0,0 +1,21 @@ +namespace Structure1.Api.Tests.EventArgs.MyEndpoints; + +[Collection("Sequential-Endpoints")] +[Trait(Traits.Category, Traits.Categories.Integration)] +public class GetEventArgByIdTests : WebApiControllerBaseTest +{ + public GetEventArgByIdTests(WebApiStartupFactory fixture) + : base(fixture) + { + } + + [Fact(Skip = "Change this to a real integration-test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/EventArgs/GetEventArgsTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/EventArgs/GetEventArgsTests.verified.cs new file mode 100644 index 000000000..eed6621a4 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/EventArgs/GetEventArgsTests.verified.cs @@ -0,0 +1,21 @@ +namespace Structure1.Api.Tests.EventArgs.MyEndpoints; + +[Collection("Sequential-Endpoints")] +[Trait(Traits.Category, Traits.Categories.Integration)] +public class GetEventArgsTests : WebApiControllerBaseTest +{ + public GetEventArgsTests(WebApiStartupFactory fixture) + : base(fixture) + { + } + + [Fact(Skip = "Change this to a real integration-test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Files/GetFileByIdTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Files/GetFileByIdTests.verified.cs new file mode 100644 index 000000000..30ecdf169 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Files/GetFileByIdTests.verified.cs @@ -0,0 +1,21 @@ +namespace Structure1.Api.Tests.Files.MyEndpoints; + +[Collection("Sequential-Endpoints")] +[Trait(Traits.Category, Traits.Categories.Integration)] +public class GetFileByIdTests : WebApiControllerBaseTest +{ + public GetFileByIdTests(WebApiStartupFactory fixture) + : base(fixture) + { + } + + [Fact(Skip = "Change this to a real integration-test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Files/UploadMultiFilesAsFormDataTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Files/UploadMultiFilesAsFormDataTests.verified.cs new file mode 100644 index 000000000..fa82be62d --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Files/UploadMultiFilesAsFormDataTests.verified.cs @@ -0,0 +1,21 @@ +namespace Structure1.Api.Tests.Files.MyEndpoints; + +[Collection("Sequential-Endpoints")] +[Trait(Traits.Category, Traits.Categories.Integration)] +public class UploadMultiFilesAsFormDataTests : WebApiControllerBaseTest +{ + public UploadMultiFilesAsFormDataTests(WebApiStartupFactory fixture) + : base(fixture) + { + } + + [Fact(Skip = "Change this to a real integration-test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Files/UploadSingleFileAsFormDataTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Files/UploadSingleFileAsFormDataTests.verified.cs new file mode 100644 index 000000000..f6bf85519 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Files/UploadSingleFileAsFormDataTests.verified.cs @@ -0,0 +1,21 @@ +namespace Structure1.Api.Tests.Files.MyEndpoints; + +[Collection("Sequential-Endpoints")] +[Trait(Traits.Category, Traits.Categories.Integration)] +public class UploadSingleFileAsFormDataTests : WebApiControllerBaseTest +{ + public UploadSingleFileAsFormDataTests(WebApiStartupFactory fixture) + : base(fixture) + { + } + + [Fact(Skip = "Change this to a real integration-test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Files/UploadSingleObjectWithFileAsFormDataTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Files/UploadSingleObjectWithFileAsFormDataTests.verified.cs new file mode 100644 index 000000000..fb3336f79 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Files/UploadSingleObjectWithFileAsFormDataTests.verified.cs @@ -0,0 +1,21 @@ +namespace Structure1.Api.Tests.Files.MyEndpoints; + +[Collection("Sequential-Endpoints")] +[Trait(Traits.Category, Traits.Categories.Integration)] +public class UploadSingleObjectWithFileAsFormDataTests : WebApiControllerBaseTest +{ + public UploadSingleObjectWithFileAsFormDataTests(WebApiStartupFactory fixture) + : base(fixture) + { + } + + [Fact(Skip = "Change this to a real integration-test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Files/UploadSingleObjectWithFilesAsFormDataTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Files/UploadSingleObjectWithFilesAsFormDataTests.verified.cs new file mode 100644 index 000000000..e5cbacacd --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Files/UploadSingleObjectWithFilesAsFormDataTests.verified.cs @@ -0,0 +1,21 @@ +namespace Structure1.Api.Tests.Files.MyEndpoints; + +[Collection("Sequential-Endpoints")] +[Trait(Traits.Category, Traits.Categories.Integration)] +public class UploadSingleObjectWithFilesAsFormDataTests : WebApiControllerBaseTest +{ + public UploadSingleObjectWithFilesAsFormDataTests(WebApiStartupFactory fixture) + : base(fixture) + { + } + + [Fact(Skip = "Change this to a real integration-test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Items/CreateItemTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Items/CreateItemTests.verified.cs new file mode 100644 index 000000000..659687674 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Items/CreateItemTests.verified.cs @@ -0,0 +1,21 @@ +namespace Structure1.Api.Tests.Items.MyEndpoints; + +[Collection("Sequential-Endpoints")] +[Trait(Traits.Category, Traits.Categories.Integration)] +public class CreateItemTests : WebApiControllerBaseTest +{ + public CreateItemTests(WebApiStartupFactory fixture) + : base(fixture) + { + } + + [Fact(Skip = "Change this to a real integration-test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Items/UpdateItemTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Items/UpdateItemTests.verified.cs new file mode 100644 index 000000000..64d0a57fd --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Items/UpdateItemTests.verified.cs @@ -0,0 +1,21 @@ +namespace Structure1.Api.Tests.Items.MyEndpoints; + +[Collection("Sequential-Endpoints")] +[Trait(Traits.Category, Traits.Categories.Integration)] +public class UpdateItemTests : WebApiControllerBaseTest +{ + public UpdateItemTests(WebApiStartupFactory fixture) + : base(fixture) + { + } + + [Fact(Skip = "Change this to a real integration-test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Orders/GetOrderByIdTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Orders/GetOrderByIdTests.verified.cs new file mode 100644 index 000000000..82fcf27b1 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Orders/GetOrderByIdTests.verified.cs @@ -0,0 +1,21 @@ +namespace Structure1.Api.Tests.Orders.MyEndpoints; + +[Collection("Sequential-Endpoints")] +[Trait(Traits.Category, Traits.Categories.Integration)] +public class GetOrderByIdTests : WebApiControllerBaseTest +{ + public GetOrderByIdTests(WebApiStartupFactory fixture) + : base(fixture) + { + } + + [Fact(Skip = "Change this to a real integration-test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Orders/GetOrdersTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Orders/GetOrdersTests.verified.cs new file mode 100644 index 000000000..9515731bc --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Orders/GetOrdersTests.verified.cs @@ -0,0 +1,21 @@ +namespace Structure1.Api.Tests.Orders.MyEndpoints; + +[Collection("Sequential-Endpoints")] +[Trait(Traits.Category, Traits.Categories.Integration)] +public class GetOrdersTests : WebApiControllerBaseTest +{ + public GetOrdersTests(WebApiStartupFactory fixture) + : base(fixture) + { + } + + [Fact(Skip = "Change this to a real integration-test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Orders/PatchOrdersIdTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Orders/PatchOrdersIdTests.verified.cs new file mode 100644 index 000000000..acdc9f53e --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Orders/PatchOrdersIdTests.verified.cs @@ -0,0 +1,21 @@ +namespace Structure1.Api.Tests.Orders.MyEndpoints; + +[Collection("Sequential-Endpoints")] +[Trait(Traits.Category, Traits.Categories.Integration)] +public class PatchOrdersIdTests : WebApiControllerBaseTest +{ + public PatchOrdersIdTests(WebApiStartupFactory fixture) + : base(fixture) + { + } + + [Fact(Skip = "Change this to a real integration-test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/RouteWithDash/GetRouteWithDashTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/RouteWithDash/GetRouteWithDashTests.verified.cs new file mode 100644 index 000000000..ebd0dca11 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/RouteWithDash/GetRouteWithDashTests.verified.cs @@ -0,0 +1,21 @@ +namespace Structure1.Api.Tests.RouteWithDash.MyEndpoints; + +[Collection("Sequential-Endpoints")] +[Trait(Traits.Category, Traits.Categories.Integration)] +public class GetRouteWithDashTests : WebApiControllerBaseTest +{ + public GetRouteWithDashTests(WebApiStartupFactory fixture) + : base(fixture) + { + } + + [Fact(Skip = "Change this to a real integration-test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Tasks/GetTasksTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Tasks/GetTasksTests.verified.cs new file mode 100644 index 000000000..e8317d04a --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Tasks/GetTasksTests.verified.cs @@ -0,0 +1,21 @@ +namespace Structure1.Api.Tests.Tasks.MyEndpoints; + +[Collection("Sequential-Endpoints")] +[Trait(Traits.Category, Traits.Categories.Integration)] +public class GetTasksTests : WebApiControllerBaseTest +{ + public GetTasksTests(WebApiStartupFactory fixture) + : base(fixture) + { + } + + [Fact(Skip = "Change this to a real integration-test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Users/DeleteUserByIdTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Users/DeleteUserByIdTests.verified.cs new file mode 100644 index 000000000..def17600a --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Users/DeleteUserByIdTests.verified.cs @@ -0,0 +1,21 @@ +namespace Structure1.Api.Tests.Users.MyEndpoints; + +[Collection("Sequential-Endpoints")] +[Trait(Traits.Category, Traits.Categories.Integration)] +public class DeleteUserByIdTests : WebApiControllerBaseTest +{ + public DeleteUserByIdTests(WebApiStartupFactory fixture) + : base(fixture) + { + } + + [Fact(Skip = "Change this to a real integration-test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Users/GetUserByEmailTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Users/GetUserByEmailTests.verified.cs new file mode 100644 index 000000000..aae9f6a8a --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Users/GetUserByEmailTests.verified.cs @@ -0,0 +1,21 @@ +namespace Structure1.Api.Tests.Users.MyEndpoints; + +[Collection("Sequential-Endpoints")] +[Trait(Traits.Category, Traits.Categories.Integration)] +public class GetUserByEmailTests : WebApiControllerBaseTest +{ + public GetUserByEmailTests(WebApiStartupFactory fixture) + : base(fixture) + { + } + + [Fact(Skip = "Change this to a real integration-test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Users/GetUserByIdTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Users/GetUserByIdTests.verified.cs new file mode 100644 index 000000000..395ed853c --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Users/GetUserByIdTests.verified.cs @@ -0,0 +1,21 @@ +namespace Structure1.Api.Tests.Users.MyEndpoints; + +[Collection("Sequential-Endpoints")] +[Trait(Traits.Category, Traits.Categories.Integration)] +public class GetUserByIdTests : WebApiControllerBaseTest +{ + public GetUserByIdTests(WebApiStartupFactory fixture) + : base(fixture) + { + } + + [Fact(Skip = "Change this to a real integration-test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Users/GetUsersTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Users/GetUsersTests.verified.cs new file mode 100644 index 000000000..17bc489aa --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Users/GetUsersTests.verified.cs @@ -0,0 +1,21 @@ +namespace Structure1.Api.Tests.Users.MyEndpoints; + +[Collection("Sequential-Endpoints")] +[Trait(Traits.Category, Traits.Categories.Integration)] +public class GetUsersTests : WebApiControllerBaseTest +{ + public GetUsersTests(WebApiStartupFactory fixture) + : base(fixture) + { + } + + [Fact(Skip = "Change this to a real integration-test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Users/PostUserTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Users/PostUserTests.verified.cs new file mode 100644 index 000000000..1429d33cc --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Users/PostUserTests.verified.cs @@ -0,0 +1,21 @@ +namespace Structure1.Api.Tests.Users.MyEndpoints; + +[Collection("Sequential-Endpoints")] +[Trait(Traits.Category, Traits.Categories.Integration)] +public class PostUserTests : WebApiControllerBaseTest +{ + public PostUserTests(WebApiStartupFactory fixture) + : base(fixture) + { + } + + [Fact(Skip = "Change this to a real integration-test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Users/UpdateMyTestGenderTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Users/UpdateMyTestGenderTests.verified.cs new file mode 100644 index 000000000..ad047acfa --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Users/UpdateMyTestGenderTests.verified.cs @@ -0,0 +1,21 @@ +namespace Structure1.Api.Tests.Users.MyEndpoints; + +[Collection("Sequential-Endpoints")] +[Trait(Traits.Category, Traits.Categories.Integration)] +public class UpdateMyTestGenderTests : WebApiControllerBaseTest +{ + public UpdateMyTestGenderTests(WebApiStartupFactory fixture) + : base(fixture) + { + } + + [Fact(Skip = "Change this to a real integration-test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Users/UpdateUserByIdTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Users/UpdateUserByIdTests.verified.cs new file mode 100644 index 000000000..e1237e038 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Endpoints/Users/UpdateUserByIdTests.verified.cs @@ -0,0 +1,21 @@ +namespace Structure1.Api.Tests.Users.MyEndpoints; + +[Collection("Sequential-Endpoints")] +[Trait(Traits.Category, Traits.Categories.Integration)] +public class UpdateUserByIdTests : WebApiControllerBaseTest +{ + public UpdateUserByIdTests(WebApiStartupFactory fixture) + : base(fixture) + { + } + + [Fact(Skip = "Change this to a real integration-test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/EventArgs/MyEndpoints/GetEventArgByIdHandlerStub.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/EventArgs/MyEndpoints/GetEventArgByIdHandlerStub.verified.cs new file mode 100644 index 000000000..97aa2826a --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/EventArgs/MyEndpoints/GetEventArgByIdHandlerStub.verified.cs @@ -0,0 +1,20 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests.EventArgs.MyEndpoints; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetEventArgByIdHandlerStub : IGetEventArgByIdHandler +{ + public Task ExecuteAsync( + GetEventArgByIdParameters parameters, + CancellationToken cancellationToken = default) + { + var data = new Fixture().Create(); + + return Task.FromResult(GetEventArgByIdResult.Ok(data)); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/EventArgs/MyEndpoints/GetEventArgsHandlerStub.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/EventArgs/MyEndpoints/GetEventArgsHandlerStub.verified.cs new file mode 100644 index 000000000..449d26600 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/EventArgs/MyEndpoints/GetEventArgsHandlerStub.verified.cs @@ -0,0 +1,19 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests.EventArgs.MyEndpoints; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetEventArgsHandlerStub : IGetEventArgsHandler +{ + public Task ExecuteAsync( + CancellationToken cancellationToken = default) + { + var data = new Fixture().Create>(); + + return Task.FromResult(GetEventArgsResult.Ok(data)); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Files/MyEndpoints/GetFileByIdHandlerStub.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Files/MyEndpoints/GetFileByIdHandlerStub.verified.cs new file mode 100644 index 000000000..0246fcdd9 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Files/MyEndpoints/GetFileByIdHandlerStub.verified.cs @@ -0,0 +1,19 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests.Files.MyEndpoints; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetFileByIdHandlerStub : IGetFileByIdHandler +{ + public Task ExecuteAsync( + GetFileByIdParameters parameters, + CancellationToken cancellationToken = default) + { + var bytes = Encoding.UTF8.GetBytes("Hello World"); + return Task.FromResult(GetFileByIdResult.Ok(bytes, "dummy.txt")); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Files/MyEndpoints/UploadMultiFilesAsFormDataHandlerStub.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Files/MyEndpoints/UploadMultiFilesAsFormDataHandlerStub.verified.cs new file mode 100644 index 000000000..9fd0d7544 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Files/MyEndpoints/UploadMultiFilesAsFormDataHandlerStub.verified.cs @@ -0,0 +1,18 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests.Files.MyEndpoints; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UploadMultiFilesAsFormDataHandlerStub : IUploadMultiFilesAsFormDataHandler +{ + public Task ExecuteAsync( + UploadMultiFilesAsFormDataParameters parameters, + CancellationToken cancellationToken = default) + { + return Task.FromResult(UploadMultiFilesAsFormDataResult.Ok("Hallo world")); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Files/MyEndpoints/UploadSingleFileAsFormDataHandlerStub.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Files/MyEndpoints/UploadSingleFileAsFormDataHandlerStub.verified.cs new file mode 100644 index 000000000..3210f03fd --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Files/MyEndpoints/UploadSingleFileAsFormDataHandlerStub.verified.cs @@ -0,0 +1,18 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests.Files.MyEndpoints; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UploadSingleFileAsFormDataHandlerStub : IUploadSingleFileAsFormDataHandler +{ + public Task ExecuteAsync( + UploadSingleFileAsFormDataParameters parameters, + CancellationToken cancellationToken = default) + { + return Task.FromResult(UploadSingleFileAsFormDataResult.Ok("Hallo world")); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Files/MyEndpoints/UploadSingleObjectWithFileAsFormDataHandlerStub.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Files/MyEndpoints/UploadSingleObjectWithFileAsFormDataHandlerStub.verified.cs new file mode 100644 index 000000000..55010a38f --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Files/MyEndpoints/UploadSingleObjectWithFileAsFormDataHandlerStub.verified.cs @@ -0,0 +1,18 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests.Files.MyEndpoints; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UploadSingleObjectWithFileAsFormDataHandlerStub : IUploadSingleObjectWithFileAsFormDataHandler +{ + public Task ExecuteAsync( + UploadSingleObjectWithFileAsFormDataParameters parameters, + CancellationToken cancellationToken = default) + { + return Task.FromResult(UploadSingleObjectWithFileAsFormDataResult.Ok("Hallo world")); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Files/MyEndpoints/UploadSingleObjectWithFilesAsFormDataHandlerStub.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Files/MyEndpoints/UploadSingleObjectWithFilesAsFormDataHandlerStub.verified.cs new file mode 100644 index 000000000..afde72194 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Files/MyEndpoints/UploadSingleObjectWithFilesAsFormDataHandlerStub.verified.cs @@ -0,0 +1,18 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests.Files.MyEndpoints; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UploadSingleObjectWithFilesAsFormDataHandlerStub : IUploadSingleObjectWithFilesAsFormDataHandler +{ + public Task ExecuteAsync( + UploadSingleObjectWithFilesAsFormDataParameters parameters, + CancellationToken cancellationToken = default) + { + return Task.FromResult(UploadSingleObjectWithFilesAsFormDataResult.Ok("Hallo world")); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/GlobalUsings.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/GlobalUsings.verified.cs new file mode 100644 index 000000000..034ee31de --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/GlobalUsings.verified.cs @@ -0,0 +1,31 @@ +global using System.CodeDom.Compiler; +global using System.Reflection; +global using System.Text; +global using System.Text.Json; +global using System.Text.Json.Serialization; + +global using Atc.Rest.Options; +global using Atc.Rest.Results; +global using Atc.XUnit; + +global using AutoFixture; + +global using Microsoft.AspNetCore.Hosting; +global using Microsoft.AspNetCore.Http; +global using Microsoft.AspNetCore.Mvc.Testing; +global using Microsoft.AspNetCore.TestHost; +global using Microsoft.Extensions.Configuration; +global using Microsoft.Extensions.DependencyInjection; + +global using Structure1.Api.Generated; +global using Structure1.Api.Generated.Accounts.MyContracts; +global using Structure1.Api.Generated.Addresses.MyContracts; +global using Structure1.Api.Generated.EventArgs.MyContracts; +global using Structure1.Api.Generated.Files.MyContracts; +global using Structure1.Api.Generated.Items.MyContracts; +global using Structure1.Api.Generated.MyContracts; +global using Structure1.Api.Generated.Orders.MyContracts; +global using Structure1.Api.Generated.RouteWithDash.MyContracts; +global using Structure1.Api.Generated.Users.MyContracts; + +global using Xunit; \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Items/MyEndpoints/CreateItemHandlerStub.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Items/MyEndpoints/CreateItemHandlerStub.verified.cs new file mode 100644 index 000000000..6638162fe --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Items/MyEndpoints/CreateItemHandlerStub.verified.cs @@ -0,0 +1,18 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests.Items.MyEndpoints; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class CreateItemHandlerStub : ICreateItemHandler +{ + public Task ExecuteAsync( + CreateItemParameters parameters, + CancellationToken cancellationToken = default) + { + return Task.FromResult(CreateItemResult.Ok("Hallo world")); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Items/MyEndpoints/UpdateItemHandlerStub.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Items/MyEndpoints/UpdateItemHandlerStub.verified.cs new file mode 100644 index 000000000..0c6bb8ca3 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Items/MyEndpoints/UpdateItemHandlerStub.verified.cs @@ -0,0 +1,18 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests.Items.MyEndpoints; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateItemHandlerStub : IUpdateItemHandler +{ + public Task ExecuteAsync( + UpdateItemParameters parameters, + CancellationToken cancellationToken = default) + { + return Task.FromResult(UpdateItemResult.Ok(Guid.NewGuid())); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Orders/MyEndpoints/GetOrderByIdHandlerStub.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Orders/MyEndpoints/GetOrderByIdHandlerStub.verified.cs new file mode 100644 index 000000000..e87526e54 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Orders/MyEndpoints/GetOrderByIdHandlerStub.verified.cs @@ -0,0 +1,20 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests.Orders.MyEndpoints; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetOrderByIdHandlerStub : IGetOrderByIdHandler +{ + public Task ExecuteAsync( + GetOrderByIdParameters parameters, + CancellationToken cancellationToken = default) + { + var data = new Fixture().Create(); + + return Task.FromResult(GetOrderByIdResult.Ok(data)); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Orders/MyEndpoints/GetOrdersHandlerStub.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Orders/MyEndpoints/GetOrdersHandlerStub.verified.cs new file mode 100644 index 000000000..617d4e5aa --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Orders/MyEndpoints/GetOrdersHandlerStub.verified.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests.Orders.MyEndpoints; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetOrdersHandlerStub : IGetOrdersHandler +{ + public Task ExecuteAsync( + GetOrdersParameters parameters, + CancellationToken cancellationToken = default) + { + var data = new Fixture().Create>(); + + var paginationData = new Pagination( + data, + parameters.PageSize, + parameters.QueryString, + parameters.ContinuationToken); + + return Task.FromResult(GetOrdersResult.Ok(paginationData)); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Orders/MyEndpoints/PatchOrdersIdHandlerStub.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Orders/MyEndpoints/PatchOrdersIdHandlerStub.verified.cs new file mode 100644 index 000000000..c0e77579a --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Orders/MyEndpoints/PatchOrdersIdHandlerStub.verified.cs @@ -0,0 +1,18 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests.Orders.MyEndpoints; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class PatchOrdersIdHandlerStub : IPatchOrdersIdHandler +{ + public Task ExecuteAsync( + PatchOrdersIdParameters parameters, + CancellationToken cancellationToken = default) + { + return Task.FromResult(PatchOrdersIdResult.Ok("Hallo world")); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/RouteWithDash/MyEndpoints/GetRouteWithDashHandlerStub.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/RouteWithDash/MyEndpoints/GetRouteWithDashHandlerStub.verified.cs new file mode 100644 index 000000000..f4695c917 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/RouteWithDash/MyEndpoints/GetRouteWithDashHandlerStub.verified.cs @@ -0,0 +1,17 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests.RouteWithDash.MyEndpoints; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetRouteWithDashHandlerStub : IGetRouteWithDashHandler +{ + public Task ExecuteAsync( + CancellationToken cancellationToken = default) + { + return Task.FromResult(GetRouteWithDashResult.Ok("Hallo world")); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Tasks/MyEndpoints/GetTasksHandlerStub.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Tasks/MyEndpoints/GetTasksHandlerStub.verified.cs new file mode 100644 index 000000000..b03679c27 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Tasks/MyEndpoints/GetTasksHandlerStub.verified.cs @@ -0,0 +1,19 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests.Tasks.MyEndpoints; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetTasksHandlerStub : Structure1.Api.Tests.Tasks.MyEndpoints.IGetTasksHandler +{ + public Task ExecuteAsync( + CancellationToken cancellationToken = default) + { + var data = new Fixture().Create>(); + + return Task.FromResult(Structure1.Api.Tests.Tasks.MyEndpoints.GetTasksResult.Ok(data)); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Users/MyEndpoints/DeleteUserByIdHandlerStub.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Users/MyEndpoints/DeleteUserByIdHandlerStub.verified.cs new file mode 100644 index 000000000..510198942 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Users/MyEndpoints/DeleteUserByIdHandlerStub.verified.cs @@ -0,0 +1,18 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests.Users.MyEndpoints; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class DeleteUserByIdHandlerStub : IDeleteUserByIdHandler +{ + public Task ExecuteAsync( + DeleteUserByIdParameters parameters, + CancellationToken cancellationToken = default) + { + return Task.FromResult(DeleteUserByIdResult.Ok("Hallo world")); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Users/MyEndpoints/GetUserByEmailHandlerStub.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Users/MyEndpoints/GetUserByEmailHandlerStub.verified.cs new file mode 100644 index 000000000..f3b76b3ce --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Users/MyEndpoints/GetUserByEmailHandlerStub.verified.cs @@ -0,0 +1,20 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests.Users.MyEndpoints; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetUserByEmailHandlerStub : IGetUserByEmailHandler +{ + public Task ExecuteAsync( + GetUserByEmailParameters parameters, + CancellationToken cancellationToken = default) + { + var data = new Fixture().Create(); + + return Task.FromResult(GetUserByEmailResult.Ok(data)); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Users/MyEndpoints/GetUserByIdHandlerStub.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Users/MyEndpoints/GetUserByIdHandlerStub.verified.cs new file mode 100644 index 000000000..3fac45f29 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Users/MyEndpoints/GetUserByIdHandlerStub.verified.cs @@ -0,0 +1,20 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests.Users.MyEndpoints; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetUserByIdHandlerStub : IGetUserByIdHandler +{ + public Task ExecuteAsync( + GetUserByIdParameters parameters, + CancellationToken cancellationToken = default) + { + var data = new Fixture().Create(); + + return Task.FromResult(GetUserByIdResult.Ok(data)); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Users/MyEndpoints/GetUsersHandlerStub.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Users/MyEndpoints/GetUsersHandlerStub.verified.cs new file mode 100644 index 000000000..f3ba032d4 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Users/MyEndpoints/GetUsersHandlerStub.verified.cs @@ -0,0 +1,19 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests.Users.MyEndpoints; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetUsersHandlerStub : IGetUsersHandler +{ + public Task ExecuteAsync( + CancellationToken cancellationToken = default) + { + var data = new Fixture().Create>(); + + return Task.FromResult(GetUsersResult.Ok(data)); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Users/MyEndpoints/PostUserHandlerStub.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Users/MyEndpoints/PostUserHandlerStub.verified.cs new file mode 100644 index 000000000..22d448e22 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Users/MyEndpoints/PostUserHandlerStub.verified.cs @@ -0,0 +1,18 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests.Users.MyEndpoints; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class PostUserHandlerStub : IPostUserHandler +{ + public Task ExecuteAsync( + PostUserParameters parameters, + CancellationToken cancellationToken = default) + { + return Task.FromResult(PostUserResult.Created()); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Users/MyEndpoints/UpdateMyTestGenderHandlerStub.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Users/MyEndpoints/UpdateMyTestGenderHandlerStub.verified.cs new file mode 100644 index 000000000..82e7f0adf --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Users/MyEndpoints/UpdateMyTestGenderHandlerStub.verified.cs @@ -0,0 +1,18 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests.Users.MyEndpoints; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateMyTestGenderHandlerStub : IUpdateMyTestGenderHandler +{ + public Task ExecuteAsync( + UpdateMyTestGenderParameters parameters, + CancellationToken cancellationToken = default) + { + return Task.FromResult(UpdateMyTestGenderResult.Ok("Hallo world")); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Users/MyEndpoints/UpdateUserByIdHandlerStub.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Users/MyEndpoints/UpdateUserByIdHandlerStub.verified.cs new file mode 100644 index 000000000..e454f18be --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/Users/MyEndpoints/UpdateUserByIdHandlerStub.verified.cs @@ -0,0 +1,18 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests.Users.MyEndpoints; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateUserByIdHandlerStub : IUpdateUserByIdHandler +{ + public Task ExecuteAsync( + UpdateUserByIdParameters parameters, + CancellationToken cancellationToken = default) + { + return Task.FromResult(UpdateUserByIdResult.Ok("Hallo world")); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/WebApiControllerBaseTest.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/WebApiControllerBaseTest.verified.cs new file mode 100644 index 000000000..6854af9ae --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/WebApiControllerBaseTest.verified.cs @@ -0,0 +1,56 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public abstract class WebApiControllerBaseTest : IClassFixture +{ + protected readonly WebApiStartupFactory Factory; + + protected readonly HttpClient HttpClient; + + protected readonly IConfiguration Configuration; + + protected static JsonSerializerOptions? JsonSerializerOptions; + + protected WebApiControllerBaseTest(WebApiStartupFactory fixture) + { + this.Factory = fixture; + this.HttpClient = this.Factory.CreateClient(); + this.Configuration = new ConfigurationBuilder().Build(); + JsonSerializerOptions = new JsonSerializerOptions + { + PropertyNameCaseInsensitive = true, + Converters = + { + new JsonStringEnumConverter() + }, + }; + } + + protected static StringContent ToJson(object data) + => new(JsonSerializer.Serialize(data, JsonSerializerOptions), Encoding.UTF8, "application/json"); + + protected static StringContent Json(string data) + => new(data, Encoding.UTF8, "application/json"); + + protected static IFormFile GetTestFile() + { + var bytes = Encoding.UTF8.GetBytes("Hello World"); + var stream = new MemoryStream(bytes); + var formFile = new FormFile(stream, 0, stream.Length, "dummy", "dummy.txt") + { + Headers = new HeaderDictionary(), + ContentType = "application/octet-stream", + }; + + return formFile; + } + + protected static List GetTestFiles() + => new() { GetTestFile(), GetTestFile() }; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/WebApiStartupFactory.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/WebApiStartupFactory.verified.cs new file mode 100644 index 000000000..534870e0e --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Api.Tests/WebApiStartupFactory.verified.cs @@ -0,0 +1,40 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests; + +/// +/// Factory for bootstrapping in memory tests. +/// Includes options to override configuration and service collection using a partial class. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public partial class WebApiStartupFactory : WebApplicationFactory +{ + protected override void ConfigureWebHost(IWebHostBuilder builder) + { + builder.ConfigureAppConfiguration(config => + { + ModifyConfiguration(config); + var integrationConfig = new ConfigurationBuilder() + .AddJsonFile("appsettings.integrationtest.json") + .Build(); + config.AddConfiguration(integrationConfig); + }); + + builder.ConfigureTestServices(services => + { + ModifyServices(services); + services.AddSingleton(); + services.AutoRegistrateServices( + Assembly.GetAssembly(typeof(ApiRegistration))!, + Assembly.GetAssembly(typeof(WebApiStartupFactory))!); + }); + } + + partial void ModifyConfiguration(IConfigurationBuilder config); + + partial void ModifyServices(IServiceCollection services); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Accounts/MyHandlers/SetAccountNameHandlerTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Accounts/MyHandlers/SetAccountNameHandlerTests.verified.cs new file mode 100644 index 000000000..4d76dc542 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Accounts/MyHandlers/SetAccountNameHandlerTests.verified.cs @@ -0,0 +1,14 @@ +namespace Structure1.Domain.Tests.Accounts.MyHandlers; + +public class SetAccountNameHandlerTests +{ + [Fact(Skip = "Change this to a real test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Accounts/MyHandlers/UpdateAccountNameHandlerTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Accounts/MyHandlers/UpdateAccountNameHandlerTests.verified.cs new file mode 100644 index 000000000..f5c841eca --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Accounts/MyHandlers/UpdateAccountNameHandlerTests.verified.cs @@ -0,0 +1,14 @@ +namespace Structure1.Domain.Tests.Accounts.MyHandlers; + +public class UpdateAccountNameHandlerTests +{ + [Fact(Skip = "Change this to a real test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Addresses/MyHandlers/GetAddressesByPostalCodesHandlerTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Addresses/MyHandlers/GetAddressesByPostalCodesHandlerTests.verified.cs new file mode 100644 index 000000000..6ab0c28d8 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Addresses/MyHandlers/GetAddressesByPostalCodesHandlerTests.verified.cs @@ -0,0 +1,14 @@ +namespace Structure1.Domain.Tests.Addresses.MyHandlers; + +public class GetAddressesByPostalCodesHandlerTests +{ + [Fact(Skip = "Change this to a real test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/EventArgs/MyHandlers/GetEventArgByIdHandlerTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/EventArgs/MyHandlers/GetEventArgByIdHandlerTests.verified.cs new file mode 100644 index 000000000..765256080 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/EventArgs/MyHandlers/GetEventArgByIdHandlerTests.verified.cs @@ -0,0 +1,14 @@ +namespace Structure1.Domain.Tests.EventArgs.MyHandlers; + +public class GetEventArgByIdHandlerTests +{ + [Fact(Skip = "Change this to a real test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/EventArgs/MyHandlers/GetEventArgsHandlerTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/EventArgs/MyHandlers/GetEventArgsHandlerTests.verified.cs new file mode 100644 index 000000000..0084c1603 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/EventArgs/MyHandlers/GetEventArgsHandlerTests.verified.cs @@ -0,0 +1,14 @@ +namespace Structure1.Domain.Tests.EventArgs.MyHandlers; + +public class GetEventArgsHandlerTests +{ + [Fact(Skip = "Change this to a real test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Files/MyHandlers/GetFileByIdHandlerTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Files/MyHandlers/GetFileByIdHandlerTests.verified.cs new file mode 100644 index 000000000..0a2401436 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Files/MyHandlers/GetFileByIdHandlerTests.verified.cs @@ -0,0 +1,14 @@ +namespace Structure1.Domain.Tests.Files.MyHandlers; + +public class GetFileByIdHandlerTests +{ + [Fact(Skip = "Change this to a real test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Files/MyHandlers/UploadMultiFilesAsFormDataHandlerTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Files/MyHandlers/UploadMultiFilesAsFormDataHandlerTests.verified.cs new file mode 100644 index 000000000..41d7bf7d8 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Files/MyHandlers/UploadMultiFilesAsFormDataHandlerTests.verified.cs @@ -0,0 +1,14 @@ +namespace Structure1.Domain.Tests.Files.MyHandlers; + +public class UploadMultiFilesAsFormDataHandlerTests +{ + [Fact(Skip = "Change this to a real test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Files/MyHandlers/UploadSingleFileAsFormDataHandlerTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Files/MyHandlers/UploadSingleFileAsFormDataHandlerTests.verified.cs new file mode 100644 index 000000000..27ec01758 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Files/MyHandlers/UploadSingleFileAsFormDataHandlerTests.verified.cs @@ -0,0 +1,14 @@ +namespace Structure1.Domain.Tests.Files.MyHandlers; + +public class UploadSingleFileAsFormDataHandlerTests +{ + [Fact(Skip = "Change this to a real test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Files/MyHandlers/UploadSingleObjectWithFileAsFormDataHandlerTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Files/MyHandlers/UploadSingleObjectWithFileAsFormDataHandlerTests.verified.cs new file mode 100644 index 000000000..f15b9bda1 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Files/MyHandlers/UploadSingleObjectWithFileAsFormDataHandlerTests.verified.cs @@ -0,0 +1,14 @@ +namespace Structure1.Domain.Tests.Files.MyHandlers; + +public class UploadSingleObjectWithFileAsFormDataHandlerTests +{ + [Fact(Skip = "Change this to a real test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Files/MyHandlers/UploadSingleObjectWithFilesAsFormDataHandlerTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Files/MyHandlers/UploadSingleObjectWithFilesAsFormDataHandlerTests.verified.cs new file mode 100644 index 000000000..422d78547 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Files/MyHandlers/UploadSingleObjectWithFilesAsFormDataHandlerTests.verified.cs @@ -0,0 +1,14 @@ +namespace Structure1.Domain.Tests.Files.MyHandlers; + +public class UploadSingleObjectWithFilesAsFormDataHandlerTests +{ + [Fact(Skip = "Change this to a real test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/GlobalUsings.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/GlobalUsings.verified.cs new file mode 100644 index 000000000..a611174c9 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/GlobalUsings.verified.cs @@ -0,0 +1 @@ +global using Xunit; \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Items/MyHandlers/CreateItemHandlerTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Items/MyHandlers/CreateItemHandlerTests.verified.cs new file mode 100644 index 000000000..147aa5fdd --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Items/MyHandlers/CreateItemHandlerTests.verified.cs @@ -0,0 +1,14 @@ +namespace Structure1.Domain.Tests.Items.MyHandlers; + +public class CreateItemHandlerTests +{ + [Fact(Skip = "Change this to a real test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Items/MyHandlers/UpdateItemHandlerTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Items/MyHandlers/UpdateItemHandlerTests.verified.cs new file mode 100644 index 000000000..10b06df06 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Items/MyHandlers/UpdateItemHandlerTests.verified.cs @@ -0,0 +1,14 @@ +namespace Structure1.Domain.Tests.Items.MyHandlers; + +public class UpdateItemHandlerTests +{ + [Fact(Skip = "Change this to a real test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Orders/MyHandlers/GetOrderByIdHandlerTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Orders/MyHandlers/GetOrderByIdHandlerTests.verified.cs new file mode 100644 index 000000000..7d1e1c202 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Orders/MyHandlers/GetOrderByIdHandlerTests.verified.cs @@ -0,0 +1,14 @@ +namespace Structure1.Domain.Tests.Orders.MyHandlers; + +public class GetOrderByIdHandlerTests +{ + [Fact(Skip = "Change this to a real test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Orders/MyHandlers/GetOrdersHandlerTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Orders/MyHandlers/GetOrdersHandlerTests.verified.cs new file mode 100644 index 000000000..0a2a466be --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Orders/MyHandlers/GetOrdersHandlerTests.verified.cs @@ -0,0 +1,14 @@ +namespace Structure1.Domain.Tests.Orders.MyHandlers; + +public class GetOrdersHandlerTests +{ + [Fact(Skip = "Change this to a real test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Orders/MyHandlers/PatchOrdersIdHandlerTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Orders/MyHandlers/PatchOrdersIdHandlerTests.verified.cs new file mode 100644 index 000000000..119e0887a --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Orders/MyHandlers/PatchOrdersIdHandlerTests.verified.cs @@ -0,0 +1,14 @@ +namespace Structure1.Domain.Tests.Orders.MyHandlers; + +public class PatchOrdersIdHandlerTests +{ + [Fact(Skip = "Change this to a real test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/RouteWithDash/MyHandlers/GetRouteWithDashHandlerTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/RouteWithDash/MyHandlers/GetRouteWithDashHandlerTests.verified.cs new file mode 100644 index 000000000..5a860cfe0 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/RouteWithDash/MyHandlers/GetRouteWithDashHandlerTests.verified.cs @@ -0,0 +1,14 @@ +namespace Structure1.Domain.Tests.RouteWithDash.MyHandlers; + +public class GetRouteWithDashHandlerTests +{ + [Fact(Skip = "Change this to a real test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Tasks/MyHandlers/GetTasksHandlerTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Tasks/MyHandlers/GetTasksHandlerTests.verified.cs new file mode 100644 index 000000000..373c9b225 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Tasks/MyHandlers/GetTasksHandlerTests.verified.cs @@ -0,0 +1,14 @@ +namespace Structure1.Domain.Tests.Tasks.MyHandlers; + +public class GetTasksHandlerTests +{ + [Fact(Skip = "Change this to a real test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Users/MyHandlers/DeleteUserByIdHandlerTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Users/MyHandlers/DeleteUserByIdHandlerTests.verified.cs new file mode 100644 index 000000000..e15b29f06 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Users/MyHandlers/DeleteUserByIdHandlerTests.verified.cs @@ -0,0 +1,14 @@ +namespace Structure1.Domain.Tests.Users.MyHandlers; + +public class DeleteUserByIdHandlerTests +{ + [Fact(Skip = "Change this to a real test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Users/MyHandlers/GetUserByEmailHandlerTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Users/MyHandlers/GetUserByEmailHandlerTests.verified.cs new file mode 100644 index 000000000..13b459c38 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Users/MyHandlers/GetUserByEmailHandlerTests.verified.cs @@ -0,0 +1,14 @@ +namespace Structure1.Domain.Tests.Users.MyHandlers; + +public class GetUserByEmailHandlerTests +{ + [Fact(Skip = "Change this to a real test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Users/MyHandlers/GetUserByIdHandlerTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Users/MyHandlers/GetUserByIdHandlerTests.verified.cs new file mode 100644 index 000000000..0cc5461fe --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Users/MyHandlers/GetUserByIdHandlerTests.verified.cs @@ -0,0 +1,14 @@ +namespace Structure1.Domain.Tests.Users.MyHandlers; + +public class GetUserByIdHandlerTests +{ + [Fact(Skip = "Change this to a real test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Users/MyHandlers/GetUsersHandlerTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Users/MyHandlers/GetUsersHandlerTests.verified.cs new file mode 100644 index 000000000..134d6b46c --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Users/MyHandlers/GetUsersHandlerTests.verified.cs @@ -0,0 +1,14 @@ +namespace Structure1.Domain.Tests.Users.MyHandlers; + +public class GetUsersHandlerTests +{ + [Fact(Skip = "Change this to a real test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Users/MyHandlers/PostUserHandlerTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Users/MyHandlers/PostUserHandlerTests.verified.cs new file mode 100644 index 000000000..18dcae505 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Users/MyHandlers/PostUserHandlerTests.verified.cs @@ -0,0 +1,14 @@ +namespace Structure1.Domain.Tests.Users.MyHandlers; + +public class PostUserHandlerTests +{ + [Fact(Skip = "Change this to a real test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Users/MyHandlers/UpdateMyTestGenderHandlerTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Users/MyHandlers/UpdateMyTestGenderHandlerTests.verified.cs new file mode 100644 index 000000000..88f693f7d --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Users/MyHandlers/UpdateMyTestGenderHandlerTests.verified.cs @@ -0,0 +1,14 @@ +namespace Structure1.Domain.Tests.Users.MyHandlers; + +public class UpdateMyTestGenderHandlerTests +{ + [Fact(Skip = "Change this to a real test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Users/MyHandlers/UpdateUserByIdHandlerTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Users/MyHandlers/UpdateUserByIdHandlerTests.verified.cs new file mode 100644 index 000000000..536ab855a --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WOPD/test/Structure1.Domain.Tests/Users/MyHandlers/UpdateUserByIdHandlerTests.verified.cs @@ -0,0 +1,14 @@ +namespace Structure1.Domain.Tests.Users.MyHandlers; + +public class UpdateUserByIdHandlerTests +{ + [Fact(Skip = "Change this to a real test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Accounts/MyContracts/Interfaces/ISetAccountNameHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Accounts/MyContracts/Interfaces/ISetAccountNameHandler.verified.cs new file mode 100644 index 000000000..80dbd1854 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Accounts/MyContracts/Interfaces/ISetAccountNameHandler.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Accounts.MyContracts; + +/// +/// Domain Interface for RequestHandler. +/// Description: Set name of account. +/// Operation: SetAccountName. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface ISetAccountNameHandler +{ + /// + /// Execute method. + /// + /// The parameters. + /// The cancellation token. + Task ExecuteAsync( + SetAccountNameParameters parameters, + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Accounts/MyContracts/Interfaces/IUpdateAccountNameHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Accounts/MyContracts/Interfaces/IUpdateAccountNameHandler.verified.cs new file mode 100644 index 000000000..12be463b5 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Accounts/MyContracts/Interfaces/IUpdateAccountNameHandler.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Accounts.MyContracts; + +/// +/// Domain Interface for RequestHandler. +/// Description: Update name of account. +/// Operation: UpdateAccountName. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IUpdateAccountNameHandler +{ + /// + /// Execute method. + /// + /// The parameters. + /// The cancellation token. + Task ExecuteAsync( + UpdateAccountNameParameters parameters, + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Accounts/MyContracts/Models/UpdateAccountRequest.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Accounts/MyContracts/Models/UpdateAccountRequest.verified.cs new file mode 100644 index 000000000..c56e8e07c --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Accounts/MyContracts/Models/UpdateAccountRequest.verified.cs @@ -0,0 +1,20 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Accounts.MyContracts; + +/// +/// UpdateAccountRequest. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateAccountRequest +{ + public string Name { get; set; } + + /// + public override string ToString() + => $"{nameof(Name)}: {Name}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Accounts/MyContracts/Parameters/SetAccountNameParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Accounts/MyContracts/Parameters/SetAccountNameParameters.verified.cs new file mode 100644 index 000000000..8da7147f5 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Accounts/MyContracts/Parameters/SetAccountNameParameters.verified.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Accounts.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Set name of account. +/// Operation: SetAccountName. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class SetAccountNameParameters +{ + /// + /// The accountId. + /// + [FromRoute(Name = "accountId")] + [Required] + public Guid AccountId { get; set; } + + /// + /// UpdateAccountRequest. + /// + [FromBody] + [Required] + public UpdateAccountRequest Request { get; set; } + + /// + public override string ToString() + => $"{nameof(AccountId)}: {AccountId}, {nameof(Request)}: ({Request})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Accounts/MyContracts/Parameters/UpdateAccountNameParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Accounts/MyContracts/Parameters/UpdateAccountNameParameters.verified.cs new file mode 100644 index 000000000..381922220 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Accounts/MyContracts/Parameters/UpdateAccountNameParameters.verified.cs @@ -0,0 +1,33 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Accounts.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Update name of account. +/// Operation: UpdateAccountName. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateAccountNameParameters +{ + /// + /// The accountId. + /// + [FromRoute(Name = "accountId")] + [Required] + public Guid AccountId { get; set; } + + /// + /// The account name. + /// + [FromHeader(Name = "name")] + public string? Name { get; set; } + + /// + public override string ToString() + => $"{nameof(AccountId)}: {AccountId}, {nameof(Name)}: {Name}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Accounts/MyContracts/Results/SetAccountNameResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Accounts/MyContracts/Results/SetAccountNameResult.verified.cs new file mode 100644 index 000000000..1ef3f6247 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Accounts/MyContracts/Results/SetAccountNameResult.verified.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Accounts.MyContracts; + +/// +/// Results for operation request. +/// Description: Set name of account. +/// Operation: SetAccountName. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class SetAccountNameResult : ResultBase +{ + private SetAccountNameResult(ActionResult result) : base(result) { } + + /// + /// 200 - Ok response. + /// + public static SetAccountNameResult Ok(string? message = null) + => new SetAccountNameResult(new OkObjectResult(message)); + + /// + /// Performs an implicit conversion from SetAccountNameResult to ActionResult. + /// + public static implicit operator SetAccountNameResult(string response) + => Ok(response); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Accounts/MyContracts/Results/UpdateAccountNameResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Accounts/MyContracts/Results/UpdateAccountNameResult.verified.cs new file mode 100644 index 000000000..493fb1a9e --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Accounts/MyContracts/Results/UpdateAccountNameResult.verified.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Accounts.MyContracts; + +/// +/// Results for operation request. +/// Description: Update name of account. +/// Operation: UpdateAccountName. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateAccountNameResult : ResultBase +{ + private UpdateAccountNameResult(ActionResult result) : base(result) { } + + /// + /// 200 - Ok response. + /// + public static UpdateAccountNameResult Ok(string? message = null) + => new UpdateAccountNameResult(new OkObjectResult(message)); + + /// + /// Performs an implicit conversion from UpdateAccountNameResult to ActionResult. + /// + public static implicit operator UpdateAccountNameResult(string response) + => Ok(response); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Addresses/MyContracts/Interfaces/IGetAddressesByPostalCodesHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Addresses/MyContracts/Interfaces/IGetAddressesByPostalCodesHandler.verified.cs new file mode 100644 index 000000000..5e1b3ecb2 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Addresses/MyContracts/Interfaces/IGetAddressesByPostalCodesHandler.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Addresses.MyContracts; + +/// +/// Domain Interface for RequestHandler. +/// Description: Get addresses by postal code. +/// Operation: GetAddressesByPostalCodes. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetAddressesByPostalCodesHandler +{ + /// + /// Execute method. + /// + /// The parameters. + /// The cancellation token. + Task ExecuteAsync( + GetAddressesByPostalCodesParameters parameters, + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Addresses/MyContracts/Parameters/GetAddressesByPostalCodesParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Addresses/MyContracts/Parameters/GetAddressesByPostalCodesParameters.verified.cs new file mode 100644 index 000000000..96bb43589 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Addresses/MyContracts/Parameters/GetAddressesByPostalCodesParameters.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Addresses.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Get addresses by postal code. +/// Operation: GetAddressesByPostalCodes. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetAddressesByPostalCodesParameters +{ + /// + /// The postalCode to limit addresses on. + /// + [FromRoute(Name = "postalCode")] + [Required] + public string PostalCode { get; set; } + + /// + public override string ToString() + => $"{nameof(PostalCode)}: {PostalCode}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Addresses/MyContracts/Results/GetAddressesByPostalCodesResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Addresses/MyContracts/Results/GetAddressesByPostalCodesResult.verified.cs new file mode 100644 index 000000000..1e63219ce --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Addresses/MyContracts/Results/GetAddressesByPostalCodesResult.verified.cs @@ -0,0 +1,36 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Addresses.MyContracts; + +/// +/// Results for operation request. +/// Description: Get addresses by postal code. +/// Operation: GetAddressesByPostalCodes. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetAddressesByPostalCodesResult : ResultBase +{ + private GetAddressesByPostalCodesResult(ActionResult result) : base(result) { } + + /// + /// 200 - Ok response. + /// + public static GetAddressesByPostalCodesResult Ok(IEnumerable
response) + => new GetAddressesByPostalCodesResult(new OkObjectResult(response ?? Enumerable.Empty
())); + + /// + /// 404 - NotFound response. + /// + public static GetAddressesByPostalCodesResult NotFound(string? message = null) + => new GetAddressesByPostalCodesResult(new NotFoundObjectResult(message)); + + /// + /// Performs an implicit conversion from GetAddressesByPostalCodesResult to ActionResult. + /// + public static implicit operator GetAddressesByPostalCodesResult(List
response) + => Ok(response); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/ApiRegistration.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/ApiRegistration.verified.cs new file mode 100644 index 000000000..24076909b --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/ApiRegistration.verified.cs @@ -0,0 +1,12 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class ApiRegistration +{ +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/EventArgs/MyContracts/Interfaces/IGetEventArgByIdHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/EventArgs/MyContracts/Interfaces/IGetEventArgByIdHandler.verified.cs new file mode 100644 index 000000000..3a4df487b --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/EventArgs/MyContracts/Interfaces/IGetEventArgByIdHandler.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.EventArgs.MyContracts; + +/// +/// Domain Interface for RequestHandler. +/// Description: Get EventArgs By Id. +/// Operation: GetEventArgById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetEventArgByIdHandler +{ + /// + /// Execute method. + /// + /// The parameters. + /// The cancellation token. + Task ExecuteAsync( + GetEventArgByIdParameters parameters, + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/EventArgs/MyContracts/Interfaces/IGetEventArgsHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/EventArgs/MyContracts/Interfaces/IGetEventArgsHandler.verified.cs new file mode 100644 index 000000000..95b0fb798 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/EventArgs/MyContracts/Interfaces/IGetEventArgsHandler.verified.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.EventArgs.MyContracts; + +/// +/// Domain Interface for RequestHandler. +/// Description: Get EventArgs List. +/// Operation: GetEventArgs. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetEventArgsHandler +{ + /// + /// Execute method. + /// + /// The cancellation token. + Task ExecuteAsync( + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/EventArgs/MyContracts/Models/EventArgs.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/EventArgs/MyContracts/Models/EventArgs.verified.cs new file mode 100644 index 000000000..7413b2af1 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/EventArgs/MyContracts/Models/EventArgs.verified.cs @@ -0,0 +1,22 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.EventArgs.MyContracts; + +/// +/// EventArgs. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class EventArgs +{ + public Guid Id { get; set; } + + public string EventName { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}, {nameof(EventName)}: {EventName}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/EventArgs/MyContracts/Parameters/GetEventArgByIdParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/EventArgs/MyContracts/Parameters/GetEventArgByIdParameters.verified.cs new file mode 100644 index 000000000..981212598 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/EventArgs/MyContracts/Parameters/GetEventArgByIdParameters.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.EventArgs.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Get EventArgs By Id. +/// Operation: GetEventArgById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetEventArgByIdParameters +{ + /// + /// The id of the eventArgs. + /// + [FromRoute(Name = "id")] + [Required] + public string Id { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/EventArgs/MyContracts/Results/GetEventArgByIdResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/EventArgs/MyContracts/Results/GetEventArgByIdResult.verified.cs new file mode 100644 index 000000000..950bfb1a5 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/EventArgs/MyContracts/Results/GetEventArgByIdResult.verified.cs @@ -0,0 +1,36 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.EventArgs.MyContracts; + +/// +/// Results for operation request. +/// Description: Get EventArgs By Id. +/// Operation: GetEventArgById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetEventArgByIdResult : ResultBase +{ + private GetEventArgByIdResult(ActionResult result) : base(result) { } + + /// + /// 200 - Ok response. + /// + public static GetEventArgByIdResult Ok(EventArgs response) + => new GetEventArgByIdResult(new OkObjectResult(response)); + + /// + /// 404 - NotFound response. + /// + public static GetEventArgByIdResult NotFound(string? message = null) + => new GetEventArgByIdResult(new NotFoundObjectResult(message)); + + /// + /// Performs an implicit conversion from GetEventArgByIdResult to ActionResult. + /// + public static implicit operator GetEventArgByIdResult(EventArgs response) + => Ok(response); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/EventArgs/MyContracts/Results/GetEventArgsResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/EventArgs/MyContracts/Results/GetEventArgsResult.verified.cs new file mode 100644 index 000000000..de0f1a0b5 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/EventArgs/MyContracts/Results/GetEventArgsResult.verified.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.EventArgs.MyContracts; + +/// +/// Results for operation request. +/// Description: Get EventArgs List. +/// Operation: GetEventArgs. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetEventArgsResult : ResultBase +{ + private GetEventArgsResult(ActionResult result) : base(result) { } + + /// + /// 200 - Ok response. + /// + public static GetEventArgsResult Ok(IEnumerable response) + => new GetEventArgsResult(new OkObjectResult(response ?? Enumerable.Empty())); + + /// + /// Performs an implicit conversion from GetEventArgsResult to ActionResult. + /// + public static implicit operator GetEventArgsResult(List response) + => Ok(response); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Files/MyContracts/Interfaces/IGetFileByIdHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Files/MyContracts/Interfaces/IGetFileByIdHandler.verified.cs new file mode 100644 index 000000000..a10a53e3e --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Files/MyContracts/Interfaces/IGetFileByIdHandler.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Files.MyContracts; + +/// +/// Domain Interface for RequestHandler. +/// Description: Get File By Id. +/// Operation: GetFileById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetFileByIdHandler +{ + /// + /// Execute method. + /// + /// The parameters. + /// The cancellation token. + Task ExecuteAsync( + GetFileByIdParameters parameters, + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Files/MyContracts/Interfaces/IUploadMultiFilesAsFormDataHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Files/MyContracts/Interfaces/IUploadMultiFilesAsFormDataHandler.verified.cs new file mode 100644 index 000000000..1ddda3760 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Files/MyContracts/Interfaces/IUploadMultiFilesAsFormDataHandler.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Files.MyContracts; + +/// +/// Domain Interface for RequestHandler. +/// Description: Upload multi files as form data. +/// Operation: UploadMultiFilesAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IUploadMultiFilesAsFormDataHandler +{ + /// + /// Execute method. + /// + /// The parameters. + /// The cancellation token. + Task ExecuteAsync( + UploadMultiFilesAsFormDataParameters parameters, + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Files/MyContracts/Interfaces/IUploadSingleFileAsFormDataHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Files/MyContracts/Interfaces/IUploadSingleFileAsFormDataHandler.verified.cs new file mode 100644 index 000000000..dcf66124e --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Files/MyContracts/Interfaces/IUploadSingleFileAsFormDataHandler.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Files.MyContracts; + +/// +/// Domain Interface for RequestHandler. +/// Description: Upload a file as OctetStream. +/// Operation: UploadSingleFileAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IUploadSingleFileAsFormDataHandler +{ + /// + /// Execute method. + /// + /// The parameters. + /// The cancellation token. + Task ExecuteAsync( + UploadSingleFileAsFormDataParameters parameters, + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Files/MyContracts/Interfaces/IUploadSingleObjectWithFileAsFormDataHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Files/MyContracts/Interfaces/IUploadSingleObjectWithFileAsFormDataHandler.verified.cs new file mode 100644 index 000000000..bdaeeac4c --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Files/MyContracts/Interfaces/IUploadSingleObjectWithFileAsFormDataHandler.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Files.MyContracts; + +/// +/// Domain Interface for RequestHandler. +/// Description: Upload a file as FormData. +/// Operation: UploadSingleObjectWithFileAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IUploadSingleObjectWithFileAsFormDataHandler +{ + /// + /// Execute method. + /// + /// The parameters. + /// The cancellation token. + Task ExecuteAsync( + UploadSingleObjectWithFileAsFormDataParameters parameters, + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Files/MyContracts/Interfaces/IUploadSingleObjectWithFilesAsFormDataHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Files/MyContracts/Interfaces/IUploadSingleObjectWithFilesAsFormDataHandler.verified.cs new file mode 100644 index 000000000..47e56e87e --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Files/MyContracts/Interfaces/IUploadSingleObjectWithFilesAsFormDataHandler.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Files.MyContracts; + +/// +/// Domain Interface for RequestHandler. +/// Description: Upload files as FormData. +/// Operation: UploadSingleObjectWithFilesAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IUploadSingleObjectWithFilesAsFormDataHandler +{ + /// + /// Execute method. + /// + /// The parameters. + /// The cancellation token. + Task ExecuteAsync( + UploadSingleObjectWithFilesAsFormDataParameters parameters, + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Files/MyContracts/Models/FileAsFormDataRequest.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Files/MyContracts/Models/FileAsFormDataRequest.verified.cs new file mode 100644 index 000000000..d187e1ed8 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Files/MyContracts/Models/FileAsFormDataRequest.verified.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Files.MyContracts; + +/// +/// FileAsFormDataRequest. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class FileAsFormDataRequest +{ + [Required] + public string ItemName { get; set; } + + public IFormFile? File { get; set; } + + [Required] + public List Items { get; set; } + + /// + public override string ToString() + => $"{nameof(ItemName)}: {ItemName}, {nameof(File)}: {File}, {nameof(Items)}.Count: {Items?.Count ?? 0}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Files/MyContracts/Models/FilesAsFormDataRequest.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Files/MyContracts/Models/FilesAsFormDataRequest.verified.cs new file mode 100644 index 000000000..1c0728c6b --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Files/MyContracts/Models/FilesAsFormDataRequest.verified.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Files.MyContracts; + +/// +/// FilesAsFormDataRequest. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class FilesAsFormDataRequest +{ + /// + /// A list of File(s). + /// + public List Files { get; set; } = new List(); + + /// + public override string ToString() + => $"{nameof(Files)}.Count: {Files?.Count ?? 0}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Files/MyContracts/Parameters/GetFileByIdParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Files/MyContracts/Parameters/GetFileByIdParameters.verified.cs new file mode 100644 index 000000000..5f0edff2b --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Files/MyContracts/Parameters/GetFileByIdParameters.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Files.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Get File By Id. +/// Operation: GetFileById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetFileByIdParameters +{ + /// + /// The file id. + /// + [FromRoute(Name = "id")] + [Required] + public string Id { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Files/MyContracts/Parameters/UploadMultiFilesAsFormDataParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Files/MyContracts/Parameters/UploadMultiFilesAsFormDataParameters.verified.cs new file mode 100644 index 000000000..ba7c1aa55 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Files/MyContracts/Parameters/UploadMultiFilesAsFormDataParameters.verified.cs @@ -0,0 +1,24 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Files.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Upload multi files as form data. +/// Operation: UploadMultiFilesAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UploadMultiFilesAsFormDataParameters +{ + [FromForm] + [Required] + public List Request { get; set; } = new List(); + + /// + public override string ToString() + => $"{nameof(Request)}.Count: {Request?.Count ?? 0}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Files/MyContracts/Parameters/UploadSingleFileAsFormDataParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Files/MyContracts/Parameters/UploadSingleFileAsFormDataParameters.verified.cs new file mode 100644 index 000000000..b761ea16d --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Files/MyContracts/Parameters/UploadSingleFileAsFormDataParameters.verified.cs @@ -0,0 +1,24 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Files.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Upload a file as OctetStream. +/// Operation: UploadSingleFileAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UploadSingleFileAsFormDataParameters +{ + [FromBody] + [Required] + public IFormFile Request { get; set; } + + /// + public override string ToString() + => $"{nameof(Request)}: ({Request})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Files/MyContracts/Parameters/UploadSingleObjectWithFileAsFormDataParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Files/MyContracts/Parameters/UploadSingleObjectWithFileAsFormDataParameters.verified.cs new file mode 100644 index 000000000..2afbb0b39 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Files/MyContracts/Parameters/UploadSingleObjectWithFileAsFormDataParameters.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Files.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Upload a file as FormData. +/// Operation: UploadSingleObjectWithFileAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UploadSingleObjectWithFileAsFormDataParameters +{ + /// + /// FileAsFormDataRequest. + /// + [FromForm] + [Required] + public FileAsFormDataRequest Request { get; set; } + + /// + public override string ToString() + => $"{nameof(Request)}: ({Request})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Files/MyContracts/Parameters/UploadSingleObjectWithFilesAsFormDataParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Files/MyContracts/Parameters/UploadSingleObjectWithFilesAsFormDataParameters.verified.cs new file mode 100644 index 000000000..a80165b8a --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Files/MyContracts/Parameters/UploadSingleObjectWithFilesAsFormDataParameters.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Files.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Upload files as FormData. +/// Operation: UploadSingleObjectWithFilesAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UploadSingleObjectWithFilesAsFormDataParameters +{ + /// + /// FilesAsFormDataRequest. + /// + [FromForm] + [Required] + public FilesAsFormDataRequest Request { get; set; } + + /// + public override string ToString() + => $"{nameof(Request)}: ({Request})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Files/MyContracts/Results/GetFileByIdResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Files/MyContracts/Results/GetFileByIdResult.verified.cs new file mode 100644 index 000000000..6d5e1b715 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Files/MyContracts/Results/GetFileByIdResult.verified.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Files.MyContracts; + +/// +/// Results for operation request. +/// Description: Get File By Id. +/// Operation: GetFileById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetFileByIdResult : ResultBase +{ + private GetFileByIdResult(ActionResult result) : base(result) { } + + /// + /// 200 - Ok response. + /// + public static GetFileByIdResult Ok(byte[] bytes, string fileName) + => new GetFileByIdResult(ResultFactory.CreateFileContentResult(bytes, fileName)); + + /// + /// 404 - NotFound response. + /// + public static GetFileByIdResult NotFound(string? message = null) + => new GetFileByIdResult(new NotFoundObjectResult(message)); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Files/MyContracts/Results/UploadMultiFilesAsFormDataResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Files/MyContracts/Results/UploadMultiFilesAsFormDataResult.verified.cs new file mode 100644 index 000000000..8b8f0b690 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Files/MyContracts/Results/UploadMultiFilesAsFormDataResult.verified.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Files.MyContracts; + +/// +/// Results for operation request. +/// Description: Upload multi files as form data. +/// Operation: UploadMultiFilesAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UploadMultiFilesAsFormDataResult : ResultBase +{ + private UploadMultiFilesAsFormDataResult(ActionResult result) : base(result) { } + + /// + /// 200 - Ok response. + /// + public static UploadMultiFilesAsFormDataResult Ok(string? message = null) + => new UploadMultiFilesAsFormDataResult(new OkObjectResult(message)); + + /// + /// Performs an implicit conversion from UploadMultiFilesAsFormDataResult to ActionResult. + /// + public static implicit operator UploadMultiFilesAsFormDataResult(string response) + => Ok(response); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Files/MyContracts/Results/UploadSingleFileAsFormDataResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Files/MyContracts/Results/UploadSingleFileAsFormDataResult.verified.cs new file mode 100644 index 000000000..1a3604161 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Files/MyContracts/Results/UploadSingleFileAsFormDataResult.verified.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Files.MyContracts; + +/// +/// Results for operation request. +/// Description: Upload a file as OctetStream. +/// Operation: UploadSingleFileAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UploadSingleFileAsFormDataResult : ResultBase +{ + private UploadSingleFileAsFormDataResult(ActionResult result) : base(result) { } + + /// + /// 200 - Ok response. + /// + public static UploadSingleFileAsFormDataResult Ok(string? message = null) + => new UploadSingleFileAsFormDataResult(new OkObjectResult(message)); + + /// + /// Performs an implicit conversion from UploadSingleFileAsFormDataResult to ActionResult. + /// + public static implicit operator UploadSingleFileAsFormDataResult(string response) + => Ok(response); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Files/MyContracts/Results/UploadSingleObjectWithFileAsFormDataResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Files/MyContracts/Results/UploadSingleObjectWithFileAsFormDataResult.verified.cs new file mode 100644 index 000000000..3d3c939f4 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Files/MyContracts/Results/UploadSingleObjectWithFileAsFormDataResult.verified.cs @@ -0,0 +1,36 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Files.MyContracts; + +/// +/// Results for operation request. +/// Description: Upload a file as FormData. +/// Operation: UploadSingleObjectWithFileAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UploadSingleObjectWithFileAsFormDataResult : ResultBase +{ + private UploadSingleObjectWithFileAsFormDataResult(ActionResult result) : base(result) { } + + /// + /// 200 - Ok response. + /// + public static UploadSingleObjectWithFileAsFormDataResult Ok(string? message = null) + => new UploadSingleObjectWithFileAsFormDataResult(new OkObjectResult(message)); + + /// + /// 400 - BadRequest response. + /// + public static UploadSingleObjectWithFileAsFormDataResult BadRequest(string? message = null) + => new UploadSingleObjectWithFileAsFormDataResult(ResultFactory.CreateContentResultWithValidationProblemDetails(HttpStatusCode.BadRequest, message)); + + /// + /// Performs an implicit conversion from UploadSingleObjectWithFileAsFormDataResult to ActionResult. + /// + public static implicit operator UploadSingleObjectWithFileAsFormDataResult(string response) + => Ok(response); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Files/MyContracts/Results/UploadSingleObjectWithFilesAsFormDataResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Files/MyContracts/Results/UploadSingleObjectWithFilesAsFormDataResult.verified.cs new file mode 100644 index 000000000..b129b0ffa --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Files/MyContracts/Results/UploadSingleObjectWithFilesAsFormDataResult.verified.cs @@ -0,0 +1,36 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Files.MyContracts; + +/// +/// Results for operation request. +/// Description: Upload files as FormData. +/// Operation: UploadSingleObjectWithFilesAsFormData. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UploadSingleObjectWithFilesAsFormDataResult : ResultBase +{ + private UploadSingleObjectWithFilesAsFormDataResult(ActionResult result) : base(result) { } + + /// + /// 200 - Ok response. + /// + public static UploadSingleObjectWithFilesAsFormDataResult Ok(string? message = null) + => new UploadSingleObjectWithFilesAsFormDataResult(new OkObjectResult(message)); + + /// + /// 400 - BadRequest response. + /// + public static UploadSingleObjectWithFilesAsFormDataResult BadRequest(string? message = null) + => new UploadSingleObjectWithFilesAsFormDataResult(ResultFactory.CreateContentResultWithValidationProblemDetails(HttpStatusCode.BadRequest, message)); + + /// + /// Performs an implicit conversion from UploadSingleObjectWithFilesAsFormDataResult to ActionResult. + /// + public static implicit operator UploadSingleObjectWithFilesAsFormDataResult(string response) + => Ok(response); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/GlobalUsings.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/GlobalUsings.verified.cs new file mode 100644 index 000000000..a2569039d --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/GlobalUsings.verified.cs @@ -0,0 +1,20 @@ +global using System.CodeDom.Compiler; +global using System.ComponentModel.DataAnnotations; +global using System.Net; + +global using Atc.Rest.Results; + +global using Microsoft.AspNetCore.Authorization; +global using Microsoft.AspNetCore.Http; +global using Microsoft.AspNetCore.Mvc; + +global using Structure1.Api.Generated.Accounts.MyContracts; +global using Structure1.Api.Generated.Addresses.MyContracts; +global using Structure1.Api.Generated.EventArgs.MyContracts; +global using Structure1.Api.Generated.Files.MyContracts; +global using Structure1.Api.Generated.Items.MyContracts; +global using Structure1.Api.Generated.MyContracts; +global using Structure1.Api.Generated.Orders.MyContracts; +global using Structure1.Api.Generated.RouteWithDash.MyContracts; +global using Structure1.Api.Generated.Tasks.MyContracts; +global using Structure1.Api.Generated.Users.MyContracts; \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Items/MyContracts/Interfaces/ICreateItemHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Items/MyContracts/Interfaces/ICreateItemHandler.verified.cs new file mode 100644 index 000000000..e6c623a37 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Items/MyContracts/Interfaces/ICreateItemHandler.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Items.MyContracts; + +/// +/// Domain Interface for RequestHandler. +/// Description: Create a new item. +/// Operation: CreateItem. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface ICreateItemHandler +{ + /// + /// Execute method. + /// + /// The parameters. + /// The cancellation token. + Task ExecuteAsync( + CreateItemParameters parameters, + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Items/MyContracts/Interfaces/IUpdateItemHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Items/MyContracts/Interfaces/IUpdateItemHandler.verified.cs new file mode 100644 index 000000000..cb7998fd5 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Items/MyContracts/Interfaces/IUpdateItemHandler.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Items.MyContracts; + +/// +/// Domain Interface for RequestHandler. +/// Description: Updates an item. +/// Operation: UpdateItem. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IUpdateItemHandler +{ + /// + /// Execute method. + /// + /// The parameters. + /// The cancellation token. + Task ExecuteAsync( + UpdateItemParameters parameters, + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Items/MyContracts/Models/CreateItemRequest.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Items/MyContracts/Models/CreateItemRequest.verified.cs new file mode 100644 index 000000000..c5ca1f3b6 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Items/MyContracts/Models/CreateItemRequest.verified.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Items.MyContracts; + +/// +/// CreateItemRequest. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class CreateItemRequest +{ + /// + /// Item. + /// + [Required] + public Item Item { get; set; } + + /// + /// A list of Item. + /// + [Required] + public List MyItems { get; set; } + + /// + public override string ToString() + => $"{nameof(Item)}: ({Item}), {nameof(MyItems)}.Count: {MyItems?.Count ?? 0}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Items/MyContracts/Models/Item.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Items/MyContracts/Models/Item.verified.cs new file mode 100644 index 000000000..f44dd5fe6 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Items/MyContracts/Models/Item.verified.cs @@ -0,0 +1,21 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Items.MyContracts; + +/// +/// Item. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class Item +{ + [Required] + public string Name { get; set; } + + /// + public override string ToString() + => $"{nameof(Name)}: {Name}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Items/MyContracts/Models/UpdateItemRequest.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Items/MyContracts/Models/UpdateItemRequest.verified.cs new file mode 100644 index 000000000..e6c3179a6 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Items/MyContracts/Models/UpdateItemRequest.verified.cs @@ -0,0 +1,24 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Items.MyContracts; + +/// +/// UpdateItemRequest. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateItemRequest +{ + /// + /// Item. + /// + [Required] + public Item Item { get; set; } + + /// + public override string ToString() + => $"{nameof(Item)}: ({Item})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Items/MyContracts/Parameters/CreateItemParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Items/MyContracts/Parameters/CreateItemParameters.verified.cs new file mode 100644 index 000000000..19e052aa9 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Items/MyContracts/Parameters/CreateItemParameters.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Items.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Create a new item. +/// Operation: CreateItem. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class CreateItemParameters +{ + /// + /// CreateItemRequest. + /// + [FromBody] + [Required] + public CreateItemRequest Request { get; set; } + + /// + public override string ToString() + => $"{nameof(Request)}: ({Request})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Items/MyContracts/Parameters/UpdateItemParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Items/MyContracts/Parameters/UpdateItemParameters.verified.cs new file mode 100644 index 000000000..b414f536e --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Items/MyContracts/Parameters/UpdateItemParameters.verified.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Items.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Updates an item. +/// Operation: UpdateItem. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateItemParameters +{ + /// + /// The id of the order. + /// + [FromRoute(Name = "id")] + [Required] + public Guid Id { get; set; } + + /// + /// UpdateItemRequest. + /// + [FromBody] + [Required] + public UpdateItemRequest Request { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}, {nameof(Request)}: ({Request})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Items/MyContracts/Results/CreateItemResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Items/MyContracts/Results/CreateItemResult.verified.cs new file mode 100644 index 000000000..a7b01b9d8 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Items/MyContracts/Results/CreateItemResult.verified.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Items.MyContracts; + +/// +/// Results for operation request. +/// Description: Create a new item. +/// Operation: CreateItem. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class CreateItemResult : ResultBase +{ + private CreateItemResult(ActionResult result) : base(result) { } + + /// + /// 200 - Ok response. + /// + public static CreateItemResult Ok(string? message = null) + => new CreateItemResult(new OkObjectResult(message)); + + /// + /// Performs an implicit conversion from CreateItemResult to ActionResult. + /// + public static implicit operator CreateItemResult(string response) + => Ok(response); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Items/MyContracts/Results/UpdateItemResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Items/MyContracts/Results/UpdateItemResult.verified.cs new file mode 100644 index 000000000..4cb56f23d --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Items/MyContracts/Results/UpdateItemResult.verified.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Items.MyContracts; + +/// +/// Results for operation request. +/// Description: Updates an item. +/// Operation: UpdateItem. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateItemResult : ResultBase +{ + private UpdateItemResult(ActionResult result) : base(result) { } + + /// + /// 200 - Ok response. + /// + public static UpdateItemResult Ok(Guid response) + => new UpdateItemResult(new OkObjectResult(response)); + + /// + /// Performs an implicit conversion from UpdateItemResult to ActionResult. + /// + public static implicit operator UpdateItemResult(Guid response) + => Ok(response); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/MyContracts/_EnumerationTypes/ColorType.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/MyContracts/_EnumerationTypes/ColorType.verified.cs new file mode 100644 index 000000000..3df9ddd51 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/MyContracts/_EnumerationTypes/ColorType.verified.cs @@ -0,0 +1,21 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.MyContracts; + +/// +/// Enumeration: ColorType. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +[Flags] +public enum ColorType +{ + None = 0, + Black = 1, + White = 2, + Yellow = 4, + Red = 8, +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/MyContracts/_EnumerationTypes/GenderType.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/MyContracts/_EnumerationTypes/GenderType.verified.cs new file mode 100644 index 000000000..fbdaffc77 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/MyContracts/_EnumerationTypes/GenderType.verified.cs @@ -0,0 +1,19 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.MyContracts; + +/// +/// Enumeration: GenderType. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public enum GenderType +{ + None, + NonBinary, + Male, + Female, +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/MyContracts/_Shared/Address.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/MyContracts/_Shared/Address.verified.cs new file mode 100644 index 000000000..6df154843 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/MyContracts/_Shared/Address.verified.cs @@ -0,0 +1,32 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.MyContracts; + +/// +/// Address. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class Address +{ + [StringLength(255)] + public string StreetName { get; set; } + + public string StreetNumber { get; set; } + + public string PostalCode { get; set; } + + public string CityName { get; set; } + + /// + /// Country. + /// + public Country MyCountry { get; set; } + + /// + public override string ToString() + => $"{nameof(StreetName)}: {StreetName}, {nameof(StreetNumber)}: {StreetNumber}, {nameof(PostalCode)}: {PostalCode}, {nameof(CityName)}: {CityName}, {nameof(MyCountry)}: ({MyCountry})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/MyContracts/_Shared/Country.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/MyContracts/_Shared/Country.verified.cs new file mode 100644 index 000000000..92f9e91cd --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/MyContracts/_Shared/Country.verified.cs @@ -0,0 +1,33 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.MyContracts; + +/// +/// Country. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class Country +{ + [Required] + public string Name { get; set; } + + [Required] + [MinLength(2)] + [MaxLength(2)] + [RegularExpression("^[A-Za-z]{2}$")] + public string Alpha2Code { get; set; } + + [Required] + [MinLength(3)] + [MaxLength(3)] + [RegularExpression("^[A-Za-z]{3}$")] + public string Alpha3Code { get; set; } + + /// + public override string ToString() + => $"{nameof(Name)}: {Name}, {nameof(Alpha2Code)}: {Alpha2Code}, {nameof(Alpha3Code)}: {Alpha3Code}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/MyEndpoints/AccountsController.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/MyEndpoints/AccountsController.verified.cs new file mode 100644 index 000000000..9123238c6 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/MyEndpoints/AccountsController.verified.cs @@ -0,0 +1,42 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.MyEndpoints; + +/// +/// Endpoint definitions. +/// +[ApiController] +[Route("/api/v1/accounts")] +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public sealed class AccountsController : ControllerBase +{ + /// + /// Description: Update name of account. + /// Operation: UpdateAccountName. + /// + [HttpPut("{accountId}/name")] + [ProducesResponseType(typeof(string), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] + public async Task UpdateAccountName( + UpdateAccountNameParameters parameters, + [FromServices] IUpdateAccountNameHandler handler, + CancellationToken cancellationToken) + => await handler.ExecuteAsync(parameters, cancellationToken); + + /// + /// Description: Set name of account. + /// Operation: SetAccountName. + /// + [HttpPost("{accountId}/name")] + [ProducesResponseType(typeof(string), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] + public async Task SetAccountName( + SetAccountNameParameters parameters, + [FromServices] ISetAccountNameHandler handler, + CancellationToken cancellationToken) + => await handler.ExecuteAsync(parameters, cancellationToken); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/MyEndpoints/AddressesController.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/MyEndpoints/AddressesController.verified.cs new file mode 100644 index 000000000..c5b7c3c75 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/MyEndpoints/AddressesController.verified.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.MyEndpoints; + +/// +/// Endpoint definitions. +/// +[ApiController] +[Route("/api/v1/addresses")] +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public sealed class AddressesController : ControllerBase +{ + /// + /// Description: Get addresses by postal code. + /// Operation: GetAddressesByPostalCodes. + /// + [HttpGet("{postalCode}")] + [ProducesResponseType(typeof(IEnumerable
), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] + [ProducesResponseType(typeof(string), StatusCodes.Status404NotFound)] + public async Task GetAddressesByPostalCodes( + GetAddressesByPostalCodesParameters parameters, + [FromServices] IGetAddressesByPostalCodesHandler handler, + CancellationToken cancellationToken) + => await handler.ExecuteAsync(parameters, cancellationToken); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/MyEndpoints/EventArgsController.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/MyEndpoints/EventArgsController.verified.cs new file mode 100644 index 000000000..1db8993d0 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/MyEndpoints/EventArgsController.verified.cs @@ -0,0 +1,41 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.MyEndpoints; + +/// +/// Endpoint definitions. +/// +[ApiController] +[Route("/api/v1/eventArgs")] +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public sealed class EventArgsController : ControllerBase +{ + /// + /// Description: Get EventArgs List. + /// Operation: GetEventArgs. + /// + [HttpGet] + [ProducesResponseType(typeof(IEnumerable), StatusCodes.Status200OK)] + public async Task GetEventArgs( + [FromServices] IGetEventArgsHandler handler, + CancellationToken cancellationToken) + => await handler.ExecuteAsync(cancellationToken); + + /// + /// Description: Get EventArgs By Id. + /// Operation: GetEventArgById. + /// + [HttpGet("{id}")] + [ProducesResponseType(typeof(Contracts.EventArgs.EventArgs), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] + [ProducesResponseType(typeof(string), StatusCodes.Status404NotFound)] + public async Task GetEventArgById( + GetEventArgByIdParameters parameters, + [FromServices] IGetEventArgByIdHandler handler, + CancellationToken cancellationToken) + => await handler.ExecuteAsync(parameters, cancellationToken); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/MyEndpoints/FilesController.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/MyEndpoints/FilesController.verified.cs new file mode 100644 index 000000000..c0ac6a3b7 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/MyEndpoints/FilesController.verified.cs @@ -0,0 +1,86 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.MyEndpoints; + +/// +/// Endpoint definitions. +/// +[ApiController] +[Route("/api/v1/files")] +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public sealed class FilesController : ControllerBase +{ + /// + /// Description: Upload multi files as form data. + /// Operation: UploadMultiFilesAsFormData. + /// + [HttpPost("form-data/multiFile")] + [RequestFormLimits(MultipartBodyLengthLimit = long.MaxValue)] + [ProducesResponseType(typeof(string), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] + public async Task UploadMultiFilesAsFormData( + UploadMultiFilesAsFormDataParameters parameters, + [FromServices] IUploadMultiFilesAsFormDataHandler handler, + CancellationToken cancellationToken) + => await handler.ExecuteAsync(parameters, cancellationToken); + + /// + /// Description: Upload a file as OctetStream. + /// Operation: UploadSingleFileAsFormData. + /// + [HttpPost("form-data/singleFile")] + [RequestFormLimits(MultipartBodyLengthLimit = long.MaxValue)] + [ProducesResponseType(typeof(string), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] + public async Task UploadSingleFileAsFormData( + UploadSingleFileAsFormDataParameters parameters, + [FromServices] IUploadSingleFileAsFormDataHandler handler, + CancellationToken cancellationToken) + => await handler.ExecuteAsync(parameters, cancellationToken); + + /// + /// Description: Upload a file as FormData. + /// Operation: UploadSingleObjectWithFileAsFormData. + /// + [HttpPost("form-data/singleObject")] + [RequestFormLimits(MultipartBodyLengthLimit = long.MaxValue)] + [ProducesResponseType(typeof(string), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] + public async Task UploadSingleObjectWithFileAsFormData( + UploadSingleObjectWithFileAsFormDataParameters parameters, + [FromServices] IUploadSingleObjectWithFileAsFormDataHandler handler, + CancellationToken cancellationToken) + => await handler.ExecuteAsync(parameters, cancellationToken); + + /// + /// Description: Upload files as FormData. + /// Operation: UploadSingleObjectWithFilesAsFormData. + /// + [HttpPost("form-data/singleObjectMultiFile")] + [RequestFormLimits(MultipartBodyLengthLimit = long.MaxValue)] + [ProducesResponseType(typeof(string), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] + public async Task UploadSingleObjectWithFilesAsFormData( + UploadSingleObjectWithFilesAsFormDataParameters parameters, + [FromServices] IUploadSingleObjectWithFilesAsFormDataHandler handler, + CancellationToken cancellationToken) + => await handler.ExecuteAsync(parameters, cancellationToken); + + /// + /// Description: Get File By Id. + /// Operation: GetFileById. + /// + [HttpGet("{id}")] + [ProducesResponseType(typeof(byte[]), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] + [ProducesResponseType(typeof(string), StatusCodes.Status404NotFound)] + public async Task GetFileById( + GetFileByIdParameters parameters, + [FromServices] IGetFileByIdHandler handler, + CancellationToken cancellationToken) + => await handler.ExecuteAsync(parameters, cancellationToken); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/MyEndpoints/ItemsController.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/MyEndpoints/ItemsController.verified.cs new file mode 100644 index 000000000..b09c525b4 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/MyEndpoints/ItemsController.verified.cs @@ -0,0 +1,42 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.MyEndpoints; + +/// +/// Endpoint definitions. +/// +[ApiController] +[Route("/api/v1/items")] +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public sealed class ItemsController : ControllerBase +{ + /// + /// Description: Create a new item. + /// Operation: CreateItem. + /// + [HttpPost] + [ProducesResponseType(typeof(string), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] + public async Task CreateItem( + CreateItemParameters parameters, + [FromServices] ICreateItemHandler handler, + CancellationToken cancellationToken) + => await handler.ExecuteAsync(parameters, cancellationToken); + + /// + /// Description: Updates an item. + /// Operation: UpdateItem. + /// + [HttpPut("{id}")] + [ProducesResponseType(typeof(Guid), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] + public async Task UpdateItem( + UpdateItemParameters parameters, + [FromServices] IUpdateItemHandler handler, + CancellationToken cancellationToken) + => await handler.ExecuteAsync(parameters, cancellationToken); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/MyEndpoints/OrdersController.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/MyEndpoints/OrdersController.verified.cs new file mode 100644 index 000000000..27cba5e63 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/MyEndpoints/OrdersController.verified.cs @@ -0,0 +1,66 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.MyEndpoints; + +/// +/// Endpoint definitions. +/// +[Authorize] +[ApiController] +[Route("/api/v1/orders")] +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public sealed class OrdersController : ControllerBase +{ + /// + /// Description: Get orders. + /// Operation: GetOrders. + /// + [HttpGet] + [ProducesResponseType(typeof(Pagination), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] + [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status401Unauthorized)] + [ProducesResponseType(typeof(string), StatusCodes.Status404NotFound)] + public async Task GetOrders( + GetOrdersParameters parameters, + [FromServices] IGetOrdersHandler handler, + CancellationToken cancellationToken) + => await handler.ExecuteAsync(parameters, cancellationToken); + + /// + /// Description: Get order by id. + /// Operation: GetOrderById. + /// + [AllowAnonymous] + [HttpGet("{id}")] + [ProducesResponseType(typeof(Order), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] + [ProducesResponseType(typeof(string), StatusCodes.Status404NotFound)] + public async Task GetOrderById( + GetOrderByIdParameters parameters, + [FromServices] IGetOrderByIdHandler handler, + CancellationToken cancellationToken) + => await handler.ExecuteAsync(parameters, cancellationToken); + + /// + /// Description: Update part of order by id. + /// Operation: PatchOrdersId. + /// + [Authorize(Roles = "admin,operator")] + [HttpPatch("{id}")] + [ProducesResponseType(typeof(string), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] + [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status401Unauthorized)] + [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status403Forbidden)] + [ProducesResponseType(typeof(string), StatusCodes.Status404NotFound)] + [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status409Conflict)] + [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status502BadGateway)] + public async Task PatchOrdersId( + PatchOrdersIdParameters parameters, + [FromServices] IPatchOrdersIdHandler handler, + CancellationToken cancellationToken) + => await handler.ExecuteAsync(parameters, cancellationToken); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/MyEndpoints/RouteWithDashController.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/MyEndpoints/RouteWithDashController.verified.cs new file mode 100644 index 000000000..e654e78c6 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/MyEndpoints/RouteWithDashController.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.MyEndpoints; + +/// +/// Endpoint definitions. +/// +[ApiController] +[Route("/api/v1/route-with-dash")] +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public sealed class RouteWithDashController : ControllerBase +{ + /// + /// Description: Your GET endpoint. + /// Operation: GetRouteWithDash. + /// + [HttpGet] + [ProducesResponseType(typeof(string), StatusCodes.Status200OK)] + public async Task GetRouteWithDash( + [FromServices] IGetRouteWithDashHandler handler, + CancellationToken cancellationToken) + => await handler.ExecuteAsync(cancellationToken); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/MyEndpoints/TasksController.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/MyEndpoints/TasksController.verified.cs new file mode 100644 index 000000000..0c6b92783 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/MyEndpoints/TasksController.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.MyEndpoints; + +/// +/// Endpoint definitions. +/// +[ApiController] +[Route("/api/v1/tasks")] +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public sealed class TasksController : ControllerBase +{ + /// + /// Description: Returns tasks. + /// Operation: GetTasks. + /// + [HttpGet] + [ProducesResponseType(typeof(IEnumerable), StatusCodes.Status200OK)] + public async Task GetTasks( + [FromServices] IGetTasksHandler handler, + CancellationToken cancellationToken) + => await handler.ExecuteAsync(cancellationToken); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/MyEndpoints/UsersController.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/MyEndpoints/UsersController.verified.cs new file mode 100644 index 000000000..f041102f0 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/MyEndpoints/UsersController.verified.cs @@ -0,0 +1,117 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.MyEndpoints; + +/// +/// Endpoint definitions. +/// +[ApiController] +[Route("/api/v1/users")] +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public sealed class UsersController : ControllerBase +{ + /// + /// Description: Get all users. + /// Operation: GetUsers. + /// + [HttpGet] + [ProducesResponseType(typeof(IEnumerable), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status409Conflict)] + public async Task GetUsers( + [FromServices] IGetUsersHandler handler, + CancellationToken cancellationToken) + => await handler.ExecuteAsync(cancellationToken); + + /// + /// Description: Create a new user. + /// Operation: PostUser. + /// + [HttpPost] + [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status201Created)] + [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] + [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status409Conflict)] + public async Task PostUser( + PostUserParameters parameters, + [FromServices] IPostUserHandler handler, + CancellationToken cancellationToken) + => await handler.ExecuteAsync(parameters, cancellationToken); + + /// + /// Description: Get user by email. + /// Operation: GetUserByEmail. + /// + [HttpGet("email")] + [ProducesResponseType(typeof(User), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] + [ProducesResponseType(typeof(string), StatusCodes.Status404NotFound)] + [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status409Conflict)] + public async Task GetUserByEmail( + GetUserByEmailParameters parameters, + [FromServices] IGetUserByEmailHandler handler, + CancellationToken cancellationToken) + => await handler.ExecuteAsync(parameters, cancellationToken); + + /// + /// Description: Get user by id. + /// Operation: GetUserById. + /// + [HttpGet("{id}")] + [ProducesResponseType(typeof(User), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] + [ProducesResponseType(typeof(string), StatusCodes.Status404NotFound)] + [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status409Conflict)] + public async Task GetUserById( + GetUserByIdParameters parameters, + [FromServices] IGetUserByIdHandler handler, + CancellationToken cancellationToken) + => await handler.ExecuteAsync(parameters, cancellationToken); + + /// + /// Description: Update user by id. + /// Operation: UpdateUserById. + /// + [HttpPut("{id}")] + [ProducesResponseType(typeof(string), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] + [ProducesResponseType(typeof(string), StatusCodes.Status404NotFound)] + [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status409Conflict)] + public async Task UpdateUserById( + UpdateUserByIdParameters parameters, + [FromServices] IUpdateUserByIdHandler handler, + CancellationToken cancellationToken) + => await handler.ExecuteAsync(parameters, cancellationToken); + + /// + /// Description: Delete user by id. + /// Operation: DeleteUserById. + /// + [HttpDelete("{id}")] + [ProducesResponseType(typeof(string), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] + [ProducesResponseType(typeof(string), StatusCodes.Status404NotFound)] + [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status409Conflict)] + public async Task DeleteUserById( + DeleteUserByIdParameters parameters, + [FromServices] IDeleteUserByIdHandler handler, + CancellationToken cancellationToken) + => await handler.ExecuteAsync(parameters, cancellationToken); + + /// + /// Description: Update gender on a user. + /// Operation: UpdateMyTestGender. + /// + [HttpPut("{id}/gender")] + [ProducesResponseType(typeof(string), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] + [ProducesResponseType(typeof(string), StatusCodes.Status404NotFound)] + [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status409Conflict)] + public async Task UpdateMyTestGender( + UpdateMyTestGenderParameters parameters, + [FromServices] IUpdateMyTestGenderHandler handler, + CancellationToken cancellationToken) + => await handler.ExecuteAsync(parameters, cancellationToken); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Orders/MyContracts/Interfaces/IGetOrderByIdHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Orders/MyContracts/Interfaces/IGetOrderByIdHandler.verified.cs new file mode 100644 index 000000000..3757a6f71 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Orders/MyContracts/Interfaces/IGetOrderByIdHandler.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Orders.MyContracts; + +/// +/// Domain Interface for RequestHandler. +/// Description: Get order by id. +/// Operation: GetOrderById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetOrderByIdHandler +{ + /// + /// Execute method. + /// + /// The parameters. + /// The cancellation token. + Task ExecuteAsync( + GetOrderByIdParameters parameters, + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Orders/MyContracts/Interfaces/IGetOrdersHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Orders/MyContracts/Interfaces/IGetOrdersHandler.verified.cs new file mode 100644 index 000000000..2c1d391d2 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Orders/MyContracts/Interfaces/IGetOrdersHandler.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Orders.MyContracts; + +/// +/// Domain Interface for RequestHandler. +/// Description: Get orders. +/// Operation: GetOrders. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetOrdersHandler +{ + /// + /// Execute method. + /// + /// The parameters. + /// The cancellation token. + Task ExecuteAsync( + GetOrdersParameters parameters, + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Orders/MyContracts/Interfaces/IPatchOrdersIdHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Orders/MyContracts/Interfaces/IPatchOrdersIdHandler.verified.cs new file mode 100644 index 000000000..4e2849e04 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Orders/MyContracts/Interfaces/IPatchOrdersIdHandler.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Orders.MyContracts; + +/// +/// Domain Interface for RequestHandler. +/// Description: Update part of order by id. +/// Operation: PatchOrdersId. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IPatchOrdersIdHandler +{ + /// + /// Execute method. + /// + /// The parameters. + /// The cancellation token. + Task ExecuteAsync( + PatchOrdersIdParameters parameters, + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Orders/MyContracts/Models/Order.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Orders/MyContracts/Models/Order.verified.cs new file mode 100644 index 000000000..c744d852d --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Orders/MyContracts/Models/Order.verified.cs @@ -0,0 +1,79 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Orders.MyContracts; + +/// +/// A single order. +/// Hallo description with multiline and no ending dot. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class Order +{ + public Guid Id { get; set; } + + public string Description { get; set; } + + public DateTimeOffset MyTime { get; set; } + + /// + /// Undefined description. + /// + /// + /// Email validation being enforced. + /// + [EmailAddress] + public string MyEmail { get; set; } = "a@a.com"; + + public DateTimeOffset? MyNullableDateTime { get; set; } + + public DateTimeOffset MyDateTime { get; set; } + + [Range(1.1, 20.2)] + public double MyNumber { get; set; } + + [Range(int.MinValue, 50)] + public int MyInteger { get; set; } = 15; + + /// + /// MyBool is great. + /// + public bool MyBool { get; set; } + + /// + /// This is the good uri :-). + /// + /// + /// Url validation being enforced. + /// + [Uri] + public Uri MyUri { get; set; } + + /// + /// Undefined description. + /// + /// + /// This string should be base64-encoded. + /// + public string MyByte { get; set; } + + /// + /// Hallo myStringList desc :-). + /// + public List MyStringList { get; set; } = new List(); + + [Range(10, int.MaxValue)] + public long MyLong { get; set; } + + /// + /// Address. + /// + public Address DeliveryAddress { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}, {nameof(Description)}: {Description}, {nameof(MyTime)}: ({MyTime}), {nameof(MyEmail)}: {MyEmail}, {nameof(MyNullableDateTime)}: ({MyNullableDateTime}), {nameof(MyDateTime)}: ({MyDateTime}), {nameof(MyNumber)}: {MyNumber}, {nameof(MyInteger)}: {MyInteger}, {nameof(MyBool)}: {MyBool}, {nameof(MyUri)}: ({MyUri}), {nameof(MyByte)}: {MyByte}, {nameof(MyStringList)}.Count: {MyStringList?.Count ?? 0}, {nameof(MyLong)}: {MyLong}, {nameof(DeliveryAddress)}: ({DeliveryAddress})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Orders/MyContracts/Models/UpdateOrderRequest.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Orders/MyContracts/Models/UpdateOrderRequest.verified.cs new file mode 100644 index 000000000..c94553357 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Orders/MyContracts/Models/UpdateOrderRequest.verified.cs @@ -0,0 +1,28 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Orders.MyContracts; + +/// +/// Request to update an order. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateOrderRequest +{ + /// + /// Undefined description. + /// + /// + /// Email validation being enforced. + /// + [Required] + [EmailAddress] + public string MyEmail { get; set; } + + /// + public override string ToString() + => $"{nameof(MyEmail)}: {MyEmail}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Orders/MyContracts/Parameters/GetOrderByIdParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Orders/MyContracts/Parameters/GetOrderByIdParameters.verified.cs new file mode 100644 index 000000000..e195efbd7 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Orders/MyContracts/Parameters/GetOrderByIdParameters.verified.cs @@ -0,0 +1,37 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Orders.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Get order by id. +/// Operation: GetOrderById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetOrderByIdParameters +{ + /// + /// The id of the order. + /// + [FromRoute(Name = "id")] + [Required] + public Guid Id { get; set; } + + /// + /// The email for filter orders to retrieve. + /// + /// + /// Email validation being enforced. + /// + [FromQuery] + [EmailAddress] + public string? MyEmail { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}, {nameof(MyEmail)}: {MyEmail}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Orders/MyContracts/Parameters/GetOrdersParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Orders/MyContracts/Parameters/GetOrdersParameters.verified.cs new file mode 100644 index 000000000..9b0631300 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Orders/MyContracts/Parameters/GetOrdersParameters.verified.cs @@ -0,0 +1,53 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Orders.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Get orders. +/// Operation: GetOrders. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetOrdersParameters +{ + /// + /// The numbers of items to return. + /// + [FromQuery] + [Required] + [Range(1, 100)] + public int PageSize { get; set; } = 10; + + /// + /// The number of items to skip before starting to collect the result set. + /// + [FromQuery] + [Range(0, 2147483647)] + public int PageIndex { get; set; } = 0; + + /// + /// The query string. + /// + [FromQuery] + public string? QueryString { get; set; } + + /// + /// The query array of string. + /// + [FromQuery] + public List QueryStringArray { get; set; } = new List(); + + /// + /// The continuation token. + /// + [FromQuery] + public string? ContinuationToken { get; set; } + + /// + public override string ToString() + => $"{nameof(PageSize)}: {PageSize}, {nameof(PageIndex)}: {PageIndex}, {nameof(QueryString)}: {QueryString}, {nameof(QueryStringArray)}.Count: {QueryStringArray?.Count ?? 0}, {nameof(ContinuationToken)}: {ContinuationToken}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Orders/MyContracts/Parameters/PatchOrdersIdParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Orders/MyContracts/Parameters/PatchOrdersIdParameters.verified.cs new file mode 100644 index 000000000..c3edea113 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Orders/MyContracts/Parameters/PatchOrdersIdParameters.verified.cs @@ -0,0 +1,62 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Orders.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Update part of order by id. +/// Operation: PatchOrdersId. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class PatchOrdersIdParameters +{ + /// + /// The id of the order. + /// + [FromRoute(Name = "id")] + [Required] + public Guid Id { get; set; } + + /// + /// The myTestHeader special key. + /// + [FromHeader(Name = "myTestHeader")] + [Required] + public string MyTestHeader { get; set; } + + /// + /// The myTestHeaderBool special key. + /// + [FromHeader(Name = "myTestHeaderBool")] + [Required] + public bool MyTestHeaderBool { get; set; } + + /// + /// The myTestHeaderInt special key. + /// + [FromHeader(Name = "myTestHeaderInt")] + [Required] + public int MyTestHeaderInt { get; set; } + + /// + /// The correlationId. + /// + [FromHeader(Name = "x-correlation-id")] + [Required] + public string CorrelationId { get; set; } + + /// + /// Request to update an order. + /// + [FromBody] + [Required] + public UpdateOrderRequest Request { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}, {nameof(MyTestHeader)}: {MyTestHeader}, {nameof(MyTestHeaderBool)}: {MyTestHeaderBool}, {nameof(MyTestHeaderInt)}: {MyTestHeaderInt}, {nameof(CorrelationId)}: {CorrelationId}, {nameof(Request)}: ({Request})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Orders/MyContracts/Results/GetOrderByIdResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Orders/MyContracts/Results/GetOrderByIdResult.verified.cs new file mode 100644 index 000000000..290184c7a --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Orders/MyContracts/Results/GetOrderByIdResult.verified.cs @@ -0,0 +1,36 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Orders.MyContracts; + +/// +/// Results for operation request. +/// Description: Get order by id. +/// Operation: GetOrderById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetOrderByIdResult : ResultBase +{ + private GetOrderByIdResult(ActionResult result) : base(result) { } + + /// + /// 200 - Ok response. + /// + public static GetOrderByIdResult Ok(Order response) + => new GetOrderByIdResult(new OkObjectResult(response)); + + /// + /// 404 - NotFound response. + /// + public static GetOrderByIdResult NotFound(string? message = null) + => new GetOrderByIdResult(new NotFoundObjectResult(message)); + + /// + /// Performs an implicit conversion from GetOrderByIdResult to ActionResult. + /// + public static implicit operator GetOrderByIdResult(Order response) + => Ok(response); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Orders/MyContracts/Results/GetOrdersResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Orders/MyContracts/Results/GetOrdersResult.verified.cs new file mode 100644 index 000000000..711fbb473 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Orders/MyContracts/Results/GetOrdersResult.verified.cs @@ -0,0 +1,36 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Orders.MyContracts; + +/// +/// Results for operation request. +/// Description: Get orders. +/// Operation: GetOrders. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetOrdersResult : ResultBase +{ + private GetOrdersResult(ActionResult result) : base(result) { } + + /// + /// 200 - Ok response. + /// + public static GetOrdersResult Ok(Pagination response) + => new GetOrdersResult(new OkObjectResult(response)); + + /// + /// 404 - NotFound response. + /// + public static GetOrdersResult NotFound(string? message = null) + => new GetOrdersResult(new NotFoundObjectResult(message)); + + /// + /// Performs an implicit conversion from GetOrdersResult to ActionResult. + /// + public static implicit operator GetOrdersResult(Pagination response) + => Ok(response); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Orders/MyContracts/Results/PatchOrdersIdResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Orders/MyContracts/Results/PatchOrdersIdResult.verified.cs new file mode 100644 index 000000000..9297832ba --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Orders/MyContracts/Results/PatchOrdersIdResult.verified.cs @@ -0,0 +1,48 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Orders.MyContracts; + +/// +/// Results for operation request. +/// Description: Update part of order by id. +/// Operation: PatchOrdersId. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class PatchOrdersIdResult : ResultBase +{ + private PatchOrdersIdResult(ActionResult result) : base(result) { } + + /// + /// 200 - Ok response. + /// + public static PatchOrdersIdResult Ok(string? message = null) + => new PatchOrdersIdResult(new OkObjectResult(message)); + + /// + /// 404 - NotFound response. + /// + public static PatchOrdersIdResult NotFound(string? message = null) + => new PatchOrdersIdResult(new NotFoundObjectResult(message)); + + /// + /// 409 - Conflict response. + /// + public static PatchOrdersIdResult Conflict(string? message = null) + => new PatchOrdersIdResult(ResultFactory.CreateContentResultWithProblemDetails(HttpStatusCode.Conflict, message)); + + /// + /// 502 - BadGateway response. + /// + public static PatchOrdersIdResult BadGateway(string? message = null) + => new PatchOrdersIdResult(ResultFactory.CreateContentResultWithProblemDetails(HttpStatusCode.BadGateway, message)); + + /// + /// Performs an implicit conversion from PatchOrdersIdResult to ActionResult. + /// + public static implicit operator PatchOrdersIdResult(string response) + => Ok(response); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Resources/ApiSpecification.yaml b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Resources/ApiSpecification.yaml new file mode 100644 index 000000000..cf543aff2 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Resources/ApiSpecification.yaml @@ -0,0 +1,969 @@ +openapi: 3.0.1 +info: + title: Demo Sample Api + description: Demo Sample Api - SingleFileVersion + version: '1.0' + contact: + name: atc-net A/S +servers: + - url: /api/v1 + description: Api version 1.0 +x-authorize-roles: + - admin + - operator +paths: + /orders: + x-authentication-required: true + get: + tags: + - Orders + summary: Get orders + description: Get orders + operationId: getOrders + parameters: + - $ref: '#/components/parameters/pagingPageSize' + - $ref: '#/components/parameters/pagingPageIndex' + - $ref: '#/components/parameters/queryString' + - $ref: '#/components/parameters/queryStringArray' + - $ref: '#/components/parameters/continuationToken' + responses: + '200': + description: Expected response to a valid request + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Pagination' + - $ref: '#/components/schemas/Orders' + '404': + description: Not Found + '/orders/{id}': + x-authentication-required: true + x-authorize-roles: + - operator + get: + tags: + - Orders + summary: Get order by id + description: Get order by id + operationId: getOrderById + x-authentication-required: false + parameters: + - name: myEmail + in: query + description: The email for filter orders to retrieve + schema: + type: string + format: email + nullable: true + responses: + '200': + description: Expected response to a valid request + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + '404': + description: Not Found + patch: + summary: Update part of order by id + description: Update part of order by id + operationId: patchOrdersId + x-authorize-roles: + - admin + - operator + parameters: + - name: myTestHeader + in: header + required: true + description: The myTestHeader special key + schema: + type: string + - name: myTestHeaderBool + in: header + required: true + description: The myTestHeaderBool special key + schema: + type: boolean + - name: myTestHeaderInt + in: header + required: true + description: The myTestHeaderInt special key + schema: + type: integer + - name: x-correlation-id + in: header + required: true + description: The correlationId + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateOrderRequest' + responses: + '200': + description: OK + '404': + description: Not Found + '409': + description: Conflict + '502': + description: Bad Gateway + content: + application/json: + schema: + $ref: '#/components/schemas/ProblemDetails' + parameters: + - name: id + in: path + description: The id of the order + required: true + schema: + type: string + format: uuid + /users/email: + get: + tags: + - Users + summary: Get user by email + description: Get user by email + operationId: getUserByEmail + parameters: + - name: email + in: query + description: The email of the user to retrieve + required: true + schema: + type: string + format: email + responses: + '200': + description: Expected response to a valid request + content: + application/json: + schema: + $ref: '#/components/schemas/User' + '400': + description: Bad Request + '404': + description: Not Found + '409': + description: Conflict + '/users/{id}': + get: + summary: Get user by id + description: Get user by id + operationId: getUserById + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/User' + '404': + description: Not Found + '409': + description: Conflict + put: + summary: Update user by id + description: Update user by id + operationId: updateUserById + responses: + '200': + description: OK + '400': + description: Bad Request + '404': + description: Not Found + '409': + description: Conflict + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateUserRequest' + delete: + summary: Delete user by id + description: Delete user by id + operationId: deleteUserById + responses: + '200': + description: OK + '404': + description: Not Found + '409': + description: Conflict + parameters: + - name: id + in: path + description: Id of the user + required: true + schema: + type: string + format: uuid + /users: + get: + summary: Get all users + description: Get all users + operationId: getUsers + tags: [] + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Users' + '409': + description: Conflict + post: + summary: Create a new user + description: Create a new user + operationId: postUser + responses: + '201': + description: Created + '400': + description: Bad Request + '409': + description: Conflict + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateUserRequest' + '/users/{id}/gender': + put: + summary: Update gender on a user + description: Update gender on a user + operationId: updateMyTestGender + parameters: + - name: genderParam + in: query + description: The gender to set on the user + schema: + $ref: '#/components/schemas/GenderType' + responses: + '200': + description: OK + '400': + description: Bad Request + '404': + description: Not Found + '409': + description: Conflict + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateTestGenderRequest' + parameters: + - name: id + description: Id of the user + in: path + required: true + schema: + type: string + format: uuid + '/accounts/{accountId}/name': + put: + summary: Update name of account + description: Update name of account + operationId: updateAccountName + responses: + '200': + description: OK + parameters: + - name: name + in: header + description: The account name + schema: + type: string + post: + summary: Set name of account + description: Set name of account + operationId: setAccountName + responses: + '200': + description: OK + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateAccountRequest' + parameters: + - name: accountId + in: path + required: true + description: The accountId + schema: + type: string + format: uuid + '/addresses/{postalCode}': + get: + summary: Get addresses by postal code + description: Get addresses by postal code + operationId: getAddressesByPostalCodes + tags: [] + responses: + '200': + description: OK + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Address' + '404': + description: Not Found + parameters: + - name: postalCode + in: path + required: true + description: The postalCode to limit addresses on + schema: + type: string + /route-with-dash: + get: + summary: Your GET endpoint + description: Your GET endpoint + tags: [] + responses: + '200': + description: OK + operationId: getRouteWithDash + /items: + post: + summary: Create a new item + description: Create a new item + operationId: createItem + responses: + '200': + description: OK + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateItemRequest' + '/items/{id}': + put: + summary: Updates an item + description: Updates an item + operationId: updateItem + responses: + '200': + description: OK + content: + application/json: + schema: + type: string + format: uuid + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateItemRequest' + parameters: + - name: id + in: path + description: The id of the order + required: true + schema: + type: string + format: uuid + /tasks: + get: + operationId: getTasks + summary: Returns tasks + description: Returns tasks + tags: [] + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Tasks' + '/eventArgs/{id}': + parameters: + - name: id + in: path + description: The id of the eventArgs + required: true + schema: + type: string + get: + summary: Get EventArgs By Id + description: Get EventArgs By Id + tags: [] + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/EventArgs' + '404': + description: Not Found + operationId: getEventArgById + /eventArgs: + get: + operationId: getEventArgs + summary: Get EventArgs List + description: Get EventArgs List + tags: [] + responses: + '200': + description: OK + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/EventArgs' + '/files/{id}': + parameters: + - name: id + in: path + description: The file id + required: true + schema: + type: string + get: + operationId: getFileById + summary: Get File By Id + description: Get File By Id + tags: [] + responses: + '200': + description: OK + content: + application/octet-stream: + schema: + type: string + format: binary + headers: {} + '404': + description: Not Found + /files/form-data/singleObject: + post: + operationId: uploadSingleObjectWithFileAsFormData + summary: Upload a file as FormData + description: Upload a file as FormData + responses: + '200': + description: OK + '400': + description: Bad Request + requestBody: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/FileAsFormDataRequest' + parameters: [] + /files/form-data/singleObjectMultiFile: + post: + operationId: uploadSingleObjectWithFilesAsFormData + summary: Upload files as FormData + description: Upload files as FormData + responses: + '200': + description: OK + '400': + description: Bad Request + requestBody: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/FilesAsFormDataRequest' + parameters: [] + /files/form-data/singleFile: + post: + operationId: uploadSingleFileAsFormData + summary: Upload a file as OctetStream + description: Upload a file as OctetStream + responses: + '200': + description: OK + requestBody: + content: + application/octet-stream: + schema: + type: string + format: binary + parameters: [] + /files/form-data/multiFile: + post: + summary: Upload multi files as form data + description: Upload multi files as form data + operationId: uploadMultiFilesAsFormData + responses: + '200': + description: OK + requestBody: + content: + multipart/form-data: + schema: + type: array + items: + type: string + format: binary +components: + parameters: + pagingPageSize: + name: pageSize + in: query + required: true + schema: + type: integer + minimum: 1 + maximum: 100 + default: 10 + description: The numbers of items to return. + pagingPageIndex: + name: pageIndex + in: query + required: false + schema: + type: integer + minimum: 0 + default: 0 + description: The number of items to skip before starting to collect the result set. + queryString: + name: queryString + in: query + required: false + schema: + type: string + nullable: true + description: The query string. + queryStringArray: + name: queryStringArray + in: query + required: false + schema: + type: array + items: + type: string + nullable: true + description: The query array of string. + continuationToken: + name: continuationToken + in: query + required: false + schema: + type: string + nullable: true + description: The continuation token. + schemas: + Pagination: + type: object + title: Pagination + description: A item result subset of a data query. + properties: + pageSize: + type: number + description: The number of items to request. + pageIndex: + type: number + nullable: true + description: The given page index starting with 0. + queryString: + type: string + nullable: true + description: The query to filter items by. + continuationToken: + type: string + nullable: true + description: Token to indicate next result set. + count: + type: number + description: Items count in result set. + totalCount: + type: number + nullable: true + description: Total items count. + totalPages: + type: number + nullable: true + description: Total pages. + required: + - pageSize + - count + ProblemDetails: + type: object + title: ProblemDetails + description: 'A machine-readable format for specifying errors in HTTP API responses based on https://tools.ietf.org/html/rfc7807.' + properties: + type: + type: string + description: 'A URI reference [RFC3986] that identifies the problem type. This specification encourages that, when dereferenced, it provide human-readable documentation for the problem type (e.g., using HTML [W3C.REC-html5-20141028]).' + title: + type: string + description: 'A short, human-readable summary of the problem type.It SHOULD NOT change from occurrence to occurrence of the problem, except for purposes of localization(e.g., using proactive content negotiation; see[RFC7231], Section 3.4).' + status: + type: integer + format: int32 + description: 'The HTTP status code([RFC7231], Section 6) generated by the origin server for this occurrence of the problem.' + detail: + type: string + description: A human-readable explanation specific to this occurrence of the problem. + instance: + type: string + description: A URI reference that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced. + Order: + title: Order + description: |- + A single order. + Hallo description with multiline and no ending dot + type: object + x-examples: + MyExample: + id: 123 + name: Hallo world + MyExample2: {} + properties: + id: + type: string + format: uuid + description: + type: string + myTime: + type: string + format: time + myEmail: + type: string + format: email + default: a@a.com + myNullableDateTime: + type: string + format: date-time + nullable: true + myDateTime: + type: string + format: date-time + myNumber: + type: number + minimum: 1.1 + maximum: 20.2 + myInteger: + type: integer + maximum: 50 + default: 15 + myBool: + type: boolean + description: MyBool is great + myUri: + type: string + format: uri + description: 'This is the good uri :-)' + myByte: + type: string + format: byte + myStringList: + type: array + description: 'Hallo myStringList desc :-)' + items: + type: string + myLong: + type: integer + format: int64 + minimum: 10 + exclusiveMinimum: false + deliveryAddress: + $ref: '#/components/schemas/Address' + Orders: + description: A list of orders. + type: array + x-tags: + - Orders + title: Orders + items: + $ref: '#/components/schemas/Order' + GenderType: + title: GenderType + description: '' + type: object + properties: + gender: + type: string + description: The users gender type + enum: + - None + - NonBinary + - Male + - Female + required: + - gender + ColorType: + title: ColorType + description: '' + type: object + properties: + color: + type: string + description: The users color type + enum: + - None = 0 + - Black = 1 + - White = 2 + - Yellow = 4 + - Red = 8 + required: + - color + User: + title: User + description: A single user. + type: object + properties: + id: + type: string + format: uuid + example: 00000000-0000-0000-0000-000000000000 + gender: + $ref: '#/components/schemas/GenderType' + firstName: + type: string + lastName: + type: string + email: + type: string + format: email + example: email@email.dk + homepage: + type: string + format: uri + color: + $ref: '#/components/schemas/ColorType' + homeAddress: + $ref: '#/components/schemas/Address' + companyAddress: + $ref: '#/components/schemas/Address' + Users: + description: A list of users. + type: array + items: + $ref: '#/components/schemas/User' + x-tags: + - Users + title: Users + CreateUserRequest: + title: CreateUserRequest + description: Request to create a user + type: object + properties: + firstName: + type: string + lastName: + type: string + myNullableDateTime: + type: string + format: date-time + nullable: true + myDateTime: + type: string + format: date-time + email: + type: string + format: email + example: email@email.dk + homepage: + type: string + format: uri + gender: + $ref: '#/components/schemas/GenderType' + myNullableAddress: + nullable: true + oneOf: + - $ref: '#/components/schemas/Address' + tags: + type: object + additionalProperties: + type: string + desiredProperties1: + type: object + additionalProperties: + type: string + desiredProperties2: + type: object + nullable: true + additionalProperties: + type: string + desiredProperties3: + type: object + nullable: true + additionalProperties: + type: integer + required: + - firstName + - lastName + - myDateTime + - email + - gender + - tags + CreateUsersRequest: + description: A list of users. + type: array + x-tags: + - CreateUsersRequest + title: CreateUsersRequest + items: + $ref: '#/components/schemas/CreateUserRequest' + UpdateUserRequest: + title: UpdateUserRequest + description: Request to update a user + type: object + properties: + firstName: + type: string + lastName: + type: string + email: + type: string + format: email + example: email@email.dk + gender: + $ref: '#/components/schemas/GenderType' + UpdateTestGenderRequest: + title: Update test-gender Request + description: '' + type: object + properties: + gender: + $ref: '#/components/schemas/GenderType' + Address: + title: Address + type: object + properties: + streetName: + type: string + maxLength: 255 + streetNumber: + type: string + postalCode: + type: string + cityName: + type: string + myCountry: + $ref: '#/components/schemas/Country' + Country: + title: Country + type: object + properties: + name: + type: string + alpha2Code: + type: string + minLength: 2 + maxLength: 2 + pattern: '^[A-Za-z]{2}$' + alpha3Code: + type: string + minLength: 3 + maxLength: 3 + pattern: '^[A-Za-z]{3}$' + required: + - name + - alpha2Code + - alpha3Code + UpdateOrderRequest: + title: UpdateOrderRequest + description: Request to update an order + type: object + properties: + myEmail: + type: string + format: email + required: + - myEmail + Item: + title: Item + type: object + properties: + name: + type: string + required: + - name + CreateItemRequest: + title: CreateItemRequest + type: object + properties: + item: + $ref: '#/components/schemas/Item' + myItems: + type: array + items: + $ref: '#/components/schemas/Item' + required: + - item + - myItems + UpdateItemRequest: + title: UpdateItemRequest + type: object + properties: + item: + $ref: '#/components/schemas/Item' + required: + - item + Task: + title: Task + type: object + properties: + id: + type: string + format: uuid + name: + type: string + description: Describes a single task. + Tasks: + title: Tasks + type: array + items: + $ref: '#/components/schemas/Task' + description: Contains a list of Tasks + EventArgs: + title: EventArgs + type: object + properties: + id: + type: string + format: uuid + eventName: + type: string + FileAsFormDataRequest: + title: FileAsFormDataRequest + type: object + properties: + itemName: + type: string + file: + type: string + format: binary + nullable: true + items: + type: array + items: + type: string + required: + - itemName + - items + FilesAsFormDataRequest: + title: FilesAsFormDataRequest + type: object + properties: + files: + type: array + items: + type: string + format: binary + required: + - files + UpdateAccountRequest: + title: UpdateAccountRequest + type: object + properties: + name: + type: string \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/RouteWithDash/MyContracts/Interfaces/IGetRouteWithDashHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/RouteWithDash/MyContracts/Interfaces/IGetRouteWithDashHandler.verified.cs new file mode 100644 index 000000000..eabe2ac64 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/RouteWithDash/MyContracts/Interfaces/IGetRouteWithDashHandler.verified.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.RouteWithDash.MyContracts; + +/// +/// Domain Interface for RequestHandler. +/// Description: Your GET endpoint. +/// Operation: GetRouteWithDash. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetRouteWithDashHandler +{ + /// + /// Execute method. + /// + /// The cancellation token. + Task ExecuteAsync( + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/RouteWithDash/MyContracts/Results/GetRouteWithDashResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/RouteWithDash/MyContracts/Results/GetRouteWithDashResult.verified.cs new file mode 100644 index 000000000..21e6f5355 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/RouteWithDash/MyContracts/Results/GetRouteWithDashResult.verified.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.RouteWithDash.MyContracts; + +/// +/// Results for operation request. +/// Description: Your GET endpoint. +/// Operation: GetRouteWithDash. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetRouteWithDashResult : ResultBase +{ + private GetRouteWithDashResult(ActionResult result) : base(result) { } + + /// + /// 200 - Ok response. + /// + public static GetRouteWithDashResult Ok(string? message = null) + => new GetRouteWithDashResult(new OkObjectResult(message)); + + /// + /// Performs an implicit conversion from GetRouteWithDashResult to ActionResult. + /// + public static implicit operator GetRouteWithDashResult(string response) + => Ok(response); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Tasks/MyContracts/Interfaces/IGetTasksHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Tasks/MyContracts/Interfaces/IGetTasksHandler.verified.cs new file mode 100644 index 000000000..49a98e04e --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Tasks/MyContracts/Interfaces/IGetTasksHandler.verified.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Tasks.MyContracts; + +/// +/// Domain Interface for RequestHandler. +/// Description: Returns tasks. +/// Operation: GetTasks. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetTasksHandler +{ + /// + /// Execute method. + /// + /// The cancellation token. + Task ExecuteAsync( + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Tasks/MyContracts/Models/Task.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Tasks/MyContracts/Models/Task.verified.cs new file mode 100644 index 000000000..09523b1d4 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Tasks/MyContracts/Models/Task.verified.cs @@ -0,0 +1,22 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Tasks.MyContracts; + +/// +/// Describes a single task. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class Task +{ + public Guid Id { get; set; } + + public string Name { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}, {nameof(Name)}: {Name}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Tasks/MyContracts/Models/Tasks.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Tasks/MyContracts/Models/Tasks.verified.cs new file mode 100644 index 000000000..5aa2e0080 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Tasks/MyContracts/Models/Tasks.verified.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Tasks.MyContracts; + +/// +/// Contains a list of Tasks. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class Tasks +{ + /// + /// A list of Task. + /// + public List TaskList { get; set; } = new List(); + + /// + public override string ToString() + => $"{nameof(TaskList)}.Count: {TaskList?.Count ?? 0}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Tasks/MyContracts/Results/GetTasksResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Tasks/MyContracts/Results/GetTasksResult.verified.cs new file mode 100644 index 000000000..163cec60b --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Tasks/MyContracts/Results/GetTasksResult.verified.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Tasks.MyContracts; + +/// +/// Results for operation request. +/// Description: Returns tasks. +/// Operation: GetTasks. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetTasksResult : ResultBase +{ + private GetTasksResult(ActionResult result) : base(result) { } + + /// + /// 200 - Ok response. + /// + public static GetTasksResult Ok(IEnumerable response) + => new GetTasksResult(new OkObjectResult(response ?? Enumerable.Empty())); + + /// + /// Performs an implicit conversion from GetTasksResult to ActionResult. + /// + public static implicit operator GetTasksResult(List response) + => Ok(response); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Interfaces/IDeleteUserByIdHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Interfaces/IDeleteUserByIdHandler.verified.cs new file mode 100644 index 000000000..0e75b7d69 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Interfaces/IDeleteUserByIdHandler.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Users.MyContracts; + +/// +/// Domain Interface for RequestHandler. +/// Description: Delete user by id. +/// Operation: DeleteUserById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IDeleteUserByIdHandler +{ + /// + /// Execute method. + /// + /// The parameters. + /// The cancellation token. + Task ExecuteAsync( + DeleteUserByIdParameters parameters, + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Interfaces/IGetUserByEmailHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Interfaces/IGetUserByEmailHandler.verified.cs new file mode 100644 index 000000000..2f5d266b2 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Interfaces/IGetUserByEmailHandler.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Users.MyContracts; + +/// +/// Domain Interface for RequestHandler. +/// Description: Get user by email. +/// Operation: GetUserByEmail. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetUserByEmailHandler +{ + /// + /// Execute method. + /// + /// The parameters. + /// The cancellation token. + Task ExecuteAsync( + GetUserByEmailParameters parameters, + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Interfaces/IGetUserByIdHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Interfaces/IGetUserByIdHandler.verified.cs new file mode 100644 index 000000000..1aac66f25 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Interfaces/IGetUserByIdHandler.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Users.MyContracts; + +/// +/// Domain Interface for RequestHandler. +/// Description: Get user by id. +/// Operation: GetUserById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetUserByIdHandler +{ + /// + /// Execute method. + /// + /// The parameters. + /// The cancellation token. + Task ExecuteAsync( + GetUserByIdParameters parameters, + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Interfaces/IGetUsersHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Interfaces/IGetUsersHandler.verified.cs new file mode 100644 index 000000000..96d2abb0f --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Interfaces/IGetUsersHandler.verified.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Users.MyContracts; + +/// +/// Domain Interface for RequestHandler. +/// Description: Get all users. +/// Operation: GetUsers. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IGetUsersHandler +{ + /// + /// Execute method. + /// + /// The cancellation token. + Task ExecuteAsync( + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Interfaces/IPostUserHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Interfaces/IPostUserHandler.verified.cs new file mode 100644 index 000000000..8ca92cf7b --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Interfaces/IPostUserHandler.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Users.MyContracts; + +/// +/// Domain Interface for RequestHandler. +/// Description: Create a new user. +/// Operation: PostUser. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IPostUserHandler +{ + /// + /// Execute method. + /// + /// The parameters. + /// The cancellation token. + Task ExecuteAsync( + PostUserParameters parameters, + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Interfaces/IUpdateMyTestGenderHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Interfaces/IUpdateMyTestGenderHandler.verified.cs new file mode 100644 index 000000000..7753fbd54 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Interfaces/IUpdateMyTestGenderHandler.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Users.MyContracts; + +/// +/// Domain Interface for RequestHandler. +/// Description: Update gender on a user. +/// Operation: UpdateMyTestGender. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IUpdateMyTestGenderHandler +{ + /// + /// Execute method. + /// + /// The parameters. + /// The cancellation token. + Task ExecuteAsync( + UpdateMyTestGenderParameters parameters, + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Interfaces/IUpdateUserByIdHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Interfaces/IUpdateUserByIdHandler.verified.cs new file mode 100644 index 000000000..1e1980b23 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Interfaces/IUpdateUserByIdHandler.verified.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Users.MyContracts; + +/// +/// Domain Interface for RequestHandler. +/// Description: Update user by id. +/// Operation: UpdateUserById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public interface IUpdateUserByIdHandler +{ + /// + /// Execute method. + /// + /// The parameters. + /// The cancellation token. + Task ExecuteAsync( + UpdateUserByIdParameters parameters, + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Models/CreateUserRequest.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Models/CreateUserRequest.verified.cs new file mode 100644 index 000000000..0b8cba906 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Models/CreateUserRequest.verified.cs @@ -0,0 +1,65 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Users.MyContracts; + +/// +/// Request to create a user. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class CreateUserRequest +{ + [Required] + public string FirstName { get; set; } + + [Required] + public string LastName { get; set; } + + public DateTimeOffset? MyNullableDateTime { get; set; } + + [Required] + public DateTimeOffset MyDateTime { get; set; } + + /// + /// Undefined description. + /// + /// + /// Email validation being enforced. + /// + [Required] + [EmailAddress] + public string Email { get; set; } + + /// + /// Undefined description. + /// + /// + /// Url validation being enforced. + /// + [Uri] + public Uri Homepage { get; set; } + + /// + /// GenderType. + /// + [Required] + public GenderType Gender { get; set; } + + public Address? MyNullableAddress { get; set; } + + [Required] + public Dictionary Tags { get; set; } + + public Dictionary DesiredProperties1 { get; set; } + + public Dictionary? DesiredProperties2 { get; set; } + + public Dictionary? DesiredProperties3 { get; set; } + + /// + public override string ToString() + => $"{nameof(FirstName)}: {FirstName}, {nameof(LastName)}: {LastName}, {nameof(MyNullableDateTime)}: ({MyNullableDateTime}), {nameof(MyDateTime)}: ({MyDateTime}), {nameof(Email)}: {Email}, {nameof(Homepage)}: ({Homepage}), {nameof(Gender)}: {Gender}, {nameof(MyNullableAddress)}: ({MyNullableAddress}), {nameof(Tags)}: ({Tags}), {nameof(DesiredProperties1)}: ({DesiredProperties1}), {nameof(DesiredProperties2)}: ({DesiredProperties2}), {nameof(DesiredProperties3)}: ({DesiredProperties3})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Models/UpdateTestGenderRequest.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Models/UpdateTestGenderRequest.verified.cs new file mode 100644 index 000000000..c703c9152 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Models/UpdateTestGenderRequest.verified.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Users.MyContracts; + +/// +/// Update test-gender Request. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateTestGenderRequest +{ + /// + /// GenderType. + /// + public GenderType Gender { get; set; } + + /// + public override string ToString() + => $"{nameof(Gender)}: {Gender}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Models/UpdateUserRequest.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Models/UpdateUserRequest.verified.cs new file mode 100644 index 000000000..5d47fa337 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Models/UpdateUserRequest.verified.cs @@ -0,0 +1,36 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Users.MyContracts; + +/// +/// Request to update a user. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateUserRequest +{ + public string FirstName { get; set; } + + public string LastName { get; set; } + + /// + /// Undefined description. + /// + /// + /// Email validation being enforced. + /// + [EmailAddress] + public string Email { get; set; } + + /// + /// GenderType. + /// + public GenderType Gender { get; set; } + + /// + public override string ToString() + => $"{nameof(FirstName)}: {FirstName}, {nameof(LastName)}: {LastName}, {nameof(Email)}: {Email}, {nameof(Gender)}: {Gender}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Models/User.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Models/User.verified.cs new file mode 100644 index 000000000..edcdbd59b --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Models/User.verified.cs @@ -0,0 +1,62 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Users.MyContracts; + +/// +/// A single user. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class User +{ + public Guid Id { get; set; } + + /// + /// GenderType. + /// + public GenderType Gender { get; set; } + + public string FirstName { get; set; } + + public string LastName { get; set; } + + /// + /// Undefined description. + /// + /// + /// Email validation being enforced. + /// + [EmailAddress] + public string Email { get; set; } + + /// + /// Undefined description. + /// + /// + /// Url validation being enforced. + /// + [Uri] + public Uri Homepage { get; set; } + + /// + /// ColorType. + /// + public ColorType Color { get; set; } + + /// + /// Address. + /// + public Address HomeAddress { get; set; } + + /// + /// Address. + /// + public Address CompanyAddress { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}, {nameof(Gender)}: {Gender}, {nameof(FirstName)}: {FirstName}, {nameof(LastName)}: {LastName}, {nameof(Email)}: {Email}, {nameof(Homepage)}: ({Homepage}), {nameof(Color)}: {Color}, {nameof(HomeAddress)}: ({HomeAddress}), {nameof(CompanyAddress)}: ({CompanyAddress})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Models/Users.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Models/Users.verified.cs new file mode 100644 index 000000000..85cefc96b --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Models/Users.verified.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Users.MyContracts; + +/// +/// A list of users. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class Users +{ + /// + /// A list of User. + /// + public List UserList { get; set; } = new List(); + + /// + public override string ToString() + => $"{nameof(UserList)}.Count: {UserList?.Count ?? 0}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Parameters/DeleteUserByIdParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Parameters/DeleteUserByIdParameters.verified.cs new file mode 100644 index 000000000..ad9bef77d --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Parameters/DeleteUserByIdParameters.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Users.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Delete user by id. +/// Operation: DeleteUserById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class DeleteUserByIdParameters +{ + /// + /// Id of the user. + /// + [FromRoute(Name = "id")] + [Required] + public Guid Id { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Parameters/GetUserByEmailParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Parameters/GetUserByEmailParameters.verified.cs new file mode 100644 index 000000000..08f120981 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Parameters/GetUserByEmailParameters.verified.cs @@ -0,0 +1,31 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Users.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Get user by email. +/// Operation: GetUserByEmail. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetUserByEmailParameters +{ + /// + /// The email of the user to retrieve. + /// + /// + /// Email validation being enforced. + /// + [FromQuery] + [Required] + [EmailAddress] + public string Email { get; set; } + + /// + public override string ToString() + => $"{nameof(Email)}: {Email}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Parameters/GetUserByIdParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Parameters/GetUserByIdParameters.verified.cs new file mode 100644 index 000000000..64e1029f2 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Parameters/GetUserByIdParameters.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Users.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Get user by id. +/// Operation: GetUserById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetUserByIdParameters +{ + /// + /// Id of the user. + /// + [FromRoute(Name = "id")] + [Required] + public Guid Id { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Parameters/PostUserParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Parameters/PostUserParameters.verified.cs new file mode 100644 index 000000000..457eca163 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Parameters/PostUserParameters.verified.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Users.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Create a new user. +/// Operation: PostUser. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class PostUserParameters +{ + /// + /// Request to create a user. + /// + [FromBody] + [Required] + public CreateUserRequest Request { get; set; } + + /// + public override string ToString() + => $"{nameof(Request)}: ({Request})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Parameters/UpdateMyTestGenderParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Parameters/UpdateMyTestGenderParameters.verified.cs new file mode 100644 index 000000000..6441eb709 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Parameters/UpdateMyTestGenderParameters.verified.cs @@ -0,0 +1,40 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Users.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Update gender on a user. +/// Operation: UpdateMyTestGender. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateMyTestGenderParameters +{ + /// + /// Id of the user. + /// + [FromRoute(Name = "id")] + [Required] + public Guid Id { get; set; } + + /// + /// The gender to set on the user. + /// + [FromQuery] + public GenderType? GenderParam { get; set; } + + /// + /// Update test-gender Request. + /// + [FromBody] + [Required] + public UpdateTestGenderRequest Request { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}, {nameof(GenderParam)}: {GenderParam}, {nameof(Request)}: ({Request})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Parameters/UpdateUserByIdParameters.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Parameters/UpdateUserByIdParameters.verified.cs new file mode 100644 index 000000000..7f6be0b19 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Parameters/UpdateUserByIdParameters.verified.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Users.MyContracts; + +/// +/// Parameters for operation request. +/// Description: Update user by id. +/// Operation: UpdateUserById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateUserByIdParameters +{ + /// + /// Id of the user. + /// + [FromRoute(Name = "id")] + [Required] + public Guid Id { get; set; } + + /// + /// Request to update a user. + /// + [FromBody] + [Required] + public UpdateUserRequest Request { get; set; } + + /// + public override string ToString() + => $"{nameof(Id)}: {Id}, {nameof(Request)}: ({Request})"; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Results/DeleteUserByIdResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Results/DeleteUserByIdResult.verified.cs new file mode 100644 index 000000000..c5f0efe1c --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Results/DeleteUserByIdResult.verified.cs @@ -0,0 +1,42 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Users.MyContracts; + +/// +/// Results for operation request. +/// Description: Delete user by id. +/// Operation: DeleteUserById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class DeleteUserByIdResult : ResultBase +{ + private DeleteUserByIdResult(ActionResult result) : base(result) { } + + /// + /// 200 - Ok response. + /// + public static DeleteUserByIdResult Ok(string? message = null) + => new DeleteUserByIdResult(new OkObjectResult(message)); + + /// + /// 404 - NotFound response. + /// + public static DeleteUserByIdResult NotFound(string? message = null) + => new DeleteUserByIdResult(new NotFoundObjectResult(message)); + + /// + /// 409 - Conflict response. + /// + public static DeleteUserByIdResult Conflict(string? message = null) + => new DeleteUserByIdResult(ResultFactory.CreateContentResultWithProblemDetails(HttpStatusCode.Conflict, message)); + + /// + /// Performs an implicit conversion from DeleteUserByIdResult to ActionResult. + /// + public static implicit operator DeleteUserByIdResult(string response) + => Ok(response); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Results/GetUserByEmailResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Results/GetUserByEmailResult.verified.cs new file mode 100644 index 000000000..f7ce6fe85 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Results/GetUserByEmailResult.verified.cs @@ -0,0 +1,48 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Users.MyContracts; + +/// +/// Results for operation request. +/// Description: Get user by email. +/// Operation: GetUserByEmail. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetUserByEmailResult : ResultBase +{ + private GetUserByEmailResult(ActionResult result) : base(result) { } + + /// + /// 200 - Ok response. + /// + public static GetUserByEmailResult Ok(User response) + => new GetUserByEmailResult(new OkObjectResult(response)); + + /// + /// 400 - BadRequest response. + /// + public static GetUserByEmailResult BadRequest(string? message = null) + => new GetUserByEmailResult(ResultFactory.CreateContentResultWithValidationProblemDetails(HttpStatusCode.BadRequest, message)); + + /// + /// 404 - NotFound response. + /// + public static GetUserByEmailResult NotFound(string? message = null) + => new GetUserByEmailResult(new NotFoundObjectResult(message)); + + /// + /// 409 - Conflict response. + /// + public static GetUserByEmailResult Conflict(string? message = null) + => new GetUserByEmailResult(ResultFactory.CreateContentResultWithProblemDetails(HttpStatusCode.Conflict, message)); + + /// + /// Performs an implicit conversion from GetUserByEmailResult to ActionResult. + /// + public static implicit operator GetUserByEmailResult(User response) + => Ok(response); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Results/GetUserByIdResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Results/GetUserByIdResult.verified.cs new file mode 100644 index 000000000..cf953c1be --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Results/GetUserByIdResult.verified.cs @@ -0,0 +1,42 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Users.MyContracts; + +/// +/// Results for operation request. +/// Description: Get user by id. +/// Operation: GetUserById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetUserByIdResult : ResultBase +{ + private GetUserByIdResult(ActionResult result) : base(result) { } + + /// + /// 200 - Ok response. + /// + public static GetUserByIdResult Ok(User response) + => new GetUserByIdResult(new OkObjectResult(response)); + + /// + /// 404 - NotFound response. + /// + public static GetUserByIdResult NotFound(string? message = null) + => new GetUserByIdResult(new NotFoundObjectResult(message)); + + /// + /// 409 - Conflict response. + /// + public static GetUserByIdResult Conflict(string? message = null) + => new GetUserByIdResult(ResultFactory.CreateContentResultWithProblemDetails(HttpStatusCode.Conflict, message)); + + /// + /// Performs an implicit conversion from GetUserByIdResult to ActionResult. + /// + public static implicit operator GetUserByIdResult(User response) + => Ok(response); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Results/GetUsersResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Results/GetUsersResult.verified.cs new file mode 100644 index 000000000..acb766c30 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Results/GetUsersResult.verified.cs @@ -0,0 +1,36 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Users.MyContracts; + +/// +/// Results for operation request. +/// Description: Get all users. +/// Operation: GetUsers. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetUsersResult : ResultBase +{ + private GetUsersResult(ActionResult result) : base(result) { } + + /// + /// 200 - Ok response. + /// + public static GetUsersResult Ok(IEnumerable response) + => new GetUsersResult(new OkObjectResult(response ?? Enumerable.Empty())); + + /// + /// 409 - Conflict response. + /// + public static GetUsersResult Conflict(string? message = null) + => new GetUsersResult(ResultFactory.CreateContentResultWithProblemDetails(HttpStatusCode.Conflict, message)); + + /// + /// Performs an implicit conversion from GetUsersResult to ActionResult. + /// + public static implicit operator GetUsersResult(List response) + => Ok(response); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Results/PostUserResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Results/PostUserResult.verified.cs new file mode 100644 index 000000000..65cf11e3f --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Results/PostUserResult.verified.cs @@ -0,0 +1,36 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Users.MyContracts; + +/// +/// Results for operation request. +/// Description: Create a new user. +/// Operation: PostUser. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class PostUserResult : ResultBase +{ + private PostUserResult(ActionResult result) : base(result) { } + + /// + /// 201 - Created response. + /// + public static PostUserResult Created(string? uri = null) + => new PostUserResult(ResultFactory.CreateContentResult(HttpStatusCode.Created, uri)); + + /// + /// 400 - BadRequest response. + /// + public static PostUserResult BadRequest(string? message = null) + => new PostUserResult(ResultFactory.CreateContentResultWithValidationProblemDetails(HttpStatusCode.BadRequest, message)); + + /// + /// 409 - Conflict response. + /// + public static PostUserResult Conflict(string? message = null) + => new PostUserResult(ResultFactory.CreateContentResultWithProblemDetails(HttpStatusCode.Conflict, message)); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Results/UpdateMyTestGenderResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Results/UpdateMyTestGenderResult.verified.cs new file mode 100644 index 000000000..ae9a5b383 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Results/UpdateMyTestGenderResult.verified.cs @@ -0,0 +1,48 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Users.MyContracts; + +/// +/// Results for operation request. +/// Description: Update gender on a user. +/// Operation: UpdateMyTestGender. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateMyTestGenderResult : ResultBase +{ + private UpdateMyTestGenderResult(ActionResult result) : base(result) { } + + /// + /// 200 - Ok response. + /// + public static UpdateMyTestGenderResult Ok(string? message = null) + => new UpdateMyTestGenderResult(new OkObjectResult(message)); + + /// + /// 400 - BadRequest response. + /// + public static UpdateMyTestGenderResult BadRequest(string? message = null) + => new UpdateMyTestGenderResult(ResultFactory.CreateContentResultWithValidationProblemDetails(HttpStatusCode.BadRequest, message)); + + /// + /// 404 - NotFound response. + /// + public static UpdateMyTestGenderResult NotFound(string? message = null) + => new UpdateMyTestGenderResult(new NotFoundObjectResult(message)); + + /// + /// 409 - Conflict response. + /// + public static UpdateMyTestGenderResult Conflict(string? message = null) + => new UpdateMyTestGenderResult(ResultFactory.CreateContentResultWithProblemDetails(HttpStatusCode.Conflict, message)); + + /// + /// Performs an implicit conversion from UpdateMyTestGenderResult to ActionResult. + /// + public static implicit operator UpdateMyTestGenderResult(string response) + => Ok(response); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Results/UpdateUserByIdResult.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Results/UpdateUserByIdResult.verified.cs new file mode 100644 index 000000000..7ff8b3785 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api.Generated/Users/MyContracts/Results/UpdateUserByIdResult.verified.cs @@ -0,0 +1,48 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Generated.Users.MyContracts; + +/// +/// Results for operation request. +/// Description: Update user by id. +/// Operation: UpdateUserById. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateUserByIdResult : ResultBase +{ + private UpdateUserByIdResult(ActionResult result) : base(result) { } + + /// + /// 200 - Ok response. + /// + public static UpdateUserByIdResult Ok(string? message = null) + => new UpdateUserByIdResult(new OkObjectResult(message)); + + /// + /// 400 - BadRequest response. + /// + public static UpdateUserByIdResult BadRequest(string? message = null) + => new UpdateUserByIdResult(ResultFactory.CreateContentResultWithValidationProblemDetails(HttpStatusCode.BadRequest, message)); + + /// + /// 404 - NotFound response. + /// + public static UpdateUserByIdResult NotFound(string? message = null) + => new UpdateUserByIdResult(new NotFoundObjectResult(message)); + + /// + /// 409 - Conflict response. + /// + public static UpdateUserByIdResult Conflict(string? message = null) + => new UpdateUserByIdResult(ResultFactory.CreateContentResultWithProblemDetails(HttpStatusCode.Conflict, message)); + + /// + /// Performs an implicit conversion from UpdateUserByIdResult to ActionResult. + /// + public static implicit operator UpdateUserByIdResult(string response) + => Ok(response); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api/GlobalUsings.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api/GlobalUsings.verified.cs new file mode 100644 index 000000000..c9fdc9c44 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api/GlobalUsings.verified.cs @@ -0,0 +1,16 @@ +global using System.CodeDom.Compiler; +global using System.Reflection; +global using System.Text; + +global using Asp.Versioning.ApiExplorer; + +global using Atc.Rest.Extended.Options; + +global using Microsoft.Extensions.Options; +global using Microsoft.OpenApi.Models; + +global using Structure1.Api.Generated; +global using Structure1.Api.Options; +global using Structure1.Domain; + +global using Swashbuckle.AspNetCore.SwaggerGen; \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api/Options/ConfigureSwaggerDocOptions.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api/Options/ConfigureSwaggerDocOptions.verified.cs new file mode 100644 index 000000000..99ea13d7f --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api/Options/ConfigureSwaggerDocOptions.verified.cs @@ -0,0 +1,94 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Options; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class ConfigureSwaggerDocOptions : IConfigureOptions +{ + private readonly IApiVersionDescriptionProvider provider; + private readonly IWebHostEnvironment environment; + + /// + /// Initializes a new instance of the class. + /// + /// The provider used to generate Swagger documents. + /// The environment. + public ConfigureSwaggerDocOptions( + IApiVersionDescriptionProvider provider, + IWebHostEnvironment environment) + { + this.provider = provider; + this.environment = environment; + } + + public void Configure( + SwaggerGenOptions options) + { + foreach (var description in provider.ApiVersionDescriptions) + { + options.SwaggerDoc(description.GroupName, CreateInfoForApiVersion(description)); + } + + options.IncludeXmlComments(Path.ChangeExtension(GetType().Assembly.Location, "xml")); + } + + private OpenApiInfo CreateInfoForApiVersion( + ApiVersionDescription description) + { + var text = new StringBuilder("Demo Sample Api - SingleFileVersion"); + var info = new OpenApiInfo + { + Title = $"{environment.ApplicationName} {description.GroupName.ToUpperInvariant()}", + Version = description.ApiVersion.ToString(), + Contact = new OpenApiContact + { + Name = "atc-net A/S", + }, + }; + + if (description.IsDeprecated) + { + text.Append(" This API version has been deprecated."); + } + + if (description.SunsetPolicy is { } policy) + { + if (policy.Date is { } when) + { + text.Append(" The API will be sunset on ") + .Append(when.Date.ToShortDateString()) + .Append('.'); + } + + if (policy.HasLinks) + { + text.AppendLine(); + + foreach (var link in policy.Links) + { + if (link.Type != "text/html") + { + continue; + } + + text.AppendLine(); + + if (link.Title.HasValue) + { + text.Append(link.Title.Value).Append(": "); + } + + text.Append(link.LinkTarget.OriginalString); + } + } + } + + info.Description = text.ToString(); + + return info; + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api/Program.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api/Program.verified.cs new file mode 100644 index 000000000..0c49ad9ae --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api/Program.verified.cs @@ -0,0 +1,23 @@ +namespace Structure1.Api; + +public static class Program +{ + public static void Main(string[] args) + { + CreateHostBuilder(args) + .Build() + .Run(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) + { + var builder = Host + .CreateDefaultBuilder(args) + .ConfigureWebHostDefaults(webBuilder => + { + webBuilder.UseStartup(); + }); + + return builder; + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api/Startup.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api/Startup.verified.cs new file mode 100644 index 000000000..cd23f998f --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Api/Startup.verified.cs @@ -0,0 +1,38 @@ +namespace Structure1.Api; + +public class Startup +{ + private readonly RestApiExtendedOptions restApiOptions; + + public Startup( + IConfiguration configuration) + { + Configuration = configuration; + restApiOptions = new RestApiExtendedOptions + { + // TODO: Remove/out-comment/set to false this for production scenarios! + AllowAnonymousAccessForDevelopment = true, + }; + + restApiOptions.AddAssemblyPairs( + Assembly.GetAssembly(typeof(ApiRegistration)), + Assembly.GetAssembly(typeof(DomainRegistration))); + } + + public IConfiguration Configuration { get; } + + public void ConfigureServices( + IServiceCollection services) + { + services.ConfigureOptions(); + + services.AddRestApi(restApiOptions, Configuration); + } + + public void Configure( + IApplicationBuilder app, + IWebHostEnvironment env) + { + app.ConfigureRestApi(env, restApiOptions); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Accounts/MyHandlers/SetAccountNameHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Accounts/MyHandlers/SetAccountNameHandler.verified.cs new file mode 100644 index 000000000..976aa4191 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Accounts/MyHandlers/SetAccountNameHandler.verified.cs @@ -0,0 +1,18 @@ +namespace Structure1.Domain.Accounts.MyHandlers; + +/// +/// Handler for operation request. +/// Description: Set name of account. +/// Operation: SetAccountName. +/// +public sealed class SetAccountNameHandler : ISetAccountNameHandler +{ + public Task ExecuteAsync( + SetAccountNameParameters parameters, + CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(parameters); + + throw new NotImplementedException("Add logic here for SetAccountNameHandler"); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Accounts/MyHandlers/UpdateAccountNameHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Accounts/MyHandlers/UpdateAccountNameHandler.verified.cs new file mode 100644 index 000000000..aa1622271 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Accounts/MyHandlers/UpdateAccountNameHandler.verified.cs @@ -0,0 +1,18 @@ +namespace Structure1.Domain.Accounts.MyHandlers; + +/// +/// Handler for operation request. +/// Description: Update name of account. +/// Operation: UpdateAccountName. +/// +public sealed class UpdateAccountNameHandler : IUpdateAccountNameHandler +{ + public Task ExecuteAsync( + UpdateAccountNameParameters parameters, + CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(parameters); + + throw new NotImplementedException("Add logic here for UpdateAccountNameHandler"); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Addresses/MyHandlers/GetAddressesByPostalCodesHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Addresses/MyHandlers/GetAddressesByPostalCodesHandler.verified.cs new file mode 100644 index 000000000..0617b6ec0 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Addresses/MyHandlers/GetAddressesByPostalCodesHandler.verified.cs @@ -0,0 +1,18 @@ +namespace Structure1.Domain.Addresses.MyHandlers; + +/// +/// Handler for operation request. +/// Description: Get addresses by postal code. +/// Operation: GetAddressesByPostalCodes. +/// +public sealed class GetAddressesByPostalCodesHandler : IGetAddressesByPostalCodesHandler +{ + public Task ExecuteAsync( + GetAddressesByPostalCodesParameters parameters, + CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(parameters); + + throw new NotImplementedException("Add logic here for GetAddressesByPostalCodesHandler"); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/DomainRegistration.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/DomainRegistration.verified.cs new file mode 100644 index 000000000..f3e9d6787 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/DomainRegistration.verified.cs @@ -0,0 +1,12 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Domain; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class DomainRegistration +{ +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/EventArgs/MyHandlers/GetEventArgByIdHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/EventArgs/MyHandlers/GetEventArgByIdHandler.verified.cs new file mode 100644 index 000000000..277d579db --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/EventArgs/MyHandlers/GetEventArgByIdHandler.verified.cs @@ -0,0 +1,18 @@ +namespace Structure1.Domain.EventArgs.MyHandlers; + +/// +/// Handler for operation request. +/// Description: Get EventArgs By Id. +/// Operation: GetEventArgById. +/// +public sealed class GetEventArgByIdHandler : IGetEventArgByIdHandler +{ + public Task ExecuteAsync( + GetEventArgByIdParameters parameters, + CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(parameters); + + throw new NotImplementedException("Add logic here for GetEventArgByIdHandler"); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/EventArgs/MyHandlers/GetEventArgsHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/EventArgs/MyHandlers/GetEventArgsHandler.verified.cs new file mode 100644 index 000000000..d10976a32 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/EventArgs/MyHandlers/GetEventArgsHandler.verified.cs @@ -0,0 +1,15 @@ +namespace Structure1.Domain.EventArgs.MyHandlers; + +/// +/// Handler for operation request. +/// Description: Get EventArgs List. +/// Operation: GetEventArgs. +/// +public sealed class GetEventArgsHandler : IGetEventArgsHandler +{ + public Task ExecuteAsync( + CancellationToken cancellationToken = default) + { + throw new NotImplementedException("Add logic here for GetEventArgsHandler"); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Files/MyHandlers/GetFileByIdHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Files/MyHandlers/GetFileByIdHandler.verified.cs new file mode 100644 index 000000000..4ef41766b --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Files/MyHandlers/GetFileByIdHandler.verified.cs @@ -0,0 +1,18 @@ +namespace Structure1.Domain.Files.MyHandlers; + +/// +/// Handler for operation request. +/// Description: Get File By Id. +/// Operation: GetFileById. +/// +public sealed class GetFileByIdHandler : IGetFileByIdHandler +{ + public Task ExecuteAsync( + GetFileByIdParameters parameters, + CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(parameters); + + throw new NotImplementedException("Add logic here for GetFileByIdHandler"); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Files/MyHandlers/UploadMultiFilesAsFormDataHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Files/MyHandlers/UploadMultiFilesAsFormDataHandler.verified.cs new file mode 100644 index 000000000..f8212b2c4 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Files/MyHandlers/UploadMultiFilesAsFormDataHandler.verified.cs @@ -0,0 +1,18 @@ +namespace Structure1.Domain.Files.MyHandlers; + +/// +/// Handler for operation request. +/// Description: Upload multi files as form data. +/// Operation: UploadMultiFilesAsFormData. +/// +public sealed class UploadMultiFilesAsFormDataHandler : IUploadMultiFilesAsFormDataHandler +{ + public Task ExecuteAsync( + UploadMultiFilesAsFormDataParameters parameters, + CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(parameters); + + throw new NotImplementedException("Add logic here for UploadMultiFilesAsFormDataHandler"); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Files/MyHandlers/UploadSingleFileAsFormDataHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Files/MyHandlers/UploadSingleFileAsFormDataHandler.verified.cs new file mode 100644 index 000000000..ba1db77bd --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Files/MyHandlers/UploadSingleFileAsFormDataHandler.verified.cs @@ -0,0 +1,18 @@ +namespace Structure1.Domain.Files.MyHandlers; + +/// +/// Handler for operation request. +/// Description: Upload a file as OctetStream. +/// Operation: UploadSingleFileAsFormData. +/// +public sealed class UploadSingleFileAsFormDataHandler : IUploadSingleFileAsFormDataHandler +{ + public Task ExecuteAsync( + UploadSingleFileAsFormDataParameters parameters, + CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(parameters); + + throw new NotImplementedException("Add logic here for UploadSingleFileAsFormDataHandler"); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Files/MyHandlers/UploadSingleObjectWithFileAsFormDataHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Files/MyHandlers/UploadSingleObjectWithFileAsFormDataHandler.verified.cs new file mode 100644 index 000000000..9122dd024 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Files/MyHandlers/UploadSingleObjectWithFileAsFormDataHandler.verified.cs @@ -0,0 +1,18 @@ +namespace Structure1.Domain.Files.MyHandlers; + +/// +/// Handler for operation request. +/// Description: Upload a file as FormData. +/// Operation: UploadSingleObjectWithFileAsFormData. +/// +public sealed class UploadSingleObjectWithFileAsFormDataHandler : IUploadSingleObjectWithFileAsFormDataHandler +{ + public Task ExecuteAsync( + UploadSingleObjectWithFileAsFormDataParameters parameters, + CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(parameters); + + throw new NotImplementedException("Add logic here for UploadSingleObjectWithFileAsFormDataHandler"); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Files/MyHandlers/UploadSingleObjectWithFilesAsFormDataHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Files/MyHandlers/UploadSingleObjectWithFilesAsFormDataHandler.verified.cs new file mode 100644 index 000000000..835cfd2ec --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Files/MyHandlers/UploadSingleObjectWithFilesAsFormDataHandler.verified.cs @@ -0,0 +1,18 @@ +namespace Structure1.Domain.Files.MyHandlers; + +/// +/// Handler for operation request. +/// Description: Upload files as FormData. +/// Operation: UploadSingleObjectWithFilesAsFormData. +/// +public sealed class UploadSingleObjectWithFilesAsFormDataHandler : IUploadSingleObjectWithFilesAsFormDataHandler +{ + public Task ExecuteAsync( + UploadSingleObjectWithFilesAsFormDataParameters parameters, + CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(parameters); + + throw new NotImplementedException("Add logic here for UploadSingleObjectWithFilesAsFormDataHandler"); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/GlobalUsings.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/GlobalUsings.verified.cs new file mode 100644 index 000000000..3e480efb0 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/GlobalUsings.verified.cs @@ -0,0 +1,11 @@ +global using System.CodeDom.Compiler; + +global using Structure1.Api.Generated.Accounts.MyContracts; +global using Structure1.Api.Generated.Addresses.MyContracts; +global using Structure1.Api.Generated.EventArgs.MyContracts; +global using Structure1.Api.Generated.Files.MyContracts; +global using Structure1.Api.Generated.Items.MyContracts; +global using Structure1.Api.Generated.Orders.MyContracts; +global using Structure1.Api.Generated.RouteWithDash.MyContracts; +global using Structure1.Api.Generated.Tasks.MyContracts; +global using Structure1.Api.Generated.Users.MyContracts; \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Items/MyHandlers/CreateItemHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Items/MyHandlers/CreateItemHandler.verified.cs new file mode 100644 index 000000000..363741ecd --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Items/MyHandlers/CreateItemHandler.verified.cs @@ -0,0 +1,18 @@ +namespace Structure1.Domain.Items.MyHandlers; + +/// +/// Handler for operation request. +/// Description: Create a new item. +/// Operation: CreateItem. +/// +public sealed class CreateItemHandler : ICreateItemHandler +{ + public Task ExecuteAsync( + CreateItemParameters parameters, + CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(parameters); + + throw new NotImplementedException("Add logic here for CreateItemHandler"); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Items/MyHandlers/UpdateItemHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Items/MyHandlers/UpdateItemHandler.verified.cs new file mode 100644 index 000000000..008b542ee --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Items/MyHandlers/UpdateItemHandler.verified.cs @@ -0,0 +1,18 @@ +namespace Structure1.Domain.Items.MyHandlers; + +/// +/// Handler for operation request. +/// Description: Updates an item. +/// Operation: UpdateItem. +/// +public sealed class UpdateItemHandler : IUpdateItemHandler +{ + public Task ExecuteAsync( + UpdateItemParameters parameters, + CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(parameters); + + throw new NotImplementedException("Add logic here for UpdateItemHandler"); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Orders/MyHandlers/GetOrderByIdHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Orders/MyHandlers/GetOrderByIdHandler.verified.cs new file mode 100644 index 000000000..fb0232810 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Orders/MyHandlers/GetOrderByIdHandler.verified.cs @@ -0,0 +1,18 @@ +namespace Structure1.Domain.Orders.MyHandlers; + +/// +/// Handler for operation request. +/// Description: Get order by id. +/// Operation: GetOrderById. +/// +public sealed class GetOrderByIdHandler : IGetOrderByIdHandler +{ + public Task ExecuteAsync( + GetOrderByIdParameters parameters, + CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(parameters); + + throw new NotImplementedException("Add logic here for GetOrderByIdHandler"); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Orders/MyHandlers/GetOrdersHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Orders/MyHandlers/GetOrdersHandler.verified.cs new file mode 100644 index 000000000..a35d74bf1 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Orders/MyHandlers/GetOrdersHandler.verified.cs @@ -0,0 +1,18 @@ +namespace Structure1.Domain.Orders.MyHandlers; + +/// +/// Handler for operation request. +/// Description: Get orders. +/// Operation: GetOrders. +/// +public sealed class GetOrdersHandler : IGetOrdersHandler +{ + public Task ExecuteAsync( + GetOrdersParameters parameters, + CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(parameters); + + throw new NotImplementedException("Add logic here for GetOrdersHandler"); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Orders/MyHandlers/PatchOrdersIdHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Orders/MyHandlers/PatchOrdersIdHandler.verified.cs new file mode 100644 index 000000000..6ade26cd5 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Orders/MyHandlers/PatchOrdersIdHandler.verified.cs @@ -0,0 +1,18 @@ +namespace Structure1.Domain.Orders.MyHandlers; + +/// +/// Handler for operation request. +/// Description: Update part of order by id. +/// Operation: PatchOrdersId. +/// +public sealed class PatchOrdersIdHandler : IPatchOrdersIdHandler +{ + public Task ExecuteAsync( + PatchOrdersIdParameters parameters, + CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(parameters); + + throw new NotImplementedException("Add logic here for PatchOrdersIdHandler"); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/RouteWithDash/MyHandlers/GetRouteWithDashHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/RouteWithDash/MyHandlers/GetRouteWithDashHandler.verified.cs new file mode 100644 index 000000000..418d9c3f4 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/RouteWithDash/MyHandlers/GetRouteWithDashHandler.verified.cs @@ -0,0 +1,15 @@ +namespace Structure1.Domain.RouteWithDash.MyHandlers; + +/// +/// Handler for operation request. +/// Description: Your GET endpoint. +/// Operation: GetRouteWithDash. +/// +public sealed class GetRouteWithDashHandler : IGetRouteWithDashHandler +{ + public Task ExecuteAsync( + CancellationToken cancellationToken = default) + { + throw new NotImplementedException("Add logic here for GetRouteWithDashHandler"); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Tasks/MyHandlers/GetTasksHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Tasks/MyHandlers/GetTasksHandler.verified.cs new file mode 100644 index 000000000..850dc7812 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Tasks/MyHandlers/GetTasksHandler.verified.cs @@ -0,0 +1,15 @@ +namespace Structure1.Domain.Tasks.MyHandlers; + +/// +/// Handler for operation request. +/// Description: Returns tasks. +/// Operation: GetTasks. +/// +public sealed class GetTasksHandler : IGetTasksHandler +{ + public Task ExecuteAsync( + CancellationToken cancellationToken = default) + { + throw new NotImplementedException("Add logic here for GetTasksHandler"); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Users/MyHandlers/DeleteUserByIdHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Users/MyHandlers/DeleteUserByIdHandler.verified.cs new file mode 100644 index 000000000..267a22865 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Users/MyHandlers/DeleteUserByIdHandler.verified.cs @@ -0,0 +1,18 @@ +namespace Structure1.Domain.Users.MyHandlers; + +/// +/// Handler for operation request. +/// Description: Delete user by id. +/// Operation: DeleteUserById. +/// +public sealed class DeleteUserByIdHandler : IDeleteUserByIdHandler +{ + public Task ExecuteAsync( + DeleteUserByIdParameters parameters, + CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(parameters); + + throw new NotImplementedException("Add logic here for DeleteUserByIdHandler"); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Users/MyHandlers/GetUserByEmailHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Users/MyHandlers/GetUserByEmailHandler.verified.cs new file mode 100644 index 000000000..117cb294f --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Users/MyHandlers/GetUserByEmailHandler.verified.cs @@ -0,0 +1,18 @@ +namespace Structure1.Domain.Users.MyHandlers; + +/// +/// Handler for operation request. +/// Description: Get user by email. +/// Operation: GetUserByEmail. +/// +public sealed class GetUserByEmailHandler : IGetUserByEmailHandler +{ + public Task ExecuteAsync( + GetUserByEmailParameters parameters, + CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(parameters); + + throw new NotImplementedException("Add logic here for GetUserByEmailHandler"); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Users/MyHandlers/GetUserByIdHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Users/MyHandlers/GetUserByIdHandler.verified.cs new file mode 100644 index 000000000..63b690554 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Users/MyHandlers/GetUserByIdHandler.verified.cs @@ -0,0 +1,18 @@ +namespace Structure1.Domain.Users.MyHandlers; + +/// +/// Handler for operation request. +/// Description: Get user by id. +/// Operation: GetUserById. +/// +public sealed class GetUserByIdHandler : IGetUserByIdHandler +{ + public Task ExecuteAsync( + GetUserByIdParameters parameters, + CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(parameters); + + throw new NotImplementedException("Add logic here for GetUserByIdHandler"); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Users/MyHandlers/GetUsersHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Users/MyHandlers/GetUsersHandler.verified.cs new file mode 100644 index 000000000..d8d8e7fab --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Users/MyHandlers/GetUsersHandler.verified.cs @@ -0,0 +1,15 @@ +namespace Structure1.Domain.Users.MyHandlers; + +/// +/// Handler for operation request. +/// Description: Get all users. +/// Operation: GetUsers. +/// +public sealed class GetUsersHandler : IGetUsersHandler +{ + public Task ExecuteAsync( + CancellationToken cancellationToken = default) + { + throw new NotImplementedException("Add logic here for GetUsersHandler"); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Users/MyHandlers/PostUserHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Users/MyHandlers/PostUserHandler.verified.cs new file mode 100644 index 000000000..075338c5a --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Users/MyHandlers/PostUserHandler.verified.cs @@ -0,0 +1,18 @@ +namespace Structure1.Domain.Users.MyHandlers; + +/// +/// Handler for operation request. +/// Description: Create a new user. +/// Operation: PostUser. +/// +public sealed class PostUserHandler : IPostUserHandler +{ + public Task ExecuteAsync( + PostUserParameters parameters, + CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(parameters); + + throw new NotImplementedException("Add logic here for PostUserHandler"); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Users/MyHandlers/UpdateMyTestGenderHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Users/MyHandlers/UpdateMyTestGenderHandler.verified.cs new file mode 100644 index 000000000..300667242 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Users/MyHandlers/UpdateMyTestGenderHandler.verified.cs @@ -0,0 +1,18 @@ +namespace Structure1.Domain.Users.MyHandlers; + +/// +/// Handler for operation request. +/// Description: Update gender on a user. +/// Operation: UpdateMyTestGender. +/// +public sealed class UpdateMyTestGenderHandler : IUpdateMyTestGenderHandler +{ + public Task ExecuteAsync( + UpdateMyTestGenderParameters parameters, + CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(parameters); + + throw new NotImplementedException("Add logic here for UpdateMyTestGenderHandler"); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Users/MyHandlers/UpdateUserByIdHandler.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Users/MyHandlers/UpdateUserByIdHandler.verified.cs new file mode 100644 index 000000000..4db3de34d --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/src/Structure1.Domain/Users/MyHandlers/UpdateUserByIdHandler.verified.cs @@ -0,0 +1,18 @@ +namespace Structure1.Domain.Users.MyHandlers; + +/// +/// Handler for operation request. +/// Description: Update user by id. +/// Operation: UpdateUserById. +/// +public sealed class UpdateUserByIdHandler : IUpdateUserByIdHandler +{ + public Task ExecuteAsync( + UpdateUserByIdParameters parameters, + CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(parameters); + + throw new NotImplementedException("Add logic here for UpdateUserByIdHandler"); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Accounts/MyEndpoints/SetAccountNameHandlerStub.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Accounts/MyEndpoints/SetAccountNameHandlerStub.verified.cs new file mode 100644 index 000000000..198a26833 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Accounts/MyEndpoints/SetAccountNameHandlerStub.verified.cs @@ -0,0 +1,18 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests.Accounts.MyEndpoints; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class SetAccountNameHandlerStub : ISetAccountNameHandler +{ + public Task ExecuteAsync( + SetAccountNameParameters parameters, + CancellationToken cancellationToken = default) + { + return Task.FromResult(SetAccountNameResult.Ok("Hallo world")); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Accounts/MyEndpoints/UpdateAccountNameHandlerStub.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Accounts/MyEndpoints/UpdateAccountNameHandlerStub.verified.cs new file mode 100644 index 000000000..4e0bf86ea --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Accounts/MyEndpoints/UpdateAccountNameHandlerStub.verified.cs @@ -0,0 +1,18 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests.Accounts.MyEndpoints; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateAccountNameHandlerStub : IUpdateAccountNameHandler +{ + public Task ExecuteAsync( + UpdateAccountNameParameters parameters, + CancellationToken cancellationToken = default) + { + return Task.FromResult(UpdateAccountNameResult.Ok("Hallo world")); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Addresses/MyEndpoints/GetAddressesByPostalCodesHandlerStub.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Addresses/MyEndpoints/GetAddressesByPostalCodesHandlerStub.verified.cs new file mode 100644 index 000000000..054394ecd --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Addresses/MyEndpoints/GetAddressesByPostalCodesHandlerStub.verified.cs @@ -0,0 +1,20 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests.Addresses.MyEndpoints; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetAddressesByPostalCodesHandlerStub : IGetAddressesByPostalCodesHandler +{ + public Task ExecuteAsync( + GetAddressesByPostalCodesParameters parameters, + CancellationToken cancellationToken = default) + { + var data = new Fixture().Create>(); + + return Task.FromResult(GetAddressesByPostalCodesResult.Ok(data)); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Accounts/SetAccountNameTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Accounts/SetAccountNameTests.verified.cs new file mode 100644 index 000000000..c1f50a460 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Accounts/SetAccountNameTests.verified.cs @@ -0,0 +1,21 @@ +namespace Structure1.Api.Tests.Accounts.MyEndpoints; + +[Collection("Sequential-Endpoints")] +[Trait(Traits.Category, Traits.Categories.Integration)] +public class SetAccountNameTests : WebApiControllerBaseTest +{ + public SetAccountNameTests(WebApiStartupFactory fixture) + : base(fixture) + { + } + + [Fact(Skip = "Change this to a real integration-test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Accounts/UpdateAccountNameTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Accounts/UpdateAccountNameTests.verified.cs new file mode 100644 index 000000000..a145fc48d --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Accounts/UpdateAccountNameTests.verified.cs @@ -0,0 +1,21 @@ +namespace Structure1.Api.Tests.Accounts.MyEndpoints; + +[Collection("Sequential-Endpoints")] +[Trait(Traits.Category, Traits.Categories.Integration)] +public class UpdateAccountNameTests : WebApiControllerBaseTest +{ + public UpdateAccountNameTests(WebApiStartupFactory fixture) + : base(fixture) + { + } + + [Fact(Skip = "Change this to a real integration-test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Addresses/GetAddressesByPostalCodesTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Addresses/GetAddressesByPostalCodesTests.verified.cs new file mode 100644 index 000000000..602c00981 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Addresses/GetAddressesByPostalCodesTests.verified.cs @@ -0,0 +1,21 @@ +namespace Structure1.Api.Tests.Addresses.MyEndpoints; + +[Collection("Sequential-Endpoints")] +[Trait(Traits.Category, Traits.Categories.Integration)] +public class GetAddressesByPostalCodesTests : WebApiControllerBaseTest +{ + public GetAddressesByPostalCodesTests(WebApiStartupFactory fixture) + : base(fixture) + { + } + + [Fact(Skip = "Change this to a real integration-test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/EventArgs/GetEventArgByIdTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/EventArgs/GetEventArgByIdTests.verified.cs new file mode 100644 index 000000000..9b5b1fe1b --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/EventArgs/GetEventArgByIdTests.verified.cs @@ -0,0 +1,21 @@ +namespace Structure1.Api.Tests.EventArgs.MyEndpoints; + +[Collection("Sequential-Endpoints")] +[Trait(Traits.Category, Traits.Categories.Integration)] +public class GetEventArgByIdTests : WebApiControllerBaseTest +{ + public GetEventArgByIdTests(WebApiStartupFactory fixture) + : base(fixture) + { + } + + [Fact(Skip = "Change this to a real integration-test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/EventArgs/GetEventArgsTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/EventArgs/GetEventArgsTests.verified.cs new file mode 100644 index 000000000..eed6621a4 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/EventArgs/GetEventArgsTests.verified.cs @@ -0,0 +1,21 @@ +namespace Structure1.Api.Tests.EventArgs.MyEndpoints; + +[Collection("Sequential-Endpoints")] +[Trait(Traits.Category, Traits.Categories.Integration)] +public class GetEventArgsTests : WebApiControllerBaseTest +{ + public GetEventArgsTests(WebApiStartupFactory fixture) + : base(fixture) + { + } + + [Fact(Skip = "Change this to a real integration-test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Files/GetFileByIdTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Files/GetFileByIdTests.verified.cs new file mode 100644 index 000000000..30ecdf169 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Files/GetFileByIdTests.verified.cs @@ -0,0 +1,21 @@ +namespace Structure1.Api.Tests.Files.MyEndpoints; + +[Collection("Sequential-Endpoints")] +[Trait(Traits.Category, Traits.Categories.Integration)] +public class GetFileByIdTests : WebApiControllerBaseTest +{ + public GetFileByIdTests(WebApiStartupFactory fixture) + : base(fixture) + { + } + + [Fact(Skip = "Change this to a real integration-test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Files/UploadMultiFilesAsFormDataTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Files/UploadMultiFilesAsFormDataTests.verified.cs new file mode 100644 index 000000000..fa82be62d --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Files/UploadMultiFilesAsFormDataTests.verified.cs @@ -0,0 +1,21 @@ +namespace Structure1.Api.Tests.Files.MyEndpoints; + +[Collection("Sequential-Endpoints")] +[Trait(Traits.Category, Traits.Categories.Integration)] +public class UploadMultiFilesAsFormDataTests : WebApiControllerBaseTest +{ + public UploadMultiFilesAsFormDataTests(WebApiStartupFactory fixture) + : base(fixture) + { + } + + [Fact(Skip = "Change this to a real integration-test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Files/UploadSingleFileAsFormDataTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Files/UploadSingleFileAsFormDataTests.verified.cs new file mode 100644 index 000000000..f6bf85519 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Files/UploadSingleFileAsFormDataTests.verified.cs @@ -0,0 +1,21 @@ +namespace Structure1.Api.Tests.Files.MyEndpoints; + +[Collection("Sequential-Endpoints")] +[Trait(Traits.Category, Traits.Categories.Integration)] +public class UploadSingleFileAsFormDataTests : WebApiControllerBaseTest +{ + public UploadSingleFileAsFormDataTests(WebApiStartupFactory fixture) + : base(fixture) + { + } + + [Fact(Skip = "Change this to a real integration-test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Files/UploadSingleObjectWithFileAsFormDataTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Files/UploadSingleObjectWithFileAsFormDataTests.verified.cs new file mode 100644 index 000000000..fb3336f79 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Files/UploadSingleObjectWithFileAsFormDataTests.verified.cs @@ -0,0 +1,21 @@ +namespace Structure1.Api.Tests.Files.MyEndpoints; + +[Collection("Sequential-Endpoints")] +[Trait(Traits.Category, Traits.Categories.Integration)] +public class UploadSingleObjectWithFileAsFormDataTests : WebApiControllerBaseTest +{ + public UploadSingleObjectWithFileAsFormDataTests(WebApiStartupFactory fixture) + : base(fixture) + { + } + + [Fact(Skip = "Change this to a real integration-test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Files/UploadSingleObjectWithFilesAsFormDataTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Files/UploadSingleObjectWithFilesAsFormDataTests.verified.cs new file mode 100644 index 000000000..e5cbacacd --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Files/UploadSingleObjectWithFilesAsFormDataTests.verified.cs @@ -0,0 +1,21 @@ +namespace Structure1.Api.Tests.Files.MyEndpoints; + +[Collection("Sequential-Endpoints")] +[Trait(Traits.Category, Traits.Categories.Integration)] +public class UploadSingleObjectWithFilesAsFormDataTests : WebApiControllerBaseTest +{ + public UploadSingleObjectWithFilesAsFormDataTests(WebApiStartupFactory fixture) + : base(fixture) + { + } + + [Fact(Skip = "Change this to a real integration-test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Items/CreateItemTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Items/CreateItemTests.verified.cs new file mode 100644 index 000000000..659687674 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Items/CreateItemTests.verified.cs @@ -0,0 +1,21 @@ +namespace Structure1.Api.Tests.Items.MyEndpoints; + +[Collection("Sequential-Endpoints")] +[Trait(Traits.Category, Traits.Categories.Integration)] +public class CreateItemTests : WebApiControllerBaseTest +{ + public CreateItemTests(WebApiStartupFactory fixture) + : base(fixture) + { + } + + [Fact(Skip = "Change this to a real integration-test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Items/UpdateItemTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Items/UpdateItemTests.verified.cs new file mode 100644 index 000000000..64d0a57fd --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Items/UpdateItemTests.verified.cs @@ -0,0 +1,21 @@ +namespace Structure1.Api.Tests.Items.MyEndpoints; + +[Collection("Sequential-Endpoints")] +[Trait(Traits.Category, Traits.Categories.Integration)] +public class UpdateItemTests : WebApiControllerBaseTest +{ + public UpdateItemTests(WebApiStartupFactory fixture) + : base(fixture) + { + } + + [Fact(Skip = "Change this to a real integration-test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Orders/GetOrderByIdTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Orders/GetOrderByIdTests.verified.cs new file mode 100644 index 000000000..82fcf27b1 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Orders/GetOrderByIdTests.verified.cs @@ -0,0 +1,21 @@ +namespace Structure1.Api.Tests.Orders.MyEndpoints; + +[Collection("Sequential-Endpoints")] +[Trait(Traits.Category, Traits.Categories.Integration)] +public class GetOrderByIdTests : WebApiControllerBaseTest +{ + public GetOrderByIdTests(WebApiStartupFactory fixture) + : base(fixture) + { + } + + [Fact(Skip = "Change this to a real integration-test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Orders/GetOrdersTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Orders/GetOrdersTests.verified.cs new file mode 100644 index 000000000..9515731bc --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Orders/GetOrdersTests.verified.cs @@ -0,0 +1,21 @@ +namespace Structure1.Api.Tests.Orders.MyEndpoints; + +[Collection("Sequential-Endpoints")] +[Trait(Traits.Category, Traits.Categories.Integration)] +public class GetOrdersTests : WebApiControllerBaseTest +{ + public GetOrdersTests(WebApiStartupFactory fixture) + : base(fixture) + { + } + + [Fact(Skip = "Change this to a real integration-test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Orders/PatchOrdersIdTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Orders/PatchOrdersIdTests.verified.cs new file mode 100644 index 000000000..acdc9f53e --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Orders/PatchOrdersIdTests.verified.cs @@ -0,0 +1,21 @@ +namespace Structure1.Api.Tests.Orders.MyEndpoints; + +[Collection("Sequential-Endpoints")] +[Trait(Traits.Category, Traits.Categories.Integration)] +public class PatchOrdersIdTests : WebApiControllerBaseTest +{ + public PatchOrdersIdTests(WebApiStartupFactory fixture) + : base(fixture) + { + } + + [Fact(Skip = "Change this to a real integration-test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/RouteWithDash/GetRouteWithDashTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/RouteWithDash/GetRouteWithDashTests.verified.cs new file mode 100644 index 000000000..ebd0dca11 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/RouteWithDash/GetRouteWithDashTests.verified.cs @@ -0,0 +1,21 @@ +namespace Structure1.Api.Tests.RouteWithDash.MyEndpoints; + +[Collection("Sequential-Endpoints")] +[Trait(Traits.Category, Traits.Categories.Integration)] +public class GetRouteWithDashTests : WebApiControllerBaseTest +{ + public GetRouteWithDashTests(WebApiStartupFactory fixture) + : base(fixture) + { + } + + [Fact(Skip = "Change this to a real integration-test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Tasks/GetTasksTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Tasks/GetTasksTests.verified.cs new file mode 100644 index 000000000..e8317d04a --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Tasks/GetTasksTests.verified.cs @@ -0,0 +1,21 @@ +namespace Structure1.Api.Tests.Tasks.MyEndpoints; + +[Collection("Sequential-Endpoints")] +[Trait(Traits.Category, Traits.Categories.Integration)] +public class GetTasksTests : WebApiControllerBaseTest +{ + public GetTasksTests(WebApiStartupFactory fixture) + : base(fixture) + { + } + + [Fact(Skip = "Change this to a real integration-test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Users/DeleteUserByIdTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Users/DeleteUserByIdTests.verified.cs new file mode 100644 index 000000000..def17600a --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Users/DeleteUserByIdTests.verified.cs @@ -0,0 +1,21 @@ +namespace Structure1.Api.Tests.Users.MyEndpoints; + +[Collection("Sequential-Endpoints")] +[Trait(Traits.Category, Traits.Categories.Integration)] +public class DeleteUserByIdTests : WebApiControllerBaseTest +{ + public DeleteUserByIdTests(WebApiStartupFactory fixture) + : base(fixture) + { + } + + [Fact(Skip = "Change this to a real integration-test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Users/GetUserByEmailTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Users/GetUserByEmailTests.verified.cs new file mode 100644 index 000000000..aae9f6a8a --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Users/GetUserByEmailTests.verified.cs @@ -0,0 +1,21 @@ +namespace Structure1.Api.Tests.Users.MyEndpoints; + +[Collection("Sequential-Endpoints")] +[Trait(Traits.Category, Traits.Categories.Integration)] +public class GetUserByEmailTests : WebApiControllerBaseTest +{ + public GetUserByEmailTests(WebApiStartupFactory fixture) + : base(fixture) + { + } + + [Fact(Skip = "Change this to a real integration-test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Users/GetUserByIdTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Users/GetUserByIdTests.verified.cs new file mode 100644 index 000000000..395ed853c --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Users/GetUserByIdTests.verified.cs @@ -0,0 +1,21 @@ +namespace Structure1.Api.Tests.Users.MyEndpoints; + +[Collection("Sequential-Endpoints")] +[Trait(Traits.Category, Traits.Categories.Integration)] +public class GetUserByIdTests : WebApiControllerBaseTest +{ + public GetUserByIdTests(WebApiStartupFactory fixture) + : base(fixture) + { + } + + [Fact(Skip = "Change this to a real integration-test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Users/GetUsersTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Users/GetUsersTests.verified.cs new file mode 100644 index 000000000..17bc489aa --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Users/GetUsersTests.verified.cs @@ -0,0 +1,21 @@ +namespace Structure1.Api.Tests.Users.MyEndpoints; + +[Collection("Sequential-Endpoints")] +[Trait(Traits.Category, Traits.Categories.Integration)] +public class GetUsersTests : WebApiControllerBaseTest +{ + public GetUsersTests(WebApiStartupFactory fixture) + : base(fixture) + { + } + + [Fact(Skip = "Change this to a real integration-test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Users/PostUserTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Users/PostUserTests.verified.cs new file mode 100644 index 000000000..1429d33cc --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Users/PostUserTests.verified.cs @@ -0,0 +1,21 @@ +namespace Structure1.Api.Tests.Users.MyEndpoints; + +[Collection("Sequential-Endpoints")] +[Trait(Traits.Category, Traits.Categories.Integration)] +public class PostUserTests : WebApiControllerBaseTest +{ + public PostUserTests(WebApiStartupFactory fixture) + : base(fixture) + { + } + + [Fact(Skip = "Change this to a real integration-test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Users/UpdateMyTestGenderTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Users/UpdateMyTestGenderTests.verified.cs new file mode 100644 index 000000000..ad047acfa --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Users/UpdateMyTestGenderTests.verified.cs @@ -0,0 +1,21 @@ +namespace Structure1.Api.Tests.Users.MyEndpoints; + +[Collection("Sequential-Endpoints")] +[Trait(Traits.Category, Traits.Categories.Integration)] +public class UpdateMyTestGenderTests : WebApiControllerBaseTest +{ + public UpdateMyTestGenderTests(WebApiStartupFactory fixture) + : base(fixture) + { + } + + [Fact(Skip = "Change this to a real integration-test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Users/UpdateUserByIdTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Users/UpdateUserByIdTests.verified.cs new file mode 100644 index 000000000..e1237e038 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Endpoints/Users/UpdateUserByIdTests.verified.cs @@ -0,0 +1,21 @@ +namespace Structure1.Api.Tests.Users.MyEndpoints; + +[Collection("Sequential-Endpoints")] +[Trait(Traits.Category, Traits.Categories.Integration)] +public class UpdateUserByIdTests : WebApiControllerBaseTest +{ + public UpdateUserByIdTests(WebApiStartupFactory fixture) + : base(fixture) + { + } + + [Fact(Skip = "Change this to a real integration-test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/EventArgs/MyEndpoints/GetEventArgByIdHandlerStub.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/EventArgs/MyEndpoints/GetEventArgByIdHandlerStub.verified.cs new file mode 100644 index 000000000..97aa2826a --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/EventArgs/MyEndpoints/GetEventArgByIdHandlerStub.verified.cs @@ -0,0 +1,20 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests.EventArgs.MyEndpoints; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetEventArgByIdHandlerStub : IGetEventArgByIdHandler +{ + public Task ExecuteAsync( + GetEventArgByIdParameters parameters, + CancellationToken cancellationToken = default) + { + var data = new Fixture().Create(); + + return Task.FromResult(GetEventArgByIdResult.Ok(data)); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/EventArgs/MyEndpoints/GetEventArgsHandlerStub.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/EventArgs/MyEndpoints/GetEventArgsHandlerStub.verified.cs new file mode 100644 index 000000000..449d26600 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/EventArgs/MyEndpoints/GetEventArgsHandlerStub.verified.cs @@ -0,0 +1,19 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests.EventArgs.MyEndpoints; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetEventArgsHandlerStub : IGetEventArgsHandler +{ + public Task ExecuteAsync( + CancellationToken cancellationToken = default) + { + var data = new Fixture().Create>(); + + return Task.FromResult(GetEventArgsResult.Ok(data)); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Files/MyEndpoints/GetFileByIdHandlerStub.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Files/MyEndpoints/GetFileByIdHandlerStub.verified.cs new file mode 100644 index 000000000..0246fcdd9 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Files/MyEndpoints/GetFileByIdHandlerStub.verified.cs @@ -0,0 +1,19 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests.Files.MyEndpoints; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetFileByIdHandlerStub : IGetFileByIdHandler +{ + public Task ExecuteAsync( + GetFileByIdParameters parameters, + CancellationToken cancellationToken = default) + { + var bytes = Encoding.UTF8.GetBytes("Hello World"); + return Task.FromResult(GetFileByIdResult.Ok(bytes, "dummy.txt")); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Files/MyEndpoints/UploadMultiFilesAsFormDataHandlerStub.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Files/MyEndpoints/UploadMultiFilesAsFormDataHandlerStub.verified.cs new file mode 100644 index 000000000..9fd0d7544 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Files/MyEndpoints/UploadMultiFilesAsFormDataHandlerStub.verified.cs @@ -0,0 +1,18 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests.Files.MyEndpoints; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UploadMultiFilesAsFormDataHandlerStub : IUploadMultiFilesAsFormDataHandler +{ + public Task ExecuteAsync( + UploadMultiFilesAsFormDataParameters parameters, + CancellationToken cancellationToken = default) + { + return Task.FromResult(UploadMultiFilesAsFormDataResult.Ok("Hallo world")); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Files/MyEndpoints/UploadSingleFileAsFormDataHandlerStub.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Files/MyEndpoints/UploadSingleFileAsFormDataHandlerStub.verified.cs new file mode 100644 index 000000000..3210f03fd --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Files/MyEndpoints/UploadSingleFileAsFormDataHandlerStub.verified.cs @@ -0,0 +1,18 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests.Files.MyEndpoints; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UploadSingleFileAsFormDataHandlerStub : IUploadSingleFileAsFormDataHandler +{ + public Task ExecuteAsync( + UploadSingleFileAsFormDataParameters parameters, + CancellationToken cancellationToken = default) + { + return Task.FromResult(UploadSingleFileAsFormDataResult.Ok("Hallo world")); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Files/MyEndpoints/UploadSingleObjectWithFileAsFormDataHandlerStub.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Files/MyEndpoints/UploadSingleObjectWithFileAsFormDataHandlerStub.verified.cs new file mode 100644 index 000000000..55010a38f --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Files/MyEndpoints/UploadSingleObjectWithFileAsFormDataHandlerStub.verified.cs @@ -0,0 +1,18 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests.Files.MyEndpoints; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UploadSingleObjectWithFileAsFormDataHandlerStub : IUploadSingleObjectWithFileAsFormDataHandler +{ + public Task ExecuteAsync( + UploadSingleObjectWithFileAsFormDataParameters parameters, + CancellationToken cancellationToken = default) + { + return Task.FromResult(UploadSingleObjectWithFileAsFormDataResult.Ok("Hallo world")); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Files/MyEndpoints/UploadSingleObjectWithFilesAsFormDataHandlerStub.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Files/MyEndpoints/UploadSingleObjectWithFilesAsFormDataHandlerStub.verified.cs new file mode 100644 index 000000000..afde72194 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Files/MyEndpoints/UploadSingleObjectWithFilesAsFormDataHandlerStub.verified.cs @@ -0,0 +1,18 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests.Files.MyEndpoints; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UploadSingleObjectWithFilesAsFormDataHandlerStub : IUploadSingleObjectWithFilesAsFormDataHandler +{ + public Task ExecuteAsync( + UploadSingleObjectWithFilesAsFormDataParameters parameters, + CancellationToken cancellationToken = default) + { + return Task.FromResult(UploadSingleObjectWithFilesAsFormDataResult.Ok("Hallo world")); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/GlobalUsings.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/GlobalUsings.verified.cs new file mode 100644 index 000000000..034ee31de --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/GlobalUsings.verified.cs @@ -0,0 +1,31 @@ +global using System.CodeDom.Compiler; +global using System.Reflection; +global using System.Text; +global using System.Text.Json; +global using System.Text.Json.Serialization; + +global using Atc.Rest.Options; +global using Atc.Rest.Results; +global using Atc.XUnit; + +global using AutoFixture; + +global using Microsoft.AspNetCore.Hosting; +global using Microsoft.AspNetCore.Http; +global using Microsoft.AspNetCore.Mvc.Testing; +global using Microsoft.AspNetCore.TestHost; +global using Microsoft.Extensions.Configuration; +global using Microsoft.Extensions.DependencyInjection; + +global using Structure1.Api.Generated; +global using Structure1.Api.Generated.Accounts.MyContracts; +global using Structure1.Api.Generated.Addresses.MyContracts; +global using Structure1.Api.Generated.EventArgs.MyContracts; +global using Structure1.Api.Generated.Files.MyContracts; +global using Structure1.Api.Generated.Items.MyContracts; +global using Structure1.Api.Generated.MyContracts; +global using Structure1.Api.Generated.Orders.MyContracts; +global using Structure1.Api.Generated.RouteWithDash.MyContracts; +global using Structure1.Api.Generated.Users.MyContracts; + +global using Xunit; \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Items/MyEndpoints/CreateItemHandlerStub.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Items/MyEndpoints/CreateItemHandlerStub.verified.cs new file mode 100644 index 000000000..6638162fe --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Items/MyEndpoints/CreateItemHandlerStub.verified.cs @@ -0,0 +1,18 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests.Items.MyEndpoints; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class CreateItemHandlerStub : ICreateItemHandler +{ + public Task ExecuteAsync( + CreateItemParameters parameters, + CancellationToken cancellationToken = default) + { + return Task.FromResult(CreateItemResult.Ok("Hallo world")); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Items/MyEndpoints/UpdateItemHandlerStub.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Items/MyEndpoints/UpdateItemHandlerStub.verified.cs new file mode 100644 index 000000000..0c6bb8ca3 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Items/MyEndpoints/UpdateItemHandlerStub.verified.cs @@ -0,0 +1,18 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests.Items.MyEndpoints; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateItemHandlerStub : IUpdateItemHandler +{ + public Task ExecuteAsync( + UpdateItemParameters parameters, + CancellationToken cancellationToken = default) + { + return Task.FromResult(UpdateItemResult.Ok(Guid.NewGuid())); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Orders/MyEndpoints/GetOrderByIdHandlerStub.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Orders/MyEndpoints/GetOrderByIdHandlerStub.verified.cs new file mode 100644 index 000000000..e87526e54 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Orders/MyEndpoints/GetOrderByIdHandlerStub.verified.cs @@ -0,0 +1,20 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests.Orders.MyEndpoints; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetOrderByIdHandlerStub : IGetOrderByIdHandler +{ + public Task ExecuteAsync( + GetOrderByIdParameters parameters, + CancellationToken cancellationToken = default) + { + var data = new Fixture().Create(); + + return Task.FromResult(GetOrderByIdResult.Ok(data)); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Orders/MyEndpoints/GetOrdersHandlerStub.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Orders/MyEndpoints/GetOrdersHandlerStub.verified.cs new file mode 100644 index 000000000..617d4e5aa --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Orders/MyEndpoints/GetOrdersHandlerStub.verified.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests.Orders.MyEndpoints; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetOrdersHandlerStub : IGetOrdersHandler +{ + public Task ExecuteAsync( + GetOrdersParameters parameters, + CancellationToken cancellationToken = default) + { + var data = new Fixture().Create>(); + + var paginationData = new Pagination( + data, + parameters.PageSize, + parameters.QueryString, + parameters.ContinuationToken); + + return Task.FromResult(GetOrdersResult.Ok(paginationData)); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Orders/MyEndpoints/PatchOrdersIdHandlerStub.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Orders/MyEndpoints/PatchOrdersIdHandlerStub.verified.cs new file mode 100644 index 000000000..c0e77579a --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Orders/MyEndpoints/PatchOrdersIdHandlerStub.verified.cs @@ -0,0 +1,18 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests.Orders.MyEndpoints; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class PatchOrdersIdHandlerStub : IPatchOrdersIdHandler +{ + public Task ExecuteAsync( + PatchOrdersIdParameters parameters, + CancellationToken cancellationToken = default) + { + return Task.FromResult(PatchOrdersIdResult.Ok("Hallo world")); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/RouteWithDash/MyEndpoints/GetRouteWithDashHandlerStub.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/RouteWithDash/MyEndpoints/GetRouteWithDashHandlerStub.verified.cs new file mode 100644 index 000000000..f4695c917 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/RouteWithDash/MyEndpoints/GetRouteWithDashHandlerStub.verified.cs @@ -0,0 +1,17 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests.RouteWithDash.MyEndpoints; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetRouteWithDashHandlerStub : IGetRouteWithDashHandler +{ + public Task ExecuteAsync( + CancellationToken cancellationToken = default) + { + return Task.FromResult(GetRouteWithDashResult.Ok("Hallo world")); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Tasks/MyEndpoints/GetTasksHandlerStub.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Tasks/MyEndpoints/GetTasksHandlerStub.verified.cs new file mode 100644 index 000000000..b03679c27 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Tasks/MyEndpoints/GetTasksHandlerStub.verified.cs @@ -0,0 +1,19 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests.Tasks.MyEndpoints; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetTasksHandlerStub : Structure1.Api.Tests.Tasks.MyEndpoints.IGetTasksHandler +{ + public Task ExecuteAsync( + CancellationToken cancellationToken = default) + { + var data = new Fixture().Create>(); + + return Task.FromResult(Structure1.Api.Tests.Tasks.MyEndpoints.GetTasksResult.Ok(data)); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Users/MyEndpoints/DeleteUserByIdHandlerStub.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Users/MyEndpoints/DeleteUserByIdHandlerStub.verified.cs new file mode 100644 index 000000000..510198942 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Users/MyEndpoints/DeleteUserByIdHandlerStub.verified.cs @@ -0,0 +1,18 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests.Users.MyEndpoints; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class DeleteUserByIdHandlerStub : IDeleteUserByIdHandler +{ + public Task ExecuteAsync( + DeleteUserByIdParameters parameters, + CancellationToken cancellationToken = default) + { + return Task.FromResult(DeleteUserByIdResult.Ok("Hallo world")); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Users/MyEndpoints/GetUserByEmailHandlerStub.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Users/MyEndpoints/GetUserByEmailHandlerStub.verified.cs new file mode 100644 index 000000000..f3b76b3ce --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Users/MyEndpoints/GetUserByEmailHandlerStub.verified.cs @@ -0,0 +1,20 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests.Users.MyEndpoints; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetUserByEmailHandlerStub : IGetUserByEmailHandler +{ + public Task ExecuteAsync( + GetUserByEmailParameters parameters, + CancellationToken cancellationToken = default) + { + var data = new Fixture().Create(); + + return Task.FromResult(GetUserByEmailResult.Ok(data)); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Users/MyEndpoints/GetUserByIdHandlerStub.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Users/MyEndpoints/GetUserByIdHandlerStub.verified.cs new file mode 100644 index 000000000..3fac45f29 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Users/MyEndpoints/GetUserByIdHandlerStub.verified.cs @@ -0,0 +1,20 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests.Users.MyEndpoints; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetUserByIdHandlerStub : IGetUserByIdHandler +{ + public Task ExecuteAsync( + GetUserByIdParameters parameters, + CancellationToken cancellationToken = default) + { + var data = new Fixture().Create(); + + return Task.FromResult(GetUserByIdResult.Ok(data)); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Users/MyEndpoints/GetUsersHandlerStub.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Users/MyEndpoints/GetUsersHandlerStub.verified.cs new file mode 100644 index 000000000..f3ba032d4 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Users/MyEndpoints/GetUsersHandlerStub.verified.cs @@ -0,0 +1,19 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests.Users.MyEndpoints; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class GetUsersHandlerStub : IGetUsersHandler +{ + public Task ExecuteAsync( + CancellationToken cancellationToken = default) + { + var data = new Fixture().Create>(); + + return Task.FromResult(GetUsersResult.Ok(data)); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Users/MyEndpoints/PostUserHandlerStub.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Users/MyEndpoints/PostUserHandlerStub.verified.cs new file mode 100644 index 000000000..22d448e22 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Users/MyEndpoints/PostUserHandlerStub.verified.cs @@ -0,0 +1,18 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests.Users.MyEndpoints; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class PostUserHandlerStub : IPostUserHandler +{ + public Task ExecuteAsync( + PostUserParameters parameters, + CancellationToken cancellationToken = default) + { + return Task.FromResult(PostUserResult.Created()); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Users/MyEndpoints/UpdateMyTestGenderHandlerStub.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Users/MyEndpoints/UpdateMyTestGenderHandlerStub.verified.cs new file mode 100644 index 000000000..82e7f0adf --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Users/MyEndpoints/UpdateMyTestGenderHandlerStub.verified.cs @@ -0,0 +1,18 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests.Users.MyEndpoints; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateMyTestGenderHandlerStub : IUpdateMyTestGenderHandler +{ + public Task ExecuteAsync( + UpdateMyTestGenderParameters parameters, + CancellationToken cancellationToken = default) + { + return Task.FromResult(UpdateMyTestGenderResult.Ok("Hallo world")); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Users/MyEndpoints/UpdateUserByIdHandlerStub.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Users/MyEndpoints/UpdateUserByIdHandlerStub.verified.cs new file mode 100644 index 000000000..e454f18be --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/Users/MyEndpoints/UpdateUserByIdHandlerStub.verified.cs @@ -0,0 +1,18 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests.Users.MyEndpoints; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public class UpdateUserByIdHandlerStub : IUpdateUserByIdHandler +{ + public Task ExecuteAsync( + UpdateUserByIdParameters parameters, + CancellationToken cancellationToken = default) + { + return Task.FromResult(UpdateUserByIdResult.Ok("Hallo world")); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/WebApiControllerBaseTest.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/WebApiControllerBaseTest.verified.cs new file mode 100644 index 000000000..6854af9ae --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/WebApiControllerBaseTest.verified.cs @@ -0,0 +1,56 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests; + +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public abstract class WebApiControllerBaseTest : IClassFixture +{ + protected readonly WebApiStartupFactory Factory; + + protected readonly HttpClient HttpClient; + + protected readonly IConfiguration Configuration; + + protected static JsonSerializerOptions? JsonSerializerOptions; + + protected WebApiControllerBaseTest(WebApiStartupFactory fixture) + { + this.Factory = fixture; + this.HttpClient = this.Factory.CreateClient(); + this.Configuration = new ConfigurationBuilder().Build(); + JsonSerializerOptions = new JsonSerializerOptions + { + PropertyNameCaseInsensitive = true, + Converters = + { + new JsonStringEnumConverter() + }, + }; + } + + protected static StringContent ToJson(object data) + => new(JsonSerializer.Serialize(data, JsonSerializerOptions), Encoding.UTF8, "application/json"); + + protected static StringContent Json(string data) + => new(data, Encoding.UTF8, "application/json"); + + protected static IFormFile GetTestFile() + { + var bytes = Encoding.UTF8.GetBytes("Hello World"); + var stream = new MemoryStream(bytes); + var formFile = new FormFile(stream, 0, stream.Length, "dummy", "dummy.txt") + { + Headers = new HeaderDictionary(), + ContentType = "application/octet-stream", + }; + + return formFile; + } + + protected static List GetTestFiles() + => new() { GetTestFile(), GetTestFile() }; +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/WebApiStartupFactory.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/WebApiStartupFactory.verified.cs new file mode 100644 index 000000000..534870e0e --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Api.Tests/WebApiStartupFactory.verified.cs @@ -0,0 +1,40 @@ +//------------------------------------------------------------------------------ +// This code was auto-generated by ApiGenerator x.x.x.x. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +//------------------------------------------------------------------------------ +namespace Structure1.Api.Tests; + +/// +/// Factory for bootstrapping in memory tests. +/// Includes options to override configuration and service collection using a partial class. +/// +[GeneratedCode("ApiGenerator", "x.x.x.x")] +public partial class WebApiStartupFactory : WebApplicationFactory +{ + protected override void ConfigureWebHost(IWebHostBuilder builder) + { + builder.ConfigureAppConfiguration(config => + { + ModifyConfiguration(config); + var integrationConfig = new ConfigurationBuilder() + .AddJsonFile("appsettings.integrationtest.json") + .Build(); + config.AddConfiguration(integrationConfig); + }); + + builder.ConfigureTestServices(services => + { + ModifyServices(services); + services.AddSingleton(); + services.AutoRegistrateServices( + Assembly.GetAssembly(typeof(ApiRegistration))!, + Assembly.GetAssembly(typeof(WebApiStartupFactory))!); + }); + } + + partial void ModifyConfiguration(IConfigurationBuilder config); + + partial void ModifyServices(IServiceCollection services); +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Accounts/MyHandlers/SetAccountNameHandlerTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Accounts/MyHandlers/SetAccountNameHandlerTests.verified.cs new file mode 100644 index 000000000..4d76dc542 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Accounts/MyHandlers/SetAccountNameHandlerTests.verified.cs @@ -0,0 +1,14 @@ +namespace Structure1.Domain.Tests.Accounts.MyHandlers; + +public class SetAccountNameHandlerTests +{ + [Fact(Skip = "Change this to a real test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Accounts/MyHandlers/UpdateAccountNameHandlerTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Accounts/MyHandlers/UpdateAccountNameHandlerTests.verified.cs new file mode 100644 index 000000000..f5c841eca --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Accounts/MyHandlers/UpdateAccountNameHandlerTests.verified.cs @@ -0,0 +1,14 @@ +namespace Structure1.Domain.Tests.Accounts.MyHandlers; + +public class UpdateAccountNameHandlerTests +{ + [Fact(Skip = "Change this to a real test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Addresses/MyHandlers/GetAddressesByPostalCodesHandlerTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Addresses/MyHandlers/GetAddressesByPostalCodesHandlerTests.verified.cs new file mode 100644 index 000000000..6ab0c28d8 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Addresses/MyHandlers/GetAddressesByPostalCodesHandlerTests.verified.cs @@ -0,0 +1,14 @@ +namespace Structure1.Domain.Tests.Addresses.MyHandlers; + +public class GetAddressesByPostalCodesHandlerTests +{ + [Fact(Skip = "Change this to a real test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/EventArgs/MyHandlers/GetEventArgByIdHandlerTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/EventArgs/MyHandlers/GetEventArgByIdHandlerTests.verified.cs new file mode 100644 index 000000000..765256080 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/EventArgs/MyHandlers/GetEventArgByIdHandlerTests.verified.cs @@ -0,0 +1,14 @@ +namespace Structure1.Domain.Tests.EventArgs.MyHandlers; + +public class GetEventArgByIdHandlerTests +{ + [Fact(Skip = "Change this to a real test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/EventArgs/MyHandlers/GetEventArgsHandlerTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/EventArgs/MyHandlers/GetEventArgsHandlerTests.verified.cs new file mode 100644 index 000000000..0084c1603 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/EventArgs/MyHandlers/GetEventArgsHandlerTests.verified.cs @@ -0,0 +1,14 @@ +namespace Structure1.Domain.Tests.EventArgs.MyHandlers; + +public class GetEventArgsHandlerTests +{ + [Fact(Skip = "Change this to a real test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Files/MyHandlers/GetFileByIdHandlerTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Files/MyHandlers/GetFileByIdHandlerTests.verified.cs new file mode 100644 index 000000000..0a2401436 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Files/MyHandlers/GetFileByIdHandlerTests.verified.cs @@ -0,0 +1,14 @@ +namespace Structure1.Domain.Tests.Files.MyHandlers; + +public class GetFileByIdHandlerTests +{ + [Fact(Skip = "Change this to a real test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Files/MyHandlers/UploadMultiFilesAsFormDataHandlerTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Files/MyHandlers/UploadMultiFilesAsFormDataHandlerTests.verified.cs new file mode 100644 index 000000000..41d7bf7d8 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Files/MyHandlers/UploadMultiFilesAsFormDataHandlerTests.verified.cs @@ -0,0 +1,14 @@ +namespace Structure1.Domain.Tests.Files.MyHandlers; + +public class UploadMultiFilesAsFormDataHandlerTests +{ + [Fact(Skip = "Change this to a real test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Files/MyHandlers/UploadSingleFileAsFormDataHandlerTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Files/MyHandlers/UploadSingleFileAsFormDataHandlerTests.verified.cs new file mode 100644 index 000000000..27ec01758 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Files/MyHandlers/UploadSingleFileAsFormDataHandlerTests.verified.cs @@ -0,0 +1,14 @@ +namespace Structure1.Domain.Tests.Files.MyHandlers; + +public class UploadSingleFileAsFormDataHandlerTests +{ + [Fact(Skip = "Change this to a real test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Files/MyHandlers/UploadSingleObjectWithFileAsFormDataHandlerTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Files/MyHandlers/UploadSingleObjectWithFileAsFormDataHandlerTests.verified.cs new file mode 100644 index 000000000..f15b9bda1 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Files/MyHandlers/UploadSingleObjectWithFileAsFormDataHandlerTests.verified.cs @@ -0,0 +1,14 @@ +namespace Structure1.Domain.Tests.Files.MyHandlers; + +public class UploadSingleObjectWithFileAsFormDataHandlerTests +{ + [Fact(Skip = "Change this to a real test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Files/MyHandlers/UploadSingleObjectWithFilesAsFormDataHandlerTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Files/MyHandlers/UploadSingleObjectWithFilesAsFormDataHandlerTests.verified.cs new file mode 100644 index 000000000..422d78547 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Files/MyHandlers/UploadSingleObjectWithFilesAsFormDataHandlerTests.verified.cs @@ -0,0 +1,14 @@ +namespace Structure1.Domain.Tests.Files.MyHandlers; + +public class UploadSingleObjectWithFilesAsFormDataHandlerTests +{ + [Fact(Skip = "Change this to a real test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/GlobalUsings.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/GlobalUsings.verified.cs new file mode 100644 index 000000000..a611174c9 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/GlobalUsings.verified.cs @@ -0,0 +1 @@ +global using Xunit; \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Items/MyHandlers/CreateItemHandlerTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Items/MyHandlers/CreateItemHandlerTests.verified.cs new file mode 100644 index 000000000..147aa5fdd --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Items/MyHandlers/CreateItemHandlerTests.verified.cs @@ -0,0 +1,14 @@ +namespace Structure1.Domain.Tests.Items.MyHandlers; + +public class CreateItemHandlerTests +{ + [Fact(Skip = "Change this to a real test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Items/MyHandlers/UpdateItemHandlerTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Items/MyHandlers/UpdateItemHandlerTests.verified.cs new file mode 100644 index 000000000..10b06df06 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Items/MyHandlers/UpdateItemHandlerTests.verified.cs @@ -0,0 +1,14 @@ +namespace Structure1.Domain.Tests.Items.MyHandlers; + +public class UpdateItemHandlerTests +{ + [Fact(Skip = "Change this to a real test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Orders/MyHandlers/GetOrderByIdHandlerTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Orders/MyHandlers/GetOrderByIdHandlerTests.verified.cs new file mode 100644 index 000000000..7d1e1c202 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Orders/MyHandlers/GetOrderByIdHandlerTests.verified.cs @@ -0,0 +1,14 @@ +namespace Structure1.Domain.Tests.Orders.MyHandlers; + +public class GetOrderByIdHandlerTests +{ + [Fact(Skip = "Change this to a real test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Orders/MyHandlers/GetOrdersHandlerTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Orders/MyHandlers/GetOrdersHandlerTests.verified.cs new file mode 100644 index 000000000..0a2a466be --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Orders/MyHandlers/GetOrdersHandlerTests.verified.cs @@ -0,0 +1,14 @@ +namespace Structure1.Domain.Tests.Orders.MyHandlers; + +public class GetOrdersHandlerTests +{ + [Fact(Skip = "Change this to a real test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Orders/MyHandlers/PatchOrdersIdHandlerTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Orders/MyHandlers/PatchOrdersIdHandlerTests.verified.cs new file mode 100644 index 000000000..119e0887a --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Orders/MyHandlers/PatchOrdersIdHandlerTests.verified.cs @@ -0,0 +1,14 @@ +namespace Structure1.Domain.Tests.Orders.MyHandlers; + +public class PatchOrdersIdHandlerTests +{ + [Fact(Skip = "Change this to a real test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/RouteWithDash/MyHandlers/GetRouteWithDashHandlerTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/RouteWithDash/MyHandlers/GetRouteWithDashHandlerTests.verified.cs new file mode 100644 index 000000000..5a860cfe0 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/RouteWithDash/MyHandlers/GetRouteWithDashHandlerTests.verified.cs @@ -0,0 +1,14 @@ +namespace Structure1.Domain.Tests.RouteWithDash.MyHandlers; + +public class GetRouteWithDashHandlerTests +{ + [Fact(Skip = "Change this to a real test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Tasks/MyHandlers/GetTasksHandlerTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Tasks/MyHandlers/GetTasksHandlerTests.verified.cs new file mode 100644 index 000000000..373c9b225 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Tasks/MyHandlers/GetTasksHandlerTests.verified.cs @@ -0,0 +1,14 @@ +namespace Structure1.Domain.Tests.Tasks.MyHandlers; + +public class GetTasksHandlerTests +{ + [Fact(Skip = "Change this to a real test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Users/MyHandlers/DeleteUserByIdHandlerTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Users/MyHandlers/DeleteUserByIdHandlerTests.verified.cs new file mode 100644 index 000000000..e15b29f06 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Users/MyHandlers/DeleteUserByIdHandlerTests.verified.cs @@ -0,0 +1,14 @@ +namespace Structure1.Domain.Tests.Users.MyHandlers; + +public class DeleteUserByIdHandlerTests +{ + [Fact(Skip = "Change this to a real test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Users/MyHandlers/GetUserByEmailHandlerTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Users/MyHandlers/GetUserByEmailHandlerTests.verified.cs new file mode 100644 index 000000000..13b459c38 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Users/MyHandlers/GetUserByEmailHandlerTests.verified.cs @@ -0,0 +1,14 @@ +namespace Structure1.Domain.Tests.Users.MyHandlers; + +public class GetUserByEmailHandlerTests +{ + [Fact(Skip = "Change this to a real test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Users/MyHandlers/GetUserByIdHandlerTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Users/MyHandlers/GetUserByIdHandlerTests.verified.cs new file mode 100644 index 000000000..0cc5461fe --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Users/MyHandlers/GetUserByIdHandlerTests.verified.cs @@ -0,0 +1,14 @@ +namespace Structure1.Domain.Tests.Users.MyHandlers; + +public class GetUserByIdHandlerTests +{ + [Fact(Skip = "Change this to a real test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Users/MyHandlers/GetUsersHandlerTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Users/MyHandlers/GetUsersHandlerTests.verified.cs new file mode 100644 index 000000000..134d6b46c --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Users/MyHandlers/GetUsersHandlerTests.verified.cs @@ -0,0 +1,14 @@ +namespace Structure1.Domain.Tests.Users.MyHandlers; + +public class GetUsersHandlerTests +{ + [Fact(Skip = "Change this to a real test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Users/MyHandlers/PostUserHandlerTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Users/MyHandlers/PostUserHandlerTests.verified.cs new file mode 100644 index 000000000..18dcae505 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Users/MyHandlers/PostUserHandlerTests.verified.cs @@ -0,0 +1,14 @@ +namespace Structure1.Domain.Tests.Users.MyHandlers; + +public class PostUserHandlerTests +{ + [Fact(Skip = "Change this to a real test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Users/MyHandlers/UpdateMyTestGenderHandlerTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Users/MyHandlers/UpdateMyTestGenderHandlerTests.verified.cs new file mode 100644 index 000000000..88f693f7d --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Users/MyHandlers/UpdateMyTestGenderHandlerTests.verified.cs @@ -0,0 +1,14 @@ +namespace Structure1.Domain.Tests.Users.MyHandlers; + +public class UpdateMyTestGenderHandlerTests +{ + [Fact(Skip = "Change this to a real test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Users/MyHandlers/UpdateUserByIdHandlerTests.verified.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Users/MyHandlers/UpdateUserByIdHandlerTests.verified.cs new file mode 100644 index 000000000..536ab855a --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/Scenarios/Structure1/VerifyServerAll/Mvc_WPD/test/Structure1.Domain.Tests/Users/MyHandlers/UpdateUserByIdHandlerTests.verified.cs @@ -0,0 +1,14 @@ +namespace Structure1.Domain.Tests.Users.MyHandlers; + +public class UpdateUserByIdHandlerTests +{ + [Fact(Skip = "Change this to a real test")] + public void Sample() + { + // Arrange + + // Act + + // Assert + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.CLI.Tests/ScenariosTests.cs b/test/Atc.Rest.ApiGenerator.CLI.Tests/ScenariosTests.cs index d8f1c8351..caa957198 100644 --- a/test/Atc.Rest.ApiGenerator.CLI.Tests/ScenariosTests.cs +++ b/test/Atc.Rest.ApiGenerator.CLI.Tests/ScenariosTests.cs @@ -22,6 +22,7 @@ public class ScenariosTests : ScenarioIntegrationTestBase, IAsyncLifetime [InlineData("ExNsWithTask")] [InlineData("ExUsers")] [InlineData("PetStore")] + [InlineData("Structure1")] public async Task ValidateYamlSpecificationByScenario( string scenarioName) { @@ -52,26 +53,31 @@ public async Task ValidateYamlSpecificationByScenario( } [Theory] - [InlineData("DemoSample", AspNetOutputType.Mvc, false)] - [InlineData("DemoSample", AspNetOutputType.Mvc, true)] - [InlineData("ExAllResponseTypes", AspNetOutputType.Mvc, false)] - [InlineData("ExAllResponseTypes", AspNetOutputType.Mvc, true)] - [InlineData("ExAsyncEnumerable", AspNetOutputType.Mvc, false)] - [InlineData("ExAsyncEnumerable", AspNetOutputType.Mvc, true)] - [InlineData("ExAsyncEnumerable", AspNetOutputType.MinimalApi, false)] - [InlineData("ExAsyncEnumerable", AspNetOutputType.MinimalApi, true)] - [InlineData("ExGenericPagination", AspNetOutputType.Mvc, false)] - [InlineData("ExGenericPagination", AspNetOutputType.Mvc, true)] - [InlineData("ExNsWithTask", AspNetOutputType.Mvc, false)] - [InlineData("ExNsWithTask", AspNetOutputType.Mvc, true)] - [InlineData("ExUsers", AspNetOutputType.Mvc, false)] - [InlineData("ExUsers", AspNetOutputType.Mvc, true)] - [InlineData("PetStore", AspNetOutputType.Mvc, false)] - [InlineData("PetStore", AspNetOutputType.Mvc, true)] + [InlineData("DemoSample", AspNetOutputType.Mvc, false, null, null, null)] + [InlineData("DemoSample", AspNetOutputType.Mvc, true, null, null, null)] + [InlineData("ExAllResponseTypes", AspNetOutputType.Mvc, false, null, null, null)] + [InlineData("ExAllResponseTypes", AspNetOutputType.Mvc, true, null, null, null)] + [InlineData("ExAsyncEnumerable", AspNetOutputType.Mvc, false, null, null, null)] + [InlineData("ExAsyncEnumerable", AspNetOutputType.Mvc, true, null, null, null)] + [InlineData("ExAsyncEnumerable", AspNetOutputType.MinimalApi, false, null, null, null)] + [InlineData("ExAsyncEnumerable", AspNetOutputType.MinimalApi, true, null, null, null)] + [InlineData("ExGenericPagination", AspNetOutputType.Mvc, false, null, null, null)] + [InlineData("ExGenericPagination", AspNetOutputType.Mvc, true, null, null, null)] + [InlineData("ExNsWithTask", AspNetOutputType.Mvc, false, null, null, null)] + [InlineData("ExNsWithTask", AspNetOutputType.Mvc, true, null, null, null)] + [InlineData("ExUsers", AspNetOutputType.Mvc, false, null, null, null)] + [InlineData("ExUsers", AspNetOutputType.Mvc, true, null, null, null)] + [InlineData("PetStore", AspNetOutputType.Mvc, false, null, null, null)] + [InlineData("PetStore", AspNetOutputType.Mvc, true, null, null, null)] + [InlineData("Structure1", AspNetOutputType.Mvc, false, "[[apiGroupName]].MyContracts", "[[apiGroupName]].MyEndpoints", "[[apiGroupName]].MyHandlers")] + [InlineData("Structure1", AspNetOutputType.Mvc, true, "[[apiGroupName]].MyContracts", "[[apiGroupName]].MyEndpoints", "[[apiGroupName]].MyHandlers")] public async Task GenerateVerifyAndBuildForServerAllByScenario( string scenarioName, AspNetOutputType aspNetOutputType, - bool useProblemDetailsAsDefaultResponseBody) + bool useProblemDetailsAsDefaultResponseBody, + string? contractsLocation, + string? endpointsLocation, + string? handlersLocation) { // Arrange var scenarioPath = CollectScenarioPaths().First(x => x.Name == scenarioName); @@ -85,31 +91,35 @@ public async Task GenerateVerifyAndBuildForServerAllByScenario( } // Act & Assert - await AssertGenerateForServerAll(outputPath, scenarioPath, specificationFile, aspNetOutputType, useProblemDetailsAsDefaultResponseBody); + await AssertGenerateForServerAll(outputPath, scenarioPath, specificationFile, aspNetOutputType, useProblemDetailsAsDefaultResponseBody, contractsLocation, endpointsLocation, handlersLocation); await AssertVerifyCsFilesForServerAll(outputPath, scenarioPath, aspNetOutputType, useProblemDetailsAsDefaultResponseBody); await AssertBuildForServerAll(outputPath, scenarioPath); } [Theory] - [InlineData("DemoSample", false, false)] - [InlineData("DemoSample", true, false)] - [InlineData("ExAllResponseTypes", false, false)] - [InlineData("ExAllResponseTypes", true, false)] - [InlineData("ExAsyncEnumerable", false, false)] - [InlineData("ExAsyncEnumerable", true, false)] - [InlineData("ExGenericPagination", false, false)] - [InlineData("ExGenericPagination", true, false)] - [InlineData("ExNsWithTask", false, false)] - [InlineData("ExNsWithTask", true, false)] - [InlineData("ExUsers", false, false)] - [InlineData("ExUsers", true, false)] - [InlineData("PetStore", false, false)] - [InlineData("PetStore", true, false)] - [InlineData("Monta", false, true)] + [InlineData("DemoSample", false, false, null, null)] + [InlineData("DemoSample", true, false, null, null)] + [InlineData("ExAllResponseTypes", false, false, null, null)] + [InlineData("ExAllResponseTypes", true, false, null, null)] + [InlineData("ExAsyncEnumerable", false, false, null, null)] + [InlineData("ExAsyncEnumerable", true, false, null, null)] + [InlineData("ExGenericPagination", false, false, null, null)] + [InlineData("ExGenericPagination", true, false, null, null)] + [InlineData("ExNsWithTask", false, false, null, null)] + [InlineData("ExNsWithTask", true, false, null, null)] + [InlineData("ExUsers", false, false, null, null)] + [InlineData("ExUsers", true, false, null, null)] + [InlineData("PetStore", false, false, null, null)] + [InlineData("PetStore", true, false, null, null)] + [InlineData("Monta", false, true, null, null)] + [InlineData("Structure1", false, false, "[[apiGroupName]].MyContracts", "[[apiGroupName]].MyEndpoints")] + [InlineData("Structure1", true, false, "[[apiGroupName]].MyContracts", "[[apiGroupName]].MyEndpoints")] public async Task GenerateVerifyAndBuildForClientCSharpByScenario( string scenarioName, bool useProblemDetailsAsDefaultResponseBody, - bool useCustomErrorResponseModel) + bool useCustomErrorResponseModel, + string? contractsLocation, + string? endpointsLocation) { // Arrange var scenarioPath = CollectScenarioPaths().First(x => x.Name == scenarioName); @@ -124,7 +134,7 @@ public async Task GenerateVerifyAndBuildForClientCSharpByScenario( } // Act & Assert - await AssertGenerateForClientCSharp(outputPath, scenarioPath, specificationFile, optionsFile, useProblemDetailsAsDefaultResponseBody, useCustomErrorResponseModel); + await AssertGenerateForClientCSharp(outputPath, scenarioPath, specificationFile, optionsFile, useProblemDetailsAsDefaultResponseBody, useCustomErrorResponseModel, contractsLocation, endpointsLocation); await AssertVerifyCsFilesForClientCSharp(outputPath, scenarioPath, useProblemDetailsAsDefaultResponseBody, useCustomErrorResponseModel); } @@ -247,7 +257,10 @@ private static async Task AssertGenerateForServerAll( DirectoryInfo scenarioPath, FileInfo specificationFile, AspNetOutputType aspNetOutputType, - bool useProblemDetailsAsDefaultResponseBody) + bool useProblemDetailsAsDefaultResponseBody, + string? contractsLocation, + string? endpointsLocation, + string? handlersLocation) { var sbCommands = new StringBuilder(); sbCommands.Append("generate server all"); @@ -268,6 +281,24 @@ private static async Task AssertGenerateForServerAll( sbCommands.Append(" --useProblemDetailsAsDefaultResponseBody"); } + if (contractsLocation is not null) + { + sbCommands.Append(" --contractsLocation "); + sbCommands.Append(contractsLocation); + } + + if (endpointsLocation is not null) + { + sbCommands.Append(" --endpointsLocation "); + sbCommands.Append(endpointsLocation); + } + + if (handlersLocation is not null) + { + sbCommands.Append(" --handlersLocation "); + sbCommands.Append(handlersLocation); + } + sbCommands.Append(" --verbose"); var (isSuccessful, output) = await ProcessHelper.Execute(cliExeFile!, sbCommands.ToString()); @@ -336,12 +367,9 @@ private static async Task AssertVerifyCsFilesForServerAll( Assert.True( outputCsFilesWithRelativePath.Length == verifyCsFilesWithRelativePath.Length, $"Different count on *.cs files, " + - $"verify.count={verifyCsFilesWithRelativePath.Length} and " + - $"generated.count={outputCsFilesWithRelativePath.Length} for scenario '{scenarioPath.Name}'. " + - $"\n\nFiles only in output:" + - $"\n\t{string.Join("\n\t", onlyInOutput)}" + - $"\n\nFiles only in verify:" + - $"\n\t{string.Join("\n\t", onlyInVerify)}\n"); + $"verify.count={verifyCsFilesWithRelativePath.Length} and generated.count={outputCsFilesWithRelativePath.Length} for scenario '{scenarioPath.Name}'. " + + $"\n\nFiles only in output:\n\t{string.Join("\n\t", onlyInOutput)}" + + $"\n\nFiles only in verify:\n\t{string.Join("\n\t", onlyInVerify)}\n"); } private static async Task AssertBuildForServerAll( @@ -364,7 +392,9 @@ private static async Task AssertGenerateForClientCSharp( FileInfo specificationFile, FileInfo? optionsFile, bool useProblemDetailsAsDefaultResponseBody, - bool useCustomErrorResponseModel) + bool useCustomErrorResponseModel, + string? contractsLocation, + string? endpointsLocation) { var sbCommands = new StringBuilder(); sbCommands.Append("generate client csharp"); @@ -386,6 +416,18 @@ private static async Task AssertGenerateForClientCSharp( sbCommands.Append(optionsFile.FullName); } + if (contractsLocation is not null) + { + sbCommands.Append(" --contractsLocation "); + sbCommands.Append(contractsLocation); + } + + if (endpointsLocation is not null) + { + sbCommands.Append(" --endpointsLocation "); + sbCommands.Append(endpointsLocation); + } + sbCommands.Append(" --verbose"); var (isSuccessful, output) = await ProcessHelper.Execute(cliExeFile!, sbCommands.ToString()); @@ -446,21 +488,25 @@ private static async Task AssertVerifyCsFilesForClientCSharp( .ToArray(); var verifyCsFilesWithRelativePath = verifyCsFiles.Select(x => x.FullName) - .Select(x => Path.GetRelativePath(scenarioPath.CombineFileInfo("VerifyServerAll", suffix).FullName, x)) + .Select(x => Path.GetRelativePath(scenarioPath.CombineFileInfo("VerifyClient", suffix).FullName, x)) .ToArray(); - var onlyInOutput = outputCsFilesWithRelativePath.Except(verifyCsFilesWithRelativePath, StringComparer.Ordinal).ToArray(); - var onlyInVerify = verifyCsFilesWithRelativePath.Except(outputCsFilesWithRelativePath, StringComparer.Ordinal).ToArray(); + var onlyInOutput = outputCsFilesWithRelativePath + .Except(verifyCsFilesWithRelativePath, StringComparer.Ordinal) + .OrderBy(x => x, StringComparer.Ordinal) + .ToArray(); + + var onlyInVerify = verifyCsFilesWithRelativePath + .Except(outputCsFilesWithRelativePath, StringComparer.Ordinal) + .OrderBy(x => x, StringComparer.Ordinal) + .ToArray(); Assert.True( outputCsFilesWithRelativePath.Length == verifyCsFilesWithRelativePath.Length, $"Different count on *.cs files, " + - $"verify.count={verifyCsFilesWithRelativePath.Length} and " + - $"generated.count={outputCsFilesWithRelativePath.Length} for scenario '{scenarioPath.Name}'. " + - $"\n\nFiles only in output:" + - $"\n\t{string.Join("\n\t", onlyInOutput)}" + - $"\n\nFiles only in verify:" + - $"\n\t{string.Join("\n\t", onlyInVerify)}\n"); + $"verify.count={verifyCsFilesWithRelativePath.Length} and generated.count={outputCsFilesWithRelativePath.Length} for scenario '{scenarioPath.Name}'. " + + $"\n\nFiles only in output:\n\t{string.Join("\n\t", onlyInOutput)}" + + $"\n\nFiles only in verify:\n\t{string.Join("\n\t", onlyInVerify)}\n"); } public Task InitializeAsync() diff --git a/test/Atc.Rest.ApiGenerator.Framework.Tests/Atc.Rest.ApiGenerator.Framework.Tests.csproj b/test/Atc.Rest.ApiGenerator.Framework.Tests/Atc.Rest.ApiGenerator.Framework.Tests.csproj index c25a64a96..9184a1fe1 100644 --- a/test/Atc.Rest.ApiGenerator.Framework.Tests/Atc.Rest.ApiGenerator.Framework.Tests.csproj +++ b/test/Atc.Rest.ApiGenerator.Framework.Tests/Atc.Rest.ApiGenerator.Framework.Tests.csproj @@ -6,6 +6,7 @@ + @@ -18,4 +19,8 @@ + + + + diff --git a/test/Atc.Rest.ApiGenerator.Framework.Tests/Factories/FileInfoFactoryTests.cs b/test/Atc.Rest.ApiGenerator.Framework.Tests/Factories/FileInfoFactoryTests.cs new file mode 100644 index 000000000..2b2788771 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.Framework.Tests/Factories/FileInfoFactoryTests.cs @@ -0,0 +1,44 @@ +namespace Atc.Rest.ApiGenerator.Framework.Tests.Factories; + +[Trait(Traits.Category, Traits.Categories.Integration)] +public class FileInfoFactoryTests +{ + [Theory] + [InlineData(@"C:\Project", new[] { "SubFolder", "File.cs" }, @"C:\Project\SubFolder\File.cs")] + [InlineData(@"C:\Project", new[] { "Folder-With-Dashes", "File.cs" }, @"C:\Project\Folder\With\Dashes\File.cs")] + [InlineData(@"C:\Project", new[] { "nested.folder", "File.cs" }, @"C:\Project\Nested\Folder\File.cs")] + [InlineData(@"C:\Project", new[] { "_shared", "File.cs" }, @"C:\Project\_Shared\File.cs")] + [InlineData(@"C:\Project", new[] { "_enumerationTypes", "File.cs" }, @"C:\Project\_EnumerationTypes\File.cs")] + [InlineData(@"C:\Project", new[] { "folder", "Users", "MyUser.cs" }, @"C:\Project\Folder\Users\MyUser.cs")] + [InlineData(@"C:\Project", new[] { "nested.folder", "Users", "MyUser.cs" }, @"C:\Project\Nested\Folder\Users\MyUser.cs")] + [InlineData(@"C:\Project", new[] { @"nested\folder", "Users", "MyUser.cs" }, @"C:\Project\Nested\Folder\Users\MyUser.cs")] + [InlineData(@"C:\Project", new[] { ".", "Users", "MyUser.cs" }, @"C:\Project\Users\MyUser.cs")] + public void Create_ShouldReturnCorrectFileInfo( + string projectPath, + string[] subParts, + string expectedFilePath) + { + // Arrange + var directoryInfo = new DirectoryInfo(projectPath); + + // Act + var fileInfo = FileInfoFactory.Create(directoryInfo, subParts); + + // Assert + Assert.Equal(expectedFilePath, fileInfo.FullName); + } + + [Theory] + [InlineData(@"C:\Project", new string[] { })] + [InlineData(@"C:\Project", new[] { "SubFolder", "FileWithoutExtension" })] + public void Create_ShouldThrowException( + string projectPath, + string[] subParts) + { + // Arrange + var directoryInfo = new DirectoryInfo(projectPath); + + // Act & Assert + Assert.Throws(() => FileInfoFactory.Create(directoryInfo, subParts)); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.Framework.Tests/Factories/LocationFactoryTests.cs b/test/Atc.Rest.ApiGenerator.Framework.Tests/Factories/LocationFactoryTests.cs new file mode 100644 index 000000000..72418c7a0 --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.Framework.Tests/Factories/LocationFactoryTests.cs @@ -0,0 +1,90 @@ +namespace Atc.Rest.ApiGenerator.Framework.Tests.Factories; + +public class LocationFactoryTests +{ + [Theory] + [InlineData("MyProject.Folder.[[apiGroupName]].MyUser", "Users", "MyProject.Folder.Users.MyUser")] + [InlineData("MyProject.[[apiGroupName]].MyUser", "Users", "MyProject.Users.MyUser")] + [InlineData("[[apiGroupName]].MyUser", "Users", "Users.MyUser")] + public void CreateWithApiGroupName_ShouldReturnCorrect_Location( + string value, + string apiGroupName, + string expected) + { + // Act + var result = LocationFactory.CreateWithApiGroupName(apiGroupName, value); + + // Assert + Assert.Equal(expected, result); + } + + [Theory] + [InlineData("MyProject.Folder.TemplateForApiGroupName.MyUser", "MyProject.Folder.TemplateForApiGroupName.MyUser")] + [InlineData("MyProject.TemplateForApiGroupName.MyUser", "MyProject.TemplateForApiGroupName.MyUser")] + [InlineData("TemplateForApiGroupName.MyUser", "TemplateForApiGroupName.MyUser")] + public void CreateWithoutTemplateForApiGroupName_ShouldRemoveTemplateKey( + string value, + string expected) + { + // Act + var result = LocationFactory.CreateWithoutTemplateForApiGroupName(value); + + // Assert + Assert.Equal(expected, result); + } + + [Fact] + public void CreateWithoutTemplateForApiGroupName_ShouldReturnEmpty_WhenValueIsNull() + { + // Act + var result = LocationFactory.CreateWithoutTemplateForApiGroupName(null!); + + // Assert + Assert.Equal(string.Empty, result); + } + + [Theory] + [InlineData(new[] { "MyProject", "folder", "[[apiGroupName]]", "MyUser" }, "Users", "MyProject.Folder.Users.MyUser")] + [InlineData(new[] { "MyProject", "nested.folder", "[[apiGroupName]]", "MyUser" }, "Users", "MyProject.Nested.Folder.Users.MyUser")] + [InlineData(new[] { "MyProject", @"nested\folder", "[[apiGroupName]]", "MyUser" }, "Users", "MyProject.Nested.Folder.Users.MyUser")] + [InlineData(new[] { "MyProject", ".", "[[apiGroupName]]", "MyUser" }, "Users", "MyProject.Users.MyUser")] + [InlineData(new[] { "MyProject", ".", "MyUser" }, "Users", "MyProject.MyUser.Users")] + public void Create_WithTemplateItems_ShouldReturnCorrect_Location( + string[] values, + string apiGroupName, + string expected) + { + // Act + var result = LocationFactory.Create( + new List { new("apiGroupName", apiGroupName) }, + values); + + // Assert + Assert.Equal(expected, result); + } + + [Fact] + public void Create_WithNullValues_ShouldReturnEmptyString() + { + // Act + var result = LocationFactory.Create( + new List { new("apiGroupName", "Users") }, + null!); + + // Assert + Assert.Equal(string.Empty, result); + } + + [Fact] + public void Create_WithEmptyTemplateItems_ShouldReturnJoinedValues() + { + // Arrange + var values = new[] { "MyProject", "folder", "MyUser" }; + + // Act + var result = LocationFactory.Create(new List(), values); + + // Assert + Assert.Equal("MyProject.Folder.MyUser", result); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.Framework.Tests/Factories/NamespaceFactoryTests.cs b/test/Atc.Rest.ApiGenerator.Framework.Tests/Factories/NamespaceFactoryTests.cs new file mode 100644 index 000000000..49961cb6d --- /dev/null +++ b/test/Atc.Rest.ApiGenerator.Framework.Tests/Factories/NamespaceFactoryTests.cs @@ -0,0 +1,27 @@ +namespace Atc.Rest.ApiGenerator.Framework.Tests.Factories; + +public class NamespaceFactoryTests +{ + [Theory] + [InlineData(new string[] { }, "")] + [InlineData(new[] { "MyNamespace" }, "MyNamespace")] + [InlineData(new[] { "MyNamespace", "SubNamespace" }, "MyNamespace.SubNamespace")] + [InlineData(new[] { "MyProject" }, "MyProject")] + [InlineData(new[] { "", "SubNamespace1" }, "SubNamespace1")] + [InlineData(new[] { "MyProject", "SubNamespace1" }, "MyProject.SubNamespace1")] + [InlineData(new[] { "MyProject", "SubNamespace1", "SubNamespace2" }, "MyProject.SubNamespace1.SubNamespace2")] + [InlineData(new[] { "MyProject", "folder", "Users", "MyUser" }, "MyProject.Folder.Users.MyUser")] + [InlineData(new[] { "MyProject", "nested.folder", "Users", "MyUser" }, "MyProject.Nested.Folder.Users.MyUser")] + [InlineData(new[] { "MyProject", @"nested\folder", "Users", "MyUser" }, "MyProject.Nested.Folder.Users.MyUser")] + [InlineData(new[] { "MyProject", ".", "Users", "MyUser" }, "MyProject.Users.MyUser")] + public void Create_ShouldReturnCorrect_Namespace( + string[] values, + string expected) + { + // Act + var result = NamespaceFactory.Create(values); + + // Assert + Assert.Equal(expected, result); + } +} \ No newline at end of file diff --git a/test/Atc.Rest.ApiGenerator.Framework.Tests/GlobalUsings.cs b/test/Atc.Rest.ApiGenerator.Framework.Tests/GlobalUsings.cs index ed971978b..f958d79c6 100644 --- a/test/Atc.Rest.ApiGenerator.Framework.Tests/GlobalUsings.cs +++ b/test/Atc.Rest.ApiGenerator.Framework.Tests/GlobalUsings.cs @@ -1 +1,4 @@ -global using System.Diagnostics.CodeAnalysis; \ No newline at end of file +global using System.Diagnostics.CodeAnalysis; +global using Atc.Data.Models; +global using Atc.Rest.ApiGenerator.Framework.Factories; +global using Atc.XUnit; \ No newline at end of file